@commercetools-uikit/data-table 16.7.4 → 16.8.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.
@@ -22,6 +22,7 @@ var _styled = require('@emotion/styled/base');
22
22
  var react = require('@emotion/react');
23
23
  var designSystem = require('@commercetools-uikit/design-system');
24
24
  var AccessibleButton = require('@commercetools-uikit/accessible-button');
25
+ var _taggedTemplateLiteral = require('@babel/runtime-corejs3/helpers/taggedTemplateLiteral');
25
26
  var icons = require('@commercetools-uikit/icons');
26
27
  var jsxRuntime = require('@emotion/react/jsx-runtime');
27
28
  var _Number$isNaN = require('@babel/runtime-corejs3/core-js-stable/number/is-nan');
@@ -139,7 +140,7 @@ var _ref2 = {
139
140
  } ;
140
141
  const BaseCell = /*#__PURE__*/_styled__default["default"]("td", {
141
142
  target: "e10u1n7e2"
142
- } )("position:relative;display:flex;background-color:", designSystem.designTokens.colorSurface, ";border-bottom:", props => props.shouldRenderBottomBorder ? "1px solid ".concat(designSystem.designTokens.colorNeutral90, ";") : 'none', ";font-size:", designSystem.designTokens.fontSizeForTable, ";", props => props.shouldClipContent ? _ref2 : '', " ", props => props.shouldIgnoreRowClick ? _ref$1 : '', ";" + ("" ));
143
+ } )("position:relative;display:flex;background-color:", designSystem.designTokens.colorSurface, ";border-bottom:", props => props.shouldRenderBottomBorder ? "1px solid ".concat(designSystem.designTokens.colorNeutral95, ";") : 'none', ";font-size:", designSystem.designTokens.fontSizeForTable, ";", props => props.shouldClipContent ? _ref2 : '', " ", props => props.shouldIgnoreRowClick ? _ref$1 : '', ";" + ("" ));
143
144
  /*#__PURE__*/_styled__default["default"]("td", {
144
145
  target: "e10u1n7e1"
145
146
  } )("position:", props => props.disableFooterStickiness ? 'relative' : 'sticky', ";left:0;bottom:0;grid-column:1/", props => props.numberOfColumns, ";background-color:", designSystem.designTokens.colorSurface, ";border-bottom:1px solid ", designSystem.designTokens.colorNeutral90, ";border-top:1px solid ", designSystem.designTokens.colorNeutral90, ";margin-top:-1px;" + ("" ));
@@ -147,6 +148,61 @@ const RowExpandCollapseButton = /*#__PURE__*/_styled__default["default"](Accessi
147
148
  target: "e10u1n7e0"
148
149
  } )("cursor:", props => props.isRowCollapsed ? /*#__PURE__*/react.css("" , "" ) : /*#__PURE__*/react.css("" , "" ), ";position:absolute;height:16px;width:16px;bottom:0;right:0;opacity:0;display:flex;justify-content:flex-end;align-items:flex-end;" + ("" ));
149
150
 
