@salesforcedevs/dx-components 1.40.1 → 1.40.3-toolbar-fix

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.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
- "gitHead": "e14396ab322a7cec69a1ebf180adbf8ac2902c3b"
48
- }
2
+ "name": "@salesforcedevs/dx-components",
3
+ "version": "1.40.3-toolbar-fix",
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.3"
48
+ }
@@ -132,12 +132,62 @@
132
132
  width: var(--dx-c-slot-empty-width, 52px);
133
133
  }
134
134
 
135
+ /*
136
+ * Renders a primary/secondary/tertiary button as an icon-only square while
137
+ * keeping a slotted label in the DOM for screen readers. The square width
138
+ * reuses --dx-c-slot-empty-width so callers can tune it the same way as the
139
+ * slot-empty path. position: relative anchors the visually-hidden label.
140
+ */
141
+ .button.variant_primary.icon-only,
142
+ .button.variant_secondary.icon-only,
143
+ .button.variant_tertiary.icon-only {
144
+ position: relative;
145
+ padding: 0;
146
+ }
147
+
148
+ .button.size-large.icon-only {
149
+ width: var(--dx-c-slot-empty-width, var(--dx-g-spacing-3xl));
150
+ }
151
+
152
+ .button.size-small.icon-only {
153
+ width: var(--dx-c-slot-empty-width, var(--dx-g-spacing-xl));
154
+ }
155
+
156
+ .button.size-hero.icon-only {
157
+ width: var(--dx-c-slot-empty-width, 52px);
158
+ }
159
+
160
+ /*
161
+ * Visually hide the slotted label but keep it accessible. Scoped to the
162
+ * content span (not the loading-message span) so the loading state still
163
+ * reads out.
164
+ */
165
+ .button.icon-only > span[part="content"] {
166
+ position: absolute;
167
+ width: 1px;
168
+ height: 1px;
169
+ margin: -1px;
170
+ padding: 0;
171
+ overflow: hidden;
172
+ clip: rect(0 0 0 0);
173
+ white-space: nowrap;
174
+ border: 0;
175
+ }
176
+
177
+ /* The hidden label leaves no visible text, so drop the icon gap. */
178
+ .button.icon-only.icon-right > *:nth-child(2),
179
+ .button.icon-only.icon-left > *:nth-child(2) {
180
+ margin-left: 0;
181
+ margin-right: 0;
182
+ }
183
+
135
184
  /* primary */
136
185
 
137
186
  .button.variant_primary {
138
187
  color: white;
139
188
  background: var(--dx-c-button-primary-color);
140
- border: 1px solid var(--dx-c-button-primary-color);
189
+ border: var(--dx-c-button-border-width, 1px) solid
190
+ var(--dx-c-button-primary-color);
141
191
  }
142
192
 
143
193
  .button.variant_primary:hover,
@@ -159,7 +209,8 @@
159
209
  .button.variant_secondary,
160
210
  .button.variant_quaternary {
161
211
  color: var(--dx-c-button-secondary-color);
162
- border: 1px solid var(--dx-c-button-secondary-color);
212
+ border: var(--dx-c-button-border-width, var(--dx-g-spacing-2xs)) solid
213
+ var(--dx-c-button-secondary-color);
163
214
  }
164
215
 
165
216
  .button.variant_secondary:hover,
@@ -175,7 +226,7 @@
175
226
  .button.variant_inline,
176
227
  .button.variant_inline-inherit {
177
228
  color: var(--dx-c-button-inline-color);
178
- border: 1px solid transparent;
229
+ border: var(--dx-c-button-border-width, 1px) solid transparent;
179
230
  }
180
231
 
