@salesforcedevs/dx-components 1.3.179 → 1.3.180-alpha
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/lwc.config.json +1 -4
- package/package.json +2 -3
- package/src/modules/dx/button/button.css +1 -4
- package/src/modules/dx/button/button.ts +2 -18
- package/src/modules/dx/checkbox/checkbox.ts +2 -26
- package/src/modules/dx/featuresListHeader/featuresListHeader.css +1 -6
- package/src/modules/dx/featuresListHeader/featuresListHeader.html +1 -3
- package/src/modules/dx/featuresListHeader/featuresListHeader.ts +1 -14
- package/src/modules/dx/input/input.css +0 -4
- package/src/modules/dx/input/input.html +0 -1
- package/src/modules/dx/input/input.ts +7 -56
- package/src/modules/dx/scrollManager/scrollManager.ts +0 -1
- package/src/modules/dx/sectionBanner/sectionBanner.css +1 -57
- package/src/modules/dx/sectionBanner/sectionBanner.html +4 -18
- package/src/modules/dx/sectionBanner/sectionBanner.ts +3 -96
- package/src/modules/dx/select/select.ts +5 -28
- package/src/modules/dx/stepSequence/stepSequence.css +4 -0
- package/src/modules/dx/stepSequence/stepSequence.html +1 -2
- package/src/modules/dx/stepSequence/stepSequence.ts +34 -139
- package/src/modules/dx/trafficLabeler/trafficLabeler.html +1 -0
- package/src/modules/dx/trafficLabeler/trafficLabeler.ts +66 -0
- package/src/modules/dxUtils/css/css.ts +1 -4
- package/src/modules/dxUtils/lwc/lwc.ts +0 -15
- package/LICENSE +0 -12
- package/src/modules/dx/alert/alert.css +0 -108
- package/src/modules/dx/alert/alert.html +0 -36
- package/src/modules/dx/alert/alert.ts +0 -137
- package/src/modules/dx/cardStep/cardStep.css +0 -128
- package/src/modules/dx/cardStep/cardStep.html +0 -31
- package/src/modules/dx/cardStep/cardStep.ts +0 -55
- package/src/modules/dx/cardStep/mockProps.ts +0 -60
- package/src/modules/dxBaseElements/lightningElementWithState/lightningElementWithState.ts +0 -93
- package/src/modules/dxUtils/list/list.ts +0 -11
|
@@ -2,7 +2,6 @@ import cx from "classnames";
|
|
|
2
2
|
import { LightningElement, api } from "lwc";
|
|
3
3
|
import { SelectOption } from "typings/custom";
|
|
4
4
|
import { toJson, normalizeBoolean } from "dxUtils/normalizers";
|
|
5
|
-
import { reflectBooleanAttribute } from "dxUtils/lwc";
|
|
6
5
|
|
|
7
6
|
export const DEFAULT_MISSING_MESSAGE = "This field is required";
|
|
8
7
|
|
|
@@ -11,6 +10,7 @@ export default class Select extends LightningElement {
|
|
|
11
10
|
@api autocomplete?: string;
|
|
12
11
|
@api label?: string;
|
|
13
12
|
@api messageWhenValueMissing: string = DEFAULT_MISSING_MESSAGE;
|
|
13
|
+
@api name?: string;
|
|
14
14
|
@api placeholder?: string;
|
|
15
15
|
@api size?: string;
|
|
16
16
|
|
|
@@ -39,11 +39,6 @@ export default class Select extends LightningElement {
|
|
|
39
39
|
|
|
40
40
|
set required(value) {
|
|
41
41
|
this._required = normalizeBoolean(value);
|
|
42
|
-
reflectBooleanAttribute(
|
|
43
|
-
this as unknown as LightningElement,
|
|
44
|
-
"required",
|
|
45
|
-
value
|
|
46
|
-
);
|
|
47
42
|
}
|
|
48
43
|
|
|
49
44
|
@api
|
|
@@ -56,22 +51,11 @@ export default class Select extends LightningElement {
|
|
|
56
51
|
this.updateSelectValue();
|
|
57
52
|
}
|
|
58
53
|
|
|
59
|
-
@api
|
|
60
|
-
get name() {
|
|
61
|
-
return this._name;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
set name(name) {
|
|
65
|
-
this._name = name;
|
|
66
|
-
this.setAttribute("name", name); // reflect to HTML
|
|
67
|
-
}
|
|
68
|
-
|
|
69
54
|
_disabled = false;
|
|
70
55
|
_size = "";
|
|
71
56
|
_required = false;
|
|
72
57
|
_options: Array<SelectOption> = [];
|
|
73
58
|
_value: string = "";
|
|
74
|
-
_name?: string;
|
|
75
59
|
_selectElement: HTMLSelectElement | null = null;
|
|
76
60
|
helpMessage?: string = "";
|
|
77
61
|
|
|
@@ -95,16 +79,13 @@ export default class Select extends LightningElement {
|
|
|
95
79
|
|
|
96
80
|
get selectElement() {
|
|
97
81
|
if (!this._selectElement) {
|
|
98
|
-
this._selectElement =
|
|
99
|
-
|
|
82
|
+
this._selectElement = this.template.querySelector<HTMLSelectElement>(
|
|
83
|
+
"select"
|
|
84
|
+
);
|
|
100
85
|
}
|
|
101
86
|
return this._selectElement;
|
|
102
87
|
}
|
|
103
88
|
|
|
104
|
-
get isRequiredButEmpty() {
|
|
105
|
-
return this.required && !this.value;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
89
|
@api
|
|
109
90
|
blur(): void {
|
|
110
91
|
if (this.selectElement) {
|
|
@@ -121,17 +102,13 @@ export default class Select extends LightningElement {
|
|
|
121
102
|
|
|
122
103
|
@api
|
|
123
104
|
reportValidity(): boolean {
|
|
124
|
-
const isInvalid = this.
|
|
105
|
+
const isInvalid = this._required && !this._value;
|
|
125
106
|
this.helpMessage = isInvalid
|
|
126
107
|
? this.messageWhenValueMissing || DEFAULT_MISSING_MESSAGE
|
|
127
108
|
: "";
|
|
128
109
|
return !isInvalid;
|
|
129
110
|
}
|
|
130
111
|
|
|
131
|
-
@api checkValidity(): boolean {
|
|
132
|
-
return !this.isRequiredButEmpty;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
112
|
handleBlur(): void {
|
|
136
113
|
this.reportValidity();
|
|
137
114
|
this.dispatchEvent(new CustomEvent("blur"));
|
|
@@ -7,21 +7,12 @@ import cx from "classnames";
|
|
|
7
7
|
// forward/back buttons and via any action buttons defined in the dx-step-sequence-step components (see that
|
|
8
8
|
// component for details on the action buttons).
|
|
9
9
|
export default class StepSequence extends LightningElement {
|
|
10
|
-
@api animateTransitions = false;
|
|
11
|
-
@api communicateStepChanges = false;
|
|
12
|
-
@api forceInitiallyVisible = false;
|
|
13
10
|
@api initialStepIndex: string | undefined;
|
|
14
|
-
@api
|
|
15
|
-
@api sessionStorageId = "";
|
|
16
|
-
@api useHistory = false;
|
|
11
|
+
@api animateTransitions = false;
|
|
17
12
|
|
|
18
13
|
private currentStepIndex = 0;
|
|
19
|
-
private defaultScrollRestorationValue = history.scrollRestoration;
|
|
20
|
-
private didInitiallyBecomeVisible = false;
|
|
21
|
-
private isHiddenForInitialAnimation = true;
|
|
22
|
-
private measuredStepHeights: number[] = [];
|
|
23
|
-
private slotClassName = "step-sequence-steps-slot";
|
|
24
14
|
private steps: Array<HTMLElement> = [];
|
|
15
|
+
private isHiddenForInitialAnimation = true;
|
|
25
16
|
|
|
26
17
|
private get containerClassName() {
|
|
27
18
|
return cx("step-sequence-container", {
|
|
@@ -32,33 +23,16 @@ export default class StepSequence extends LightningElement {
|
|
|
32
23
|
|
|
33
24
|
connectedCallback() {
|
|
34
25
|
const initialStepIndex = parseInt(this.initialStepIndex as string, 10);
|
|
35
|
-
|
|
36
26
|
if (!isNaN(initialStepIndex)) {
|
|
37
27
|
this.currentStepIndex = initialStepIndex;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
currentStepIndex: this.currentStepIndex
|
|
47
|
-
},
|
|
48
|
-
""
|
|
49
|
-
);
|
|
50
|
-
window.addEventListener("popstate", this.handleHistoryPopstate);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (this.sessionStorageId) {
|
|
54
|
-
sessionStorage.setItem(
|
|
55
|
-
this.sessionStorageId,
|
|
56
|
-
JSON.stringify({
|
|
57
|
-
currentStepIndex: this.currentStepIndex
|
|
58
|
-
})
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
29
|
+
history.replaceState(
|
|
30
|
+
{
|
|
31
|
+
currentStepIndex: this.currentStepIndex
|
|
32
|
+
},
|
|
33
|
+
""
|
|
34
|
+
);
|
|
35
|
+
window.addEventListener("popstate", this.handleHistoryPopstate);
|
|
62
36
|
if (this.animateTransitions) {
|
|
63
37
|
this.addEventListener("transitionend", this.handleTransitionEnd);
|
|
64
38
|
} else {
|
|
@@ -66,33 +40,9 @@ export default class StepSequence extends LightningElement {
|
|
|
66
40
|
}
|
|
67
41
|
}
|
|
68
42
|
|
|
69
|
-
renderedCallback() {
|
|
70
|
-
// If we're not animating and we want to force visible, we can do it right on first render.
|
|
71
|
-
// If we're animating, this is handled after the initial animations end (to avoid seeing weird flashes).
|
|
72
|
-
if (this.forceInitiallyVisible && !this.didInitiallyBecomeVisible) {
|
|
73
|
-
this.didInitiallyBecomeVisible = true;
|
|
74
|
-
|
|
75
|
-
if (!this.animateTransitions) {
|
|
76
|
-
this.scrollToStepTop();
|
|
77
|
-
} else {
|
|
78
|
-
setTimeout(() => {
|
|
79
|
-
this.isHiddenForInitialAnimation = false;
|
|
80
|
-
requestAnimationFrame(() => {
|
|
81
|
-
this.scrollToStepTop();
|
|
82
|
-
});
|
|
83
|
-
}, 400);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
43
|
disconnectedCallback() {
|
|
89
44
|
window.removeEventListener("popstate", this.handleHistoryPopstate);
|
|
90
45
|
this.removeEventListener("transitionend", this.handleTransitionEnd);
|
|
91
|
-
history.scrollRestoration = this.defaultScrollRestorationValue;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
private scrollToStepTop() {
|
|
95
|
-
this.template.host.scrollIntoView();
|
|
96
46
|
}
|
|
97
47
|
|
|
98
48
|
// Used only if this.animateTransitions is truthy
|
|
@@ -105,6 +55,10 @@ export default class StepSequence extends LightningElement {
|
|
|
105
55
|
return;
|
|
106
56
|
}
|
|
107
57
|
|
|
58
|
+
if (this.isHiddenForInitialAnimation) {
|
|
59
|
+
this.isHiddenForInitialAnimation = false;
|
|
60
|
+
}
|
|
61
|
+
|
|
108
62
|
// Ensure subsequent steps are no longer visible:
|
|
109
63
|
const prevStep = this.steps[this.currentStepIndex - 1];
|
|
110
64
|
const nextStep = this.steps[this.currentStepIndex + 1];
|
|
@@ -117,38 +71,18 @@ export default class StepSequence extends LightningElement {
|
|
|
117
71
|
|
|
118
72
|
// Mark the current step as fully active:
|
|
119
73
|
this.steps[this.currentStepIndex].classList.add("active-step");
|
|
120
|
-
// Remove temporary minHeight set for nice animations, so that component will resize properly:
|
|
121
|
-
this.template.querySelector(
|
|
122
|
-
".step-sequence-container"
|
|
123
|
-
)!.style.minHeight = "auto";
|
|
124
74
|
};
|
|
125
75
|
|
|
126
|
-
// NOTE: This is the ultimate coordinator of step transitions; it should all go through here.
|
|
127
76
|
private changeActiveStep(nextStepIndex: number, updateHistory = true) {
|
|
128
|
-
if (
|
|
129
|
-
nextStepIndex === this.currentStepIndex ||
|
|
130
|
-
!this.isStepIndexWithinBounds(nextStepIndex)
|
|
131
|
-
) {
|
|
77
|
+
if (nextStepIndex === this.currentStepIndex) {
|
|
132
78
|
// Should never happen, but covering all logical bases. Nothing to do here.
|
|
133
79
|
return;
|
|
134
80
|
}
|
|
135
81
|
|
|
136
|
-
if (this.optimizePositionAfterAnimation) {
|
|
137
|
-
this.scrollToStepTop();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
82
|
if (!this.animateTransitions) {
|
|
141
83
|
this.steps[this.currentStepIndex].className = "";
|
|
142
84
|
this.steps[nextStepIndex].className = "visible active-step";
|
|
143
85
|
} else {
|
|
144
|
-
// Set minHeight temporarily to ensure nice animations:
|
|
145
|
-
this.template.querySelector(
|
|
146
|
-
".step-sequence-container"
|
|
147
|
-
)!.style.minHeight = `${
|
|
148
|
-
this.measuredStepHeights[nextStepIndex] ||
|
|
149
|
-
this.steps[nextStepIndex].clientHeight
|
|
150
|
-
}px`;
|
|
151
|
-
|
|
152
86
|
// If animations are enabled, we need to animate in the correct directions:
|
|
153
87
|
if (nextStepIndex > this.currentStepIndex) {
|
|
154
88
|
this.steps[this.currentStepIndex].className =
|
|
@@ -159,13 +93,9 @@ export default class StepSequence extends LightningElement {
|
|
|
159
93
|
"visible animate-right-out";
|
|
160
94
|
this.steps[nextStepIndex].className = "visible animate-in";
|
|
161
95
|
}
|
|
162
|
-
// Ensure focus cannot drift to invisible off-screen components
|
|
163
|
-
this.steps[nextStepIndex].removeAttribute("inert");
|
|
164
|
-
this.steps[this.currentStepIndex].setAttribute("inert", "true");
|
|
165
|
-
this.steps[nextStepIndex].focus();
|
|
166
96
|
}
|
|
167
97
|
|
|
168
|
-
if (
|
|
98
|
+
if (updateHistory) {
|
|
169
99
|
history.pushState(
|
|
170
100
|
{
|
|
171
101
|
currentStepIndex: nextStepIndex
|
|
@@ -173,29 +103,7 @@ export default class StepSequence extends LightningElement {
|
|
|
173
103
|
""
|
|
174
104
|
);
|
|
175
105
|
}
|
|
176
|
-
|
|
177
|
-
if (this.sessionStorageId) {
|
|
178
|
-
sessionStorage.setItem(
|
|
179
|
-
this.sessionStorageId,
|
|
180
|
-
JSON.stringify({
|
|
181
|
-
currentStepIndex: nextStepIndex
|
|
182
|
-
})
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
106
|
this.currentStepIndex = nextStepIndex;
|
|
187
|
-
|
|
188
|
-
if (this.communicateStepChanges) {
|
|
189
|
-
this.dispatchEvent(
|
|
190
|
-
new CustomEvent("stepsequencechange", {
|
|
191
|
-
detail: {
|
|
192
|
-
stepIndex: this.currentStepIndex
|
|
193
|
-
},
|
|
194
|
-
composed: true,
|
|
195
|
-
bubbles: true
|
|
196
|
-
})
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
107
|
}
|
|
200
108
|
|
|
201
109
|
private initializeStepAnimationClasses(
|
|
@@ -215,15 +123,10 @@ export default class StepSequence extends LightningElement {
|
|
|
215
123
|
}
|
|
216
124
|
}
|
|
217
125
|
|
|
218
|
-
@api
|
|
219
|
-
public getCurrentStepIndex(): number {
|
|
220
|
-
return this.currentStepIndex;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
126
|
// This method is available in case there are scenarios where a sequence needs to "jump" in some cases
|
|
224
127
|
@api
|
|
225
128
|
public jumpToStep(stepIndex: number) {
|
|
226
|
-
if (
|
|
129
|
+
if (stepIndex < 0 || stepIndex >= this.steps.length) {
|
|
227
130
|
// illegal value; ignore
|
|
228
131
|
return;
|
|
229
132
|
}
|
|
@@ -237,18 +140,8 @@ export default class StepSequence extends LightningElement {
|
|
|
237
140
|
}
|
|
238
141
|
}
|
|
239
142
|
|
|
240
|
-
@api
|
|
241
|
-
public remeasureSteps() {
|
|
242
|
-
this.measuredStepHeights = this.steps.map((step) => step.clientHeight);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
private isStepIndexWithinBounds(stepIndex: number) {
|
|
246
|
-
return stepIndex >= 0 && stepIndex < this.steps.length;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
143
|
handleHistoryPopstate = ({ state }: PopStateEvent) => {
|
|
250
|
-
if (typeof state
|
|
251
|
-
this.remeasureSteps();
|
|
144
|
+
if (typeof state.currentStepIndex === "number") {
|
|
252
145
|
this.changeActiveStep(state.currentStepIndex, false);
|
|
253
146
|
}
|
|
254
147
|
};
|
|
@@ -276,27 +169,29 @@ export default class StepSequence extends LightningElement {
|
|
|
276
169
|
// change it).
|
|
277
170
|
handleSlotChange(e: Event) {
|
|
278
171
|
const slot = e.target as HTMLSlotElement;
|
|
279
|
-
|
|
280
|
-
if (slot.className !== this.slotClassName) {
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
172
|
this.steps = slot.assignedElements() as HTMLElement[];
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
173
|
+
if (!this.animateTransitions) {
|
|
174
|
+
this.steps[this.currentStepIndex].className = "visible active-step";
|
|
175
|
+
} else {
|
|
176
|
+
// For transition animations to be visible, the container must have a height that will
|
|
177
|
+
// keep the components visible as they transition in and out. Currently this component
|
|
178
|
+
// will have at least the height of the "tallest" slotted element.
|
|
179
|
+
let minHeight = 0;
|
|
180
|
+
this.steps.forEach((step, index) => {
|
|
181
|
+
if (step.clientHeight > minHeight) {
|
|
182
|
+
minHeight = step.clientHeight;
|
|
183
|
+
}
|
|
288
184
|
this.initializeStepAnimationClasses(
|
|
289
185
|
this.currentStepIndex,
|
|
290
186
|
step,
|
|
291
187
|
index
|
|
292
188
|
);
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
189
|
+
});
|
|
190
|
+
if (minHeight > 0) {
|
|
191
|
+
this.template.querySelector(
|
|
192
|
+
".step-sequence-container"
|
|
193
|
+
)!.style.minHeight = `${minHeight}px`;
|
|
297
194
|
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
this.steps[this.currentStepIndex].className = "visible active-step";
|
|
195
|
+
}
|
|
301
196
|
}
|
|
302
197
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<template></template>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
|
|
3
|
+
const REDUNDANT_INSTANCE_ERROR_MESSAGE =
|
|
4
|
+
"Multiple <dx-traffic-labeler>s detected, this should never be the case.";
|
|
5
|
+
|
|
6
|
+
const CLEARBIT_PUBLIC_KEY = "pk_c7acb4500cec7a59c8c1199eeb8e041d";
|
|
7
|
+
|
|
8
|
+
declare module globalThis {
|
|
9
|
+
let singletonTrafficLabelerConnected: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default class TrafficLabeler extends LightningElement {
|
|
13
|
+
@api internalIps?: string;
|
|
14
|
+
|
|
15
|
+
renderedCallback() {}
|
|
16
|
+
|
|
17
|
+
connectedCallback(): void {
|
|
18
|
+
if (!globalThis.singletonTrafficLabelerConnected) {
|
|
19
|
+
globalThis.singletonTrafficLabelerConnected = true;
|
|
20
|
+
this.loadClearBitData();
|
|
21
|
+
} else {
|
|
22
|
+
console.error(REDUNDANT_INSTANCE_ERROR_MESSAGE);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async loadClearBitData() {
|
|
27
|
+
const result = await fetch(
|
|
28
|
+
`https://reveal.clearbit.com/v1/companies/reveal?authorization=${CLEARBIT_PUBLIC_KEY}`
|
|
29
|
+
);
|
|
30
|
+
const json = await result.json();
|
|
31
|
+
if (json.company.name.toLowerCase().includes("salesforce")) {
|
|
32
|
+
this.setTrafficType("internal");
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async evaluateVPNAddress() {
|
|
37
|
+
try {
|
|
38
|
+
const ipifyResult = await fetch(
|
|
39
|
+
"https://api.ipify.org/?format=json"
|
|
40
|
+
);
|
|
41
|
+
const result = await ipifyResult.json();
|
|
42
|
+
|
|
43
|
+
const internalIps = this.internalIps?.split(",");
|
|
44
|
+
let trafficType: "internal" | "external" = "external";
|
|
45
|
+
|
|
46
|
+
internalIps?.forEach((value) => {
|
|
47
|
+
const regex = new RegExp(value);
|
|
48
|
+
if (regex.exec(result.ip)) {
|
|
49
|
+
trafficType = "internal";
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
this.setTrafficType(trafficType);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error("fetch failed ", error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
setTrafficType(trafficType: "internal" | "external") {
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
const dataLayer = (window.dataLayer = window.dataLayer || []);
|
|
62
|
+
dataLayer.push({
|
|
63
|
+
traffic_type: trafficType
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -17,7 +17,6 @@ const LABEL_TO_DX_VAR: { [key: string]: string } = {
|
|
|
17
17
|
|
|
18
18
|
const DEFAULT_BACKGROUND_LEVEL = 95;
|
|
19
19
|
const DEFAULT_COLOR_LEVEL = 40;
|
|
20
|
-
const BROWSER_COLOR_REGEXP = /^(?:#[0-9A-F]{3,8}|rgba?\(.+\))/;
|
|
21
20
|
|
|
22
21
|
export const colorToDxColors = (
|
|
23
22
|
color?: Color
|
|
@@ -41,9 +40,7 @@ export const colorToDxColors = (
|
|
|
41
40
|
};
|
|
42
41
|
|
|
43
42
|
export const toDxColor = (color: string) =>
|
|
44
|
-
["white", "transparent"].includes(color)
|
|
45
|
-
? color
|
|
46
|
-
: `var(--dx-g-${color})`;
|
|
43
|
+
["white", "transparent"].includes(color) ? color : `var(--dx-g-${color})`;
|
|
47
44
|
|
|
48
45
|
export const buildStyleColorVariables = ({
|
|
49
46
|
background,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { LightningElement } from "lwc";
|
|
2
|
-
|
|
3
1
|
export const setContainerInnerHtml = (
|
|
4
2
|
container: HTMLElement,
|
|
5
3
|
markup: string
|
|
@@ -9,16 +7,3 @@ export const setContainerInnerHtml = (
|
|
|
9
7
|
container.innerHTML = markup;
|
|
10
8
|
}
|
|
11
9
|
};
|
|
12
|
-
|
|
13
|
-
export const reflectBooleanAttribute = <T extends LightningElement>(
|
|
14
|
-
element: T,
|
|
15
|
-
attrName: string,
|
|
16
|
-
value: string | boolean | undefined
|
|
17
|
-
) => {
|
|
18
|
-
// Reflect to HTML, accommodating the disparate ways HTML and LWC handle boolean attributes
|
|
19
|
-
if (value !== false) {
|
|
20
|
-
element.setAttribute(attrName, "");
|
|
21
|
-
} else {
|
|
22
|
-
element.removeAttribute(attrName);
|
|
23
|
-
}
|
|
24
|
-
};
|
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.
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
@import "dxHelpers/reset";
|
|
2
|
-
@import "dxHelpers/text";
|
|
3
|
-
|
|
4
|
-
:host {
|
|
5
|
-
--dx-c-alert-top: 0;
|
|
6
|
-
--dx-c-alert-container-align-items: flex-start;
|
|
7
|
-
--dx-c-alert-vertical-padding: var(--dx-g-spacing-md);
|
|
8
|
-
--dx-c-alert-success-color: var(--dx-g-green-vibrant-95);
|
|
9
|
-
--dx-c-alert-warning-color: rgb(254, 243, 217);
|
|
10
|
-
--dx-c-alert-danger-color: var(--dx-g-red-vibrant-95);
|
|
11
|
-
--dx-c-alert-success-accent-color: var(--dx-g-green-vibrant-80);
|
|
12
|
-
--dx-c-alert-warning-accent-color: var(--dx-g-yellow-vibrant-80);
|
|
13
|
-
--dx-c-alert-danger-accent-color: var(--dx-g-red-vibrant-50);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.alert-icon {
|
|
17
|
-
margin-right: var(--dx-g-spacing-md);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.alert-base {
|
|
21
|
-
padding: var(--dx-c-alert-vertical-padding);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.alert-container {
|
|
25
|
-
display: flex;
|
|
26
|
-
flex-direction: column;
|
|
27
|
-
align-items: var(--dx-c-alert-container-align-items);
|
|
28
|
-
padding-left: var(--dx-g-global-header-padding-horizontal);
|
|
29
|
-
padding-right: var(--dx-g-global-header-padding-horizontal);
|
|
30
|
-
width: 100%;
|
|
31
|
-
border: none;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.alert-container.alert-type-success {
|
|
35
|
-
background-color: var(--dx-c-alert-success-color);
|
|
36
|
-
border-color: var(--dx-c-alert-success-accent-color);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.alert-container.alert-type-warning {
|
|
40
|
-
background-color: var(--dx-c-alert-warning-color);
|
|
41
|
-
border-color: var(--dx-c-alert-warning-accent-color);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.alert-container.alert-type-danger {
|
|
45
|
-
background-color: var(--dx-c-alert-danger-color);
|
|
46
|
-
border-color: var(--dx-c-alert-danger-accent-color);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.alert-container.alert-variant-accented {
|
|
50
|
-
border-style: solid;
|
|
51
|
-
border-width: 0;
|
|
52
|
-
border-left-width: 4px;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.alert-title-container {
|
|
56
|
-
display: flex;
|
|
57
|
-
flex-direction: row;
|
|
58
|
-
align-items: center;
|
|
59
|
-
width: 100%;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.alert-title {
|
|
63
|
-
font-weight: var(--dx-g-font-bold);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
dx-button {
|
|
67
|
-
margin-left: auto;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/*
|
|
71
|
-
NOTE: Here we are assuming that indicator height won't go beyond 1000px.
|
|
72
|
-
|
|
73
|
-
It's one of the suggested way to achieve the expand/collapse animation
|
|
74
|
-
Ref: https://stackoverflow.com/a/41164095
|
|
75
|
-
|
|
76
|
-
Otherwise we need to change the height when user clicks on button
|
|
77
|
-
Ref: https://stackoverflow.com/a/11837673
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
.alert-body {
|
|
81
|
-
display: block;
|
|
82
|
-
max-height: 1000px;
|
|
83
|
-
overflow: hidden;
|
|
84
|
-
padding-top: var(--dx-g-spacing-smd);
|
|
85
|
-
transition: max-height 0.25s ease, padding 0.25s ease;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.alert-body-hidden {
|
|
89
|
-
max-height: 0;
|
|
90
|
-
padding-top: 0;
|
|
91
|
-
transition: max-height 0.1s ease-out, padding 0.25s ease-out;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.alert-body a {
|
|
95
|
-
color: var(--dx-g-blue-vibrant-50);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.dismissible-icon {
|
|
99
|
-
margin-left: auto;
|
|
100
|
-
cursor: pointer;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/* Small Devices */
|
|
104
|
-
@media screen and (max-width: 480px) {
|
|
105
|
-
.alert-container {
|
|
106
|
-
padding: var(--dx-c-alert-vertical-padding);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class={className} part="container">
|
|
3
|
-
<div class="alert-title-container">
|
|
4
|
-
<dx-icon
|
|
5
|
-
class="alert-icon"
|
|
6
|
-
symbol={iconName}
|
|
7
|
-
sprite={iconSprite}
|
|
8
|
-
size="large"
|
|
9
|
-
color={iconColor}
|
|
10
|
-
></dx-icon>
|
|
11
|
-
<p class="alert-title dx-text-body-3">{alertTitle}</p>
|
|
12
|
-
<dx-button
|
|
13
|
-
if:true={hideable}
|
|
14
|
-
variant="inline"
|
|
15
|
-
onclick={onShowHide}
|
|
16
|
-
aria-label={hideBodyText}
|
|
17
|
-
>
|
|
18
|
-
{hideBodyText}
|
|
19
|
-
</dx-button>
|
|
20
|
-
<dx-icon
|
|
21
|
-
class="dismissible-icon"
|
|
22
|
-
onclick={onDismiss}
|
|
23
|
-
if:true={dismissible}
|
|
24
|
-
symbol="close"
|
|
25
|
-
size="large"
|
|
26
|
-
color="status-icon-color"
|
|
27
|
-
></dx-icon>
|
|
28
|
-
</div>
|
|
29
|
-
<!--
|
|
30
|
-
NOTE: Here we are rendering mark up using lwc:dom & innerHTML
|
|
31
|
-
option instead of slots because the html markup will come as a
|
|
32
|
-
property to the component from a configuration
|
|
33
|
-
-->
|
|
34
|
-
<span lwc:dom="manual" class={bodyClassName}></span>
|
|
35
|
-
</div>
|
|
36
|
-
</template>
|