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