@salesforcedevs/dx-components 1.40.0 → 1.40.1-proj-ver-picker-1

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/package.json CHANGED
@@ -1,48 +1,48 @@
1
1
  {
2
- "name": "@salesforcedevs/dx-components",
3
- "version": "1.40.0",
4
- "description": "DX Lightning web components",
5
- "license": "MIT",
6
- "engines": {
7
- "node": "22.x"
8
- },
9
- "publishConfig": {
10
- "access": "public"
11
- },
12
- "dependencies": {
13
- "@coveo/headless": "3.22.2",
14
- "@floating-ui/dom": "1.5.1",
15
- "@optimizely/optimizely-sdk": "5.3.0",
16
- "@shikijs/colorized-brackets": "^3.12.2",
17
- "@types/throttle-debounce": "5.0.2",
18
- "@vimeo/player": "2.22.0",
19
- "classnames": "2.5.1",
20
- "composed-offset-position": "0.0.4",
21
- "coveo-search-ui": "2.10113.0",
22
- "debounce": "1.2.1",
23
- "js-cookie": "3.0.5",
24
- "lodash.defaults": "4.2.0",
25
- "lodash.get": "4.4.2",
26
- "lodash.kebabcase": "4.1.1",
27
- "memoize-one": "6.0.0",
28
- "microtip": "0.2.2",
29
- "shiki": "^3.12.2",
30
- "throttle-debounce": "5.0.0",
31
- "uuid": "9.0.1"
32
- },
33
- "devDependencies": {
34
- "@types/classnames": "2.3.1",
35
- "@types/debounce": "1.2.4",
36
- "@types/js-cookie": "3.0.6",
37
- "@types/lodash.defaults": "4.2.9",
38
- "@types/lodash.get": "4.4.9",
39
- "@types/lodash.kebabcase": "4.1.9",
40
- "@types/luxon": "3.4.2",
41
- "@types/uuid": "8.3.4",
42
- "@types/vimeo__player": "2.18.3",
43
- "eventsourcemock": "2.0.0",
44
- "luxon": "3.4.4",
45
- "msw": "^2.12.4"
46
- },
47
- "gitHead": "db75cd19dd7a77fe4e09856439c4905c32e64d1f"
48
- }
2
+ "name": "@salesforcedevs/dx-components",
3
+ "version": "1.40.1-proj-ver-picker-1",
4
+ "description": "DX Lightning web components",
5
+ "license": "MIT",
6
+ "engines": {
7
+ "node": "22.x"
8
+ },
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "dependencies": {
13
+ "@coveo/headless": "3.22.2",
14
+ "@floating-ui/dom": "1.5.1",
15
+ "@optimizely/optimizely-sdk": "5.3.0",
16
+ "@shikijs/colorized-brackets": "^3.12.2",
17
+ "@types/throttle-debounce": "5.0.2",
18
+ "@vimeo/player": "2.22.0",
19
+ "classnames": "2.5.1",
20
+ "composed-offset-position": "0.0.4",
21
+ "coveo-search-ui": "2.10113.0",
22
+ "debounce": "1.2.1",
23
+ "js-cookie": "3.0.5",
24
+ "lodash.defaults": "4.2.0",
25
+ "lodash.get": "4.4.2",
26
+ "lodash.kebabcase": "4.1.1",
27
+ "memoize-one": "6.0.0",
28
+ "microtip": "0.2.2",
29
+ "shiki": "^3.12.2",
30
+ "throttle-debounce": "5.0.0",
31
+ "uuid": "9.0.1"
32
+ },
33
+ "devDependencies": {
34
+ "@types/classnames": "2.3.1",
35
+ "@types/debounce": "1.2.4",
36
+ "@types/js-cookie": "3.0.6",
37
+ "@types/lodash.defaults": "4.2.9",
38
+ "@types/lodash.get": "4.4.9",
39
+ "@types/lodash.kebabcase": "4.1.9",
40
+ "@types/luxon": "3.4.2",
41
+ "@types/uuid": "8.3.4",
42
+ "@types/vimeo__player": "2.18.3",
43
+ "eventsourcemock": "2.0.0",
44
+ "luxon": "3.4.4",
45
+ "msw": "^2.12.4"
46
+ },
47
+ "stableVersion": "1.40.0"
48
+ }
@@ -86,11 +86,11 @@
86
86
  }
87
87
 
88
88
  .button.icon-right:not(.slot-empty) > *:nth-child(2) {
89
- margin-left: var(--dx-g-spacing-sm);
89
+ margin-left: var(--dx-c-button-icon-gap, var(--dx-g-spacing-sm));
90
90
  }
91
91
 
92
92
  .button.icon-left:not(.slot-empty) > *:nth-child(2) {
93
- margin-right: var(--dx-g-spacing-sm);
93
+ margin-right: var(--dx-c-button-icon-gap, var(--dx-g-spacing-sm));
94
94
  }
