@up42/up-components 0.10.8 → 0.10.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { DateType, FormatDateOptions } from '../../utils/helpers/formatDate';
3
+ export declare type DateTimeProps = {
4
+ date: DateType;
5
+ } & FormatDateOptions;
6
+ /**
7
+ * Documentation: https://up-components.up42.dev/?path=/docs/data-display-datetime
8
+ */
9
+ export declare const DateTime: React.ForwardRefExoticComponent<{
10
+ date: DateType;
11
+ } & FormatDateOptions & React.RefAttributes<HTMLTimeElement>>;
@@ -21,4 +21,4 @@ export declare type EmptyStateProps<C extends React.ElementType = 'div'> = BaseP
21
21
  /**
22
22
  * Documentation: https://up-components.up42.dev/?path=/docs/patterns-emptystate
23
23
  */
24
- export declare const EmptyState: <C extends React.ElementType<any>>({ icon: Icon, title, subTitle, action, ...props }: EmptyStateProps<C>) => JSX.Element;
24
+ export declare const EmptyState: <C extends React.ElementType<any>>({ icon: Icon, title, subTitle, action, sx, ...props }: EmptyStateProps<C>) => JSX.Element;
@@ -40,6 +40,7 @@ export { Loading, type LoadingProps } from './components/Loading/Loading';
40
40
  export { Icon, type IconProps } from './components/Icon/Icon';
41
41
  export { Badge, type BadgeProps } from './components/Badge/Badge';
42
42
  export { Tag, type TagProps } from './components/Tag/Tag';
43
+ export { DateTime, type DateTimeProps } from './components/DateTime/DateTime';
43
44
  export { DocumentationPopover, type DocumentationPopoverProps, } from './components/DocumentationPopover/DocumentationPopover';
44
45
  export { CodeBox, type CodeBoxProps } from './components/CodeBox/CodeBox';
45
46
  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';
