@up42/up-components 5.5.2 → 5.6.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/dist/cjs/index.js +2 -2
- package/dist/cjs/types/components/CodeSnippet/CodeSnippet.d.ts +42 -12
- package/dist/cjs/types/components/CodeSnippet/languagesMock.d.ts +2 -0
- package/dist/cjs/types/components/FeatureCardHeaderActions/FeatureCardHeaderActions.d.ts +1 -0
- package/dist/cjs/types/index.d.ts +1 -1
- package/dist/cjs/types/test-setup.d.ts +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/types/components/CodeSnippet/CodeSnippet.d.ts +42 -12
- package/dist/esm/types/components/CodeSnippet/languagesMock.d.ts +2 -0
- package/dist/esm/types/components/FeatureCardHeaderActions/FeatureCardHeaderActions.d.ts +1 -0
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/esm/types/test-setup.d.ts +1 -0
- package/dist/index.d.ts +44 -13
- package/package.json +6 -17
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
import { BoxProps, SxProps, Theme } from '@mui/material';
|
|
3
|
+
import Prism from 'prismjs';
|
|
3
4
|
import 'prismjs/plugins/line-numbers/prism-line-numbers';
|
|
4
5
|
import 'prismjs/components/prism-json';
|
|
5
6
|
import 'prismjs/components/prism-python';
|
|
@@ -7,26 +8,55 @@ import 'prismjs/components/prism-kotlin';
|
|
|
7
8
|
import 'prismjs/components/prism-java';
|
|
8
9
|
import 'prismjs/components/prism-julia';
|
|
9
10
|
import 'prismjs/components/prism-bash';
|
|
10
|
-
export
|
|
11
|
-
|
|
11
|
+
export interface CodeSnippetProps extends Omit<CodeBlockProps, 'code' | 'language'> {
|
|
12
|
+
snippets: CodeSnippetItemProps[];
|
|
13
|
+
onCopy?: (code: string) => void;
|
|
14
|
+
sx?: SxProps<Theme>;
|
|
15
|
+
/**
|
|
16
|
+
* Set value to show specific snippet when component mounts
|
|
17
|
+
*/
|
|
18
|
+
initialSnippetIndex?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface CodeSnippetItemProps extends CodeBlockProps {
|
|
12
21
|
label: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Documentation: https://up-components.up42.com/?path=/docs/data-display-CodeSnippet--docs
|
|
25
|
+
*/
|
|
26
|
+
export declare const CodeSnippet: ({ snippets, sx, onCopy, initialSnippetIndex, lineNumbers, maxLineLength, }: CodeSnippetProps) => React.JSX.Element;
|
|
27
|
+
export type Languages = keyof typeof Prism.languages;
|
|
28
|
+
export interface CodeBlockProps {
|
|
29
|
+
/**
|
|
30
|
+
* the code to display
|
|
31
|
+
*/
|
|
13
32
|
code: string;
|
|
33
|
+
/**
|
|
34
|
+
* the language of the code
|
|
35
|
+
*/
|
|
14
36
|
language: Languages;
|
|
15
37
|
/**
|
|
16
38
|
* limit the code height. defaults to 512px, **roughly** 22 lines
|
|
17
39
|
*/
|
|
18
40
|
maxCodeHeight?: string;
|
|
19
|
-
}
|
|
20
|
-
export interface CodeSnippetProps {
|
|
21
|
-
snippets: CodeSnippetItemProps[];
|
|
22
|
-
onCopy?: (code: string) => void;
|
|
23
|
-
sx?: SxProps<Theme>;
|
|
24
41
|
/**
|
|
25
|
-
*
|
|
42
|
+
* show line numbers. defaults to true
|
|
26
43
|
*/
|
|
27
|
-
|
|
44
|
+
lineNumbers?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* maximum characters per line before wrapping. defaults to no limit
|
|
47
|
+
*/
|
|
48
|
+
maxLineLength?: number;
|
|
49
|
+
/**
|
|
50
|
+
* additional styles
|
|
51
|
+
*/
|
|
52
|
+
sx?: BoxProps['sx'];
|
|
53
|
+
/**
|
|
54
|
+
* test id
|
|
55
|
+
*/
|
|
56
|
+
testId?: string;
|
|
28
57
|
}
|
|
29
58
|
/**
|
|
30
|
-
*
|
|
59
|
+
* Not moved to a separate file to prevent the build from failing with "(!) Unused external imports" error.
|
|
60
|
+
* PrismJS generates unused imports, which causes the build to fail when importing this from a separate file.
|
|
31
61
|
*/
|
|
32
|
-
export declare
|
|
62
|
+
export declare function CodeBlock({ code, language, maxCodeHeight, lineNumbers, maxLineLength, sx, testId, }: CodeBlockProps): React.JSX.Element;
|
|
@@ -55,7 +55,7 @@ export { EditTagsButton, type EditTagsButtonProps } from './components/EditTagsB
|
|
|
55
55
|
export { FeatureFlagCheckbox, type FeatureFlagCheckboxProps, } from './components/FeatureFlagCheckbox/FeatureFlagCheckbox';
|
|
56
56
|
export { DocumentationPopover, type DocumentationPopoverProps, } from './components/DocumentationPopover/DocumentationPopover';
|
|
57
57
|
export { CodeInline, type CodeInlineProps } from './components/CodeInline/CodeInline';
|
|
58
|
-
export { CodeSnippet, type CodeSnippetProps, type CodeSnippetItemProps } from './components/CodeSnippet/CodeSnippet';
|
|
58
|
+
export { CodeSnippet, type CodeSnippetProps, type CodeSnippetItemProps, CodeBlock, type CodeBlockProps, } from './components/CodeSnippet/CodeSnippet';
|
|
59
59
|
export { Table, TableBody, TableCell, TableHead, TableContainer, TableRow, TableFooter, TablePagination, TableSortLabel, type TableProps, type TableBodyProps, type TableCellProps, type TableHeadProps, type TableContainerProps, type TableRowProps, type TableFooterProps, type TablePaginationProps, type TableSortLabelProps, } from './components/Table/Table';
|
|
60
60
|
export { DataGrid, GridRow, GridCell, GridEditInputCell, GridCellModes, GridFooter, GridLoadingOverlay, GridNoRowsOverlay, GridPagination, GridRowCount, GridSelectedRowCount, gridColumnDefinitionsSelector, gridColumnVisibilityModelSelector, gridDetailPanelExpandedRowIdsSelector, gridDetailPanelExpandedRowsContentCacheSelector, gridRowsLookupSelector, GRID_DETAIL_PANEL_TOGGLE_COL_DEF, GRID_DETAIL_PANEL_TOGGLE_FIELD, useGridApiContext, useGridApiRef, useGridSelector, } from './components/DataGrid/DataGrid';
|
|
61
61
|
export type { GridColDef, GridRenderEditCellParams, GridCellModesModel, GridCellParams, GridRenderCellParams, GridRowId, GridRowParams, GridRowSelectionModel, GridRowsProp, GridSortModel, GridTreeNodeWithRender, GridColumnHeaderParams, GridEditCellProps, GridInitialState, GridPreProcessEditCellProps, } from './components/DataGrid/DataGrid';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { DatePickerProps, DateTimePickerProps } from '@mui/x-date-pickers-pro';
|
|
|
11
11
|
import dayjs, { Dayjs } from 'dayjs';
|
|
12
12
|
import { DateRangePickerProps } from '@mui/x-date-pickers-pro/DateRangePicker';
|
|
13
13
|
import * as _mui_material_OverridableComponent from '@mui/material/OverridableComponent';
|
|
14
|
+
import Prism from 'prismjs';
|
|
14
15
|
import { TableProps as TableProps$1 } from '@mui/material/Table';
|
|
15
16
|
import { TableBodyProps as TableBodyProps$1 } from '@mui/material/TableBody';
|
|
16
17
|
import { TableCellProps as TableCellProps$1 } from '@mui/material/TableCell';
|
|
@@ -5422,6 +5423,7 @@ type MenuAction = {
|
|
|
5422
5423
|
label: string;
|
|
5423
5424
|
onClick: (event: React__default.MouseEvent<HTMLLIElement>) => void;
|
|
5424
5425
|
sx?: SxProps;
|
|
5426
|
+
isExternal?: boolean;
|
|
5425
5427
|
};
|
|
5426
5428
|
type FeatureCardHeaderActionsProps = {
|
|
5427
5429
|
iconActions?: IconAction[];
|
|
@@ -5556,29 +5558,58 @@ interface CodeInlineProps {
|
|
|
5556
5558
|
*/
|
|
5557
5559
|
declare const CodeInline: ({ label, text, "data-testid": dataTestId, inlineLabel }: CodeInlineProps) => React__default.JSX.Element;
|
|
5558
5560
|
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
+
interface CodeSnippetProps extends Omit<CodeBlockProps, 'code' | 'language'> {
|
|
5562
|
+
snippets: CodeSnippetItemProps[];
|
|
5563
|
+
onCopy?: (code: string) => void;
|
|
5564
|
+
sx?: SxProps<Theme>;
|
|
5565
|
+
/**
|
|
5566
|
+
* Set value to show specific snippet when component mounts
|
|
5567
|
+
*/
|
|
5568
|
+
initialSnippetIndex?: number;
|
|
5569
|
+
}
|
|
5570
|
+
interface CodeSnippetItemProps extends CodeBlockProps {
|
|
5561
5571
|
label: string;
|
|
5572
|
+
}
|
|
5573
|
+
/**
|
|
5574
|
+
* Documentation: https://up-components.up42.com/?path=/docs/data-display-CodeSnippet--docs
|
|
5575
|
+
*/
|
|
5576
|
+
declare const CodeSnippet: ({ snippets, sx, onCopy, initialSnippetIndex, lineNumbers, maxLineLength, }: CodeSnippetProps) => React__default.JSX.Element;
|
|
5577
|
+
type Languages = keyof typeof Prism.languages;
|
|
5578
|
+
interface CodeBlockProps {
|
|
5579
|
+
/**
|
|
5580
|
+
* the code to display
|
|
5581
|
+
*/
|
|
5562
5582
|
code: string;
|
|
5583
|
+
/**
|
|
5584
|
+
* the language of the code
|
|
5585
|
+
*/
|
|
5563
5586
|
language: Languages;
|
|
5564
5587
|
/**
|
|
5565
5588
|
* limit the code height. defaults to 512px, **roughly** 22 lines
|
|
5566
5589
|
*/
|
|
5567
5590
|
maxCodeHeight?: string;
|
|
5568
|
-
}
|
|
5569
|
-
interface CodeSnippetProps {
|
|
5570
|
-
snippets: CodeSnippetItemProps[];
|
|
5571
|
-
onCopy?: (code: string) => void;
|
|
5572
|
-
sx?: SxProps<Theme>;
|
|
5573
5591
|
/**
|
|
5574
|
-
*
|
|
5592
|
+
* show line numbers. defaults to true
|
|
5575
5593
|
*/
|
|
5576
|
-
|
|
5594
|
+
lineNumbers?: boolean;
|
|
5595
|
+
/**
|
|
5596
|
+
* maximum characters per line before wrapping. defaults to no limit
|
|
5597
|
+
*/
|
|
5598
|
+
maxLineLength?: number;
|
|
5599
|
+
/**
|
|
5600
|
+
* additional styles
|
|
5601
|
+
*/
|
|
5602
|
+
sx?: BoxProps['sx'];
|
|
5603
|
+
/**
|
|
5604
|
+
* test id
|
|
5605
|
+
*/
|
|
5606
|
+
testId?: string;
|
|
5577
5607
|
}
|
|
5578
5608
|
/**
|
|
5579
|
-
*
|
|
5609
|
+
* Not moved to a separate file to prevent the build from failing with "(!) Unused external imports" error.
|
|
5610
|
+
* PrismJS generates unused imports, which causes the build to fail when importing this from a separate file.
|
|
5580
5611
|
*/
|
|
5581
|
-
declare
|
|
5612
|
+
declare function CodeBlock({ code, language, maxCodeHeight, lineNumbers, maxLineLength, sx, testId, }: CodeBlockProps): React__default.JSX.Element;
|
|
5582
5613
|
|
|
5583
5614
|
type TableProps = MUIGlobalOmit<TableProps$1>;
|
|
5584
5615
|
/**
|
|
@@ -5811,5 +5842,5 @@ type ContextState = {
|
|
|
5811
5842
|
*/
|
|
5812
5843
|
declare const useAlert: () => ContextState;
|
|
5813
5844
|
|
|
5814
|
-
export { Alert, Avatar, Badge, Banner, Button, Checkbox, CodeInline, CodeSnippet, ContactBox, ControlButton, CopyButton, DataGrid, DateTime, Divider, DocumentationPopover, EditTagsButton, EmptyState, FeatureCard, FeatureCardHeader, FeatureCardHeaderActions, FeatureFlagCheckbox, FormCheckbox, FormDatePicker, FormDateRangePicker, FormDateRangePickerList, FormDateTimePicker, FormInput, FormRadio, FormSelect, FormSwitch, GridContainer, GridItem, Icon, Illustration, InfoCard, InfoModal, InfoPopover, Input, Link, Loading, Logo, NotFound, PageContainer, PageHeader, Popover, Radio, Select, Slider, StatusLight, Switch, Tab, TabGroup, Table, TableBody, TableCell, TableContainer, TableFooter, TableHead, TablePagination, TableRow, TableSortLabel, Tabs, Tag, TagsList, ToggleButton, Typography, UpComponentsProvider, capitalize, copyToClipboard, formatDate, formatFileSize, formatNumber, theme, useAlert, useCursorPagination, useDebounce, useQueryParams, useRemotePagination, useToggle };
|
|
5815
|
-
export type { AlertProps, AvatarProps, BadgeProps, BannerProps, ButtonProps, CheckboxProps, CodeInlineProps, CodeSnippetItemProps, CodeSnippetProps, ContactBoxProps, ControlButtonProps, CopyButtonProps, CreateAlertProps, CreateSnackbarProps, CursorPaginatedResponse, DatePickerDateType, DateRange, DateTimeProps, DividerProps, DocumentationPopoverProps, EditTagsButtonProps, EmptyStateProps, FeatureCardHeaderActionsProps, FeatureCardHeaderProps, FeatureCardProps, FeatureFlagCheckboxProps, FormCheckboxProps, FormDatePickerProps, FormDateRangePickerListProps, FormDateRangePickerProps, FormDateTimePickerProps, FormInputProps, FormRadioProps, FormSelectProps, FormSwitchProps, GridContainerProps, GridItemProps, IconAction, IconProps$1 as IconProps, IllustrationProps, InfoCardProps, InfoModalProps, InfoPopoverProps, InputProps, LinkProps, LoadingProps, LogoProps, MenuAction, NotFoundProps, PageContainerProps, PageHeaderProps, PaginatedResponse, PopoverProps, RadioProps, SelectProps, SliderProps, StatusLightProps, SwitchProps, TabGroupProps, TabProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TableSortLabelProps, TabsProps, TagItem, TagProps, TagsListProps, ToggleButtonProps, TypographyProps, UseToggleResult };
|
|
5845
|
+
export { Alert, Avatar, Badge, Banner, Button, Checkbox, CodeBlock, CodeInline, CodeSnippet, ContactBox, ControlButton, CopyButton, DataGrid, DateTime, Divider, DocumentationPopover, EditTagsButton, EmptyState, FeatureCard, FeatureCardHeader, FeatureCardHeaderActions, FeatureFlagCheckbox, FormCheckbox, FormDatePicker, FormDateRangePicker, FormDateRangePickerList, FormDateTimePicker, FormInput, FormRadio, FormSelect, FormSwitch, GridContainer, GridItem, Icon, Illustration, InfoCard, InfoModal, InfoPopover, Input, Link, Loading, Logo, NotFound, PageContainer, PageHeader, Popover, Radio, Select, Slider, StatusLight, Switch, Tab, TabGroup, Table, TableBody, TableCell, TableContainer, TableFooter, TableHead, TablePagination, TableRow, TableSortLabel, Tabs, Tag, TagsList, ToggleButton, Typography, UpComponentsProvider, capitalize, copyToClipboard, formatDate, formatFileSize, formatNumber, theme, useAlert, useCursorPagination, useDebounce, useQueryParams, useRemotePagination, useToggle };
|
|
5846
|
+
export type { AlertProps, AvatarProps, BadgeProps, BannerProps, ButtonProps, CheckboxProps, CodeBlockProps, CodeInlineProps, CodeSnippetItemProps, CodeSnippetProps, ContactBoxProps, ControlButtonProps, CopyButtonProps, CreateAlertProps, CreateSnackbarProps, CursorPaginatedResponse, DatePickerDateType, DateRange, DateTimeProps, DividerProps, DocumentationPopoverProps, EditTagsButtonProps, EmptyStateProps, FeatureCardHeaderActionsProps, FeatureCardHeaderProps, FeatureCardProps, FeatureFlagCheckboxProps, FormCheckboxProps, FormDatePickerProps, FormDateRangePickerListProps, FormDateRangePickerProps, FormDateTimePickerProps, FormInputProps, FormRadioProps, FormSelectProps, FormSwitchProps, GridContainerProps, GridItemProps, IconAction, IconProps$1 as IconProps, IllustrationProps, InfoCardProps, InfoModalProps, InfoPopoverProps, InputProps, LinkProps, LoadingProps, LogoProps, MenuAction, NotFoundProps, PageContainerProps, PageHeaderProps, PaginatedResponse, PopoverProps, RadioProps, SelectProps, SliderProps, StatusLightProps, SwitchProps, TabGroupProps, TabProps, TableBodyProps, TableCellProps, TableContainerProps, TableFooterProps, TableHeadProps, TablePaginationProps, TableProps, TableRowProps, TableSortLabelProps, TabsProps, TagItem, TagProps, TagsListProps, ToggleButtonProps, TypographyProps, UseToggleResult };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@up42/up-components",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "UP42 Component Library",
|
|
5
5
|
"author": "Axel Fuhrmann axel.fuhrmann@up42.com",
|
|
6
6
|
"license": "ISC",
|
|
@@ -14,10 +14,9 @@
|
|
|
14
14
|
"dev": "pnpm run storybook",
|
|
15
15
|
"build": "rollup -c --failAfterWarnings",
|
|
16
16
|
"build:watch": "rollup -c -w",
|
|
17
|
-
"test": "
|
|
18
|
-
"test:watch": "
|
|
19
|
-
"test:
|
|
20
|
-
"test:smoke": "jest -- smoke",
|
|
17
|
+
"test": "vitest run --exclude='**/smoke.test.*'",
|
|
18
|
+
"test:watch": "vitest",
|
|
19
|
+
"test:smoke": "vitest run smoke.test.jsx",
|
|
21
20
|
"storybook": "storybook dev -p 6006",
|
|
22
21
|
"storybook:build": "storybook build",
|
|
23
22
|
"lint": "eslint src/.",
|
|
@@ -36,15 +35,8 @@
|
|
|
36
35
|
"prismjs": "^1.29.0"
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
39
|
-
"@babel/core": "^7.16.10",
|
|
40
|
-
"@babel/plugin-transform-runtime": "^7.19.1",
|
|
41
|
-
"@babel/preset-env": "^7.16.10",
|
|
42
|
-
"@babel/preset-react": "^7.16.7",
|
|
43
|
-
"@babel/preset-typescript": "^7.16.7",
|
|
44
|
-
"@babel/runtime": "^7.27.1",
|
|
45
38
|
"@commitlint/cli": "^17.7.0",
|
|
46
39
|
"@commitlint/config-conventional": "^17.7.0",
|
|
47
|
-
"@emotion/jest": "^11.7.1",
|
|
48
40
|
"@emotion/react": "^11.7.1",
|
|
49
41
|
"@emotion/styled": "^11.6.0",
|
|
50
42
|
"@mui/icons-material": "^5.3.0",
|
|
@@ -57,11 +49,9 @@
|
|
|
57
49
|
"@rollup/plugin-terser": "^0.4.4",
|
|
58
50
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
59
51
|
"@storybook/addon-a11y": "^8.6.10",
|
|
60
|
-
"@storybook/addon-actions": "^8.6.10",
|
|
61
52
|
"@storybook/addon-docs": "^8.6.14",
|
|
62
53
|
"@storybook/addon-essentials": "^8.6.10",
|
|
63
54
|
"@storybook/addon-links": "^8.6.10",
|
|
64
|
-
"@storybook/addon-mdx-gfm": "^8.6.10",
|
|
65
55
|
"@storybook/manager-api": "^8.6.10",
|
|
66
56
|
"@storybook/react": "^8.6.10",
|
|
67
57
|
"@storybook/react-vite": "^8.6.10",
|
|
@@ -69,7 +59,6 @@
|
|
|
69
59
|
"@svgr/rollup": "^6.2.1",
|
|
70
60
|
"@testing-library/react": "^12.1.2",
|
|
71
61
|
"@testing-library/react-hooks": "^8.0.1",
|
|
72
|
-
"@types/jest": "^27.4.0",
|
|
73
62
|
"@types/prismjs": "^1.26.0",
|
|
74
63
|
"@types/react": "^17.0.38",
|
|
75
64
|
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
|
@@ -85,7 +74,6 @@
|
|
|
85
74
|
"eslint-plugin-react-hooks": "^4.3.0",
|
|
86
75
|
"eslint-plugin-storybook": "^0.12.0",
|
|
87
76
|
"husky": "^7.0.4",
|
|
88
|
-
"jest": "^27.4.7",
|
|
89
77
|
"lint-staged": "^12.3.1",
|
|
90
78
|
"prettier": "^2.5.1",
|
|
91
79
|
"react": "^17.0.2",
|
|
@@ -99,7 +87,8 @@
|
|
|
99
87
|
"tslib": "^2.8.1",
|
|
100
88
|
"typescript": "^4.5.4",
|
|
101
89
|
"vite": "^7.1.4",
|
|
102
|
-
"vite-plugin-svgr": "^4.2.0"
|
|
90
|
+
"vite-plugin-svgr": "^4.2.0",
|
|
91
|
+
"vitest": "^3.2.4"
|
|
103
92
|
},
|
|
104
93
|
"peerDependencies": {
|
|
105
94
|
"@emotion/react": "^11.7.1",
|