@nd-storybook/storybook 0.3.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 +71 -0
- package/dist/css/badge.css +20 -0
- package/dist/css/button.css +0 -0
- package/dist/css/components/.DS_Store +0 -0
- package/dist/css/components/modal.css +133 -0
- package/dist/css/components/portal/accordion.css +39 -0
- package/dist/css/components/portal/accordionItem.css +102 -0
- package/dist/css/components/portal/alert.css +71 -0
- package/dist/css/components/portal/dataFrame.css +450 -0
- package/dist/css/components/portal/description-list.css +37 -0
- package/dist/css/components/portal/menuItem.css +93 -0
- package/dist/css/components/portal/navigationCard.css +86 -0
- package/dist/css/components/portal/portal-navigation.css +45 -0
- package/dist/css/components/portal/tabs.css +220 -0
- package/dist/css/experimental/collapsed-card.css +16 -0
- package/dist/css/molecules/form.css +28 -0
- package/dist/css/tailwind.css +21 -0
- package/dist/css/tokens.css +511 -0
- package/dist/css/typography.css +359 -0
- package/dist/index.cjs.js +107 -0
- package/dist/index.d.ts +396 -0
- package/dist/index.es.js +6369 -0
- package/dist/tailwind.config.js +96 -0
- package/dist/tailwind.tokens.js +452 -0
- package/dist/tokens.utilities.js +1042 -0
- package/package.json +83 -0
- package/tailwind.config.js +86 -0
- package/tailwind.tokens.js +252 -0
- package/tokens.utilities.js +870 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import react__default, { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import * as use_immer from 'use-immer';
|
|
5
|
+
import * as react_use_lib_misc_hookState from 'react-use/lib/misc/hookState';
|
|
6
|
+
import * as mitt from 'mitt';
|
|
7
|
+
|
|
8
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
9
|
+
variant?: 'primary' | 'secondary' | 'ghost' | 'dark' | 'pill';
|
|
10
|
+
icon?: string | null;
|
|
11
|
+
iconOnly?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const Button: react__default.FC<ButtonProps>;
|
|
14
|
+
|
|
15
|
+
interface IconProps {
|
|
16
|
+
name: string;
|
|
17
|
+
size?: number;
|
|
18
|
+
color?: string;
|
|
19
|
+
className?: string;
|
|
20
|
+
variant?: "fill" | "outline";
|
|
21
|
+
}
|
|
22
|
+
declare const Icon: react__default.FC<IconProps>;
|
|
23
|
+
|
|
24
|
+
declare function keys(variant?: 'outline' | 'fill'): string[];
|
|
25
|
+
|
|
26
|
+
interface PremiumBadgeProps {
|
|
27
|
+
className?: string;
|
|
28
|
+
size?: 'small' | 'large';
|
|
29
|
+
}
|
|
30
|
+
declare const PremiumBadge: react__default.FC<PremiumBadgeProps>;
|
|
31
|
+
|
|
32
|
+
type SkeletonSize = 'sm' | 'md' | 'lg' | Array<'sm' | 'md' | 'lg'>;
|
|
33
|
+
interface SkeletonProps {
|
|
34
|
+
className?: string;
|
|
35
|
+
size?: SkeletonSize;
|
|
36
|
+
}
|
|
37
|
+
declare const Skeleton: react__default.FC<SkeletonProps>;
|
|
38
|
+
|
|
39
|
+
interface TypographyProps {
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
className?: string;
|
|
42
|
+
}
|
|
43
|
+
declare const HeadingArticle: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
44
|
+
declare const HeadingPage: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
45
|
+
declare const Heading2: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
46
|
+
declare const Heading3: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
47
|
+
declare const HeadingArticleFeed: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
48
|
+
declare const BodyStandard: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
49
|
+
declare const BodyStandardRegular: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
50
|
+
declare const BodyStandardBold: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
51
|
+
declare const BodyArticle: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
52
|
+
declare const BodyArticleIntro: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
53
|
+
declare const BodyArticleQuote: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
54
|
+
declare const MetaStandard: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
55
|
+
declare const MetaRegular: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
56
|
+
declare const MetaAuthor: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
57
|
+
declare const DropCap: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
58
|
+
declare const ArticleCity: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
59
|
+
declare const ArticleType: ({ children, className }: TypographyProps) => react_jsx_runtime.JSX.Element;
|
|
60
|
+
|
|
61
|
+
type NModalProps = {
|
|
62
|
+
id?: string;
|
|
63
|
+
open?: boolean;
|
|
64
|
+
size?: "md" | "xl";
|
|
65
|
+
backdrop?: boolean;
|
|
66
|
+
modalTitle?: string;
|
|
67
|
+
modalSubTitle?: string;
|
|
68
|
+
hideHeader?: boolean;
|
|
69
|
+
simplified?: boolean;
|
|
70
|
+
closeButton?: boolean;
|
|
71
|
+
noFooter?: boolean;
|
|
72
|
+
noCloseOnBackdrop?: boolean;
|
|
73
|
+
bodyClass?: string;
|
|
74
|
+
compactOnMobile?: boolean;
|
|
75
|
+
children?: react__default.ReactNode;
|
|
76
|
+
footer?: react__default.ReactNode;
|
|
77
|
+
onClose?: () => void;
|
|
78
|
+
onAfterClose?: () => void;
|
|
79
|
+
};
|
|
80
|
+
declare const NModal: react__default.FC<NModalProps>;
|
|
81
|
+
|
|
82
|
+
interface ConfirmModalProps extends NModalProps {
|
|
83
|
+
title?: string;
|
|
84
|
+
message?: string;
|
|
85
|
+
confirmLabel?: string;
|
|
86
|
+
cancelLabel?: string;
|
|
87
|
+
onConfirm?: (props: ConfirmModalProps) => void;
|
|
88
|
+
onCancel?: (props: ConfirmModalProps) => void;
|
|
89
|
+
}
|
|
90
|
+
declare const ConfirmModal: react__default.FC;
|
|
91
|
+
|
|
92
|
+
declare const ExampleModal: react__default.FC;
|
|
93
|
+
|
|
94
|
+
declare const ModalManager: react__default.FC;
|
|
95
|
+
|
|
96
|
+
interface DescriptionListProps {
|
|
97
|
+
className?: string;
|
|
98
|
+
title?: react__default.ReactNode;
|
|
99
|
+
actions?: react__default.ReactNode;
|
|
100
|
+
footer?: react__default.ReactNode;
|
|
101
|
+
isLoading?: boolean;
|
|
102
|
+
children?: react__default.ReactNode;
|
|
103
|
+
}
|
|
104
|
+
declare const DescriptionList: react__default.FC<DescriptionListProps>;
|
|
105
|
+
|
|
106
|
+
interface DescriptionListItemProps {
|
|
107
|
+
term?: react__default.ReactNode;
|
|
108
|
+
children?: react__default.ReactNode;
|
|
109
|
+
skeleton?: SkeletonSize;
|
|
110
|
+
isLoading?: boolean;
|
|
111
|
+
className?: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* DescriptionListItem component for displaying a term-description pair
|
|
115
|
+
*/
|
|
116
|
+
declare const DescriptionListItem: react__default.FC<DescriptionListItemProps>;
|
|
117
|
+
|
|
118
|
+
interface DescriptionListItemsProps {
|
|
119
|
+
children: react__default.ReactNode;
|
|
120
|
+
isLoading?: boolean;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* DescriptionListItems component for grouping DescriptionListItem components
|
|
124
|
+
*/
|
|
125
|
+
declare const DescriptionListItems: react__default.FC<DescriptionListItemsProps>;
|
|
126
|
+
|
|
127
|
+
interface PortalNavigationItem {
|
|
128
|
+
href: string;
|
|
129
|
+
label: string;
|
|
130
|
+
}
|
|
131
|
+
interface PortalNavigationProps {
|
|
132
|
+
items: PortalNavigationItem[];
|
|
133
|
+
active?: boolean;
|
|
134
|
+
backHref?: string;
|
|
135
|
+
currentLocation?: string;
|
|
136
|
+
}
|
|
137
|
+
declare const PortalNavigation: react__default.FC<PortalNavigationProps>;
|
|
138
|
+
|
|
139
|
+
interface NavigationCardProps {
|
|
140
|
+
icon: string;
|
|
141
|
+
headline: string;
|
|
142
|
+
description: string;
|
|
143
|
+
href: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface NavigationCardsProps {
|
|
147
|
+
items: NavigationCardProps[];
|
|
148
|
+
}
|
|
149
|
+
declare function NavigationCards(props: NavigationCardsProps): react_jsx_runtime.JSX.Element;
|
|
150
|
+
|
|
151
|
+
interface TabsProps {
|
|
152
|
+
tabs: Array<{
|
|
153
|
+
label: string;
|
|
154
|
+
href?: string;
|
|
155
|
+
id?: string;
|
|
156
|
+
}>;
|
|
157
|
+
activeIndex?: number;
|
|
158
|
+
defaultActiveIndex?: number;
|
|
159
|
+
onTabChange?: (index: number) => void;
|
|
160
|
+
activeTabId?: string;
|
|
161
|
+
device?: 'desktop' | 'mobile';
|
|
162
|
+
}
|
|
163
|
+
declare function Tabs(props: TabsProps): react_jsx_runtime.JSX.Element;
|
|
164
|
+
|
|
165
|
+
interface FAQItem {
|
|
166
|
+
id?: string;
|
|
167
|
+
question: string;
|
|
168
|
+
answer: string;
|
|
169
|
+
}
|
|
170
|
+
interface FAQProps {
|
|
171
|
+
title?: string;
|
|
172
|
+
items: FAQItem[];
|
|
173
|
+
allowMultiple?: boolean;
|
|
174
|
+
variant?: 'default' | 'large';
|
|
175
|
+
className?: string;
|
|
176
|
+
}
|
|
177
|
+
declare function FAQ({ title, items, allowMultiple, variant, className }: FAQProps): react_jsx_runtime.JSX.Element;
|
|
178
|
+
|
|
179
|
+
interface AccordionItemProps {
|
|
180
|
+
question: string;
|
|
181
|
+
answer: string;
|
|
182
|
+
id?: string;
|
|
183
|
+
isOpen?: boolean;
|
|
184
|
+
onToggle?: () => void;
|
|
185
|
+
variant?: 'default' | 'large';
|
|
186
|
+
}
|
|
187
|
+
declare function AccordionItem({ question, answer, id, isOpen: controlledIsOpen, onToggle, variant }: AccordionItemProps): react_jsx_runtime.JSX.Element;
|
|
188
|
+
|
|
189
|
+
interface AccordionProps {
|
|
190
|
+
items: AccordionItemProps[];
|
|
191
|
+
title?: string;
|
|
192
|
+
allowMultiple?: boolean;
|
|
193
|
+
variant?: 'default' | 'large';
|
|
194
|
+
}
|
|
195
|
+
declare function Accordion({ items, title, allowMultiple, variant }: AccordionProps): react_jsx_runtime.JSX.Element;
|
|
196
|
+
|
|
197
|
+
interface AlertProps {
|
|
198
|
+
className?: string;
|
|
199
|
+
children: ReactNode;
|
|
200
|
+
variant?: AlertVariant;
|
|
201
|
+
}
|
|
202
|
+
type AlertVariant = "dark" | "danger" | "info" | "success" | "warning";
|
|
203
|
+
declare const Alert: react__default.FC<AlertProps>;
|
|
204
|
+
|
|
205
|
+
interface DataFrameItemProps {
|
|
206
|
+
label: string;
|
|
207
|
+
value?: string | ReactNode;
|
|
208
|
+
skeleton?: string[];
|
|
209
|
+
isLoading?: boolean;
|
|
210
|
+
multiline?: boolean;
|
|
211
|
+
}
|
|
212
|
+
declare function DataFrameItem(props: DataFrameItemProps): react_jsx_runtime.JSX.Element;
|
|
213
|
+
|
|
214
|
+
interface DataFrameInputField {
|
|
215
|
+
name: string;
|
|
216
|
+
label: string;
|
|
217
|
+
value?: string;
|
|
218
|
+
type?: string;
|
|
219
|
+
disabled?: boolean;
|
|
220
|
+
readonly?: boolean;
|
|
221
|
+
placeholder?: string;
|
|
222
|
+
width?: 'full' | 'half' | 'third';
|
|
223
|
+
}
|
|
224
|
+
interface DataFrameProps {
|
|
225
|
+
title: string;
|
|
226
|
+
items?: DataFrameItemProps[];
|
|
227
|
+
children?: ReactNode;
|
|
228
|
+
editable?: boolean;
|
|
229
|
+
onEdit?: () => void;
|
|
230
|
+
onSave?: (data: Record<string, any>) => void;
|
|
231
|
+
onCancel?: () => void;
|
|
232
|
+
editFields?: DataFrameInputField[];
|
|
233
|
+
collapsible?: boolean;
|
|
234
|
+
isOpen?: boolean;
|
|
235
|
+
onToggle?: () => void;
|
|
236
|
+
alert?: {
|
|
237
|
+
type: AlertVariant;
|
|
238
|
+
message: string;
|
|
239
|
+
};
|
|
240
|
+
actions?: Array<{
|
|
241
|
+
label: string;
|
|
242
|
+
onClick: () => void;
|
|
243
|
+
icon?: string;
|
|
244
|
+
}>;
|
|
245
|
+
isLoading?: boolean;
|
|
246
|
+
}
|
|
247
|
+
declare function DataFrame(props: DataFrameProps): react_jsx_runtime.JSX.Element;
|
|
248
|
+
|
|
249
|
+
interface DataFramesProps {
|
|
250
|
+
frames: DataFrameProps[];
|
|
251
|
+
}
|
|
252
|
+
declare function DataFrames(props: DataFramesProps): react_jsx_runtime.JSX.Element;
|
|
253
|
+
|
|
254
|
+
interface CardProps {
|
|
255
|
+
children?: ReactNode;
|
|
256
|
+
image?: ReactNode;
|
|
257
|
+
title?: ReactNode;
|
|
258
|
+
footer?: ReactNode;
|
|
259
|
+
}
|
|
260
|
+
declare const Card: react__default.FC<CardProps>;
|
|
261
|
+
|
|
262
|
+
interface CollapsedCardProps {
|
|
263
|
+
title?: string;
|
|
264
|
+
collapsed?: boolean;
|
|
265
|
+
children?: ReactNode;
|
|
266
|
+
header?: ReactNode;
|
|
267
|
+
onToggle?: (isCollapsed: boolean) => void;
|
|
268
|
+
}
|
|
269
|
+
declare const CollapsedCard: react__default.FC<CollapsedCardProps>;
|
|
270
|
+
|
|
271
|
+
interface InputProps extends react__default.InputHTMLAttributes<HTMLInputElement> {
|
|
272
|
+
value: any;
|
|
273
|
+
setValue: (value: any) => any;
|
|
274
|
+
label?: string;
|
|
275
|
+
help?: string;
|
|
276
|
+
errors?: string[] | null;
|
|
277
|
+
}
|
|
278
|
+
declare const Input: react__default.FC<InputProps>;
|
|
279
|
+
|
|
280
|
+
interface Config$3 {
|
|
281
|
+
url: string | (() => string);
|
|
282
|
+
params?: object | (() => object);
|
|
283
|
+
onFetched?: (response: any) => void;
|
|
284
|
+
initialFetch?: boolean;
|
|
285
|
+
dataKey?: string;
|
|
286
|
+
}
|
|
287
|
+
declare function useFetchData<T>(config: Config$3): {
|
|
288
|
+
isLoading: boolean;
|
|
289
|
+
isInitialized: boolean;
|
|
290
|
+
data: T;
|
|
291
|
+
error: Error;
|
|
292
|
+
isEmpty: boolean;
|
|
293
|
+
initialize: () => Promise<void>;
|
|
294
|
+
fetch: () => Promise<any>;
|
|
295
|
+
clear: () => void;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
interface Meta {
|
|
299
|
+
current_page?: number;
|
|
300
|
+
from?: number;
|
|
301
|
+
last_page?: number;
|
|
302
|
+
availableSlots?: number;
|
|
303
|
+
usedSlots?: number;
|
|
304
|
+
}
|
|
305
|
+
interface Config$2 {
|
|
306
|
+
url: string | (() => string);
|
|
307
|
+
params?: object | (() => object);
|
|
308
|
+
onFetched?: (response: any) => void;
|
|
309
|
+
}
|
|
310
|
+
declare function useFetchList<T>(config: Config$2): {
|
|
311
|
+
isLoading: boolean;
|
|
312
|
+
isInitialized: boolean;
|
|
313
|
+
data: T[];
|
|
314
|
+
meta: Meta;
|
|
315
|
+
isEmpty: boolean;
|
|
316
|
+
initialize: () => Promise<void>;
|
|
317
|
+
fetch: (resetPagination?: boolean) => Promise<void>;
|
|
318
|
+
clear: () => void;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
interface Config$1 {
|
|
322
|
+
url: string | (() => string);
|
|
323
|
+
request?: () => Promise<any>;
|
|
324
|
+
[key: string]: any;
|
|
325
|
+
}
|
|
326
|
+
interface FetchConfig {
|
|
327
|
+
url?: string;
|
|
328
|
+
params?: object;
|
|
329
|
+
silent?: boolean;
|
|
330
|
+
[key: string]: any;
|
|
331
|
+
}
|
|
332
|
+
declare function useFormFactory<T>(config: Config$1): {
|
|
333
|
+
isLoading: boolean;
|
|
334
|
+
isInitialized: boolean;
|
|
335
|
+
setIsInitialized: react.Dispatch<react.SetStateAction<boolean>>;
|
|
336
|
+
factory: T;
|
|
337
|
+
setFactory: use_immer.Updater<T>;
|
|
338
|
+
initialize: (_config?: FetchConfig) => Promise<void>;
|
|
339
|
+
fetchFactory: (_config?: FetchConfig) => Promise<any>;
|
|
340
|
+
clear: () => void;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
interface Config {
|
|
344
|
+
url: string | (() => string);
|
|
345
|
+
request?: (data: any) => Promise<any>;
|
|
346
|
+
onSuccess?: (response: any) => void;
|
|
347
|
+
onValidationError?: (errors: any) => void;
|
|
348
|
+
onError?: (error: any) => void;
|
|
349
|
+
}
|
|
350
|
+
declare function useFormHandler(config: Config): {
|
|
351
|
+
isLoading: boolean;
|
|
352
|
+
errors: Record<string, any>;
|
|
353
|
+
setErrors: react.Dispatch<react.SetStateAction<Record<string, any>>>;
|
|
354
|
+
hasErrors: boolean;
|
|
355
|
+
submit: (data: any, _config?: {
|
|
356
|
+
url?: string;
|
|
357
|
+
}) => Promise<any>;
|
|
358
|
+
clear: () => void;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
type ModalData = {
|
|
362
|
+
key: string;
|
|
363
|
+
component: React.FC<any>;
|
|
364
|
+
};
|
|
365
|
+
type ActiveModalData = {
|
|
366
|
+
id: string;
|
|
367
|
+
key: string;
|
|
368
|
+
component: React.FC<any>;
|
|
369
|
+
props: object;
|
|
370
|
+
};
|
|
371
|
+
declare function useModalManager(): {
|
|
372
|
+
modals: ModalData[];
|
|
373
|
+
activeModals: ActiveModalData[];
|
|
374
|
+
registerModal: (key: string, component: React.FC<any>) => void;
|
|
375
|
+
open: (key: string, props?: object) => string | undefined;
|
|
376
|
+
close: (id: string) => void;
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
declare function useSharedState(): {
|
|
380
|
+
sharedState: string;
|
|
381
|
+
setSharedState: (state: react_use_lib_misc_hookState.IHookStateSetAction<string>) => void;
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
declare function setData<T extends object>(obj: T, path: string, value: any): T;
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Formats a date string to a human-readable format (DD Month YYYY)
|
|
388
|
+
* @param dateString - The date string to format
|
|
389
|
+
* @returns Formatted date string or null if input is invalid
|
|
390
|
+
*/
|
|
391
|
+
declare const formatDate: (dateString: string | null | undefined) => string | null;
|
|
392
|
+
|
|
393
|
+
declare const eventbus: mitt.Emitter<Record<mitt.EventType, unknown>>;
|
|
394
|
+
|
|
395
|
+
export { Accordion, AccordionItem, Alert, ArticleCity, ArticleType, BodyArticle, BodyArticleIntro, BodyArticleQuote, BodyStandard, BodyStandardBold, BodyStandardRegular, Button, Card, CollapsedCard, ConfirmModal, DataFrame, DataFrameItem, DataFrames, DescriptionList, DescriptionListItem, DescriptionListItems, DropCap, ExampleModal, FAQ, Heading2, Heading3, HeadingArticle, HeadingArticleFeed, HeadingPage, Icon, Input, MetaAuthor, MetaRegular, MetaStandard, ModalManager, NModal, NavigationCards, PortalNavigation, PremiumBadge, Skeleton, Tabs, eventbus, formatDate, keys as iconKeys, setData, useFetchData, useFetchList, useFormFactory, useFormHandler, useModalManager, useSharedState };
|
|
396
|
+
export type { AccordionItemProps, AccordionProps, AlertProps, AlertVariant, ButtonProps, CardProps, CollapsedCardProps, ConfirmModalProps, DataFrameItemProps, DataFrameProps, DataFramesProps, DescriptionListItemProps, DescriptionListItemsProps, DescriptionListProps, FAQProps, IconProps, InputProps, Meta, NModalProps, NavigationCardsProps, PortalNavigationItem, PortalNavigationProps, PremiumBadgeProps, SkeletonProps, SkeletonSize, TabsProps, TypographyProps };
|