@zoiq.io/dev-kit 0.1.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/README.md +96 -0
- package/dist/index.d.mts +236 -0
- package/dist/index.d.ts +236 -0
- package/dist/index.js +379 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +362 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# ZOIQ
|
|
2
|
+
|
|
3
|
+
React component library and framework with **project-key-driven theme**, hooks, and UI primitives. Use a single project key to auto-configure colors, fonts, and branding across your app.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install zoiq
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer dependencies: `react`, `react-dom` (>=18).
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
Wrap your app with `ZOIQProvider` and pass your project key (and optional API base URL):
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { ZOIQProvider, Page, Header, Text, useProjectSettings } from 'zoiq'
|
|
19
|
+
|
|
20
|
+
function App() {
|
|
21
|
+
return (
|
|
22
|
+
<ZOIQProvider projectKey="your-project-id" apiBaseUrl="https://your-portal.com">
|
|
23
|
+
<Page>
|
|
24
|
+
<Header left={<Logo />} right={<UserMenu />} />
|
|
25
|
+
<Text>Content with theme applied</Text>
|
|
26
|
+
</Page>
|
|
27
|
+
</ZOIQProvider>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## ZOIQProvider
|
|
33
|
+
|
|
34
|
+
| Prop | Type | Description |
|
|
35
|
+
|------|------|-------------|
|
|
36
|
+
| `projectKey` | `string` | **Required.** Project ID or public front-end key used to fetch theme and config. |
|
|
37
|
+
| `apiBaseUrl` | `string` | Optional. Base URL for the project config API. Defaults to `window.location.origin` (same origin). |
|
|
38
|
+
| `fetchProjectConfig` | `(key: string) => Promise<ProjectSettings \| null>` | Optional. Custom fetcher; if provided, `apiBaseUrl` is ignored for config. |
|
|
39
|
+
|
|
40
|
+
The provider:
|
|
41
|
+
|
|
42
|
+
1. Fetches project theme (styleGuide, branding, definedColors, navbarSettings) from `GET {apiBaseUrl}/api/zoiq/project/{projectKey}`.
|
|
43
|
+
2. Applies theme by setting CSS variables on `document.documentElement` and optional font links.
|
|
44
|
+
3. Exposes the same config via context for `useProjectSettings` and other hooks.
|
|
45
|
+
|
|
46
|
+
## Hooks
|
|
47
|
+
|
|
48
|
+
### useProjectSettings()
|
|
49
|
+
|
|
50
|
+
Returns the full project theme/settings (same data the provider used to apply theme). Use within `ZOIQProvider`.
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
const { data, loading, error, refetch } = useProjectSettings()
|
|
54
|
+
// data: ProjectSettings | null (styleGuide, branding, definedColors, navbarSettings)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### useSectionFlags()
|
|
58
|
+
|
|
59
|
+
Returns which section IDs are enabled or disabled for the current project (e.g. for feature gating or nav). Uses `GET {apiBaseUrl}/api/zoiq/project/{projectKey}/sections`.
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
const { enabledIds, disabledIds, loading, error, refetch } = useSectionFlags()
|
|
63
|
+
// enabledIds: Set<string>, disabledIds: Set<string>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### useZOIQApi\<T\>(entity, options?)
|
|
67
|
+
|
|
68
|
+
Fetches custom entity data for the current project. Uses `GET {apiBaseUrl}/api/zoiq/project/{projectKey}/data/{entity}?id=...`.
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
const { data, loading, error, refetch } = useZOIQApi<PageType>('pages', { id: 'abc' })
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Supported entities (when using the default portal API): `pages`, `siteData`.
|
|
75
|
+
|
|
76
|
+
## Components
|
|
77
|
+
|
|
78
|
+
- **Atoms:** `Text`, `Title`, `Subtitle`, `ScrollButton`, `ToggleTheme`
|
|
79
|
+
- **Molecules:** `Section`, `ToastContainer` (placeholder; use your own toast library)
|
|
80
|
+
- **Layout:** `Page`, `Header`, `Footer`, `SecondarySidebar`
|
|
81
|
+
|
|
82
|
+
All components use CSS variables (e.g. `var(--primary)`, `var(--text-primary)`) so ZOIQProvider’s theme applies automatically.
|
|
83
|
+
|
|
84
|
+
## API (backend)
|
|
85
|
+
|
|
86
|
+
The default client expects these endpoints on the host (e.g. your portal):
|
|
87
|
+
|
|
88
|
+
- `GET /api/zoiq/project/[projectKey]` → project theme (styleGuide, branding, definedColors, navbarSettings)
|
|
89
|
+
- `GET /api/zoiq/project/[projectKey]/sections` → `{ enabledIds: string[], disabledIds: string[] }`
|
|
90
|
+
- `GET /api/zoiq/project/[projectKey]/data/[entity]?id=...` → entity data (e.g. `pages`, `siteData`)
|
|
91
|
+
|
|
92
|
+
You can bypass these by passing a custom `fetchProjectConfig` to `ZOIQProvider`.
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
See repository license.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Project theme/settings shape returned by the config API and consumed by ZOIQProvider.
|
|
6
|
+
*/
|
|
7
|
+
interface ProjectSettings {
|
|
8
|
+
styleGuide?: Record<string, string | null> | null;
|
|
9
|
+
branding?: {
|
|
10
|
+
navbarLogo?: {
|
|
11
|
+
fileID?: string | null;
|
|
12
|
+
link?: string | null;
|
|
13
|
+
} | null;
|
|
14
|
+
footerLogo?: {
|
|
15
|
+
fileID?: string | null;
|
|
16
|
+
link?: string | null;
|
|
17
|
+
} | null;
|
|
18
|
+
loaderLogo?: {
|
|
19
|
+
fileID?: string | null;
|
|
20
|
+
link?: string | null;
|
|
21
|
+
} | null;
|
|
22
|
+
faviconLogo?: {
|
|
23
|
+
fileID?: string | null;
|
|
24
|
+
link?: string | null;
|
|
25
|
+
} | null;
|
|
26
|
+
authImage?: {
|
|
27
|
+
fileID?: string | null;
|
|
28
|
+
link?: string | null;
|
|
29
|
+
} | null;
|
|
30
|
+
customLogos?: Array<{
|
|
31
|
+
name: string;
|
|
32
|
+
description?: string | null;
|
|
33
|
+
fileID?: string | null;
|
|
34
|
+
link?: string | null;
|
|
35
|
+
} | null> | null;
|
|
36
|
+
primaryFont?: {
|
|
37
|
+
name?: string | null;
|
|
38
|
+
link?: string | null;
|
|
39
|
+
} | null;
|
|
40
|
+
secondaryFont?: {
|
|
41
|
+
name?: string | null;
|
|
42
|
+
link?: string | null;
|
|
43
|
+
} | null;
|
|
44
|
+
tertiaryFont?: {
|
|
45
|
+
name?: string | null;
|
|
46
|
+
link?: string | null;
|
|
47
|
+
} | null;
|
|
48
|
+
} | null;
|
|
49
|
+
definedColors?: Array<{
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
value: string;
|
|
53
|
+
} | null> | null;
|
|
54
|
+
clientDefinedColors?: Array<{
|
|
55
|
+
name: string;
|
|
56
|
+
description?: string | null;
|
|
57
|
+
definedColor?: {
|
|
58
|
+
name: string;
|
|
59
|
+
value: string;
|
|
60
|
+
} | null;
|
|
61
|
+
} | null> | null;
|
|
62
|
+
navbarSettings?: {
|
|
63
|
+
isSticky?: boolean | null;
|
|
64
|
+
fontSize?: string | null;
|
|
65
|
+
alignment?: string | null;
|
|
66
|
+
logoSize?: string | null;
|
|
67
|
+
navbarType?: string | null;
|
|
68
|
+
gutters?: string | null;
|
|
69
|
+
subCategoryAnimation?: string | null;
|
|
70
|
+
} | null;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Section flag: enabled/disabled per section ID.
|
|
74
|
+
*/
|
|
75
|
+
interface SectionFlag {
|
|
76
|
+
id: string;
|
|
77
|
+
enabled: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Response shape for section flags API.
|
|
81
|
+
*/
|
|
82
|
+
interface SectionFlagsData {
|
|
83
|
+
enabledIds: string[];
|
|
84
|
+
disabledIds: string[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface ZOIQProviderProps {
|
|
88
|
+
/** Project key (e.g. project ID or public API key) to fetch theme and config */
|
|
89
|
+
projectKey: string;
|
|
90
|
+
/** Base URL for the project config API (e.g. https://your-portal.com/api/zoiq) */
|
|
91
|
+
apiBaseUrl?: string;
|
|
92
|
+
/** Optional custom fetcher; if provided, apiBaseUrl is ignored for config fetch */
|
|
93
|
+
fetchProjectConfig?: (key: string) => Promise<ProjectSettings | null>;
|
|
94
|
+
children: React.ReactNode;
|
|
95
|
+
}
|
|
96
|
+
interface ZOIQContextValue {
|
|
97
|
+
projectKey: string;
|
|
98
|
+
apiBaseUrl?: string;
|
|
99
|
+
settings: ProjectSettings | null;
|
|
100
|
+
loading: boolean;
|
|
101
|
+
error: Error | null;
|
|
102
|
+
refetch: () => Promise<void>;
|
|
103
|
+
}
|
|
104
|
+
declare function ZOIQProvider({ projectKey, apiBaseUrl, fetchProjectConfig: customFetch, children, }: ZOIQProviderProps): react_jsx_runtime.JSX.Element;
|
|
105
|
+
declare function useZOIQContext(): ZOIQContextValue | null;
|
|
106
|
+
|
|
107
|
+
interface UseProjectSettingsResult {
|
|
108
|
+
data: ProjectSettings | null;
|
|
109
|
+
loading: boolean;
|
|
110
|
+
error: Error | null;
|
|
111
|
+
refetch: () => Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Returns the full project theme/settings for the current project key.
|
|
115
|
+
* Must be used within ZOIQProvider. Data is the same that the provider used to apply theme.
|
|
116
|
+
*/
|
|
117
|
+
declare function useProjectSettings(): UseProjectSettingsResult;
|
|
118
|
+
|
|
119
|
+
interface UseSectionFlagsResult {
|
|
120
|
+
enabledIds: Set<string>;
|
|
121
|
+
disabledIds: Set<string>;
|
|
122
|
+
loading: boolean;
|
|
123
|
+
error: Error | null;
|
|
124
|
+
refetch: () => Promise<void>;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Returns which section IDs are enabled or disabled for the current project.
|
|
128
|
+
* Must be used within ZOIQProvider. Uses the same apiBaseUrl as the provider.
|
|
129
|
+
*/
|
|
130
|
+
declare function useSectionFlags(): UseSectionFlagsResult;
|
|
131
|
+
|
|
132
|
+
interface UseZOIQApiOptions {
|
|
133
|
+
id?: string;
|
|
134
|
+
query?: Record<string, string>;
|
|
135
|
+
}
|
|
136
|
+
interface UseZOIQApiResult<T> {
|
|
137
|
+
data: T | null;
|
|
138
|
+
loading: boolean;
|
|
139
|
+
error: Error | null;
|
|
140
|
+
refetch: () => Promise<void>;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Fetches custom entity data for the current project.
|
|
144
|
+
* Must be used within ZOIQProvider.
|
|
145
|
+
*/
|
|
146
|
+
declare function useZOIQApi<T = unknown>(entity: string, options?: UseZOIQApiOptions): UseZOIQApiResult<T>;
|
|
147
|
+
|
|
148
|
+
interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
149
|
+
children?: React.ReactNode;
|
|
150
|
+
className?: string;
|
|
151
|
+
as?: 'span' | 'p' | 'div';
|
|
152
|
+
}
|
|
153
|
+
declare const Text: ({ children, className, as: As, ...props }: TextProps) => react_jsx_runtime.JSX.Element;
|
|
154
|
+
|
|
155
|
+
interface TitleProps {
|
|
156
|
+
children?: React.ReactNode;
|
|
157
|
+
className?: string;
|
|
158
|
+
}
|
|
159
|
+
declare const Title: ({ children, className }: TitleProps) => react_jsx_runtime.JSX.Element;
|
|
160
|
+
|
|
161
|
+
interface SubtitleProps {
|
|
162
|
+
children?: React.ReactNode;
|
|
163
|
+
className?: string;
|
|
164
|
+
}
|
|
165
|
+
declare const Subtitle: ({ children, className }: SubtitleProps) => react_jsx_runtime.JSX.Element;
|
|
166
|
+
|
|
167
|
+
interface ScrollButtonProps {
|
|
168
|
+
className?: string;
|
|
169
|
+
/** Scroll Y threshold above which the button is shown (default 200) */
|
|
170
|
+
threshold?: number;
|
|
171
|
+
}
|
|
172
|
+
declare const ScrollButton: ({ className, threshold }: ScrollButtonProps) => react_jsx_runtime.JSX.Element;
|
|
173
|
+
|
|
174
|
+
interface ToggleThemeProps {
|
|
175
|
+
className?: string;
|
|
176
|
+
/** Callback when user requests theme toggle; host app controls actual theme state */
|
|
177
|
+
onToggle?: () => void;
|
|
178
|
+
/** Optional current theme name for rendering (e.g. "light" | "dark") */
|
|
179
|
+
theme?: string;
|
|
180
|
+
/** Content to show (e.g. icon). If not provided, shows "Theme" */
|
|
181
|
+
children?: React.ReactNode;
|
|
182
|
+
}
|
|
183
|
+
declare const ToggleTheme: ({ className, onToggle, theme, children }: ToggleThemeProps) => react_jsx_runtime.JSX.Element;
|
|
184
|
+
|
|
185
|
+
interface SectionProps {
|
|
186
|
+
children?: React.ReactNode;
|
|
187
|
+
className?: string;
|
|
188
|
+
}
|
|
189
|
+
declare const Section: ({ children, className }: SectionProps) => react_jsx_runtime.JSX.Element;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Placeholder for toast container. Host app should render Toaster from "sonner" (or similar)
|
|
193
|
+
* inside the app; ZOIQ does not bundle a toast library.
|
|
194
|
+
*/
|
|
195
|
+
declare const ToastContainer: () => null;
|
|
196
|
+
|
|
197
|
+
interface PageProps {
|
|
198
|
+
children?: React.ReactNode;
|
|
199
|
+
className?: string;
|
|
200
|
+
/** Optional full-width layout (no horizontal padding) */
|
|
201
|
+
fullWidth?: boolean;
|
|
202
|
+
}
|
|
203
|
+
declare const Page: ({ children, className, fullWidth }: PageProps) => react_jsx_runtime.JSX.Element;
|
|
204
|
+
|
|
205
|
+
interface HeaderProps {
|
|
206
|
+
children?: React.ReactNode;
|
|
207
|
+
className?: string;
|
|
208
|
+
/** Optional left slot (e.g. logo, nav) */
|
|
209
|
+
left?: React.ReactNode;
|
|
210
|
+
/** Optional right slot (e.g. user menu, theme toggle) */
|
|
211
|
+
right?: React.ReactNode;
|
|
212
|
+
}
|
|
213
|
+
declare const Header: ({ children, className, left, right }: HeaderProps) => react_jsx_runtime.JSX.Element;
|
|
214
|
+
|
|
215
|
+
interface FooterProps {
|
|
216
|
+
children?: React.ReactNode;
|
|
217
|
+
className?: string;
|
|
218
|
+
}
|
|
219
|
+
declare const Footer: ({ children, className }: FooterProps) => react_jsx_runtime.JSX.Element;
|
|
220
|
+
|
|
221
|
+
interface SecondarySidebarItem {
|
|
222
|
+
label: string;
|
|
223
|
+
href: string;
|
|
224
|
+
icon?: React.ReactNode;
|
|
225
|
+
}
|
|
226
|
+
interface SecondarySidebarProps {
|
|
227
|
+
items: SecondarySidebarItem[];
|
|
228
|
+
className?: string;
|
|
229
|
+
/** Optional: return true if item is active (e.g. from pathname) */
|
|
230
|
+
isActive?: (item: SecondarySidebarItem) => boolean;
|
|
231
|
+
/** Optional: custom link renderer (e.g. Next.js Link). Default: <a> */
|
|
232
|
+
renderLink?: (item: SecondarySidebarItem, children: React.ReactNode) => React.ReactNode;
|
|
233
|
+
}
|
|
234
|
+
declare const SecondarySidebar: ({ items, className, isActive, renderLink }: SecondarySidebarProps) => react_jsx_runtime.JSX.Element;
|
|
235
|
+
|
|
236
|
+
export { Footer, Header, Page, type ProjectSettings, ScrollButton, SecondarySidebar, type SecondarySidebarItem, type SecondarySidebarProps, Section, type SectionFlag, type SectionFlagsData, Subtitle, Text, Title, ToastContainer, ToggleTheme, ZOIQProvider, useProjectSettings, useSectionFlags, useZOIQApi, useZOIQContext };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Project theme/settings shape returned by the config API and consumed by ZOIQProvider.
|
|
6
|
+
*/
|
|
7
|
+
interface ProjectSettings {
|
|
8
|
+
styleGuide?: Record<string, string | null> | null;
|
|
9
|
+
branding?: {
|
|
10
|
+
navbarLogo?: {
|
|
11
|
+
fileID?: string | null;
|
|
12
|
+
link?: string | null;
|
|
13
|
+
} | null;
|
|
14
|
+
footerLogo?: {
|
|
15
|
+
fileID?: string | null;
|
|
16
|
+
link?: string | null;
|
|
17
|
+
} | null;
|
|
18
|
+
loaderLogo?: {
|
|
19
|
+
fileID?: string | null;
|
|
20
|
+
link?: string | null;
|
|
21
|
+
} | null;
|
|
22
|
+
faviconLogo?: {
|
|
23
|
+
fileID?: string | null;
|
|
24
|
+
link?: string | null;
|
|
25
|
+
} | null;
|
|
26
|
+
authImage?: {
|
|
27
|
+
fileID?: string | null;
|
|
28
|
+
link?: string | null;
|
|
29
|
+
} | null;
|
|
30
|
+
customLogos?: Array<{
|
|
31
|
+
name: string;
|
|
32
|
+
description?: string | null;
|
|
33
|
+
fileID?: string | null;
|
|
34
|
+
link?: string | null;
|
|
35
|
+
} | null> | null;
|
|
36
|
+
primaryFont?: {
|
|
37
|
+
name?: string | null;
|
|
38
|
+
link?: string | null;
|
|
39
|
+
} | null;
|
|
40
|
+
secondaryFont?: {
|
|
41
|
+
name?: string | null;
|
|
42
|
+
link?: string | null;
|
|
43
|
+
} | null;
|
|
44
|
+
tertiaryFont?: {
|
|
45
|
+
name?: string | null;
|
|
46
|
+
link?: string | null;
|
|
47
|
+
} | null;
|
|
48
|
+
} | null;
|
|
49
|
+
definedColors?: Array<{
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
value: string;
|
|
53
|
+
} | null> | null;
|
|
54
|
+
clientDefinedColors?: Array<{
|
|
55
|
+
name: string;
|
|
56
|
+
description?: string | null;
|
|
57
|
+
definedColor?: {
|
|
58
|
+
name: string;
|
|
59
|
+
value: string;
|
|
60
|
+
} | null;
|
|
61
|
+
} | null> | null;
|
|
62
|
+
navbarSettings?: {
|
|
63
|
+
isSticky?: boolean | null;
|
|
64
|
+
fontSize?: string | null;
|
|
65
|
+
alignment?: string | null;
|
|
66
|
+
logoSize?: string | null;
|
|
67
|
+
navbarType?: string | null;
|
|
68
|
+
gutters?: string | null;
|
|
69
|
+
subCategoryAnimation?: string | null;
|
|
70
|
+
} | null;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Section flag: enabled/disabled per section ID.
|
|
74
|
+
*/
|
|
75
|
+
interface SectionFlag {
|
|
76
|
+
id: string;
|
|
77
|
+
enabled: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Response shape for section flags API.
|
|
81
|
+
*/
|
|
82
|
+
interface SectionFlagsData {
|
|
83
|
+
enabledIds: string[];
|
|
84
|
+
disabledIds: string[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface ZOIQProviderProps {
|
|
88
|
+
/** Project key (e.g. project ID or public API key) to fetch theme and config */
|
|
89
|
+
projectKey: string;
|
|
90
|
+
/** Base URL for the project config API (e.g. https://your-portal.com/api/zoiq) */
|
|
91
|
+
apiBaseUrl?: string;
|
|
92
|
+
/** Optional custom fetcher; if provided, apiBaseUrl is ignored for config fetch */
|
|
93
|
+
fetchProjectConfig?: (key: string) => Promise<ProjectSettings | null>;
|
|
94
|
+
children: React.ReactNode;
|
|
95
|
+
}
|
|
96
|
+
interface ZOIQContextValue {
|
|
97
|
+
projectKey: string;
|
|
98
|
+
apiBaseUrl?: string;
|
|
99
|
+
settings: ProjectSettings | null;
|
|
100
|
+
loading: boolean;
|
|
101
|
+
error: Error | null;
|
|
102
|
+
refetch: () => Promise<void>;
|
|
103
|
+
}
|
|
104
|
+
declare function ZOIQProvider({ projectKey, apiBaseUrl, fetchProjectConfig: customFetch, children, }: ZOIQProviderProps): react_jsx_runtime.JSX.Element;
|
|
105
|
+
declare function useZOIQContext(): ZOIQContextValue | null;
|
|
106
|
+
|
|
107
|
+
interface UseProjectSettingsResult {
|
|
108
|
+
data: ProjectSettings | null;
|
|
109
|
+
loading: boolean;
|
|
110
|
+
error: Error | null;
|
|
111
|
+
refetch: () => Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Returns the full project theme/settings for the current project key.
|
|
115
|
+
* Must be used within ZOIQProvider. Data is the same that the provider used to apply theme.
|
|
116
|
+
*/
|
|
117
|
+
declare function useProjectSettings(): UseProjectSettingsResult;
|
|
118
|
+
|
|
119
|
+
interface UseSectionFlagsResult {
|
|
120
|
+
enabledIds: Set<string>;
|
|
121
|
+
disabledIds: Set<string>;
|
|
122
|
+
loading: boolean;
|
|
123
|
+
error: Error | null;
|
|
124
|
+
refetch: () => Promise<void>;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Returns which section IDs are enabled or disabled for the current project.
|
|
128
|
+
* Must be used within ZOIQProvider. Uses the same apiBaseUrl as the provider.
|
|
129
|
+
*/
|
|
130
|
+
declare function useSectionFlags(): UseSectionFlagsResult;
|
|
131
|
+
|
|
132
|
+
interface UseZOIQApiOptions {
|
|
133
|
+
id?: string;
|
|
134
|
+
query?: Record<string, string>;
|
|
135
|
+
}
|
|
136
|
+
interface UseZOIQApiResult<T> {
|
|
137
|
+
data: T | null;
|
|
138
|
+
loading: boolean;
|
|
139
|
+
error: Error | null;
|
|
140
|
+
refetch: () => Promise<void>;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Fetches custom entity data for the current project.
|
|
144
|
+
* Must be used within ZOIQProvider.
|
|
145
|
+
*/
|
|
146
|
+
declare function useZOIQApi<T = unknown>(entity: string, options?: UseZOIQApiOptions): UseZOIQApiResult<T>;
|
|
147
|
+
|
|
148
|
+
interface TextProps extends React.HTMLAttributes<HTMLElement> {
|
|
149
|
+
children?: React.ReactNode;
|
|
150
|
+
className?: string;
|
|
151
|
+
as?: 'span' | 'p' | 'div';
|
|
152
|
+
}
|
|
153
|
+
declare const Text: ({ children, className, as: As, ...props }: TextProps) => react_jsx_runtime.JSX.Element;
|
|
154
|
+
|
|
155
|
+
interface TitleProps {
|
|
156
|
+
children?: React.ReactNode;
|
|
157
|
+
className?: string;
|
|
158
|
+
}
|
|
159
|
+
declare const Title: ({ children, className }: TitleProps) => react_jsx_runtime.JSX.Element;
|
|
160
|
+
|
|
161
|
+
interface SubtitleProps {
|
|
162
|
+
children?: React.ReactNode;
|
|
163
|
+
className?: string;
|
|
164
|
+
}
|
|
165
|
+
declare const Subtitle: ({ children, className }: SubtitleProps) => react_jsx_runtime.JSX.Element;
|
|
166
|
+
|
|
167
|
+
interface ScrollButtonProps {
|
|
168
|
+
className?: string;
|
|
169
|
+
/** Scroll Y threshold above which the button is shown (default 200) */
|
|
170
|
+
threshold?: number;
|
|
171
|
+
}
|
|
172
|
+
declare const ScrollButton: ({ className, threshold }: ScrollButtonProps) => react_jsx_runtime.JSX.Element;
|
|
173
|
+
|
|
174
|
+
interface ToggleThemeProps {
|
|
175
|
+
className?: string;
|
|
176
|
+
/** Callback when user requests theme toggle; host app controls actual theme state */
|
|
177
|
+
onToggle?: () => void;
|
|
178
|
+
/** Optional current theme name for rendering (e.g. "light" | "dark") */
|
|
179
|
+
theme?: string;
|
|
180
|
+
/** Content to show (e.g. icon). If not provided, shows "Theme" */
|
|
181
|
+
children?: React.ReactNode;
|
|
182
|
+
}
|
|
183
|
+
declare const ToggleTheme: ({ className, onToggle, theme, children }: ToggleThemeProps) => react_jsx_runtime.JSX.Element;
|
|
184
|
+
|
|
185
|
+
interface SectionProps {
|
|
186
|
+
children?: React.ReactNode;
|
|
187
|
+
className?: string;
|
|
188
|
+
}
|
|
189
|
+
declare const Section: ({ children, className }: SectionProps) => react_jsx_runtime.JSX.Element;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Placeholder for toast container. Host app should render Toaster from "sonner" (or similar)
|
|
193
|
+
* inside the app; ZOIQ does not bundle a toast library.
|
|
194
|
+
*/
|
|
195
|
+
declare const ToastContainer: () => null;
|
|
196
|
+
|
|
197
|
+
interface PageProps {
|
|
198
|
+
children?: React.ReactNode;
|
|
199
|
+
className?: string;
|
|
200
|
+
/** Optional full-width layout (no horizontal padding) */
|
|
201
|
+
fullWidth?: boolean;
|
|
202
|
+
}
|
|
203
|
+
declare const Page: ({ children, className, fullWidth }: PageProps) => react_jsx_runtime.JSX.Element;
|
|
204
|
+
|
|
205
|
+
interface HeaderProps {
|
|
206
|
+
children?: React.ReactNode;
|
|
207
|
+
className?: string;
|
|
208
|
+
/** Optional left slot (e.g. logo, nav) */
|
|
209
|
+
left?: React.ReactNode;
|
|
210
|
+
/** Optional right slot (e.g. user menu, theme toggle) */
|
|
211
|
+
right?: React.ReactNode;
|
|
212
|
+
}
|
|
213
|
+
declare const Header: ({ children, className, left, right }: HeaderProps) => react_jsx_runtime.JSX.Element;
|
|
214
|
+
|
|
215
|
+
interface FooterProps {
|
|
216
|
+
children?: React.ReactNode;
|
|
217
|
+
className?: string;
|
|
218
|
+
}
|
|
219
|
+
declare const Footer: ({ children, className }: FooterProps) => react_jsx_runtime.JSX.Element;
|
|
220
|
+
|
|
221
|
+
interface SecondarySidebarItem {
|
|
222
|
+
label: string;
|
|
223
|
+
href: string;
|
|
224
|
+
icon?: React.ReactNode;
|
|
225
|
+
}
|
|
226
|
+
interface SecondarySidebarProps {
|
|
227
|
+
items: SecondarySidebarItem[];
|
|
228
|
+
className?: string;
|
|
229
|
+
/** Optional: return true if item is active (e.g. from pathname) */
|
|
230
|
+
isActive?: (item: SecondarySidebarItem) => boolean;
|
|
231
|
+
/** Optional: custom link renderer (e.g. Next.js Link). Default: <a> */
|
|
232
|
+
renderLink?: (item: SecondarySidebarItem, children: React.ReactNode) => React.ReactNode;
|
|
233
|
+
}
|
|
234
|
+
declare const SecondarySidebar: ({ items, className, isActive, renderLink }: SecondarySidebarProps) => react_jsx_runtime.JSX.Element;
|
|
235
|
+
|
|
236
|
+
export { Footer, Header, Page, type ProjectSettings, ScrollButton, SecondarySidebar, type SecondarySidebarItem, type SecondarySidebarProps, Section, type SectionFlag, type SectionFlagsData, Subtitle, Text, Title, ToastContainer, ToggleTheme, ZOIQProvider, useProjectSettings, useSectionFlags, useZOIQApi, useZOIQContext };
|