@carbon/ibm-products-web-components 0.44.0 → 0.45.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 (74) hide show
  1. package/custom-elements.json +67 -11
  2. package/es/components/about-modal/about-modal.scss.js +1 -1
  3. package/es/components/tearsheet-preview/tearsheet-header-content.d.ts +27 -1
  4. package/es/components/tearsheet-preview/tearsheet-header-content.d.ts.map +1 -1
  5. package/es/components/tearsheet-preview/tearsheet-header-content.js +137 -4
  6. package/es/components/tearsheet-preview/tearsheet-header-content.js.map +1 -1
  7. package/es/components/tearsheet-preview/tearsheet-header-content.scss.js +1 -1
  8. package/es/components/tearsheet-preview/tearsheet-header-content.scss.js.map +1 -1
  9. package/es/components/tearsheet-preview/tearsheet-header.d.ts +12 -16
  10. package/es/components/tearsheet-preview/tearsheet-header.d.ts.map +1 -1
  11. package/es/components/tearsheet-preview/tearsheet-header.js +29 -70
  12. package/es/components/tearsheet-preview/tearsheet-header.js.map +1 -1
  13. package/es/components/tearsheet-preview/tearsheet-header.scss.js +1 -1
  14. package/es/components/tearsheet-preview/tearsheet-header.scss.js.map +1 -1
  15. package/es/components/tearsheet-preview/tearsheet-influencer.js +1 -1
  16. package/es/components/tearsheet-preview/tearsheet-influencer.js.map +1 -1
  17. package/es/components/tearsheet-preview/tearsheet-navigation-bar.scss.js +1 -1
  18. package/es/components/tearsheet-preview/tearsheet-signal.d.ts +6 -0
  19. package/es/components/tearsheet-preview/tearsheet-signal.d.ts.map +1 -1
  20. package/es/components/tearsheet-preview/tearsheet-signal.js +4 -1
  21. package/es/components/tearsheet-preview/tearsheet-signal.js.map +1 -1
  22. package/es/components/tearsheet-preview/tearsheet-summary-content.d.ts.map +1 -1
  23. package/es/components/tearsheet-preview/tearsheet-summary-content.js +4 -1
  24. package/es/components/tearsheet-preview/tearsheet-summary-content.js.map +1 -1
  25. package/es/components/tearsheet-preview/tearsheet.d.ts +19 -0
  26. package/es/components/tearsheet-preview/tearsheet.d.ts.map +1 -1
  27. package/es/components/tearsheet-preview/tearsheet.js +38 -3
  28. package/es/components/tearsheet-preview/tearsheet.js.map +1 -1
  29. package/es/components/tearsheet-preview/tearsheet.scss.js +1 -1
  30. package/es/components/tearsheet-preview/tearsheet.scss.js.map +1 -1
  31. package/es/ibm-products-web-components/package.js +1 -1
  32. package/es/utilities/manageFocusTrap/manageFocusTrap.d.ts +12 -5
  33. package/es/utilities/manageFocusTrap/manageFocusTrap.d.ts.map +1 -1
  34. package/es/utilities/manageFocusTrap/manageFocusTrap.js +23 -10
  35. package/es/utilities/manageFocusTrap/manageFocusTrap.js.map +1 -1
  36. package/es-custom/components/about-modal/about-modal.scss.js +1 -1
  37. package/es-custom/components/tearsheet-preview/tearsheet-header-content.js +137 -4
  38. package/es-custom/components/tearsheet-preview/tearsheet-header-content.js.map +1 -1
  39. package/es-custom/components/tearsheet-preview/tearsheet-header-content.scss.js +1 -1
  40. package/es-custom/components/tearsheet-preview/tearsheet-header-content.scss.js.map +1 -1
  41. package/es-custom/components/tearsheet-preview/tearsheet-header.js +29 -70
  42. package/es-custom/components/tearsheet-preview/tearsheet-header.js.map +1 -1
  43. package/es-custom/components/tearsheet-preview/tearsheet-header.scss.js +1 -1
  44. package/es-custom/components/tearsheet-preview/tearsheet-header.scss.js.map +1 -1
  45. package/es-custom/components/tearsheet-preview/tearsheet-influencer.js +1 -1
  46. package/es-custom/components/tearsheet-preview/tearsheet-influencer.js.map +1 -1
  47. package/es-custom/components/tearsheet-preview/tearsheet-navigation-bar.scss.js +1 -1
  48. package/es-custom/components/tearsheet-preview/tearsheet-signal.js +4 -1
  49. package/es-custom/components/tearsheet-preview/tearsheet-signal.js.map +1 -1
  50. package/es-custom/components/tearsheet-preview/tearsheet-summary-content.js +4 -1
  51. package/es-custom/components/tearsheet-preview/tearsheet-summary-content.js.map +1 -1
  52. package/es-custom/components/tearsheet-preview/tearsheet.js +38 -3
  53. package/es-custom/components/tearsheet-preview/tearsheet.js.map +1 -1
  54. package/es-custom/components/tearsheet-preview/tearsheet.scss.js +1 -1
  55. package/es-custom/components/tearsheet-preview/tearsheet.scss.js.map +1 -1
  56. package/es-custom/ibm-products-web-components/package.js +1 -1
  57. package/es-custom/utilities/manageFocusTrap/manageFocusTrap.js +23 -10
  58. package/es-custom/utilities/manageFocusTrap/manageFocusTrap.js.map +1 -1
  59. package/lib/components/tearsheet-preview/tearsheet-header-content.d.ts +27 -1
  60. package/lib/components/tearsheet-preview/tearsheet-header-content.d.ts.map +1 -1
  61. package/lib/components/tearsheet-preview/tearsheet-header.d.ts +12 -16
  62. package/lib/components/tearsheet-preview/tearsheet-header.d.ts.map +1 -1
  63. package/lib/components/tearsheet-preview/tearsheet-signal.d.ts +6 -0
  64. package/lib/components/tearsheet-preview/tearsheet-signal.d.ts.map +1 -1
  65. package/lib/components/tearsheet-preview/tearsheet-summary-content.d.ts.map +1 -1
  66. package/lib/components/tearsheet-preview/tearsheet.d.ts +19 -0
  67. package/lib/components/tearsheet-preview/tearsheet.d.ts.map +1 -1
  68. package/lib/utilities/manageFocusTrap/manageFocusTrap.d.ts +12 -5
  69. package/lib/utilities/manageFocusTrap/manageFocusTrap.d.ts.map +1 -1
  70. package/package.json +4 -4
  71. package/scss/components/tearsheet-preview/tearsheet-header-content.scss +57 -11
  72. package/scss/components/tearsheet-preview/tearsheet-header.scss +4 -3
  73. package/scss/components/tearsheet-preview/tearsheet.scss +16 -0
  74. package/telemetry.yml +2 -1
