@carbon/ibm-products 1.8.0 → 1.11.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.
- package/css/index-full-carbon.css +270 -5656
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +6 -6
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +58 -3432
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +3 -3
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +238 -3922
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +6 -6
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +238 -3923
- package/css/index.css.map +1 -1
- package/css/index.min.css +6 -6
- package/css/index.min.css.map +1 -1
- package/es/components/AddSelect/AddSelect.js +147 -53
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +4 -4
- package/es/components/AddSelect/AddSelectColumn.js +195 -0
- package/es/components/AddSelect/AddSelectList.js +67 -8
- package/es/components/AddSelect/AddSelectSidebar.js +8 -15
- package/es/components/AddSelect/add-select-utils.js +64 -0
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -1
- package/es/components/ButtonMenu/ButtonMenu.js +1 -1
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +505 -167
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +244 -17
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +74 -8
- package/es/components/DataSpreadsheet/hooks/useMoveActiveCell.js +27 -0
- package/es/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +28 -0
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +41 -0
- package/es/components/DataSpreadsheet/utils/checkActiveHeaderCell.js +34 -0
- package/es/components/DataSpreadsheet/utils/createActiveCellFn.js +58 -0
- package/es/components/DataSpreadsheet/utils/createCellSelectionArea.js +49 -0
- package/es/components/DataSpreadsheet/{generateData.js → utils/generateData.js} +6 -0
- package/es/components/DataSpreadsheet/{getCellSize.js → utils/getCellSize.js} +0 -0
- package/es/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +46 -0
- package/es/components/DataSpreadsheet/utils/handleMultipleKeys.js +82 -0
- package/es/components/DataSpreadsheet/utils/removeCellSelections.js +30 -0
- package/es/components/InlineEdit/InlineEdit.js +80 -39
- package/es/components/OptionsTile/OptionsTile.js +31 -21
- package/es/components/OptionsTile/index.js +1 -1
- package/es/components/PageHeader/PageHeader.js +26 -15
- package/es/components/PageHeader/PageHeaderTitle.js +2 -1
- package/es/components/PageHeader/PageHeaderUtils.js +24 -29
- package/es/components/TagSet/TagSet.js +12 -3
- package/es/components/UserProfileImage/UserProfileImage.js +2 -1
- package/es/global/js/utils/DisplayBox.js +31 -0
- package/es/global/js/utils/deepCloneObject.js +26 -0
- package/lib/components/AddSelect/AddSelect.js +150 -54
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +2 -3
- package/lib/components/AddSelect/AddSelectColumn.js +219 -0
- package/lib/components/AddSelect/AddSelectList.js +65 -8
- package/lib/components/AddSelect/AddSelectSidebar.js +14 -15
- package/lib/components/AddSelect/add-select-utils.js +78 -0
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -1
- package/lib/components/ButtonMenu/ButtonMenu.js +1 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +514 -170
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +251 -18
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +82 -9
- package/lib/components/DataSpreadsheet/hooks/useMoveActiveCell.js +37 -0
- package/lib/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +39 -0
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +52 -0
- package/lib/components/DataSpreadsheet/utils/checkActiveHeaderCell.js +45 -0
- package/lib/components/DataSpreadsheet/{createActiveCellFn.js → utils/createActiveCellFn.js} +22 -9
- package/lib/components/DataSpreadsheet/utils/createCellSelectionArea.js +60 -0
- package/lib/components/DataSpreadsheet/{generateData.js → utils/generateData.js} +6 -0
- package/lib/components/DataSpreadsheet/{getCellSize.js → utils/getCellSize.js} +0 -0
- package/lib/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +59 -0
- package/lib/components/DataSpreadsheet/utils/handleMultipleKeys.js +92 -0
- package/lib/components/DataSpreadsheet/utils/removeCellSelections.js +41 -0
- package/lib/components/InlineEdit/InlineEdit.js +82 -40
- package/lib/components/OptionsTile/OptionsTile.js +30 -20
- package/lib/components/PageHeader/PageHeader.js +25 -15
- package/lib/components/PageHeader/PageHeaderTitle.js +2 -1
- package/lib/components/PageHeader/PageHeaderUtils.js +24 -29
- package/lib/components/TagSet/TagSet.js +13 -3
- package/lib/components/UserProfileImage/UserProfileImage.js +2 -1
- package/lib/global/js/utils/DisplayBox.js +46 -0
- package/lib/global/js/utils/deepCloneObject.js +37 -0
- package/package.json +17 -17
- package/scss/components/ActionBar/_storybook-styles.scss +8 -0
- package/scss/components/ActionSet/_storybook-styles.scss +1 -3
- package/scss/components/AddSelect/_add-select.scss +99 -14
- package/scss/components/BreadcrumbWithOverflow/_breadcrumb-with-overflow.scss +7 -3
- package/scss/components/BreadcrumbWithOverflow/_storybook-styles.scss +8 -0
- package/scss/components/ButtonSetWithOverflow/_storybook-styles.scss +8 -0
- package/scss/components/CreateInfluencer/_create-influencer.scss +2 -0
- package/scss/components/CreateModal/_create-modal.scss +1 -0
- package/scss/components/CreateSidePanel/_create-side-panel.scss +1 -1
- package/scss/components/CreateSidePanel/_storybook-styles.scss +1 -1
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +1 -0
- package/scss/components/CreateTearsheetNarrow/_create-tearsheet-narrow.scss +1 -0
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +42 -6
- package/scss/components/EditSidePanel/_edit-side-panel.scss +9 -0
- package/scss/components/EditSidePanel/_storybook-styles.scss +1 -1
- package/scss/components/InlineEdit/_inline-edit.scss +53 -43
- package/scss/components/InlineEdit/_storybook-styles.scss +2 -0
- package/scss/components/LoadingBar/_loading-bar.scss +13 -0
- package/scss/components/NotificationsPanel/_notifications-panel.scss +3 -0
- package/scss/components/OptionsTile/_index.scss +1 -1
- package/scss/components/OptionsTile/_options-tile.scss +17 -17
- package/scss/components/OptionsTile/_storybook-styles.scss +4 -4
- package/scss/components/PageHeader/_page-header.scss +5 -2
- package/scss/components/SidePanel/_side-panel.scss +19 -12
- package/scss/components/StatusIcon/_status-icon.scss +1 -0
- package/scss/components/TagSet/_storybook-styles.scss +8 -0
- package/scss/components/Tearsheet/_tearsheet.scss +1 -2
- package/scss/components/UserProfileImage/_user-profile-image.scss +9 -0
- package/scss/components/WebTerminal/_web-terminal.scss +2 -0
- package/scss/global/styles/_display-box.scss +62 -0
- package/es/components/DataSpreadsheet/createActiveCellFn.js +0 -45
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
// stylelint-disable-next-line carbon/layout-token-use
|
|
27
27
|
transform: translateY(-38.5rem); // the height of the notification panel
|
|
28
28
|
}
|
|
29
|
+
|
|
29
30
|
100% {
|
|
30
31
|
opacity: 1;
|
|
31
32
|
transform: translateY(0);
|
|
@@ -37,6 +38,7 @@
|
|
|
37
38
|
opacity: 1;
|
|
38
39
|
transform: translateY(0);
|
|
39
40
|
}
|
|
41
|
+
|
|
40
42
|
100% {
|
|
41
43
|
opacity: 0;
|
|
42
44
|
// stylelint-disable-next-line carbon/layout-token-use
|
|
@@ -204,6 +206,7 @@
|
|
|
204
206
|
padding: 0;
|
|
205
207
|
color: $text-01;
|
|
206
208
|
opacity: 0;
|
|
209
|
+
|
|
207
210
|
&:hover,
|
|
208
211
|
&:focus {
|
|
209
212
|
opacity: 1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright IBM Corp. 2021,
|
|
2
|
+
// Copyright IBM Corp. 2021, 2022
|
|
3
3
|
//
|
|
4
4
|
// This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
// Other Carbon settings.
|
|
13
13
|
@import 'carbon-components/scss/globals/scss/helper-mixins';
|
|
14
14
|
|
|
15
|
+
// PageHeader uses the following Carbon components:
|
|
16
|
+
// Toggle
|
|
17
|
+
@import 'carbon-components/scss/components/toggle/toggle';
|
|
18
|
+
|
|
15
19
|
// Define all component styles in a mixin which is then exported using
|
|
16
20
|
// the Carbon import-once mechanism.
|
|
17
21
|
@mixin options-tile {
|
|
@@ -44,7 +48,7 @@
|
|
|
44
48
|
box-sizing: border-box;
|
|
45
49
|
align-items: center;
|
|
46
50
|
padding-right: $spacing-05;
|
|
47
|
-
grid-template-columns: 3rem 1fr
|
|
51
|
+
grid-template-columns: 3rem 1fr 2rem; // chevron container, heading, toggle width
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
.#{$block-class}__header {
|
|
@@ -53,6 +57,10 @@
|
|
|
53
57
|
transition: background-color $duration--fast-01 motion(entrance, productive);
|
|
54
58
|
}
|
|
55
59
|
|
|
60
|
+
.#{$block-class}__header::-webkit-details-marker {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
56
64
|
.#{$block-class}__header:hover {
|
|
57
65
|
background-color: $hover-ui;
|
|
58
66
|
}
|
|
@@ -61,11 +69,11 @@
|
|
|
61
69
|
@include focus-outline('outline');
|
|
62
70
|
}
|
|
63
71
|
|
|
64
|
-
.#{$block-class}
|
|
72
|
+
.#{$block-class}__heading {
|
|
65
73
|
grid-column: 2;
|
|
66
74
|
}
|
|
67
75
|
|
|
68
|
-
.#{$block-class}
|
|
76
|
+
.#{$block-class}__title {
|
|
69
77
|
@include carbon--type-style('productive-heading-01');
|
|
70
78
|
|
|
71
79
|
color: $text-01;
|
|
@@ -88,7 +96,7 @@
|
|
|
88
96
|
.#{$block-class}__summary--warn,
|
|
89
97
|
.#{$block-class}__summary--locked {
|
|
90
98
|
column-gap: $spacing-02;
|
|
91
|
-
grid-template-columns: 1rem 1fr;
|
|
99
|
+
grid-template-columns: 1rem 1fr; // icon, text
|
|
92
100
|
}
|
|
93
101
|
|
|
94
102
|
.#{$block-class}__summary--invalid {
|
|
@@ -110,11 +118,15 @@
|
|
|
110
118
|
.#{$block-class}__summary-text {
|
|
111
119
|
overflow: hidden;
|
|
112
120
|
height: max-content;
|
|
121
|
+
// spacing-05 + toggle width
|
|
122
|
+
// stylelint-disable-next-line carbon/layout-token-use
|
|
123
|
+
padding-right: calc(#{$spacing-05} + 2rem);
|
|
113
124
|
text-overflow: ellipsis;
|
|
114
125
|
white-space: nowrap;
|
|
115
126
|
}
|
|
116
127
|
|
|
117
128
|
.#{$block-class}__chevron {
|
|
129
|
+
display: block;
|
|
118
130
|
justify-self: center;
|
|
119
131
|
transition: transform $duration--fast-02 motion(standard, productive);
|
|
120
132
|
}
|
|
@@ -195,18 +207,6 @@
|
|
|
195
207
|
margin-top: $spacing-01;
|
|
196
208
|
}
|
|
197
209
|
|
|
198
|
-
.#{$block-class}--lg .#{$block-class}__summary-text {
|
|
199
|
-
// spacing-05 + toggle width
|
|
200
|
-
// stylelint-disable-next-line carbon/layout-token-use
|
|
201
|
-
padding-right: calc(#{$spacing-05} + 1rem);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.#{$block-class}--xl .#{$block-class}__summary-text {
|
|
205
|
-
// spacing-05 + toggle width
|
|
206
|
-
// stylelint-disable-next-line carbon/layout-token-use
|
|
207
|
-
padding-right: calc(#{$spacing-05} + 2rem);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
210
|
@media (prefers-reduced-motion: reduce) {
|
|
211
211
|
.#{$block-class}__summary,
|
|
212
212
|
.#{$block-class}__chevron {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright IBM Corp. 2021,
|
|
2
|
+
// Copyright IBM Corp. 2021, 2022
|
|
3
3
|
//
|
|
4
4
|
// This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
$block-class: #{$pkg-prefix}--options-tile;
|
|
11
11
|
|
|
12
12
|
.#{$block-class} {
|
|
13
|
-
width:
|
|
14
|
-
min-width:
|
|
15
|
-
max-width:
|
|
13
|
+
width: 80vw;
|
|
14
|
+
min-width: 16rem;
|
|
15
|
+
max-width: 48rem;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
.#{$block-class}__content p {
|
|
@@ -41,6 +41,7 @@ $right-section-alt-width: 100% - $left-section-alt-width;
|
|
|
41
41
|
from {
|
|
42
42
|
background-color: var(--from-color);
|
|
43
43
|
}
|
|
44
|
+
|
|
44
45
|
to {
|
|
45
46
|
background-color: var(--to-color);
|
|
46
47
|
}
|
|
@@ -50,6 +51,7 @@ $right-section-alt-width: 100% - $left-section-alt-width;
|
|
|
50
51
|
background-color: var(--from-color);
|
|
51
52
|
box-shadow: 0 1px 0 var(--from-color);
|
|
52
53
|
}
|
|
54
|
+
|
|
53
55
|
to {
|
|
54
56
|
background-color: var(--to-color);
|
|
55
57
|
box-shadow: 0 1px 0 var(--to-color-shadow);
|
|
@@ -207,8 +209,8 @@ $right-section-alt-width: 100% - $left-section-alt-width;
|
|
|
207
209
|
.#{$block-class}__breadcrumb-row--has-breadcrumbs
|
|
208
210
|
.#{$block-class}__action-bar-column {
|
|
209
211
|
// back button displayed only
|
|
210
|
-
max-width: $
|
|
211
|
-
flex: 0 1 $
|
|
212
|
+
max-width: $right-section-alt-width;
|
|
213
|
+
flex: 0 1 $right-section-alt-width;
|
|
212
214
|
|
|
213
215
|
@include carbon--breakpoint(md) {
|
|
214
216
|
max-width: $right-section-std-width;
|
|
@@ -251,6 +253,7 @@ $right-section-alt-width: 100% - $left-section-alt-width;
|
|
|
251
253
|
}
|
|
252
254
|
|
|
253
255
|
.#{$block-class}__breadcrumb-column {
|
|
256
|
+
overflow: hidden; /* required for ellipsis in title, title not visible in breadcrumb with back arrow */
|
|
254
257
|
max-width: 100%;
|
|
255
258
|
flex: 0 0 100%;
|
|
256
259
|
|
|
@@ -31,6 +31,7 @@ $action-set-block-class: #{$pkg-prefix}--action-set;
|
|
|
31
31
|
// stylelint-disable-next-line carbon/layout-token-use
|
|
32
32
|
transform: translateX(#{$size}); // the size width of the side panel
|
|
33
33
|
}
|
|
34
|
+
|
|
34
35
|
100% {
|
|
35
36
|
opacity: 1;
|
|
36
37
|
transform: translateX(0);
|
|
@@ -45,6 +46,7 @@ $action-set-block-class: #{$pkg-prefix}--action-set;
|
|
|
45
46
|
// stylelint-disable-next-line carbon/layout-token-use
|
|
46
47
|
transform: translateX(-#{$size}); // the size width of the side panel
|
|
47
48
|
}
|
|
49
|
+
|
|
48
50
|
100% {
|
|
49
51
|
opacity: 1;
|
|
50
52
|
transform: translateX(0);
|
|
@@ -56,8 +58,8 @@ $action-set-block-class: #{$pkg-prefix}--action-set;
|
|
|
56
58
|
$placement: 'right',
|
|
57
59
|
$size: map-get($side-panel-sizes, md)
|
|
58
60
|
) {
|
|
59
|
-
|
|
60
|
-
max-width:
|
|
61
|
+
width: $size;
|
|
62
|
+
max-width: 100%;
|
|
61
63
|
@if $placement == right {
|
|
62
64
|
@include sidePanelEntranceRight($size);
|
|
63
65
|
} @else {
|
|
@@ -66,8 +68,8 @@ $action-set-block-class: #{$pkg-prefix}--action-set;
|
|
|
66
68
|
}
|
|
67
69
|
|
|
68
70
|
@mixin setPanelSize($size: map-get($side-panel-sizes, md)) {
|
|
69
|
-
|
|
70
|
-
max-width:
|
|
71
|
+
width: $size;
|
|
72
|
+
max-width: 100%;
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
@mixin setDividerStyles() {
|
|
@@ -95,6 +97,7 @@ $action-set-block-class: #{$pkg-prefix}--action-set;
|
|
|
95
97
|
opacity: 1;
|
|
96
98
|
transform: translateX(0);
|
|
97
99
|
}
|
|
100
|
+
|
|
98
101
|
100% {
|
|
99
102
|
opacity: 0;
|
|
100
103
|
// stylelint-disable-next-line carbon/layout-token-use
|
|
@@ -107,6 +110,7 @@ $action-set-block-class: #{$pkg-prefix}--action-set;
|
|
|
107
110
|
opacity: 1;
|
|
108
111
|
transform: translateX(0);
|
|
109
112
|
}
|
|
113
|
+
|
|
110
114
|
100% {
|
|
111
115
|
opacity: 0;
|
|
112
116
|
// stylelint-disable-next-line carbon/layout-token-use
|
|
@@ -183,6 +187,7 @@ $action-set-block-class: #{$pkg-prefix}--action-set;
|
|
|
183
187
|
);
|
|
184
188
|
padding: $spacing-05 $spacing-05 $spacing-03 $spacing-05;
|
|
185
189
|
background-color: $ui-01;
|
|
190
|
+
|
|
186
191
|
&::before {
|
|
187
192
|
@include setDividerStyles();
|
|
188
193
|
}
|
|
@@ -442,14 +447,14 @@ $action-set-block-class: #{$pkg-prefix}--action-set;
|
|
|
442
447
|
}
|
|
443
448
|
|
|
444
449
|
// form fields should receive correct background color
|
|
445
|
-
.#{$block-class}__container
|
|
446
|
-
.#{$block-class}__container
|
|
447
|
-
.#{$block-class}__container
|
|
448
|
-
.#{$block-class}__container
|
|
449
|
-
.#{$block-class}__container
|
|
450
|
-
.#{$block-class}__container
|
|
451
|
-
.#{$block-class}__container
|
|
452
|
-
.#{$block-class}__container
|
|
450
|
+
.#{$block-class}__container .#{$carbon-prefix}--text-input,
|
|
451
|
+
.#{$block-class}__container .#{$carbon-prefix}--text-area,
|
|
452
|
+
.#{$block-class}__container .#{$carbon-prefix}--search-input,
|
|
453
|
+
.#{$block-class}__container .#{$carbon-prefix}--select-input,
|
|
454
|
+
.#{$block-class}__container .#{$carbon-prefix}--dropdown,
|
|
455
|
+
.#{$block-class}__container .#{$carbon-prefix}--dropdown-list,
|
|
456
|
+
.#{$block-class}__container .#{$carbon-prefix}--number input[type='number'],
|
|
457
|
+
.#{$block-class}__container .#{$carbon-prefix}--date-picker__input {
|
|
453
458
|
background-color: $field-02;
|
|
454
459
|
}
|
|
455
460
|
|
|
@@ -457,6 +462,7 @@ $action-set-block-class: #{$pkg-prefix}--action-set;
|
|
|
457
462
|
0% {
|
|
458
463
|
opacity: 0;
|
|
459
464
|
}
|
|
465
|
+
|
|
460
466
|
100% {
|
|
461
467
|
opacity: 1;
|
|
462
468
|
}
|
|
@@ -466,6 +472,7 @@ $action-set-block-class: #{$pkg-prefix}--action-set;
|
|
|
466
472
|
0% {
|
|
467
473
|
opacity: 1;
|
|
468
474
|
}
|
|
475
|
+
|
|
469
476
|
100% {
|
|
470
477
|
opacity: 0;
|
|
471
478
|
}
|
|
@@ -66,6 +66,15 @@ $theme-keys: map-keys($themes);
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
.#{$carbon-prefix}--tooltip__trigger.#{$block-class}__tooltip {
|
|
70
|
+
&:hover,
|
|
71
|
+
&:focus {
|
|
72
|
+
svg {
|
|
73
|
+
fill: $ui-01;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
69
78
|
.#{$block-class} {
|
|
70
79
|
display: flex;
|
|
71
80
|
flex-direction: column;
|
|
@@ -10,6 +10,7 @@ $block-class: #{$pkg-prefix}--web-terminal;
|
|
|
10
10
|
// stylelint-disable-next-line carbon/layout-token-use
|
|
11
11
|
transform: translateX(#{$web-terminal-width});
|
|
12
12
|
}
|
|
13
|
+
|
|
13
14
|
100% {
|
|
14
15
|
opacity: 1;
|
|
15
16
|
transform: translateX(0);
|
|
@@ -21,6 +22,7 @@ $block-class: #{$pkg-prefix}--web-terminal;
|
|
|
21
22
|
opacity: 1;
|
|
22
23
|
transform: translateX(0);
|
|
23
24
|
}
|
|
25
|
+
|
|
24
26
|
100% {
|
|
25
27
|
opacity: 0;
|
|
26
28
|
// stylelint-disable-next-line carbon/layout-token-use
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright IBM Corp. 2022, 2022
|
|
3
|
+
//
|
|
4
|
+
// This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
|
6
|
+
//
|
|
7
|
+
@import '../../global/styles/project-settings';
|
|
8
|
+
|
|
9
|
+
$block-class: 'ccs-sb--display-box';
|
|
10
|
+
|
|
11
|
+
$indicator-width: $spacing-02;
|
|
12
|
+
$indicator-height: $spacing-04;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
Adds a box indicating the extent of the available space to the displayed component
|
|
16
|
+
*/
|
|
17
|
+
.#{$block-class} {
|
|
18
|
+
position: relative;
|
|
19
|
+
display: inline-block;
|
|
20
|
+
padding-top: $spacing-05; // space for the indicators
|
|
21
|
+
color: $text-05;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.#{$block-class}__indicator {
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 0;
|
|
27
|
+
width: 100%;
|
|
28
|
+
border-bottom: 1px solid $text-05;
|
|
29
|
+
white-space: nowrap;
|
|
30
|
+
@include carbon--type-style('helper-text-01');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.#{$block-class}__message {
|
|
34
|
+
position: absolute;
|
|
35
|
+
bottom: $spacing-02;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.sb-main-centered .#{$block-class}__message {
|
|
39
|
+
left: 50%;
|
|
40
|
+
min-width: 100vh;
|
|
41
|
+
text-align: center;
|
|
42
|
+
transform: translateX(-50%);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.#{$block-class}__indicator--left,
|
|
46
|
+
.#{$block-class}__indicator--right {
|
|
47
|
+
position: absolute;
|
|
48
|
+
bottom: calc(-1 * $indicator-height);
|
|
49
|
+
width: 0;
|
|
50
|
+
height: 0;
|
|
51
|
+
border-top: $indicator-height solid $text-05;
|
|
52
|
+
border-right: $indicator-width solid transparent;
|
|
53
|
+
border-left: $indicator-width solid transparent;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.#{$block-class}__indicator--left {
|
|
57
|
+
left: calc(-1 * $indicator-width);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.#{$block-class}__indicator--right {
|
|
61
|
+
right: calc(-1 * $indicator-width);
|
|
62
|
+
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2022, 2022
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
import { px } from '@carbon/layout';
|
|
8
|
-
import { pkg } from '../../settings';
|
|
9
|
-
export var createActiveCellFn = function createActiveCellFn(_ref) {
|
|
10
|
-
var placementElement = _ref.placementElement,
|
|
11
|
-
coords = _ref.coords,
|
|
12
|
-
_ref$addToHeader = _ref.addToHeader,
|
|
13
|
-
addToHeader = _ref$addToHeader === void 0 ? false : _ref$addToHeader,
|
|
14
|
-
contextRef = _ref.contextRef,
|
|
15
|
-
_ref$blockClass = _ref.blockClass,
|
|
16
|
-
blockClass = _ref$blockClass === void 0 ? "".concat(pkg.prefix, "--data-spreadsheet") : _ref$blockClass,
|
|
17
|
-
onActiveCellChange = _ref.onActiveCellChange,
|
|
18
|
-
activeCellValue = _ref.activeCellValue;
|
|
19
|
-
|
|
20
|
-
if (!coords) {
|
|
21
|
-
return;
|
|
22
|
-
} // If the active cell is in the column header row (very first), we need to append this element
|
|
23
|
-
// to `.${blockClass}__header--container`, otherwise it should be appended to `.${blockClass}__listContainer` firstElementChild
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var activeElementContainer = addToHeader ? contextRef === null || contextRef === void 0 ? void 0 : contextRef.current.querySelector(".".concat(blockClass, "__header--container")) : contextRef === null || contextRef === void 0 ? void 0 : contextRef.current.querySelector(".".concat(blockClass, "__list--container")).firstElementChild;
|
|
27
|
-
var relativePosition = {
|
|
28
|
-
top: placementElement.getBoundingClientRect().top - activeElementContainer.getBoundingClientRect().top,
|
|
29
|
-
left: placementElement.getBoundingClientRect().left - activeElementContainer.getBoundingClientRect().left
|
|
30
|
-
};
|
|
31
|
-
var activeCellButton = (contextRef === null || contextRef === void 0 ? void 0 : contextRef.current.querySelector(".".concat(blockClass, "__active-cell--highlight"))) || document.createElement('button');
|
|
32
|
-
activeCellButton.classList.add("".concat(blockClass, "__active-cell--highlight"), "".concat(blockClass, "--interactive-cell-element"));
|
|
33
|
-
activeCellButton.style.width = px(placementElement === null || placementElement === void 0 ? void 0 : placementElement.offsetWidth);
|
|
34
|
-
activeCellButton.style.height = px(placementElement === null || placementElement === void 0 ? void 0 : placementElement.offsetHeight);
|
|
35
|
-
activeCellButton.style.left = px(relativePosition.left);
|
|
36
|
-
activeCellButton.style.top = px(relativePosition.top);
|
|
37
|
-
activeCellButton.setAttribute('data-active-row-index', typeof (coords === null || coords === void 0 ? void 0 : coords.row) === 'number' ? coords.row : 'header');
|
|
38
|
-
activeCellButton.setAttribute('data-active-column-index', typeof (coords === null || coords === void 0 ? void 0 : coords.column) === 'number' ? coords.column : 'header');
|
|
39
|
-
activeElementContainer.appendChild(activeCellButton);
|
|
40
|
-
activeCellButton.focus();
|
|
41
|
-
|
|
42
|
-
if (typeof (coords === null || coords === void 0 ? void 0 : coords.column) === 'number' && typeof (coords === null || coords === void 0 ? void 0 : coords.row) === 'number') {
|
|
43
|
-
onActiveCellChange(activeCellValue);
|
|
44
|
-
}
|
|
45
|
-
};
|