181
232
  .button.variant_inline.light-text {
@@ -221,7 +272,8 @@
221
272
  .button.variant_icon-only:hover.state-disabled {
222
273
  color: var(--dx-c-button-custom-color);
223
274
  background: var(--dx-c-button-custom-background);
224
- border: 1px solid var(--dx-c-button-custom-border);
275
+ border: var(--dx-c-button-border-width, 1px) solid
276
+ var(--dx-c-button-custom-border);
225
277
  }
226
278
 
227
279
  .button.variant_custom:hover,
@@ -22,6 +22,7 @@ export default class Button extends LightningElement {
22
22
  @api loading: boolean = false;
23
23
  @api size: ButtonSize = "small";
24
24
  @api variant: ButtonVariant = "primary";
25
+ @api iconOnly: boolean = false;
25
26
  @api inlineTextColor: ButtonTextColor = "dark";
26
27
  @api font: "display" | "sans" = "display";
27
28
  @api form: string | undefined;
@@ -61,6 +62,7 @@ export default class Button extends LightningElement {
61
62
  `variant_${this.variant}`,
62
63
  {
63
64
  "slot-empty": !isIconOnly && !this.loading && this.isSlotEmpty,
65
+ "icon-only": this.iconOnly,
64
66
  "state-disabled": this.disabled,
65
67
  "state-loading": this.loading,
66
68
  "style-icon": !!this.iconSymbol,
@@ -1,6 +1,6 @@
1
1
  @import "dxHelpers/reset";
2
2
 
3
- .menu-nested::part(content) {
3
+ .menu-nested:not(.menu-fit-content)::part(content) {
4
4
  padding-top: var(--dx-g-spacing-sm);
5
5
  width: 354px;
6
6
  }
@@ -14,6 +14,32 @@
14
14
  display: none;
15
15
  }
16
16
 
17
+ .menu-fit-content {
18
+ --dx-c-popover-width: max-content;
19
+ --dx-c-popover-padding: var(--dx-g-spacing-sm) 0;
20
+ }
21
+
22
+ .menu-fit-content .menu_list {
23
+ width: 100%;
24
+ align-items: flex-start;
25
+ gap: var(--dx-g-spacing-sm);
26
+ }
27
+
28
+ .menu-fit-content.menu-nested .menu_option:not(:first-child) {
29
+ border-top: var(--border);
30
+ margin-top: 0;
31
+ padding-top: var(--dx-g-spacing-sm);
32
+ }
33
+
34
+ .menu-fit-content .menu_heading {
35
+ margin: 0;
36
+ padding: var(--dx-g-spacing-smd) var(--dx-g-spacing-lg);
37
+ font-family: var(--dx-g-font-sans);
38
+ line-height: var(--dx-g-spacing-mlg);
39
+ text-transform: none;
40
+ color: var(--dx-g-gray-10);
41
+ }
42
+
17
43
  @media screen and (max-width: 1000px) {
18
44
  .menu-nested .menu_option:not(:first-child) {
19
45
  border-top: var(--border);
@@ -52,7 +78,7 @@
52
78
  }
53
79
 
54
80
  .menu_option {
55
- --border: 1px solid var(--dx-g-blue-natural-90);
81
+ --border: 1px solid var(--dx-g-gray-80);
56
82
 
57
83
  display: flex;
58
84
  flex-direction: column;
@@ -70,7 +96,6 @@
70
96
  font-size: var(--dx-g-text-sm);
71
97
  font-weight: bold;
72
98
  text-transform: uppercase;
73
- letter-spacing: 1px;
74
99
  margin: var(--dx-g-spacing-sm);
75
100
  }
76
101
 
@@ -2,15 +2,16 @@
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
+ onopen={onOpen}
8
9
  open-on-hover={openOnHover}
9
10
  open={open}
10
11
  page-padding={pagePadding}
11
12
  placement={placement}
12
13
  small={small}
13
- width={width}
14
+ width={effectiveWidth}
14
15
  >
15
16
  <slot slot="control"></slot>
16
17
  <div
@@ -33,6 +34,7 @@
33
34
  option={option}
34
35
  nav-item-label={navItemLabel}
35
36
  variant={variant}
37
+ width-mode={widthMode}
36
38
  ></dx-dropdown-option>
37
39
  <div
38
40
  key={option.id}
@@ -52,6 +54,7 @@
52
54
  onselect={onOptionClick}
53
55
  option={suboption}
54
56
  nav-item-label={navItemLabel}
57
+ width-mode={widthMode}
55
58
  ></dx-dropdown-option>
56
59
  </template>
57
60
  <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,29 @@ 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;
84
99
  return cx(
85
100
  this.isNested && "menu-nested",
86
- this.isNested && this.options.length >= 2 && "menu-nested-2-col",
101
+ this.isNested &&
102
+ this.options.length >= 2 &&
103
+ !fitContent &&
104
+ "menu-nested-2-col",
87
105
  this.offset && `menu-offset-${this.offset}`,
88
- this.areOptionsEmpty && "menu-hidden"
106
+ this.areOptionsEmpty && "menu-hidden",
107
+ fitContent && "menu-fit-content"
89
108
  );
90
109
  }
91
110
 
@@ -166,6 +185,11 @@ export default class Dropdown extends LightningElement {
166
185
 
167
186
  private onClose(): void {
168
187
  this._focusedValue = null;
188
+ this.dispatchEvent(new CustomEvent("close"));
189
+ }
190
+
191
+ private onOpen(): void {
192
+ this.dispatchEvent(new CustomEvent("open"));
169
193
  }
170
194
 
171
195
  private focusDefaultOption() {
@@ -1,8 +1,8 @@
1
1
  @import "dxHelpers/reset";
2
2
 
3
3
  .indented-shape {
4
- --background: rgb(170 203 255);
5
- --wide: 2px;
4
+ --background: var(--dx-g-cloud-blue-vibrant-80);
5
+ --wide: var(--dx-g-spacing-2xs);
6
6
 
7
7
  background-color: var(--background);
8
8
  height: var(--wide);
@@ -27,22 +27,23 @@
27
27
  width: 100%;
28
28
  padding: var(--dx-g-spacing-sm);
29
29
  font-size: var(--dx-g-text-sm);
30
- border-radius: var(--dx-g-spacing-xs);
31
30
  transition: var(--dx-g-transition-hue-1x);
32
31
  align-items: center;
33
32
  outline: none !important;
34
33
  }
35
34
 
36
- .option:focus {
37
- box-shadow: inset 0 0 0 1px var(--dx-g-blue-vibrant-50);
38
- }
39
-
40
35
  .option:active {
41
36
  background: var(--dx-g-cloud-blue-vibrant-95) !important;
42
37
  }
43
38
 
44
- .option:not(.option-active):hover {
45
- background: var(--dx-g-gray-95);
39
+ .option:not(.option-active):hover,
40
+ .option:not(.option-active):focus-visible {
41
+ background: var(--dx-g-cloud-blue-vibrant-95);
42
+ }
43
+
44
+ .option:focus-visible {
45
+ box-shadow: inset 0 0 0 2px var(--dx-g-blue-vibrant-60),
46
+ inset 0 0 0 4px white;
46
47
  }
47
48
 
48
49
  .option-active {
@@ -101,6 +102,46 @@
101
102
  padding-bottom: var(--dx-g-spacing-xs);
102
103
  }
103
104
 
105
+ .option-fit-content {
106
+ min-width: 0;
107
+ padding: var(--dx-g-spacing-sm) var(--dx-g-spacing-lg);
108
+ }
109
+
110
+ .option-fit-content .option_details {
111
+ align-items: flex-start;
112
+ gap: var(--dx-g-spacing-sm);
113
+ min-width: 0;
114
+ flex: 1;
115
+ }
116
+
117
+ .option-fit-content .option_description {
118
+ margin-top: 0;
119
+ }
120
+
121
+ .option-fit-content .option_label {
122
+ display: block;
123
+ color: var(--dx-g-gray-10);
124
+ font-weight: var(--dx-g-font-normal);
125
+ line-height: var(--dx-g-spacing-lg);
126
+ white-space: nowrap;
127
+ overflow: hidden;
128
+ text-overflow: ellipsis;
129
+ max-width: calc(100vw - var(--dx-g-spacing-lg) * 4);
130
+ }
131
+
132
+ .option-fit-content.option-active .option_label {
133
+ color: var(--dx-g-blue-vibrant-50);
134
+ }
135
+
136
+ .option-fit-content .option_icon {
137
+ --dx-c-icon-size: var(--dx-g-icon-size-md);
138
+ --dx-c-icon-color: var(--dx-g-gray-50);
139
+
140
+ order: 1;
141
+ margin-right: 0;
142
+ margin-left: var(--dx-g-spacing-2xl);
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;
@@ -15,7 +15,7 @@
15
15
  symbol={option.iconSymbol}
16
16
  sprite={option.iconSprite}
17
17
  if:true={option.iconSymbol}
18
- size="large"
18
+ size={optionIconSize}
19
19
  ></dx-icon>
20
20
  <div class="option_details">
21
21
  <div if:true={renderIndentedShape} class="indented-shape"></div>
@@ -45,7 +45,7 @@
45
45
  sprite={option.iconSprite}
46
46
  color={option.iconColor}
47
47
  if:true={option.iconSymbol}
48
- size="large"
48
+ size={optionIconSize}
49
49
  ></dx-icon>
50
50
  <div class="option_details">
51
51
  <div if:true={renderIndentedShape} class="indented-shape"></div>
@@ -3,7 +3,9 @@ import cx from "classnames";
3
3
  import {
4
4
  OptionWithNested,
5
5
  AnalyticsPayload,
6
- DropdownVariant
6
+ DropdownVariant,
7
+ DropdownWidthMode,
8
+ IconSize
7
9
  } from "typings/custom";
8
10
  import { track } from "dxUtils/analytics";
9
11
 
@@ -16,6 +18,7 @@ export default class DropdownOption extends LightningElement {
16
18
  @api analyticsPayload?: AnalyticsPayload | undefined;
17
19
  @api indexPosition: number = 0;
18
20
  @api variant: DropdownVariant = "base";
21
+ @api widthMode: DropdownWidthMode = "fixed";
19
22
 
20
23
  @api focus() {
21
24
  const option = this.template.querySelector(".option");
@@ -29,7 +32,8 @@ export default class DropdownOption extends LightningElement {
29
32
  return cx(
30
33
  "option",
31
34
  this.active && "option-active",
32
- this.variant && `option-${this.variant}`
35
+ this.variant && `option-${this.variant}`,
36
+ this.widthMode === "fit-content" && "option-fit-content"
33
37
  );
34
38
  }
35
39
 
@@ -37,6 +41,10 @@ export default class DropdownOption extends LightningElement {
37
41
  return this.variant === "indented" && this.indexPosition >= 1;
38
42
  }
39
43
 
44
+ private get optionIconSize(): IconSize {
45
+ return this.widthMode === "fit-content" ? "override" : "large";
46
+ }
47
+
40
48
  private onClick(e: PointerEvent) {
41
49
  this.dispatchEvent(
42
50
  new CustomEvent("select", { detail: this.keyValue })
@@ -23,7 +23,7 @@
23
23
  border: var(--popover-border);
24
24
  box-shadow: var(--dx-g-box-shadow-lg);
25
25
  border-radius: var(--popover-border-radius);
26
- width: 168px;
26
+ width: var(--dx-c-popover-width, 168px);
27
27
  max-width: calc(100vw - var(--dx-g-spacing-lg));
28
28
  max-height: 65vh;
29
29
  padding: var(--popover-padding);
@@ -44,6 +44,14 @@
44
44
  transform: var(--popover-container-open-transform);
45
45
  }
46
46
 
47
+ /* Adjust transform for top placement */
48
+ .popover-container[data-placement-side="top"].popover-container_open .popover {
49
+ transform: var(
50
+ --popover-container-open-transform-up,
51
+ var(--popover-container-open-transform)
52
+ );
53
+ }
54
+
47
55
  .popover-overridewidth {
48
56
  max-width: unset;
49
57
  }
@@ -80,7 +80,11 @@ export default class Popover extends LightningElement {
80
80
  this.control.setAttribute("aria-expanded", "true");
81
81
 
82
82
  if (this.popover) {
83
- this.autoUpdateCleanup = autoUpdate(this.control, this.popover, this.setPosition);
83
+ this.autoUpdateCleanup = autoUpdate(
84
+ this.control,
85
+ this.popover,
86
+ this.setPosition
87
+ );
84
88
  }
85
89
 
86
90
  this.dispatchEvent(new CustomEvent("open"));
@@ -337,6 +341,12 @@ export default class Popover extends LightningElement {
337
341
  top: `${y}px`
338
342
  });
339
343
 
344
+ // Expose the final placement side after any flip
345
+ popoverEl.setAttribute(
346
+ "data-placement-side",
347
+ placement.split("-")[0]
348
+ );
349
+
340
350
  if (this.arrow && middlewareData.arrow) {
341
351
  const { x: arrowX, y: arrowY } = middlewareData.arrow;
342
352
  const popoverPlacementSide = placement.split("-")[0] as
@@ -65,9 +65,15 @@
65
65
  }
66
66
 
67
67
  .dx-text-display-custom {
68
- color: var(--dx-c-section-heading-font-color, --dx-g-text-heading-color);
69
- font-family: var(--dx-c-section-heading-font-family, --dx-g-font-display);
70
- font-size: var(--dx-c-section-heading-font-size, --dx-g-text-3xl);
68
+ color: var(
69
+ --dx-c-section-heading-font-color,
70
+ var(--dx-g-text-heading-color)
71
+ );
72
+ font-family: var(
73
+ --dx-c-section-heading-font-family,
74
+ var(--dx-g-font-display)
75
+ );
76
+ font-size: var(--dx-c-section-heading-font-size, var(--dx-g-text-3xl));
71
77
  letter-spacing: var(--dx-c-section-heading-letter-spacing, -0.4px);
72
78
  line-height: var(--dx-c-section-heading-line-height, 40px);
73
79
  }
@@ -1,5 +1,7 @@
1
1
  :host {
2
2
  display: block;
3
+
4
+ --dx-c-select-border: 1px solid var(--dx-g-gray-50);
3
5
  }
4
6
 
5
7
  :host(:focus-visible) {
@@ -122,7 +124,7 @@ select {
122
124
  .select-element {
123
125
  height: calc(1.875rem + (1px * 2));
124
126
  width: 100%;
125
- border: 1px solid #dddbda;
127
+ border: var(--dx-c-select-border);
126
128
  border-radius: 0.25rem;
127
129
  background-color: transparent;
128
130
  transition: border 0.1s linear, background-color 0.1s linear;
@@ -8,6 +8,18 @@
8
8
  display: inherit;
9
9
  }
10
10
 
11
+ [aria-label][role~="tooltip"].is-visible::before,
12
+ [aria-label][role~="tooltip"].is-visible::after {
13
+ opacity: 1;
14
+ pointer-events: auto;
15
+ }
16
+
17
+ [aria-label][role~="tooltip"].is-suppressed:is(:hover, :focus)::before,
18
+ [aria-label][role~="tooltip"].is-suppressed:is(:hover, :focus)::after {
19
+ opacity: 0;
20
+ pointer-events: none;
21
+ }
22
+
11
23
  [role~="tooltip"][data-microtip-position|="bottom"]::before {
12
24
  background: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%28116,%20116,%20116,%201%29%22%20transform%3D%22rotate%28180%2018%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E")
13
25
  no-repeat;
@@ -1,5 +1,10 @@
1
1
  <template>
2
- <div data-microtip-position={placement} role="tooltip" aria-label={label}>
2
+ <div
3
+ class={tooltipClass}
4
+ data-microtip-position={placement}
5
+ role="tooltip"
6
+ aria-label={label}
7
+ >
3
8
  <slot></slot>
4
9
  </div>
5
10
  </template>
@@ -1,6 +1,21 @@
1
1
  import { LightningElement, api } from "lwc";
2
+ import cx from "classnames";
2
3
 
3
4
  export default class Tooltip extends LightningElement {
4
5
  @api placement?: String = "top";
5
6
  @api label: string = "";
7
+
8
+ // When true, the tooltip is shown regardless of hover/focus. Lets a
9
+ // consumer flash it programmatically
10
+ @api visible: boolean = false;
11
+
12
+ // Suppresses the tooltip while the trigger is hovered or focused e.g when a menu is open
13
+ @api suppressed: boolean = false;
14
+
15
+ get tooltipClass(): string {
16
+ return cx({
17
+ "is-visible": this.visible,
18
+ "is-suppressed": this.suppressed && !this.visible
19
+ });
20
+ }
6
21
  }
@@ -18,8 +18,7 @@ const VALID_BRANDS = [
18
18
  "revenue",
19
19
  "sales",
20
20
  "service",
21
- "success",
22
- "einstein"
21
+ "success"
23
22
  ];
24
23
 
25
24
  export const ANALYTICS_INFO = {
@@ -13,6 +13,5 @@ export const BRANDS = [
13
13
  "industries",
14
14
  "learning",
15
15
  "service",
16
- "analytics",
17
- "einstein"
16
+ "analytics"
18
17
  ] as Brand[];
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.