@aws-amplify/ui-react 6.11.2 → 6.12.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.
@@ -10,11 +10,20 @@ import { SearchField } from '../SearchField/SearchField.mjs';
10
10
  import { ComponentText } from '../shared/constants.mjs';
11
11
  import { strHasLength } from '../shared/utils.mjs';
12
12
  import { itemHasText, getPageCount, getItemsAtPage } from './utils.mjs';
13
+ import { Table } from '../Table/Table.mjs';
14
+ import { TableBody } from '../Table/TableBody.mjs';
15
+ import '../Table/TableCell.mjs';
16
+ import '../Table/TableFoot.mjs';
17
+ import '../Table/TableHead.mjs';
18
+ import '../Table/TableRow.mjs';
13
19
 
14
20
  const DEFAULT_PAGE_SIZE = 10;
15
21
  const TYPEAHEAD_DELAY_MS = 300;
16
22
  const ListCollection = ({ children, direction = 'column', items, ...rest }) => (React.createElement(Flex, { direction: direction, ...rest }, Array.isArray(items) ? items.map(children) : null));
17
23
  const GridCollection = ({ children, items, ...rest }) => (React.createElement(Grid, { ...rest }, Array.isArray(items) ? items.map(children) : null));
24
+ const TableCollection = ({ children, items, tableHeader: TableHeader, ...rest }) => (React.createElement(Table, { ...rest },
25
+ React.createElement(TableHeader, null),
26
+ React.createElement(TableBody, null, Array.isArray(items) ? items.map(children) : null)));
18
27
  const renderCollectionOrNoResultsFound = (collection, items, searchNoResultsFound) => {
19
28
  if (items.length) {
20
29
  return collection;
@@ -45,7 +54,7 @@ const Collection = ({ className, isSearchable, isPaginated, items, itemsPerPage
45
54
  if (isPaginated) {
46
55
  items = getItemsAtPage(items, pagination.currentPage, itemsPerPage);
47
56
  }
48
- const collection = type === 'list' ? (React.createElement(ListCollection, { className: ComponentClassName.CollectionItems, items: items, ...rest })) : type === 'grid' ? (React.createElement(GridCollection, { className: ComponentClassName.CollectionItems, items: items, ...rest })) : null;
57
+ const collection = type === 'list' ? (React.createElement(ListCollection, { className: ComponentClassName.CollectionItems, items: items, ...rest })) : type === 'grid' ? (React.createElement(GridCollection, { className: ComponentClassName.CollectionItems, items: items, ...rest })) : type === 'table' ? (React.createElement(TableCollection, { className: ComponentClassName.CollectionItems, items: items, tableHeader: rest.tableHeader, ...rest })) : null;
49
58
  return (React.createElement(Flex, { testId: testId, className: classNames(ComponentClassName.Collection, className) },
50
59
  isSearchable ? (React.createElement(Flex, { className: ComponentClassName.CollectionSearch },
51
60
  React.createElement(SearchField, { label: searchLabel, placeholder: searchPlaceholder, onChange: (e) => onSearch(e.target.value), onClear: () => setSearchText('') }))) : null,
@@ -1,3 +1,3 @@
1
- const VERSION = '6.11.2';
1
+ const VERSION = '6.12.0';
2
2
 
3
3
  export { VERSION };
package/dist/index.js CHANGED
@@ -1062,10 +1062,47 @@ const itemHasText = (item, text) => {
1062
1062
  */
1063
1063
  const getPageCount = (totalItems, itemsPerPage) => Math.ceil(totalItems / itemsPerPage);
1064
1064
 
1065
+ const TablePrimitive = ({ caption, children, className, highlightOnHover = false, size, variation, ...rest }, ref) => {
1066
+ const componentClasses = ui.classNames(ui.ComponentClassName.Table, ui.classNameModifier(ui.ComponentClassName.Table, size), ui.classNameModifier(ui.ComponentClassName.Table, variation), className);
1067
+ return (React__namespace.createElement(Field.View, { as: "table", className: componentClasses, "data-highlightonhover": highlightOnHover, ref: ref, ...rest },
1068
+ caption && (React__namespace.createElement(Field.View, { as: "caption", className: ui.ComponentClassName.TableCaption }, caption)),
1069
+ children));
1070
+ };
1071
+ /**
1072
+ * [📖 Docs](https://ui.docs.amplify.aws/react/components/table)
1073
+ */
1074
+ const Table = Field.primitiveWithForwardRef(TablePrimitive);
1075
+ Table.displayName = 'Table';
1076
+
1077
+ const TableBodyPrimitive = ({ children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: "tbody", className: ui.classNames(ui.ComponentClassName.TableBody, className), ref: ref, ...rest }, children));
1078
+ const TableBody = Field.primitiveWithForwardRef(TableBodyPrimitive);
1079
+ TableBody.displayName = 'TableBody';
1080
+
1081
+ const TableCellPrimitive = ({ as: asElementTag = 'td', children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: asElementTag, className: ui.classNames(asElementTag === 'td'
1082
+ ? ui.ComponentClassName.TableTd
1083
+ : ui.ComponentClassName.TableTh, className), ref: ref, ...rest }, children));
1084
+ const TableCell = Field.primitiveWithForwardRef(TableCellPrimitive);
1085
+ TableCell.displayName = 'TableCell';
1086
+
1087
+ const TableFootPrimitive = ({ children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: "tfoot", className: ui.classNames(ui.ComponentClassName.TableFoot, className), ref: ref, ...rest }, children));
1088
+ const TableFoot = Field.primitiveWithForwardRef(TableFootPrimitive);
1089
+ TableFoot.displayName = 'TableFoot';
1090
+
1091
+ const TableHeadPrimitive = ({ children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: "thead", className: ui.classNames(ui.ComponentClassName.TableHead, className), ref: ref, ...rest }, children));
1092
+ const TableHead = Field.primitiveWithForwardRef(TableHeadPrimitive);
1093
+ TableHead.displayName = 'TableHead';
1094
+
1095
+ const TableRowPrimitive = ({ children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: "tr", className: ui.classNames(ui.ComponentClassName.TableRow, className), ref: ref, ...rest }, children));
1096
+ const TableRow = Field.primitiveWithForwardRef(TableRowPrimitive);
1097
+ TableRow.displayName = 'TableRow';
1098
+
1065
1099
  const DEFAULT_PAGE_SIZE = 10;
1066
1100
  const TYPEAHEAD_DELAY_MS = 300;
1067
1101
  const ListCollection = ({ children, direction = 'column', items, ...rest }) => (React__namespace.createElement(Field.Flex, { direction: direction, ...rest }, Array.isArray(items) ? items.map(children) : null));
1068
1102
  const GridCollection = ({ children, items, ...rest }) => (React__namespace.createElement(Grid, { ...rest }, Array.isArray(items) ? items.map(children) : null));
1103
+ const TableCollection = ({ children, items, tableHeader: TableHeader, ...rest }) => (React__namespace.createElement(Table, { ...rest },
1104
+ React__namespace.createElement(TableHeader, null),
1105
+ React__namespace.createElement(TableBody, null, Array.isArray(items) ? items.map(children) : null)));
1069
1106
  const renderCollectionOrNoResultsFound = (collection, items, searchNoResultsFound) => {
1070
1107
  if (items.length) {
1071
1108
  return collection;
@@ -1096,7 +1133,7 @@ const Collection = ({ className, isSearchable, isPaginated, items, itemsPerPage
1096
1133
  if (isPaginated) {
1097
1134
  items = getItemsAtPage(items, pagination.currentPage, itemsPerPage);
1098
1135
  }
1099
- const collection = type === 'list' ? (React__namespace.createElement(ListCollection, { className: ui.ComponentClassName.CollectionItems, items: items, ...rest })) : type === 'grid' ? (React__namespace.createElement(GridCollection, { className: ui.ComponentClassName.CollectionItems, items: items, ...rest })) : null;
1136
+ const collection = type === 'list' ? (React__namespace.createElement(ListCollection, { className: ui.ComponentClassName.CollectionItems, items: items, ...rest })) : type === 'grid' ? (React__namespace.createElement(GridCollection, { className: ui.ComponentClassName.CollectionItems, items: items, ...rest })) : type === 'table' ? (React__namespace.createElement(TableCollection, { className: ui.ComponentClassName.CollectionItems, items: items, tableHeader: rest.tableHeader, ...rest })) : null;
1100
1137
  return (React__namespace.createElement(Field.Flex, { testId: testId, className: ui.classNames(ui.ComponentClassName.Collection, className) },
1101
1138
  isSearchable ? (React__namespace.createElement(Field.Flex, { className: ui.ComponentClassName.CollectionSearch },
1102
1139
  React__namespace.createElement(SearchField, { label: searchLabel, placeholder: searchPlaceholder, onChange: (e) => onSearch(e.target.value), onClear: () => setSearchText('') }))) : null,
@@ -1985,40 +2022,6 @@ const SwitchFieldPrimitive = ({ className, defaultChecked, id, isChecked, isDisa
1985
2022
  const SwitchField = Field.primitiveWithForwardRef(SwitchFieldPrimitive);
1986
2023
  SwitchField.displayName = 'SwitchField';
1987
2024
 
1988
- const TablePrimitive = ({ caption, children, className, highlightOnHover = false, size, variation, ...rest }, ref) => {
1989
- const componentClasses = ui.classNames(ui.ComponentClassName.Table, ui.classNameModifier(ui.ComponentClassName.Table, size), ui.classNameModifier(ui.ComponentClassName.Table, variation), className);
1990
- return (React__namespace.createElement(Field.View, { as: "table", className: componentClasses, "data-highlightonhover": highlightOnHover, ref: ref, ...rest },
1991
- caption && (React__namespace.createElement(Field.View, { as: "caption", className: ui.ComponentClassName.TableCaption }, caption)),
1992
- children));
1993
- };
1994
- /**
1995
- * [📖 Docs](https://ui.docs.amplify.aws/react/components/table)
1996
- */
1997
- const Table = Field.primitiveWithForwardRef(TablePrimitive);
1998
- Table.displayName = 'Table';
1999
-
2000
- const TableBodyPrimitive = ({ children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: "tbody", className: ui.classNames(ui.ComponentClassName.TableBody, className), ref: ref, ...rest }, children));
2001
- const TableBody = Field.primitiveWithForwardRef(TableBodyPrimitive);
2002
- TableBody.displayName = 'TableBody';
2003
-
2004
- const TableCellPrimitive = ({ as: asElementTag = 'td', children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: asElementTag, className: ui.classNames(asElementTag === 'td'
2005
- ? ui.ComponentClassName.TableTd
2006
- : ui.ComponentClassName.TableTh, className), ref: ref, ...rest }, children));
2007
- const TableCell = Field.primitiveWithForwardRef(TableCellPrimitive);
2008
- TableCell.displayName = 'TableCell';
2009
-
2010
- const TableFootPrimitive = ({ children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: "tfoot", className: ui.classNames(ui.ComponentClassName.TableFoot, className), ref: ref, ...rest }, children));
2011
- const TableFoot = Field.primitiveWithForwardRef(TableFootPrimitive);
2012
- TableFoot.displayName = 'TableFoot';
2013
-
2014
- const TableHeadPrimitive = ({ children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: "thead", className: ui.classNames(ui.ComponentClassName.TableHead, className), ref: ref, ...rest }, children));
2015
- const TableHead = Field.primitiveWithForwardRef(TableHeadPrimitive);
2016
- TableHead.displayName = 'TableHead';
2017
-
2018
- const TableRowPrimitive = ({ children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: "tr", className: ui.classNames(ui.ComponentClassName.TableRow, className), ref: ref, ...rest }, children));
2019
- const TableRow = Field.primitiveWithForwardRef(TableRowPrimitive);
2020
- TableRow.displayName = 'TableRow';
2021
-
2022
2025
  const TabsContext = React__namespace.createContext({
2023
2026
  groupId: '',
2024
2027
  activeTab: '',
@@ -2469,7 +2472,7 @@ const defaultDeleteUserDisplayText = {
2469
2472
  warningText: 'Deleting your account is not reversible. You will lose access to your account and all data associated with it.',
2470
2473
  };
2471
2474
 
2472
- const VERSION = '6.11.2';
2475
+ const VERSION = '6.12.0';
2473
2476
 
2474
2477
  const logger$2 = ui.getLogger('AccountSettings');
2475
2478
  const getIsDisabled = (formValues, validationError) => {
@@ -67,11 +67,26 @@
67
67
  z-index: 1;
68
68
  }
69
69
 
70
- .amplify-liveness-loader {
70
+ .amplify-liveness-loader .amplify-liveness-centered-loader {
71
+ transform: translate(-50%, -50%);
72
+ }
73
+
74
+ .amplify-liveness-centered-loader {
71
75
  position: absolute;
72
76
  left: 50%;
73
77
  top: 50%;
74
- transform: translate(-50%, -50%);
78
+ }
79
+
80
+ .amplify-liveness-connecting-loader {
81
+ display: flex;
82
+ position: absolute;
83
+ flex-direction: column;
84
+ justify-content: center;
85
+ align-items: center;
86
+ z-index: 3;
87
+ width: 100%;
88
+ height: 100%;
89
+ background-color: var(--amplify-colors-background-primary);
75
90
  }
76
91
 
77
92
  .amplify-liveness-oval-canvas {
@@ -68,11 +68,26 @@
68
68
  z-index: 1;
69
69
  }
70
70
 
71
- .amplify-liveness-loader {
71
+ .amplify-liveness-loader .amplify-liveness-centered-loader {
72
+ transform: translate(-50%, -50%);
73
+ }
74
+
75
+ .amplify-liveness-centered-loader {
72
76
  position: absolute;
73
77
  left: 50%;
74
78
  top: 50%;
75
- transform: translate(-50%, -50%);
79
+ }
80
+
81
+ .amplify-liveness-connecting-loader {
82
+ display: flex;
83
+ position: absolute;
84
+ flex-direction: column;
85
+ justify-content: center;
86
+ align-items: center;
87
+ z-index: 3;
88
+ width: 100%;
89
+ height: 100%;
90
+ background-color: var(--amplify-colors-background-primary);
76
91
  }
77
92
 
78
93
  .amplify-liveness-oval-canvas {
package/dist/styles.css CHANGED
@@ -4250,11 +4250,26 @@ html[dir=rtl] .amplify-field-group__inner-start {
4250
4250
  z-index: 1;
4251
4251
  }
4252
4252
 
4253
- .amplify-liveness-loader {
4253
+ .amplify-liveness-loader .amplify-liveness-centered-loader {
4254
+ transform: translate(-50%, -50%);
4255
+ }
4256
+
4257
+ .amplify-liveness-centered-loader {
4254
4258
  position: absolute;
4255
4259
  left: 50%;
4256
4260
  top: 50%;
4257
- transform: translate(-50%, -50%);
4261
+ }
4262
+
4263
+ .amplify-liveness-connecting-loader {
4264
+ display: flex;
4265
+ position: absolute;
4266
+ flex-direction: column;
4267
+ justify-content: center;
4268
+ align-items: center;
4269
+ z-index: 3;
4270
+ width: 100%;
4271
+ height: 100%;
4272
+ background-color: var(--amplify-colors-background-primary);
4258
4273
  }
4259
4274
 
4260
4275
  .amplify-liveness-oval-canvas {
@@ -4251,11 +4251,26 @@ html[dir=rtl] .amplify-field-group__inner-start {
4251
4251
  z-index: 1;
4252
4252
  }
4253
4253
 
4254
- .amplify-liveness-loader {
4254
+ .amplify-liveness-loader .amplify-liveness-centered-loader {
4255
+ transform: translate(-50%, -50%);
4256
+ }
4257
+
4258
+ .amplify-liveness-centered-loader {
4255
4259
  position: absolute;
4256
4260
  left: 50%;
4257
4261
  top: 50%;
4258
- transform: translate(-50%, -50%);
4262
+ }
4263
+
4264
+ .amplify-liveness-connecting-loader {
4265
+ display: flex;
4266
+ position: absolute;
4267
+ flex-direction: column;
4268
+ justify-content: center;
4269
+ align-items: center;
4270
+ z-index: 3;
4271
+ width: 100%;
4272
+ height: 100%;
4273
+ background-color: var(--amplify-colors-background-primary);
4259
4274
  }
4260
4275
 
4261
4276
  .amplify-liveness-oval-canvas {
@@ -67,6 +67,13 @@ export interface CollectionBaseProps<Item> extends CollectionChildren<Item> {
67
67
  }
68
68
  export type ListCollectionProps<Item> = Omit<BaseFlexProps, 'children'> & CollectionBaseProps<Item>;
69
69
  export type GridCollectionProps<Item> = Omit<BaseGridProps, 'children'> & CollectionBaseProps<Item>;
70
+ export type TableCollectionProps<Item> = Omit<BaseGridProps, 'children'> & CollectionBaseProps<Item> & {
71
+ /**
72
+ * @description
73
+ * Custom table header component to be rendered at the top of the table
74
+ */
75
+ tableHeader: () => React.ReactNode;
76
+ };
70
77
  /**
71
78
  * Omits `React.ReactNode` as children to prevent intersection type for `children` of
72
79
  * `React.ReactNode & (item: Item, index: number) => React.JSX.Element`
@@ -78,7 +85,9 @@ export type BaseCollectionProps<Item, Element extends ElementType> = PrimitivePr
78
85
  type: 'list';
79
86
  } & ListCollectionProps<Item>, Item> | ReplaceChildren<{
80
87
  type: 'grid';
81
- } & GridCollectionProps<Item>, Item>);
88
+ } & GridCollectionProps<Item>, Item> | ReplaceChildren<{
89
+ type: 'table';
90
+ } & TableCollectionProps<Item>, Item>);
82
91
  export type CollectionProps<Item, Element extends ElementType = 'div'> = ReplaceChildren<PrimitiveProps<BaseCollectionProps<Item, Element> & {
83
92
  children: React.ReactNode;
84
93
  }, Element>, Item>;
@@ -1 +1 @@
1
- export declare const VERSION = "6.11.2";
1
+ export declare const VERSION = "6.12.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react",
3
- "version": "6.11.2",
3
+ "version": "6.12.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {