@carbon/ibm-products 1.56.0 → 1.58.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.
Files changed (49) hide show
  1. package/css/index-full-carbon.css +392 -895
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +3 -3
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon.css +392 -895
  6. package/css/index-without-carbon.css.map +1 -1
  7. package/css/index-without-carbon.min.css +3 -3
  8. package/css/index-without-carbon.min.css.map +1 -1
  9. package/css/index.css +392 -895
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +3 -3
  12. package/css/index.min.css.map +1 -1
  13. package/es/components/Checklist/Checklist.js +277 -0
  14. package/es/components/Checklist/ChecklistChart.js +104 -0
  15. package/es/components/Checklist/ChecklistIcon.js +105 -0
  16. package/es/components/Checklist/index.js +8 -0
  17. package/es/components/Datagrid/Datagrid/Datagrid.js +12 -7
  18. package/es/components/Datagrid/Datagrid/DatagridContent.js +6 -3
  19. package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +128 -7
  20. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +1 -23
  21. package/es/components/Datagrid/Datagrid/addons/stateReducer.js +111 -0
  22. package/es/components/Datagrid/useDatagrid.js +5 -2
  23. package/es/components/Datagrid/utils/getColTitle.js +25 -0
  24. package/es/components/NonLinearReading/NonLinearReading.js +9 -4
  25. package/es/components/index.js +2 -1
  26. package/es/global/js/hooks/useResizeObserver.js +19 -3
  27. package/es/global/js/package-settings.js +1 -0
  28. package/lib/components/Checklist/Checklist.js +267 -0
  29. package/lib/components/Checklist/ChecklistChart.js +94 -0
  30. package/lib/components/Checklist/ChecklistIcon.js +92 -0
  31. package/lib/components/Checklist/index.js +12 -0
  32. package/lib/components/Datagrid/Datagrid/Datagrid.js +12 -7
  33. package/lib/components/Datagrid/Datagrid/DatagridContent.js +6 -3
  34. package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +131 -7
  35. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +4 -26
  36. package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +122 -0
  37. package/lib/components/Datagrid/useDatagrid.js +5 -2
  38. package/lib/components/Datagrid/utils/getColTitle.js +32 -0
  39. package/lib/components/NonLinearReading/NonLinearReading.js +8 -3
  40. package/lib/components/index.js +8 -1
  41. package/lib/global/js/hooks/useResizeObserver.js +19 -3
  42. package/lib/global/js/package-settings.js +1 -0
  43. package/package.json +2 -2
  44. package/scss/components/Checklist/_checklist.scss +231 -0
  45. package/scss/components/Checklist/_index.scss +8 -0
  46. package/scss/components/Checklist/_storybook-styles.scss +13 -0
  47. package/scss/components/Datagrid/styles/_datagrid.scss +91 -0
  48. package/scss/components/NonLinearReading/_non-linear-reading.scss +76 -64
  49. package/scss/components/_index.scss +1 -0