@@ -93,16 +93,18 @@ export declare const clearFocusableContainers: (uniqueId?: string) => void;
93
93
  *
94
94
  * @param wrapper - Optional wrapper element to attach the keydown listener to.
95
95
  * If not provided, defaults to document for backward compatibility.
96
- * Using a specific wrapper can improve performance and scope the listener.
97
96
  * @param uniqueId - Optional unique identifier to scope the focus trap to specific containers.
98
97
  * If provided, only containers registered with this uniqueId are included.
99
- * If not provided, uses the default key for backward compatibility.
98
+ * @param getFirstFocusable - Optional resolver called lazily on each keydown (and for initial
99
+ * focus) to determine the first element. Using a function rather than
100
+ * a value avoids a stale reference if header-action buttons are added
101
+ * or removed while the tearsheet is open.
102
+ * Falls back to the first element across registered containers.
100
103
  *
101
104
  * @returns An object with a `cleanup` method that removes event listeners.
102
- * Call this method when the component is closing or unmounting.
103
105
  *
104
106
  * @example
105
- * // In a parent component when opening
107
+ * * // In a parent component when opening
106
108
  * protected updated(changedProps) {
107
109
  * if (changedProps.has('open') && this.open) {
108
110
  * // Update signal so children can register
@@ -125,8 +127,13 @@ export declare const clearFocusableContainers: (uniqueId?: string) => void;
125
127
  * this._trapFocusAPI?.cleanup();
126
128
  * clearFocusableContainers(this.uniqueId);
127
129
  * }
130
+ * this._trapFocusAPI = trapFocus(
131
+ * this as HTMLElement,
132
+ * this.uniqueId,
133
+ * () => this._getFirstFocusable()
134
+ * );
128
135
  */
129
- export declare const trapFocus: (wrapper?: HTMLElement, uniqueId?: string) => {
136
+ export declare const trapFocus: (wrapper?: HTMLElement, uniqueId?: string, getFirstFocusable?: (() => HTMLElement | null) | null) => {
130
137
  cleanup: () => void;
131
138
  };
132
139
  //# sourceMappingURL=manageFocusTrap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"manageFocusTrap.d.ts","sourceRoot":"","sources":["../../../src/utilities/manageFocusTrap/manageFocusTrap.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkBH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,2BAA2B,GACtC,WAAW,WAAW,GAAG,UAAU,GAAG,IAAI,EAC1C,WAAW,MAAM,SAiBlB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,6BAA6B,GACxC,WAAW,WAAW,GAAG,UAAU,GAAG,IAAI,EAC1C,WAAW,MAAM,SAalB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,wBAAwB,GAAI,WAAW,MAAM,SAMzD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,SAAS,GAAI,UAAU,WAAW,EAAE,WAAW,MAAM;;CA8JjE,CAAC"}
1
+ {"version":3,"file":"manageFocusTrap.d.ts","sourceRoot":"","sources":["../../../src/utilities/manageFocusTrap/manageFocusTrap.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkBH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,2BAA2B,GACtC,WAAW,WAAW,GAAG,UAAU,GAAG,IAAI,EAC1C,WAAW,MAAM,SAiBlB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,6BAA6B,GACxC,WAAW,WAAW,GAAG,UAAU,GAAG,IAAI,EAC1C,WAAW,MAAM,SAalB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,wBAAwB,GAAI,WAAW,MAAM,SAMzD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,SAAS,GACpB,UAAU,WAAW,EACrB,WAAW,MAAM,EACjB,oBAAoB,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,IAAI;;CA4KtD,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products-web-components",
3
3
  "description": "Carbon for IBM Products Web Components",
4
- "version": "0.44.0",
4
+ "version": "0.45.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "es/index.js",
7
7
  "module": "es/index.js",
@@ -58,7 +58,7 @@
58
58
  "dependencies": {
59
59
  "@carbon-labs/wc-empty-state": "^0.22.0",
60
60
  "@carbon-labs/wc-resizer": "^0.3.0",
61
- "@carbon/ibm-products-styles": "^2.91.0",
61
+ "@carbon/ibm-products-styles": "^2.92.0",
62
62
  "@carbon/layout": "^11.54.0",
63
63
  "@carbon/styles": "^1.110.1",
64
64
  "@carbon/utilities": "^0.21.0",
@@ -71,7 +71,7 @@
71
71
  "devDependencies": {
72
72
  "@aarsteinmedia/dotlottie-player": "^6.0.5",
73
73
  "@blockquote/rollup-plugin-externalize-source-dependencies": "^1.0.0",
74
- "@carbon/ibm-products-utilities": "1.4.0",
74
+ "@carbon/ibm-products-utilities": "1.5.0",
75
75
  "@carbon/icon-helpers": "^10.77.0",
76
76
  "@carbon/icons": "^11.83.0",
77
77
  "@carbon/motion": "^11.47.0",
@@ -109,5 +109,5 @@
109
109
  "vitest": "^3.2.0",
110
110
  "web-component-analyzer": "2.0.0"
111
111
  },
112
- "gitHead": "ac1586f56880d74a163c73b60d82895427dea2ce"
112
+ "gitHead": "452f9b6ddfcc5e76fc88cc005bfc5455944872cb"
113
113
  }
@@ -11,6 +11,7 @@
11
11
  @use '@carbon/styles/scss/motion' as *;
12
12
  @use '@carbon/styles/scss/spacing' as *;
13
13
  @use '@carbon/styles/scss/type';
14
+ @use '@carbon/layout/scss/convert';
14
15
  @use './tearsheet.scss' as *;
15
16
 
16
17
  $prefix: config.$pkg-prefix;
@@ -53,6 +54,9 @@ $motion-duration: $duration-moderate-02;
53
54
  }
54
55
 
55
56
  :host {
57
+ // Grid hosts header-content (col 1) and header-actions (col 2).
58
+ // Decorator and close button are absolutely positioned top-right,
59
+ // placed early in DOM order for correct keyboard tab sequence.
56
60
  display: grid;
57
61
  flex-basis: unset;
58
62
  gap: $spacing-05;
@@ -61,7 +65,7 @@ $motion-duration: $duration-moderate-02;
61
65
  1fr
62
66
  );
63
67
 
64
- inline-size: calc(100% - var(--tearsheet-header-action-offset));
68
+ inline-size: 100%; // full width — close/decorator are abs-positioned, no offset needed
65
69
 
66
70
  @include breakpoint-down(md) {
67
71
  display: flex;
@@ -73,6 +77,39 @@ $motion-duration: $duration-moderate-02;
73
77
  }
74
78
  }
75
79
  }
80
+
81
+ // ── Decorator (AI label) ─────────────────────────────────────────
82
+ // DOM position: 2nd (after header-actions, before close, before header-content)
83
+ // Visual position: absolute top-right (matches React TearsheetNext)
84
+ .#{$block-class__next}__decorator {
85
+ position: absolute;
86
+ z-index: 1;
87
+ inset-block-start: convert.to-rem(10px);
88
+ inset-inline-end: $spacing-09;
89
+ // Transition on base state so it animates in both directions (expand + collapse)
90
+ transition: inset-block-start $motion-duration motion(entrance, expressive);
91
+
92
+ // When header is collapsed, shift slightly down — matches React
93
+ :host-context(#{$c4p-prefix}-tearsheet-header[collapsed]) & {
94
+ inset-block-start: $spacing-03;
95
+ }
96
+ }
97
+
98
+ // ── Close button ─────────────────────────────────────────────────
99
+ // DOM position: 3rd (after decorator, before header-content)
100
+ // Visual position: absolute top-right corner — stays absolute on ALL screen sizes
101
+ .#{$block-class__next}__close-button {
102
+ position: absolute;
103
+ z-index: 1;
104
+ inset-block-start: 0;
105
+ inset-inline-end: 0;
106
+
107
+ // Animate size change (lg → md on collapse) — matches React
108
+ .#{$carbon-prefix}--modal-close {
109
+ transition: all $motion-duration ease;
110
+ }
111
+ }
112
+
76
113
  .#{$block-class__next}__header-actions {
