@sankhyatronics/sankhya-ui 0.0.1
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/LICENSE +21 -0
- package/README.md +35 -0
- package/dist/App.d.ts +2 -0
- package/dist/components/BentoGrid/BentoGrid.d.ts +18 -0
- package/dist/components/CTASection/CTASection.d.ts +7 -0
- package/dist/components/Card/Card.d.ts +12 -0
- package/dist/components/Common/BaseComponent.interfaces.d.ts +23 -0
- package/dist/components/Common/DynamicRenderer.constants.d.ts +22 -0
- package/dist/components/Common/DynamicRenderer.d.ts +3 -0
- package/dist/components/Common/DynamicRenderer.interfaces.d.ts +16 -0
- package/dist/components/ContentBlock/ContentBlock.d.ts +14 -0
- package/dist/components/Dropdown/Dropdown.d.ts +15 -0
- package/dist/components/FeatureSplit/FeatureSplit.d.ts +17 -0
- package/dist/components/FeaturesSection/FeatureItem.d.ts +9 -0
- package/dist/components/FeaturesSection/FeaturesSection.d.ts +9 -0
- package/dist/components/Footer/Footer.d.ts +23 -0
- package/dist/components/HamburgerMenu/HamburgerMenu.d.ts +7 -0
- package/dist/components/Header/Header.d.ts +14 -0
- package/dist/components/Hero/Hero.d.ts +9 -0
- package/dist/components/IconButton/IconButton.d.ts +10 -0
- package/dist/components/ItemsAccordion/ItemsAccordion.d.ts +14 -0
- package/dist/components/Menu/MenuGrid.d.ts +7 -0
- package/dist/components/Menu/MenuGridItem.d.ts +11 -0
- package/dist/components/Menu/MenuItem.d.ts +14 -0
- package/dist/components/Stats/Stats.d.ts +11 -0
- package/dist/components/Testimonials/Testimonials.d.ts +14 -0
- package/dist/contexts/DropdownContext.d.ts +11 -0
- package/dist/hooks/useApiConfig.d.ts +35 -0
- package/dist/hooks/useBreakpointTouch.d.ts +21 -0
- package/dist/hooks/useDataConfig.d.ts +106 -0
- package/dist/hooks/useTypedApiConfig.d.ts +17 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.es.js +13984 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +21 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sankhyatronics
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @sankhyatronics/SankhyaUI
|
|
2
|
+
|
|
3
|
+
The core UI library for the SankhyaUI system. Build dynamic, JSON-driven portals with ease.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @sankhyatronics/SankhyaUI
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { DynamicRenderer } from '@sankhyatronics/SankhyaUI';
|
|
15
|
+
import '@sankhyatronics/SankhyaUI/styles';
|
|
16
|
+
|
|
17
|
+
const pageData = [
|
|
18
|
+
{
|
|
19
|
+
type: "Hero",
|
|
20
|
+
data: {
|
|
21
|
+
Title: "Hello World",
|
|
22
|
+
SubTitle: "Welcome to my portal"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
function App() {
|
|
28
|
+
return <DynamicRenderer data={pageData} />;
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
- **Highly Modular**: Each component is independent and purely visual.
|
|
34
|
+
- **CMS Ready**: Designed to work with Storyblok, Contentful, or custom JSON backends.
|
|
35
|
+
- **Tailwind Integrated**: Uses Tailwind CSS for modern, responsive designs.
|
package/dist/App.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseProps, SectionProps } from '../Common/BaseComponent.interfaces';
|
|
3
|
+
export interface BentoGridItem extends BaseProps {
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
image?: {
|
|
8
|
+
imageSrc: string;
|
|
9
|
+
alt: string;
|
|
10
|
+
};
|
|
11
|
+
colSpan?: 1 | 2 | 3 | 4;
|
|
12
|
+
rowSpan?: 1 | 2;
|
|
13
|
+
href?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface BentoGridProps extends SectionProps {
|
|
16
|
+
items: BentoGridItem[];
|
|
17
|
+
}
|
|
18
|
+
export declare const BentoGrid: React.FC<BentoGridProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SectionProps, ActionableProps } from '../Common/BaseComponent.interfaces';
|
|
3
|
+
export interface CTASectionProps extends SectionProps, ActionableProps {
|
|
4
|
+
imageSrc?: string;
|
|
5
|
+
inverted?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const CTASection: React.FC<CTASectionProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface CardProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
variant?: 'default' | 'bordered';
|
|
6
|
+
padding?: 'none' | 'sm' | 'md' | 'lg';
|
|
7
|
+
hoverable?: boolean;
|
|
8
|
+
elevation?: 'none' | 'sm' | 'md' | 'lg';
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
inverted?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const Card: React.FC<CardProps>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base properties shared by ALL components.
|
|
3
|
+
*/
|
|
4
|
+
export interface BaseProps {
|
|
5
|
+
id?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
inverted?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Properties shared by main sections/blocks (Hero, FeaturesSection, etc).
|
|
11
|
+
*/
|
|
12
|
+
export interface SectionProps extends BaseProps {
|
|
13
|
+
title?: string;
|
|
14
|
+
subtitle?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Properties for components that have a primary action/call-to-action.
|
|
18
|
+
*/
|
|
19
|
+
export interface ActionableProps {
|
|
20
|
+
actionLabel?: string;
|
|
21
|
+
href?: string;
|
|
22
|
+
onAction?: () => void;
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentList } from './DynamicRenderer.interfaces';
|
|
2
|
+
export declare const baseComponents: {
|
|
3
|
+
readonly Header: import('react').FC<import('../Header/Header').HeaderProps>;
|
|
4
|
+
readonly MenuItem: import('react').FC<import('../Menu/MenuItem').MenuItemProps>;
|
|
5
|
+
readonly MenuGrid: import('react').FC<import('../Menu/MenuGrid').MenuGridProps>;
|
|
6
|
+
readonly MenuGridItem: import('react').FC<import('../Menu/MenuGridItem').MenuGridItemProps>;
|
|
7
|
+
readonly Dropdown: import('react').FC<import('../Dropdown/Dropdown').DropdownProps>;
|
|
8
|
+
readonly Hero: import('react').FC<import('../Hero/Hero').HeroProps>;
|
|
9
|
+
readonly IconButton: import('react').FC<import('../IconButton/IconButton').IconButtonProps>;
|
|
10
|
+
readonly HamburgerMenu: import('react').FC<import('../HamburgerMenu/HamburgerMenu').HamburgerMenuProps>;
|
|
11
|
+
readonly FeatureSplit: import('react').FC<import('../FeatureSplit/FeatureSplit').FeatureSplitProps>;
|
|
12
|
+
readonly ContentBlock: import('react').FC<import('../ContentBlock/ContentBlock').ContentBlockProps>;
|
|
13
|
+
readonly FeaturesSection: import('react').FC<import('../FeaturesSection/FeaturesSection').FeaturesSectionProps>;
|
|
14
|
+
readonly FeatureItem: import('react').FC<import('../FeaturesSection/FeatureItem').FeatureItemProps>;
|
|
15
|
+
readonly BentoGrid: import('react').FC<import('../BentoGrid/BentoGrid').BentoGridProps>;
|
|
16
|
+
readonly Stats: import('react').FC<import('../Stats/Stats').StatsProps>;
|
|
17
|
+
readonly CTASection: import('react').FC<import('../CTASection/CTASection').CTASectionProps>;
|
|
18
|
+
readonly Testimonials: import('react').FC<import('../Testimonials/Testimonials').TestimonialsProps>;
|
|
19
|
+
};
|
|
20
|
+
export declare function registerComponent<T extends ComponentList>(name: T, component: React.ComponentType<any>): void;
|
|
21
|
+
export declare function getComponent<T extends ComponentList>(name: T): React.ComponentType<any> | undefined;
|
|
22
|
+
export declare function hasComponent(name: string): name is ComponentList;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type ComponentList = 'Dropdown' | 'Header' | 'MenuItem' | 'MenuGrid' | 'MenuGridItem' | 'Hero' | 'IconButton' | 'HamburgerMenu' | 'ItemsAccordion' | 'Footer' | 'Stats' | 'FeatureSplit' | 'ContentBlock' | 'FeaturesSection' | 'BentoGrid' | 'FeatureItem' | 'CTASection' | 'Testimonials';
|
|
2
|
+
export interface IDynamicRendererProps {
|
|
3
|
+
config: IComponent | IComponent[] | any;
|
|
4
|
+
className?: string;
|
|
5
|
+
handlers?: Record<string, (...args: any[]) => void>;
|
|
6
|
+
onError?: (error: Error, component: IComponent) => void;
|
|
7
|
+
}
|
|
8
|
+
export interface IComponent {
|
|
9
|
+
type: ComponentList;
|
|
10
|
+
data: {
|
|
11
|
+
id: string;
|
|
12
|
+
children?: Array<IComponent>;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare function isIComponent(obj: unknown): obj is IComponent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SectionProps } from '../Common/BaseComponent.interfaces';
|
|
3
|
+
export interface ContentBlockProps extends SectionProps {
|
|
4
|
+
content?: string;
|
|
5
|
+
format?: 'html' | 'markdown';
|
|
6
|
+
image?: {
|
|
7
|
+
imageSrc: string;
|
|
8
|
+
alt: string;
|
|
9
|
+
caption?: string;
|
|
10
|
+
};
|
|
11
|
+
className?: string;
|
|
12
|
+
inverted?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const ContentBlock: React.FC<ContentBlockProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface DropdownProps {
|
|
2
|
+
children?: React.ReactNode[] | React.ReactNode;
|
|
3
|
+
className?: string;
|
|
4
|
+
itemGroupClassName?: string;
|
|
5
|
+
itemClassName?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
iconPosition?: 'left' | 'right';
|
|
9
|
+
iconSize?: string;
|
|
10
|
+
iconColor?: string;
|
|
11
|
+
href?: string;
|
|
12
|
+
id?: string;
|
|
13
|
+
target?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const Dropdown: React.FC<DropdownProps>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SectionProps, ActionableProps } from '../Common/BaseComponent.interfaces';
|
|
3
|
+
export interface FeatureSplitItem {
|
|
4
|
+
icon?: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
}
|
|
8
|
+
export interface FeatureSplitProps extends SectionProps, ActionableProps {
|
|
9
|
+
items?: FeatureSplitItem[];
|
|
10
|
+
image: {
|
|
11
|
+
imageSrc: string;
|
|
12
|
+
alt: string;
|
|
13
|
+
};
|
|
14
|
+
imagePosition?: 'left' | 'right' | 'top';
|
|
15
|
+
inverted?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const FeatureSplit: React.FC<FeatureSplitProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseProps, ActionableProps } from '../Common/BaseComponent.interfaces';
|
|
3
|
+
export interface FeatureItemProps extends BaseProps, ActionableProps {
|
|
4
|
+
icon?: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
inverted?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const FeatureItem: React.FC<FeatureItemProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FeatureItemProps } from './FeatureItem';
|
|
3
|
+
import { SectionProps, ActionableProps } from '../Common/BaseComponent.interfaces';
|
|
4
|
+
export interface FeaturesSectionProps extends SectionProps, ActionableProps {
|
|
5
|
+
items?: FeatureItemProps[];
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
columns?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const FeaturesSection: React.FC<FeaturesSectionProps>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseProps } from '../Common/BaseComponent.interfaces';
|
|
3
|
+
export interface FooterLink {
|
|
4
|
+
label: string;
|
|
5
|
+
href: string;
|
|
6
|
+
}
|
|
7
|
+
export interface FooterColumn {
|
|
8
|
+
title: string;
|
|
9
|
+
links: FooterLink[];
|
|
10
|
+
}
|
|
11
|
+
export interface FooterProps extends BaseProps {
|
|
12
|
+
imageSrc?: string;
|
|
13
|
+
companyName?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
columns: FooterColumn[];
|
|
16
|
+
socialLinks?: {
|
|
17
|
+
icon: string;
|
|
18
|
+
href: string;
|
|
19
|
+
}[];
|
|
20
|
+
copyright?: string;
|
|
21
|
+
inverted?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const Footer: React.FC<FooterProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseProps } from '../Common/BaseComponent.interfaces';
|
|
3
|
+
export interface HeaderProps extends BaseProps {
|
|
4
|
+
sticky?: boolean;
|
|
5
|
+
mobileBreakpoint?: number;
|
|
6
|
+
logoHref?: string;
|
|
7
|
+
logoTarget?: string;
|
|
8
|
+
logoClassName?: string;
|
|
9
|
+
imageSrc?: string;
|
|
10
|
+
altText?: string;
|
|
11
|
+
menuBar?: React.ReactNode[];
|
|
12
|
+
utilityButtons?: React.ReactNode[];
|
|
13
|
+
}
|
|
14
|
+
export declare const Header: React.FC<HeaderProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SectionProps, ActionableProps } from '../Common/BaseComponent.interfaces';
|
|
2
|
+
export interface HeroProps extends SectionProps, ActionableProps {
|
|
3
|
+
imageSrc?: string;
|
|
4
|
+
textAlignment?: 'left' | 'center' | 'right' | 'justify';
|
|
5
|
+
padding?: 'none' | 'small' | 'medium' | 'large';
|
|
6
|
+
inverted?: boolean;
|
|
7
|
+
focalPoint?: 'top' | 'left' | 'right' | 'bottom' | 'center';
|
|
8
|
+
}
|
|
9
|
+
export declare const Hero: React.FC<HeroProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface IconButtonProps {
|
|
2
|
+
icon: string;
|
|
3
|
+
onClick?: () => void;
|
|
4
|
+
ariaLabel: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
badge?: string | number;
|
|
7
|
+
active?: boolean;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const IconButton: React.FC<IconButtonProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface AccordionItem {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
content: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export interface ItemsAccordionProps {
|
|
8
|
+
title?: string;
|
|
9
|
+
subtitle?: string;
|
|
10
|
+
items: AccordionItem[];
|
|
11
|
+
className?: string;
|
|
12
|
+
allowMultiple?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const ItemsAccordion: React.FC<ItemsAccordionProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface MenuGridItemProps {
|
|
2
|
+
title: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
href: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
badge?: string;
|
|
7
|
+
compact?: boolean;
|
|
8
|
+
showDescription?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const MenuGridItem: React.FC<MenuGridItemProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface MenuItemProps {
|
|
2
|
+
title: string;
|
|
3
|
+
href: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
badge?: string | number;
|
|
7
|
+
isActive?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
showDescription?: boolean;
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
target?: string;
|
|
12
|
+
compact?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const MenuItem: React.FC<MenuItemProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseProps } from '../Common/BaseComponent.interfaces';
|
|
3
|
+
export interface StatItem {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface StatsProps extends BaseProps {
|
|
9
|
+
items: StatItem[];
|
|
10
|
+
}
|
|
11
|
+
export declare const Stats: React.FC<StatsProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { BaseProps, SectionProps } from '../Common/BaseComponent.interfaces';
|
|
3
|
+
export interface TestimonialItem extends BaseProps {
|
|
4
|
+
name: string;
|
|
5
|
+
role: string;
|
|
6
|
+
company?: string;
|
|
7
|
+
imageSrc?: string;
|
|
8
|
+
quote: string;
|
|
9
|
+
rating?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface TestimonialsProps extends SectionProps {
|
|
12
|
+
items: TestimonialItem[];
|
|
13
|
+
}
|
|
14
|
+
export declare const Testimonials: React.FC<TestimonialsProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface DropdownContextType {
|
|
3
|
+
activeDropdown: string | null;
|
|
4
|
+
setActiveDropdown: (id: string | null) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const useDropdownContext: () => DropdownContextType;
|
|
7
|
+
interface DropdownProviderProps {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const DropdownProvider: React.FC<DropdownProviderProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface ApiService {
|
|
2
|
+
get<T = any>(endpoint: string, options?: any): Promise<{
|
|
3
|
+
data: T;
|
|
4
|
+
status: number;
|
|
5
|
+
statusText: string;
|
|
6
|
+
}>;
|
|
7
|
+
}
|
|
8
|
+
export interface ApiResponse<T = any> {
|
|
9
|
+
data: T;
|
|
10
|
+
status: number;
|
|
11
|
+
statusText: string;
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
export interface ApiError {
|
|
15
|
+
error: string;
|
|
16
|
+
status: number;
|
|
17
|
+
statusText: string;
|
|
18
|
+
}
|
|
19
|
+
interface UseApiConfigOptions {
|
|
20
|
+
endpoint: string;
|
|
21
|
+
storyName?: string;
|
|
22
|
+
params?: Record<string, string>;
|
|
23
|
+
autoFetch?: boolean;
|
|
24
|
+
apiService?: ApiService;
|
|
25
|
+
}
|
|
26
|
+
export declare function setDefaultApiService(service: ApiService): void;
|
|
27
|
+
export declare function getDefaultApiService(): ApiService;
|
|
28
|
+
export declare function useApiConfig<T = any>({ endpoint, storyName, params, autoFetch, apiService }: UseApiConfigOptions): {
|
|
29
|
+
data: T | null;
|
|
30
|
+
loading: boolean;
|
|
31
|
+
error: string | null;
|
|
32
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
33
|
+
setData: import('react').Dispatch<import('react').SetStateAction<T | null>>;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface TouchDeviceOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Screen width breakpoint (in pixels) below which device is considered touch/mobile
|
|
4
|
+
* @default 768
|
|
5
|
+
*/
|
|
6
|
+
breakpoint?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Whether to use actual touch detection in addition to breakpoint
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
useActualDetection?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Class name to add to HTML element when device is considered touch
|
|
14
|
+
* @default 'touch-device'
|
|
15
|
+
*/
|
|
16
|
+
touchClassName?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const useTouchDevice: (options?: TouchDeviceOptions) => boolean;
|
|
19
|
+
export declare const useMobileTouchDevice: () => boolean;
|
|
20
|
+
export declare const useTabletTouchDevice: () => boolean;
|
|
21
|
+
export declare const useDesktopTouchDevice: () => boolean;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { ApiService } from './useApiConfig';
|
|
2
|
+
export declare function useMenuGridItemConfig(story: string, apiService: ApiService, variant?: string): {
|
|
3
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
4
|
+
loading: boolean;
|
|
5
|
+
error: string | null;
|
|
6
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
7
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
8
|
+
};
|
|
9
|
+
export declare function useMenuGridConfig(story: string, apiService: ApiService, variant?: string): {
|
|
10
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
error: string | null;
|
|
13
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
14
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
15
|
+
};
|
|
16
|
+
export declare function useDropdownConfig(story: string, apiService: ApiService, variant?: string): {
|
|
17
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
18
|
+
loading: boolean;
|
|
19
|
+
error: string | null;
|
|
20
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
21
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
22
|
+
};
|
|
23
|
+
export declare function useHamburgerMenuConfig(story: string, apiService: ApiService, variant?: string): {
|
|
24
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
25
|
+
loading: boolean;
|
|
26
|
+
error: string | null;
|
|
27
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
28
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
29
|
+
};
|
|
30
|
+
export declare function useHeroConfig(story: string, apiService: ApiService, variant?: string): {
|
|
31
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
32
|
+
loading: boolean;
|
|
33
|
+
error: string | null;
|
|
34
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
35
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
36
|
+
};
|
|
37
|
+
export declare function useHeaderConfig(story: string, apiService: ApiService, variant?: string): {
|
|
38
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
39
|
+
loading: boolean;
|
|
40
|
+
error: string | null;
|
|
41
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
42
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
43
|
+
};
|
|
44
|
+
export declare function useItemsAccordionConfig(story: string, apiService: ApiService, variant?: string): {
|
|
45
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
46
|
+
loading: boolean;
|
|
47
|
+
error: string | null;
|
|
48
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
49
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
50
|
+
};
|
|
51
|
+
export declare function useFooterConfig(story: string, apiService: ApiService, variant?: string): {
|
|
52
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
53
|
+
loading: boolean;
|
|
54
|
+
error: string | null;
|
|
55
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
56
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
57
|
+
};
|
|
58
|
+
export declare function useStatsConfig(story: string, apiService: ApiService, variant?: string): {
|
|
59
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
60
|
+
loading: boolean;
|
|
61
|
+
error: string | null;
|
|
62
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
63
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
64
|
+
};
|
|
65
|
+
export declare function useFeatureSplitConfig(story: string, apiService: ApiService, variant?: string): {
|
|
66
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
67
|
+
loading: boolean;
|
|
68
|
+
error: string | null;
|
|
69
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
70
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
71
|
+
};
|
|
72
|
+
export declare function useContentBlockConfig(story: string, apiService: ApiService, variant?: string): {
|
|
73
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
74
|
+
loading: boolean;
|
|
75
|
+
error: string | null;
|
|
76
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
77
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
78
|
+
};
|
|
79
|
+
export declare function useFeaturesSectionConfig(story: string, apiService: ApiService, variant?: string): {
|
|
80
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
81
|
+
loading: boolean;
|
|
82
|
+
error: string | null;
|
|
83
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
84
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
85
|
+
};
|
|
86
|
+
export declare function useBentoGridConfig(story: string, apiService: ApiService, variant?: string): {
|
|
87
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
88
|
+
loading: boolean;
|
|
89
|
+
error: string | null;
|
|
90
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
91
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
92
|
+
};
|
|
93
|
+
export declare function useCTASectionConfig(story: string, apiService: ApiService, variant?: string): {
|
|
94
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
95
|
+
loading: boolean;
|
|
96
|
+
error: string | null;
|
|
97
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
98
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
99
|
+
};
|
|
100
|
+
export declare function useTestimonialsConfig(story: string, apiService: ApiService, variant?: string): {
|
|
101
|
+
data: import('../components/Common/DynamicRenderer.interfaces').IComponent | null;
|
|
102
|
+
loading: boolean;
|
|
103
|
+
error: string | null;
|
|
104
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
105
|
+
setData: import('react').Dispatch<import('react').SetStateAction<import('../components/Common/DynamicRenderer.interfaces').IComponent | null>>;
|
|
106
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ApiService } from './useApiConfig';
|
|
2
|
+
import { IComponent } from '../components/Common/DynamicRenderer.interfaces';
|
|
3
|
+
interface UseTypedApiConfigOptions {
|
|
4
|
+
component: ComponentType;
|
|
5
|
+
story: string;
|
|
6
|
+
apiService: ApiService;
|
|
7
|
+
variant?: string;
|
|
8
|
+
}
|
|
9
|
+
type ComponentType = 'MenuGridItem' | 'MenuGrid' | 'Dropdown' | 'Header' | 'Hero' | 'HamburgerMenu' | 'Card' | 'ItemsAccordion' | 'Footer' | 'Stats' | 'FeatureSplit' | 'ContentBlock' | 'FeaturesSection' | 'BentoGrid' | 'CTASection' | 'Testimonials';
|
|
10
|
+
export declare function useTypedApiConfig(options: UseTypedApiConfigOptions): {
|
|
11
|
+
data: IComponent | null;
|
|
12
|
+
loading: boolean;
|
|
13
|
+
error: string | null;
|
|
14
|
+
refetch: (customStory?: string, customParams?: Record<string, string>) => Promise<void>;
|
|
15
|
+
setData: import('react').Dispatch<import('react').SetStateAction<IComponent | null>>;
|
|
16
|
+
};
|
|
17
|
+
export {};
|