@@ -0,0 +1,231 @@
1
+ /* stylelint-disable declaration-no-important */
2
+
3
+ //
4
+ // Copyright IBM Corp. 2023, 2023
5
+ //
6
+ // This source code is licensed under the Apache-2.0 license found in the
7
+ // LICENSE file in the root directory of this source tree.
8
+ //
9
+
10
+ // Standard imports.
11
+ @import '../../global/styles/project-settings';
12
+ @import '../../global/styles/mixins';
13
+
14
+ // Other Carbon settings.
15
+ // TODO: @import 'carbon-components/scss/globals/grid/grid'; if needed
16
+
17
+ // Checklist uses the following Carbon components:
18
+ // TODO: @import(s) of Carbon component styles used by Checklist
19
+
20
+ // Checklist uses the following Carbon for IBM Products components:
21
+ // TODO: @import(s) of IBM Products component styles used by Checklist
22
+
23
+ // Define all component styles in a mixin which is then exported using
24
+ // the Carbon import-once mechanism.
25
+
26
+ @mixin ellipsis-2-lines {
27
+ display: -webkit-box;
28
+ overflow: hidden;
29
+ -webkit-box-orient: vertical;
30
+ -webkit-line-clamp: 2;
31
+ text-overflow: ellipsis;
32
+ }
33
+
34
+ @mixin checklist {
35
+ // The block part of our conventional BEM class names (blockClass__E--M).
36
+ $block-class: #{$pkg-prefix}--checklist;
37
+
38
+ .#{$block-class} {
39
+ &__header {
40
+ display: flex;
41
+ padding: $spacing-05;
42
+ background-color: $ui-01;
43
+ gap: $spacing-03;
44
+ }
45
+
46
+ &__chart {
47
+ // outer donut
48
+ position: relative;
49
+ width: $spacing-08;
50
+ min-width: $spacing-08;
51
+ height: $spacing-08;
52
+ align-self: center;
53
+
54
+ &::after {
55
+ // inner donut
56
+ position: absolute;
57
+ top: $spacing-02;
58
+ left: $spacing-02;
59
+ width: $spacing-07;
60
+ height: $spacing-07;
61
+ border-radius: 50%;
62
+ background-color: $ui-01;
63
+ content: '';
64
+ }
65
+ }
66
+
67
+ // Align __title and __chart-label vertically centered in the header.
68
+ &__titles {
69
+ display: flex;
70
+ flex-direction: column;
71
+ justify-content: center;
72
+ }
73
+
74
+ &__title {
75
+ @include carbon--type-style('productive-heading-02');
76
+ @include ellipsis-2-lines();
77
+ }
78
+
79
+ &__chart-label {
80
+ @include carbon--type-style('label-01');
81
+ @include ellipsis-2-lines();
82
+
83
+ color: $text-02;
84
+ }
85
+
86
+ &__title + &__chart-label {
87
+ margin-top: $spacing-01;
88
+ }
89
+
90
+ // open/close toggle
91
+ &__toggle {
92
+ width: 30px;
93
+ min-width: 30px;
94
+ height: 30px;
95
+ min-height: 30px !important;
96
+ /* stylelint-disable-next-line carbon/layout-token-use */
97
+ padding: 0 rem(6px) !important;
98
+ margin-top: calc(-1 * $spacing-03) !important;
99
+ margin-right: calc(-1 * $spacing-03) !important;
100
+ margin-left: auto !important;
101
+ }
102
+
103
+ &__chevron {
104
+ color: $text-01;
105
+ transform: rotate(0deg);
106
+ transition: all $duration--fast-02 motion(standard, productive);
107
+
108
+ @media (prefers-reduced-motion: reduce) {
109
+ transition: none;
110
+ }
111
+ }
112
+
113
+ &__closed &__chevron {
114
+ transform: rotate(-180deg);
115
+ }
116
+
117
+ // Button to appear more like a link so it aligns better with the list text
118
+ &__button {
119
+ max-width: none !important;
120
+ min-height: auto !important;
121
+ // override bx--btn to allow two-line ellipsis
122
+ /* stylelint-disable-next-line declaration-property-value-disallowed-list */
123
+ flex-shrink: unset !important;
124
+ padding: 0 !important;
125
+ border: none !important;
126
+ background-color: transparent !important;
127
+ color: $link-01 !important;
128
+
129
+ // The CSS for the Carbon button's label
130
+ // is incompatible with two-line ellipsis,
131
+ // but a div inside a Carbon button works.
132
+ div {
133
+ @include ellipsis-2-lines();
134
+ }
135
+
136
+ &:hover {
137
+ background: transparent;
138
+ color: $link-primary-hover;
139
+ text-decoration: underline;
140
+ }
141
+
142
+ &:active {
143
+ background: transparent;
144
+ color: $text-primary;
145
+ text-decoration: underline;
146
+ }
147
+
148
+ &--error {
149
+ color: $text-error !important;
150
+ }
151
+ }
152
+
153
+ // container for animated content
154
+ &__content-outer {
155
+ overflow: hidden;
156
+ }
157
+
158
+ &__content-inner {
159
+ height: 100%;
160
+ background-color: $ui-01;
161
+ transform: translate(0, 0);
162
+ transition: all $duration--fast-02 motion(standard, productive);
163
+
164
+ @media (prefers-reduced-motion: reduce) {
165
+ transition: none;
166
+ }
167
+ }
168
+
169
+ &__closed &__content-inner {
170
+ height: 0;
171
+ transform: translate(0, -100%);
172
+ }
173
+
174
+ &__list-group {
175
+ padding: $spacing-05;
176
+ border-top: 1px solid $ui-03;
177
+ }
178
+
179
+ &__list-title {
180
+ @include carbon--type-style('body-short-01');
181
+ @include ellipsis-2-lines();
182
+
183
+ margin-bottom: $spacing-03;
184
+ }
185
+
186
+ &__list-item {
187
+ display: flex;
188
+ margin-bottom: $spacing-03;
189
+
190
+ &:last-child {
191
+ margin-bottom: 0;
192
+ }
193
+ }
194
+
195
+ &__icon {
196
+ /* stylelint-disable-next-line carbon/layout-token-use */
197
+ margin: rem(1px) $spacing-03 0 0;
198
+ color: $link-01;
199
+
200
+ &--error {
201
+ color: $support-error;
202
+ }
203
+
204
+ &--disabled {
205
+ color: $disabled-03;
206
+ }
207
+ }
208
+
209
+ &__label {
210
+ @include carbon--type-style('body-short-01');
211
+ @include ellipsis-2-lines();
212
+
213
+ &--checked,
214
+ &--disabled,
215
+ &--error {
216
+ color: $disabled-03;
217
+ }
218
+ }
219
+
220
+ &__footer {
221
+ @include ellipsis-2-lines();
222
+
223
+ padding: $spacing-03 $spacing-05;
224
+ border-top: 1px solid $ui-03;
225
+ }
226
+ }
227
+ }
228
+
229
+ @include exports('checklist') {
230
+ @include checklist;
231
+ }
@@ -0,0 +1,8 @@
1
+ //
2
+ // Copyright IBM Corp. 2023, 2023
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
+
8
+ @import './checklist';
@@ -0,0 +1,13 @@
1
+ //
2
+ // Copyright IBM Corp. 2023, 2023
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
+
8
+ @import '../../global/styles/project-settings';
9
+
10
+ .checklist-stories__viewport .c4p--checklist {
11
+ min-width: calc(2 * $spacing-13); // 320px
12
+ max-width: calc(2 * $spacing-13);
13
+ }
@@ -164,6 +164,23 @@
164
164
  width: 100%;
