@carbon/ibm-products-web-components 0.17.0 → 0.18.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/custom-elements.json +218 -10
- package/es/components/about-modal/about-modal.scss.js +1 -1
- package/es/components/options-tile/options-tile.d.ts +6 -6
- package/es/components/options-tile/options-tile.js +25 -25
- package/es/components/options-tile/options-tile.js.map +1 -1
- package/es/components/options-tile/options-tile.scss.js +1 -1
- package/es/components/options-tile/options-tile.test.js +4 -4
- package/es/components/options-tile/options-tile.test.js.map +1 -1
- package/es/components/side-panel/side-panel.scss.js +1 -1
- package/es/components/tearsheet/tearsheet.d.ts +3 -0
- package/es/components/tearsheet/tearsheet.js +39 -1
- package/es/components/tearsheet/tearsheet.js.map +1 -1
- package/es/components/tearsheet/tearsheet.scss.js +1 -1
- package/es/components/tearsheet/tearsheet.test.js +27 -1
- package/es/components/tearsheet/tearsheet.test.js.map +1 -1
- package/es/components/tearsheet/utils.d.ts +3 -0
- package/es/components/tearsheet/utils.js +40 -1
- package/es/components/tearsheet/utils.js.map +1 -1
- package/es/components/truncated-text/index.d.ts +9 -0
- package/es/components/truncated-text/index.js +9 -0
- package/es/components/truncated-text/index.js.map +1 -0
- package/es/components/truncated-text/truncated-text.d.ts +73 -0
- package/es/components/truncated-text/truncated-text.js +232 -0
- package/es/components/truncated-text/truncated-text.js.map +1 -0
- package/es/components/truncated-text/truncated-text.scss.js +13 -0
- package/es/components/truncated-text/truncated-text.scss.js.map +1 -0
- package/es/components/truncated-text/truncated-text.test.d.ts +7 -0
- package/es/components/truncated-text/truncated-text.test.js +77 -0
- package/es/components/truncated-text/truncated-text.test.js.map +1 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/index.js.map +1 -1
- package/es/package.json.js +1 -1
- package/es-custom/components/about-modal/about-modal.scss.js +1 -1
- package/es-custom/components/options-tile/options-tile.d.ts +6 -6
- package/es-custom/components/options-tile/options-tile.js +25 -25
- package/es-custom/components/options-tile/options-tile.js.map +1 -1
- package/es-custom/components/options-tile/options-tile.scss.js +1 -1
- package/es-custom/components/options-tile/options-tile.test.js +4 -4
- package/es-custom/components/options-tile/options-tile.test.js.map +1 -1
- package/es-custom/components/side-panel/side-panel.scss.js +1 -1
- package/es-custom/components/tearsheet/tearsheet.d.ts +3 -0
- package/es-custom/components/tearsheet/tearsheet.js +39 -1
- package/es-custom/components/tearsheet/tearsheet.js.map +1 -1
- package/es-custom/components/tearsheet/tearsheet.scss.js +1 -1
- package/es-custom/components/tearsheet/tearsheet.test.js +27 -1
- package/es-custom/components/tearsheet/tearsheet.test.js.map +1 -1
- package/es-custom/components/tearsheet/utils.d.ts +3 -0
- package/es-custom/components/tearsheet/utils.js +40 -1
- package/es-custom/components/tearsheet/utils.js.map +1 -1
- package/es-custom/components/truncated-text/index.d.ts +9 -0
- package/es-custom/components/truncated-text/index.js +9 -0
- package/es-custom/components/truncated-text/index.js.map +1 -0
- package/es-custom/components/truncated-text/truncated-text.d.ts +73 -0
- package/es-custom/components/truncated-text/truncated-text.js +232 -0
- package/es-custom/components/truncated-text/truncated-text.js.map +1 -0
- package/es-custom/components/truncated-text/truncated-text.scss.js +13 -0
- package/es-custom/components/truncated-text/truncated-text.scss.js.map +1 -0
- package/es-custom/components/truncated-text/truncated-text.test.d.ts +7 -0
- package/es-custom/components/truncated-text/truncated-text.test.js +77 -0
- package/es-custom/components/truncated-text/truncated-text.test.js.map +1 -0
- package/es-custom/index.d.ts +1 -0
- package/es-custom/index.js +1 -0
- package/es-custom/index.js.map +1 -1
- package/es-custom/package.json.js +1 -1
- package/lib/components/options-tile/options-tile.d.ts +6 -6
- package/lib/components/tearsheet/tearsheet.d.ts +3 -0
- package/lib/components/tearsheet/utils.d.ts +3 -0
- package/lib/components/truncated-text/index.d.ts +9 -0
- package/lib/components/truncated-text/truncated-text.d.ts +73 -0
- package/lib/components/truncated-text/truncated-text.test.d.ts +7 -0
- package/lib/index.d.ts +1 -0
- package/package.json +9 -9
- package/scss/components/api-key-modal/story-styles.scss +10 -0
- package/scss/components/options-tile/options-tile.scss +31 -5
- package/scss/components/tearsheet/tearsheet.scss +22 -6
- package/scss/components/truncated-text/story-styles.scss +13 -0
- package/scss/components/truncated-text/truncated-text.scss +122 -0
package/es-custom/index.js
CHANGED
@@ -11,4 +11,5 @@ export { default as CDSFullPageError } from './components/full-page-error/full-p
|
|
11
11
|
export { default as CDSAboutModal } from './components/about-modal/about-modal.js';
|
12
12
|
export { default as CDSUseravatar } from './components/user-avatar/user-avatar.js';
|
13
13
|
export { default as CDSOptionsTile } from './components/options-tile/options-tile.js';
|
14
|
+
export { default as CDSTruncatedText } from './components/truncated-text/truncated-text.js';
|
14
15
|
//# sourceMappingURL=index.js.map
|
package/es-custom/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
@@ -6,7 +6,8 @@
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
8
8
|
*/
|
9
|
-
import { LitElement
|
9
|
+
import { LitElement } from 'lit';
|
10
|
+
import '@carbon/web-components/es/components/button/index.js';
|
10
11
|
export declare const blockClass = "c4p--options-tile";
|
11
12
|
declare const CDSOptionsTile_base: {
|
12
13
|
new (...args: any[]): {
|
@@ -373,20 +374,19 @@ declare class CDSOptionsTile extends CDSOptionsTile_base {
|
|
373
374
|
* Determines the size of the header
|
374
375
|
*/
|
375
376
|
size?: 'lg' | 'xl';
|
376
|
-
/**
|
377
|
-
* Text for the title
|
378
|
-
*/
|
379
|
-
title: string;
|
380
377
|
/**
|
381
378
|
* ID for the title
|
382
379
|
*/
|
383
380
|
titleId: string;
|
381
|
+
/**
|
382
|
+
* Text for the title
|
383
|
+
*/
|
384
|
+
titleText: string;
|
384
385
|
static get eventOpen(): string;
|
385
386
|
static get eventClose(): string;
|
386
387
|
private _toggle;
|
387
388
|
private _handleOpen;
|
388
389
|
private _handleClose;
|
389
|
-
getBody(): import("lit-html").TemplateResult<1> | typeof nothing;
|
390
390
|
render(): import("lit-html").TemplateResult<1>;
|
391
391
|
static styles: any;
|
392
392
|
}
|
@@ -393,6 +393,8 @@ declare class CDSTearsheet extends CDSTearsheet_base {
|
|
393
393
|
_hasHeaderActions: boolean;
|
394
394
|
_hasLabel: boolean;
|
395
395
|
_hasSlug: boolean;
|
396
|
+
_hasDecorator: boolean;
|
397
|
+
_hasAILabel: boolean;
|
396
398
|
_hasTitle: boolean;
|
397
399
|
_hasDescription: boolean;
|
398
400
|
_hasInfluencerLeft: boolean;
|
@@ -428,6 +430,7 @@ declare class CDSTearsheet extends CDSTearsheet_base {
|
|
428
430
|
*/
|
429
431
|
private _handleUserInitiatedClose;
|
430
432
|
private _handleSlugChange;
|
433
|
+
private _handleDecoratorChange;
|
431
434
|
/**
|
432
435
|
* Optional aria label for the tearsheet
|
433
436
|
*/
|
@@ -11,6 +11,8 @@ import '@carbon/web-components/es/components/text-input/index.js';
|
|
11
11
|
import '@carbon/web-components/es/components/textarea/index.js';
|
12
12
|
import '@carbon/web-components/es/components/tabs/index.js';
|
13
13
|
import '@carbon/web-components/es/components/slug/index.js';
|
14
|
+
import '@carbon/web-components/es/components/ai-label/index.js';
|
15
|
+
import '@carbon/web-components/es/components/toggle-tip/index.js';
|
14
16
|
import '@carbon/web-components/es/components/dropdown/index.js';
|
15
17
|
import '@carbon/web-components/es/components/progress-indicator/index.js';
|
16
18
|
import '@carbon/web-components/es/components/progress-bar/index.js';
|
@@ -27,3 +29,4 @@ export declare const getActionToolbarItems: (index: any) => import("lit-html").T
|
|
27
29
|
export declare const getActionItems: (index: any) => import("lit-html").TemplateResult<1>[] | null;
|
28
30
|
export declare const getNavigation: (index: any) => import("lit-html").TemplateResult<1> | null;
|
29
31
|
export declare const getSlug: (index: any) => import("lit-html").TemplateResult<1> | null;
|
32
|
+
export declare const getDecorator: (decorator: any) => import("lit-html").TemplateResult<1> | undefined;
|
@@ -0,0 +1,73 @@
|
|
1
|
+
/**
|
2
|
+
* @license
|
3
|
+
*
|
4
|
+
* Copyright IBM Corp. 2025, 2025
|
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
|
+
import { LitElement } from 'lit';
|
10
|
+
import '@carbon/web-components/es/components/tooltip/index.js';
|
11
|
+
import '@carbon/web-components/es/components/button/button.js';
|
12
|
+
import '@carbon/web-components/es/components/link/index.js';
|
13
|
+
export declare const blockClass = "c4p--truncated-text";
|
14
|
+
declare const elementName = "c4p-truncated-text";
|
15
|
+
/**
|
16
|
+
* TruncatedText.
|
17
|
+
*
|
18
|
+
* @element c4p-truncated-text
|
19
|
+
*/
|
20
|
+
export declare class CDSTruncatedText extends LitElement {
|
21
|
+
/**
|
22
|
+
* The maximum number of lines to display before truncation.
|
23
|
+
*/
|
24
|
+
lines: number;
|
25
|
+
/**
|
26
|
+
* The string value to be truncated.
|
27
|
+
*/
|
28
|
+
value: string;
|
29
|
+
/**
|
30
|
+
* Specify how the tooltip should align with the content.
|
31
|
+
*/
|
32
|
+
align: string;
|
33
|
+
/**
|
34
|
+
* Specify whether a auto align functionality should be applied
|
35
|
+
*/
|
36
|
+
autoalign: boolean;
|
37
|
+
/**
|
38
|
+
* The label on expand button.
|
39
|
+
*/
|
40
|
+
expandLabel: string;
|
41
|
+
/**
|
42
|
+
* The label on the collapse button.
|
43
|
+
*/
|
44
|
+
collapseLabel: string;
|
45
|
+
/**
|
46
|
+
* The method to display the full text when truncated. Options are "tooltip" or "expand". if not passed, the text would just be truncated with ellipsis.
|
47
|
+
*/
|
48
|
+
with: 'tooltip' | 'expand';
|
49
|
+
private _isOverflowing;
|
50
|
+
private _isExpanded;
|
51
|
+
private _maxHeight;
|
52
|
+
private _textElement;
|
53
|
+
private _lineHeight;
|
54
|
+
private _isLayered;
|
55
|
+
private _resizeObserver?;
|
56
|
+
static styles: any;
|
57
|
+
connectedCallback(): void;
|
58
|
+
disconnectedCallback(): void;
|
59
|
+
protected firstUpdated(): void;
|
60
|
+
protected updated(changed: Map<string, unknown>): void;
|
61
|
+
private _updateMaxHeight;
|
62
|
+
private _setupResizeObserver;
|
63
|
+
private _updateOverflowStatus;
|
64
|
+
private _toggleExpansion;
|
65
|
+
private _renderToggleButton;
|
66
|
+
render(): import("lit-html").TemplateResult<1>;
|
67
|
+
}
|
68
|
+
declare global {
|
69
|
+
interface HTMLElementTagNameMap {
|
70
|
+
[elementName]: CDSTruncatedText;
|
71
|
+
}
|
72
|
+
}
|
73
|
+
export default CDSTruncatedText;
|
package/lib/index.d.ts
CHANGED
@@ -12,3 +12,4 @@ export { default as CDSFullPageError } from './components/full-page-error/full-p
|
|
12
12
|
export { default as CDSAboutModal } from './components/about-modal/about-modal';
|
13
13
|
export { default as CDSUseravatar } from './components/user-avatar/user-avatar';
|
14
14
|
export { default as CDSOptionsTile } from './components/options-tile/options-tile';
|
15
|
+
export { default as CDSTruncatedText } from './components/truncated-text/truncated-text';
|
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.
|
4
|
+
"version": "0.18.0",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "es/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -54,17 +54,17 @@
|
|
54
54
|
"coverage": "vitest run --coverage"
|
55
55
|
},
|
56
56
|
"dependencies": {
|
57
|
-
"@carbon/ibm-products-styles": "^2.
|
58
|
-
"@carbon/styles": "1.
|
59
|
-
"@carbon/web-components": "2.
|
57
|
+
"@carbon/ibm-products-styles": "^2.65.0",
|
58
|
+
"@carbon/styles": "1.82.0",
|
59
|
+
"@carbon/web-components": "2.30.0",
|
60
60
|
"@ibm/telemetry-js": "^1.9.1",
|
61
61
|
"lit": "^3.1.0"
|
62
62
|
},
|
63
63
|
"devDependencies": {
|
64
64
|
"@blockquote/rollup-plugin-externalize-source-dependencies": "^1.0.0",
|
65
|
-
"@carbon/icon-helpers": "^10.
|
66
|
-
"@carbon/icons": "^11.
|
67
|
-
"@carbon/motion": "^11.
|
65
|
+
"@carbon/icon-helpers": "^10.59.0",
|
66
|
+
"@carbon/icons": "^11.60.0",
|
67
|
+
"@carbon/motion": "^11.28.0",
|
68
68
|
"@mordech/vite-lit-loader": "^0.37.0",
|
69
69
|
"@open-wc/testing": "^4.0.0",
|
70
70
|
"@rollup/plugin-alias": "^5.1.1",
|
@@ -87,7 +87,7 @@
|
|
87
87
|
"c8": "^10.1.3",
|
88
88
|
"cssnano": "^7.0.6",
|
89
89
|
"eslint": "^9.14.0",
|
90
|
-
"eslint-config-carbon": "^3.
|
90
|
+
"eslint-config-carbon": "^3.22.0",
|
91
91
|
"globby": "^14.0.2",
|
92
92
|
"happy-dom": "^17.0.0",
|
93
93
|
"playwright": "^1.51.1",
|
@@ -106,5 +106,5 @@
|
|
106
106
|
"vitest": "^3.0.1",
|
107
107
|
"web-component-analyzer": "2.0.0"
|
108
108
|
},
|
109
|
-
"gitHead": "
|
109
|
+
"gitHead": "4aec9b9d0c951b243025b3266cc9084e3a37578d"
|
110
110
|
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright IBM Corp. 2025, 2025
|
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
|
+
@use '@carbon/styles/scss/theme' as *;
|
8
|
+
@use '@carbon/styles/scss/spacing' as *;
|
9
|
+
|
10
|
+
$story-prefix: 'import-modal-stories__';
|
@@ -20,15 +20,32 @@ $block-class: #{$prefix}--options-tile;
|
|
20
20
|
:host(#{$prefix}-options-tile) {
|
21
21
|
.#{$block-class} {
|
22
22
|
background: $layer-01;
|
23
|
+
border-block-end: 1px solid $border-subtle-01;
|
24
|
+
|
25
|
+
::marker,
|
26
|
+
::-webkit-details-marker {
|
27
|
+
display: none;
|
28
|
+
content: '';
|
29
|
+
}
|
23
30
|
|
24
31
|
&__header {
|
25
32
|
display: flex;
|
26
33
|
align-items: center;
|
27
34
|
justify-content: space-between;
|
28
35
|
block-size: $spacing-09;
|
36
|
+
cursor: pointer;
|
29
37
|
padding-inline: $spacing-05;
|
30
38
|
padding-inline-end: $spacing-05;
|
31
39
|
|
40
|
+
&:hover {
|
41
|
+
background: $background-hover;
|
42
|
+
}
|
43
|
+
|
44
|
+
&:focus {
|
45
|
+
outline: 2px solid $focus;
|
46
|
+
outline-offset: -2px;
|
47
|
+
}
|
48
|
+
|
32
49
|
&-left {
|
33
50
|
display: flex;
|
34
51
|
align-items: center;
|
@@ -42,14 +59,17 @@ $block-class: #{$prefix}--options-tile;
|
|
42
59
|
|
43
60
|
&__title {
|
44
61
|
@include type.type-style('heading-compact-01');
|
62
|
+
|
63
|
+
&-block {
|
64
|
+
margin-inline-end: $spacing-05;
|
65
|
+
margin-inline-start: $spacing-05;
|
66
|
+
}
|
45
67
|
}
|
46
68
|
|
47
69
|
&__summary {
|
48
70
|
@include type.type-style('helper-text-01');
|
49
|
-
}
|
50
71
|
|
51
|
-
|
52
|
-
margin-inline-end: $spacing-03;
|
72
|
+
color: $text-secondary;
|
53
73
|
}
|
54
74
|
|
55
75
|
&__body {
|
@@ -60,8 +80,14 @@ $block-class: #{$prefix}--options-tile;
|
|
60
80
|
}
|
61
81
|
}
|
62
82
|
|
63
|
-
.#{$block-class}--xl
|
64
|
-
block-
|
83
|
+
.#{$block-class}--xl {
|
84
|
+
.#{$block-class}__header {
|
85
|
+
block-size: $spacing-10;
|
86
|
+
}
|
87
|
+
|
88
|
+
.#{$block-class}__summary {
|
89
|
+
margin-block-start: $spacing-01;
|
90
|
+
}
|
65
91
|
}
|
66
92
|
|
67
93
|
.#{$block-class}--open .#{$block-class}__chevron {
|
@@ -102,8 +102,11 @@ $motion-duration: $duration-moderate-02;
|
|
102
102
|
.#{$block-class}__influencer[wide] {
|
103
103
|
@extend .#{$block-class}__influencer--wide;
|
104
104
|
}
|
105
|
+
::slotted([slot='decorator']),
|
105
106
|
::slotted(#{$carbon-prefix}-slug) {
|
107
|
+
position: absolute;
|
106
108
|
display: flex;
|
109
|
+
inset-block-start: to-rem(10px);
|
107
110
|
inset-inline-end: 0;
|
108
111
|
/* stylelint-disable-next-line carbon/layout-use */
|
109
112
|
margin-block: 6px;
|
@@ -171,7 +174,8 @@ $motion-duration: $duration-moderate-02;
|
|
171
174
|
@extend .#{$carbon-prefix}--visually-hidden;
|
172
175
|
}
|
173
176
|
|
174
|
-
:host(#{$prefix}-tearsheet[slug])
|
177
|
+
:host(#{$prefix}-tearsheet[slug]),
|
178
|
+
:host(#{$prefix}-tearsheet[ai-label]) {
|
175
179
|
--overlay-color: #{$ai-overlay};
|
176
180
|
|
177
181
|
.#{$block-class}__container {
|
@@ -200,7 +204,13 @@ $motion-duration: $duration-moderate-02;
|
|
200
204
|
|
201
205
|
:host(#{$prefix}-tearsheet[slug])
|
202
206
|
.#{$prefix}--tearsheet__header[has-actions]
|
203
|
-
::slotted(#{$prefix}-slug)
|
207
|
+
::slotted(#{$prefix}-slug),
|
208
|
+
:host(#{$prefix}-tearsheet[ai-label])
|
209
|
+
.#{$prefix}--tearsheet__header[has-actions]
|
210
|
+
::slotted(#{$prefix}-ai-label),
|
211
|
+
:host(#{$prefix}-tearsheet[decorator])
|
212
|
+
.#{$prefix}--tearsheet__header[has-actions]
|
213
|
+
::slotted([slot='decorator']) {
|
204
214
|
inset-inline-end: 0;
|
205
215
|
}
|
206
216
|
|
@@ -216,7 +226,6 @@ $motion-duration: $duration-moderate-02;
|
|
216
226
|
:host(#{$prefix}-tearsheet[width='narrow']) {
|
217
227
|
.#{$block-class}__header {
|
218
228
|
margin: 0;
|
219
|
-
background-color: $layer;
|
220
229
|
border-block-end: 1px solid $border-subtle-01;
|
221
230
|
}
|
222
231
|
|
@@ -226,7 +235,7 @@ $motion-duration: $duration-moderate-02;
|
|
226
235
|
}
|
227
236
|
|
228
237
|
.#{$block-class}__main {
|
229
|
-
background-color:
|
238
|
+
background-color: unset;
|
230
239
|
}
|
231
240
|
}
|
232
241
|
|
@@ -256,11 +265,13 @@ $motion-duration: $duration-moderate-02;
|
|
256
265
|
}
|
257
266
|
|
258
267
|
.#{$block-class}__header[has-close-icon],
|
259
|
-
.#{$block-class}__header[has-slug]
|
268
|
+
.#{$block-class}__header[has-slug],
|
269
|
+
.#{$block-class}__header[has-decorator] {
|
260
270
|
padding-inline-end: $spacing-11;
|
261
271
|
}
|
262
272
|
|
263
|
-
.#{$block-class}__header[has-close-icon][has-slug]
|
273
|
+
.#{$block-class}__header[has-close-icon][has-slug],
|
274
|
+
.#{$block-class}__header[has-close-icon][has-decorator] {
|
264
275
|
/* stylelint-disable-next-line carbon/layout-use */
|
265
276
|
padding-inline-end: calc(#{$spacing-11 + $spacing-09});
|
266
277
|
}
|
@@ -325,3 +336,8 @@ $motion-duration: $duration-moderate-02;
|
|
325
336
|
::slotted(#{$carbon-prefix}-button) {
|
326
337
|
block-size: $spacing-10;
|
327
338
|
}
|
339
|
+
:host(#{$prefix}-tearsheet[width='narrow']) {
|
340
|
+
.#{$block-class}__buttons {
|
341
|
+
background-color: unset;
|
342
|
+
}
|
343
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright IBM Corp. 2025, 2025
|
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
|
+
@use '@carbon/styles/scss/theme' as *;
|
9
|
+
|
10
|
+
// $story-prefix: 'truncated-text-stories__';
|
11
|
+
#main-content {
|
12
|
+
padding: 12rem;
|
13
|
+
}
|
@@ -0,0 +1,122 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright IBM Corp. 2025, 2025
|
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
|
+
// $css--plex: true !default;
|
9
|
+
|
10
|
+
@use 'sass:map';
|
11
|
+
@use '@carbon/styles/scss/utilities' as *;
|
12
|
+
@use '@carbon/themes' as *;
|
13
|
+
@use '@carbon/styles/scss/spacing' as *;
|
14
|
+
@use '@carbon/styles/scss/theme' as *;
|
15
|
+
@use '@carbon/styles/scss/motion' as *;
|
16
|
+
@use '@carbon/styles/scss/config';
|
17
|
+
|
18
|
+
$prefix: 'c4p';
|
19
|
+
$carbon-prefix: config.$prefix;
|
20
|
+
$block-class: #{$prefix}--truncated-text;
|
21
|
+
|
22
|
+
// Common reset button style
|
23
|
+
%reset-button {
|
24
|
+
border: none;
|
25
|
+
cursor: pointer;
|
26
|
+
font: inherit;
|
27
|
+
line-height: inherit;
|
28
|
+
}
|
29
|
+
|
30
|
+
// Mixin for directional gradients
|
31
|
+
@mixin gradient-bg($direction, $color) {
|
32
|
+
background: linear-gradient($direction, rgba(255, 255, 255, 0) 0%, $color 0%);
|
33
|
+
}
|
34
|
+
|
35
|
+
:host(#{$prefix}-truncated-text) {
|
36
|
+
display: block;
|
37
|
+
inline-size: 100%;
|
38
|
+
|
39
|
+
.#{$block-class}_transition {
|
40
|
+
@media (prefers-reduced-motion: no-preference) {
|
41
|
+
transition: max-height $duration-fast-02 motion(standard, productive);
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
.#{$block-class}_content {
|
46
|
+
display: -webkit-box;
|
47
|
+
overflow: hidden;
|
48
|
+
-webkit-box-orient: vertical;
|
49
|
+
-webkit-line-clamp: var(--line-clamp, 0);
|
50
|
+
text-overflow: clip;
|
51
|
+
white-space: normal;
|
52
|
+
|
53
|
+
&:focus {
|
54
|
+
@include focus-outline('outline');
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
#{$carbon-prefix}-tooltip {
|
59
|
+
display: inline-flex;
|
60
|
+
}
|
61
|
+
|
62
|
+
button:focus,
|
63
|
+
.#{$block-class}_button-expand:focus,
|
64
|
+
.#{$block-class}_button-collapse:focus {
|
65
|
+
@include focus-outline('outline');
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
.#{$block-class}_button-expand,
|
70
|
+
.#{$block-class}_button-collapse {
|
71
|
+
@extend %reset-button;
|
72
|
+
|
73
|
+
padding: 0 $spacing-01;
|
74
|
+
color: $link-primary;
|
75
|
+
|
76
|
+
&.#{$block-class}_button-hide {
|
77
|
+
display: none;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
.#{$block-class}_button-expand {
|
82
|
+
position: absolute;
|
83
|
+
background-color: $background;
|
84
|
+
inset-block-end: 0;
|
85
|
+
inset-inline-end: 0;
|
86
|
+
|
87
|
+
&.#{$block-class}_button-layered {
|
88
|
+
background-color: $layer;
|
89
|
+
}
|
90
|
+
|
91
|
+
&::before {
|
92
|
+
position: absolute;
|
93
|
+
block-size: 100%;
|
94
|
+
color: $text-primary;
|
95
|
+
content: '...';
|
96
|
+
inline-size: 1em; // use em so truncation element scales with parent font size
|
97
|
+
inset-inline-start: -1em; // positions pseudo element before button without overlap across font sizes
|
98
|
+
pointer-events: none;
|
99
|
+
}
|
100
|
+
|
101
|
+
// Gradient LTR
|
102
|
+
&:dir(ltr)::before {
|
103
|
+
@include gradient-bg(90deg, $background);
|
104
|
+
}
|
105
|
+
|
106
|
+
&.#{$block-class}_button-layered:dir(ltr)::before {
|
107
|
+
@include gradient-bg(90deg, $layer);
|
108
|
+
}
|
109
|
+
|
110
|
+
// Gradient RTL
|
111
|
+
&:dir(rtl)::before {
|
112
|
+
@include gradient-bg(270deg, $background);
|
113
|
+
}
|
114
|
+
|
115
|
+
&.#{$block-class}_button-layered:dir(rtl)::before {
|
116
|
+
@include gradient-bg(270deg, $layer);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
.#{$block-class}_button-collapse {
|
121
|
+
background-color: transparent;
|
122
|
+
}
|