@platform-blocks/ui 0.3.1 → 0.5.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 +5842 -2570
- package/lib/cjs/index.js.map +1 -1
- package/lib/components/Accordion/hooks/useAccordionItemAnimation.d.ts +8 -10
- package/lib/components/Avatar/Avatar.d.ts +1 -1
- package/lib/components/Avatar/types.d.ts +10 -1
- package/lib/components/Calendar/types.d.ts +2 -1
- package/lib/components/Can/types.d.ts +6 -4
- package/lib/components/Carousel/types.d.ts +18 -0
- 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/DataTable/DataTable.d.ts +1 -1
- package/lib/components/DataTable/types.d.ts +2 -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/Slider/types.d.ts +29 -1
- 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 +5843 -2569
- 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 +3 -3
- 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
package/lib/hooks/index.d.ts
CHANGED
|
@@ -4,3 +4,5 @@ export { useScrollSpy, type ScrollSpyOptions, type UseScrollSpyItem } from './us
|
|
|
4
4
|
export { useHaptics, type UseHapticsOptions, type UseHapticsReturn } from './useHaptics';
|
|
5
5
|
export { useMaskedInput, type UseMaskedInputOptions, type UseMaskedInputReturn } from './useMaskedInput';
|
|
6
6
|
export { useTitleRegistration, type UseTitleRegistrationOptions } from './useTitleRegistration';
|
|
7
|
+
export { useDeviceInfo, type DeviceInfo, type UseDeviceInfoOptions, } from './useDeviceInfo';
|
|
8
|
+
export { useOverlayMode, type UseOverlayModeOptions, type UseOverlayModeResult, } from './useOverlayMode';
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export interface DeviceInfo {
|
|
2
|
+
runtime: {
|
|
3
|
+
platform: 'browser' | 'native';
|
|
4
|
+
browserName: string | null;
|
|
5
|
+
browserVersion: string | null;
|
|
6
|
+
jsEngine: 'Hermes' | 'JSC' | 'V8' | null;
|
|
7
|
+
engineVersion: string | null;
|
|
8
|
+
};
|
|
9
|
+
system: {
|
|
10
|
+
os: {
|
|
11
|
+
name: string | null;
|
|
12
|
+
version: string | null;
|
|
13
|
+
buildId?: string | null;
|
|
14
|
+
};
|
|
15
|
+
device: {
|
|
16
|
+
type: 'phone' | 'tablet' | 'desktop' | 'tv' | 'console' | 'wearable' | 'unknown';
|
|
17
|
+
brand: string | null;
|
|
18
|
+
model: string | null;
|
|
19
|
+
isVirtual?: boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
screen: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
scale: number;
|
|
26
|
+
fontScale?: number;
|
|
27
|
+
orientation: 'portrait' | 'landscape';
|
|
28
|
+
};
|
|
29
|
+
locale: {
|
|
30
|
+
language: string;
|
|
31
|
+
region: string | null;
|
|
32
|
+
full: string;
|
|
33
|
+
timeZone: string;
|
|
34
|
+
uses24HourClock: boolean;
|
|
35
|
+
};
|
|
36
|
+
appearance: {
|
|
37
|
+
colorScheme: 'light' | 'dark' | 'no-preference';
|
|
38
|
+
contrast: 'more' | 'less' | 'no-preference';
|
|
39
|
+
reducedMotion: boolean;
|
|
40
|
+
fontScale: number;
|
|
41
|
+
};
|
|
42
|
+
input: {
|
|
43
|
+
primaryPointer: 'touch' | 'mouse' | 'pen' | 'unknown';
|
|
44
|
+
pointerTypes: Array<'touch' | 'mouse' | 'pen'>;
|
|
45
|
+
hasTouch: boolean;
|
|
46
|
+
hasMouse: boolean;
|
|
47
|
+
hasKeyboard: boolean | null;
|
|
48
|
+
};
|
|
49
|
+
safeArea: {
|
|
50
|
+
top: number;
|
|
51
|
+
bottom: number;
|
|
52
|
+
left: number;
|
|
53
|
+
right: number;
|
|
54
|
+
};
|
|
55
|
+
network?: {
|
|
56
|
+
ipAddress?: string | null;
|
|
57
|
+
macAddress?: string | null;
|
|
58
|
+
connectionType?: 'wifi' | 'cellular' | 'ethernet' | 'unknown';
|
|
59
|
+
downlink?: number | null;
|
|
60
|
+
};
|
|
61
|
+
capabilities?: {
|
|
62
|
+
hdr: boolean | null;
|
|
63
|
+
gpu: string | null;
|
|
64
|
+
};
|
|
65
|
+
platform: {
|
|
66
|
+
isWeb: boolean;
|
|
67
|
+
isNative: boolean;
|
|
68
|
+
isIOS: boolean;
|
|
69
|
+
isAndroid: boolean;
|
|
70
|
+
isMobile: boolean;
|
|
71
|
+
isTablet: boolean;
|
|
72
|
+
isPhone: boolean;
|
|
73
|
+
isDesktop: boolean;
|
|
74
|
+
isConsole: boolean;
|
|
75
|
+
isTV: boolean;
|
|
76
|
+
isWearable: boolean;
|
|
77
|
+
};
|
|
78
|
+
helpers: {
|
|
79
|
+
isPhone: boolean;
|
|
80
|
+
isTablet: boolean;
|
|
81
|
+
isMobile: boolean;
|
|
82
|
+
isDesktop: boolean;
|
|
83
|
+
isDarkMode: boolean;
|
|
84
|
+
isLandscape: boolean;
|
|
85
|
+
getOS: () => string;
|
|
86
|
+
getBrand: () => string | null;
|
|
87
|
+
};
|
|
88
|
+
meta: {
|
|
89
|
+
updatedAt: number;
|
|
90
|
+
ready: boolean;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export interface UseDeviceInfoOptions {
|
|
94
|
+
enableExtendedData?: boolean;
|
|
95
|
+
}
|
|
96
|
+
type LocaleState = DeviceInfo['locale'];
|
|
97
|
+
export declare function useDeviceInfo(options?: UseDeviceInfoOptions): DeviceInfo;
|
|
98
|
+
/** @internal */
|
|
99
|
+
export declare const __deviceInfoInternals: {
|
|
100
|
+
detectLocale: () => LocaleState;
|
|
101
|
+
};
|
|
102
|
+
export default useDeviceInfo;
|
|
103
|
+
/**
|
|
104
|
+
* Example Usage:
|
|
105
|
+
*
|
|
106
|
+
* const info = useDeviceInfo({ enableExtendedData: true });
|
|
107
|
+
* console.log(`Running on ${info.system.os.name} with a ${info.system.device.type}`);
|
|
108
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useEscapeKey } from '../useHotkeys';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useGlobalHotkeys, globalHotkeys, type HotkeyItem } from '../useHotkeys';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createMask, MaskDefinition, MaskResult } from '
|
|
1
|
+
import { createMask, MaskDefinition, MaskResult } from './utils/mask';
|
|
2
2
|
export interface UseMaskedInputOptions {
|
|
3
3
|
/** The mask definition */
|
|
4
4
|
mask: MaskDefinition | ReturnType<typeof createMask>;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Advanced input masking utility inspired by react-imask
|
|
3
|
+
* Provides flexible pattern-based input formatting with proper cursor handling
|
|
4
|
+
*/
|
|
5
|
+
export interface MaskDefinition {
|
|
6
|
+
/** The mask pattern (e.g., '(000) 000-0000', '+1 000 000 0000') */
|
|
7
|
+
mask: string;
|
|
8
|
+
/** Placeholder character for unfilled positions */
|
|
9
|
+
placeholderChar?: string;
|
|
10
|
+
/** Whether to show the mask when input is empty */
|
|
11
|
+
showMask?: boolean;
|
|
12
|
+
/** Custom definitions for mask characters */
|
|
13
|
+
definitions?: Record<string, RegExp>;
|
|
14
|
+
/** Whether to allow incomplete input */
|
|
15
|
+
lazy?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface MaskResult {
|
|
18
|
+
/** The masked/formatted value */
|
|
19
|
+
value: string;
|
|
20
|
+
/** The unmasked/raw value */
|
|
21
|
+
unmaskedValue: string;
|
|
22
|
+
/** Whether the mask is complete */
|
|
23
|
+
isComplete: boolean;
|
|
24
|
+
/** Current cursor position after formatting */
|
|
25
|
+
cursorPosition: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates a masking function for the given pattern
|
|
29
|
+
*/
|
|
30
|
+
export declare function createMask(definition: MaskDefinition): {
|
|
31
|
+
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
32
|
+
getDisplayValue: (value: string) => string;
|
|
33
|
+
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
34
|
+
pattern: {
|
|
35
|
+
char: string;
|
|
36
|
+
isFixed: boolean;
|
|
37
|
+
regex?: RegExp;
|
|
38
|
+
}[];
|
|
39
|
+
definition: MaskDefinition;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Phone number specific masking presets
|
|
43
|
+
*/
|
|
44
|
+
export declare const PHONE_MASKS: {
|
|
45
|
+
US: {
|
|
46
|
+
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
47
|
+
getDisplayValue: (value: string) => string;
|
|
48
|
+
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
49
|
+
pattern: {
|
|
50
|
+
char: string;
|
|
51
|
+
isFixed: boolean;
|
|
52
|
+
regex?: RegExp;
|
|
53
|
+
}[];
|
|
54
|
+
definition: MaskDefinition;
|
|
55
|
+
};
|
|
56
|
+
US_WITH_COUNTRY: {
|
|
57
|
+
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
58
|
+
getDisplayValue: (value: string) => string;
|
|
59
|
+
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
60
|
+
pattern: {
|
|
61
|
+
char: string;
|
|
62
|
+
isFixed: boolean;
|
|
63
|
+
regex?: RegExp;
|
|
64
|
+
}[];
|
|
65
|
+
definition: MaskDefinition;
|
|
66
|
+
};
|
|
67
|
+
UK: {
|
|
68
|
+
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
69
|
+
getDisplayValue: (value: string) => string;
|
|
70
|
+
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
71
|
+
pattern: {
|
|
72
|
+
char: string;
|
|
73
|
+
isFixed: boolean;
|
|
74
|
+
regex?: RegExp;
|
|
75
|
+
}[];
|
|
76
|
+
definition: MaskDefinition;
|
|
77
|
+
};
|
|
78
|
+
INTERNATIONAL: {
|
|
79
|
+
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
80
|
+
getDisplayValue: (value: string) => string;
|
|
81
|
+
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
82
|
+
pattern: {
|
|
83
|
+
char: string;
|
|
84
|
+
isFixed: boolean;
|
|
85
|
+
regex?: RegExp;
|
|
86
|
+
}[];
|
|
87
|
+
definition: MaskDefinition;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Other useful mask presets
|
|
92
|
+
*/
|
|
93
|
+
export declare const COMMON_MASKS: {
|
|
94
|
+
CREDIT_CARD: {
|
|
95
|
+
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
96
|
+
getDisplayValue: (value: string) => string;
|
|
97
|
+
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
98
|
+
pattern: {
|
|
99
|
+
char: string;
|
|
100
|
+
isFixed: boolean;
|
|
101
|
+
regex?: RegExp;
|
|
102
|
+
}[];
|
|
103
|
+
definition: MaskDefinition;
|
|
104
|
+
};
|
|
105
|
+
DATE: {
|
|
106
|
+
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
107
|
+
getDisplayValue: (value: string) => string;
|
|
108
|
+
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
109
|
+
pattern: {
|
|
110
|
+
char: string;
|
|
111
|
+
isFixed: boolean;
|
|
112
|
+
regex?: RegExp;
|
|
113
|
+
}[];
|
|
114
|
+
definition: MaskDefinition;
|
|
115
|
+
};
|
|
116
|
+
SSN: {
|
|
117
|
+
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
118
|
+
getDisplayValue: (value: string) => string;
|
|
119
|
+
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
120
|
+
pattern: {
|
|
121
|
+
char: string;
|
|
122
|
+
isFixed: boolean;
|
|
123
|
+
regex?: RegExp;
|
|
124
|
+
}[];
|
|
125
|
+
definition: MaskDefinition;
|
|
126
|
+
};
|
|
127
|
+
ZIP_CODE: {
|
|
128
|
+
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
129
|
+
getDisplayValue: (value: string) => string;
|
|
130
|
+
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
131
|
+
pattern: {
|
|
132
|
+
char: string;
|
|
133
|
+
isFixed: boolean;
|
|
134
|
+
regex?: RegExp;
|
|
135
|
+
}[];
|
|
136
|
+
definition: MaskDefinition;
|
|
137
|
+
};
|
|
138
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useDeviceInfo } from '../useDeviceInfo';
|
|
2
|
+
export interface UseOverlayModeOptions {
|
|
3
|
+
/** Force modal presentation regardless of platform */
|
|
4
|
+
forceModal?: boolean;
|
|
5
|
+
/** Force anchored overlay/portal regardless of platform */
|
|
6
|
+
forceOverlay?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface UseOverlayModeResult {
|
|
9
|
+
/** Raw device info reference (forwarded for convenience) */
|
|
10
|
+
deviceInfo: ReturnType<typeof useDeviceInfo>;
|
|
11
|
+
/** True when running on React Native Web */
|
|
12
|
+
isWeb: boolean;
|
|
13
|
+
/** Consolidated mobile experience flag (native or narrow web) */
|
|
14
|
+
isMobileExperience: boolean;
|
|
15
|
+
/** Inverse of mobile experience flag */
|
|
16
|
+
isDesktopExperience: boolean;
|
|
17
|
+
/** Prefer fullscreen/modal surfaces (native + mobile web) */
|
|
18
|
+
shouldUseModal: boolean;
|
|
19
|
+
/** Prefer anchored overlays/portals (desktop web) */
|
|
20
|
+
shouldUseOverlay: boolean;
|
|
21
|
+
/** Alias for shouldUseOverlay for popover/portal driven surfaces */
|
|
22
|
+
shouldUsePortal: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Normalises how components decide between fullscreen modals and anchored overlays
|
|
26
|
+
* by combining platform + device heuristics from useDeviceInfo.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useOverlayMode(options?: UseOverlayModeOptions): UseOverlayModeResult;
|
|
29
|
+
export default useOverlayMode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useSpotlightToggle } from '../useHotkeys';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useToggleColorScheme } from '../useHotkeys';
|
package/lib/index.d.ts
CHANGED
|
@@ -16,14 +16,13 @@ export { AccessibilityProvider, useAccessibility } from './core/accessibility/co
|
|
|
16
16
|
export { SoundProvider, useSound, useHaptics, getAllSounds, getSoundsByCategory, createSound, DEFAULT_SOUND_IDS } from './core/sound';
|
|
17
17
|
export type { SoundAsset, SoundOptions, HapticFeedbackOptions } from './core/sound';
|
|
18
18
|
export { factory, polymorphicFactory } from './core/factory';
|
|
19
|
-
export { TitleRegistryProvider, useTitleRegistry, useTitleRegistryOptional, type TitleItem } from './contexts';
|
|
20
|
-
export { rem, px, getSize, getFontSize, getRadius, getShadow, getColor, debounce, throttle, measurePerformance, measureAsyncPerformance,
|
|
19
|
+
export { TitleRegistryProvider, useTitleRegistry, useTitleRegistryOptional, type TitleItem } from './hooks/useTitleRegistration/contexts';
|
|
20
|
+
export { rem, px, getSize, getFontSize, getRadius, getShadow, getColor, debounce, throttle, measurePerformance, measureAsyncPerformance, calculateOverlayPositionEnhanced, getViewport, measureElement, pointInRect, getScrollPosition, clearOverlayPositionCache, type Rect, type Viewport, type PositionResult, type PlacementType, type PositioningOptions, } from './core/utils';
|
|
21
21
|
export { usePopoverPositioning, useTooltipPositioning, type UsePopoverPositioningOptions, type UsePopoverPositioningReturn, } from './core/hooks/usePopoverPositioning';
|
|
22
22
|
export { useDropdownPositioning, type UseDropdownPositioningOptions, type UseDropdownPositioningReturn, } from './core/hooks/useDropdownPositioning';
|
|
23
23
|
export { resolveSize, getIconSize, getHeight, getSpacing, getLineHeight, COMPONENT_SIZES, SIZE_SCALES, } from './core/theme/sizes';
|
|
24
24
|
export { DEFAULT_BREAKPOINTS, resolveResponsiveProp } from './core/theme/breakpoints';
|
|
25
25
|
export { useHotkeys, useGlobalHotkeys, useEscapeKey, useToggleColorScheme, useSpotlightToggle, globalHotkeys, } from './hooks';
|
|
26
|
-
export { Container } from './components/Container';
|
|
27
26
|
export { KeyboardAwareLayout } from './components/KeyboardAwareLayout';
|
|
28
27
|
export { Flex } from './components/Flex';
|
|
29
28
|
export { Grid, GridItem } from './components/Grid';
|
|
@@ -84,20 +83,20 @@ export { Block } from './components/Block';
|
|
|
84
83
|
export { Card } from './components/Card';
|
|
85
84
|
export { Chip } from './components/Chip';
|
|
86
85
|
export { DataTable } from './components/DataTable';
|
|
87
|
-
export { Disclaimer, ComponentWithDisclaimer, useDisclaimer, withDisclaimer, extractDisclaimerProps } from './components/Disclaimer';
|
|
86
|
+
export { Disclaimer, ComponentWithDisclaimer, useDisclaimer, withDisclaimer, extractDisclaimerProps } from './components/_internal/Disclaimer';
|
|
88
87
|
export { Table } from './components/Table';
|
|
89
88
|
export { Timeline } from './components/Timeline';
|
|
90
89
|
export { ListGroup, ListGroupItem, ListGroupDivider, ListGroupBody } from './components/ListGroup';
|
|
91
90
|
export { TableOfContents } from './components/TableOfContents';
|
|
92
91
|
export { Tree } from './components/Tree';
|
|
93
|
-
export {
|
|
92
|
+
export { Notice } from './components/Notice';
|
|
94
93
|
export { Progress } from './components/Progress';
|
|
95
94
|
export { Skeleton } from './components/Skeleton';
|
|
96
95
|
export { Loader } from './components/Loader';
|
|
97
96
|
export { Gauge } from './components/Gauge';
|
|
98
97
|
export { Ring } from './components/Ring';
|
|
99
98
|
export { NavigationProgress, navigationProgress } from './components/NavigationProgress';
|
|
100
|
-
export { Toast, ToastProvider, useToast, useToastApi,
|
|
99
|
+
export { Toast, ToastProvider, useToast, useToastApi, onToastsRequested } from './components/Toast';
|
|
101
100
|
export { Dialog, DialogProvider, DialogRenderer, useDialog, useDialogApi, useDialogs, useSimpleDialog, onDialogsRequested } from './components/Dialog';
|
|
102
101
|
export { Tooltip } from './components/Tooltip';
|
|
103
102
|
export { Overlay } from './components/Overlay';
|
|
@@ -119,6 +118,7 @@ export { Gallery } from './components/Gallery';
|
|
|
119
118
|
export { Lottie } from './components/Lottie';
|
|
120
119
|
export { Video } from './components/Video';
|
|
121
120
|
export { Waveform } from './components/Waveform';
|
|
121
|
+
export { Collapse } from './components/Collapse';
|
|
122
122
|
export { Divider } from './components/Divider';
|
|
123
123
|
export { Space } from './components/Space';
|
|
124
124
|
export { Link } from './components/Link';
|
|
@@ -127,7 +127,7 @@ export { CopyButton } from './components/CopyButton/CopyButton';
|
|
|
127
127
|
export { QRCode } from './components/QRCode';
|
|
128
128
|
export { KeyCap } from './components/KeyCap';
|
|
129
129
|
export { Spoiler } from './components/Spoiler';
|
|
130
|
-
export { PressAnimation, withPressAnimation, AnimatedPressable } from './components/PressAnimation/PressAnimation';
|
|
130
|
+
export { PressAnimation, withPressAnimation, AnimatedPressable } from './components/_internal/PressAnimation/PressAnimation';
|
|
131
131
|
export { Accordion } from './components/Accordion';
|
|
132
132
|
export type { PlatformBlocksTheme, PlatformBlocksThemeOverride } from './core/theme/types';
|
|
133
133
|
export type { PlatformBlocksProviderProps } from './core/theme/PlatformBlocksProvider';
|
|
@@ -148,7 +148,6 @@ export type { ShimmerTextProps } from './components/ShimmerText';
|
|
|
148
148
|
export type { HighlightProps } from './components/Highlight';
|
|
149
149
|
export type { OverlayProps } from './components/Overlay';
|
|
150
150
|
export type { TitleProps } from './components/Title/types';
|
|
151
|
-
export type { ContainerProps } from './components/Container';
|
|
152
151
|
export type { KeyboardAwareLayoutProps } from './components/KeyboardAwareLayout';
|
|
153
152
|
export type { FlexProps } from './components/Flex';
|
|
154
153
|
export type { GridProps, GridItemProps } from './components/Grid';
|
|
@@ -193,11 +192,11 @@ export type { IndicatorProps } from './components/Indicator';
|
|
|
193
192
|
export type { CardProps } from './components/Card';
|
|
194
193
|
export type { ChipProps } from './components/Chip';
|
|
195
194
|
export type { DataTableProps, DataTableColumn, DataTableSort, DataTablePagination } from './components/DataTable';
|
|
196
|
-
export type { DisclaimerProps, WithDisclaimerProps, ComponentWithDisclaimerProps, DisclaimerSupport } from './components/Disclaimer';
|
|
195
|
+
export type { DisclaimerProps, WithDisclaimerProps, ComponentWithDisclaimerProps, DisclaimerSupport } from './components/_internal/Disclaimer';
|
|
197
196
|
export type { TableProps } from './components/Table';
|
|
198
197
|
export type { TimelineProps } from './components/Timeline';
|
|
199
198
|
export type { TableOfContentsProps } from './components/TableOfContents';
|
|
200
|
-
export type {
|
|
199
|
+
export type { NoticeProps } from './components/Notice';
|
|
201
200
|
export type { ProgressProps } from './components/Progress';
|
|
202
201
|
export type { SkeletonProps } from './components/Skeleton';
|
|
203
202
|
export type { LoaderProps } from './components/Loader';
|
|
@@ -213,9 +212,11 @@ export type { PopoverProps, PopoverTargetProps, PopoverDropdownProps } from './c
|
|
|
213
212
|
export type { SpotlightProps } from './components/Spotlight';
|
|
214
213
|
export type { Action, Subject, Field, Conditions, PermissionRule, PermissionCheck, Ability, CanProps, CanWithConditionsProps, CannotProps, PermissionGateProps, PermissionContextValue, PermissionProviderProps, UsePermissionsOptions } from './components/Can';
|
|
215
214
|
export type { BrandIconProps, BrandName } from './components/BrandIcon';
|
|
215
|
+
export type { CollapseProps } from './components/Collapse';
|
|
216
216
|
export type { IconButtonProps } from './components/IconButton';
|
|
217
217
|
export type { CarouselProps } from './components/Carousel';
|
|
218
218
|
export type { GalleryProps, GalleryItem } from './components/Gallery';
|
|
219
|
+
export type { ImageProps } from './components/Image';
|
|
219
220
|
export type { LottieProps } from './components/Lottie';
|
|
220
221
|
export type { WaveformProps } from './components/Waveform';
|
|
221
222
|
export type { DividerProps } from './components/Divider';
|
|
@@ -227,7 +228,7 @@ export type { QRCodeProps } from './components/QRCode';
|
|
|
227
228
|
export type { KeyCapProps } from './components/KeyCap';
|
|
228
229
|
export type { SpoilerProps } from './components/Spoiler';
|
|
229
230
|
export type { FloatingActionsProps, FloatingActionItem } from './components/FloatingActions';
|
|
230
|
-
export type { PressAnimationProps } from './components/PressAnimation/PressAnimation';
|
|
231
|
+
export type { PressAnimationProps } from './components/_internal/PressAnimation/PressAnimation';
|
|
231
232
|
export type { AccordionProps } from './components/Accordion';
|
|
232
233
|
export type { MarkdownProps, MarkdownComponentMap } from './components/Markdown';
|
|
233
234
|
export type { AppShellProps } from './components/AppShell';
|
package/lib/utils/mask.d.ts
CHANGED
|
@@ -1,138 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Advanced input masking utility inspired by react-imask
|
|
3
|
-
* Provides flexible pattern-based input formatting with proper cursor handling
|
|
4
|
-
*/
|
|
5
|
-
export interface MaskDefinition {
|
|
6
|
-
/** The mask pattern (e.g., '(000) 000-0000', '+1 000 000 0000') */
|
|
7
|
-
mask: string;
|
|
8
|
-
/** Placeholder character for unfilled positions */
|
|
9
|
-
placeholderChar?: string;
|
|
10
|
-
/** Whether to show the mask when input is empty */
|
|
11
|
-
showMask?: boolean;
|
|
12
|
-
/** Custom definitions for mask characters */
|
|
13
|
-
definitions?: Record<string, RegExp>;
|
|
14
|
-
/** Whether to allow incomplete input */
|
|
15
|
-
lazy?: boolean;
|
|
16
|
-
}
|
|
17
|
-
export interface MaskResult {
|
|
18
|
-
/** The masked/formatted value */
|
|
19
|
-
value: string;
|
|
20
|
-
/** The unmasked/raw value */
|
|
21
|
-
unmaskedValue: string;
|
|
22
|
-
/** Whether the mask is complete */
|
|
23
|
-
isComplete: boolean;
|
|
24
|
-
/** Current cursor position after formatting */
|
|
25
|
-
cursorPosition: number;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Creates a masking function for the given pattern
|
|
29
|
-
*/
|
|
30
|
-
export declare function createMask(definition: MaskDefinition): {
|
|
31
|
-
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
32
|
-
getDisplayValue: (value: string) => string;
|
|
33
|
-
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
34
|
-
pattern: {
|
|
35
|
-
char: string;
|
|
36
|
-
isFixed: boolean;
|
|
37
|
-
regex?: RegExp;
|
|
38
|
-
}[];
|
|
39
|
-
definition: MaskDefinition;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Phone number specific masking presets
|
|
43
|
-
*/
|
|
44
|
-
export declare const PHONE_MASKS: {
|
|
45
|
-
US: {
|
|
46
|
-
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
47
|
-
getDisplayValue: (value: string) => string;
|
|
48
|
-
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
49
|
-
pattern: {
|
|
50
|
-
char: string;
|
|
51
|
-
isFixed: boolean;
|
|
52
|
-
regex?: RegExp;
|
|
53
|
-
}[];
|
|
54
|
-
definition: MaskDefinition;
|
|
55
|
-
};
|
|
56
|
-
US_WITH_COUNTRY: {
|
|
57
|
-
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
58
|
-
getDisplayValue: (value: string) => string;
|
|
59
|
-
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
60
|
-
pattern: {
|
|
61
|
-
char: string;
|
|
62
|
-
isFixed: boolean;
|
|
63
|
-
regex?: RegExp;
|
|
64
|
-
}[];
|
|
65
|
-
definition: MaskDefinition;
|
|
66
|
-
};
|
|
67
|
-
UK: {
|
|
68
|
-
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
69
|
-
getDisplayValue: (value: string) => string;
|
|
70
|
-
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
71
|
-
pattern: {
|
|
72
|
-
char: string;
|
|
73
|
-
isFixed: boolean;
|
|
74
|
-
regex?: RegExp;
|
|
75
|
-
}[];
|
|
76
|
-
definition: MaskDefinition;
|
|
77
|
-
};
|
|
78
|
-
INTERNATIONAL: {
|
|
79
|
-
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
80
|
-
getDisplayValue: (value: string) => string;
|
|
81
|
-
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
82
|
-
pattern: {
|
|
83
|
-
char: string;
|
|
84
|
-
isFixed: boolean;
|
|
85
|
-
regex?: RegExp;
|
|
86
|
-
}[];
|
|
87
|
-
definition: MaskDefinition;
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Other useful mask presets
|
|
92
|
-
*/
|
|
93
|
-
export declare const COMMON_MASKS: {
|
|
94
|
-
CREDIT_CARD: {
|
|
95
|
-
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
96
|
-
getDisplayValue: (value: string) => string;
|
|
97
|
-
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
98
|
-
pattern: {
|
|
99
|
-
char: string;
|
|
100
|
-
isFixed: boolean;
|
|
101
|
-
regex?: RegExp;
|
|
102
|
-
}[];
|
|
103
|
-
definition: MaskDefinition;
|
|
104
|
-
};
|
|
105
|
-
DATE: {
|
|
106
|
-
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
107
|
-
getDisplayValue: (value: string) => string;
|
|
108
|
-
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
109
|
-
pattern: {
|
|
110
|
-
char: string;
|
|
111
|
-
isFixed: boolean;
|
|
112
|
-
regex?: RegExp;
|
|
113
|
-
}[];
|
|
114
|
-
definition: MaskDefinition;
|
|
115
|
-
};
|
|
116
|
-
SSN: {
|
|
117
|
-
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
118
|
-
getDisplayValue: (value: string) => string;
|
|
119
|
-
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
120
|
-
pattern: {
|
|
121
|
-
char: string;
|
|
122
|
-
isFixed: boolean;
|
|
123
|
-
regex?: RegExp;
|
|
124
|
-
}[];
|
|
125
|
-
definition: MaskDefinition;
|
|
126
|
-
};
|
|
127
|
-
ZIP_CODE: {
|
|
128
|
-
applyMask: (inputValue: string, previousValue?: string, cursorPos?: number) => MaskResult;
|
|
129
|
-
getDisplayValue: (value: string) => string;
|
|
130
|
-
processInput: (newValue: string, oldValue: string, selectionStart?: number) => MaskResult;
|
|
131
|
-
pattern: {
|
|
132
|
-
char: string;
|
|
133
|
-
isFixed: boolean;
|
|
134
|
-
regex?: RegExp;
|
|
135
|
-
}[];
|
|
136
|
-
definition: MaskDefinition;
|
|
137
|
-
};
|
|
138
|
-
};
|
|
1
|
+
export { createMask, PHONE_MASKS, COMMON_MASKS, type MaskDefinition, type MaskResult, } from '../hooks/useMaskedInput/utils/mask';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platform-blocks/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "A React Native UI library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/cjs/index.js",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"@testing-library/react-native": "^12.4.3",
|
|
77
77
|
"@types/jest": "^29.5.12",
|
|
78
78
|
"@types/react": "~19.1.10",
|
|
79
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
80
|
-
"@typescript-eslint/parser": "^
|
|
79
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
80
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
81
81
|
"babel-jest": "^29.7.0",
|
|
82
82
|
"eslint": "^8.57.1",
|
|
83
83
|
"eslint-plugin-import": "^2.28.1",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ViewStyle, TextStyle } from 'react-native';
|
|
3
|
-
import { SpacingProps } from '../../core/utils';
|
|
4
|
-
/**
|
|
5
|
-
* Props for the CodeBlock component; extracted to a separate file for reuse and cleaner component file.
|
|
6
|
-
*/
|
|
7
|
-
export interface CodeBlockProps extends SpacingProps {
|
|
8
|
-
/** The code content to display */
|
|
9
|
-
children: string;
|
|
10
|
-
/** Optional title for the code block */
|
|
11
|
-
title?: string;
|
|
12
|
-
/** Optional filename badge (displayed left of copy button, overrides title if both provided) */
|
|
13
|
-
fileName?: string;
|
|
14
|
-
/** Optional icon element or name to render beside title/filename */
|
|
15
|
-
fileIcon?: React.ReactNode;
|
|
16
|
-
/** Programming language for syntax highlighting */
|
|
17
|
-
language?: any;
|
|
18
|
-
/** Whether to show line numbers */
|
|
19
|
-
showLineNumbers?: boolean;
|
|
20
|
-
/** Whether to enable syntax highlighting (default: true) */
|
|
21
|
-
highlight?: boolean;
|
|
22
|
-
/** Whether code block should fill the full width of its parent container */
|
|
23
|
-
fullWidth?: boolean;
|
|
24
|
-
/** Whether to show copy button (default: true) */
|
|
25
|
-
showCopyButton?: boolean;
|
|
26
|
-
/** Callback when copy button is pressed */
|
|
27
|
-
onCopy?: (code: string) => void;
|
|
28
|
-
/** Custom style for the container */
|
|
29
|
-
style?: ViewStyle;
|
|
30
|
-
/** Custom style for the code text */
|
|
31
|
-
textStyle?: TextStyle;
|
|
32
|
-
/** Custom style for the title */
|
|
33
|
-
titleStyle?: TextStyle;
|
|
34
|
-
/** Added highlightLines prop: accepts array of strings like ['5', '10-15'] */
|
|
35
|
-
highlightLines?: string[];
|
|
36
|
-
/** If true, wraps the code content in a Spoiler (collapsible) container */
|
|
37
|
-
spoiler?: boolean;
|
|
38
|
-
/** Max height (px) for spoiler collapsed state (only when spoiler=true) */
|
|
39
|
-
spoilerMaxHeight?: number;
|
|
40
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ViewStyle } from 'react-native';
|
|
3
|
-
import type { SpacingProps } from '../../core/utils/spacing';
|
|
4
|
-
export interface ContainerProps extends SpacingProps {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
style?: ViewStyle;
|
|
7
|
-
/** Makes container take full available height (flex: 1) */
|
|
8
|
-
fluid?: boolean;
|
|
9
|
-
backgroundImage?: {
|
|
10
|
-
uri: string;
|
|
11
|
-
opacity?: number;
|
|
12
|
-
overlay?: {
|
|
13
|
-
color?: string;
|
|
14
|
-
opacity?: number;
|
|
15
|
-
};
|
|
16
|
-
gradient?: {
|
|
17
|
-
colors: string[];
|
|
18
|
-
locations?: number[];
|
|
19
|
-
start?: {
|
|
20
|
-
x: number;
|
|
21
|
-
y: number;
|
|
22
|
-
};
|
|
23
|
-
end?: {
|
|
24
|
-
x: number;
|
|
25
|
-
y: number;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
padding?: number;
|
|
30
|
-
margin?: number;
|
|
31
|
-
}
|