@carbon/ibm-products 1.32.1 → 1.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. package/css/index-full-carbon.css +132 -13
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +5 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +6 -2
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +5 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +132 -13
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +5 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +132 -13
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +5 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/CreateTearsheetNarrow/CreateTearsheetNarrow.js +2 -2
  18. package/es/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +4 -3
  19. package/es/components/Datagrid/Datagrid/DatagridContent.js +29 -6
  20. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +84 -38
  21. package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +2 -2
  22. package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleMultipleKeys.js +21 -0
  23. package/es/components/Datagrid/utils/getInlineEditColumns.js +25 -7
  24. package/es/components/Datagrid/utils/makeData.js +10 -1
  25. package/lib/components/CreateTearsheetNarrow/CreateTearsheetNarrow.js +2 -2
  26. package/lib/components/DataSpreadsheet/hooks/useMultipleKeyTracking.js +4 -3
  27. package/lib/components/Datagrid/Datagrid/DatagridContent.js +28 -4
  28. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +84 -38
  29. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +2 -2
  30. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleMultipleKeys.js +22 -0
  31. package/lib/components/Datagrid/utils/getInlineEditColumns.js +25 -7
  32. package/lib/components/Datagrid/utils/makeData.js +10 -1
  33. package/package.json +2 -2
  34. package/scss/components/Datagrid/_storybook-styles.scss +7 -0
  35. package/scss/components/Datagrid/styles/_datagrid.scss +0 -5
  36. package/scss/components/Datagrid/styles/_useInlineEdit.scss +177 -2
  37. package/scss/components/InlineEdit/_inline-edit.scss +4 -2
@@ -41,25 +41,43 @@ var getInlineEditColumns = function getInlineEditColumns() {
41
41
  accessor: 'firstName',
42
42
  inlineEdit: {
43
43
  type: 'text',
44
- inputProps: {} // These props are passed to the Carbon component used for inline editing
45
-
44
+ // required for including validation, this is used to set the invalid prop internally
45
+ validator: function validator(n) {
46
+ return n.length >= 40;
47
+ },
48
+ // These props are passed to the Carbon component used for inline editing
49
+ inputProps: {
50
+ invalidText: 'Invalid text, character count must be less than 40'
51
+ }
46
52
  }
47
53
  }, {
48
54
  Header: 'Last Name',
49
55
  accessor: 'lastName',
50
56
  inlineEdit: {
51
57
  type: 'text',
52
- inputProps: {} // These props are passed to the Carbon component used for inline editing
53
-
58
+ // required for including validation, this is used to set the invalid prop internally
59
+ validator: function validator(n) {
60
+ return n.length >= 40;
61
+ },
62
+ // These props are passed to the Carbon component used for inline editing
63
+ inputProps: {
64
+ invalidText: 'Invalid text, character count must be less than 40'
65
+ }
54
66
  }
55
67
  }, {
56
68
  Header: 'Age',
57
69
  accessor: 'age',
58
70
  width: 120,
59
71
  inlineEdit: {
72
+ // required for including validation, this is used to set the invalid prop internally
73
+ validator: function validator(n) {
74
+ return n && n < 18;
75
+ },
60
76
  type: 'number',
61
- inputProps: {} // These props are passed to the Carbon component used for inline editing
62
-
77
+ // These props are passed to the Carbon component used for inline editing
78
+ inputProps: {
79
+ invalidText: 'Invalid number, must be 18 or greater'
80
+ }
63
81
  }
64
82
  }, {
65
83
  Header: 'Visits',
@@ -96,7 +114,7 @@ var getInlineEditColumns = function getInlineEditColumns() {
96
114
  // These props are passed to the Carbon component used for inline editing
97
115
  items: inlineEditSelectItems,
98
116
  onChange: function onChange(item) {
99
- return console.log(item);
117
+ console.log(item);
100
118
  }
101
119
  }
102
120
  }
@@ -76,6 +76,14 @@ var renderStatusIcon = function renderStatusIcon(statusChance) {
76
76
  return /*#__PURE__*/_react.default.createElement(_StatusIcon.StatusIcon, iconProps);
77
77
  };