165
165
  padding-top: 0;
166
166
 
167
+ .#{$carbon-prefix}--data-table-header__description {
168
+ overflow: hidden;
169
+ text-overflow: ellipsis;
170
+ white-space: nowrap;
171
+ }
172
+
173
+ .#{$carbon-prefix}--data-table-header__title {
174
+ overflow: hidden;
175
+ max-width: 80ch;
176
+ text-overflow: ellipsis;
177
+ white-space: nowrap;
178
+
179
+ @include carbon--breakpoint(md) {
180
+ max-width: 55ch;
181
+ }
182
+ }
183
+
167
184
  .#{$carbon-prefix}--data-table-content {
168
185
  width: 100%;
169
186
  height: 100%;
@@ -612,3 +629,77 @@
612
629
  .#{$block-class} .#{$pkg-prefix}--datagrid__head-wrap {
613
630
  background-color: $ui-03;
614
631
  }
632
+
633
+ .#{$block-class} .#{$block-class}__col-resizer-range {
634
+ position: absolute;
635
+ z-index: 2;
636
+ top: 0;
637
+ right: calc(#{$spacing-03} * -1);
638
+ width: 1rem;
639
+ height: 100%;
640
+ margin: 0;
641
+ -moz-appearance: initial;
642
+ -webkit-appearance: none;
643
+ appearance: none;
644
+ background: transparent;
645
+ }
646
+
647
+ .#{$block-class} .#{$block-class}__col-resizer-range:focus {
648
+ outline: 0;
649
+ }
650
+
651
+ .#{$block-class}
652
+ .#{$block-class}__col-resizer-range:focus
653
+ + .#{$block-class}__col-resize-indicator::before {
654
+ position: absolute;
655
+ top: 50%;
656
+ left: 50%;
657
+ width: 2px;
658
+ height: var(--#{$block-class}--header-height);
659
+ background-color: $focus;
660
+ content: '';
661
+ transform: translate(-50%, -50%);
662
+ }
663
+
664
+ .#{$block-class}
665
+ .#{$block-class}__col-resizer-range:focus
666
+ + .#{$block-class}__col-resize-indicator {
667
+ position: absolute;
668
+ z-index: 2;
669
+ right: calc(#{$spacing-03} * -1);
670
+ width: 0.5rem;
671
+ height: 0.5rem;
672
+ border-radius: 100%;
673
+ margin: 0;
674
+ background-color: $focus;
675
+ transform: translate(-50%, 0);
676
+ }
677
+
678
+ .#{$block-class}
679
+ .#{$block-class}__col-resizer-range:focus
680
+ + .#{$block-class}__col-resize-indicator::after {
681
+ position: absolute;
682
+ /* stylelint-disable-next-line carbon/layout-token-use */
683
+ top: calc(var(--#{$block-class}--row-height) - 20px);
684
+ right: $spacing-02;
685
+ width: 1px;
686
+ height: calc(
687
+ var(--#{$block-class}--grid-height) - var(--#{$block-class}--row-height)
688
+ );
689
+ background-color: $active-ui;
690
+ content: '';
691
+ }
692
+
693
+ .#{$block-class} .#{$block-class}__col-resizer-range::-webkit-slider-thumb {
694
+ width: 16px;
695
+ height: 16px;
696
+ border: none;
697
+ border-radius: 50%;
698
+ -webkit-appearance: none;
699
+ appearance: none;
700
+ background: transparent;
701
+ }
702
+
703
+ .#{$block-class} .#{$block-class}__col-resizer-range::-moz-range-thumb {
704
+ visibility: hidden;
705
+ }
@@ -8,18 +8,50 @@
8
8
  // Standard imports.
