glints-aries 4.0.201 → 4.0.203

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.
Files changed (63) hide show
  1. package/es/@next/DataTable/DataTable.d.ts +25 -0
  2. package/es/@next/DataTable/DataTable.js +97 -0
  3. package/es/@next/DataTable/DataTableStyle.d.ts +9 -0
  4. package/es/@next/DataTable/DataTableStyle.js +41 -0
  5. package/es/@next/DataTable/DatatTable.stories.d.ts +5 -0
  6. package/es/@next/DataTable/TableCell.d.ts +5 -0
  7. package/es/@next/DataTable/TableCell.js +13 -0
  8. package/es/@next/DataTable/TableFooter.d.ts +4 -0
  9. package/es/@next/DataTable/TableFooter.js +5 -0
  10. package/es/@next/DataTable/TableHeader.d.ts +8 -0
  11. package/es/@next/DataTable/TableHeader.js +48 -0
  12. package/es/@next/DataTable/TableRow.d.ts +6 -0
  13. package/es/@next/DataTable/TableRow.js +12 -0
  14. package/es/@next/DataTable/index.d.ts +4 -0
  15. package/es/@next/DataTable/index.js +4 -0
  16. package/es/@next/EmptyState/EmptyStateStyle.d.ts +3 -3
  17. package/es/@next/Link/LinkStyle.js +1 -1
  18. package/es/@next/Pagination/PaginationStyle.js +1 -1
  19. package/es/@next/Spinner/Spinner.d.ts +6 -2
  20. package/es/@next/Spinner/Spinner.js +17 -8
  21. package/es/@next/Spinner/Spinner.stories.d.ts +5 -0
  22. package/es/@next/Spinner/SpinnerStyle.d.ts +3 -0
  23. package/es/@next/Spinner/SpinnerStyle.js +11 -0
  24. package/es/@next/Switch/Switch.d.ts +1 -0
  25. package/es/@next/Switch/Switch.js +18 -4
  26. package/es/@next/Switch/Switch.stories.d.ts +2 -1
  27. package/es/@next/Switch/SwitchStyle.js +2 -2
  28. package/es/@next/Typography/Typography.d.ts +3 -2
  29. package/es/@next/Typography/Typography.js +3 -1
  30. package/es/@next/index.d.ts +1 -0
  31. package/es/@next/index.js +1 -0
  32. package/lib/@next/DataTable/DataTable.d.ts +25 -0
  33. package/lib/@next/DataTable/DataTable.js +103 -0
  34. package/lib/@next/DataTable/DataTableStyle.d.ts +9 -0
  35. package/lib/@next/DataTable/DataTableStyle.js +55 -0
  36. package/lib/@next/DataTable/DatatTable.stories.d.ts +5 -0
  37. package/lib/@next/DataTable/TableCell.d.ts +5 -0
  38. package/lib/@next/DataTable/TableCell.js +19 -0
  39. package/lib/@next/DataTable/TableFooter.d.ts +4 -0
  40. package/lib/@next/DataTable/TableFooter.js +11 -0
  41. package/lib/@next/DataTable/TableHeader.d.ts +8 -0
  42. package/lib/@next/DataTable/TableHeader.js +55 -0
  43. package/lib/@next/DataTable/TableRow.d.ts +6 -0
  44. package/lib/@next/DataTable/TableRow.js +18 -0
  45. package/lib/@next/DataTable/index.d.ts +4 -0
  46. package/lib/@next/DataTable/index.js +27 -0
  47. package/lib/@next/EmptyState/EmptyStateStyle.d.ts +3 -3
  48. package/lib/@next/Link/LinkStyle.js +1 -1
  49. package/lib/@next/Pagination/PaginationStyle.js +1 -1
  50. package/lib/@next/Spinner/Spinner.d.ts +6 -2
  51. package/lib/@next/Spinner/Spinner.js +18 -9
  52. package/lib/@next/Spinner/Spinner.stories.d.ts +5 -0
  53. package/lib/@next/Spinner/SpinnerStyle.d.ts +3 -0
  54. package/lib/@next/Spinner/SpinnerStyle.js +18 -0
  55. package/lib/@next/Switch/Switch.d.ts +1 -0
  56. package/lib/@next/Switch/Switch.js +18 -4
  57. package/lib/@next/Switch/Switch.stories.d.ts +2 -1
  58. package/lib/@next/Switch/SwitchStyle.js +2 -2
  59. package/lib/@next/Typography/Typography.d.ts +3 -2
  60. package/lib/@next/Typography/Typography.js +3 -1
  61. package/lib/@next/index.d.ts +1 -0
  62. package/lib/@next/index.js +7 -1
  63. package/package.json +3 -2
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { EmptyStateProps } from '../EmptyState';
3
+ export declare type SortDirection = 'ASCENDING' | 'DESCENDING';
4
+ export declare type TableHeading = React.ThHTMLAttributes<HTMLTableColElement> & {
5
+ title?: string;
6
+ id?: string;
7
+ defaultSortDirection?: SortDirection;
8
+ };
9
+ export declare type Total = TableHeading | null;
10
+ export interface DataTableProps extends React.TableHTMLAttributes<HTMLTableElement> {
11
+ headings: TableHeading[];
12
+ children: React.ReactNode;
13
+ emptyState: React.ReactElement<EmptyStateProps>;
14
+ totals?: Total[];
15
+ loading?: boolean;
16
+ loadingLabel?: string;
17
+ onSortChanged?: (context: string, sortDirection: SortDirection) => void;
18
+ }
19
+ export declare const DataTable: React.ForwardRefExoticComponent<DataTableProps & React.RefAttributes<HTMLTableElement>> & {
20
+ Row: ({ children, ...props }: import("./TableRow").TableRowProps) => JSX.Element;
21
+ Cell: ({ align, children }: import("./TableCell").TableCellProps) => JSX.Element;
22
+ Footer: ({ children }: {
23
+ children: React.ReactNode;
24
+ }) => JSX.Element;
25
+ };
@@ -0,0 +1,97 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["headings", "totals", "onSortChanged", "children", "emptyState", "loading", "loadingLabel"];
4
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
+ import React from 'react';
8
+ import { Spinner } from '../Spinner';
9
+ import { Typography } from '../Typography';
10
+ import { StyledDataTableContainer, StyledLoaderWrapper, StyledSpinnerContainer, StyledTable, StyledTableCell, StyledTableFooterRow, StyledTableLoadingRow, StyledTableRow } from './DataTableStyle';
11
+ import { TableCell } from './TableCell';
12
+ import { TableFooter } from './TableFooter';
13
+ import { TableHeader } from './TableHeader';
14
+ import { TableRow } from './TableRow';
15
+ var DataTableComponent = /*#__PURE__*/React.forwardRef(function DataTable(_ref, ref) {
16
+ var headings = _ref.headings,
17
+ totals = _ref.totals,
18
+ onSortChanged = _ref.onSortChanged,
19
+ children = _ref.children,
20
+ emptyState = _ref.emptyState,
21
+ loading = _ref.loading,
22
+ _ref$loadingLabel = _ref.loadingLabel,
23
+ loadingLabel = _ref$loadingLabel === void 0 ? 'loading' : _ref$loadingLabel,
24
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
25
+ var handleSortChanged = function handleSortChanged(context, sortDirection) {
26
+ onSortChanged == null ? void 0 : onSortChanged(context, sortDirection);
27
+ };
28
+ var rowHeaderMarkup = headings.map(function (heading, index) {
29
+ var id = heading.id,
30
+ title = heading.title,
31
+ defaultSortDirection = heading.defaultSortDirection,
32
+ align = heading.align;
33
+ var key = "table-header-heading-" + title + "-" + index;
34
+ return /*#__PURE__*/React.createElement(TableHeader, {
35
+ key: key,
36
+ title: title,
37
+ sortDirection: defaultSortDirection,
38
+ align: align,
39
+ onSort: function onSort(sortDirection) {
40
+ return handleSortChanged(id || title, sortDirection);
41
+ }
42
+ });
43
+ });
44
+ var totalsRowMarkup = totals ? totals.map(function (total, index) {
45
+ var _ref2 = total || {
46
+ title: ''
47
+ },
48
+ title = _ref2.title,
49
+ align = _ref2.align;
50
+ var key = total + "-" + index;
51
+ return /*#__PURE__*/React.createElement(TableCell, {
52
+ key: key,
53
+ align: align
54
+ }, /*#__PURE__*/React.createElement(Typography, {
55
+ as: "div",
56
+ variant: "body2"
57
+ }, title));
58
+ }) : null;
59
+ var footer;
60
+ var rows = [];
61
+ for (var _iterator = _createForOfIteratorHelperLoose(React.Children.toArray(children)), _step; !(_step = _iterator()).done;) {
62
+ var child = _step.value;
63
+ var reactEl = child;
64
+ if (reactEl.type === TableFooter) {
65
+ footer = reactEl.props.children;
66
+ continue;
67
+ }
68
+ rows.push(reactEl);
69
+ }
70
+ var emptyRow = /*#__PURE__*/React.createElement(StyledTableRow, null, /*#__PURE__*/React.createElement(StyledTableCell, {
71
+ colSpan: headings.length
72
+ }, emptyState));
73
+ var hasRows = rows.length > 0;
74
+ var rowsMarkup = hasRows ? rows : emptyRow;
75
+ var showFooter = !!footer;
76
+ var LoadingRow = function LoadingRow() {
77
+ return /*#__PURE__*/React.createElement(StyledTableLoadingRow, {
78
+ className: "loader-container"
79
+ }, /*#__PURE__*/React.createElement(StyledLoaderWrapper, null, /*#__PURE__*/React.createElement(StyledSpinnerContainer, null, /*#__PURE__*/React.createElement(Spinner, null), /*#__PURE__*/React.createElement(Typography, {
80
+ variant: "subtitle1"
81
+ }, loadingLabel))));
82
+ };
83
+ return /*#__PURE__*/React.createElement(StyledDataTableContainer, null, /*#__PURE__*/React.createElement(StyledTable, _extends({
84
+ ref: ref,
85
+ "data-loading": loading,
86
+ "data-has-footer": showFooter
87
+ }, props), /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement(StyledTableRow, null, rowHeaderMarkup)), /*#__PURE__*/React.createElement("tbody", null, /*#__PURE__*/React.createElement(LoadingRow, null), totalsRowMarkup && hasRows && /*#__PURE__*/React.createElement(StyledTableRow, {
88
+ "data-total": "true"
89
+ }, totalsRowMarkup), rowsMarkup), showFooter && /*#__PURE__*/React.createElement("tfoot", null, /*#__PURE__*/React.createElement(StyledTableFooterRow, null, /*#__PURE__*/React.createElement(StyledTableCell, {
90
+ colSpan: headings.length
91
+ }, footer)))));
92
+ });
93
+ export var DataTable = Object.assign(DataTableComponent, {
94
+ Row: TableRow,
95
+ Cell: TableCell,
96
+ Footer: TableFooter
97
+ });
@@ -0,0 +1,9 @@
1
+ export declare const StyledTable: import("styled-components").StyledComponent<"table", any, {}, never>;
2
+ export declare const StyledTableRow: import("styled-components").StyledComponent<"tr", any, {}, never>;
3
+ export declare const StyledTabledHeader: import("styled-components").StyledComponent<"th", any, {}, never>;
4
+ export declare const StyledTableCell: import("styled-components").StyledComponent<"td", any, {}, never>;
5
+ export declare const StyledTableFooterRow: import("styled-components").StyledComponent<"tr", any, {}, never>;
6
+ export declare const StyledTableLoadingRow: import("styled-components").StyledComponent<"tr", any, {}, never>;
7
+ export declare const StyledLoaderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
8
+ export declare const StyledSpinnerContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
9
+ export declare const StyledDataTableContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,41 @@
1
+ import styled from 'styled-components';
2
+ import { borderRadius8 } from '../utilities/borderRadius';
3
+ import { Blue, Neutral } from '../utilities/colors';
4
+ import { space16 } from '../utilities/spacing';
5
+ var alignmentStyle = "\n&[data-text-align='right'] {\n > div {\n display: flex;\n justify-content: right;\n }\n}\n\n&[data-text-align='center'] {\n > div {\n display: flex;\n justify-content: center;\n }\n}\n";
6
+ export var StyledTable = styled.table.withConfig({
7
+ displayName: "DataTableStyle__StyledTable",
8
+ componentId: "sc-18v2ula-0"
9
+ })(["width:100%;height:100%;border:1px solid ", ";border-spacing:0;color:", ";max-width:100vw;border-bottom:0;&[data-has-footer='true']{border-bottom:1px solid ", ";}&[data-loading='true']{tbody{position:relative;}.loader-container{display:block;z-index:1;}}"], Neutral.B85, Neutral.B18, Neutral.B85);
10
+ export var StyledTableRow = styled.tr.withConfig({
11
+ displayName: "DataTableStyle__StyledTableRow",
12
+ componentId: "sc-18v2ula-1"
13
+ })(["background:", ";box-shadow:inset 0px -1px 0px ", ";&:hover{background:", ";}&[data-total='true']{background:", ";}"], Neutral.B100, Neutral.B85, Neutral.B99, Neutral.B99);
14
+ export var StyledTabledHeader = styled.th.withConfig({
15
+ displayName: "DataTableStyle__StyledTabledHeader",
16
+ componentId: "sc-18v2ula-2"
17
+ })(["padding:", ";text-align:left;", " button{padding:0;margin:0;height:auto;border:none;box-shadow:none;}button:hover{background:transparent;}button:active{border:none;box-shadow:none;background:transparent;}button:focus{border:none;}button svg{width:24px;height:24px;fill:", ";}"], space16, alignmentStyle, Neutral.B40);
18
+ export var StyledTableCell = styled.td.withConfig({
19
+ displayName: "DataTableStyle__StyledTableCell",
20
+ componentId: "sc-18v2ula-3"
21
+ })(["text-align:left;padding:", ";vertical-align:top;", ""], space16, alignmentStyle);
22
+ export var StyledTableFooterRow = styled.tr.withConfig({
23
+ displayName: "DataTableStyle__StyledTableFooterRow",
24
+ componentId: "sc-18v2ula-4"
25
+ })(["background:", ";border-top:0;border-radius:0px 0px ", " ", ";td{padding:", ";}"], Neutral.B99, borderRadius8, borderRadius8, space16);
26
+ export var StyledTableLoadingRow = styled(StyledTableRow).withConfig({
27
+ displayName: "DataTableStyle__StyledTableLoadingRow",
28
+ componentId: "sc-18v2ula-5"
29
+ })(["position:absolute;width:100%;height:100%;display:none;z-index:-1;"]);
30
+ export var StyledLoaderWrapper = styled.div.withConfig({
31
+ displayName: "DataTableStyle__StyledLoaderWrapper",
32
+ componentId: "sc-18v2ula-6"
33
+ })(["height:100%;width:100%;position:relative;"]);
34
+ export var StyledSpinnerContainer = styled.div.withConfig({
35
+ displayName: "DataTableStyle__StyledSpinnerContainer",
36
+ componentId: "sc-18v2ula-7"
37
+ })(["position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:", ";svg{width:48px;height:48px;fill:", ";}"], Neutral.B18, Blue.S99);
38
+ export var StyledDataTableContainer = styled.div.withConfig({
39
+ displayName: "DataTableStyle__StyledDataTableContainer",
40
+ componentId: "sc-18v2ula-8"
41
+ })(["overflow-x:auto;scroll-behavior:smooth;"]);
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ declare const _default: Meta<import("@storybook/react").Args>;
3
+ export default _default;
4
+ export declare const Interactive: any;
5
+ export declare const WithEmptyState: any;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export interface TableCellProps extends React.TdHTMLAttributes<HTMLTableColElement> {
3
+ children: React.ReactNode;
4
+ }
5
+ export declare const TableCell: ({ align, children }: TableCellProps) => JSX.Element;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { Typography } from '../Typography';
3
+ import { StyledTableCell } from './DataTableStyle';
4
+ export var TableCell = function TableCell(_ref) {
5
+ var align = _ref.align,
6
+ children = _ref.children;
7
+ return /*#__PURE__*/React.createElement(StyledTableCell, {
8
+ "data-text-align": align
9
+ }, /*#__PURE__*/React.createElement(Typography, {
10
+ as: "div",
11
+ variant: "body1"
12
+ }, children));
13
+ };
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare const TableFooter: ({ children }: {
3
+ children: React.ReactNode;
4
+ }) => JSX.Element;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ export var TableFooter = function TableFooter(_ref) {
3
+ var children = _ref.children;
4
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
5
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { SortDirection } from './DataTable';
3
+ export interface TableHeaderProps extends React.ThHTMLAttributes<HTMLTableColElement> {
4
+ title: string;
5
+ sortDirection?: SortDirection;
6
+ onSort?: (sortDirection: SortDirection) => void;
7
+ }
8
+ export declare const TableHeader: ({ sortDirection: sortDirectionProp, title, align, onSort, }: TableHeaderProps) => JSX.Element;
@@ -0,0 +1,48 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { Button } from '../Button';
3
+ import { Icon } from '../Icon';
4
+ import { Typography } from '../Typography';
5
+ import { StyledTabledHeader } from './DataTableStyle';
6
+ export var TableHeader = function TableHeader(_ref) {
7
+ var sortDirectionProp = _ref.sortDirection,
8
+ title = _ref.title,
9
+ _ref$align = _ref.align,
10
+ align = _ref$align === void 0 ? 'left' : _ref$align,
11
+ onSort = _ref.onSort;
12
+ var _useState = useState(null),
13
+ sortDirection = _useState[0],
14
+ setSortDirection = _useState[1];
15
+ useEffect(function () {
16
+ setSortDirection(sortDirectionProp);
17
+ }, [sortDirectionProp]);
18
+ var iconName = sortDirection === 'ASCENDING' ? 'ri-arrow-xs-up-fill' : 'ri-arrow-xs-down-fill';
19
+ var iconMarkup = sortDirection ? /*#__PURE__*/React.createElement(Icon, {
20
+ name: iconName
21
+ }) : null;
22
+ var titleMarkup = /*#__PURE__*/React.createElement(Typography, {
23
+ as: "span",
24
+ variant: "body1",
25
+ style: {
26
+ whiteSpace: 'nowrap'
27
+ }
28
+ }, title);
29
+ var handleSortableClick = function handleSortableClick() {
30
+ if (!sortDirection) {
31
+ return;
32
+ }
33
+ var direction = sortDirection === 'ASCENDING' ? 'DESCENDING' : 'ASCENDING';
34
+ setSortDirection(direction);
35
+ onSort == null ? void 0 : onSort(direction);
36
+ };
37
+ var sortableCellMarkup = /*#__PURE__*/React.createElement(Button, {
38
+ "data-testid": "data-table-sort-button-" + title,
39
+ icon: iconMarkup,
40
+ onClick: function onClick() {
41
+ return handleSortableClick();
42
+ }
43
+ }, titleMarkup);
44
+ var contentMarkup = sortDirection ? sortableCellMarkup : titleMarkup;
45
+ return /*#__PURE__*/React.createElement(StyledTabledHeader, {
46
+ "data-text-align": align
47
+ }, /*#__PURE__*/React.createElement("div", null, contentMarkup));
48
+ };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface TableRowProps extends React.HtmlHTMLAttributes<HTMLTableRowElement> {
3
+ position?: number;
4
+ children: React.ReactNode;
5
+ }
6
+ export declare const TableRow: ({ children, ...props }: TableRowProps) => JSX.Element;
@@ -0,0 +1,12 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["children"];
4
+ import React from 'react';
5
+ import { StyledTableRow } from './DataTableStyle';
6
+ export var TableRow = function TableRow(_ref) {
7
+ var children = _ref.children,
8
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
9
+ return /*#__PURE__*/React.createElement(StyledTableRow, _extends({
10
+ "data-testid": "data-table-row"
11
+ }, props), children);
12
+ };
@@ -0,0 +1,4 @@
1
+ export * from './DataTable';
2
+ export * from './TableRow';
3
+ export * from './TableCell';
4
+ export * from './TableHeader';
@@ -0,0 +1,4 @@
1
+ export * from './DataTable';
2
+ export * from './TableRow';
3
+ export * from './TableCell';
4
+ export * from './TableHeader';
@@ -3,6 +3,6 @@ export declare const EmptyStateContainer: import("styled-components").StyledComp
3
3
  export declare const EmptyStateContentContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
4
4
  export declare const StyledImage: import("styled-components").StyledComponent<"img", any, {}, never>;
5
5
  export declare const StyledButtonGroup: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("..").ButtonGroupProps & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
6
- export declare const StyledTitle: import("styled-components").StyledComponent<({ as, children, variant, ...props }: import("..").TypographyProps) => JSX.Element, any, {}, never>;
7
- export declare const StyledDescription: import("styled-components").StyledComponent<({ as, children, variant, ...props }: import("..").TypographyProps) => JSX.Element, any, {}, never>;
8
- export declare const StyledHelpText: import("styled-components").StyledComponent<({ as, children, variant, ...props }: import("..").TypographyProps) => JSX.Element, any, {}, never>;
6
+ export declare const StyledTitle: import("styled-components").StyledComponent<({ as, children, variant, style, ...props }: import("..").TypographyProps) => JSX.Element, any, {}, never>;
7
+ export declare const StyledDescription: import("styled-components").StyledComponent<({ as, children, variant, style, ...props }: import("..").TypographyProps) => JSX.Element, any, {}, never>;
8
+ export declare const StyledHelpText: import("styled-components").StyledComponent<({ as, children, variant, style, ...props }: import("..").TypographyProps) => JSX.Element, any, {}, never>;
@@ -4,4 +4,4 @@ import { space2 } from '../utilities/spacing';
4
4
  export var StyledLink = styled.a.withConfig({
5
5
  displayName: "LinkStyle__StyledLink",
6
6
  componentId: "sc-usx229-0"
7
- })(["display:flex;align-items:center;color:", ";&[data-underline='false']{text-decoration:none;}&[data-monochrome='true']{color:", ";&:hover,&:active{color:", ";}}&:hover{color:rgba(0,86,140,0.9);svg{fill:rgba(0,86,140,0.9);}}&:active{color:", ";svg{fill:", ";}}svg{fill:", ";margin-left:", ";padding-bottom:", ";height:18px;}"], Blue.S99, Neutral.B18, Neutral.B00, Blue.S100, Blue.S100, Blue.S99, space2, space2);
7
+ })(["display:flex;align-items:center;color:", ";&[data-underline='false']{text-decoration:none;}&[data-monochrome='true']{color:", ";&:hover,&:active{color:", ";svg{fill:", ";}}svg{fill:", ";}}&:hover{color:rgba(0,86,140,0.9);svg{fill:rgba(0,86,140,0.9);}}&:active{color:", ";svg{fill:", ";}}svg{fill:", ";margin-left:", ";padding-bottom:", ";height:18px;}"], Blue.S99, Neutral.B18, Neutral.B00, Neutral.B00, Neutral.B18, Blue.S100, Blue.S100, Blue.S99, space2, space2);
@@ -16,7 +16,7 @@ export var SimplePaginationStyledNav = styled(StyledNav).withConfig({
16
16
  export var StyledPageButton = styled.button.withConfig({
17
17
  displayName: "PaginationStyle__StyledPageButton",
18
18
  componentId: "sc-1hi5sa8-2"
19
- })(["cursor:pointer;height:32px;min-width:32px;border:0;background:", ";border-radius:", ";padding:", ";color:", ";&:hover{background:", ";}&:disabled{color:", ";}svg{fill:", ";width:24px;height:24px;}&[data-active='true']{background:", ";color:", ";}&:disabled svg{fill:", ";}&[data-active='true']:disabled{background:", ";color:", ";}"], Neutral.B100, borderRadius2, space4, Neutral.B18, Neutral.B95, Neutral.B85, Neutral.B40, Blue.S08, Blue.S99, Neutral.B85, Neutral.B95, Neutral.B85);
19
+ })(["cursor:pointer;height:32px;min-width:32px;border:0;background:transparent;border-radius:", ";padding:", ";color:", ";&:hover{background:", ";}&:disabled{color:", ";}svg{fill:", ";width:24px;height:24px;}&[data-active='true']{background:", ";color:", ";}&:disabled svg{fill:", ";}&[data-active='true']:disabled{background:", ";color:", ";}"], borderRadius2, space4, Neutral.B18, Neutral.B95, Neutral.B85, Neutral.B40, Blue.S08, Blue.S99, Neutral.B85, Neutral.B95, Neutral.B85);
20
20
  export var StyledSimplePaginationButton = styled(StyledPageButton).withConfig({
21
21
  displayName: "PaginationStyle__StyledSimplePaginationButton",
22
22
  componentId: "sc-1hi5sa8-3"
@@ -1,4 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { IconProps } from '../Icon';
3
- export declare type SpinnerProps = Omit<IconProps, 'name'>;
4
- export declare const Spinner: (props: SpinnerProps) => JSX.Element;
3
+ export declare type Size = 'small' | 'large';
4
+ export declare type SpinnerProps = Omit<IconProps, 'name'> & {
5
+ label?: string;
6
+ size?: Size;
7
+ };
8
+ export declare const Spinner: ({ label, size, ...props }: SpinnerProps) => JSX.Element;
@@ -1,15 +1,24 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["label", "size"];
4
+ var _iconSizeMapping, _labelVariantMapping;
2
5
  import React from 'react';
3
- import styled from 'styled-components';
4
6
  import { Icon } from '../Icon';
5
- var StyledWrapper = styled.div.withConfig({
6
- displayName: "Spinner__StyledWrapper",
7
- componentId: "sc-ynwr5u-0"
8
- })(["display:flex;justify-content:center;@keyframes p-keyframes-spin{to{transform:rotate(1turn);}}svg{animation:p-keyframes-spin 800ms linear infinite;}"]);
9
- export var Spinner = function Spinner(props) {
7
+ import { Label, StyledWrapper } from './SpinnerStyle';
8
+ var iconSizeMapping = (_iconSizeMapping = {}, _iconSizeMapping['small'] = '18px', _iconSizeMapping['large'] = '48px', _iconSizeMapping);
9
+ var labelVariantMapping = (_labelVariantMapping = {}, _labelVariantMapping['small'] = 'body1', _labelVariantMapping['large'] = 'subtitle1', _labelVariantMapping);
10
+ export var Spinner = function Spinner(_ref) {
11
+ var label = _ref.label,
12
+ size = _ref.size,
13
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
10
14
  return /*#__PURE__*/React.createElement(StyledWrapper, {
11
15
  className: "spinner-container"
12
16
  }, /*#__PURE__*/React.createElement(Icon, _extends({
13
- name: "ri-loader"
14
- }, props)));
17
+ name: "ri-loader",
18
+ height: iconSizeMapping[size],
19
+ width: iconSizeMapping[size]
20
+ }, props)), label && /*#__PURE__*/React.createElement(Label, {
21
+ variant: labelVariantMapping[size],
22
+ "data-size": size
23
+ }, label));
15
24
  };
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ declare const _default: Meta<import("@storybook/react").Args>;
3
+ export default _default;
4
+ export declare const Default: any;
5
+ export declare const WithLabel: any;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
+ export declare const Label: import("styled-components").StyledComponent<({ as, children, variant, style, ...props }: import("../Typography").TypographyProps) => JSX.Element, any, {}, never>;
@@ -0,0 +1,11 @@
1
+ import styled from 'styled-components';
2
+ import { Typography } from '../Typography';
3
+ import { space16, space4 } from '../utilities/spacing';
4
+ export var StyledWrapper = styled.div.withConfig({
5
+ displayName: "SpinnerStyle__StyledWrapper",
6
+ componentId: "sc-1rqoa36-0"
7
+ })(["display:flex;flex-direction:column;justify-content:center;align-items:center;@keyframes p-keyframes-spin{to{transform:rotate(1turn);}}svg{animation:p-keyframes-spin 800ms linear infinite;}"]);
8
+ export var Label = styled(Typography).withConfig({
9
+ displayName: "SpinnerStyle__Label",
10
+ componentId: "sc-1rqoa36-1"
11
+ })(["margin-bottom:0;&[data-size='large']{margin-top:", ";}&[data-size='small']{margin-top:", ";}"], space16, space4);
@@ -4,5 +4,6 @@ export interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
4
4
  disabled?: boolean;