77
114
  display: flex;
78
115
  justify-content: flex-end;
@@ -134,6 +171,10 @@ $motion-duration: $duration-moderate-02;
134
171
  @include type.type-style('label-02');
135
172
 
136
173
  align-items: center;
174
+ // Fixed block-size keeps the title row at the same height as the close button
175
+ block-size: $spacing-08;
176
+ // Gap between title-start icon and title text when collapsed
177
+ gap: $spacing-03;
137
178
  margin-block-start: $spacing-02;
138
179
  transition: all $motion-duration motion(entrance, expressive);
139
180
 
@@ -151,24 +192,29 @@ $motion-duration: $duration-moderate-02;
151
192
  }
152
193
 
153
194
  // Hide header actions on small screens when collapsed
154
- @include breakpoint-down(md) {
155
- .#{$block-class__next}__header-actions {
156
- display: none;
157
- }
158
- }
159
-
160
195
  // Normalize visible elements
161
196
  .#{$block-class__next}__header-content,
162
197
  .#{$block-class__next}__content__title-wrapper,
163
- .#{$block-class__next}__header-actions,
164
198
  .#{$block-class__next}__header-title {
165
199
  margin-block: 0;
166
200
  transition: margin-block $motion-duration ease;
167
201
  }
168
- // Header actions adjustment
169
- .#{$block-class__next}__header-actions {
170
- margin-block-start: -$spacing-01;
202
+
203
+ @include breakpoint-down(md) {
204
+ .#{$block-class__next}__header-actions {
205
+ display: none;
206
+ }
207
+ }
208
+
209
+ @include breakpoint(md) {
210
+ .#{$block-class__next}__header-actions {
211
+ display: flex;
212
+ align-items: center;
213
+ margin-block: 0;
214
+ transition: margin-block $motion-duration ease;
215
+ }
171
216
  }