9
9
  @import '../../global/styles/project-settings';
10
10
 
11
- @mixin keyword-closed-defaults {
11
+ @keyframes fade {
12
+ 0% {
13
+ opacity: 0;
14
+ }
15
+
16
+ 15% {
17
+ opacity: 0;
18
+ }
19
+
20
+ 100% {
21
+ opacity: 1;
22
+ }
23
+ }
24
+
25
+ @mixin keyword-closed {
12
26
  height: rem(20px);
13
27
  padding-top: 0;
14
28
  // stylelint-disable-next-line carbon/layout-token-use
15
29
  padding-right: rem(3px);
16
30
  border-width: rem(1px);
17
31
  border-style: solid;
32
+ border-color: $button-tertiary;
18
33
  border-radius: $spacing-04;
34
+ background-color: transparent;
35
+ color: $button-tertiary;
19
36
  white-space: nowrap;
20
37
 
21
38
  &:hover {
22
- cursor: pointer;
39
+ border-color: $button-tertiary;
40
+ background-color: $button-tertiary;
41
+ color: $text-inverse;
42
+ }
43
+
44
+ &:focus {
45
+ border-color: $text-inverse;
46
+ background-color: $button-tertiary;
47
+ box-shadow: 0 0 0 1px $text-inverse, 0 0 0 3px $button-tertiary;
48
+ color: $text-inverse;
49
+ }
50
+
51
+ // Disable browser's default focus outline.
52
+ // We will provide all the focus/outline styling.
53
+ &:focus-visible {
54
+ outline: none;
23
55
  }
24
56
 
25
57
  // The "up" chevron
@@ -29,25 +61,47 @@
29
61
  vertical-align: text-top;
30
62
  }
31
63
  }