78
78
 
79
+ var renderDocLink = function renderDocLink(statusChance) {
80
+ var docLinkObj = {
81
+ href: statusChance > 0.66 ? 'http://carbondesignsystem.com/' : statusChance > 0.33 ? 'https://pages.github.ibm.com/cdai-design/pal/' : 'http://carbon-for-ibm-products.netlify.app/',
82
+ text: statusChance > 0.66 ? 'Carbon Design System' : statusChance > 0.33 ? 'Carbon for IBM Products PAL' : 'Carbon for IBM Products storybook'
83
+ };
84
+ return docLinkObj;
85
+ };
86
+
79
87
  var newPerson = function newPerson() {
80
88
  var statusChance = Math.random();
81
89
  var initialChartTypeIndex = getRandomInteger(0, 2);
@@ -180,7 +188,8 @@ var newPerson = function newPerson() {
180
188
  chartType: initialChartTypeIndex === 0 ? _getInlineEditColumns.inlineEditSelectItems[0] : initialChartTypeIndex === 1 ? _getInlineEditColumns.inlineEditSelectItems[1] : _getInlineEditColumns.inlineEditSelectItems[2],
181
189
  activeSince: statusChance > 0.66 ? activeSinceDate : statusChance > 0.33 ? yesterdayDate : twoDaysAgoDate,
182
190
  bonus: "$\r".concat(getRandomInteger(100, 500, 2)),
183
- status_icon: renderStatusIcon(statusChance)
191
+ status_icon: renderStatusIcon(statusChance),
192
+ doc_link: renderDocLink(statusChance)
184
193
  };
185
194
  };
186
195
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "1.32.1",
4
+ "version": "1.33.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -93,5 +93,5 @@
93
93
  "react": "^16.8.6 || ^17.0.1",
94
94
  "react-dom": "^16.8.6 || ^17.0.1"
95
95
  },
96
- "gitHead": "829c3e97ae9b2412f7fcb1859dc8dd8b019963ee"
96
+ "gitHead": "1ac4bda25833dab9426808f9d397d0ea4c5534e4"
97
97
  }
@@ -86,3 +86,10 @@ $block-class: #{$pkg-prefix}--datagrid;
86
86
  .#{$pkg-prefix}--side-panel__inner-content {
87
87
  height: 100%;
88
88
  }
89
+
90
+ .#{$block-class}-story__custom-cell-wrapper.#{$carbon-prefix}--link {
91
+ display: block;
92
+ overflow: hidden;
93
+ text-overflow: ellipsis;
94
+ white-space: nowrap;
95
+ }
@@ -523,8 +523,3 @@
523
523
  .#{$block-class} .#{$pkg-prefix}--button-menu {
524
524
  height: $spacing-09;
525
525
  }
526
-
527
- .#{$block-class} .#{$block-class}__table-grid-active {
528
- border: 2px solid $inverse-link;
529
- outline: 0;
530
- }
@@ -38,7 +38,7 @@ $row-heights: (
38
38
  .#{$block-class}
39
39
  .#{$block-class}__inline-edit--outer-cell-button--#{$size}
40
40
  .#{$carbon-prefix}--number__control-btn::after {
41
- height: calc($size-value - 0.25rem);
41
+ height: calc(#{$size-value} - 0.25rem);
42
42
  }
43
43
  .#{$block-class}
44
44
  .#{$block-class}__inline-edit--select.#{$block-class}__inline-edit--select-#{$size}.#{$carbon-prefix}--list-box {
@@ -56,6 +56,10 @@ $row-heights: (
56
56
  }
57
57
  }
58
58
 
59
+ .#{$block-class} {
60
+ --#{$block-class}--grid-header-height: 0;
61
+ }
62
+
59
63
  .#{$block-class}__inline-edit-cell {
60
64
  display: flex;
61
65
  height: 100%;
