ymy-components 0.0.49 → 0.0.50
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/bottom-sheet/BottomSheet.d.ts +8 -0
- package/dist/bottom-sheet/BottomSheet.styles.d.ts +5 -0
- package/dist/bottom-sheet/BottomSheet.types.d.ts +17 -0
- package/dist/constants/spring.config.d.ts +25 -0
- package/dist/hooks/useReducedMotion.d.ts +6 -0
- package/dist/hooks/useReportPosition.d.ts +27 -0
- package/dist/hooks/useViewportSize.d.ts +11 -0
- package/dist/index.cjs.js +334 -42
- package/dist/index.d.ts +16 -0
- package/dist/index.es.js +3603 -1924
- package/dist/keyboard/ZhuyinKeyboard.d.ts +7 -0
- package/dist/keyboard/ZhuyinKeyboard.styles.d.ts +20 -0
- package/dist/keyboard/ZhuyinKeyboard.types.d.ts +21 -0
- package/dist/loading/LoadingScreen.d.ts +8 -0
- package/dist/loading/LoadingScreen.styles.d.ts +1134 -0
- package/dist/loading/LoadingScreen.types.d.ts +14 -0
- package/dist/picker/OptionPicker.d.ts +8 -0
- package/dist/picker/OptionPicker.styles.d.ts +12 -0
- package/dist/picker/OptionPicker.types.d.ts +19 -0
- package/dist/utils/throttle.d.ts +15 -0
- package/package.json +3 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { BottomSheetProps } from './BottomSheet.types';
|
|
3
|
+
/**
|
|
4
|
+
* Draggable bottom sheet modal with gesture support.
|
|
5
|
+
* Features rubber-band physics, velocity-based swipe detection, and smooth animations.
|
|
6
|
+
*/
|
|
7
|
+
export declare function BottomSheet({ isOpen, onClose, children, title, maxHeight, velocityThreshold, closeThreshold, }: BottomSheetProps): ReactElement;
|
|
8
|
+
export default BottomSheet;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const SheetOverlay: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
2
|
+
export declare const SheetContent: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const SheetHandle: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
|
+
export declare const SheetBody: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
|
+
export declare const VisuallyHidden: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface BottomSheetProps {
|
|
3
|
+
/** Whether the sheet is open */
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
/** Callback when the sheet should close */
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
/** Content to render inside the sheet */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** Accessible title for screen readers */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Max height of the sheet (default: 300) */
|
|
12
|
+
maxHeight?: number;
|
|
13
|
+
/** Velocity threshold for swipe-to-close in px/ms (default: 0.4) */
|
|
14
|
+
velocityThreshold?: number;
|
|
15
|
+
/** Percentage of height drag required to close (default: 0.25) */
|
|
16
|
+
closeThreshold?: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SpringConfig } from '@react-spring/web';
|
|
2
|
+
/**
|
|
3
|
+
* Shared React Spring configuration constants.
|
|
4
|
+
* Centralizes animation configs for consistent feel across applications.
|
|
5
|
+
*/
|
|
6
|
+
/** Base comfortable config - smooth, relaxed animations */
|
|
7
|
+
export declare const SPRING_COMFORTABLE: SpringConfig;
|
|
8
|
+
/** Slower comfortable variant for background/gradient transitions */
|
|
9
|
+
export declare const SPRING_COMFORTABLE_SLOW: SpringConfig;
|
|
10
|
+
/** Snappy config - quick, responsive animations */
|
|
11
|
+
export declare const SPRING_SNAPPY: SpringConfig;
|
|
12
|
+
/** Responsive config - for UI elements that need quick feedback */
|
|
13
|
+
export declare const SPRING_RESPONSIVE: SpringConfig;
|
|
14
|
+
/** Staggered/lagged config - for cascading animations */
|
|
15
|
+
export declare const SPRING_STAGGERED: SpringConfig;
|
|
16
|
+
/** Instant config - near-immediate transitions */
|
|
17
|
+
export declare const SPRING_INSTANT: SpringConfig;
|
|
18
|
+
/** Gentle config - subtle, unobtrusive animations */
|
|
19
|
+
export declare const SPRING_GENTLE: SpringConfig;
|
|
20
|
+
/** Very slow config - for delayed/transitional animations */
|
|
21
|
+
export declare const SPRING_VERY_SLOW: SpringConfig;
|
|
22
|
+
/** Landing config - for "settling" hero animations with slight overshoot */
|
|
23
|
+
export declare const SPRING_LANDING: SpringConfig;
|
|
24
|
+
/** Rising config - for reverse hero animations, smoother deceleration */
|
|
25
|
+
export declare const SPRING_RISING: SpringConfig;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RefCallback } from 'react';
|
|
2
|
+
export interface SerializableRect {
|
|
3
|
+
top: number;
|
|
4
|
+
left: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
right: number;
|
|
8
|
+
bottom: number;
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}
|
|
12
|
+
export interface UseReportPositionOptions {
|
|
13
|
+
/** When false, position tracking is paused (default: true) */
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
/** Include margins in height calculation (default: true) */
|
|
16
|
+
includeMargins?: boolean;
|
|
17
|
+
/** Throttle interval in ms (default: 16 for ~60fps) */
|
|
18
|
+
throttleMs?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Hook to track an element's position and report changes via callback.
|
|
22
|
+
* Uses ResizeObserver and scroll/resize listeners with throttling.
|
|
23
|
+
* @param onPositionChange - Callback fired when position changes meaningfully (>0.5px)
|
|
24
|
+
* @param options - Configuration options
|
|
25
|
+
* @returns RefCallback to attach to the target element
|
|
26
|
+
*/
|
|
27
|
+
export declare function useReportPosition(onPositionChange: (rect: SerializableRect) => void, options?: UseReportPositionOptions): RefCallback<HTMLElement>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ViewportSize {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Hook to track viewport dimensions with debounced updates.
|
|
7
|
+
* Listens to resize and orientation change events.
|
|
8
|
+
* @param debounceMs - Debounce delay in milliseconds (default: 100)
|
|
9
|
+
* @returns ViewportSize - Current viewport width and height
|
|
10
|
+
*/
|
|
11
|
+
export declare function useViewportSize(debounceMs?: number): ViewportSize;
|