151
+ var _templateObject, _templateObject2, _templateObject3;
152
+ const getButtonStyle = () => /*#__PURE__*/react.css("cursor:pointer;border:none;background:none;text-decoration:none;color:inherit;font:inherit;font-size:", designSystem.designTokens.fontSize10, ";font-family:inherit;" + ("" ), "" );
153
+
154
+ /* When a sortable header is deselected,
155
+ * (i.e. when another sortable header is selected)
156
+ * the AngleUpDown is animated with fadeIn
157
+ *
158
+ * When the user hovers over a sortable header that
159
+ * is not the active sorted column, the icon for
160
+ * the current sort direction is animated with fadeIn
161
+ */
162
+ const fadeIn = react.keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n"])));
163
+
164
+ /* When a sortable header is activated/selected,
165
+ * and the sort direction is 'desc', the ArrowDown
166
+ * icon is animated with rotateClockwise
167
+ */
168
+ const rotateClockwise = react.keyframes(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n from {\n transform: rotate(-180deg);\n } to {\n transform: rotate(0deg);\n }\n"])));
169
+
170
+ /* When a sortable header is activated/selected,
171
+ * and the sort direction is 'asc', the ArrowUp
172
+ * icon is animated with rotateCounterClockwise
173
+ */
174
+ const rotateCounterClockwise = react.keyframes(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n from {\n transform: rotate(180deg);\n } to {\n transform: rotate(0deg);\n }\n"])));
175
+
176
+ /* A sortable header has the two arrow svg icons
177
+ * GIVEN column is sortable and is not focused
178
+ * THEN AngleUpDown icon is shown (default behaviour)
179
+ * AND ArrowUp or ArrowDown icon is not shown
180
+ *
181
+ * GIVEN column is sortable and foucsed or hovered
182
+ * THEN AngleUpDown icon is hidden
183
+ * AND ArrowUp or ArrowDown icon is shown
184
+ */
185
+
186
+ const getSortableHeaderStyles = props => /*#__PURE__*/react.css("width:100%;display:flex;align-items:center;svg[data-icon-state='inactive'],svg[data-icon-state='active']{margin-left:", designSystem.designTokens.spacing10, ";flex-shrink:0;}svg[data-icon-state='inactive']{display:", props.isActive ? 'none' : 'inline-block', ";animation:", fadeIn, " 150ms ease-in-out;}svg[data-icon-state='active']{display:", props.isActive ? 'inline-block' : 'none', ";animation:", props.isActive && /*#__PURE__*/react.css(props.label === 'asc' ? rotateCounterClockwise : rotateClockwise, " 150ms ease-in-out;" + ("" ), "" ), ";}>svg *{fill:", designSystem.designTokens.colorNeutral60, "!important;}:hover,:focus{svg[data-icon-state='inactive']{display:none;}svg[data-icon-state='active']{display:inline-block;animation:", !props.isActive && /*#__PURE__*/react.css(fadeIn, " 150ms ease-in-out;" + ("" ), "" ), ";}}" + ("" ), "" );
187
+ const HeaderCellInner = /*#__PURE__*/_styled__default["default"]("div", {
188
+ target: "e1ipt8n24"
189
+ } )("box-sizing:border-box;display:flex;justify-content:flex-start;padding:0 ", props => props.isCondensed ? designSystem.designTokens.paddingForTableHeaderAsCondensed : designSystem.designTokens.paddingForTableHeader, ";", getCellInnerStyles, " ", props => props.isSortable ? getSortableHeaderStyles(props) : '', ";", props => props.as === 'button' ? getButtonStyle() : '', ";", props => props.shouldWrap ? '' : 'white-space: nowrap', ";" + ("" ));
190
+ const BaseHeaderCell = /*#__PURE__*/_styled__default["default"]("th", {
191
+ target: "e1ipt8n23"
192
+ } )("color:", designSystem.designTokens.colorNeutral40, ";background-color:", designSystem.designTokens.colorNeutral98, ";position:", props => props.disableHeaderStickiness ? 'relative' : 'sticky', ";top:0;z-index:1;line-height:", designSystem.designTokens.lineHeightForTableHeader, ";padding:0;font-weight:", designSystem.designTokens.fontWeight500, ";font-size:", designSystem.designTokens.fontSize10, ";:after{content:'';position:absolute;z-index:-1;width:100%;height:", designSystem.designTokens.borderWidth1, ";bottom:0;left:0;background-color:", designSystem.designTokens.colorNeutral95, ";}:hover,:active{z-index:2;}", HeaderCellInner, "{", props => props.shouldClipContent ? 'overflow: hidden;' : '', ";}" + ("" ));
193
+ const HeaderLabelWrapper = /*#__PURE__*/_styled__default["default"]("div", {
194
+ target: "e1ipt8n22"
195
+ } )("display:inline-flex;min-height:1.4em;margin:", designSystem.designTokens.marginForTableHeader, " 0;flex:0 0 fit-content;" + ("" ));
196
+ const HeaderLabelTextWrapper = /*#__PURE__*/_styled__default["default"]("span", {
197
+ target: "e1ipt8n21"
198
+ } )({
199
+ name: "1onapuj",
200
+ styles: "display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere"
201
+ } );
202
+ const HeaderIconWrapper = /*#__PURE__*/_styled__default["default"]("div", {
203
+ target: "e1ipt8n20"
204
+ } )("display:inline-flex;align-items:center;justify-content:center;margin-left:", designSystem.designTokens.spacing20, ";vertical-align:middle;" + ("" ));
205
+
150
206
  const convertNumericDimensionToPixelValue = dimensionValue => typeof dimensionValue === 'number' ? "".concat(dimensionValue, "px") : dimensionValue;
151
207
  var convertNumericDimensionToPixelValue$1 = convertNumericDimensionToPixelValue;
152
208
 
@@ -168,7 +224,7 @@ const getDisabledSelfContainmentStyles = props => {
168
224
  };
169
225
  const TableContainer = /*#__PURE__*/_styled__default["default"]("div", {
170
226
  target: "epk01s24"
171
- } )("position:relative;z-index:0;", props =>
227
+ } )("position:relative;z-index:0;box-shadow:", designSystem.designTokens.boxShadowForTable, ";border:1px solid ", designSystem.designTokens.colorNeutral95, ";border-radius:", designSystem.designTokens.borderRadius4, ";", props =>
172
228
  // this is needed in order to have a sticky header
173
229
  props.maxHeight ? "overflow-x: auto;" : '', " ", props => props.maxWidth && !props.disableSelfContainment ? "max-width: ".concat(convertNumericDimensionToPixelValue$1(props.maxWidth), ";") : '', " ", props => props.isBeingResized && "\n * {\n user-select: none;\n }", " ", getDisabledSelfContainmentStyles, ";" + ("" ));
174
230
  const TableGrid = /*#__PURE__*/_styled__default["default"]("table", {
@@ -181,10 +237,7 @@ const TableGrid = /*#__PURE__*/_styled__default["default"]("table", {
181
237
  props.maxHeight ? "overflow-y: auto;" : '', " ", props => props.maxHeight && !props.disableSelfContainment ? "max-height: ".concat(convertNumericDimensionToPixelValue$1(props.maxHeight), ";") : '', " ", props => props.resizedTotalWidth ? "max-width: ".concat(props.resizedTotalWidth, "px;") : '', " ", getDisabledSelfContainmentStyles, ";" + ("" ));
182
238
  const TableHeader = /*#__PURE__*/_styled__default["default"]("thead", {
183
239
  target: "epk01s22"
184
- } )({
185
- name: "49aokf",
186
- styles: "display:contents"
187
- } );
240
+ } )("display:contents;:hover{", BaseHeaderCell, ":before{content:'';position:absolute;border-right:1px solid ", designSystem.designTokens.colorNeutral, ";top:", designSystem.designTokens.spacing20, ";right:0;bottom:", designSystem.designTokens.spacing20, ";}", BaseHeaderCell, ":last-child:before{display:none;}}" + ("" ));
188
241
  const TableBody = /*#__PURE__*/_styled__default["default"]("tbody", {
189
242
  target: "epk01s21"
190
243
  } )({
@@ -205,32 +258,6 @@ Footer.displayName = 'Footer';
205
258
  Footer.defaultProps = defaultProps$4;
206
259
  var Footer$1 = Footer;
207
260
 
208
- const getButtonStyle = () => /*#__PURE__*/react.css("cursor:pointer;border:none;background:none;text-decoration:none;color:inherit;font:inherit;font-size:", designSystem.designTokens.fontSizeForTable, ";font-family:inherit;" + ("" ), "" );
209
-
210
- /* A sortable header has the two arrow svg icons
211
- * GIVEN column is sortable and is not focused
212
- * THEN AngleUpDown icon is shown (default behaviour)
213
- * AND AngleUp or AngleDown icon is not shown
214
- *
215
- * GIVEN column is sortable and foucsed
216
- * THEN AngleUpDown icon is hidden
217
- * AND AngleUp or AngleDown icon is shown
218
- */
219
-
220
- const getSortableHeaderStyles = props => /*#__PURE__*/react.css("width:100%;display:flex;align-items:center;svg[data-icon-state='inactive'],svg[data-icon-state='active']{margin-left:", designSystem.designTokens.spacing20, ";flex-shrink:0;}svg[data-icon-state='inactive']{display:", props.isActive ? 'none' : 'inline-block', ";}svg[data-icon-state='active']{display:", props.isActive ? 'inline-block' : 'none', ";}>svg *{fill:", designSystem.designTokens.fontColorForTableHeader, "!important;}:hover,:focus{svg[data-icon-state='inactive']{display:none;}svg[data-icon-state='active']{display:inline-block;}}" + ("" ), "" );
221
- const HeaderCellInner = /*#__PURE__*/_styled__default["default"]("div", {
222
- target: "e1ipt8n23"
223
- } )("box-sizing:border-box;display:flex;justify-content:space-between;padding:0 ", props => props.isCondensed ? designSystem.designTokens.paddingForTableHeaderAsCondensed : designSystem.designTokens.paddingForTableHeader, ";", getCellInnerStyles, " ", props => props.isSortable ? getSortableHeaderStyles(props) : '', ";", props => props.as === 'button' ? getButtonStyle() : '', ";", props => props.shouldWrap ? '' : 'white-space: nowrap', ";" + ("" ));
224
- const BaseHeaderCell = /*#__PURE__*/_styled__default["default"]("th", {
225
- target: "e1ipt8n22"
226
- } )("color:", designSystem.designTokens.fontColorForTableHeader, ";background-color:", designSystem.designTokens.backgroundColorForTableHeader, ";position:", props => props.disableHeaderStickiness ? 'relative' : 'sticky', ";top:0;z-index:1;line-height:", designSystem.designTokens.lineHeightForTableHeader, ";padding:0;font-weight:", designSystem.designTokens.fontWeightForTableHeader, ";font-size:", designSystem.designTokens.fontSizeForTable, ";box-shadow:inset -1px 0 ", designSystem.designTokens.borderColorForTableHeader, ";:hover,:active{z-index:2;}", HeaderCellInner, "{", props => props.shouldClipContent ? 'overflow: hidden;' : '', ";}" + ("" ));
227
- const HeaderLabelWrapper = /*#__PURE__*/_styled__default["default"]("div", {
228
- target: "e1ipt8n21"
229
- } )("min-height:1.4em;margin:", designSystem.designTokens.marginForTableHeader, " 0;flex:1;" + ("" ));
230
- const HeaderIconWrapper = /*#__PURE__*/_styled__default["default"]("div", {
231
- target: "e1ipt8n20"
232
- } )("display:inline-flex;align-items:center;justify-content:center;margin-left:", designSystem.designTokens.spacing20, ";vertical-align:middle;" + ("" ));
233
-
234
261
  const ResizerIndicator = /*#__PURE__*/_styled__default["default"]("div", {
235
262
  target: "e1ccic7f1"
236
263
  } )("height:100%;width:3px;background:", designSystem.designTokens.colorInfo, ";visibility:hidden;cursor:col-resize;", (props // extra 1px of height to appear above the bottom horizontal row border
@@ -310,7 +337,7 @@ const HeaderCell = props => {
310
337
  if (props.isSortable) {
311
338
  const isActive = props.sortedBy === props.columnKey;
312
339
  const nextSortDirection = !isActive || props.sortDirection === 'desc' ? 'asc' : 'desc';
313
- SortingIcon = props.sortDirection === 'desc' ? icons.AngleDownIcon : icons.AngleUpIcon;
340
+ SortingIcon = props.sortDirection === 'desc' ? icons.ArrowDownIcon : icons.ArrowUpIcon;
314
341
  sortableHeaderProps = {
315
342
  as: 'button',
316
343
  label: props.sortDirection,
@@ -331,7 +358,9 @@ const HeaderCell = props => {
331
358
  horizontalCellAlignment: props.horizontalCellAlignment
332
359
  }, sortableHeaderProps), {}, {
333
360
  children: [jsxRuntime.jsxs(HeaderLabelWrapper, {
334
- children: [props.children, props.iconComponent && jsxRuntime.jsx(HeaderIconWrapper, {
361
+ children: [jsxRuntime.jsx(HeaderLabelTextWrapper, {
362
+ children: props.children
363
+ }), props.iconComponent && jsxRuntime.jsx(HeaderIconWrapper, {
335
364
  children: props.iconComponent
336
365
  })]
337
366
  }), props.isSortable && jsxRuntime.jsxs(jsxRuntime.Fragment, {
@@ -721,7 +750,7 @@ DataTable.displayName = 'DataTable';
721
750
  var DataTable$1 = DataTable;
722
751
 
723
752
  // NOTE: This string will be replaced on build time with the package version.
724
- var version = "16.7.4";
753
+ var version = "16.8.0";
725
754
 
726
755
  Object.defineProperty(exports, 'useRowSelection', {
727
756
  enumerable: true,