5
5
  onChange: () => void;
6
6
  value: string;
7
+ withIcon?: boolean;
7
8
  }
8
9
  export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
@@ -1,14 +1,26 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["checked", "disabled", "onChange", "value"];
3
+ var _excluded = ["checked", "disabled", "onChange", "value", "withIcon"];
4
4
  import React from 'react';
5
+ import { Icon } from '../Icon';
6
+ import { Neutral } from '../utilities/colors';
5
7
  import { InputStyle, LabelStyle, SwitchStyle } from './SwitchStyle';
6
8
  export var Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref, ref) {
7
9
  var checked = _ref.checked,
8
10
  disabled = _ref.disabled,
9
11
  onChange = _ref.onChange,
10
12
  value = _ref.value,
13
+ withIcon = _ref.withIcon,
11
14
  otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
15
+ var IconRender = function IconRender() {
16
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, {
17
+ name: "ri-check",
18
+ fill: disabled ? Neutral.B85 : Neutral.B100
19
+ }), /*#__PURE__*/React.createElement(Icon, {
20
+ name: "ri-close",
21
+ fill: disabled ? Neutral.B85 : Neutral.B100
22
+ }));
23
+ };
12
24
  return /*#__PURE__*/React.createElement(LabelStyle, null, /*#__PURE__*/React.createElement(InputStyle, _extends({
13
25
  value: value
14
26
  }, otherProps, {
@@ -16,8 +28,10 @@ export var Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref, ref) {
16
28
  defaultChecked: checked,
17
29
  type: "checkbox",
18
30
  onChange: onChange,
19
- ref: ref
31
+ ref: ref,
32
+ "data-with-icon": withIcon
20
33
  })), /*#__PURE__*/React.createElement(SwitchStyle, {
21
- "data-disabled": disabled
22
- }));
34
+ "data-disabled": disabled,
35
+ "data-with-icon": withIcon
36
+ }, withIcon && /*#__PURE__*/React.createElement(IconRender, null)));
23
37
  });