217
+ // Header actions adjustment — removed negative offset that caused misalignment
172
218
  // Style for title-start slot content (like icons)
173
219
  .#{$block-class__next}__title-start {
174
220
  display: inline-flex;
@@ -122,7 +122,8 @@ $motion-duration: $duration-moderate-02;
122
122
  // ──────────────────────────────────────────────────────────────
123
123
  :host([collapsed]) {
124
124
  .#{$block-class__next}__header {
125
- padding-block-start: $spacing-04;
125
+ // Collapsed: remove top padding (was $spacing-04)
126
+ padding-block-start: 0;
126
127
  transition: padding $motion-duration motion(entrance, expressive);
127
128
  }
128
129
 
@@ -141,8 +142,8 @@ $motion-duration: $duration-moderate-02;
141
142
  }
142
143
 
143
144
  ::slotted([slot='header-content']) {
145
+ // Remove bottom padding when collapsed (was $spacing-04)
144
146
  min-block-size: $spacing-08;
145
- padding-block-end: $spacing-04;
146
147
  }
147
148
 
148
149
  // Divider line above navigation bar when collapsed
@@ -153,7 +154,7 @@ $motion-duration: $duration-moderate-02;
153
154
  block-size: 1px;
154
155
  content: '';
155
156
  inline-size: 100vw;
