@seekora-ai/ui-sdk-react 0.2.14 → 0.2.16
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/components/CurrentRefinements.d.ts.map +1 -1
- package/dist/components/CurrentRefinements.js +69 -9
- package/dist/components/FacetDropdown.d.ts +94 -0
- package/dist/components/FacetDropdown.d.ts.map +1 -0
- package/dist/components/FacetDropdown.js +396 -0
- package/dist/components/Facets.d.ts +30 -0
- package/dist/components/Facets.d.ts.map +1 -1
- package/dist/components/Facets.js +215 -7
- package/dist/components/FederatedDropdown.d.ts.map +1 -1
- package/dist/components/FederatedDropdown.js +45 -31
- package/dist/components/InfiniteHits.d.ts +0 -7
- package/dist/components/InfiniteHits.d.ts.map +1 -1
- package/dist/components/InfiniteHits.js +2 -13
- package/dist/components/Pagination.d.ts.map +1 -1
- package/dist/components/Pagination.js +27 -9
- package/dist/components/QuerySuggestions.d.ts +0 -4
- package/dist/components/QuerySuggestions.d.ts.map +1 -1
- package/dist/components/QuerySuggestions.js +1 -17
- package/dist/components/QuerySuggestionsDropdown.d.ts +0 -4
- package/dist/components/QuerySuggestionsDropdown.d.ts.map +1 -1
- package/dist/components/QuerySuggestionsDropdown.js +32 -33
- package/dist/components/RangeInput.d.ts.map +1 -1
- package/dist/components/RangeInput.js +6 -6
- package/dist/components/RangeSlider.d.ts.map +1 -1
- package/dist/components/RangeSlider.js +54 -32
- package/dist/components/Recommendations.d.ts +0 -7
- package/dist/components/Recommendations.d.ts.map +1 -1
- package/dist/components/Recommendations.js +3 -23
- package/dist/components/RichQuerySuggestions.d.ts +0 -4
- package/dist/components/RichQuerySuggestions.d.ts.map +1 -1
- package/dist/components/RichQuerySuggestions.js +40 -35
- package/dist/components/SearchBar.d.ts +0 -4
- package/dist/components/SearchBar.d.ts.map +1 -1
- package/dist/components/SearchBar.js +17 -11
- package/dist/components/SearchBarWithSuggestions.js +4 -4
- package/dist/components/SearchLayout.d.ts.map +1 -1
- package/dist/components/SearchLayout.js +22 -17
- package/dist/components/SearchProvider.d.ts.map +1 -1
- package/dist/components/SearchProvider.js +1 -3
- package/dist/components/SearchResults.d.ts +0 -6
- package/dist/components/SearchResults.d.ts.map +1 -1
- package/dist/components/SearchResults.js +38 -39
- package/dist/components/primitives/ActionButtons.d.ts.map +1 -1
- package/dist/components/primitives/ActionButtons.js +34 -10
- package/dist/components/primitives/BadgeList.d.ts.map +1 -1
- package/dist/components/primitives/BadgeList.js +33 -13
- package/dist/components/primitives/ImageDisplay.d.ts.map +1 -1
- package/dist/components/primitives/ImageDisplay.js +32 -19
- package/dist/components/primitives/ImageZoom.d.ts.map +1 -1
- package/dist/components/primitives/ImageZoom.js +85 -30
- package/dist/components/primitives/VariantSelector.js +10 -10
- package/dist/components/primitives/VariantSwatches.d.ts.map +1 -1
- package/dist/components/primitives/VariantSwatches.js +28 -13
- package/dist/components/product-page/ProductGallery.d.ts +8 -1
- package/dist/components/product-page/ProductGallery.d.ts.map +1 -1
- package/dist/components/product-page/ProductGallery.js +2 -2
- package/dist/components/section-primitives/SectionItemGrid.d.ts +1 -3
- package/dist/components/section-primitives/SectionItemGrid.d.ts.map +1 -1
- package/dist/components/section-primitives/SectionItemGrid.js +1 -4
- package/dist/components/section-primitives/SectionSearchProvider.d.ts +3 -1
- package/dist/components/section-primitives/SectionSearchProvider.d.ts.map +1 -1
- package/dist/components/section-primitives/SectionSearchProvider.js +3 -2
- package/dist/components/section-primitives/index.d.ts +0 -1
- package/dist/components/section-primitives/index.d.ts.map +1 -1
- package/dist/components/section-primitives/index.js +0 -1
- package/dist/components/suggestions/AmazonDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/AmazonDropdown.js +3 -21
- package/dist/components/suggestions/GoogleDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/GoogleDropdown.js +3 -20
- package/dist/components/suggestions/MinimalDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/MinimalDropdown.js +2 -2
- package/dist/components/suggestions/MobileSheetDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/MobileSheetDropdown.js +78 -78
- package/dist/components/suggestions/PinterestDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/PinterestDropdown.js +41 -41
- package/dist/components/suggestions/ShopifyDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/ShopifyDropdown.js +40 -41
- package/dist/components/suggestions/SpotlightDropdown.d.ts.map +1 -1
- package/dist/components/suggestions/SpotlightDropdown.js +2 -3
- package/dist/components/suggestions/SuggestionSearchBar.d.ts.map +1 -1
- package/dist/components/suggestions/SuggestionSearchBar.js +2 -15
- package/dist/components/suggestions/types.d.ts +0 -6
- package/dist/components/suggestions/types.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/DropdownPanel.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/DropdownPanel.js +15 -2
- package/dist/components/suggestions-primitives/ItemCard.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ItemCard.js +48 -11
- package/dist/components/suggestions-primitives/ItemGrid.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ItemGrid.js +18 -5
- package/dist/components/suggestions-primitives/ProductCard.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductCard.js +36 -12
- package/dist/components/suggestions-primitives/ProductCardLayouts.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductCardLayouts.js +52 -20
- package/dist/components/suggestions-primitives/ProductGrid.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/ProductGrid.js +8 -3
- package/dist/components/suggestions-primitives/RecentSearchesList.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/RecentSearchesList.js +12 -5
- package/dist/components/suggestions-primitives/SearchInput.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SearchInput.js +29 -10
- package/dist/components/suggestions-primitives/SuggestionItem.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionItem.js +8 -3
- package/dist/components/suggestions-primitives/SuggestionList.d.ts +1 -8
- package/dist/components/suggestions-primitives/SuggestionList.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/SuggestionList.js +1 -7
- package/dist/components/suggestions-primitives/TrendingList.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/TrendingList.js +14 -7
- package/dist/components/suggestions-primitives/index.d.ts +1 -3
- package/dist/components/suggestions-primitives/index.d.ts.map +1 -1
- package/dist/components/suggestions-primitives/index.js +1 -2
- package/dist/docsearch/components/DocSearch.d.ts.map +1 -1
- package/dist/docsearch/components/DocSearch.js +1 -1
- package/dist/docsearch/components/Results.d.ts +1 -3
- package/dist/docsearch/components/Results.d.ts.map +1 -1
- package/dist/docsearch/components/Results.js +1 -9
- package/dist/docsearch/components/SearchBox.d.ts +1 -2
- package/dist/docsearch/components/SearchBox.d.ts.map +1 -1
- package/dist/docsearch/components/SearchBox.js +4 -6
- package/dist/docsearch/hooks/useSeekoraSearch.d.ts.map +1 -1
- package/dist/docsearch/hooks/useSeekoraSearch.js +6 -0
- package/dist/docsearch/types.d.ts +0 -1
- package/dist/docsearch/types.d.ts.map +1 -1
- package/dist/docsearch.css +2 -5
- package/dist/hooks/useClickTracking.d.ts.map +1 -1
- package/dist/hooks/useClickTracking.js +4 -11
- package/dist/hooks/useExperiment.d.ts.map +1 -1
- package/dist/hooks/useExperiment.js +10 -33
- package/dist/hooks/useFilters.d.ts +27 -0
- package/dist/hooks/useFilters.d.ts.map +1 -0
- package/dist/hooks/useFilters.js +66 -0
- package/dist/index.d.ts +10 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.umd.js +1 -1
- package/dist/src/index.d.ts +166 -81
- package/dist/src/index.esm.js +2141 -1048
- package/dist/src/index.esm.js.map +1 -1
- package/dist/src/index.js +2142 -1049
- package/dist/src/index.js.map +1 -1
- package/dist/utils/responsive.d.ts +130 -0
- package/dist/utils/responsive.d.ts.map +1 -0
- package/dist/utils/responsive.js +231 -0
- package/package.json +7 -7
- package/src/docsearch/docsearch.css +2 -5
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Responsive utilities for adaptive layouts across all screen sizes
|
|
3
|
+
*
|
|
4
|
+
* Provides hooks and utilities for:
|
|
5
|
+
* - Responsive breakpoints
|
|
6
|
+
* - Responsive grid columns
|
|
7
|
+
* - Responsive spacing
|
|
8
|
+
* - Responsive font sizes
|
|
9
|
+
* - Touch target sizing
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Standard breakpoints (in pixels)
|
|
13
|
+
*/
|
|
14
|
+
export declare const BREAKPOINTS: {
|
|
15
|
+
readonly xs: 0;
|
|
16
|
+
readonly sm: 576;
|
|
17
|
+
readonly md: 768;
|
|
18
|
+
readonly lg: 992;
|
|
19
|
+
readonly xl: 1200;
|
|
20
|
+
readonly xxl: 1400;
|
|
21
|
+
};
|
|
22
|
+
export type Breakpoint = keyof typeof BREAKPOINTS;
|
|
23
|
+
export type BreakpointValue = typeof BREAKPOINTS[Breakpoint];
|
|
24
|
+
/**
|
|
25
|
+
* Get current breakpoint based on window width
|
|
26
|
+
*/
|
|
27
|
+
export declare function getCurrentBreakpoint(width: number): Breakpoint;
|
|
28
|
+
/**
|
|
29
|
+
* Hook to get current breakpoint
|
|
30
|
+
*/
|
|
31
|
+
export declare function useBreakpoint(): Breakpoint;
|
|
32
|
+
/**
|
|
33
|
+
* Hook to check if current viewport matches breakpoint
|
|
34
|
+
*/
|
|
35
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Check if mobile viewport (< 768px)
|
|
38
|
+
*/
|
|
39
|
+
export declare function useIsMobile(): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Check if tablet viewport (768px - 991px)
|
|
42
|
+
*/
|
|
43
|
+
export declare function useIsTablet(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Check if desktop viewport (>= 992px)
|
|
46
|
+
*/
|
|
47
|
+
export declare function useIsDesktop(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get responsive grid columns based on breakpoint
|
|
50
|
+
*/
|
|
51
|
+
export declare function getResponsiveColumns(breakpoint: Breakpoint, defaultColumns?: number): number;
|
|
52
|
+
/**
|
|
53
|
+
* Hook to get responsive grid columns
|
|
54
|
+
*/
|
|
55
|
+
export declare function useResponsiveColumns(defaultColumns?: number): number;
|
|
56
|
+
/**
|
|
57
|
+
* Get responsive spacing value
|
|
58
|
+
*/
|
|
59
|
+
export declare function getResponsiveSpacing(breakpoint: Breakpoint, spacing: {
|
|
60
|
+
xs?: number;
|
|
61
|
+
sm?: number;
|
|
62
|
+
md?: number;
|
|
63
|
+
lg?: number;
|
|
64
|
+
xl?: number;
|
|
65
|
+
xxl?: number;
|
|
66
|
+
}): number;
|
|
67
|
+
/**
|
|
68
|
+
* Get responsive font size
|
|
69
|
+
*/
|
|
70
|
+
export declare function getResponsiveFontSize(breakpoint: Breakpoint, sizes: {
|
|
71
|
+
xs?: string;
|
|
72
|
+
sm?: string;
|
|
73
|
+
md?: string;
|
|
74
|
+
lg?: string;
|
|
75
|
+
xl?: string;
|
|
76
|
+
xxl?: string;
|
|
77
|
+
}): string;
|
|
78
|
+
/**
|
|
79
|
+
* Minimum touch target size (WCAG AAA)
|
|
80
|
+
*/
|
|
81
|
+
export declare const MIN_TOUCH_TARGET = 44;
|
|
82
|
+
/**
|
|
83
|
+
* Get touch target size based on device type
|
|
84
|
+
*/
|
|
85
|
+
export declare function getTouchTargetSize(isMobile: boolean, baseSize?: number): number;
|
|
86
|
+
/**
|
|
87
|
+
* Hook to get responsive touch target size
|
|
88
|
+
*/
|
|
89
|
+
export declare function useTouchTargetSize(baseSize?: number): number;
|
|
90
|
+
/**
|
|
91
|
+
* Responsive value helper - returns different values based on breakpoint
|
|
92
|
+
*/
|
|
93
|
+
export declare function useResponsiveValue<T>(values: Partial<Record<Breakpoint, T>> & {
|
|
94
|
+
default: T;
|
|
95
|
+
}): T;
|
|
96
|
+
/**
|
|
97
|
+
* Get responsive gap/padding for grids
|
|
98
|
+
*/
|
|
99
|
+
export declare function getResponsiveGap(breakpoint: Breakpoint, baseGap?: number): number;
|
|
100
|
+
/**
|
|
101
|
+
* Hook to get responsive gap
|
|
102
|
+
*/
|
|
103
|
+
export declare function useResponsiveGap(baseGap?: number): number;
|
|
104
|
+
/**
|
|
105
|
+
* Get responsive padding for containers
|
|
106
|
+
*/
|
|
107
|
+
export declare function getResponsivePadding(breakpoint: Breakpoint, basePadding?: number): number;
|
|
108
|
+
/**
|
|
109
|
+
* Hook to get responsive padding
|
|
110
|
+
*/
|
|
111
|
+
export declare function useResponsivePadding(basePadding?: number): number;
|
|
112
|
+
/**
|
|
113
|
+
* CSS media query strings for use in style objects
|
|
114
|
+
*/
|
|
115
|
+
export declare const MEDIA_QUERIES: {
|
|
116
|
+
readonly xs: `(max-width: ${number}px)`;
|
|
117
|
+
readonly sm: "(min-width: 576px)";
|
|
118
|
+
readonly md: "(min-width: 768px)";
|
|
119
|
+
readonly lg: "(min-width: 992px)";
|
|
120
|
+
readonly xl: "(min-width: 1200px)";
|
|
121
|
+
readonly xxl: "(min-width: 1400px)";
|
|
122
|
+
readonly mobile: `(max-width: ${number}px)`;
|
|
123
|
+
readonly tablet: `(min-width: 768px) and (max-width: ${number}px)`;
|
|
124
|
+
readonly desktop: "(min-width: 992px)";
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Helper to generate responsive CSS with media queries
|
|
128
|
+
*/
|
|
129
|
+
export declare function responsiveStyle<T extends React.CSSProperties>(base: T, mobile?: Partial<T>, tablet?: Partial<T>, desktop?: Partial<T>): T;
|
|
130
|
+
//# sourceMappingURL=responsive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responsive.d.ts","sourceRoot":"","sources":["../../src/utils/responsive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;CAOd,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,WA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- Responsive breakpoints
|
|
6
|
+
* - Responsive grid columns
|
|
7
|
+
* - Responsive spacing
|
|
8
|
+
* - Responsive font sizes
|
|
9
|
+
* - Touch target sizing
|
|
10
|
+
*/
|
|
11
|
+
import { useState, useEffect } from 'react';
|
|
12
|
+
/**
|
|
13
|
+
* Standard breakpoints (in pixels)
|
|
14
|
+
*/
|
|
15
|
+
export const BREAKPOINTS = {
|
|
16
|
+
xs: 0, // Extra small devices (portrait phones, < 576px)
|
|
17
|
+
sm: 576, // Small devices (landscape phones, ≥ 576px)
|
|
18
|
+
md: 768, // Medium devices (tablets, ≥ 768px)
|
|
19
|
+
lg: 992, // Large devices (desktops, ≥ 992px)
|
|
20
|
+
xl: 1200, // Extra large devices (large desktops, ≥ 1200px)
|
|
21
|
+
xxl: 1400, // Extra extra large devices (larger desktops, ≥ 1400px)
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Get current breakpoint based on window width
|
|
25
|
+
*/
|
|
26
|
+
export function getCurrentBreakpoint(width) {
|
|
27
|
+
if (width >= BREAKPOINTS.xxl)
|
|
28
|
+
return 'xxl';
|
|
29
|
+
if (width >= BREAKPOINTS.xl)
|
|
30
|
+
return 'xl';
|
|
31
|
+
if (width >= BREAKPOINTS.lg)
|
|
32
|
+
return 'lg';
|
|
33
|
+
if (width >= BREAKPOINTS.md)
|
|
34
|
+
return 'md';
|
|
35
|
+
if (width >= BREAKPOINTS.sm)
|
|
36
|
+
return 'sm';
|
|
37
|
+
return 'xs';
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Hook to get current breakpoint
|
|
41
|
+
*/
|
|
42
|
+
export function useBreakpoint() {
|
|
43
|
+
const [breakpoint, setBreakpoint] = useState(() => {
|
|
44
|
+
if (typeof window === 'undefined')
|
|
45
|
+
return 'lg';
|
|
46
|
+
return getCurrentBreakpoint(window.innerWidth);
|
|
47
|
+
});
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
const handleResize = () => {
|
|
50
|
+
setBreakpoint(getCurrentBreakpoint(window.innerWidth));
|
|
51
|
+
};
|
|
52
|
+
handleResize();
|
|
53
|
+
window.addEventListener('resize', handleResize);
|
|
54
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
55
|
+
}, []);
|
|
56
|
+
return breakpoint;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Hook to check if current viewport matches breakpoint
|
|
60
|
+
*/
|
|
61
|
+
export function useMediaQuery(query) {
|
|
62
|
+
const [matches, setMatches] = useState(() => {
|
|
63
|
+
if (typeof window === 'undefined')
|
|
64
|
+
return false;
|
|
65
|
+
return window.matchMedia(query).matches;
|
|
66
|
+
});
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
const mediaQuery = window.matchMedia(query);
|
|
69
|
+
const handleChange = () => setMatches(mediaQuery.matches);
|
|
70
|
+
handleChange();
|
|
71
|
+
mediaQuery.addEventListener('change', handleChange);
|
|
72
|
+
return () => mediaQuery.removeEventListener('change', handleChange);
|
|
73
|
+
}, [query]);
|
|
74
|
+
return matches;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Check if mobile viewport (< 768px)
|
|
78
|
+
*/
|
|
79
|
+
export function useIsMobile() {
|
|
80
|
+
return useMediaQuery(`(max-width: ${BREAKPOINTS.md - 1}px)`);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Check if tablet viewport (768px - 991px)
|
|
84
|
+
*/
|
|
85
|
+
export function useIsTablet() {
|
|
86
|
+
return useMediaQuery(`(min-width: ${BREAKPOINTS.md}px) and (max-width: ${BREAKPOINTS.lg - 1}px)`);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Check if desktop viewport (>= 992px)
|
|
90
|
+
*/
|
|
91
|
+
export function useIsDesktop() {
|
|
92
|
+
return useMediaQuery(`(min-width: ${BREAKPOINTS.lg}px)`);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get responsive grid columns based on breakpoint
|
|
96
|
+
*/
|
|
97
|
+
export function getResponsiveColumns(breakpoint, defaultColumns = 4) {
|
|
98
|
+
switch (breakpoint) {
|
|
99
|
+
case 'xs':
|
|
100
|
+
return Math.min(defaultColumns, 1); // 1 column on extra small
|
|
101
|
+
case 'sm':
|
|
102
|
+
return Math.min(defaultColumns, 2); // 2 columns on small
|
|
103
|
+
case 'md':
|
|
104
|
+
return Math.min(defaultColumns, 3); // 3 columns on medium
|
|
105
|
+
case 'lg':
|
|
106
|
+
return Math.min(defaultColumns, 4); // 4 columns on large
|
|
107
|
+
case 'xl':
|
|
108
|
+
return Math.min(defaultColumns, 5); // 5 columns on extra large
|
|
109
|
+
case 'xxl':
|
|
110
|
+
return defaultColumns; // Full columns on extra extra large
|
|
111
|
+
default:
|
|
112
|
+
return defaultColumns;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Hook to get responsive grid columns
|
|
117
|
+
*/
|
|
118
|
+
export function useResponsiveColumns(defaultColumns = 4) {
|
|
119
|
+
const breakpoint = useBreakpoint();
|
|
120
|
+
return getResponsiveColumns(breakpoint, defaultColumns);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Get responsive spacing value
|
|
124
|
+
*/
|
|
125
|
+
export function getResponsiveSpacing(breakpoint, spacing) {
|
|
126
|
+
return spacing[breakpoint] ?? spacing.md ?? spacing.sm ?? spacing.xs ?? 12;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Get responsive font size
|
|
130
|
+
*/
|
|
131
|
+
export function getResponsiveFontSize(breakpoint, sizes) {
|
|
132
|
+
return sizes[breakpoint] ?? sizes.md ?? sizes.sm ?? sizes.xs ?? '1rem';
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Minimum touch target size (WCAG AAA)
|
|
136
|
+
*/
|
|
137
|
+
export const MIN_TOUCH_TARGET = 44; // 44x44px minimum for touch
|
|
138
|
+
/**
|
|
139
|
+
* Get touch target size based on device type
|
|
140
|
+
*/
|
|
141
|
+
export function getTouchTargetSize(isMobile, baseSize = 32) {
|
|
142
|
+
return isMobile ? Math.max(MIN_TOUCH_TARGET, baseSize) : baseSize;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Hook to get responsive touch target size
|
|
146
|
+
*/
|
|
147
|
+
export function useTouchTargetSize(baseSize = 32) {
|
|
148
|
+
const isMobile = useIsMobile();
|
|
149
|
+
return getTouchTargetSize(isMobile, baseSize);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Responsive value helper - returns different values based on breakpoint
|
|
153
|
+
*/
|
|
154
|
+
export function useResponsiveValue(values) {
|
|
155
|
+
const breakpoint = useBreakpoint();
|
|
156
|
+
return values[breakpoint] ?? values.default;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Get responsive gap/padding for grids
|
|
160
|
+
*/
|
|
161
|
+
export function getResponsiveGap(breakpoint, baseGap = 12) {
|
|
162
|
+
switch (breakpoint) {
|
|
163
|
+
case 'xs':
|
|
164
|
+
return Math.max(4, baseGap * 0.5); // 50% on extra small
|
|
165
|
+
case 'sm':
|
|
166
|
+
return Math.max(6, baseGap * 0.75); // 75% on small
|
|
167
|
+
case 'md':
|
|
168
|
+
case 'lg':
|
|
169
|
+
return baseGap; // 100% on medium/large
|
|
170
|
+
case 'xl':
|
|
171
|
+
case 'xxl':
|
|
172
|
+
return baseGap * 1.25; // 125% on extra large
|
|
173
|
+
default:
|
|
174
|
+
return baseGap;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Hook to get responsive gap
|
|
179
|
+
*/
|
|
180
|
+
export function useResponsiveGap(baseGap = 12) {
|
|
181
|
+
const breakpoint = useBreakpoint();
|
|
182
|
+
return getResponsiveGap(breakpoint, baseGap);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Get responsive padding for containers
|
|
186
|
+
*/
|
|
187
|
+
export function getResponsivePadding(breakpoint, basePadding = 12) {
|
|
188
|
+
switch (breakpoint) {
|
|
189
|
+
case 'xs':
|
|
190
|
+
return Math.max(8, basePadding * 0.67); // ~67% on extra small
|
|
191
|
+
case 'sm':
|
|
192
|
+
return Math.max(10, basePadding * 0.83); // ~83% on small
|
|
193
|
+
case 'md':
|
|
194
|
+
case 'lg':
|
|
195
|
+
return basePadding; // 100% on medium/large
|
|
196
|
+
case 'xl':
|
|
197
|
+
case 'xxl':
|
|
198
|
+
return basePadding * 1.33; // ~133% on extra large
|
|
199
|
+
default:
|
|
200
|
+
return basePadding;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Hook to get responsive padding
|
|
205
|
+
*/
|
|
206
|
+
export function useResponsivePadding(basePadding = 12) {
|
|
207
|
+
const breakpoint = useBreakpoint();
|
|
208
|
+
return getResponsivePadding(breakpoint, basePadding);
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* CSS media query strings for use in style objects
|
|
212
|
+
*/
|
|
213
|
+
export const MEDIA_QUERIES = {
|
|
214
|
+
xs: `(max-width: ${BREAKPOINTS.sm - 1}px)`,
|
|
215
|
+
sm: `(min-width: ${BREAKPOINTS.sm}px)`,
|
|
216
|
+
md: `(min-width: ${BREAKPOINTS.md}px)`,
|
|
217
|
+
lg: `(min-width: ${BREAKPOINTS.lg}px)`,
|
|
218
|
+
xl: `(min-width: ${BREAKPOINTS.xl}px)`,
|
|
219
|
+
xxl: `(min-width: ${BREAKPOINTS.xxl}px)`,
|
|
220
|
+
mobile: `(max-width: ${BREAKPOINTS.md - 1}px)`,
|
|
221
|
+
tablet: `(min-width: ${BREAKPOINTS.md}px) and (max-width: ${BREAKPOINTS.lg - 1}px)`,
|
|
222
|
+
desktop: `(min-width: ${BREAKPOINTS.lg}px)`,
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* Helper to generate responsive CSS with media queries
|
|
226
|
+
*/
|
|
227
|
+
export function responsiveStyle(base, mobile, tablet, desktop) {
|
|
228
|
+
// This returns base styles only - media queries should be handled via CSS-in-JS or CSS files
|
|
229
|
+
// For inline styles, use the hooks instead
|
|
230
|
+
return base;
|
|
231
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seekora-ai/ui-sdk-react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"description": "Seekora UI Components SDK for React - Interactive UI components for search and query suggestions",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"author": "Seekora",
|
|
42
42
|
"license": "MIT",
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@seekora-ai/search-sdk": "^0.2.
|
|
44
|
+
"@seekora-ai/search-sdk": "^0.2.14",
|
|
45
45
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
46
46
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@seekora-ai/ui-sdk-core": "^0.2.
|
|
50
|
-
"@seekora-ai/ui-sdk-types": "^0.2.
|
|
49
|
+
"@seekora-ai/ui-sdk-core": "^0.2.16",
|
|
50
|
+
"@seekora-ai/ui-sdk-types": "^0.2.16",
|
|
51
51
|
"clsx": "^2.1.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
"@rollup/plugin-replace": "^5.0.5",
|
|
57
57
|
"@rollup/plugin-terser": "^0.4.4",
|
|
58
58
|
"@rollup/plugin-typescript": "^11.1.5",
|
|
59
|
-
"@seekora-ai/search-sdk": "^0.2.
|
|
59
|
+
"@seekora-ai/search-sdk": "^0.2.14",
|
|
60
60
|
"@types/node": "^20.0.0",
|
|
61
|
-
"@types/react": "^18.
|
|
62
|
-
"@types/react-dom": "^18.
|
|
61
|
+
"@types/react": "^18.3.27",
|
|
62
|
+
"@types/react-dom": "^18.3.7",
|
|
63
63
|
"rollup": "^4.9.0",
|
|
64
64
|
"rollup-plugin-dts": "^6.1.0",
|
|
65
65
|
"tslib": "^2.8.1",
|
|
@@ -193,8 +193,6 @@
|
|
|
193
193
|
.seekora-docsearch-input::placeholder { color: var(--seekora-docsearch-text-secondary); }
|
|
194
194
|
.seekora-docsearch-clear { display: flex; align-items: center; justify-content: center; padding: var(--seekora-docsearch-spacing-xs); background: transparent; border: none; border-radius: var(--seekora-docsearch-radius-sm); color: var(--seekora-docsearch-text-muted); cursor: pointer; transition: all var(--seekora-docsearch-transition-fast) ease; flex-shrink: 0; }
|
|
195
195
|
.seekora-docsearch-clear:hover { background: var(--seekora-docsearch-hit-bg-hover); color: var(--seekora-docsearch-text); }
|
|
196
|
-
.seekora-docsearch-spinner { display: flex; align-items: center; justify-content: center; color: var(--seekora-docsearch-primary); animation: seekora-docsearch-spin 0.8s linear infinite; }
|
|
197
|
-
@keyframes seekora-docsearch-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
|
|
198
196
|
|
|
199
197
|
.seekora-docsearch-results { padding: var(--seekora-docsearch-spacing-sm) 0; }
|
|
200
198
|
.seekora-docsearch-results-list { list-style: none; margin: 0; padding: 0; }
|
|
@@ -215,9 +213,8 @@
|
|
|
215
213
|
.seekora-docsearch-hit-action { display: flex; align-items: center; justify-content: center; color: var(--seekora-docsearch-text-secondary); flex-shrink: 0; opacity: 0; transition: opacity var(--seekora-docsearch-transition-fast) ease; }
|
|
216
214
|
.seekora-docsearch-hit:hover .seekora-docsearch-hit-action, .seekora-docsearch-hit--selected .seekora-docsearch-hit-action { opacity: 1; }
|
|
217
215
|
.seekora-docsearch-highlight mark { background: var(--seekora-docsearch-highlight-bg); color: var(--seekora-docsearch-highlight-text); font-weight: var(--seekora-docsearch-font-weight-semibold); padding: 0 2px; border-radius: 2px; }
|
|
218
|
-
.seekora-docsearch-empty, .seekora-docsearch-
|
|
219
|
-
.seekora-docsearch-empty-text, .seekora-docsearch-
|
|
220
|
-
.seekora-docsearch-loading-spinner { color: var(--seekora-docsearch-primary); margin-bottom: var(--seekora-docsearch-spacing-md); animation: seekora-docsearch-spin 0.8s linear infinite; }
|
|
216
|
+
.seekora-docsearch-empty, .seekora-docsearch-no-results, .seekora-docsearch-error { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--seekora-docsearch-spacing-xl); text-align: center; }
|
|
217
|
+
.seekora-docsearch-empty-text, .seekora-docsearch-no-results-text, .seekora-docsearch-error-text { color: var(--seekora-docsearch-text-muted); font-size: var(--seekora-docsearch-font-size-md); margin: 0; }
|
|
221
218
|
.seekora-docsearch-error-text { color: #ef4444; }
|
|
222
219
|
.seekora-docsearch-hit--child { padding-left: var(--seekora-docsearch-spacing-md); }
|
|
223
220
|
.seekora-docsearch-hit--child .seekora-docsearch-hit-icon { width: 32px; height: 32px; }
|