@@ -1,4 +1,5 @@
1
1
  import { Meta } from '@storybook/react';
2
2
  declare const _default: Meta<import("@storybook/react").Args>;
3
3
  export default _default;
4
- export declare const Interactive: any;
4
+ export declare const Default: any;
5
+ export declare const WithIcon: any;
@@ -4,11 +4,11 @@ import { Blue, Neutral } from '../utilities/colors';
4
4
  export var SwitchStyle = styled.div.withConfig({
5
5
  displayName: "SwitchStyle",
6
6
  componentId: "sc-7dlucf-0"
7
- })(["position:relative;width:", ";height:", ";background-color:", ";&[data-disabled='true']{background-color:", ";}border-radius:", ";padding:0;transition:300ms all;@media (max-width:", "){width:38px;height:22px;}&:before{transition:100ms all;content:'';position:absolute;width:16px;height:16px;border-radius:16px;top:50%;left:4px;background:", ";transform:translate(0,-50%);@media (max-width:", "){width:14px;height:14px;}}"], Spacing.space40, Spacing.space24, Neutral.B40, Neutral.B95, Spacing.space24, Breakpoints.large, Neutral.B100, Breakpoints.large);
7
+ })(["display:flex;flex-direction:row;justify-content:space-between;align-items:center;position:relative;width:", ";&[data-with-icon]{width:48px;}&[data-with-icon] svg{height:16px;}height:", ";background-color:", ";&[data-disabled='true']{background-color:", ";cursor:not-allowed;}border-radius:", ";padding:0;padding-left:8px;padding-right:8px;transition:300ms all;@media (max-width:", "){width:38px;&[data-with-icon]{width:44px;}&[data-with-icon] svg{height:14px;}height:22px;}&:before{transition:100ms all;content:'';position:absolute;width:16px;height:16px;border-radius:16px;top:50%;left:4px;background:", ";box-shadow:0px 1px 3px rgba(0,0,0,0.1);transform:translate(0,-50%);@media (max-width:", "){width:14px;height:14px;}}"], Spacing.space40, Spacing.space24, Neutral.B40, Neutral.B95, Spacing.space24, Breakpoints.large, Neutral.B100, Breakpoints.large);
8
8
  export var InputStyle = styled.input.withConfig({
9
9
  displayName: "SwitchStyle__InputStyle",
10
10
  componentId: "sc-7dlucf-1"
11
- })(["opacity:0;position:absolute;&:checked + ", "{background-color:", ";&[data-disabled='true']{background-color:", ";}&:before{transform:translate(16px,-50%);}}"], SwitchStyle, Blue.S99, Neutral.B95);
11
+ })(["opacity:0;position:absolute;&:checked + ", "{background-color:", ";&[data-disabled='true']{background-color:", ";}&:before{transform:translate(16px,-50%);}&[data-with-icon]{&:before{transform:translate(24px,-50%);}}}& + ", " svg:nth-child(1){visibility:hidden;}& + ", " svg:nth-child(2){visibility:visible;}&:checked + ", " svg:nth-child(1){visibility:visible;}&:checked + ", " svg:nth-child(2){visibility:hidden;}"], SwitchStyle, Blue.S99, Neutral.B95, SwitchStyle, SwitchStyle, SwitchStyle, SwitchStyle);
12
12
  export var LabelStyle = styled.label.withConfig({
13
13
  displayName: "SwitchStyle__LabelStyle",
14
14
  componentId: "sc-7dlucf-2"
@@ -1,4 +1,4 @@
1
- import { ElementType, ReactNode } from 'react';
1
+ import React, { ElementType, ReactNode } from 'react';
2
2
  declare const typographyVariant: readonly ["headline1", "headline2", "headline3", "headline4", "headline5", "headline6", "subtitle1", "subtitle2", "body1", "body2", "button", "caption", "overline"];
3
3
  export declare type Variant = typeof typographyVariant[number];
4
4
  export interface TypographyProps {
@@ -9,6 +9,7 @@ export interface TypographyProps {
9
9
  color?: string;
10
10
  /** Sets the Typography's variant */
11
11
  variant?: Variant;
12
+ style?: React.CSSProperties;
12
13
  }
13
- export declare const Typography: ({ as, children, variant, ...props }: TypographyProps) => JSX.Element;
14
+ export declare const Typography: ({ as, children, variant, style, ...props }: TypographyProps) => JSX.Element;
14
15
  export {};
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["as", "children", "variant"];
3
+ var _excluded = ["as", "children", "variant", "style"];
4
4
  import React from 'react';
5
5
  import { StyledTypography } from './TypographyStyles';
6
6
  var typographyVariant = ['headline1', 'headline2', 'headline3', 'headline4', 'headline5', 'headline6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'button', 'caption', 'overline'];
@@ -12,11 +12,13 @@ export var Typography = function Typography(_ref) {
12
12
  as = _ref$as === void 0 ? 'p' : _ref$as,
13
13
  children = _ref.children,
14
14
  variant = _ref.variant,
15
+ style = _ref.style,
15
16
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
16
17
  if (!isVariant(variant)) {
17
18
  console.warn("Variant: " + variant + " is not of type Variant | undefined. \ntype Variant " + typographyVariant);
18
19
  }
19
20
  return /*#__PURE__*/React.createElement(StyledTypography, _extends({
21
+ style: style,
20
22
  as: as,
21
23
  variant: variant
22
24
  }, props), children);
@@ -13,6 +13,7 @@ export { ButtonGroup, ButtonGroupProps } from './ButtonGroup';
13
13
  export { Card, CardProps } from './Card';
14
14
  export { Checkbox, CheckboxProps } from './Checkbox';
15
15
  export { CurrencyInput, CurrencyInputProps } from './CurrencyInput';
16
+ export { DataTable, DataTableProps, TableCellProps, TableHeaderProps, TableRowProps, } from './DataTable';
16
17
  export { Divider } from './Divider';
17
18
  export { EmptyState } from './EmptyState';
18
19
  export { Icon, IconProps } from './Icon';
package/es/@next/index.js CHANGED
@@ -14,6 +14,7 @@ export { ButtonGroup, ButtonGroupProps } from './ButtonGroup';
14
14
  export { Card, CardProps } from './Card';
15
15
  export { Checkbox, CheckboxProps } from './Checkbox';
16
16
  export { CurrencyInput, CurrencyInputProps } from './CurrencyInput';
17
+ export { DataTable, DataTableProps, TableCellProps, TableHeaderProps, TableRowProps } from './DataTable';
17
18
  export { Divider } from './Divider';
18
19
  export { EmptyState } from './EmptyState';
19
20
  export { Icon, IconProps } from './Icon';
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { EmptyStateProps } from '../EmptyState';
3
+ export declare type SortDirection = 'ASCENDING' | 'DESCENDING';
4
+ export declare type TableHeading = React.ThHTMLAttributes<HTMLTableColElement> & {
5
+ title?: string;
6
+ id?: string;
7
+ defaultSortDirection?: SortDirection;
8
+ };
9
+ export declare type Total = TableHeading | null;
10
+ export interface DataTableProps extends React.TableHTMLAttributes<HTMLTableElement> {
11
+ headings: TableHeading[];
12
+ children: React.ReactNode;
13
+ emptyState: React.ReactElement<EmptyStateProps>;
14
+ totals?: Total[];
15
+ loading?: boolean;
16
+ loadingLabel?: string;
17
+ onSortChanged?: (context: string, sortDirection: SortDirection) => void;
18
+ }
19
+ export declare const DataTable: React.ForwardRefExoticComponent<DataTableProps & React.RefAttributes<HTMLTableElement>> & {
20
+ Row: ({ children, ...props }: import("./TableRow").TableRowProps) => JSX.Element;
21
+ Cell: ({ align, children }: import("./TableCell").TableCellProps) => JSX.Element;
22
+ Footer: ({ children }: {
23
+ children: React.ReactNode;
24
+ }) => JSX.Element;
25
+ };