@gouvfr-lasuite/ui-kit 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.
@@ -0,0 +1,567 @@
1
+ import { CunninghamProvider as CunninghamProvider_2 } from '@openfun/cunningham-react';
2
+ import { CursorProps } from 'react-arborist';
3
+ import { Dispatch } from 'react';
4
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
5
+ import { LabelHTMLAttributes } from 'react';
6
+ import { NodeRendererProps } from 'react-arborist';
7
+ import { PropsWithChildren } from 'react';
8
+ import { ReactNode } from 'react';
9
+ import { SetStateAction } from 'react';
10
+
11
+ export declare type BaseTreeViewData<T> = T & {
12
+ id: string;
13
+ childrenCount?: number;
14
+ parentId?: string;
15
+ children?: BaseTreeViewData<T>[];
16
+ };
17
+
18
+ export declare const cunninghamConfig: {
19
+ themes: {
20
+ default: {
21
+ theme: {
22
+ colors: {
23
+ "primary-text": string;
24
+ "primary-050": string;
25
+ "primary-100": string;
26
+ "primary-150": string;
27
+ "primary-200": string;
28
+ "primary-300": string;
29
+ "primary-400": string;
30
+ "primary-500": string;
31
+ "primary-600": string;
32
+ "primary-700": string;
33
+ "primary-800": string;
34
+ "primary-900": string;
35
+ "secondary-text": string;
36
+ "secondary-100": string;
37
+ "secondary-200": string;
38
+ "secondary-300": string;
39
+ "secondary-400": string;
40
+ "secondary-500": string;
41
+ "secondary-600": string;
42
+ "secondary-700": string;
43
+ "secondary-800": string;
44
+ "secondary-900": string;
45
+ "greyscale-text": string;
46
+ "greyscale-000": string;
47
+ "greyscale-050": string;
48
+ "greyscale-100": string;
49
+ "greyscale-200": string;
50
+ "greyscale-250": string;
51
+ "greyscale-300": string;
52
+ "greyscale-350": string;
53
+ "greyscale-400": string;
54
+ "greyscale-500": string;
55
+ "greyscale-600": string;
56
+ "greyscale-700": string;
57
+ "greyscale-750": string;
58
+ "greyscale-800": string;
59
+ "greyscale-900": string;
60
+ "greyscale-950": string;
61
+ "greyscale-1000": string;
62
+ "success-text": string;
63
+ "success-100": string;
64
+ "success-200": string;
65
+ "success-300": string;
66
+ "success-400": string;
67
+ "success-500": string;
68
+ "success-600": string;
69
+ "success-700": string;
70
+ "success-800": string;
71
+ "success-900": string;
72
+ "info-text": string;
73
+ "info-100": string;
74
+ "info-200": string;
75
+ "info-300": string;
76
+ "info-400": string;
77
+ "info-500": string;
78
+ "info-600": string;
79
+ "info-700": string;
80
+ "info-800": string;
81
+ "info-900": string;
82
+ "warning-text": string;
83
+ "warning-100": string;
84
+ "warning-200": string;
85
+ "warning-300": string;
86
+ "warning-400": string;
87
+ "warning-500": string;
88
+ "warning-600": string;
89
+ "warning-700": string;
90
+ "warning-800": string;
91
+ "warning-900": string;
92
+ "danger-text": string;
93
+ "danger-100": string;
94
+ "danger-200": string;
95
+ "danger-300": string;
96
+ "danger-400": string;
97
+ "danger-500": string;
98
+ "danger-600": string;
99
+ "danger-700": string;
100
+ "danger-800": string;
101
+ "danger-900": string;
102
+ };
103
+ font: {
104
+ sizes: {
105
+ xs: string;
106
+ sm: string;
107
+ md: string;
108
+ lg: string;
109
+ ml: string;
110
+ xl: string;
111
+ t: string;
112
+ s: string;
113
+ h1: string;
114
+ h2: string;
115
+ h3: string;
116
+ h4: string;
117
+ h5: string;
118
+ h6: string;
119
+ "xl-alt": string;
120
+ "lg-alt": string;
121
+ "md-alt": string;
122
+ "sm-alt": string;
123
+ "xs-alt": string;
124
+ };
125
+ weights: {
126
+ thin: number;
127
+ extrabold: number;
128
+ black: number;
129
+ };
130
+ families: {
131
+ accent: string;
132
+ base: string;
133
+ };
134
+ };
135
+ logo: {
136
+ src: string;
137
+ widthHeader: string;
138
+ widthFooter: string;
139
+ alt: string;
140
+ };
141
+ spacings: {
142
+ "0": string;
143
+ none: string;
144
+ auto: string;
145
+ bx: string;
146
+ full: string;
147
+ "4xs": string;
148
+ "3xs": string;
149
+ "2xs": string;
150
+ xs: string;
151
+ sm: string;
152
+ base: string;
153
+ md: string;
154
+ lg: string;
155
+ xl: string;
156
+ xxl: string;
157
+ xxxl: string;
158
+ "4xl": string;
159
+ "5xl": string;
160
+ "6xl": string;
161
+ "7xl": string;
162
+ };
163
+ breakpoints: {
164
+ xxs: string;
165
+ xs: string;
166
+ mobile: string;
167
+ tablet: string;
168
+ };
169
+ };
170
+ components: {
171
+ modal: {
172
+ "width-small": string;
173
+ };
174
+ button: {
175
+ "medium-height": string;
176
+ "medium-text-height": string;
177
+ "border-radius": string;
178
+ "small-height": string;
179
+ primary: {
180
+ "background--color": string;
181
+ "background--color-hover": string;
182
+ "background--color-active": string;
183
+ "background--color-disabled": string;
184
+ color: string;
185
+ "color-hover": string;
186
+ "color-active": string;
187
+ "color-focus-visible": string;
188
+ disabled: string;
189
+ };
190
+ "primary-text": {
191
+ "background--color": string;
192
+ "background--color-hover": string;
193
+ "background--color-active": string;
194
+ "background--color-focus-visible": string;
195
+ "background--color-disabled": string;
196
+ color: string;
197
+ "color-hover": string;
198
+ disabled: string;
199
+ };
200
+ secondary: {
201
+ "background--color-hover": string;
202
+ "background--color-active": string;
203
+ "background--color-focus-visible": string;
204
+ "background--disabled": string;
205
+ color: string;
206
+ "border--color": string;
207
+ "border--color-hover": string;
208
+ "border--color-disabled": string;
209
+ disabled: string;
210
+ };
211
+ tertiary: {
212
+ "background--color": string;
213
+ "background--color-focus-visible": string;
214
+ "background--color-hover": string;
215
+ "background--color-active": string;
216
+ "background--disabled": string;
217
+ color: string;
218
+ disabled: string;
219
+ };
220
+ "tertiary-text": {
221
+ "background--color-hover": string;
222
+ "color-hover": string;
223
+ color: string;
224
+ };
225
+ danger: {
226
+ "color-hover": string;
227
+ "background--color": string;
228
+ "background--color-hover": string;
229
+ "background--color-focus-visible": string;
230
+ "background--color-disabled": string;
231
+ "color-disabled": string;
232
+ };
233
+ };
234
+ datagrid: {
235
+ "header--color": string;
236
+ "header--size": string;
237
+ "header--weight": string;
238
+ "body--background-color-hover": string;
239
+ };
240
+ "forms-checkbox": {
241
+ "border-radius": string;
242
+ "border-color": string;
243
+ "background-color--hover": string;
244
+ "border--color-disabled": string;
245
+ "border--color": string;
246
+ "background--disabled": string;
247
+ "background--enable": string;
248
+ "check--disabled": string;
249
+ "check--enable": string;
250
+ color: string;
251
+ "label--color": string;
252
+ "label--size": string;
253
+ "label--weight": string;
254
+ "text--color": string;
255
+ "text--size": string;
256
+ "text--weight": string;
257
+ "text--color-disabled": string;
258
+ };
259
+ "forms-labelledbox": {
260
+ "label-color--small": string;
261
+ "label-color--small--disabled": string;
262
+ "label-color--big": string;
263
+ "label-color--big--disabled": string;
264
+ };
265
+ "forms-radio": {
266
+ "border-color": string;
267
+ "background-color": string;
268
+ "accent-color": string;
269
+ "accent-color-disabled": string;
270
+ };
271
+ "forms-switch": {
272
+ "border--color-disabled": string;
273
+ "border--color": string;
274
+ "handle-background-color": string;
275
+ "handle-background-color--disabled": string;
276
+ "rail-background-color--disabled": string;
277
+ "accent-color": string;
278
+ };
279
+ "forms-textarea": {
280
+ "label-color--focus": string;
281
+ "border-radius": string;
282
+ "border-color": string;
283
+ "box-shadow--color--hover": string;
284
+ "box-shadow--color--focus": string;
285
+ "value-color": string;
286
+ "value-color--disabled": string;
287
+ "font-size": string;
288
+ };
289
+ "forms-input": {
290
+ "label-color--focus": string;
291
+ "border-radius": string;
292
+ "border-color": string;
293
+ "box-shadow--color--hover": string;
294
+ "box-shadow--color--focus": string;
295
+ "value-color": string;
296
+ "value-color--disabled": string;
297
+ "font-size": string;
298
+ };
299
+ "forms-select": {
300
+ "label-color--focus": string;
301
+ "item-font-size": string;
302
+ "border-radius": string;
303
+ "border-radius-hover": string;
304
+ "border-color": string;
305
+ "box-shadow--color--hover": string;
306
+ "box-shadow--color--focus": string;
307
+ "value-color": string;
308
+ "font-size": string;
309
+ };
310
+ };
311
+ };
312
+ };
313
+ };
314
+
315
+ export declare const CunninghamProvider: (props: Parameters<typeof CunninghamProvider_2>[0]) => JSX_2.Element;
316
+
317
+ export declare const CustomTabs: ({ tabs, defaultSelectedTab, fullWidth, }: TabsProps) => JSX_2.Element | null;
318
+
319
+ export declare const DropdownMenu: ({ options, isOpen, onOpenChange, children, selectedValues, onSelectValue, }: PropsWithChildren<DropdownMenuProps>) => JSX_2.Element;
320
+
321
+ export declare type DropdownMenuOption = {
322
+ label: string;
323
+ icon?: ReactNode;
324
+ callback?: () => void | Promise<unknown>;
325
+ isDisabled?: boolean;
326
+ showSeparator?: boolean;
327
+ isHidden?: boolean;
328
+ isChecked?: boolean;
329
+ testId?: string;
330
+ value?: string;
331
+ };
332
+
333
+ export declare type DropdownMenuProps = {
334
+ options: DropdownMenuOption[];
335
+ onOpenChange?: (isOpen: boolean) => void;
336
+ selectedValues?: string[];
337
+ onSelectValue?: (value: string) => void;
338
+ isOpen?: boolean;
339
+ };
340
+
341
+ export declare function getLocales(): {
342
+ enUS: any;
343
+ frFR: any;
344
+ };
345
+
346
+ export declare const Header: ({ leftIcon, rightIcon, languages, onTogglePanel, isPanelOpen, }: HeaderProps) => JSX_2.Element;
347
+
348
+ export declare const headerHeight = 52;
349
+
350
+ export declare type HeaderProps = {
351
+ leftIcon?: React.ReactNode;
352
+ rightIcon?: React.ReactNode;
353
+ languages?: DropdownMenuOption[];
354
+ onTogglePanel?: () => void;
355
+ isPanelOpen?: boolean;
356
+ };
357
+
358
+ export declare const HorizontalSeparator: ({ withPadding }: Props_3) => JSX_2.Element;
359
+
360
+ export declare const Label: ({ children, text, ...props }: LabelHTMLAttributes<HTMLLabelElement> & {
361
+ text?: string;
362
+ }) => JSX_2.Element;
363
+
364
+ export declare const LanguagePicker: ({ languages }: LanguagePickerProps) => JSX_2.Element;
365
+
366
+ export declare type LanguagePickerProps = {
367
+ languages: DropdownMenuOption[];
368
+ };
369
+
370
+ export declare const LeftPanel: ({ children, isOpen, }: PropsWithChildren<LeftPanelProps>) => JSX_2.Element;
371
+
372
+ export declare type LeftPanelProps = {
373
+ isOpen?: boolean;
374
+ };
375
+
376
+ export declare const MainLayout: ({ icon, children, leftPanelContent, rightHeaderContent, languages, enableResize, }: PropsWithChildren<MainLayoutProps>) => JSX_2.Element;
377
+
378
+ export declare type MainLayoutProps = {
379
+ icon?: React.ReactNode;
380
+ leftPanelContent?: React.ReactNode;
381
+ rightHeaderContent?: React.ReactNode;
382
+ languages?: DropdownMenuOption[];
383
+ onTogglePanel?: () => void;
384
+ enableResize?: boolean;
385
+ };
386
+
387
+ export declare const ProConnectButton: ({ disabled, onClick, }: ProConnectButtonProps) => JSX_2.Element;
388
+
389
+ export declare type ProConnectButtonProps = {
390
+ disabled?: boolean;
391
+ onClick?: () => void;
392
+ };
393
+
394
+ declare type Props = {
395
+ onSelect?: (value: string) => void;
396
+ id?: string;
397
+ };
398
+
399
+ declare type Props_2 = {
400
+ loading?: boolean;
401
+ inputValue?: string;
402
+ onFilter?: (str: string) => void;
403
+ placeholder?: string;
404
+ children?: ReactNode;
405
+ withSeparator?: boolean;
406
+ };
407
+
408
+ declare type Props_3 = {
409
+ withPadding?: boolean;
410
+ };
411
+
412
+ export declare const QuickSearch: ({ onFilter, inputContent, inputValue, loading, showInput, label, placeholder, children, }: QuickSearchProps) => JSX_2.Element;
413
+
414
+ export declare type QuickSearchAction = {
415
+ onSelect?: () => void;
416
+ content: ReactNode;
417
+ };
418
+
419
+ export declare type QuickSearchData<T> = {
420
+ groupName: string;
421
+ elements: T[];
422
+ emptyString?: string;
423
+ startActions?: QuickSearchAction[];
424
+ endActions?: QuickSearchAction[];
425
+ showWhenEmpty?: boolean;
426
+ };
427
+
428
+ export declare const QuickSearchGroup: <T>({ group, onSelect, renderElement, }: QuickSearchGroupProps<T>) => JSX_2.Element | null;
429
+
430
+ export declare type QuickSearchGroupProps<T> = {
431
+ group: QuickSearchData<T>;
432
+ renderElement?: (element: T) => ReactNode;
433
+ onSelect?: (element: T) => void;
434
+ };
435
+
436
+ export declare const QuickSearchInput: ({ loading, inputValue, onFilter, placeholder, children, withSeparator: separator, }: Props_2) => JSX_2.Element;
437
+
438
+ export declare const QuickSearchItem: ({ children, onSelect, id, }: PropsWithChildren<Props>) => JSX_2.Element;
439
+
440
+ export declare const QuickSearchItemTemplate: ({ alwaysShowRight, left, right, }: QuickSearchItemTemplateProps) => JSX_2.Element;
441
+
442
+ export declare type QuickSearchItemTemplateProps = {
443
+ alwaysShowRight?: boolean;
444
+ left: ReactNode;
445
+ right?: ReactNode;
446
+ };
447
+
448
+ export declare type QuickSearchProps = {
449
+ onFilter?: (str: string) => void;
450
+ inputValue?: string;
451
+ inputContent?: ReactNode;
452
+ showInput?: boolean;
453
+ loading?: boolean;
454
+ label?: string;
455
+ placeholder?: string;
456
+ children?: ReactNode;
457
+ };
458
+
459
+ export declare const Spinner: ({ size }: SpinnerProps) => JSX_2.Element;
460
+
461
+ declare interface SpinnerProps {
462
+ size?: "sm" | "md" | "lg" | "xl";
463
+ }
464
+
465
+ export declare type TabData = {
466
+ id: string;
467
+ label: string;
468
+ icon?: string;
469
+ content: React.ReactNode;
470
+ };
471
+
472
+ export declare type TabsProps = {
473
+ tabs: TabData[];
474
+ defaultSelectedTab?: string;
475
+ fullWidth?: boolean;
476
+ };
477
+
478
+ export declare const treeDemoData: ({
479
+ id: string;
480
+ name: string;
481
+ childrenCount?: undefined;
482
+ children?: undefined;
483
+ } | {
484
+ id: string;
485
+ name: string;
486
+ childrenCount: number;
487
+ children: never[];
488
+ } | {
489
+ id: string;
490
+ name: string;
491
+ children: {
492
+ id: string;
493
+ name: string;
494
+ }[];
495
+ childrenCount?: undefined;
496
+ })[];
497
+
498
+ export declare const TreeView: <T>({ treeData, selectedNodeId, rootNodeId, renderNode, afterMove, }: TreeViewProps<T>) => JSX_2.Element;
499
+
500
+ export declare type TreeViewDataType<T> = BaseTreeViewData<T>;
501
+
502
+ export declare const TreeViewItem: <T>({ children, onClick, node, dragHandle, style, loadChildren, forceLoading, }: PropsWithChildren<TreeViewNodeProps<T>>) => JSX_2.Element;
503
+
504
+ export declare enum TreeViewMoveModeEnum {
505
+ FIRST_CHILD = "first-child",
506
+ LAST_CHILD = "last-child",
507
+ LEFT = "left",
508
+ RIGHT = "right"
509
+ }
510
+
511
+ export declare type TreeViewMoveResult = {
512
+ targetNodeId: string;
513
+ mode: TreeViewMoveModeEnum;
514
+ sourceNodeId: string;
515
+ oldParentId?: string;
516
+ };
517
+
518
+ export declare type TreeViewNodeProps<T> = NodeRendererProps<TreeViewDataType<T>> & {
519
+ onClick?: () => void;
520
+ forceLoading?: boolean;
521
+ loadChildren?: (node: TreeViewDataType<T>) => Promise<TreeViewDataType<T>[]>;
522
+ };
523
+
524
+ export declare type TreeViewProps<T> = {
525
+ treeData: TreeViewDataType<T>[];
526
+ width?: number | string;
527
+ selectedNodeId?: string;
528
+ rootNodeId: string;
529
+ renderNode: (props: NodeRendererProps<TreeViewDataType<T>>) => React.ReactNode;
530
+ afterMove?: (result: TreeViewMoveResult, newTreeData: TreeViewDataType<T>[]) => void;
531
+ };
532
+
533
+ export declare const TreeViewSeparator: ({ top, left }: CursorProps) => JSX_2.Element;
534
+
535
+ export declare const useDropdownMenu: () => {
536
+ isOpen: boolean;
537
+ setIsOpen: Dispatch<SetStateAction<boolean>>;
538
+ };
539
+
540
+ export declare const useResponsive: () => {
541
+ isMobile: boolean;
542
+ isTablet: boolean;
543
+ isDesktop: boolean;
544
+ };
545
+
546
+ export declare const useTree: <T>(tree: TreeViewDataType<T>[], refreshCallback?: (id: string) => Promise<Partial<TreeViewDataType<T>>>) => {
547
+ treeData: TreeViewDataType<T>[];
548
+ setTreeData: Dispatch<SetStateAction<TreeViewDataType<T>[]>>;
549
+ addChild: (parentId: string, newNode: TreeViewDataType<T>) => void;
550
+ updateNode: (nodeId: string, updatedData: Partial<TreeViewDataType<T>>) => void;
551
+ deleteNode: (nodeId: string) => void;
552
+ addRootNode: (newNode: TreeViewDataType<T>) => void;
553
+ selectedNode: TreeViewDataType<T> | undefined;
554
+ setSelectedNode: Dispatch<SetStateAction<TreeViewDataType<T> | undefined>>;
555
+ refreshNode: (nodeId: string) => Promise<void>;
556
+ setChildren: (parentId: string, newChildren: TreeViewDataType<T>[], mergeStrategy?: "replace" | "merge") => void;
557
+ };
558
+
559
+ export declare const WithLabel: ({ label, text, labelSide, children, }: PropsWithChildren<WithLabelProps>) => JSX_2.Element;
560
+
561
+ export declare type WithLabelProps = {
562
+ label: string;
563
+ text?: string;
564
+ labelSide?: "left" | "right";
565
+ };
566
+
567
+ export { }