95
95
 
96
96
  .button.style-icon.slot-empty {
@@ -14,6 +14,20 @@
14
14
  display: none;
15
15
  }
16
16
 
17
+ /* Opt-in fit-content menu: grows to content (capped at the popover's viewport
18
+ max-width); long labels truncate instead of wrapping. */
19
+ .menu-fit-content::part(content) {
20
+ width: max-content;
21
+ }
22
+
23
+ .menu-fit-content {
24
+ --dx-c-dropdown-option-min-width: 0;
25
+ --dx-c-dropdown-option-label-display: block;
26
+ --dx-c-dropdown-option-white-space: nowrap;
27
+ --dx-c-dropdown-option-overflow: hidden;
28
+ --dx-c-dropdown-option-text-overflow: ellipsis;
29
+ }
30
+
17
31
  @media screen and (max-width: 1000px) {
18
32
  .menu-nested .menu_option:not(:first-child) {
19
33
  border-top: var(--border);
@@ -2,7 +2,7 @@
2
2
  <dx-popover
3
3
  aria-label={ariaLabel}
4
4
  class={className}
5
- full-width={fullWidth}
5
+ full-width={effectiveFullWidth}
6
6
  offset={offset}
7
7
  onclose={onClose}
8
8
  open-on-hover={openOnHover}
@@ -10,7 +10,7 @@
10
10
  page-padding={pagePadding}
11
11
  placement={placement}
12
12
  small={small}
13
- width={width}
13
+ width={effectiveWidth}
14
14
  >
15
15
  <slot slot="control"></slot>
16
16
  <div
@@ -2,7 +2,8 @@ import {
2
2
  AnalyticsPayload,
3
3
  OptionWithNested,
4
4
  PopperPlacement,
5
- DropdownVariant
5
+ DropdownVariant,
6
+ DropdownWidthMode
6
7
  } from "typings/custom";
7
8
  import { LightningElement, api, track } from "lwc";
8
9
  import cx from "classnames";
@@ -37,6 +38,7 @@ export default class Dropdown extends LightningElement {
37
38
  @api fullWidth?: boolean | null;
38
39
  @api navItemLabel: string | null = null;
39
40
  @api variant: DropdownVariant = "base";
41
+ @api widthMode: DropdownWidthMode = "fixed";
40
42
 
41
43
  // props forwarded to dropdown option
42
44
  @api analyticsEvent?: string;
@@ -80,12 +82,32 @@ export default class Dropdown extends LightningElement {
80
82
  return this.areOptionsEmpty ? null : "menu";
81
83
  }
82
84
 
85
+ private get isFitContent() {
86
+ return this.widthMode === "fit-content";
87
+ }
88
+
89
+ // fit-content takes precedence; the misuse is surfaced in className() below.
90
+ private get effectiveWidth() {
91
+ return this.isFitContent ? null : this.width;
92
+ }
93
+
94
+ private get effectiveFullWidth() {
95
+ return this.isFitContent ? false : this.fullWidth;
96
+ }
97
+
83
98
  private get className() {
99
+ const fitContent = this.isFitContent;
100
+ if (fitContent && (this.width || this.fullWidth)) {
101
+ console.error(
102
+ 'The "width-mode=fit-content" and "width"/"full-width" properties cannot be provided simultaneously. "width-mode=fit-content" is prioritized; "width"/"full-width" are ignored.'
103
+ );
104
+ }
84
105
  return cx(
85
106
  this.isNested && "menu-nested",
86
107
  this.isNested && this.options.length >= 2 && "menu-nested-2-col",
87
108
  this.offset && `menu-offset-${this.offset}`,
88
- this.areOptionsEmpty && "menu-hidden"
109
+ this.areOptionsEmpty && "menu-hidden",
110
+ fitContent && "menu-fit-content"
89
111
  );
90
112
  }
91
113
 
@@ -25,9 +25,14 @@
25
25
  display: flex;
26
26
  font-family: var(--dx-g-font-sans);
27
27
  width: 100%;
28
- padding: var(--dx-g-spacing-sm);
28
+
29
+ /* Opt-in hooks; defaults preserve today's look. */
30
+ padding: var(--dx-c-dropdown-option-padding, var(--dx-g-spacing-sm));
29
31
  font-size: var(--dx-g-text-sm);
30
- border-radius: var(--dx-g-spacing-xs);
32
+ border-radius: var(
33
+ --dx-c-dropdown-option-border-radius,
34
+ var(--dx-g-spacing-xs)
35
+ );
31
36
  transition: var(--dx-g-transition-hue-1x);
32
37
  align-items: center;
33
38
  outline: none !important;
@@ -58,6 +63,9 @@
58
63
  font-family: var(--dx-g-font-sans);
59
64
  font-size: var(--dx-g-text-sm);
60
65
  text-align: left;
66
+
67
+ /* Opt-in: set to 0 to let a long label truncate instead of overflow. */
68
+ min-width: var(--dx-c-dropdown-option-min-width, auto);
61
69
  }
62
70
 
63
71
  .option-indented .option_details {
@@ -67,10 +75,19 @@
67
75
 
68
76
  .option_label {
69
77
  color: var(--dx-c-dropdown-option-label-color, var(--dx-g-blue-vibrant-50));
70
- display: flex;
78
+
79
+ /* Opt-in: set to block so text-overflow:ellipsis applies (ignored on flex). */
80
+ display: var(--dx-c-dropdown-option-label-display, flex);
71
81
  align-items: center;
72
82
  font-weight: var(--dx-c-dropdown-option-font-weight, var(--dx-g-font-bold));
73
83
  font-size: var(--dx-c-dropdown-option-font-size, var(--dx-g-text-base));
84
+
85
+ /* Opt-in truncation: consumers set --dx-c-dropdown-option-white-space:
86
+ nowrap to truncate labels with an ellipsis instead of wrapping.
87
+ Defaults preserve today's wrapping behavior. */
88
+ white-space: var(--dx-c-dropdown-option-white-space, normal);
89
+ overflow: var(--dx-c-dropdown-option-overflow, visible);
90
+ text-overflow: var(--dx-c-dropdown-option-text-overflow, clip);
74
91
  }
75
92
 
76
93
  .option-indented .option_label {
@@ -7,6 +7,7 @@ import {
7
7
  IconSprite,
8
8
  IconData,
9
9
  IconSymbol,
10
+ StatusBadgeVariant,
10
11
  TypeBadgeSize
11
12
  } from "typings/custom";
12
13
  import { colorToDxColors, buildStyleColorVariables } from "dxUtils/css";
@@ -20,9 +21,16 @@ import {
20
21
  getContentTypeColorVariables
21
22
  } from "dxUtils/contentTypes";
22
23
 
24
+ // Opt-in solid status variants (status-success/-warning/-error).
25
+ export const STATUS_BADGE_VARIANTS: StatusBadgeVariant[] = [
26
+ "status-success",
27
+ "status-warning",
28
+ "status-error"
29
+ ];
30
+
23
31
  export default class TypeBadge extends LightningElement {
24
32
  @api size: TypeBadgeSize = "default";
25
- @api variant: Brand | ContentType = "default";
33
+ @api variant: Brand | ContentType | StatusBadgeVariant = "default";
26
34
  @api color?: Color;
27
35
  @api dark?: false;
28
36
 
@@ -87,11 +95,24 @@ export default class TypeBadge extends LightningElement {
87
95
  return isContentType(this.variant);
88
96
  }
89
97
 
98
+ private get isStatus(): boolean {
99
+ return STATUS_BADGE_VARIANTS.includes(
100
+ this.variant as StatusBadgeVariant
101
+ );
102
+ }
103
+
90
104
  private get className(): string {
91
- return cx("dx-badge", `size-${this.size}`);
105
+ return cx(
106
+ "dx-badge",
107
+ `size-${this.size}`,
108
+ this.isStatus && this.variant
109
+ );
92
110
  }
93
111
 
94
112
  private get style(): string {
113
+ if (this.isStatus) {
114
+ return "";
115
+ }
95
116
  if (this.dark) {
96
117
  return buildStyleColorVariables({
97
118
  background: "--dx-g-purple-vibrant-40",
@@ -26,6 +26,28 @@
26
26
  --height: var(--dx-g-spacing-mlg);
27
27
  }
28
28
 
29
+ .dx-badge.status-success,
30
+ .dx-badge.status-warning,
31
+ .dx-badge.status-error {
32
+ /* No spacing token maps to 10px; status badges need this exact padding. */
33
+ --horizontal-spacing: 10px;
34
+ }
35
+
36
+ .dx-badge.status-success {
37
+ --color: var(--sds-g-gray-1);
38
+ --background: var(--dx-g-green-vibrant-50);
39
+ }
40
+
41
+ .dx-badge.status-warning {
42
+ --color: var(--dx-g-gray-15);
43
+ --background: var(--dx-g-yellow-vibrant-80);
44
+ }
45
+
46
+ .dx-badge.status-error {
47
+ --color: var(--sds-g-gray-1);
48
+ --background: var(--dx-g-red-vibrant-40);
49
+ }
50
+
29
51
  svg,
30
52
  dx-icon {
31
53
  margin-right: var(--dx-g-spacing-sm);
package/LICENSE DELETED
@@ -1,12 +0,0 @@
1
- Copyright (c) 2020, Salesforce.com, Inc.
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
-
6
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
-
8
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
-
10
- * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
-
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.