@salesforcedevs/dx-components 1.40.0 → 1.40.1-ai-toolbar-action

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-ai-toolbar-action",
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.1"
48
+ }
@@ -14,6 +14,34 @@
14
14
  display: none;
15
15
  }
16
16
 
17
+ .menu-fit-content::part(content) {
18
+ width: 282px;
19
+ padding: var(--dx-g-spacing-sm) 0;
20
+ border-radius: var(--dx-g-spacing-sm);
21
+ box-shadow: var(--dx-g-box-shadow-lg);
22
+ }
23
+
24
+ .menu-fit-content .menu_list {
25
+ width: 100%;
26
+ align-items: flex-start;
27
+ gap: var(--dx-g-spacing-sm);
28
+ }
29
+
30
+ .menu-fit-content.menu-nested .menu_option:not(:first-child) {
31
+ border-top: var(--border);
32
+ margin-top: 0;
33
+ padding-top: var(--dx-g-spacing-sm);
34
+ }
35
+
36
+ .menu-fit-content .menu_heading {
37
+ margin: 0;
38
+ padding: var(--dx-g-spacing-smd) var(--dx-g-spacing-lg);
39
+ font-family: var(--dx-g-font-sans);
40
+ line-height: var(--dx-g-spacing-mlg);
41
+ text-transform: none;
42
+ color: var(--dx-g-gray-10);
43
+ }
44
+
17
45
  @media screen and (max-width: 1000px) {
18
46
  .menu-nested .menu_option:not(:first-child) {
19
47
  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
@@ -33,6 +33,7 @@
33
33
  option={option}
34
34
  nav-item-label={navItemLabel}
35
35
  variant={variant}
36
+ width-mode={widthMode}
36
37
  ></dx-dropdown-option>
37
38
  <div
38
39
  key={option.id}
@@ -52,6 +53,7 @@
52
53
  onselect={onOptionClick}
53
54
  option={suboption}
54
55
  nav-item-label={navItemLabel}
56
+ width-mode={widthMode}
55
57
  ></dx-dropdown-option>
56
58
  </template>
57
59
  <dx-button
@@ -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,34 @@ 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
+ private get effectiveWidth() {
90
+ return this.isFitContent ? null : this.width;
91
+ }
92
+
93
+ private get effectiveFullWidth() {
94
+ return this.isFitContent ? false : this.fullWidth;
95
+ }
96
+
83
97
  private get className() {
98
+ const fitContent = this.isFitContent;
99
+ if (fitContent && (this.width || this.fullWidth)) {
100
+ console.error(
101
+ '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.'
102
+ );
103
+ }
84
104
  return cx(
85
105
  this.isNested && "menu-nested",
86
- this.isNested && this.options.length >= 2 && "menu-nested-2-col",
106
+ this.isNested &&
107
+ this.options.length >= 2 &&
108
+ !fitContent &&
109
+ "menu-nested-2-col",
87
110
  this.offset && `menu-offset-${this.offset}`,
88
- this.areOptionsEmpty && "menu-hidden"
111
+ this.areOptionsEmpty && "menu-hidden",
112
+ fitContent && "menu-fit-content"
89
113
  );
90
114
  }
91
115
 
@@ -101,6 +101,47 @@
101
101
  padding-bottom: var(--dx-g-spacing-xs);
102
102
  }
103
103
 
104
+ .option-fit-content {
105
+ padding: var(--dx-g-spacing-sm) var(--dx-g-spacing-lg);
106
+ }
107
+
108
+ .option-fit-content .option_details {
109
+ align-items: flex-start;
110
+ gap: var(--dx-g-spacing-sm);
111
+ min-width: 0;
112
+ flex: 1;
113
+ }
114
+
115
+ .option-fit-content .option_description {
116
+ margin-top: 0;
117
+ }
118
+
119
+ .option-fit-content .option_label {
120
+ display: block;
121
+ color: var(--dx-g-gray-10);
122
+ font-weight: var(--dx-g-font-normal);
123
+ line-height: var(--dx-g-spacing-lg);
124
+ white-space: nowrap;
125
+ overflow: hidden;
126
+ text-overflow: ellipsis;
127
+ }
128
+
129
+ .option-fit-content.option-active .option_label {
130
+ color: var(--dx-g-blue-vibrant-50);
131
+ }
132
+
133
+ .option-fit-content .option_icon {
134
+ order: 1;
135
+ margin-right: 0;
136
+ margin-left: var(--dx-g-spacing-2xl);
137
+ }
138
+
139
+ .option-fit-content .option_icon::part(svg) {
140
+ width: var(--dx-g-icon-size-md) !important;
141
+ height: var(--dx-g-icon-size-md) !important;
142
+ fill: var(--dx-g-gray-50) !important;
143
+ }
144
+
104
145
  .option-indented:not([data-index="0"]) {
105
146
  --base-indentation: calc(var(--dx-g-spacing-md) + var(--shape-width));
106
147
  --shape-width: 8px;
@@ -3,7 +3,8 @@ import cx from "classnames";
3
3
  import {
4
4
  OptionWithNested,
5
5
  AnalyticsPayload,
6
- DropdownVariant
6
+ DropdownVariant,
7
+ DropdownWidthMode
7
8
  } from "typings/custom";
8
9
  import { track } from "dxUtils/analytics";
9
10
 
@@ -16,6 +17,7 @@ export default class DropdownOption extends LightningElement {
16
17
  @api analyticsPayload?: AnalyticsPayload | undefined;
17
18
  @api indexPosition: number = 0;
18
19
  @api variant: DropdownVariant = "base";
20
+ @api widthMode: DropdownWidthMode = "fixed";
19
21
 
20
22
  @api focus() {
21
23
  const option = this.template.querySelector(".option");
@@ -29,7 +31,8 @@ export default class DropdownOption extends LightningElement {
29
31
  return cx(
30
32
  "option",
31
33
  this.active && "option-active",
32
- this.variant && `option-${this.variant}`
34
+ this.variant && `option-${this.variant}`,
35
+ this.widthMode === "fit-content" && "option-fit-content"
33
36
  );
34
37
  }
35
38
 
@@ -65,7 +65,8 @@ export class TreeHandler {
65
65
  isChildrenLoading: node.isChildrenLoading || false,
66
66
  link: node.link,
67
67
  method: node.method,
68
- showForwardArrow: node.showForwardArrow
68
+ showForwardArrow: node.showForwardArrow,
69
+ redirectToChild: node.redirectToChild
69
70
  };
70
71
 
71
72
  const mapItem = { node: convertedNode, parent };
@@ -49,6 +49,10 @@ export default class TreeItem extends LightningElement {
49
49
  return this.hasChildren || this.isChildrenLoading;
50
50
  }
51
51
 
52
+ private get isContentlessParent(): boolean {
53
+ return this.isParent && !!this._treeNode?.redirectToChild;
54
+ }
55
+
52
56
  private get showChildren(): boolean {
53
57
  return this.isExpanded && this.hasChildren;
54
58
  }
@@ -140,6 +144,23 @@ export default class TreeItem extends LightningElement {
140
144
  private onLinkClick(event: Event): void {
141
145
  this.preventDefaultLinkBehavior(event);
142
146
 
147
+ /**
148
+ * A content-less parent that redirects to a content child navigates
149
+ * like a normal link (navigation handles selection and ancestor
150
+ * expansion). A content-less parent whose chain has no content page to
151
+ * redirect to only expands, it is never selected.
152
+ */
153
+ if (this.isContentlessParent) {
154
+ if (this._treeNode.link?.href) {
155
+ this.sendGtm(event);
156
+ return;
157
+ }
158
+ const isSelectAction = false;
159
+ this.doExpand(isSelectAction);
160
+ this.sendGtm(event);
161
+ return;
162
+ }
163
+
143
164
  if (this.isParent) {
144
165
  const isSelectAction = true;
145
166
  this.doExpand(isSelectAction);
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <a href={href} class={tileClass} target={target}>
2
+ <a href={href} class={tileClass} target={target} aria-label={linkAriaLabel}>
3
3
  <div class="flex indentation" role="heading" aria-level={tileAriaLevel}>
4
4
  <div class="flex tile-expand-icon tile-icon" if:true={showArrow}>
5
5
  <dx-icon
@@ -37,6 +37,28 @@ export default class TreeTile extends LightningElement {
37
37
  return this.treeNode.level + 2;
38
38
  }
39
39
 
40
+ /**
41
+ * Accessible name for the link. If a parent redirects to its first child,
42
+ * include both the parent and child labels so the destination is clear to
43
+ * screen reader users (WCAG 2.4.4)
44
+ */
45
+ get linkAriaLabel(): string | null {
46
+ if (!this.treeNode.redirectToChild || !this.treeNode.link?.href) {
47
+ return null;
48
+ }
49
+ /**
50
+ * The redirect can target a deep descendant, so walk the first-child
51
+ * chain to the node that owns the destination link and name it.
52
+ */
53
+ let destination = this.treeNode.children?.[0];
54
+ while (destination?.redirectToChild) {
55
+ destination = destination.children?.[0];
56
+ }
57
+ return destination?.link?.href === this.treeNode.link.href
58
+ ? `${this.treeNode.label}, opens ${destination.label}`
59
+ : null;
60
+ }
61
+
40
62
  private get iconSize() {
41
63
  return "xsmall";
42
64
  }
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.