@kwantis-id3/frontend-library 1.0.0-rc.3 → 1.0.0-rc.30
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 +6 -332
- package/dist/esm/index.js +377 -127
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/Accordion/Accordion.d.ts +3 -37
- package/dist/esm/types/components/Accordion/AccordionInterfaces.d.ts +21 -0
- package/dist/esm/types/components/Accordion/AccordionStyled.d.ts +19 -10
- package/dist/esm/types/components/Accordion/index.d.ts +4 -1
- package/dist/esm/types/components/Button/Button.d.ts +2 -24
- package/dist/esm/types/components/Button/ButtonInterfaces.d.ts +24 -0
- package/dist/esm/types/components/Button/ButtonStyled.d.ts +41 -0
- package/dist/esm/types/components/Button/index.d.ts +2 -1
- package/dist/esm/types/components/Card/CardInterfaces.d.ts +1 -1
- package/dist/esm/types/components/Card/index.d.ts +2 -2
- package/dist/esm/types/components/DataGrid/DataGrid.d.ts +3 -0
- package/dist/esm/types/components/DataGrid/DataGridInterfaces.d.ts +9 -0
- package/dist/esm/types/components/DataGrid/index.d.ts +2 -0
- package/dist/esm/types/components/Drawer/Drawer.d.ts +3 -0
- package/dist/esm/types/components/Drawer/DrawerInterfaces.d.ts +33 -0
- package/dist/esm/types/components/Drawer/DrawerStyled.d.ts +28 -0
- package/dist/esm/types/components/Drawer/index.d.ts +2 -0
- package/dist/esm/types/components/Dropdown/Dropdown.d.ts +2 -43
- package/dist/esm/types/components/Dropdown/DropdownInterfaces.d.ts +52 -0
- package/dist/esm/types/components/Dropdown/DropdownStyled.d.ts +1 -0
- package/dist/esm/types/components/Dropdown/index.d.ts +2 -1
- package/dist/esm/types/components/Indicator/IndicatorInterfaces.d.ts +1 -1
- package/dist/esm/types/components/Indicator/NeutralIndicator.d.ts +3 -0
- package/dist/esm/types/components/Indicator/index.d.ts +2 -2
- package/dist/esm/types/components/InputField/InputField.d.ts +3 -11
- package/dist/esm/types/components/InputField/InputFieldInterfaces.d.ts +9 -0
- package/dist/esm/types/components/InputField/index.d.ts +2 -1
- package/dist/esm/types/components/Modal/Modal.d.ts +3 -19
- package/dist/esm/types/components/Modal/ModalInterfaces.d.ts +16 -0
- package/dist/esm/types/components/Modal/index.d.ts +2 -2
- package/dist/esm/types/components/MultiViewList/MultiViewGrid.d.ts +5 -0
- package/dist/esm/types/components/MultiViewList/MultiViewList.d.ts +4 -0
- package/dist/esm/types/components/MultiViewList/MultiViewListInterfaces.d.ts +17 -0
- package/dist/esm/types/components/MultiViewList/MultiViewListStyled.d.ts +7 -0
- package/dist/esm/types/components/MultiViewList/index.d.ts +3 -0
- package/dist/esm/types/components/SelectFilter/index.d.ts +2 -2
- package/dist/esm/types/components/Slider/Slider.d.ts +2 -2
- package/dist/esm/types/components/Slider/index.d.ts +1 -1
- package/dist/esm/types/components/Table/DebouncedFilter.d.ts +6 -0
- package/dist/esm/types/components/Table/DebouncedInput.d.ts +5 -0
- package/dist/esm/types/components/Table/Table.d.ts +3 -0
- package/dist/esm/types/components/Table/TableInterfaces.d.ts +21 -0
- package/dist/esm/types/components/Table/TableStyled.d.ts +14 -0
- package/dist/esm/types/components/Table/index.d.ts +2 -0
- package/dist/esm/types/components/Tag/Tag.d.ts +2 -22
- package/dist/esm/types/components/Tag/TagInterfaces.d.ts +22 -0
- package/dist/esm/types/components/Tag/TagStyled.d.ts +7 -0
- package/dist/esm/types/components/Tag/index.d.ts +2 -1
- package/dist/esm/types/components/ThemeContext/ThemeContext.d.ts +4 -3
- package/dist/esm/types/components/ThemeContext/ThemeInterfaces.d.ts +2 -0
- package/dist/esm/types/components/TreeView/ControlledTreeView.d.ts +4 -0
- package/dist/esm/types/components/TreeView/TreeUtils.d.ts +21 -0
- package/dist/esm/types/components/TreeView/TreeViewInterfaces.d.ts +79 -0
- package/dist/esm/types/components/TreeView/TreeViewSyled.d.ts +24 -0
- package/dist/esm/types/components/TreeView/UncontrolledTreeView.d.ts +3 -0
- package/dist/esm/types/components/TreeView/index.d.ts +3 -0
- package/dist/esm/types/components/index.d.ts +15 -10
- package/dist/esm/types/utils/colors.d.ts +12 -2
- package/dist/esm/types/utils/index.d.ts +4 -7
- package/dist/esm/types/utils/isMobile.d.ts +1 -2
- package/dist/esm/types/utils/testing.d.ts +70 -1
- package/dist/index.d.ts +272 -66
- package/package.json +32 -26
- package/src/types/emotion.d.ts +8 -0
- package/src/types/tanstack.d.ts +7 -0
- package/changelog.md +0 -197
- package/dist/esm/types/utils/styled.d.ts +0 -2
- /package/dist/esm/types/components/InputField/{StyledInputField.d.ts → InputFieldStyled.d.ts} +0 -0
- /package/dist/esm/types/components/Modal/{StyledModal.d.ts → ModalStyled.d.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
2
|
+
import * as _emotion_react from '@emotion/react';
|
|
3
|
+
import { Interpolation, Theme as Theme$1 } from '@emotion/react';
|
|
4
|
+
import { Theme } from '@emotion/react/dist/declarations/src';
|
|
5
|
+
import * as react from 'react';
|
|
6
|
+
import { PropsWithChildren, ReactNode, FC } from 'react';
|
|
7
|
+
import * as _emotion_styled from '@emotion/styled';
|
|
8
|
+
import { CreateStyled } from '@emotion/styled';
|
|
9
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
6
10
|
|
|
7
|
-
type
|
|
8
|
-
type
|
|
11
|
+
type TButtonVariants = "contained" | "outlined" | "text";
|
|
12
|
+
type TButtonProps = {
|
|
9
13
|
/** Color of the button */
|
|
10
14
|
color?: string;
|
|
11
15
|
/** Type of the button */
|
|
@@ -13,7 +17,9 @@ type ButtonProps = {
|
|
|
13
17
|
/** Custom styles */
|
|
14
18
|
sx?: Interpolation<Theme>;
|
|
15
19
|
/** Variant of the button, either `contained`, `outlined` or `text` */
|
|
16
|
-
variant?:
|
|
20
|
+
variant?: TButtonVariants;
|
|
21
|
+
/** The button size; either "large" or "small" */
|
|
22
|
+
size?: "small" | "large";
|
|
17
23
|
/** onClick handler */
|
|
18
24
|
onClick?: () => void;
|
|
19
25
|
className?: string;
|
|
@@ -22,9 +28,10 @@ type ButtonProps = {
|
|
|
22
28
|
/** Disabled state */
|
|
23
29
|
disabled?: boolean;
|
|
24
30
|
/** Elements to render as children */
|
|
25
|
-
children?: React
|
|
31
|
+
children?: React.ReactNode;
|
|
26
32
|
};
|
|
27
|
-
|
|
33
|
+
|
|
34
|
+
declare const Button: (props: TButtonProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
28
35
|
|
|
29
36
|
type TColorScale = {
|
|
30
37
|
50: string;
|
|
@@ -90,6 +97,8 @@ interface IIndicatorColors {
|
|
|
90
97
|
warningFill: string;
|
|
91
98
|
error: string;
|
|
92
99
|
errorFill: string;
|
|
100
|
+
neutral: string;
|
|
101
|
+
neutralFill: string;
|
|
93
102
|
}
|
|
94
103
|
interface IPalette {
|
|
95
104
|
/** Application background */
|
|
@@ -135,56 +144,54 @@ interface IThemeContextValue {
|
|
|
135
144
|
setMode: (mode: TThemeMode) => void;
|
|
136
145
|
}
|
|
137
146
|
|
|
147
|
+
declare const commonColors: ICommonColors;
|
|
138
148
|
declare const defaultLightPalette: IPalette;
|
|
139
149
|
declare const defaultDarkPalette: IPalette;
|
|
140
|
-
declare const ThemeContextProvider: ({ palettes, defaultMode, children, }:
|
|
150
|
+
declare const ThemeContextProvider: ({ palettes, defaultMode, children, }: PropsWithChildren<IThemeContextProps>) => ReactNode;
|
|
141
151
|
declare const useThemeContext: () => IThemeContextValue;
|
|
142
152
|
|
|
143
|
-
|
|
144
|
-
|
|
153
|
+
declare const AccordionGroup: _emotion_styled.StyledComponent<{
|
|
154
|
+
theme?: _emotion_react.Theme;
|
|
155
|
+
as?: React.ElementType;
|
|
156
|
+
}, react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
157
|
+
|
|
158
|
+
type TAccordionProps = PropsWithChildren & {
|
|
159
|
+
/** Title to be used if no custom trigger is passed */
|
|
145
160
|
title: string;
|
|
146
|
-
/** Content of the accordion */
|
|
147
|
-
children: React__default.ReactNode;
|
|
148
|
-
/** Custom trigger component */
|
|
149
|
-
customTrigger?: React__default.ReactNode;
|
|
150
|
-
/** Works only if uncontrolled (isOpen props is not present) */
|
|
151
|
-
defaultOpen?: boolean;
|
|
152
|
-
/** Color of the accordion */
|
|
153
|
-
color?: string;
|
|
154
|
-
/** Color of the icon */
|
|
155
|
-
iconColor?: string;
|
|
156
|
-
/** Color of the divider */
|
|
157
|
-
dividerColor?: string;
|
|
158
|
-
/** Hide the icon */
|
|
159
|
-
hideIcon?: boolean;
|
|
160
|
-
/** Hide the divider */
|
|
161
|
-
hideDivider?: boolean;
|
|
162
161
|
/** Pass your state value here if the Accordion needs to be Controlled */
|
|
163
162
|
isOpen?: boolean;
|
|
164
|
-
/**
|
|
165
|
-
|
|
166
|
-
/**
|
|
163
|
+
/** Default open state if the accordion is Uncontrolled */
|
|
164
|
+
defaultOpen?: boolean;
|
|
165
|
+
/** Callback function to be called when the Accordion is clicked */
|
|
167
166
|
onClick?: () => void;
|
|
168
|
-
/**
|
|
167
|
+
/** Callback function to be called when the Accordion opens */
|
|
169
168
|
onOpen?: () => void;
|
|
170
|
-
/**
|
|
169
|
+
/** Callback function to be called when the Accordion closes */
|
|
171
170
|
onClose?: () => void;
|
|
172
|
-
/** Custom
|
|
173
|
-
|
|
171
|
+
/** Custom trigger element */
|
|
172
|
+
trigger?: (isOpen: boolean) => React.ReactNode;
|
|
173
|
+
/** Variant of the Accordion. Default has everything wrapped in borders, while light just renders the content and the title without setting colors
|
|
174
|
+
* @default "default"
|
|
175
|
+
*/
|
|
176
|
+
variant?: "default" | "light";
|
|
174
177
|
};
|
|
175
|
-
declare const Accordion: (props: AccordionProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
176
178
|
|
|
177
|
-
|
|
179
|
+
declare const Accordion: FC<TAccordionProps>;
|
|
180
|
+
|
|
181
|
+
declare const InputField: react.ForwardRefExoticComponent<react.InputHTMLAttributes<HTMLInputElement> & {
|
|
182
|
+
containerClassName?: string;
|
|
183
|
+
color?: string;
|
|
184
|
+
sx?: _emotion_react.Interpolation<_emotion_react.Theme>;
|
|
185
|
+
} & react.RefAttributes<HTMLInputElement>>;
|
|
186
|
+
|
|
187
|
+
type TTextFieldProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
178
188
|
/** Classname given to the container div */
|
|
179
189
|
containerClassName?: string;
|
|
180
|
-
/** Disables the input */
|
|
181
|
-
isDisabled?: boolean;
|
|
182
190
|
/** The color of the input */
|
|
183
191
|
color?: string;
|
|
184
192
|
/** Change the styles of the input field */
|
|
185
|
-
sx?:
|
|
186
|
-
}
|
|
187
|
-
declare const InputField: React__default.ForwardRefExoticComponent<TextFieldProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
193
|
+
sx?: Interpolation<Theme$1>;
|
|
194
|
+
};
|
|
188
195
|
|
|
189
196
|
interface SingleSelectProps<Option = {
|
|
190
197
|
label: string;
|
|
@@ -274,7 +281,7 @@ interface MultiSelectProps<Option = {
|
|
|
274
281
|
}
|
|
275
282
|
declare const MultiSelect: <Option>(props: MultiSelectProps<Option>) => _emotion_react_jsx_runtime.JSX.Element;
|
|
276
283
|
|
|
277
|
-
type
|
|
284
|
+
type TSliderProps = {
|
|
278
285
|
/** The values of the slider. */
|
|
279
286
|
values: number[];
|
|
280
287
|
/** The minimum value of the slider. */
|
|
@@ -306,7 +313,7 @@ type SliderProps = {
|
|
|
306
313
|
/** Wether the thumbs can overlap */
|
|
307
314
|
allowOverlap?: boolean;
|
|
308
315
|
};
|
|
309
|
-
declare const Slider: (props:
|
|
316
|
+
declare const Slider: (props: TSliderProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
310
317
|
|
|
311
318
|
/**
|
|
312
319
|
* @property {string} value - The value displayed in the dropdown item
|
|
@@ -315,7 +322,7 @@ declare const Slider: (props: SliderProps) => _emotion_react_jsx_runtime.JSX.Ele
|
|
|
315
322
|
* @property {DropdownItem[]} children - The children of the dropdown item
|
|
316
323
|
* @property {() => void} onClick - The onClick handler of the dropdown item
|
|
317
324
|
*/
|
|
318
|
-
type
|
|
325
|
+
type TDropdownItem = {
|
|
319
326
|
/** The value displayed in the item */
|
|
320
327
|
value: string;
|
|
321
328
|
/** The color of the item */
|
|
@@ -325,7 +332,7 @@ type DropdownItem = {
|
|
|
325
332
|
/** The hover color of the item */
|
|
326
333
|
hoverColor?: string;
|
|
327
334
|
/** The children of the item */
|
|
328
|
-
children?:
|
|
335
|
+
children?: TDropdownItem[];
|
|
329
336
|
/** Wether the item is hidden or not */
|
|
330
337
|
isHidden?: boolean;
|
|
331
338
|
/** Wether the dropdown should close when the item is clicked */
|
|
@@ -333,25 +340,39 @@ type DropdownItem = {
|
|
|
333
340
|
/** The onClick handler of the item */
|
|
334
341
|
onClick?: () => void;
|
|
335
342
|
};
|
|
336
|
-
type
|
|
343
|
+
type TDropdownProps = {
|
|
337
344
|
/** The content of the dropdown */
|
|
338
|
-
content:
|
|
345
|
+
content: TDropdownItem[];
|
|
339
346
|
/** The trigger element of the dropdown. Clicking on this item will open the dropdown */
|
|
340
|
-
trigger:
|
|
347
|
+
trigger: React.ReactNode;
|
|
341
348
|
/** The color of the dropdown */
|
|
342
349
|
bgColor?: string;
|
|
343
350
|
/** The hover color of the dropdown */
|
|
344
351
|
hoverColor?: string;
|
|
352
|
+
/** The border color */
|
|
353
|
+
borderColor?: string;
|
|
354
|
+
/** The border width */
|
|
355
|
+
borderWidth?: string;
|
|
345
356
|
/** Controls wether the dropdown should extend towards the left or the right */
|
|
346
357
|
direction?: "left" | "right";
|
|
358
|
+
/** Controls whether the dropdown body should have absolute or fixed position
|
|
359
|
+
* By default, it is set to absolute, which means the dropdown will be positioned relative to its parent element.
|
|
360
|
+
* Use fixed if you want the body to be above the entire page, regardless of the parent element.
|
|
361
|
+
*/
|
|
362
|
+
menuPosition?: "absolute" | "fixed";
|
|
347
363
|
/** The mobile breakpoint, by default it's 768px */
|
|
348
364
|
mobileBreakpoint?: number;
|
|
349
365
|
};
|
|
350
|
-
|
|
366
|
+
type TDropdownItemProps = TDropdownItem & {
|
|
367
|
+
direction?: string;
|
|
368
|
+
closeBody: () => void;
|
|
369
|
+
};
|
|
351
370
|
|
|
352
|
-
|
|
371
|
+
declare const Dropdown: (props: TDropdownProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
372
|
+
|
|
373
|
+
type TModalProps = {
|
|
353
374
|
/** The content of the modal */
|
|
354
|
-
children:
|
|
375
|
+
children: React.ReactNode;
|
|
355
376
|
/** Cointrols whether the modal should be open or not. */
|
|
356
377
|
isOpen: boolean;
|
|
357
378
|
/** The handler to be called when the modal is closed */
|
|
@@ -363,9 +384,10 @@ interface ModalProps {
|
|
|
363
384
|
/** custom height */
|
|
364
385
|
height?: string;
|
|
365
386
|
/** custom css */
|
|
366
|
-
sx?:
|
|
367
|
-
}
|
|
368
|
-
|
|
387
|
+
sx?: React.CSSProperties;
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
declare const Modal: FC<TModalProps>;
|
|
369
391
|
|
|
370
392
|
type TIndicatorInstanceProps = {
|
|
371
393
|
outerColor?: string;
|
|
@@ -377,7 +399,7 @@ type TIndicatorInstanceProps = {
|
|
|
377
399
|
type TIndicatorProps = {
|
|
378
400
|
variant: TIndicatorVariants;
|
|
379
401
|
} & TIndicatorInstanceProps;
|
|
380
|
-
type TIndicatorVariants = "live" | "success" | "warning" | "error";
|
|
402
|
+
type TIndicatorVariants = "live" | "success" | "warning" | "error" | "neutral";
|
|
381
403
|
|
|
382
404
|
type TGenericIndicatorProps = {
|
|
383
405
|
variant: TIndicatorVariants;
|
|
@@ -403,11 +425,14 @@ type TTagProps = {
|
|
|
403
425
|
textColor?: string;
|
|
404
426
|
sx?: Interpolation<Theme>;
|
|
405
427
|
};
|
|
428
|
+
|
|
429
|
+
/** @jsxImportSource @emotion/react */
|
|
430
|
+
|
|
406
431
|
declare const Tag: FC<TTagProps>;
|
|
407
432
|
|
|
408
433
|
type TCardSectionProps = PropsWithChildren & {
|
|
409
|
-
sx?: Interpolation$1
|
|
410
|
-
onClick?: (e:
|
|
434
|
+
sx?: Interpolation<Theme$1>;
|
|
435
|
+
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
411
436
|
};
|
|
412
437
|
|
|
413
438
|
/** @jsxImportSource @emotion/react */
|
|
@@ -424,12 +449,176 @@ declare const CardFooter: FC<TCardSectionProps>;
|
|
|
424
449
|
declare const CardIndicators: FC<TCardSectionProps>;
|
|
425
450
|
declare const CardMediaSection: FC<TCardSectionProps>;
|
|
426
451
|
|
|
452
|
+
type TCellValues = string | number | boolean | null;
|
|
453
|
+
type TTableProps<Cell extends TCellValues, Row extends TTableRow<Cell>> = {
|
|
454
|
+
columns: ColumnDef<Row, Cell>[];
|
|
455
|
+
data: Row[] | undefined;
|
|
456
|
+
};
|
|
457
|
+
type TTableCell<T extends TCellValues> = {
|
|
458
|
+
value: T;
|
|
459
|
+
bgColor?: string | null;
|
|
460
|
+
textColor?: string | null;
|
|
461
|
+
};
|
|
462
|
+
type TTableRow<T extends TCellValues> = {
|
|
463
|
+
info?: {
|
|
464
|
+
bgColor?: string | null;
|
|
465
|
+
textColor?: string | null;
|
|
466
|
+
[key: string]: string | number | boolean | null | undefined;
|
|
467
|
+
};
|
|
468
|
+
cells: {
|
|
469
|
+
[key: string]: TTableCell<T>;
|
|
470
|
+
};
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
declare const Table: <Cell extends TCellValues, Row extends TTableRow<Cell>>(props: TTableProps<Cell, Row>) => _emotion_react_jsx_runtime.JSX.Element;
|
|
474
|
+
declare const renderCell: (value: string | number | boolean | null) => _emotion_react_jsx_runtime.JSX.Element;
|
|
475
|
+
|
|
476
|
+
type TDataGridProps<Cell extends TCellValues, Row extends TDataGridRow<Cell>> = {
|
|
477
|
+
columns: ColumnDef<TDataGridRow<Cell>, Cell>[];
|
|
478
|
+
data: Row[] | undefined;
|
|
479
|
+
};
|
|
480
|
+
type TDataGridRow<Cell extends TCellValues> = {
|
|
481
|
+
[key: string]: Cell;
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
declare const DataGrid: <Cell extends TCellValues, Row extends TDataGridRow<Cell>>(props: TDataGridProps<Cell, Row>) => _emotion_react_jsx_runtime.JSX.Element;
|
|
485
|
+
|
|
486
|
+
type TMultiViewListProps<Cell extends TCellValues, Row extends TTableRow<Cell>> = TTableProps<Cell, Row> & {
|
|
487
|
+
mode: "table" | "cards";
|
|
488
|
+
cardComponent: (item: Row, index: number) => React.ReactNode;
|
|
489
|
+
cardsWidth?: string;
|
|
490
|
+
cardsHeight?: string;
|
|
491
|
+
sx?: Interpolation<Theme$1>;
|
|
492
|
+
};
|
|
493
|
+
type TMultiViewGridProps<Cell extends TCellValues, Row extends TDataGridRow<Cell>> = TDataGridProps<Cell, Row> & {
|
|
494
|
+
mode: "table" | "cards";
|
|
495
|
+
cardComponent: (item: Row, index: number) => React.ReactNode;
|
|
496
|
+
cardsWidth?: string;
|
|
497
|
+
cardsHeight?: string;
|
|
498
|
+
sx?: Interpolation<Theme$1>;
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
declare const MultiViewList: <Cell extends TCellValues, Row extends TTableRow<Cell>>(props: TMultiViewListProps<Cell, Row>) => _emotion_react_jsx_runtime.JSX.Element;
|
|
502
|
+
|
|
503
|
+
declare const MultiViewGrid: <Cell extends TCellValues, Row extends TDataGridRow<Cell>>(props: TMultiViewGridProps<Cell, Row>) => _emotion_react_jsx_runtime.JSX.Element;
|
|
504
|
+
|
|
427
505
|
/**
|
|
428
|
-
*
|
|
429
|
-
* @
|
|
430
|
-
* @
|
|
506
|
+
* A callback to customize how items are rendered
|
|
507
|
+
* @property isOpen: A boolean indicating if the item is expanded
|
|
508
|
+
* @property hasChildren: A boolean indicating if the item has children
|
|
509
|
+
* @property item: the entire item object
|
|
431
510
|
*/
|
|
432
|
-
|
|
511
|
+
type TCustomRenderProps = {
|
|
512
|
+
isOpen: boolean;
|
|
513
|
+
item: TTreeViewItem;
|
|
514
|
+
};
|
|
515
|
+
/**
|
|
516
|
+
* A callback to customize how the content of the items is rendered
|
|
517
|
+
* @extends TCustomRenderProps
|
|
518
|
+
* @property icon: The icon of the item. If the renderIcon callback is provided, this will be the result of that callback
|
|
519
|
+
* @property title: The title of the item. If the renderTitle callback is provided, this will be the result of that callback
|
|
520
|
+
*/
|
|
521
|
+
type TRenderTriggerProps = TCustomRenderProps & {
|
|
522
|
+
icon: React.ReactNode;
|
|
523
|
+
title: React.ReactNode;
|
|
524
|
+
};
|
|
525
|
+
type TTreeItemFunctions = {
|
|
526
|
+
/** A callback to customize how the titles are rendered */
|
|
527
|
+
renderTitle?: (props: TCustomRenderProps) => React.ReactNode;
|
|
528
|
+
/** A callback to customize how the icons are rendered */
|
|
529
|
+
renderIcon?: (props: TCustomRenderProps) => React.ReactNode;
|
|
530
|
+
/** A callback to customize how the content of the items is rendered */
|
|
531
|
+
renderTrigger?: (props: TRenderTriggerProps) => React.ReactNode;
|
|
532
|
+
/** A callback executed when an item is focused. An item gets focused when you click on it. Focusing and item will also select it. */
|
|
533
|
+
onFocusItem?: (item: TTreeViewItem) => void;
|
|
534
|
+
/** A callback executed when an item is selected. To select an item, ctrl+click on it. */
|
|
535
|
+
onSelectItems?: (item: string[]) => void;
|
|
536
|
+
/** A callback executed when an item is expanded */
|
|
537
|
+
onExpandItem?: (item: TTreeViewItem) => void;
|
|
538
|
+
/** A callback executed when an item is collapsed */
|
|
539
|
+
onCollapseItem?: (item: TTreeViewItem) => void;
|
|
540
|
+
/** A callback to handle the expansion of items without children */
|
|
541
|
+
onMissingChildren?: (item: TTreeViewItem) => void;
|
|
542
|
+
};
|
|
543
|
+
type TTreeViewProps = TTreeItemFunctions & {
|
|
544
|
+
/** An array representing the items that the tree needs to render */
|
|
545
|
+
items: TTreeViewItem[];
|
|
546
|
+
/** Disable multi-selection possibility */
|
|
547
|
+
isMultiSelectionDisabled?: boolean;
|
|
548
|
+
/** Custom styles */
|
|
549
|
+
sx?: Interpolation<Theme$1>;
|
|
550
|
+
};
|
|
551
|
+
type TUncontrolledTreeViewProps = TTreeViewProps & {
|
|
552
|
+
items: TTreeViewItem[];
|
|
553
|
+
/** A search string used to filter the items. */
|
|
554
|
+
searchString?: string;
|
|
555
|
+
};
|
|
556
|
+
type TControlledTreeViewProps = TTreeViewProps & {
|
|
557
|
+
/** The current state of the Tree View. */
|
|
558
|
+
viewState: TViewState;
|
|
559
|
+
};
|
|
560
|
+
type TViewState = {
|
|
561
|
+
/** The list of ids of items that are selected */
|
|
562
|
+
selectedItems?: string[];
|
|
563
|
+
/** The list of ids of items that are expanded */
|
|
564
|
+
expandedItems?: string[];
|
|
565
|
+
/** The focused item */
|
|
566
|
+
focusedItem?: string;
|
|
567
|
+
};
|
|
568
|
+
type TTreeViewItem = TTreeItemFunctions & {
|
|
569
|
+
/** Item identifier */
|
|
570
|
+
id: string;
|
|
571
|
+
/** Item name */
|
|
572
|
+
name: string;
|
|
573
|
+
/** The possible children of this item */
|
|
574
|
+
children?: string[];
|
|
575
|
+
/** If the item should be rendered as a folder even with no children */
|
|
576
|
+
isFolder?: boolean;
|
|
577
|
+
/** A callback to fetch children asynchronously */
|
|
578
|
+
childrenAsync?: () => Promise<TTreeViewItem[]>;
|
|
579
|
+
/** Custom styles */
|
|
580
|
+
sx?: Interpolation<Theme$1>;
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
/** @jsxImportSource @emotion/react */
|
|
584
|
+
|
|
585
|
+
declare const ControlledTreeView: FC<TControlledTreeViewProps>;
|
|
586
|
+
|
|
587
|
+
declare const UncontrolledTreeView: FC<TUncontrolledTreeViewProps>;
|
|
588
|
+
|
|
589
|
+
type TDrawerProps = {
|
|
590
|
+
/** Position of the drawer */
|
|
591
|
+
anchor: "top" | "right" | "bottom" | "left";
|
|
592
|
+
/** Optional state value to control the component */
|
|
593
|
+
isOpen?: boolean;
|
|
594
|
+
/** Trigger showed when drawer is closed */
|
|
595
|
+
closedTrigger?: ReactNode;
|
|
596
|
+
/** Trigger showed when drawer is open */
|
|
597
|
+
openTrigger?: ReactNode;
|
|
598
|
+
/** Component to be rendered when Drawer is open */
|
|
599
|
+
openContent?: ReactNode;
|
|
600
|
+
/** Component to be rendered when Drawer is closed */
|
|
601
|
+
closedContent?: ReactNode;
|
|
602
|
+
/** Min open of the drawer as number of pixels. If not defined the minOpen will be the height of closedContent if present, otherwise 0px */
|
|
603
|
+
minOpen?: number;
|
|
604
|
+
/** Max open of the drawer as number of pixels. If not defined the maxOpen will be the height of openContent with limit at 90vh/vw */
|
|
605
|
+
maxOpen?: number;
|
|
606
|
+
/** Background color */
|
|
607
|
+
bgColor?: string;
|
|
608
|
+
/** Trigger Color */
|
|
609
|
+
triggerColor?: string;
|
|
610
|
+
/** Trigger hover color */
|
|
611
|
+
triggerHoverColor?: string;
|
|
612
|
+
/** Hide the default thumb trigger */
|
|
613
|
+
hideTrigger?: boolean;
|
|
614
|
+
/** Set a custom z-index */
|
|
615
|
+
zIndex?: number;
|
|
616
|
+
sx?: Interpolation<Theme$1>;
|
|
617
|
+
onOpen?: () => void;
|
|
618
|
+
onClose?: () => void;
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
declare const Drawer: ({ anchor, isOpen: isOpenProp, openContent, closedContent, openTrigger, closedTrigger, minOpen, maxOpen, bgColor, triggerColor, triggerHoverColor, onOpen, onClose, zIndex, hideTrigger, sx, }: TDrawerProps) => _emotion_react_jsx_runtime.JSX.Element;
|
|
433
622
|
|
|
434
623
|
/**
|
|
435
624
|
* emotion.js doesn't support transient options out of the box.
|
|
@@ -440,7 +629,12 @@ declare const useIsMobile: (mobileBreakpoint?: number) => boolean;
|
|
|
440
629
|
*/
|
|
441
630
|
declare const transientOptions: Parameters<CreateStyled>[1];
|
|
442
631
|
|
|
443
|
-
|
|
632
|
+
/**
|
|
633
|
+
* Hook to check if the screen is mobile. The default breakpoint is 768px.
|
|
634
|
+
* @param {number=} mobileBreakpoint breakpoint width to check against
|
|
635
|
+
* @returns boolean
|
|
636
|
+
*/
|
|
637
|
+
declare const useIsMobile: (mobileBreakpoint?: number) => boolean;
|
|
444
638
|
|
|
445
639
|
/**
|
|
446
640
|
*
|
|
@@ -450,17 +644,29 @@ declare const styled: CreateStyled;
|
|
|
450
644
|
declare const getContrastColor: (color: string) => string;
|
|
451
645
|
/**
|
|
452
646
|
*
|
|
453
|
-
* @param color
|
|
647
|
+
* @param color a color
|
|
454
648
|
* @param strength the strength (0-100) to darken the color
|
|
455
649
|
* @returns the color darkened by the strength
|
|
456
650
|
*/
|
|
457
651
|
declare const darkenColor: (color: string, strength?: number) => string;
|
|
458
652
|
/**
|
|
459
653
|
*
|
|
460
|
-
* @param color
|
|
654
|
+
* @param color a color
|
|
461
655
|
* @param strength the strength (0-100) to lighten the color
|
|
462
656
|
* @returns the color lightened by the strength
|
|
463
657
|
*/
|
|
464
658
|
declare const lightenColor: (color: string, strength?: number) => string;
|
|
659
|
+
/**
|
|
660
|
+
* @param color a color
|
|
661
|
+
* @returns the hover color, based on if the color is dark or light
|
|
662
|
+
*/
|
|
663
|
+
declare const getHoverColor: (color: string) => string;
|
|
664
|
+
/**
|
|
665
|
+
* @param color a color
|
|
666
|
+
* @returns the active color, based on if the color is dark or light
|
|
667
|
+
*/
|
|
668
|
+
declare const getActiveColor: (color: string) => string;
|
|
669
|
+
|
|
670
|
+
declare function usePrefersColorScheme(): "light" | "dark";
|
|
465
671
|
|
|
466
|
-
export { Accordion,
|
|
672
|
+
export { Accordion, AccordionGroup, Button, Card, CardContent, CardFooter, CardHeader, CardIndicators, CardMediaSection, ControlledTreeView, DataGrid, Drawer, Dropdown, IBackgroundColors, ICommonColors, IIndicatorColors, IPalette, IStandardPaletteColor, ITagColors, IThemeContextProps, IThemeContextValue, Indicator, InputField, Modal, MultiSelect, MultiSelectProps, MultiViewGrid, MultiViewList, SingleSelect, SingleSelectProps, Slider, TAccordionProps, TButtonProps, TButtonVariants, TCardSectionProps, TCellValues, TColorScale, TControlledTreeViewProps, TCustomRenderProps, TDataGridProps, TDataGridRow, TDrawerProps, TDropdownItem, TDropdownItemProps, TDropdownProps, TIndicatorInstanceProps, TIndicatorProps, TIndicatorVariants, TModalProps, TMultiViewGridProps, TMultiViewListProps, TRenderTriggerProps, TSliderProps, TTableCell, TTableProps, TTableRow, TTagProps, TTextFieldProps, TThemeMode, TTreeViewItem, TUncontrolledTreeViewProps, TViewState, Table, Tag, ThemeContextProvider, UncontrolledTreeView, commonColors, darkenColor, defaultDarkPalette, defaultLightPalette, getActiveColor, getContrastColor, getHoverColor, lightenColor, renderCell, transientOptions, useIsMobile, usePrefersColorScheme, useThemeContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kwantis-id3/frontend-library",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.30",
|
|
4
4
|
"description": "Kwantis frontend components collection",
|
|
5
5
|
"scriptsComments": {
|
|
6
6
|
"storybook": "Starts storybook in development mode",
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
"test": "vitest run",
|
|
28
28
|
"test:watch": "vitest",
|
|
29
29
|
"test:coverage": "vitest --coverage",
|
|
30
|
-
"chromatic": "npx chromatic --project-token=3dd812d03e4c",
|
|
31
30
|
"build": "pnpm rollup",
|
|
32
31
|
"bump:patch": "pnpm version patch",
|
|
33
32
|
"bump:minor": "pnpm version minor",
|
|
@@ -46,17 +45,20 @@
|
|
|
46
45
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
47
46
|
"@rollup/plugin-terser": "^0.4.4",
|
|
48
47
|
"@rollup/plugin-typescript": "^11.0.0",
|
|
49
|
-
"@storybook/addon-essentials": "
|
|
50
|
-
"@storybook/addon-interactions": "
|
|
51
|
-
"@storybook/addon-links": "
|
|
52
|
-
"@storybook/
|
|
53
|
-
"@storybook/
|
|
54
|
-
"@storybook/react
|
|
55
|
-
"@storybook/
|
|
48
|
+
"@storybook/addon-essentials": "^8.6.4",
|
|
49
|
+
"@storybook/addon-interactions": "^8.6.4",
|
|
50
|
+
"@storybook/addon-links": "^8.6.4",
|
|
51
|
+
"@storybook/addon-webpack5-compiler-swc": "^2.1.0",
|
|
52
|
+
"@storybook/blocks": "^8.6.4",
|
|
53
|
+
"@storybook/react": "^8.6.4",
|
|
54
|
+
"@storybook/react-webpack5": "^8.6.4",
|
|
55
|
+
"@storybook/test": "^8.6.4",
|
|
56
|
+
"@storybook/types": "^8.6.4",
|
|
56
57
|
"@testing-library/jest-dom": "^5.16.5",
|
|
57
58
|
"@testing-library/react": "^16.2.0",
|
|
58
|
-
"@testing-library/user-event": "^14.
|
|
59
|
-
"@types/react": "^
|
|
59
|
+
"@testing-library/user-event": "^14.6.1",
|
|
60
|
+
"@types/react": "^19.0.10",
|
|
61
|
+
"@types/react-dom": "^19.0.0",
|
|
60
62
|
"@types/testing-library__jest-dom": "^5.14.5",
|
|
61
63
|
"@types/tinycolor2": "^1.4.3",
|
|
62
64
|
"@typescript-eslint/eslint-plugin": "^5.58.0",
|
|
@@ -67,40 +69,39 @@
|
|
|
67
69
|
"eslint-config-prettier": "^8.8.0",
|
|
68
70
|
"eslint-plugin-react": "^7.32.2",
|
|
69
71
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
70
|
-
"eslint-plugin-storybook": "^0.
|
|
72
|
+
"eslint-plugin-storybook": "^0.11.4",
|
|
71
73
|
"jsdom": "^23.0.1",
|
|
72
74
|
"prop-types": "15.8.1",
|
|
73
|
-
"react": "18.2.0",
|
|
74
|
-
"react-dom": "18.2.0",
|
|
75
75
|
"rollup": "^3.20.2",
|
|
76
76
|
"rollup-plugin-dts": "^5.3.0",
|
|
77
77
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
78
|
-
"storybook": "
|
|
78
|
+
"storybook": "^8.6.4",
|
|
79
79
|
"ts-node": "^10.9.1",
|
|
80
80
|
"tslib": "^2.5.0",
|
|
81
|
-
"typescript": "^5.
|
|
82
|
-
"vitest": "^3.0.5"
|
|
81
|
+
"typescript": "^5.7.3",
|
|
82
|
+
"vitest": "^3.0.5",
|
|
83
|
+
"@emotion/jest": "^11.11.0"
|
|
83
84
|
},
|
|
84
85
|
"peerDependencies": {
|
|
85
|
-
"react": "
|
|
86
|
+
"@tanstack/react-table": "^8.0.0",
|
|
87
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
88
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
89
|
+
"@emotion/react": "^11.0.0",
|
|
90
|
+
"@emotion/styled": "^11.0.0"
|
|
86
91
|
},
|
|
87
92
|
"main": "dist/cjs/index.js",
|
|
88
93
|
"module": "dist/esm/index.js",
|
|
89
94
|
"files": [
|
|
90
|
-
"dist"
|
|
95
|
+
"dist",
|
|
96
|
+
"src/types"
|
|
91
97
|
],
|
|
92
98
|
"types": "dist/index.d.ts",
|
|
93
99
|
"dependencies": {
|
|
94
|
-
"@
|
|
95
|
-
"@emotion/react": "11.14.0",
|
|
96
|
-
"@emotion/styled": "11.14.0",
|
|
97
|
-
"react-collapsible": "^2.10.0",
|
|
98
|
-
"react-icons-kit": "^2.0.0",
|
|
100
|
+
"@iconify/react": "^5.2.0",
|
|
99
101
|
"react-range": "^1.8.14",
|
|
100
102
|
"react-select": "^5.7.3",
|
|
101
103
|
"tinycolor2": "^1.6.0"
|
|
102
104
|
},
|
|
103
|
-
"readme": "ERROR: No README data found!",
|
|
104
105
|
"pnpm": {
|
|
105
106
|
"overrides": {
|
|
106
107
|
"@adobe/css-tools@<4.3.1": ">=4.3.1",
|
|
@@ -112,5 +113,10 @@
|
|
|
112
113
|
"word-wrap@<1.2.4": ">=1.2.4",
|
|
113
114
|
"@babel/traverse@<7.23.2": ">=7.23.2"
|
|
114
115
|
}
|
|
115
|
-
}
|
|
116
|
+
},
|
|
117
|
+
"engines": {
|
|
118
|
+
"node": ">=20.0.0",
|
|
119
|
+
"pnpm": ">=10.0.0"
|
|
120
|
+
},
|
|
121
|
+
"packageManager": "pnpm@10.0.0+sha512.b8fef5494bd3fe4cbd4edabd0745df2ee5be3e4b0b8b08fa643aa3e4c6702ccc0f00d68fa8a8c9858a735a0032485a44990ed2810526c875e416f001b17df12b"
|
|
116
122
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "@emotion/styled";
|
|
2
|
+
import { IThemeContextValue } from "../components/ThemeContext/ThemeInterfaces";
|
|
3
|
+
|
|
4
|
+
// override the default theme
|
|
5
|
+
declare module "@emotion/react" {
|
|
6
|
+
// eslint-disable-next-line
|
|
7
|
+
export interface Theme extends IThemeContextValue {}
|
|
8
|
+
}
|