@paperless/core 1.67.4 → 1.67.6
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/CHANGELOG.md +22 -0
- package/dist/build/p-4ee6e401.entry.js +2 -0
- package/dist/build/p-4ee6e401.entry.js.map +1 -0
- package/dist/build/paperless.esm.js +1 -1
- package/dist/build/paperless.esm.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/p-stepper.cjs.entry.js +57 -30
- package/dist/cjs/p-stepper.cjs.entry.js.map +1 -1
- package/dist/cjs/paperless.cjs.js +1 -1
- package/dist/collection/components/molecules/stepper/stepper.component.js +75 -30
- package/dist/collection/components/molecules/stepper/stepper.component.js.map +1 -1
- package/dist/components/p-stepper.js +58 -30
- package/dist/components/p-stepper.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/p-stepper.entry.js +57 -30
- package/dist/esm/p-stepper.entry.js.map +1 -1
- package/dist/esm/paperless.js +1 -1
- package/dist/index.html +1 -1
- package/dist/paperless/p-4ee6e401.entry.js +2 -0
- package/dist/paperless/p-4ee6e401.entry.js.map +1 -0
- package/dist/paperless/paperless.esm.js +1 -1
- package/dist/paperless/paperless.esm.js.map +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/types/components/molecules/stepper/stepper.component.d.ts +9 -2
- package/dist/types/components.d.ts +8 -0
- package/hydrate/index.js +58 -30
- package/package.json +1 -1
- package/dist/build/p-9c1e350b.entry.js +0 -2
- package/dist/build/p-9c1e350b.entry.js.map +0 -1
- package/dist/paperless/p-9c1e350b.entry.js +0 -2
- package/dist/paperless/p-9c1e350b.entry.js.map +0 -1
|
@@ -3,6 +3,10 @@ export declare class Stepper {
|
|
|
3
3
|
* The currently active step
|
|
4
4
|
*/
|
|
5
5
|
activeStep: number;
|
|
6
|
+
/**
|
|
7
|
+
* Wether to automatically apply active & finished to items
|
|
8
|
+
*/
|
|
9
|
+
enableAutoStatus: boolean;
|
|
6
10
|
/**
|
|
7
11
|
* The direction of the stepper
|
|
8
12
|
*/
|
|
@@ -16,11 +20,14 @@ export declare class Stepper {
|
|
|
16
20
|
*/
|
|
17
21
|
private _el;
|
|
18
22
|
private _rendering;
|
|
19
|
-
private
|
|
20
|
-
private
|
|
23
|
+
private _generateTimeout;
|
|
24
|
+
private _resizeObserver;
|
|
21
25
|
private _onSlotChange;
|
|
26
|
+
private _generateStepsOnce;
|
|
22
27
|
private _generateSteps;
|
|
28
|
+
private _setStepperLineData;
|
|
23
29
|
componentDidLoad(): void;
|
|
30
|
+
disconnectCallback(): void;
|
|
24
31
|
render(): any;
|
|
25
32
|
protected _onActiveStepChange(): void;
|
|
26
33
|
}
|
|
@@ -1177,6 +1177,10 @@ export namespace Components {
|
|
|
1177
1177
|
* The direction of the stepper
|
|
1178
1178
|
*/
|
|
1179
1179
|
"direction": 'horizontal' | 'vertical';
|
|
1180
|
+
/**
|
|
1181
|
+
* Wether to automatically apply active & finished to items
|
|
1182
|
+
*/
|
|
1183
|
+
"enableAutoStatus": boolean;
|
|
1180
1184
|
}
|
|
1181
1185
|
interface PStepperItem {
|
|
1182
1186
|
/**
|
|
@@ -3495,6 +3499,10 @@ declare namespace LocalJSX {
|
|
|
3495
3499
|
* The direction of the stepper
|
|
3496
3500
|
*/
|
|
3497
3501
|
"direction"?: 'horizontal' | 'vertical';
|
|
3502
|
+
/**
|
|
3503
|
+
* Wether to automatically apply active & finished to items
|
|
3504
|
+
*/
|
|
3505
|
+
"enableAutoStatus"?: boolean;
|
|
3498
3506
|
}
|
|
3499
3507
|
interface PStepperItem {
|
|
3500
3508
|
/**
|
package/hydrate/index.js
CHANGED
|
@@ -21796,12 +21796,19 @@ const stepperComponentCss = "/*!@.flex*/.flex.sc-p-stepper{display:flex!importan
|
|
|
21796
21796
|
class Stepper {
|
|
21797
21797
|
constructor(hostRef) {
|
|
21798
21798
|
registerInstance(this, hostRef);
|
|
21799
|
-
this.
|
|
21800
|
-
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
if (
|
|
21799
|
+
this._onSlotChange = async (_e) => this._generateStepsOnce();
|
|
21800
|
+
this._generateStepsOnce = () => {
|
|
21801
|
+
if (this._rendering) {
|
|
21802
|
+
return;
|
|
21803
|
+
}
|
|
21804
|
+
if (this._generateTimeout) {
|
|
21805
|
+
clearTimeout(this._generateTimeout);
|
|
21806
|
+
this._generateTimeout = null;
|
|
21807
|
+
}
|
|
21808
|
+
this._generateTimeout = setTimeout(() => this._generateSteps());
|
|
21809
|
+
};
|
|
21810
|
+
this._generateSteps = async () => {
|
|
21811
|
+
if (!this._el || this._rendering) {
|
|
21805
21812
|
return;
|
|
21806
21813
|
}
|
|
21807
21814
|
this._rendering = true;
|
|
@@ -21818,48 +21825,51 @@ class Stepper {
|
|
|
21818
21825
|
}
|
|
21819
21826
|
}
|
|
21820
21827
|
}
|
|
21828
|
+
let directionChanged = false;
|
|
21821
21829
|
for (let i = 0; i < (items === null || items === void 0 ? void 0 : items.length); i++) {
|
|
21822
|
-
let directionChanged = false;
|
|
21823
21830
|
const item = items.item(i);
|
|
21824
|
-
|
|
21825
|
-
|
|
21826
|
-
|
|
21831
|
+
if (this.enableAutoStatus) {
|
|
21832
|
+
item.active = i === activeStep;
|
|
21833
|
+
item.finished = i < activeStep;
|
|
21834
|
+
}
|
|
21835
|
+
if (item.direction !== this.direction && !directionChanged) {
|
|
21827
21836
|
directionChanged = true;
|
|
21828
21837
|
}
|
|
21829
21838
|
item.direction = this.direction;
|
|
21830
21839
|
item.align =
|
|
21831
21840
|
i === 0 ? 'start' : i === (items === null || items === void 0 ? void 0 : items.length) - 1 ? 'end' : 'center';
|
|
21832
21841
|
item.contentPosition = this.contentPosition;
|
|
21842
|
+
}
|
|
21843
|
+
if (directionChanged) {
|
|
21844
|
+
// super hacky way to ensure all elements that have a direction changed are re-rendered
|
|
21845
|
+
await new Promise(resolve => setTimeout(resolve, 200));
|
|
21846
|
+
}
|
|
21847
|
+
for (let i = 0; i < (items === null || items === void 0 ? void 0 : items.length); i++) {
|
|
21848
|
+
const item = items.item(i);
|
|
21833
21849
|
if (i < items.length - 1) {
|
|
21834
|
-
|
|
21850
|
+
let nextItem = item.nextElementSibling;
|
|
21835
21851
|
if (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-item') {
|
|
21836
|
-
// super hacky, but we want to wait for the css of the `item.direction` change to be applied before querying for the item.clientHeight
|
|
21837
|
-
// otherwise we always get the initial "16"
|
|
21838
|
-
if (directionChanged) {
|
|
21839
|
-
await this._delay(10);
|
|
21840
|
-
}
|
|
21841
|
-
const heightDiff = (item.clientHeight > 16
|
|
21842
|
-
? item.clientHeight - 16
|
|
21843
|
-
: item.clientHeight) / 2;
|
|
21844
21852
|
const stepperLine = document.createElement('p-stepper-line');
|
|
21845
|
-
stepperLine.direction = this.direction;
|
|
21846
|
-
stepperLine.active = i < activeStep;
|
|
21847
|
-
if (heightDiff > 0 && this.direction === 'vertical') {
|
|
21848
|
-
stepperLine.style.marginTop = `-${heightDiff / 16}rem`;
|
|
21849
|
-
stepperLine.style.marginBottom = `-${heightDiff / 16}rem`;
|
|
21850
|
-
stepperLine.style.minHeight = `calc(1rem + ${(heightDiff * 2) / 16}rem)`;
|
|
21851
|
-
}
|
|
21852
21853
|
this._el.insertBefore(stepperLine, nextItem);
|
|
21854
|
+
this._setStepperLineData(stepperLine, item, nextItem, i, activeStep);
|
|
21853
21855
|
const previous = stepperLine.previousElementSibling;
|
|
21854
21856
|
if (previous && previous.tagName.toLowerCase() === 'p-stepper-line') {
|
|
21855
21857
|
previous.remove();
|
|
21856
21858
|
}
|
|
21857
21859
|
continue;
|
|
21858
21860
|
}
|
|
21861
|
+
if (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-line') {
|
|
21862
|
+
const stepperLine = nextItem;
|
|
21863
|
+
nextItem = nextItem.nextElementSibling;
|
|
21864
|
+
if (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-item') {
|
|
21865
|
+
this._setStepperLineData(stepperLine, item, nextItem, i, activeStep);
|
|
21866
|
+
}
|
|
21867
|
+
}
|
|
21859
21868
|
}
|
|
21860
21869
|
if (i > 0) {
|
|
21861
21870
|
const previousItem = item.previousElementSibling;
|
|
21862
|
-
if (previousItem
|
|
21871
|
+
if (previousItem &&
|
|
21872
|
+
previousItem.tagName.toLowerCase() === 'p-stepper-line') {
|
|
21863
21873
|
previousItem.direction = this.direction;
|
|
21864
21874
|
previousItem.active = item.active || item.finished;
|
|
21865
21875
|
}
|
|
@@ -21872,20 +21882,37 @@ class Stepper {
|
|
|
21872
21882
|
}
|
|
21873
21883
|
setTimeout(() => (this._rendering = false), 100);
|
|
21874
21884
|
};
|
|
21885
|
+
this._setStepperLineData = (stepperLine, item, nextItem, i, activeStep) => {
|
|
21886
|
+
const heightDiff = item.clientHeight / 2;
|
|
21887
|
+
const heightDiffNext = nextItem.clientHeight / 2;
|
|
21888
|
+
stepperLine.direction = this.direction;
|
|
21889
|
+
stepperLine.active = i < activeStep;
|
|
21890
|
+
if (heightDiff > 0 && this.direction === 'vertical') {
|
|
21891
|
+
stepperLine.style.marginTop = `-${heightDiff / 16}rem`;
|
|
21892
|
+
stepperLine.style.marginBottom = `-${heightDiffNext / 16}rem`;
|
|
21893
|
+
stepperLine.style.minHeight = `calc(1rem + ${(heightDiff + heightDiffNext) / 16}rem)`;
|
|
21894
|
+
}
|
|
21895
|
+
};
|
|
21875
21896
|
this.activeStep = 1;
|
|
21897
|
+
this.enableAutoStatus = true;
|
|
21876
21898
|
this.direction = 'horizontal';
|
|
21877
21899
|
this.contentPosition = 'end';
|
|
21878
21900
|
this._rendering = false;
|
|
21879
21901
|
}
|
|
21880
21902
|
componentDidLoad() {
|
|
21881
|
-
this.
|
|
21882
|
-
this.
|
|
21903
|
+
this._resizeObserver = new ResizeObserver(() => this._generateStepsOnce());
|
|
21904
|
+
this._resizeObserver.observe(this._el);
|
|
21905
|
+
}
|
|
21906
|
+
disconnectCallback() {
|
|
21907
|
+
if (this._resizeObserver) {
|
|
21908
|
+
this._resizeObserver.disconnect();
|
|
21909
|
+
}
|
|
21883
21910
|
}
|
|
21884
21911
|
render() {
|
|
21885
21912
|
return (hAsync(Host, { class: 'p-stepper' }, hAsync("slot", { onSlotchange: this._onSlotChange })));
|
|
21886
21913
|
}
|
|
21887
21914
|
_onActiveStepChange() {
|
|
21888
|
-
this.
|
|
21915
|
+
this._generateStepsOnce();
|
|
21889
21916
|
}
|
|
21890
21917
|
get _el() { return getElement(this); }
|
|
21891
21918
|
static get watchers() { return {
|
|
@@ -21897,6 +21924,7 @@ class Stepper {
|
|
|
21897
21924
|
"$tagName$": "p-stepper",
|
|
21898
21925
|
"$members$": {
|
|
21899
21926
|
"activeStep": [2, "active-step"],
|
|
21927
|
+
"enableAutoStatus": [4, "enable-auto-status"],
|
|
21900
21928
|
"direction": [513],
|
|
21901
21929
|
"contentPosition": [513, "content-position"],
|
|
21902
21930
|
"_rendering": [32]
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,H as e,g as s}from"./p-0c2cc6c4.js";const o=".flex{display:flex!important}.h-auto{height:auto!important}.w-full{width:100%!important}.flex-col{flex-direction:column!important}.flex-wrap{flex-wrap:wrap!important}*{box-sizing:border-box}:host{display:flex}:host([direction=horizontal]){align-items:flex-end;height:auto}:host([direction=vertical]){align-items:flex-start;flex-direction:column;flex-wrap:wrap;min-height:100%;width:100%}:host([direction=vertical][content-position=start]){align-items:flex-end}.static{position:static!important}";const n=class{constructor(i){t(this,i);this._loaded=false;this._delay=t=>new Promise((i=>setTimeout(i,t)));this._onSlotChange=async t=>this._generateSteps();this._generateSteps=async(t=false)=>{if(!t&&(!this._el||this._rendering||!this._loaded)){return}this._rendering=true;let i=this.activeStep-1||0;const e=this._el.querySelectorAll("p-stepper-item");if(!this.activeStep||i<0){for(let t=0;t<(e===null||e===void 0?void 0:e.length);t++){const s=e.item(t);if(s.active){i=t}if(i<0&&s.finished){i=t+1}}}for(let t=0;t<(e===null||e===void 0?void 0:e.length);t++){let s=false;const o=e.item(t);o.active=t===i;o.finished=t<i;if(o.direction!==this.direction){s=true}o.direction=this.direction;o.align=t===0?"start":t===(e===null||e===void 0?void 0:e.length)-1?"end":"center";o.contentPosition=this.contentPosition;if(t<e.length-1){const e=o.nextElementSibling;if(e&&e.tagName.toLowerCase()==="p-stepper-item"){if(s){await this._delay(10)}const n=(o.clientHeight>16?o.clientHeight-16:o.clientHeight)/2;const r=document.createElement("p-stepper-line");r.direction=this.direction;r.active=t<i;if(n>0&&this.direction==="vertical"){r.style.marginTop=`-${n/16}rem`;r.style.marginBottom=`-${n/16}rem`;r.style.minHeight=`calc(1rem + ${n*2/16}rem)`}this._el.insertBefore(r,e);const l=r.previousElementSibling;if(l&&l.tagName.toLowerCase()==="p-stepper-line"){l.remove()}continue}}if(t>0){const t=o.previousElementSibling;if(t.tagName.toLowerCase()==="p-stepper-line"){t.direction=this.direction;t.active=o.active||o.finished}}}const s=this._el.querySelectorAll("p-stepper-line:not(:has(+ p-stepper-item)), p-stepper-line:first-child");for(let t=s.length-1;t>=0;t--){const i=s.item(t);i.remove()}setTimeout((()=>this._rendering=false),100)};this.activeStep=1;this.direction="horizontal";this.contentPosition="end";this._rendering=false}componentDidLoad(){this._loaded=true;this._generateSteps(true)}render(){return i(e,{class:"p-stepper"},i("slot",{onSlotchange:this._onSlotChange}))}_onActiveStepChange(){this._generateSteps()}get _el(){return s(this)}static get watchers(){return{activeStep:["_onActiveStepChange"]}}};n.style=o;export{n as p_stepper};
|
|
2
|
-
//# sourceMappingURL=p-9c1e350b.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["stepperComponentCss","Stepper","this","_loaded","_delay","amount","Promise","resolve","setTimeout","_onSlotChange","async","_e","_generateSteps","firstLoad","_el","_rendering","activeStep","items","querySelectorAll","i","length","item","active","finished","directionChanged","direction","align","contentPosition","nextItem","nextElementSibling","tagName","toLowerCase","heightDiff","clientHeight","stepperLine","document","createElement","style","marginTop","marginBottom","minHeight","insertBefore","previous","previousElementSibling","remove","previousItem","lines","j","line","componentDidLoad","render","h","Host","class","onSlotchange","_onActiveStepChange"],"sources":["src/components/molecules/stepper/stepper.component.scss?tag=p-stepper&encapsulation=shadow","src/components/molecules/stepper/stepper.component.tsx"],"sourcesContent":[":host {\n\t@apply flex;\n}\n\n:host([direction='horizontal']) {\n\t@apply h-auto items-end;\n}\n\n:host([direction='vertical']) {\n\t@apply flex-col flex-wrap items-start;\n\t@apply w-full min-h-full;\n}\n\n:host([direction='vertical'][content-position='start']) {\n\t@apply items-end;\n}\n","import { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\n\n@Component({\n\ttag: 'p-stepper',\n\tstyleUrl: 'stepper.component.scss',\n\tshadow: true,\n})\nexport class Stepper {\n\t/**\n\t * The currently active step\n\t */\n\t@Prop() activeStep: number = 1;\n\n\t/**\n\t * The direction of the stepper\n\t */\n\t@Prop({ reflect: true }) direction: 'horizontal' | 'vertical' = 'horizontal';\n\n\t/**\n\t * The position of the content in case of vertical direction\n\t */\n\t@Prop({ reflect: true }) contentPosition: 'start' | 'end' = 'end';\n\n\t/**\n\t * The host element\n\t */\n\t@Element() private _el: HTMLElement;\n\n\t@State() private _rendering = false;\n\n\tprivate _loaded = false;\n\n\t// private _steps: Array<HTMLPStepperItemElement>;\n\n\tprivate _delay = (amount: number) =>\n\t\tnew Promise(resolve => setTimeout(resolve, amount));\n\n\tprivate _onSlotChange = async (_e: Event) => this._generateSteps();\n\n\tprivate _generateSteps = async (firstLoad = false) => {\n\t\tif (!firstLoad && (!this._el || this._rendering || !this._loaded)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._rendering = true;\n\n\t\tlet activeStep = this.activeStep - 1 || 0;\n\t\tconst items = this._el.querySelectorAll('p-stepper-item');\n\n\t\tif (!this.activeStep || activeStep < 0) {\n\t\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\t\tconst item = items.item(i) as any;\n\n\t\t\t\tif (item.active) {\n\t\t\t\t\tactiveStep = i;\n\t\t\t\t}\n\n\t\t\t\tif (activeStep < 0 && item.finished) {\n\t\t\t\t\tactiveStep = i + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\tlet directionChanged = false;\n\t\t\tconst item = items.item(i) as any;\n\n\t\t\titem.active = i === activeStep;\n\t\t\titem.finished = i < activeStep;\n\n\t\t\tif (item.direction !== this.direction) {\n\t\t\t\tdirectionChanged = true;\n\t\t\t}\n\n\t\t\titem.direction = this.direction;\n\t\t\titem.align =\n\t\t\t\ti === 0 ? 'start' : i === items?.length - 1 ? 'end' : 'center';\n\t\t\titem.contentPosition = this.contentPosition;\n\n\t\t\tif (i < items.length - 1) {\n\t\t\t\tconst nextItem = item.nextElementSibling;\n\n\t\t\t\tif (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-item') {\n\t\t\t\t\t// super hacky, but we want to wait for the css of the `item.direction` change to be applied before querying for the item.clientHeight\n\t\t\t\t\t// otherwise we always get the initial \"16\"\n\t\t\t\t\tif (directionChanged) {\n\t\t\t\t\t\tawait this._delay(10);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst heightDiff =\n\t\t\t\t\t\t(item.clientHeight > 16\n\t\t\t\t\t\t\t? item.clientHeight - 16\n\t\t\t\t\t\t\t: item.clientHeight) / 2;\n\n\t\t\t\t\tconst stepperLine = document.createElement('p-stepper-line');\n\n\t\t\t\t\tstepperLine.direction = this.direction;\n\t\t\t\t\tstepperLine.active = i < activeStep;\n\n\t\t\t\t\tif (heightDiff > 0 && this.direction === 'vertical') {\n\t\t\t\t\t\tstepperLine.style.marginTop = `-${heightDiff / 16}rem`;\n\t\t\t\t\t\tstepperLine.style.marginBottom = `-${heightDiff / 16}rem`;\n\t\t\t\t\t\tstepperLine.style.minHeight = `calc(1rem + ${\n\t\t\t\t\t\t\t(heightDiff * 2) / 16\n\t\t\t\t\t\t}rem)`;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._el.insertBefore(stepperLine, nextItem);\n\n\t\t\t\t\tconst previous = stepperLine.previousElementSibling;\n\t\t\t\t\tif (previous && previous.tagName.toLowerCase() === 'p-stepper-line') {\n\t\t\t\t\t\tprevious.remove();\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (i > 0) {\n\t\t\t\tconst previousItem = item.previousElementSibling;\n\t\t\t\tif (previousItem.tagName.toLowerCase() === 'p-stepper-line') {\n\t\t\t\t\tpreviousItem.direction = this.direction;\n\t\t\t\t\tpreviousItem.active = item.active || item.finished;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst lines = this._el.querySelectorAll(\n\t\t\t'p-stepper-line:not(:has(+ p-stepper-item)), p-stepper-line:first-child'\n\t\t);\n\t\tfor (let j = lines.length - 1; j >= 0; j--) {\n\t\t\tconst line = lines.item(j);\n\t\t\tline.remove();\n\t\t}\n\n\t\tsetTimeout(() => (this._rendering = false), 100);\n\t};\n\n\tcomponentDidLoad() {\n\t\tthis._loaded = true;\n\t\tthis._generateSteps(true);\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class='p-stepper'>\n\t\t\t\t<slot onSlotchange={this._onSlotChange} />\n\t\t\t</Host>\n\t\t);\n\t}\n\n\t@Watch('activeStep')\n\tprotected _onActiveStepChange() {\n\t\tthis._generateSteps();\n\t}\n}\n"],"mappings":"yDAAA,MAAMA,EAAsB,if,MCOfC,EAAO,M,yBAuBXC,KAAAC,QAAU,MAIVD,KAAAE,OAAUC,GACjB,IAAIC,SAAQC,GAAWC,WAAWD,EAASF,KAEpCH,KAAAO,cAAgBC,MAAOC,GAAcT,KAAKU,iBAE1CV,KAAAU,eAAiBF,MAAOG,EAAY,SAC3C,IAAKA,KAAeX,KAAKY,KAAOZ,KAAKa,aAAeb,KAAKC,SAAU,CAClE,M,CAGDD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,EAAYG,MAAME,aAAe,IAAIP,EAAa,QAClDE,EAAYG,MAAMG,UAAY,eAC5BR,EAAa,EAAK,Q,CAIrB9B,KAAKY,IAAI2B,aAAaP,EAAaN,GAEnC,MAAMc,EAAWR,EAAYS,uBAC7B,GAAID,GAAYA,EAASZ,QAAQC,gBAAkB,iBAAkB,CACpEW,EAASE,Q,CAGV,Q,EAIF,GAAIzB,EAAI,EAAG,CACV,MAAM0B,EAAexB,EAAKsB,uBAC1B,GAAIE,EAAaf,QAAQC,gBAAkB,iBAAkB,CAC5Dc,EAAapB,UAAYvB,KAAKuB,UAC9BoB,EAAavB,OAASD,EAAKC,QAAUD,EAAKE,Q,GAK7C,MAAMuB,EAAQ5C,KAAKY,IAAII,iBACtB,0EAED,IAAK,IAAI6B,EAAID,EAAM1B,OAAS,EAAG2B,GAAK,EAAGA,IAAK,CAC3C,MAAMC,EAAOF,EAAMzB,KAAK0B,GACxBC,EAAKJ,Q,CAGNpC,YAAW,IAAON,KAAKa,WAAa,OAAQ,IAAI,E,gBA5HpB,E,eAKmC,a,qBAKJ,M,gBAO9B,K,CA8G9B,gBAAAkC,GACC/C,KAAKC,QAAU,KACfD,KAAKU,eAAe,K,CAGrB,MAAAsC,GACC,OACCC,EAACC,EAAI,CAACC,MAAM,aACXF,EAAA,QAAMG,aAAcpD,KAAKO,gB,CAMlB,mBAAA8C,GACTrD,KAAKU,gB"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i,H as e,g as s}from"./p-0c2cc6c4.js";const o=".flex{display:flex!important}.h-auto{height:auto!important}.w-full{width:100%!important}.flex-col{flex-direction:column!important}.flex-wrap{flex-wrap:wrap!important}*{box-sizing:border-box}:host{display:flex}:host([direction=horizontal]){align-items:flex-end;height:auto}:host([direction=vertical]){align-items:flex-start;flex-direction:column;flex-wrap:wrap;min-height:100%;width:100%}:host([direction=vertical][content-position=start]){align-items:flex-end}.static{position:static!important}";const n=class{constructor(i){t(this,i);this._loaded=false;this._delay=t=>new Promise((i=>setTimeout(i,t)));this._onSlotChange=async t=>this._generateSteps();this._generateSteps=async(t=false)=>{if(!t&&(!this._el||this._rendering||!this._loaded)){return}this._rendering=true;let i=this.activeStep-1||0;const e=this._el.querySelectorAll("p-stepper-item");if(!this.activeStep||i<0){for(let t=0;t<(e===null||e===void 0?void 0:e.length);t++){const s=e.item(t);if(s.active){i=t}if(i<0&&s.finished){i=t+1}}}for(let t=0;t<(e===null||e===void 0?void 0:e.length);t++){let s=false;const o=e.item(t);o.active=t===i;o.finished=t<i;if(o.direction!==this.direction){s=true}o.direction=this.direction;o.align=t===0?"start":t===(e===null||e===void 0?void 0:e.length)-1?"end":"center";o.contentPosition=this.contentPosition;if(t<e.length-1){const e=o.nextElementSibling;if(e&&e.tagName.toLowerCase()==="p-stepper-item"){if(s){await this._delay(10)}const n=(o.clientHeight>16?o.clientHeight-16:o.clientHeight)/2;const r=document.createElement("p-stepper-line");r.direction=this.direction;r.active=t<i;if(n>0&&this.direction==="vertical"){r.style.marginTop=`-${n/16}rem`;r.style.marginBottom=`-${n/16}rem`;r.style.minHeight=`calc(1rem + ${n*2/16}rem)`}this._el.insertBefore(r,e);const l=r.previousElementSibling;if(l&&l.tagName.toLowerCase()==="p-stepper-line"){l.remove()}continue}}if(t>0){const t=o.previousElementSibling;if(t.tagName.toLowerCase()==="p-stepper-line"){t.direction=this.direction;t.active=o.active||o.finished}}}const s=this._el.querySelectorAll("p-stepper-line:not(:has(+ p-stepper-item)), p-stepper-line:first-child");for(let t=s.length-1;t>=0;t--){const i=s.item(t);i.remove()}setTimeout((()=>this._rendering=false),100)};this.activeStep=1;this.direction="horizontal";this.contentPosition="end";this._rendering=false}componentDidLoad(){this._loaded=true;this._generateSteps(true)}render(){return i(e,{class:"p-stepper"},i("slot",{onSlotchange:this._onSlotChange}))}_onActiveStepChange(){this._generateSteps()}get _el(){return s(this)}static get watchers(){return{activeStep:["_onActiveStepChange"]}}};n.style=o;export{n as p_stepper};
|
|
2
|
-
//# sourceMappingURL=p-9c1e350b.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["stepperComponentCss","Stepper","this","_loaded","_delay","amount","Promise","resolve","setTimeout","_onSlotChange","async","_e","_generateSteps","firstLoad","_el","_rendering","activeStep","items","querySelectorAll","i","length","item","active","finished","directionChanged","direction","align","contentPosition","nextItem","nextElementSibling","tagName","toLowerCase","heightDiff","clientHeight","stepperLine","document","createElement","style","marginTop","marginBottom","minHeight","insertBefore","previous","previousElementSibling","remove","previousItem","lines","j","line","componentDidLoad","render","h","Host","class","onSlotchange","_onActiveStepChange"],"sources":["src/components/molecules/stepper/stepper.component.scss?tag=p-stepper&encapsulation=shadow","src/components/molecules/stepper/stepper.component.tsx"],"sourcesContent":[":host {\n\t@apply flex;\n}\n\n:host([direction='horizontal']) {\n\t@apply h-auto items-end;\n}\n\n:host([direction='vertical']) {\n\t@apply flex-col flex-wrap items-start;\n\t@apply w-full min-h-full;\n}\n\n:host([direction='vertical'][content-position='start']) {\n\t@apply items-end;\n}\n","import { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\n\n@Component({\n\ttag: 'p-stepper',\n\tstyleUrl: 'stepper.component.scss',\n\tshadow: true,\n})\nexport class Stepper {\n\t/**\n\t * The currently active step\n\t */\n\t@Prop() activeStep: number = 1;\n\n\t/**\n\t * The direction of the stepper\n\t */\n\t@Prop({ reflect: true }) direction: 'horizontal' | 'vertical' = 'horizontal';\n\n\t/**\n\t * The position of the content in case of vertical direction\n\t */\n\t@Prop({ reflect: true }) contentPosition: 'start' | 'end' = 'end';\n\n\t/**\n\t * The host element\n\t */\n\t@Element() private _el: HTMLElement;\n\n\t@State() private _rendering = false;\n\n\tprivate _loaded = false;\n\n\t// private _steps: Array<HTMLPStepperItemElement>;\n\n\tprivate _delay = (amount: number) =>\n\t\tnew Promise(resolve => setTimeout(resolve, amount));\n\n\tprivate _onSlotChange = async (_e: Event) => this._generateSteps();\n\n\tprivate _generateSteps = async (firstLoad = false) => {\n\t\tif (!firstLoad && (!this._el || this._rendering || !this._loaded)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._rendering = true;\n\n\t\tlet activeStep = this.activeStep - 1 || 0;\n\t\tconst items = this._el.querySelectorAll('p-stepper-item');\n\n\t\tif (!this.activeStep || activeStep < 0) {\n\t\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\t\tconst item = items.item(i) as any;\n\n\t\t\t\tif (item.active) {\n\t\t\t\t\tactiveStep = i;\n\t\t\t\t}\n\n\t\t\t\tif (activeStep < 0 && item.finished) {\n\t\t\t\t\tactiveStep = i + 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < items?.length; i++) {\n\t\t\tlet directionChanged = false;\n\t\t\tconst item = items.item(i) as any;\n\n\t\t\titem.active = i === activeStep;\n\t\t\titem.finished = i < activeStep;\n\n\t\t\tif (item.direction !== this.direction) {\n\t\t\t\tdirectionChanged = true;\n\t\t\t}\n\n\t\t\titem.direction = this.direction;\n\t\t\titem.align =\n\t\t\t\ti === 0 ? 'start' : i === items?.length - 1 ? 'end' : 'center';\n\t\t\titem.contentPosition = this.contentPosition;\n\n\t\t\tif (i < items.length - 1) {\n\t\t\t\tconst nextItem = item.nextElementSibling;\n\n\t\t\t\tif (nextItem && nextItem.tagName.toLowerCase() === 'p-stepper-item') {\n\t\t\t\t\t// super hacky, but we want to wait for the css of the `item.direction` change to be applied before querying for the item.clientHeight\n\t\t\t\t\t// otherwise we always get the initial \"16\"\n\t\t\t\t\tif (directionChanged) {\n\t\t\t\t\t\tawait this._delay(10);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst heightDiff =\n\t\t\t\t\t\t(item.clientHeight > 16\n\t\t\t\t\t\t\t? item.clientHeight - 16\n\t\t\t\t\t\t\t: item.clientHeight) / 2;\n\n\t\t\t\t\tconst stepperLine = document.createElement('p-stepper-line');\n\n\t\t\t\t\tstepperLine.direction = this.direction;\n\t\t\t\t\tstepperLine.active = i < activeStep;\n\n\t\t\t\t\tif (heightDiff > 0 && this.direction === 'vertical') {\n\t\t\t\t\t\tstepperLine.style.marginTop = `-${heightDiff / 16}rem`;\n\t\t\t\t\t\tstepperLine.style.marginBottom = `-${heightDiff / 16}rem`;\n\t\t\t\t\t\tstepperLine.style.minHeight = `calc(1rem + ${\n\t\t\t\t\t\t\t(heightDiff * 2) / 16\n\t\t\t\t\t\t}rem)`;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis._el.insertBefore(stepperLine, nextItem);\n\n\t\t\t\t\tconst previous = stepperLine.previousElementSibling;\n\t\t\t\t\tif (previous && previous.tagName.toLowerCase() === 'p-stepper-line') {\n\t\t\t\t\t\tprevious.remove();\n\t\t\t\t\t}\n\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (i > 0) {\n\t\t\t\tconst previousItem = item.previousElementSibling;\n\t\t\t\tif (previousItem.tagName.toLowerCase() === 'p-stepper-line') {\n\t\t\t\t\tpreviousItem.direction = this.direction;\n\t\t\t\t\tpreviousItem.active = item.active || item.finished;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst lines = this._el.querySelectorAll(\n\t\t\t'p-stepper-line:not(:has(+ p-stepper-item)), p-stepper-line:first-child'\n\t\t);\n\t\tfor (let j = lines.length - 1; j >= 0; j--) {\n\t\t\tconst line = lines.item(j);\n\t\t\tline.remove();\n\t\t}\n\n\t\tsetTimeout(() => (this._rendering = false), 100);\n\t};\n\n\tcomponentDidLoad() {\n\t\tthis._loaded = true;\n\t\tthis._generateSteps(true);\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class='p-stepper'>\n\t\t\t\t<slot onSlotchange={this._onSlotChange} />\n\t\t\t</Host>\n\t\t);\n\t}\n\n\t@Watch('activeStep')\n\tprotected _onActiveStepChange() {\n\t\tthis._generateSteps();\n\t}\n}\n"],"mappings":"yDAAA,MAAMA,EAAsB,if,MCOfC,EAAO,M,yBAuBXC,K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