-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
385 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { createElement } from 'lwc'; | ||
import FlexiblePath from 'c/flexiblePath'; | ||
|
||
describe('c-flexible-path', () => { | ||
afterEach(() => { | ||
// The jsdom instance is shared across test cases in a single file so reset the DOM | ||
while (document.body.firstChild) { | ||
document.body.removeChild(document.body.firstChild); | ||
} | ||
}); | ||
|
||
it('TODO: test case generated by CLI command, please fill in test logic', () => { | ||
// Arrange | ||
const element = createElement('c-flexible-path', { | ||
is: FlexiblePath | ||
}); | ||
|
||
// Act | ||
document.body.appendChild(element); | ||
|
||
// Assert | ||
// const div = element.shadowRoot.querySelector('div'); | ||
expect(1).toBe(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* { | ||
--slds-c-icon-color-foreground-default: white; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
<template> | ||
<!-- using slot like carousel does, each item provides text and state, maybe a click action handler | ||
We also need API props for "next action 'text', 'icon', and 'click action handler'" | ||
For "Scheduled" mode we should have Configure, Scheduled RollupCalculate Job, Deploy Child Trigger, and finally Activate --> | ||
<div class="slds-path"> | ||
<div class="slds-grid slds-path__track"> | ||
<div class="slds-grid slds-path__scroller-container"> | ||
<div class="slds-path__scroller"> | ||
<div class="slds-path__scroller_inner"> | ||
<ul | ||
class="slds-path__nav" | ||
role="listbox" | ||
aria-orientation="horizontal" | ||
aria-labelledby="slds-path__stage-name" | ||
> | ||
<template for:each={steps} for:item="step"> | ||
<li | ||
class="slds-path__item slds-is-complete" | ||
role="presentation" | ||
lwc:if={step.isComplete} | ||
key={step.label} | ||
> | ||
<a | ||
aria-selected="false" | ||
class="slds-path__link" | ||
href="#" | ||
role="option" | ||
tabindex="-1" | ||
> | ||
<span class="slds-path__stage"> | ||
<lightning-icon | ||
icon-name="utility:check" | ||
size="x-small" | ||
alternative-text="Stage Complete" | ||
></lightning-icon> | ||
</span> | ||
<span class="slds-path__title">{step.label}</span> | ||
</a> | ||
</li> | ||
<li | ||
class="slds-path__item slds-is-current slds-is-active" | ||
role="presentation" | ||
lwc:if={step.isCurrent} | ||
key={step.label} | ||
> | ||
<a | ||
aria-selected="false" | ||
class="slds-path__link" | ||
href="#" | ||
role="option" | ||
tabindex="-1" | ||
> | ||
<span class="slds-path__stage"> | ||
<lightning-icon | ||
icon-name="utility:check" | ||
size="x-small" | ||
alternative-text="Current Stage:" | ||
></lightning-icon> | ||
</span> | ||
<span class="slds-path__title">{step.label}</span> | ||
</a> | ||
</li> | ||
<li | ||
class="slds-path__item slds-is-incomplete" | ||
role="presentation" | ||
lwc:elseif={step.isIncomplete} | ||
key={step.label} | ||
> | ||
<a | ||
aria-selected="false" | ||
class="slds-path__link" | ||
href="#" | ||
role="option" | ||
tabindex="-1" | ||
> | ||
<span class="slds-path__stage"> | ||
<lightning-icon | ||
icon-name="utility:check" | ||
size="x-small" | ||
></lightning-icon> | ||
</span> | ||
<span class="slds-path__title">{step.label}</span> | ||
</a> | ||
</li> | ||
</template> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="slds-grid slds-path__action" lwc:if={nextActionLabel}> | ||
<span id="slds-path__stage-name" class="slds-path__stage-name" | ||
>Next Action: {nextActionLabel}</span | ||
> | ||
<button | ||
class="slds-button slds-button_brand slds-path__mark-complete" | ||
onclick={handleNextActionClick} | ||
> | ||
{nextActionLabel} | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { LightningElement, api } from "lwc"; | ||
|
||
/** | ||
* @typedef step | ||
* @property {string} label | ||
* @property {"complete"|"current"|"incomplete"|"failed"} status | ||
*/ | ||
|
||
export default class FlexiblePath extends LightningElement { | ||
/** @type {step[]} */ | ||
@api | ||
get steps() { | ||
return this._steps; | ||
} | ||
|
||
set steps(val) { | ||
this._steps = val.map((v) => ({ | ||
...v, | ||
["is" + v.status.charAt(0).toUpperCase() + v.status.slice(1)]: true | ||
})); | ||
} | ||
|
||
get nextActionLabel() { | ||
if (!this.steps) { | ||
return "unknown"; | ||
} | ||
let nextLabel = this.steps.find((s) => s.status === "current")?.label; | ||
if (!nextLabel) { | ||
nextLabel = this.steps.find((s) => s.status === "incomplete")?.label; | ||
} | ||
return nextLabel; | ||
} | ||
|
||
handleNextActionClick() { | ||
this.dispatchEvent( | ||
new CustomEvent("nextactionclick", { | ||
detail: { | ||
label: this.nextActionLabel | ||
} | ||
}) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>59.0</apiVersion> | ||
<isExposed>false</isExposed> | ||
</LightningComponentBundle> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* { | ||
transition: width 500ms; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.