@@ -47,6 +48,7 @@ export { DataGrid, type DataGridProps, type GridColDef, type GridRenderCellParam
47
48
  export { capitalize } from './utils/helpers/capitalize';
48
49
  export { copyToClipboard } from './utils/helpers/copyToClipboard';
49
50
  export { formatNumber } from './utils/helpers/formatNumber';
51
+ export { formatDate } from './utils/helpers/formatDate';
50
52
  export { useQueryParams } from './utils/hooks/useQueryParams';
51
53
  export { useRemotePagination, type PaginatedResponse } from './utils/hooks/useRemotePagination';
52
54
  export { useAlert, type CreateAlertProps } from './global/providers/AlertProvider/AlertProvider';
@@ -0,0 +1,16 @@
1
+ import dayjs from 'dayjs';
2
+ export declare type FormatDateOptions = {
3
+ /**
4
+ * For more formats see here: https://day.js.org/docs/en/display/format#docsNav
5
+ */
6
+ format?: string;
7
+ fromNow?: boolean;
8
+ utc?: boolean;
9
+ };
10
+ export declare type DateType = dayjs.ConfigType;
11
+ /**
12
+ * Returns formatted date string. The format will depend on the option passed in the second argument.
13
+ *
14
+ * Documentation: https://up-components.up42.dev/?path=/story/utils--page#formatnumber
15
+ */
16
+ export declare const formatDate: (date: DateType, options?: FormatDateOptions | undefined) => string;
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -36,6 +36,7 @@ import QuestionMark from '@mui/icons-material/QuestionMark';
36
36
  import ShoppingCartOutlined from '@mui/icons-material/ShoppingCartOutlined';
37
37
  import VisibilityOffOutlined from '@mui/icons-material/VisibilityOffOutlined';
38
38
  import VisibilityOutlined from '@mui/icons-material/VisibilityOutlined';
39
+ import dayjs from 'dayjs';
39
40
  import { TableProps as TableProps$1 } from '@mui/material/Table';
40
41
  import { TableBodyProps as TableBodyProps$1 } from '@mui/material/TableBody';
41
42
  import { TableCellProps as TableCellProps$1 } from '@mui/material/TableCell';
@@ -373,7 +374,7 @@ declare type EmptyStateProps<C extends React__default.ElementType = 'div'> = Bas
373
374
  /**
374
375
  * Documentation: https://up-components.up42.dev/?path=/docs/patterns-emptystate
375
376
  */
376
- declare const EmptyState: <C extends React__default.ElementType<any>>({ icon: Icon, title, subTitle, action, ...props }: EmptyStateProps<C>) => JSX.Element;
377
+ declare const EmptyState: <C extends React__default.ElementType<any>>({ icon: Icon, title, subTitle, action, sx, ...props }: EmptyStateProps<C>) => JSX.Element;
377
378
 
378
379
  declare type ModalProps = MUIGlobalOmit<ModalProps$1>;
379
380
  /**
@@ -1800,6 +1801,32 @@ declare type TagProps = MUIGlobalOmit<Omit<ChipProps$1, 'size'>>;
1800
1801
  */
1801
1802
  declare const Tag: ({ color, ...props }: TagProps) => JSX.Element;
1802
1803
 
1804
+ declare type FormatDateOptions = {
1805
+ /**
1806
+ * For more formats see here: https://day.js.org/docs/en/display/format#docsNav
1807
+ */
1808
+ format?: string;
1809
+ fromNow?: boolean;
1810
+ utc?: boolean;
1811
+ };
1812
+ declare type DateType = dayjs.ConfigType;
1813
+ /**
1814
+ * Returns formatted date string. The format will depend on the option passed in the second argument.
1815
+ *
1816
+ * Documentation: https://up-components.up42.dev/?path=/story/utils--page#formatnumber
1817
+ */
1818
+ declare const formatDate: (date: DateType, options?: FormatDateOptions | undefined) => string;
1819
+
1820
+ declare type DateTimeProps = {
1821
+ date: DateType;
1822
+ } & FormatDateOptions;
1823
+ /**
1824
+ * Documentation: https://up-components.up42.dev/?path=/docs/data-display-datetime
1825
+ */
1826
+ declare const DateTime: React__default.ForwardRefExoticComponent<{
1827
+ date: DateType;
1828
+ } & FormatDateOptions & React__default.RefAttributes<HTMLTimeElement>>;
1829
+
1803
1830
  declare type DocumentationPopoverProps = {
1804
1831
  heading: string;
1805
1832
  /**
@@ -1945,4 +1972,4 @@ declare type ContextState = {
1945
1972
  */
1946
1973
  declare const useAlert: () => ContextState;
1947
1974
 
1948
- export { Alert, AlertProps, Avatar, AvatarProps, Badge, BadgeProps, Banner, BannerProps, Box, BoxProps, Button, ButtonProps, Checkbox, CheckboxProps, Chip, ChipProps, CodeBox, CodeBoxProps, Container, ContainerProps, ControlButton, ControlButtonProps, CopyButton, CopyButtonProps, CreateAlertProps, DataGrid, DataGridProps, DocumentationPopover, DocumentationPopoverProps, EmptyState, EmptyStateProps, FormCheckbox, FormCheckboxProps, 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, 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, formatNumber, theme, useAlert, useQueryParams, useRemotePagination };
1975
+ export { Alert, AlertProps, Avatar, AvatarProps, Badge, BadgeProps, Banner, BannerProps, Box, BoxProps, Button, ButtonProps, Checkbox, CheckboxProps, Chip, ChipProps, CodeBox, CodeBoxProps, Container, ContainerProps, ControlButton, ControlButtonProps, CopyButton, CopyButtonProps, CreateAlertProps, DataGrid, DataGridProps, DateTime, DateTimeProps, DocumentationPopover, DocumentationPopoverProps, EmptyState, EmptyStateProps, FormCheckbox, FormCheckboxProps, 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, 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, formatNumber, theme, useAlert, useQueryParams, useRemotePagination };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@up42/up-components",
3
- "version": "0.10.8",
3
+ "version": "0.10.10",
4
4
  "description": "UP42 Component Library",
5
5
  "author": "Axel Fuhrmann axel.fuhrmann@up42.com",
6
6
  "license": "ISC",
@@ -21,10 +21,12 @@
21
21
  "storybook:build": "build-storybook",
22
22
  "lint": "eslint src/. --fix",
23
23
  "release": "standard-version",
24
- "prepare": "husky install"
24
+ "prepare": "husky install",
25
+ "format": "prettier --write ./**/*.mdx"
25
26
  },
26
27
  "dependencies": {
27
28
  "@up42/design-system-tokens": "^3.0.1",
29
+ "dayjs": "^1.11.7",
28
30
  "react-markdown": "^8.0.3"
29
31
  },
30
32
  "devDependencies": {
@@ -93,7 +95,8 @@
93
95
  "react-dom": "^17.0.2"
94
96
  },
95
97
  "lint-staged": {
96
- "*.{js,tsx,ts}": "eslint --cache --fix"
98
+ "*.{js,tsx,ts}": "eslint --cache --fix",
99
+ "*.mdx": "prettier --write"
97
100
  },
98
101
  "homepage": "https://github.com/up42/up-components#readme",
99
102
  "access": "private",