@@ -75,6 +79,7 @@ $row-heights: (
75
79
  .#{$block-class}__inline-edit--outer-cell-button
76
80
  .#{$block-class}__inline-edit-button {
77
81
  position: relative;
82
+ z-index: 2;
78
83
  display: flex;
79
84
  width: 100%;
80
85
  height: 100%;
@@ -90,6 +95,7 @@ $row-heights: (
90
95
  }
91
96
  &.#{$block-class}__inline-edit-button--non-edit {
92
97
  padding-left: 0;
98
+ cursor: default;
93
99
  }
94
100
  .#{$block-class}__inline-edit-button-icon {
95
101
  height: $spacing-05;
@@ -211,7 +217,176 @@ $row-heights: (
211
217
  white-space: nowrap;
212
218
  }
213
219
 
214
- .#{$carbon-prefix}--data-table .#{$block-class}__carbon-row-hover-active td {
220
+ .#{$block-class}
221
+ .#{$carbon-prefix}--data-table
222
+ .#{$block-class}__carbon-row-hover-active
223
+ td {
215
224
  border-top-color: $hover-ui;
216
225
  background-color: $hover-ui;
217
226
  }
227
+
228
+ // Custom border/outline for the focus region, because of the scrolling
229
+ // containers, using default border or outline did not
230
+ .#{$block-class} .#{$block-class}__grid-container-grid-active::before {
231
+ position: absolute;
232
+ z-index: 2;
233
+ bottom: 0;
234
+ left: 0;
235
+ width: 2px;
236
+ height: calc(100% - 50px - var(--#{$block-class}--grid-header-height));
237
+ background-color: $inverse-link;
238
+ content: '';
239
+ }
240
+
241
+ .#{$block-class} .#{$block-class}__grid-container-grid-active::after {
242
+ position: absolute;
243
+ z-index: 2;
244
+ right: 0;
245
+ bottom: 0;
246
+ width: 2px;
247
+ height: calc(100% - 50px - var(--#{$block-class}--grid-header-height));
248
+ background-color: $inverse-link;
249
+ content: '';
250
+ }
251
+
252
+ .#{$block-class}
253
+ .#{$block-class}__grid-container-grid-active
254
+ .#{$carbon-prefix}--data-table-content::before {
255
+ position: absolute;
256
+ z-index: 2;
257
+ top: 0;
258
+ right: 0;
259
+ left: 0;
260
+ width: var(--#{$block-class}--grid-width);
261
+ height: 2px;
262
+ background-color: $inverse-link;
263
+ }
264
+
265
+ .#{$block-class}
266
+ .#{$block-class}__grid-container-grid-active.#{$block-class}__grid-container-grid-active--without-toolbar::before,
267
+ .#{$block-class}
268
+ .#{$block-class}__grid-container-grid-active.#{$block-class}__grid-container-grid-active--without-toolbar::after {
269
+ height: calc(100% - 2px - var(--#{$block-class}--grid-header-height));
270
+ }
271
+
272
+ .#{$block-class}
273
+ .#{$block-class}__grid-container-grid-active
274
+ .#{$block-class}__table-container {
275
+ outline: 2px solid $inverse-link;
276
+ outline-offset: -2px;
277
+ }
278
+
279
+ .#{$block-class}
280
+ .#{$block-class}__grid-container-inline-edit
281
+ .#{$block-class}__table-container {
282
+ padding-top: $spacing-01;
283
+ }
284
+
285
+ .#{$block-class}
286
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
287
+ [data-invalid]
288
+ ~ .#{$carbon-prefix}--form-requirement,
289
+ .#{$block-class}
290
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
291
+ [data-invalid]
292
+ .#{$carbon-prefix}--form-requirement {
293
+ position: absolute;
294
+ z-index: 3;
295
+ top: calc(100% - #{$spacing-01});
296
+ width: 100%;
297
+ padding: $spacing-03 $spacing-06 $spacing-03 $spacing-03;
298
+ margin: 0;
299
+ background-color: $ui-01;
300
+ outline: $spacing-01 solid $danger-02;
301
+ outline-offset: calc(-1 * #{$spacing-01});
302
+ }
303
+
304
+ .#{$block-class}
305
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
306
+ .#{$carbon-prefix}--list-box[data-invalid]:focus-within
307
+ ~ .#{$carbon-prefix}--form-requirement {
308
+ outline: $spacing-01 solid $focus;
309
+ }
310
+
311
+ .#{$block-class}
312
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
313
+ .#{$carbon-prefix}--list-box__invalid-icon,
314
+ .#{$block-class}
315
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
316
+ .#{$carbon-prefix}--text-input__invalid-icon,
317
+ .#{$block-class}
318
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
319
+ .#{$carbon-prefix}--number__invalid {
320
+ z-index: 4;
321
+ top: calc(100% + #{$spacing-04} + #{$spacing-01});
322
+ right: $spacing-03;
323
+ }
324
+
325
+ .#{$block-class}
326
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
327
+ .#{$carbon-prefix}--number__invalid {
328
+ top: calc(100% + #{$spacing-02} + #{$spacing-01});
329
+ }
330
+
331
+ .#{$block-class}
332
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
333
+ .#{$carbon-prefix}--form-requirement::before {
334
+ position: absolute;
335
+ top: 0;
336
+ left: $spacing-01;
337
+ width: calc(100% - (#{$spacing-01} * 2));
338
+ height: $spacing-01;
339
+ background-color: $ui-01;
340
+ content: '';
341
+ }
342
+
343
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
344
+ .#{$carbon-prefix}--form-requirement::after {
345
+ position: absolute;
346
+ top: $spacing-01;
347
+ left: $spacing-03;
348
+ width: calc(100% - (#{$spacing-03} * 2));
349
+ height: 1px;
350
+ background-color: $ui-03;
351
+ content: '';
352
+ }
353
+
354
+ .#{$block-class} tbody tr:hover {
355
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
356
+ .#{$carbon-prefix}--form-requirement::before {
357
+ background-color: $ui-03;
358
+ }
359
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
360
+ .#{$carbon-prefix}--form-requirement::after {
361
+ background-color: transparent;
362
+ }
363
+ }
364
+
365
+ // Keep input focus states using $support-01 when inline edit cell is invalid
366
+ .#{$block-class}
367
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
368
+ .#{$carbon-prefix}--text-input:focus,
369
+ .#{$block-class}
370
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
371
+ .#{$carbon-prefix}--number
372
+ input[type='number']:focus,
373
+ .#{$block-class}
374
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
375
+ .#{$carbon-prefix}--number
376
+ input[type='number']:focus
377
+ ~ .#{$carbon-prefix}--number__controls
378
+ .#{$carbon-prefix}--number__control-btn:hover,
379
+ .#{$block-class}
380
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
381
+ .#{$carbon-prefix}--number__control-btn:focus {
382
+ outline-color: $support-01;
383
+ }
384
+
385
+ .#{$block-class}
386
+ .#{$block-class}__inline-edit--outer-cell-button--invalid
387
+ .#{$carbon-prefix}--number
388
+ input[type='number'][data-invalid]:focus
389
+ ~ .#{$carbon-prefix}--number__controls
390
+ .#{$carbon-prefix}--number__control-btn.up-icon::after {
391
+ background-color: $support-01;
392
+ }
@@ -105,9 +105,11 @@
105
105
  overflow: hidden;
106
106
  // positions text and placeholder including when showing placeholder
107
107
  // NOTE: Using flex does strange things to a caret in content editable
108
- width: calc(100% - var(--#{$block-class}--toolbar-width) - $spacing-05);
108
+ width: calc(
109
+ 100% - var(--#{$block-class}--toolbar-width) - #{$spacing-05}
110
+ );
109
111
  max-width: calc(
110
- 100% - var(--#{$block-class}--toolbar-width) - $spacing-05
112
+ 100% - var(--#{$block-class}--toolbar-width) - #{$spacing-05}
111
113
  );
112
114
  min-height: var(--#{$block-class}--size);
113
115
  /* stylelint-disable-next-line carbon/layout-token-use */