156
- inset-block-start: -$spacing-02;
157
+ inset-block-start: 0;
157
158
  inset-inline-start: 50%;
158
159
  pointer-events: none;
159
160
  transform: translateX(-50%);
@@ -194,8 +194,24 @@ $motion-duration: $duration-moderate-02;
194
194
  }
195
195
  }
196
196
 
197
+ // ──────────────────────────────────────────────────────────────
197
198
  // Narrow variant styles
199
+ // ──────────────────────────────────────────────────────────────
200
+ // ── Narrow container sizing ───────────────────────────────────
201
+ // Carbon's dialog defaults to full-width on small screens and ~480 px on
202
+ // larger ones, but its breakpoint (~672 px) is too wide for a narrow
203
+ // tearsheet. Pin it to exactly 480 px; below 480 px fill the viewport.
198
204
  :host(#{$c4p-prefix}-preview-tearsheet[variant='narrow']) {
205
+ ::part(dialog) {
206
+ inline-size: 480px;
207
+ max-inline-size: 480px;
208
+
209
+ @media (width <= 480px) {
210
+ inline-size: 100%;
211
+ max-inline-size: 100%;
212
+ }
213
+ }
214
+
199
215
  .#{$block-class__next}__header {
200
216
  padding-inline: $spacing-05;
201
217
  }
package/telemetry.yml CHANGED
@@ -208,6 +208,7 @@ collect:
208
208
  - container-class-name
209
209
  - onc4p-preview-tearsheet-beingclosed
210
210
  - onc4p-preview-tearsheet-closed
211
+ - onc4p-preview-tearsheet-collapse-change
211
212
  - selectors-floating-menus
212
213
  - summary-content-width
213
214
  - variant
@@ -235,7 +236,7 @@ collect:
235
236
  - width
236
237
  # c4p-tearsheet-header
237
238
  - disable-header-collapse
238
- - onc4p-tearsheet-header-close-button-clicked
239
+ - onc4p-tearsheet-header-collapse-change
239
240
  # c4p-tearsheet-influencer
240
241
  - influencer-panel-aria-label
241
242
  - influencer-panel-open