@platform-blocks/ui 0.3.0 → 0.4.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.
- package/lib/cjs/index.js +5378 -2406
- package/lib/cjs/index.js.map +1 -1
- package/lib/components/Accordion/hooks/useAccordionItemAnimation.d.ts +8 -10
- package/lib/components/Avatar/types.d.ts +9 -0
- package/lib/components/Calendar/types.d.ts +2 -1
- package/lib/components/Can/types.d.ts +6 -4
- package/lib/components/CodeBlock/CodeBlock.d.ts +0 -12
- package/lib/components/CodeBlock/types.d.ts +19 -0
- package/lib/components/CodeBlock/utils.d.ts +4 -13
- package/lib/components/Collapse/Collapse.d.ts +4 -0
- package/lib/components/Collapse/index.d.ts +2 -0
- package/lib/components/{Reveal → Collapse}/types.d.ts +9 -5
- package/lib/components/ColorPicker/styles.d.ts +1 -0
- package/lib/components/GradientText/GradientText.d.ts +1 -10
- package/lib/components/GradientText/types.d.ts +1 -9
- package/lib/components/Input/styles.d.ts +2 -2
- package/lib/components/Input/types.d.ts +4 -3
- package/lib/components/Knob/Knob.d.ts +22 -3
- package/lib/components/Knob/appearance.d.ts +56 -0
- package/lib/components/Knob/arc.d.ts +21 -0
- package/lib/components/Knob/components/KnobSurface.d.ts +30 -0
- package/lib/components/Knob/components/PointerLayer.d.ts +13 -0
- package/lib/components/Knob/components/SurfaceLayers.d.ts +38 -0
- package/lib/components/Knob/components/ThumbLayer.d.ts +14 -0
- package/lib/components/Knob/components/TickLayers.d.ts +27 -0
- package/lib/components/Knob/components/ValueLabelLayout.d.ts +18 -0
- package/lib/components/Knob/hooks/useKnobGeometry.d.ts +16 -0
- package/lib/components/Knob/hooks/useKnobGestures.d.ts +28 -0
- package/lib/components/Knob/hooks/useKnobInteraction.d.ts +29 -0
- package/lib/components/Knob/hooks/useKnobValue.d.ts +31 -0
- package/lib/components/Knob/hooks/useKnobValueLabels.d.ts +20 -0
- package/lib/components/Knob/index.d.ts +1 -1
- package/lib/components/Knob/interactionConfig.d.ts +22 -0
- package/lib/components/Knob/styles.d.ts +93 -0
- package/lib/components/Knob/types.d.ts +247 -1
- package/lib/components/Knob/utils/geometry.d.ts +6 -0
- package/lib/components/Knob/utils/marks.d.ts +4 -0
- package/lib/components/Knob/utils/math.d.ts +1 -0
- package/lib/components/ListGroup/types.d.ts +2 -2
- package/lib/components/Markdown/Markdown.d.ts +5 -0
- package/lib/components/Menu/styles.d.ts +2 -2
- package/lib/components/Menu/types.d.ts +2 -2
- package/lib/components/MenuItemButton/MenuItemButton.d.ts +4 -3
- package/lib/components/Notice/Notice.d.ts +2 -0
- package/lib/components/Notice/index.d.ts +2 -0
- package/lib/components/{Alert → Notice}/types.d.ts +9 -9
- package/lib/components/QRCode/types.d.ts +0 -6
- package/lib/components/Radio/types.d.ts +2 -0
- package/lib/components/Rating/types.d.ts +2 -1
- package/lib/components/Search/types.d.ts +3 -3
- package/lib/components/ShimmerText/ShimmerText.d.ts +2 -32
- package/lib/components/ShimmerText/types.d.ts +18 -10
- package/lib/components/Spotlight/Spotlight.d.ts +2 -2
- package/lib/components/Spotlight/types.d.ts +3 -3
- package/lib/components/Switch/types.d.ts +2 -1
- package/lib/components/Text/Text.d.ts +3 -4
- package/lib/components/Text/index.d.ts +1 -1
- package/lib/components/Toast/ToastProvider.d.ts +1 -8
- package/lib/components/Toast/index.d.ts +1 -1
- package/lib/components/Toggle/types.d.ts +2 -1
- package/lib/components/Tree/types.d.ts +2 -0
- package/lib/components/{Disclaimer → _internal/Disclaimer}/Disclaimer.d.ts +2 -2
- package/lib/components/_internal/Reveal/Reveal.d.ts +0 -0
- package/lib/components/_internal/Reveal/index.d.ts +0 -0
- package/lib/components/_internal/Reveal/types.d.ts +0 -0
- package/lib/components/index.d.ts +8 -11
- package/lib/components/optimized.d.ts +10 -1
- package/lib/components/types.d.ts +1 -2
- package/lib/core/components/InputContainer.d.ts +3 -3
- package/lib/core/factory/factory.d.ts +3 -1
- package/lib/core/factory/polymorphicFactory.d.ts +4 -3
- package/lib/core/utils/index.d.ts +1 -1
- package/lib/core/utils/positioning-enhanced.d.ts +0 -18
- package/lib/core/utils/spacing.d.ts +3 -4
- package/lib/core/utils/universal.d.ts +1 -2
- package/lib/core/utils/universalSimple.d.ts +1 -2
- package/lib/core/utils/withUniversalProps.d.ts +1 -1
- package/lib/esm/index.js +5379 -2405
- package/lib/esm/index.js.map +1 -1
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/useDeviceInfo/index.d.ts +108 -0
- package/lib/hooks/useEscapeKey/index.d.ts +1 -0
- package/lib/hooks/useGlobalHotkeys/index.d.ts +1 -0
- package/lib/hooks/{useMaskedInput.d.ts → useMaskedInput/index.d.ts} +1 -1
- package/lib/hooks/useMaskedInput/utils/mask.d.ts +138 -0
- package/lib/hooks/useOverlayMode/index.d.ts +29 -0
- package/lib/hooks/useSpotlightToggle/index.d.ts +1 -0
- package/lib/hooks/useToggleColorScheme/index.d.ts +1 -0
- package/lib/index.d.ts +12 -11
- package/lib/utils/mask.d.ts +1 -138
- package/package.json +10 -10
- package/lib/components/Alert/Alert.d.ts +0 -2
- package/lib/components/Alert/index.d.ts +0 -2
- package/lib/components/CodeBlock/type.d.ts +0 -40
- package/lib/components/Container/Container.d.ts +0 -3
- package/lib/components/Container/index.d.ts +0 -2
- package/lib/components/Container/types.d.ts +0 -31
- package/lib/components/Forms/ContactForm.d.ts +0 -3
- package/lib/components/Forms/ForgotPasswordForm.d.ts +0 -3
- package/lib/components/Forms/LoginForm.d.ts +0 -3
- package/lib/components/Forms/SignupForm.d.ts +0 -3
- package/lib/components/Forms/index.d.ts +0 -5
- package/lib/components/Forms/types.d.ts +0 -89
- package/lib/components/Reveal/Reveal.d.ts +0 -4
- package/lib/components/Reveal/index.d.ts +0 -2
- /package/lib/components/{Accessibility → _internal/Accessibility}/AccessibilityDemo.d.ts +0 -0
- /package/lib/components/{Accessibility → _internal/Accessibility}/AccessibilityHelpers.d.ts +0 -0
- /package/lib/components/{Accessibility → _internal/Accessibility}/AccessibilityTesting.d.ts +0 -0
- /package/lib/components/{Accessibility → _internal/Accessibility}/AccessibleComponents.d.ts +0 -0
- /package/lib/components/{Accessibility → _internal/Accessibility}/index.d.ts +0 -0
- /package/lib/components/{Disclaimer → _internal/Disclaimer}/disclaimerUtils.d.ts +0 -0
- /package/lib/components/{Disclaimer → _internal/Disclaimer}/index.d.ts +0 -0
- /package/lib/components/{Disclaimer → _internal/Disclaimer}/withDisclaimer.d.ts +0 -0
- /package/lib/components/{PressAnimation → _internal/PressAnimation}/PressAnimation.d.ts +0 -0
- /package/lib/components/{PressAnimation → _internal/PressAnimation}/index.d.ts +0 -0
- /package/lib/hooks/{useClipboard.d.ts → useClipboard/index.d.ts} +0 -0
- /package/lib/hooks/{useHaptics.d.ts → useHaptics/index.d.ts} +0 -0
- /package/lib/hooks/{useHotkeys.d.ts → useHotkeys/index.d.ts} +0 -0
- /package/lib/hooks/{useScrollSpy.d.ts → useScrollSpy/index.d.ts} +0 -0
- /package/lib/{contexts → hooks/useTitleRegistration/contexts}/TitleRegistryContext.d.ts +0 -0
- /package/lib/{contexts → hooks/useTitleRegistration/contexts}/index.d.ts +0 -0
- /package/lib/hooks/{useTitleRegistration.d.ts → useTitleRegistration/index.d.ts} +0 -0
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AccordionAnimationProp } from '../types';
|
|
2
2
|
export interface UseAccordionItemAnimationOptions {
|
|
3
3
|
expanded: boolean;
|
|
4
|
-
animated:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
animated: AccordionAnimationProp;
|
|
5
|
+
}
|
|
6
|
+
export interface AccordionCollapseConfig {
|
|
7
|
+
shouldAnimate: boolean;
|
|
8
|
+
duration: number;
|
|
9
|
+
easing?: (t: number) => number;
|
|
8
10
|
}
|
|
9
11
|
export interface UseAccordionItemAnimationResult {
|
|
10
|
-
contentRef: React.RefObject<View | null>;
|
|
11
|
-
onContentLayout: (e: any) => void;
|
|
12
|
-
animatedHeightStyle: any;
|
|
13
12
|
animatedChevronStyle: any;
|
|
14
|
-
|
|
15
|
-
contentHeight: number;
|
|
13
|
+
CollapseConfig: AccordionCollapseConfig;
|
|
16
14
|
}
|
|
17
15
|
export declare function useAccordionItemAnimation(opts: UseAccordionItemAnimationOptions): UseAccordionItemAnimationResult;
|
|
@@ -2,14 +2,23 @@ import React from 'react';
|
|
|
2
2
|
import { ViewStyle } from 'react-native';
|
|
3
3
|
import type { ComponentSizeValue } from '../../core/theme/componentSize';
|
|
4
4
|
export interface AvatarProps {
|
|
5
|
+
/** Size of the avatar */
|
|
5
6
|
size?: ComponentSizeValue;
|
|
7
|
+
/** Image source URL for the avatar */
|
|
6
8
|
src?: string;
|
|
9
|
+
/** Initials to show as fallback when no image is provided */
|
|
7
10
|
fallback?: string;
|
|
11
|
+
/** Background color for the fallback initials */
|
|
8
12
|
backgroundColor?: string;
|
|
13
|
+
/** Text color for the fallback initials */
|
|
9
14
|
textColor?: string;
|
|
15
|
+
/** Whether to show online status indicator */
|
|
10
16
|
online?: boolean;
|
|
17
|
+
/** Accessibility label for the avatar badge */
|
|
11
18
|
badgeColor?: string;
|
|
19
|
+
/** Accessibility label for the avatar badge */
|
|
12
20
|
style?: ViewStyle;
|
|
21
|
+
/** Accessibility label for the avatar image */
|
|
13
22
|
accessibilityLabel?: string;
|
|
14
23
|
/** Primary label displayed to the right of the avatar (string or custom React node) */
|
|
15
24
|
label?: React.ReactNode;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ViewStyle } from 'react-native';
|
|
3
3
|
import { SizeValue } from '../../core/theme/types';
|
|
4
|
+
import type { DisclaimerSupport } from '../_internal/Disclaimer';
|
|
4
5
|
export type CalendarLevel = 'month' | 'year' | 'decade';
|
|
5
6
|
export type CalendarType = 'single' | 'multiple' | 'range';
|
|
6
7
|
export type CalendarValue = Date | Date[] | [Date | null, Date | null] | null;
|
|
7
|
-
export interface CalendarProps {
|
|
8
|
+
export interface CalendarProps extends DisclaimerSupport {
|
|
8
9
|
level?: CalendarLevel;
|
|
9
10
|
defaultLevel?: CalendarLevel;
|
|
10
11
|
onLevelChange?: (level: CalendarLevel) => void;
|
|
@@ -7,7 +7,9 @@ export type Action = string;
|
|
|
7
7
|
/**
|
|
8
8
|
* Subject type - can be string, class, or object
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
type SubjectClass = abstract new (...args: any[]) => unknown;
|
|
11
|
+
type SubjectObject = Record<string, unknown> | object;
|
|
12
|
+
export type Subject = string | SubjectClass | SubjectObject;
|
|
11
13
|
/**
|
|
12
14
|
* Field within a subject
|
|
13
15
|
*/
|
|
@@ -89,13 +91,12 @@ export interface CanProps {
|
|
|
89
91
|
*/
|
|
90
92
|
export interface CanWithConditionsProps extends Omit<CanProps, 'a'> {
|
|
91
93
|
/** Subject instance with data for condition checking */
|
|
92
|
-
this:
|
|
94
|
+
this: Subject;
|
|
93
95
|
}
|
|
94
96
|
/**
|
|
95
97
|
* Cannot component props (inverse of Can)
|
|
96
98
|
*/
|
|
97
|
-
export
|
|
98
|
-
}
|
|
99
|
+
export type CannotProps = CanProps;
|
|
99
100
|
/**
|
|
100
101
|
* Permission gate props for route-level protection
|
|
101
102
|
*/
|
|
@@ -226,3 +227,4 @@ export interface PermissionRuleBuilder {
|
|
|
226
227
|
/** Finish building this rule */
|
|
227
228
|
build(): PermissionRule;
|
|
228
229
|
}
|
|
230
|
+
export {};
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CodeBlockProps } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* CodeBlock component for displaying formatted code with syntax highlighting.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* <CodeBlock title="React Component" language="tsx">
|
|
9
|
-
* {`const App = () => {
|
|
10
|
-
* return <Text>Hello World</Text>;
|
|
11
|
-
* };`}
|
|
12
|
-
* </CodeBlock>
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
3
|
export declare const CodeBlock: React.FC<CodeBlockProps>;
|
|
16
4
|
export default CodeBlock;
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
3
|
import { SpacingProps } from '../../core/utils';
|
|
4
|
+
export type CodeBlockToken = 'keyword' | 'string' | 'comment' | 'number' | 'function' | 'operator' | 'punctuation' | 'tag' | 'attribute' | 'className';
|
|
5
|
+
export type CodeBlockTextPalette = string | string[] | Partial<Record<CodeBlockToken, string>>;
|
|
6
|
+
export interface CodeBlockColorOverrides {
|
|
7
|
+
/** Background color (hex, rgb, or theme token like `primary.6`) */
|
|
8
|
+
background?: string;
|
|
9
|
+
/** Border/accent color (hex/rgb/theme token) */
|
|
10
|
+
border?: string;
|
|
11
|
+
/** Override text/token colors. Accepts a single color, an array, or a token map. */
|
|
12
|
+
text?: CodeBlockTextPalette;
|
|
13
|
+
/** Highlight colors for emphasized lines */
|
|
14
|
+
highlight?: {
|
|
15
|
+
background?: string;
|
|
16
|
+
accent?: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
4
19
|
export interface CodeBlockProps extends SpacingProps {
|
|
5
20
|
/** Optional language for syntax highlighting */
|
|
6
21
|
language?: string;
|
|
@@ -41,4 +56,8 @@ export interface CodeBlockProps extends SpacingProps {
|
|
|
41
56
|
githubUrl?: string;
|
|
42
57
|
/** Force a distinct file header bar (even without title) showing the filename */
|
|
43
58
|
fileHeader?: boolean;
|
|
59
|
+
/** Override base colors (background, text, highlights) */
|
|
60
|
+
colors?: CodeBlockColorOverrides;
|
|
61
|
+
/** Control whether long lines wrap (defaults to true). Set to false to enable horizontal scrolling instead. */
|
|
62
|
+
wrap?: boolean;
|
|
44
63
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PlatformBlocksTheme } from '../../core/theme/types';
|
|
2
|
+
import type { CodeBlockToken } from './types';
|
|
2
3
|
/**
|
|
3
4
|
* Normalizes language identifiers to standard values for syntax highlighting
|
|
4
5
|
*/
|
|
@@ -10,18 +11,8 @@ export declare function parseHighlightLines(specs: string[] | undefined, total:
|
|
|
10
11
|
/**
|
|
11
12
|
* Color schemes for different code block variants
|
|
12
13
|
*/
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
string: string;
|
|
16
|
-
comment: string;
|
|
17
|
-
number: string;
|
|
18
|
-
function: string;
|
|
19
|
-
operator: string;
|
|
20
|
-
punctuation: string;
|
|
21
|
-
tag: string;
|
|
22
|
-
attribute: string;
|
|
23
|
-
className: string;
|
|
24
|
-
};
|
|
14
|
+
export type SyntaxColorMap = Record<CodeBlockToken, string>;
|
|
15
|
+
export declare function getSyntaxColors(theme: PlatformBlocksTheme, isDark: boolean, variant?: 'code' | 'terminal' | 'hacker', overrides?: Partial<Record<CodeBlockToken, string>>): SyntaxColorMap;
|
|
25
16
|
/**
|
|
26
17
|
* Regex patterns for syntax highlighting
|
|
27
18
|
*/
|
|
@@ -32,7 +23,7 @@ export declare function getSyntaxPatterns(colors: ReturnType<typeof getSyntaxCol
|
|
|
32
23
|
/**
|
|
33
24
|
* Creates a simple syntax highlighter for React Native that returns colored tokens
|
|
34
25
|
*/
|
|
35
|
-
export declare function createNativeHighlighter(theme: PlatformBlocksTheme, isDark: boolean, variant?: 'code' | 'terminal' | 'hacker'): (code: string) => Array<Array<{
|
|
26
|
+
export declare function createNativeHighlighter(theme: PlatformBlocksTheme, isDark: boolean, variant?: 'code' | 'terminal' | 'hacker', overrides?: Partial<Record<CodeBlockToken, string>>): (code: string) => Array<Array<{
|
|
36
27
|
text: string;
|
|
37
28
|
color: string;
|
|
38
29
|
}>>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { ViewStyle } from 'react-native';
|
|
3
|
-
export interface
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export interface CollapseProps {
|
|
4
4
|
/**
|
|
5
5
|
* Whether the content is revealed/expanded
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
isCollapsed: boolean;
|
|
8
8
|
/**
|
|
9
9
|
* Content to show/hide
|
|
10
10
|
*/
|
|
@@ -22,11 +22,11 @@ export interface RevealProps {
|
|
|
22
22
|
/**
|
|
23
23
|
* Style for the container
|
|
24
24
|
*/
|
|
25
|
-
style?: ViewStyle
|
|
25
|
+
style?: StyleProp<ViewStyle>;
|
|
26
26
|
/**
|
|
27
27
|
* Style for the content wrapper
|
|
28
28
|
*/
|
|
29
|
-
contentStyle?: ViewStyle
|
|
29
|
+
contentStyle?: StyleProp<ViewStyle>;
|
|
30
30
|
/**
|
|
31
31
|
* Callback fired when animation starts
|
|
32
32
|
*/
|
|
@@ -35,6 +35,10 @@ export interface RevealProps {
|
|
|
35
35
|
* Callback fired when animation completes
|
|
36
36
|
*/
|
|
37
37
|
onAnimationEnd?: () => void;
|
|
38
|
+
/**
|
|
39
|
+
* Custom easing function overriding the timing preset
|
|
40
|
+
*/
|
|
41
|
+
easing?: (value: number) => number;
|
|
38
42
|
/**
|
|
39
43
|
* Whether to animate on initial mount
|
|
40
44
|
* @default false
|
|
@@ -21,6 +21,7 @@ export declare function useColorPickerStyles(metrics: ColorPickerSizeMetrics): {
|
|
|
21
21
|
inputFocused: ViewStyle;
|
|
22
22
|
inputDisabled: ViewStyle;
|
|
23
23
|
inputError: ViewStyle;
|
|
24
|
+
previewWrapper: ViewStyle;
|
|
24
25
|
preview: ViewStyle;
|
|
25
26
|
textInput: TextStyle;
|
|
26
27
|
dropdownIcon: TextStyle;
|
|
@@ -5,7 +5,7 @@ import { GradientTextProps } from './types';
|
|
|
5
5
|
* GradientText Component
|
|
6
6
|
*
|
|
7
7
|
* Renders text with a gradient color effect using linear gradients.
|
|
8
|
-
*
|
|
8
|
+
* Displays text using a linear gradient fill across the glyphs.
|
|
9
9
|
*
|
|
10
10
|
* **Note**: For native platforms (iOS/Android), gradient animation is currently
|
|
11
11
|
* supported on web only. Native platforms show static gradients.
|
|
@@ -17,15 +17,6 @@ import { GradientTextProps } from './types';
|
|
|
17
17
|
* Hello World
|
|
18
18
|
* </GradientText>
|
|
19
19
|
*
|
|
20
|
-
* // Animated gradient (web only)
|
|
21
|
-
* <GradientText
|
|
22
|
-
* colors={['#FF0080', '#7928CA', '#4F46E5']}
|
|
23
|
-
* animate
|
|
24
|
-
* animationDuration={3000}
|
|
25
|
-
* >
|
|
26
|
-
* Animated Text
|
|
27
|
-
* </GradientText>
|
|
28
|
-
*
|
|
29
20
|
* // Custom gradient direction
|
|
30
21
|
* <GradientText
|
|
31
22
|
* colors={['red', 'blue']}
|
|
@@ -10,16 +10,8 @@ export interface GradientTextProps extends Omit<TextProps, 'color' | 'colorVaria
|
|
|
10
10
|
start?: [number, number];
|
|
11
11
|
/** End point [x, y] (0-1). Overrides angle if provided */
|
|
12
12
|
end?: [number, number];
|
|
13
|
-
/** Gradient position offset (0-1).
|
|
13
|
+
/** Gradient position offset (0-1). Moves the gradient along the line */
|
|
14
14
|
position?: number;
|
|
15
|
-
/** Whether to animate the gradient position automatically */
|
|
16
|
-
animate?: boolean;
|
|
17
|
-
/** Animation duration in milliseconds (default: 2000) */
|
|
18
|
-
animationDuration?: number;
|
|
19
|
-
/** Animation loop behavior: 'loop', 'reverse', or 'once' (default: 'loop') */
|
|
20
|
-
animationLoop?: 'loop' | 'reverse' | 'once';
|
|
21
|
-
/** Delay before animation starts in milliseconds (default: 0) */
|
|
22
|
-
animationDelay?: number;
|
|
23
15
|
/** Custom testID for testing */
|
|
24
16
|
testID?: string;
|
|
25
17
|
}
|
|
@@ -35,7 +35,7 @@ export declare const createInputStyles: (theme: PlatformBlocksTheme, isRTL?: boo
|
|
|
35
35
|
fontWeight: "600";
|
|
36
36
|
marginBottom: number;
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
startSection: {
|
|
39
39
|
paddingLeft: number;
|
|
40
40
|
} | {
|
|
41
41
|
paddingRight: number;
|
|
@@ -43,7 +43,7 @@ export declare const createInputStyles: (theme: PlatformBlocksTheme, isRTL?: boo
|
|
|
43
43
|
required: {
|
|
44
44
|
color: string;
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
endSection: {
|
|
47
47
|
alignItems: "center";
|
|
48
48
|
flexDirection: "row";
|
|
49
49
|
paddingRight: number;
|
|
@@ -4,6 +4,7 @@ import { SpacingProps } from '../../core/theme/types';
|
|
|
4
4
|
import { LayoutProps } from '../../core/utils';
|
|
5
5
|
import { BorderRadiusProps } from '../../core/theme/radius';
|
|
6
6
|
import { SizeValue } from '../../core/theme/types';
|
|
7
|
+
import type { DisclaimerSupport } from '../_internal/Disclaimer';
|
|
7
8
|
export interface ValidationRule {
|
|
8
9
|
type: 'required' | 'minLength' | 'maxLength' | 'pattern' | 'custom' | 'passwordStrength';
|
|
9
10
|
value?: any;
|
|
@@ -20,7 +21,7 @@ export interface PasswordStrengthRule extends Omit<ValidationRule, 'type'> {
|
|
|
20
21
|
requireSymbols?: boolean;
|
|
21
22
|
};
|
|
22
23
|
}
|
|
23
|
-
export interface BaseInputProps extends SpacingProps, LayoutProps, BorderRadiusProps {
|
|
24
|
+
export interface BaseInputProps extends SpacingProps, LayoutProps, BorderRadiusProps, DisclaimerSupport {
|
|
24
25
|
/** Input value */
|
|
25
26
|
value?: string;
|
|
26
27
|
/** Change handler */
|
|
@@ -46,9 +47,9 @@ export interface BaseInputProps extends SpacingProps, LayoutProps, BorderRadiusP
|
|
|
46
47
|
/** Input name for form integration */
|
|
47
48
|
name?: string;
|
|
48
49
|
/** Left section content */
|
|
49
|
-
|
|
50
|
+
startSection?: React.ReactNode;
|
|
50
51
|
/** Right section content */
|
|
51
|
-
|
|
52
|
+
endSection?: React.ReactNode;
|
|
52
53
|
/** Additional styling */
|
|
53
54
|
style?: any;
|
|
54
55
|
/** Accessibility label */
|
|
@@ -1,6 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { View } from 'react-native';
|
|
3
|
+
import type { KnobProps, KnobAppearance, KnobRootProps, KnobFillPartProps, KnobRingPartProps, KnobProgressPartProps, KnobTickLayerPartProps, KnobPointerPartProps, KnobThumbPartProps, KnobValueLabelPartProps, KnobPartEntry } from './types';
|
|
4
|
+
declare const KnobBase: import("../../core/factory").PlatformBlocksComponent<{
|
|
4
5
|
props: KnobProps;
|
|
5
6
|
ref: View;
|
|
6
7
|
}>;
|
|
8
|
+
type PartEntry = KnobPartEntry;
|
|
9
|
+
type KnobCompoundComponent = typeof KnobBase & {
|
|
10
|
+
Root: React.FC<KnobRootProps>;
|
|
11
|
+
Fill: React.FC<KnobFillPartProps>;
|
|
12
|
+
Ring: React.FC<KnobRingPartProps>;
|
|
13
|
+
Progress: React.FC<KnobProgressPartProps>;
|
|
14
|
+
TickLayer: React.FC<KnobTickLayerPartProps>;
|
|
15
|
+
Pointer: React.FC<KnobPointerPartProps>;
|
|
16
|
+
Thumb: React.FC<KnobThumbPartProps>;
|
|
17
|
+
ValueLabel: React.FC<KnobValueLabelPartProps>;
|
|
18
|
+
};
|
|
19
|
+
export declare const Knob: KnobCompoundComponent;
|
|
20
|
+
export declare const __KnobInternals: {
|
|
21
|
+
buildAppearanceFromParts: (baseAppearance: KnobAppearance | undefined, parts: PartEntry[]) => KnobAppearance | undefined;
|
|
22
|
+
buildValueLabelFromParts: (baseValueLabel: KnobProps["valueLabel"], parts: PartEntry[]) => KnobProps["valueLabel"];
|
|
23
|
+
getGestureDegreeSpan: (isEndless: boolean, sweepAngle: number) => number;
|
|
24
|
+
};
|
|
25
|
+
export type { KnobPartEntry } from './types';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { PlatformBlocksTheme } from '../../core/theme/types';
|
|
2
|
+
import type { KnobAppearance, KnobRingShadow, KnobPointerStyle, KnobTickLayer, KnobThumbShape, KnobThumbStyle, KnobVariant, KnobPanningConfig } from './types';
|
|
3
|
+
export type ResolvedRingStyle = {
|
|
4
|
+
thickness: number;
|
|
5
|
+
color: string;
|
|
6
|
+
trailColor: string;
|
|
7
|
+
backgroundColor: string;
|
|
8
|
+
cap: 'butt' | 'round';
|
|
9
|
+
radiusOffset: number;
|
|
10
|
+
shadow?: KnobRingShadow;
|
|
11
|
+
};
|
|
12
|
+
export type ResolvedFillStyle = {
|
|
13
|
+
color: string;
|
|
14
|
+
borderWidth: number;
|
|
15
|
+
borderColor: string;
|
|
16
|
+
radiusOffset: number;
|
|
17
|
+
};
|
|
18
|
+
export type ResolvedThumbStyle = {
|
|
19
|
+
size: number;
|
|
20
|
+
color: string;
|
|
21
|
+
shape: KnobThumbShape;
|
|
22
|
+
strokeWidth: number;
|
|
23
|
+
strokeColor: string;
|
|
24
|
+
offset: number;
|
|
25
|
+
glow?: KnobThumbStyle['glow'];
|
|
26
|
+
style?: KnobThumbStyle['style'];
|
|
27
|
+
renderThumb?: KnobThumbStyle['renderThumb'];
|
|
28
|
+
};
|
|
29
|
+
export type ResolvedProgressStyle = {
|
|
30
|
+
mode: 'none' | 'contiguous' | 'split';
|
|
31
|
+
color: string;
|
|
32
|
+
trailColor: string;
|
|
33
|
+
roundedCaps: boolean;
|
|
34
|
+
thickness: number;
|
|
35
|
+
};
|
|
36
|
+
export type ResolvedKnobAppearance = {
|
|
37
|
+
ring: ResolvedRingStyle;
|
|
38
|
+
fill: ResolvedFillStyle | null;
|
|
39
|
+
thumb: ResolvedThumbStyle | null;
|
|
40
|
+
progress: ResolvedProgressStyle | null;
|
|
41
|
+
pointer: (KnobPointerStyle & {
|
|
42
|
+
visible: boolean;
|
|
43
|
+
}) | null;
|
|
44
|
+
ticks: KnobTickLayer[];
|
|
45
|
+
panning: KnobPanningConfig | null;
|
|
46
|
+
};
|
|
47
|
+
export interface ResolveAppearanceOptions {
|
|
48
|
+
appearance?: KnobAppearance;
|
|
49
|
+
theme: PlatformBlocksTheme;
|
|
50
|
+
variant: KnobVariant;
|
|
51
|
+
disabled: boolean;
|
|
52
|
+
size: number;
|
|
53
|
+
thumbSize?: number;
|
|
54
|
+
accentColor?: string;
|
|
55
|
+
}
|
|
56
|
+
export declare const resolveKnobAppearance: ({ appearance, theme, variant, disabled, size, thumbSize, accentColor, }: ResolveAppearanceOptions) => ResolvedKnobAppearance;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { KnobArcConfig } from './types';
|
|
2
|
+
export type NormalizedArcConfig = {
|
|
3
|
+
startAngle: number;
|
|
4
|
+
sweepAngle: number;
|
|
5
|
+
direction: 'cw' | 'ccw';
|
|
6
|
+
clampInput: boolean;
|
|
7
|
+
wrap: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const normalizeDegrees: (deg: number) => number;
|
|
10
|
+
export declare const normalizeArcConfig: (arc?: KnobArcConfig, options?: {
|
|
11
|
+
isEndless?: boolean;
|
|
12
|
+
}) => NormalizedArcConfig;
|
|
13
|
+
export declare const getArcAngleFromRatio: (arc: NormalizedArcConfig, ratio: number) => number;
|
|
14
|
+
export declare const getArcRatioFromAngle: (arc: NormalizedArcConfig, angle: number, options?: {
|
|
15
|
+
clamp?: boolean;
|
|
16
|
+
}) => number;
|
|
17
|
+
export declare const buildArcPathBetweenAngles: (cx: number, cy: number, radius: number, startAngle: number, endAngle: number) => string;
|
|
18
|
+
export declare const buildArcPathForSweep: (arc: NormalizedArcConfig, radius: number, ratio: number, center: {
|
|
19
|
+
cx: number;
|
|
20
|
+
cy: number;
|
|
21
|
+
}) => string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, ViewProps, PanResponderInstance, LayoutChangeEvent } from 'react-native';
|
|
3
|
+
import { type SurfaceLayersProps } from './SurfaceLayers';
|
|
4
|
+
import { type TickLayersProps } from './TickLayers';
|
|
5
|
+
import { type PointerLayerProps } from './PointerLayer';
|
|
6
|
+
import { type ThumbLayerProps } from './ThumbLayer';
|
|
7
|
+
/**
|
|
8
|
+
* Encapsulates the interactive host view for the Knob plus its visual layers so the
|
|
9
|
+
* root component can stay focused on state/logic.
|
|
10
|
+
*/
|
|
11
|
+
export type KnobSurfaceProps = Omit<ViewProps, 'onLayout' | 'children'> & {
|
|
12
|
+
size: number;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
trackColor: string;
|
|
15
|
+
accessibilityLabel?: string;
|
|
16
|
+
accessibilityMin: number;
|
|
17
|
+
accessibilityMax: number;
|
|
18
|
+
accessibilityNow: number;
|
|
19
|
+
setHostRef: (node: View | null) => void;
|
|
20
|
+
panHandlers?: PanResponderInstance['panHandlers'];
|
|
21
|
+
handleLayout?: (event: LayoutChangeEvent) => void;
|
|
22
|
+
keyboardHandlers?: Partial<ViewProps>;
|
|
23
|
+
surfaceLayersProps: SurfaceLayersProps;
|
|
24
|
+
tickLayersProps: TickLayersProps;
|
|
25
|
+
pointerLayerProps: PointerLayerProps;
|
|
26
|
+
thumbLayerProps: ThumbLayerProps;
|
|
27
|
+
centerSlot?: React.ReactNode;
|
|
28
|
+
onLayout?: ViewProps['onLayout'];
|
|
29
|
+
};
|
|
30
|
+
export declare const KnobSurface: React.FC<KnobSurfaceProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { KnobPointerStyle } from '../types';
|
|
3
|
+
import type { LayoutState } from '../hooks/useKnobGeometry';
|
|
4
|
+
export type PointerLayerProps = {
|
|
5
|
+
pointerConfig?: KnobPointerStyle | false | null;
|
|
6
|
+
labelColor: string;
|
|
7
|
+
displayAngle: number;
|
|
8
|
+
layoutState: LayoutState;
|
|
9
|
+
size: number;
|
|
10
|
+
thumbSize: number;
|
|
11
|
+
ringRadius: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const PointerLayer: React.FC<PointerLayerProps>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
import type { KnobFillStyle } from '../types';
|
|
4
|
+
import type { LayoutState } from '../hooks/useKnobGeometry';
|
|
5
|
+
export type SurfaceLayersProps = {
|
|
6
|
+
layoutState: LayoutState;
|
|
7
|
+
fillConfig?: KnobFillStyle | null;
|
|
8
|
+
fillRadius: number;
|
|
9
|
+
fillDiameter: number;
|
|
10
|
+
ringBaseDiameter: number;
|
|
11
|
+
ringSvgCenter: number;
|
|
12
|
+
ringBackgroundColor?: string;
|
|
13
|
+
ringBaseStroke: string;
|
|
14
|
+
ringPath: string;
|
|
15
|
+
ringThickness: number;
|
|
16
|
+
ringCap: 'butt' | 'round';
|
|
17
|
+
ringShadowStyle: ViewStyle | null;
|
|
18
|
+
trackStyle?: ViewStyle;
|
|
19
|
+
showContiguousProgress: boolean;
|
|
20
|
+
progressPath: string;
|
|
21
|
+
progressStrokeColor: string;
|
|
22
|
+
progressThickness: number;
|
|
23
|
+
progressStrokeCap: 'butt' | 'round';
|
|
24
|
+
showSplitProgress: boolean;
|
|
25
|
+
splitPositivePath?: string;
|
|
26
|
+
splitNegativePath?: string;
|
|
27
|
+
splitPositiveColor: string;
|
|
28
|
+
splitNegativeColor: string;
|
|
29
|
+
showZeroIndicator: boolean;
|
|
30
|
+
zeroIndicatorPoints?: {
|
|
31
|
+
x1: number;
|
|
32
|
+
y1: number;
|
|
33
|
+
x2: number;
|
|
34
|
+
y2: number;
|
|
35
|
+
} | null;
|
|
36
|
+
zeroIndicatorColor: string;
|
|
37
|
+
};
|
|
38
|
+
export declare const SurfaceLayers: React.FC<SurfaceLayersProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import type { KnobAppearance } from '../types';
|
|
4
|
+
export type ThumbLayerProps = {
|
|
5
|
+
thumbConfig?: KnobAppearance['thumb'] | null;
|
|
6
|
+
thumbSize: number;
|
|
7
|
+
thumbColor: string;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
thumbAnimatedStyle: StyleProp<ViewStyle>;
|
|
10
|
+
thumbStyle?: ViewStyle;
|
|
11
|
+
displayValue: number;
|
|
12
|
+
displayAngle: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const ThumbLayer: React.FC<ThumbLayerProps>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TextStyle } from 'react-native';
|
|
3
|
+
import type { KnobAppearance, KnobMark } from '../types';
|
|
4
|
+
import type { LayoutState } from '../hooks/useKnobGeometry';
|
|
5
|
+
export type TickLayersProps = {
|
|
6
|
+
appearanceTicks?: KnobAppearance['ticks'];
|
|
7
|
+
marksNormalized: KnobMark[];
|
|
8
|
+
min: number;
|
|
9
|
+
max: number;
|
|
10
|
+
step: number;
|
|
11
|
+
isEndless: boolean;
|
|
12
|
+
valueToAngle: (value: number) => number;
|
|
13
|
+
layoutState: LayoutState;
|
|
14
|
+
ringRadius: number;
|
|
15
|
+
ringThickness: number;
|
|
16
|
+
theme: any;
|
|
17
|
+
boundedRatio: number;
|
|
18
|
+
size: number;
|
|
19
|
+
thumbSize: number;
|
|
20
|
+
resolvedVariant: string;
|
|
21
|
+
displayValue: number;
|
|
22
|
+
activeMark?: KnobMark | null;
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
markLabelStyle?: TextStyle;
|
|
25
|
+
labelColor: string;
|
|
26
|
+
};
|
|
27
|
+
export declare const TickLayers: React.FC<TickLayersProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
import type { SpacingProps, LayoutProps } from '../../../core/utils';
|
|
4
|
+
import type { KnobProps, KnobValueLabelPosition } from '../types';
|
|
5
|
+
import type { ValueLabelSlots } from '../hooks/useKnobValueLabels';
|
|
6
|
+
export type ValueLabelLayoutProps = {
|
|
7
|
+
knobElement: React.ReactNode;
|
|
8
|
+
valueLabelSlots: ValueLabelSlots;
|
|
9
|
+
spacingStyles?: ViewStyle;
|
|
10
|
+
layoutStyles?: ViewStyle;
|
|
11
|
+
spacingProps: SpacingProps;
|
|
12
|
+
layoutProps: LayoutProps;
|
|
13
|
+
hasLabelContent: boolean;
|
|
14
|
+
label?: KnobProps['label'];
|
|
15
|
+
description?: KnobProps['description'];
|
|
16
|
+
labelPosition: KnobValueLabelPosition;
|
|
17
|
+
};
|
|
18
|
+
export declare const ValueLabelLayout: React.FC<ValueLabelLayoutProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LayoutChangeEvent } from 'react-native';
|
|
2
|
+
export type LayoutState = {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
cx: number;
|
|
6
|
+
cy: number;
|
|
7
|
+
radius: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const useKnobGeometry: (size: number) => {
|
|
10
|
+
layoutState: LayoutState;
|
|
11
|
+
handleLayout: (event: LayoutChangeEvent) => void;
|
|
12
|
+
centerX: import("react-native-reanimated").SharedValue<number>;
|
|
13
|
+
centerY: import("react-native-reanimated").SharedValue<number>;
|
|
14
|
+
radiusValue: import("react-native-reanimated").SharedValue<number>;
|
|
15
|
+
angle: import("react-native-reanimated").SharedValue<number>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { type View } from 'react-native';
|
|
3
|
+
import { type NormalizedArcConfig } from '../arc';
|
|
4
|
+
import type { NormalizedInteractionConfig } from '../interactionConfig';
|
|
5
|
+
import type { LayoutState } from './useKnobGeometry';
|
|
6
|
+
export type UseKnobGesturesParams = {
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
readOnly: boolean;
|
|
9
|
+
interactionConfig: NormalizedInteractionConfig;
|
|
10
|
+
isEndless: boolean;
|
|
11
|
+
min: number;
|
|
12
|
+
max: number;
|
|
13
|
+
arcConfig: NormalizedArcConfig;
|
|
14
|
+
gestureDegreeSpan: number;
|
|
15
|
+
layoutState: LayoutState;
|
|
16
|
+
handleValueUpdate: (value: number, final: boolean) => void;
|
|
17
|
+
onScrubStart?: () => void;
|
|
18
|
+
onScrubEnd?: () => void;
|
|
19
|
+
onChangeEnd?: (value: number) => void;
|
|
20
|
+
valueRef: MutableRefObject<number>;
|
|
21
|
+
hostRef: MutableRefObject<View | null>;
|
|
22
|
+
degreesToValueDelta: (degrees: number) => number;
|
|
23
|
+
valueToAngle: (value: number) => number;
|
|
24
|
+
isRTL: boolean;
|
|
25
|
+
};
|
|
26
|
+
export declare const useKnobGestures: ({ disabled, readOnly, interactionConfig, isEndless, min, max, arcConfig, gestureDegreeSpan, layoutState, handleValueUpdate, onScrubStart, onScrubEnd, onChangeEnd, valueRef, hostRef, degreesToValueDelta, valueToAngle, isRTL, }: UseKnobGesturesParams) => {
|
|
27
|
+
panHandlers: import("react-native").GestureResponderHandlers;
|
|
28
|
+
};
|