@up42/up-components 0.15.2 → 0.16.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.
@@ -8,16 +8,25 @@ import 'prismjs/components/prism-java';
8
8
  import 'prismjs/components/prism-julia';
9
9
  import 'prismjs/components/prism-bash';
10
10
  export declare type Languages = 'DFS' | 'atom' | 'bash' | 'clike' | 'css' | 'extend' | 'html' | 'insertBefore' | 'java' | 'javascript' | 'js' | 'json' | 'julia' | 'kotlin' | 'kt' | 'kts' | 'markup' | 'mathml' | 'plain' | 'plaintext' | 'py' | 'python' | 'rss' | 'sh' | 'shell' | 'ssml' | 'svg' | 'text' | 'txt' | 'webmanifest' | 'xml';
11
- export interface CodeSnippetProps {
11
+ export interface CodeSnippetItemProps {
12
+ label: string;
12
13
  code: string;
13
14
  language: Languages;
14
15
  /**
15
16
  * limit the code height. defaults to 512px, **roughly** 22 lines
16
17
  */
17
18
  maxCodeHeight?: string;
19
+ }
20
+ export interface CodeSnippetProps {
21
+ snippets: CodeSnippetItemProps[];
22
+ onCopy?: (code: string) => void;
18
23
  sx?: SxProps<Theme>;
24
+ /**
25
+ * Set value to show specific snippet when component mounts
26
+ */
27
+ initialSnippetIndex?: number;
19
28
  }
20
29
  /**
21
30
  * Documentation: https://up-components.up42.dev/?path=/docs/data-display-CodeSnippet
22
31
  */
23
- export declare const CodeSnippet: ({ code, language, sx, maxCodeHeight }: CodeSnippetProps) => JSX.Element;
32
+ export declare const CodeSnippet: ({ snippets, sx, onCopy, initialSnippetIndex }: CodeSnippetProps) => JSX.Element;
@@ -4,8 +4,9 @@ export interface CopyButtonProps {
4
4
  data: string;
5
5
  tooltip?: string;
6
6
  sx?: SxProps<Theme>;
7
+ onCopy?: (data: string) => void;
7
8
  }
8
9
  /**
9
10
  * Documentation: https://up-components.up42.dev/?path=/docs/patterns-copybutton
10
11
  */
11
- export declare const CopyButton: ({ data, tooltip, sx }: CopyButtonProps) => JSX.Element;
12
+ export declare const CopyButton: ({ data, tooltip, sx, onCopy }: CopyButtonProps) => JSX.Element;
@@ -1,12 +1,12 @@
1
1
  import { ReactNode } from 'react';
2
- import { TabsProps } from '../Tabs/Tabs';
2
+ import { Tab as TabData, TabsProps } from '../Tabs/Tabs';
3
3
  import { BoxProps } from '../Box/Box';
4
- declare type tab = {
4
+ declare type TabData = {
5
5
  label: string | ReactNode;
6
6
  content: string | ReactNode;
7
7
  };
8
8
  export declare type TabGroupProps = {
9
- tabs: tab[];
9
+ tabs: TabData[];
10
10
  tabContentProps?: BoxProps;
11
11
  tabsProps?: TabsProps;
12
12
  /**
@@ -47,7 +47,7 @@ export { Tag, type TagProps } from './components/Tag/Tag';
47
47
  export { DateTime, type DateTimeProps } from './components/DateTime/DateTime';
48
48
  export { DocumentationPopover, type DocumentationPopoverProps, } from './components/DocumentationPopover/DocumentationPopover';
49
49
  export { CodeInline, type CodeInlineProps } from './components/CodeInline/CodeInline';
50
- export { CodeSnippet, type CodeSnippetProps } from './components/CodeSnippet/CodeSnippet';
50
+ export { CodeSnippet, type CodeSnippetProps, type CodeSnippetItemProps } from './components/CodeSnippet/CodeSnippet';
51
51
  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';
52
52
  export { DataGrid, type DataGridProps, type GridColDef, type GridRenderCellParams, type GridRowId, type GridSelectionModel, type GridSortModel, } from './components/DataGrid/DataGrid';
53
53
  export { capitalize } from './utils/helpers/capitalize';
package/dist/index.d.ts CHANGED
@@ -369,12 +369,12 @@ declare type TabProps = MUIGlobalOmit<TabProps$1>;
369
369
  declare const Tabs: ({ children, ...props }: TabsProps) => JSX.Element;
370
370
  declare const Tab: ({ children, ...props }: TabProps) => JSX.Element;
371
371
 
372
- declare type tab = {
372
+ declare type TabData = {
373
373
  label: string | ReactNode;
374
374
  content: string | ReactNode;
375
375
  };
376
376
  declare type TabGroupProps = {
377
- tabs: tab[];
377
+ tabs: TabData[];
378
378
  tabContentProps?: BoxProps;
379
379
  tabsProps?: TabsProps;
380
380
  /**
@@ -588,11 +588,12 @@ interface CopyButtonProps {
588
588
  data: string;
589
589
  tooltip?: string;
590
590
  sx?: SxProps<Theme>;
591
+ onCopy?: (data: string) => void;
591
592
  }
592
593
  /**
593
594
  * Documentation: https://up-components.up42.dev/?path=/docs/patterns-copybutton
594
595
  */
595
- declare const CopyButton: ({ data, tooltip, sx }: CopyButtonProps) => JSX.Element;
596
+ declare const CopyButton: ({ data, tooltip, sx, onCopy }: CopyButtonProps) => JSX.Element;
596
597
 
597
598
  declare type PopoverProps = MUIGlobalOmit<PopoverProps$1>;
598
599
  /**
@@ -2057,19 +2058,28 @@ interface CodeInlineProps {
2057
2058
  declare const CodeInline: ({ label, text, "data-testid": dataTestId }: CodeInlineProps) => JSX.Element;
2058
2059
 
2059
2060
  declare type Languages = 'DFS' | 'atom' | 'bash' | 'clike' | 'css' | 'extend' | 'html' | 'insertBefore' | 'java' | 'javascript' | 'js' | 'json' | 'julia' | 'kotlin' | 'kt' | 'kts' | 'markup' | 'mathml' | 'plain' | 'plaintext' | 'py' | 'python' | 'rss' | 'sh' | 'shell' | 'ssml' | 'svg' | 'text' | 'txt' | 'webmanifest' | 'xml';
2060
- interface CodeSnippetProps {
2061
+ interface CodeSnippetItemProps {
2062
+ label: string;
2061
2063
  code: string;
2062
2064
  language: Languages;
2063
2065
  /**
2064
2066
  * limit the code height. defaults to 512px, **roughly** 22 lines
2065
2067
  */
2066
2068
  maxCodeHeight?: string;
2069
+ }
2070
+ interface CodeSnippetProps {
2071
+ snippets: CodeSnippetItemProps[];
2072
+ onCopy?: (code: string) => void;
2067
2073
  sx?: SxProps<Theme>;
2074
+ /**
2075
+ * Set value to show specific snippet when component mounts
2076
+ */
2077
+ initialSnippetIndex?: number;
2068
2078
  }
2069
2079
  /**
2070
2080
  * Documentation: https://up-components.up42.dev/?path=/docs/data-display-CodeSnippet
2071
2081
  */
2072
- declare const CodeSnippet: ({ code, language, sx, maxCodeHeight }: CodeSnippetProps) => JSX.Element;
2082
+ declare const CodeSnippet: ({ snippets, sx, onCopy, initialSnippetIndex }: CodeSnippetProps) => JSX.Element;
2073
2083
 
2074
2084
  declare type TableProps = MUIGlobalOmit<TableProps$1>;
2075
2085
  /**
@@ -2189,4 +2199,4 @@ declare type ContextState = {
2189
2199
  */
2190
2200
  declare const useAlert: () => ContextState;
2191
2201
 
2192
- export { Alert, AlertProps, Avatar, AvatarProps, Badge, BadgeProps, Banner, BannerProps, Box, BoxProps, Button, ButtonProps, Checkbox, CheckboxProps, Chip, ChipProps, CodeInline, CodeInlineProps, CodeSnippet, CodeSnippetProps, ContactBox, ContactBoxProps, Container, ContainerProps, ControlButton, ControlButtonProps, CopyButton, CopyButtonProps, CreateAlertProps, DataGrid, DataGridProps, DatePickerDateType, DateTime, DateTimeProps, DocumentationPopover, DocumentationPopoverProps, EmptyState, EmptyStateProps, FormCheckbox, FormCheckboxProps, FormDatePicker, FormDatePickerProps, FormDateRangePicker, FormDateRangePickerProps, FormInput, FormInputProps, FormRadio, FormRadioProps, FormSelect, FormSelectProps, FormSwitch, FormSwitchProps, Icon, IconProps, InfoCard, InfoCardProps, InfoModal, InfoModalProps, InfoPopover, InfoPopoverProps, Input, InputProps, Link, LinkProps, Loading, LoadingProps, Menu, MenuItem, MenuItemProps, MenuProps, Modal, ModalProps, NotFound, PageHeader, PageHeaderProps, PaginatedResponse, Popover, PopoverProps, Radio, RadioProps, Select, SelectProps, Slider, SliderProps, Switch, SwitchProps, Tab, TabGroup, TabGroupProps, TabProps, Table, TableBody, TableBodyProps, TableCell, TableCellProps, TableContainer, TableContainerProps, TableFooter, TableFooterProps, TableHead, TableHeadProps, TablePagination, TablePaginationProps, TableProps, TableRow, TableRowProps, TableSortLabel, TableSortLabelProps, Tabs, TabsProps, Tag, TagProps, Tooltip, TooltipProps, Typography, TypographyProps, UpComponentsProvider, capitalize, copyToClipboard, formatDate, formatFileSize, formatNumber, theme, useAlert, useQueryParams, useRemotePagination };
2202
+ export { Alert, AlertProps, Avatar, AvatarProps, Badge, BadgeProps, Banner, BannerProps, Box, BoxProps, Button, ButtonProps, Checkbox, CheckboxProps, Chip, ChipProps, CodeInline, CodeInlineProps, CodeSnippet, CodeSnippetItemProps, CodeSnippetProps, ContactBox, ContactBoxProps, Container, ContainerProps, ControlButton, ControlButtonProps, CopyButton, CopyButtonProps, CreateAlertProps, DataGrid, DataGridProps, DatePickerDateType, DateTime, DateTimeProps, DocumentationPopover, DocumentationPopoverProps, EmptyState, EmptyStateProps, FormCheckbox, FormCheckboxProps, FormDatePicker, FormDatePickerProps, FormDateRangePicker, FormDateRangePickerProps, FormInput, FormInputProps, FormRadio, FormRadioProps, FormSelect, FormSelectProps, FormSwitch, FormSwitchProps, Icon, IconProps, InfoCard, InfoCardProps, InfoModal, InfoModalProps, InfoPopover, InfoPopoverProps, Input, InputProps, Link, LinkProps, Loading, LoadingProps, Menu, MenuItem, MenuItemProps, MenuProps, Modal, ModalProps, NotFound, PageHeader, PageHeaderProps, PaginatedResponse, Popover, PopoverProps, Radio, RadioProps, Select, SelectProps, Slider, SliderProps, Switch, SwitchProps, Tab, TabGroup, TabGroupProps, TabProps, Table, TableBody, TableBodyProps, TableCell, TableCellProps, TableContainer, TableContainerProps, TableFooter, TableFooterProps, TableHead, TableHeadProps, TablePagination, TablePaginationProps, TableProps, TableRow, TableRowProps, TableSortLabel, TableSortLabelProps, Tabs, TabsProps, Tag, TagProps, Tooltip, TooltipProps, Typography, TypographyProps, UpComponentsProvider, capitalize, copyToClipboard, formatDate, formatFileSize, formatNumber, theme, useAlert, useQueryParams, useRemotePagination };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@up42/up-components",
3
- "version": "0.15.2",
3
+ "version": "0.16.0",
4
4
  "description": "UP42 Component Library",
5
5
  "author": "Axel Fuhrmann axel.fuhrmann@up42.com",
6
6
  "license": "ISC",