32
- @mixin keyword-open-defaults {
33
- @include keyword-closed-defaults();
64
+ @mixin keyword-open {
65
+ @include keyword-closed();
66
+
67
+ border-color: $button-tertiary;
68
+ background-color: $button-tertiary;
69
+ color: $text-inverse;
70
+
71
+ &:hover {
72
+ border-color: $button-tertiary;
73
+ background-color: transparent;
74
+ color: $button-tertiary;
75
+ }
76
+
77
+ &:focus {
78
+ border-color: $text-inverse;
79
+ background-color: transparent;
80
+ box-shadow: inset 0 0 0 1px $button-tertiary, 0 0 0 1px $text-inverse,
81
+ 0 0 0 3px $button-tertiary;
82
+ color: $button-tertiary;
83
+ }
34
84
 
35
85
  // The "up" chevron, flipped
36
86
  svg {
37
87
  transform: rotate(180deg);
38
88
  }
39
89
  }
90
+
40
91
  @mixin body-defaults {
41
92
  @include carbon--type-style('body-long-01');
42
93
 
43
94
  display: block;
44
95
  padding: $spacing-03 $spacing-04;
45
- border-left-width: rem(1.25px);
46
- border-left-style: solid;
96
+ border-left: rem(1.25px) solid $text-01;
47
97
  margin: $spacing-02 0;
48
98
  // Novice to pro does not always use Carbon defaults/tokens
49
99
  // stylelint-disable-next-line carbon/motion-duration-use, carbon/motion-easing-use
50
100
  animation: fade 600ms;
101
+
102
+ @media (prefers-reduced-motion: reduce) {
103
+ animation: none;
104
+ }
51
105
  }
52
106
 
53
107
  // Other Carbon settings.
@@ -65,92 +119,50 @@
65
119
  // The block part of our conventional BEM class names (blockClass__E--M).
66
120
  $block-class: #{$pkg-prefix}--non-linear-reading;
67
121
 
68
- @keyframes fade {
69
- 0% {
70
- opacity: 0;
71
- }
72
-
73
- 15% {
74
- opacity: 0;
75
- }
76
-
77
- 100% {
78
- opacity: 1;
79
- }
80
- }
81
-
82
122
  .#{$block-class}__light {
83
123
  .#{$block-class}__keyword {
84
124
  &-closed {
85
- @include keyword-closed-defaults();
86
-
87
- border-color: $interactive-03;
88
- background-color: transparent;
89
- color: $interactive-03;
125
+ @include keyword-closed();
126
+ }
90
127
 
91
- &:hover {
92
- background-color: $interactive-03;
93
- color: $inverse-01;
94
- }
128
+ // The body has an id that must be visible to the button's "aria-controls" property.
129
+ // We *must* render the body with the id to avoid breaking accessibility.
130
+ // When closed we render but don't display the body, and we don't render the "content".
131
+ // When open, we display the body, and render the content.
132
+ &-closed + .#{$block-class}__body {
133
+ display: none;
95
134
  }
96
135
 
97
136
  &-open {
98
- @include keyword-open-defaults();
99
-
100
- border-color: $interactive-03;
101
- background-color: $interactive-03;
102
- color: $inverse-01;
103
-
104
- &:hover {
105
- background-color: transparent;
106
- color: $interactive-03;
107
- }
137
+ @include keyword-open();
108
138
  }
109
139
  }
110
140
 
111
141
  .#{$block-class}__body {
112
142
  @include body-defaults();
113
-
114
- border-left-color: $text-01;
115
143
  }
116
144
  }
117
145
 
118
146
  .#{$block-class}__dark {
147
+ @include carbon--theme($carbon--theme--g100, true);
148
+
119
149
  .#{$block-class}__keyword {
120
150
  &-closed {
121
- @include carbon--theme($carbon--theme--g100, true);
122
- @include keyword-closed-defaults();
123
-
124
- border-color: $icon-03;
125
- background-color: transparent;
126
- color: $text-01;
151
+ @include keyword-closed();
152
+ }
127
153
 
128
- &:hover {
129
- background-color: $icon-03;
130
- color: $inverse-01;
131
- }
154
+ &-closed + .#{$block-class}__body {
155
+ display: none;
132
156
  }
133
157
 
134
158
  &-open {
135
- @include carbon--theme($carbon--theme--g100, true);
136
- @include keyword-open-defaults();
137
-
138
- border-color: $icon-03;
139
- background-color: $icon-03;
140
- color: $inverse-01;
141
-
142
- &:hover {
143
- background-color: transparent;
144
- color: $text-01;
145
- }
159
+ @include keyword-open();
146
160
  }
147
161
  }
148
162
 
149
163
  .#{$block-class}__body {
150
- @include carbon--theme($carbon--theme--g100, true);
151
164
  @include body-defaults();
152
165
 
153
- border-left-color: $text-01;
154
166
  color: $text-01;
155
167
 
156
168
  // override default link color to compensate for a gradient background.
@@ -63,3 +63,4 @@
63
63
  @import './CoachmarkStack/index';
64
64
  @import './InlineTip/index';
65
65
  @import './SteppedAnimatedMedia/index';
66
+ @import './Checklist/index';