@aquera/nile-elements 0.1.26 → 0.1.28-beta-1.1
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/README.md +6 -0
- package/demo/index.html +0 -97
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js.map +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.esm.js +1 -1
- package/dist/nile-circular-progressbar/nile-circular-progressbar.cjs.js +1 -1
- package/dist/nile-circular-progressbar/nile-circular-progressbar.cjs.js.map +1 -1
- package/dist/nile-circular-progressbar/nile-circular-progressbar.css.cjs.js +1 -1
- package/dist/nile-circular-progressbar/nile-circular-progressbar.css.cjs.js.map +1 -1
- package/dist/nile-circular-progressbar/nile-circular-progressbar.css.esm.js +23 -5
- package/dist/nile-circular-progressbar/nile-circular-progressbar.esm.js +22 -15
- package/dist/nile-progress-bar/nile-progress-bar.cjs.js +1 -1
- package/dist/nile-progress-bar/nile-progress-bar.cjs.js.map +1 -1
- package/dist/nile-progress-bar/nile-progress-bar.css.cjs.js +1 -1
- package/dist/nile-progress-bar/nile-progress-bar.css.cjs.js.map +1 -1
- package/dist/nile-progress-bar/nile-progress-bar.css.esm.js +15 -3
- package/dist/nile-progress-bar/nile-progress-bar.esm.js +3 -3
- package/dist/nile-stepper/nile-stepper.cjs.js +1 -1
- package/dist/nile-stepper/nile-stepper.cjs.js.map +1 -1
- package/dist/nile-stepper/nile-stepper.css.cjs.js +1 -1
- package/dist/nile-stepper/nile-stepper.css.cjs.js.map +1 -1
- package/dist/nile-stepper/nile-stepper.css.esm.js +8 -2
- package/dist/nile-stepper/nile-stepper.esm.js +3 -3
- package/dist/nile-stepper-item/nile-stepper-item.cjs.js +1 -1
- package/dist/nile-stepper-item/nile-stepper-item.cjs.js.map +1 -1
- package/dist/nile-stepper-item/nile-stepper-item.css.cjs.js +1 -1
- package/dist/nile-stepper-item/nile-stepper-item.css.cjs.js.map +1 -1
- package/dist/nile-stepper-item/nile-stepper-item.css.esm.js +37 -16
- package/dist/nile-stepper-item/nile-stepper-item.esm.js +20 -17
- package/dist/nile-tab-group/nile-tab-group.cjs.js.map +1 -1
- package/dist/nile-tab-group/nile-tab-group.css.cjs.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.css.cjs.js.map +1 -1
- package/dist/nile-tab-group/nile-tab-group.css.esm.js +3 -3
- package/dist/nile-vertical-stepper-item/nile-vertical-stepper-item.cjs.js +1 -1
- package/dist/nile-vertical-stepper-item/nile-vertical-stepper-item.cjs.js.map +1 -1
- package/dist/nile-vertical-stepper-item/nile-vertical-stepper-item.css.cjs.js +1 -1
- package/dist/nile-vertical-stepper-item/nile-vertical-stepper-item.css.cjs.js.map +1 -1
- package/dist/nile-vertical-stepper-item/nile-vertical-stepper-item.css.esm.js +28 -14
- package/dist/nile-vertical-stepper-item/nile-vertical-stepper-item.esm.js +11 -13
- package/dist/src/nile-auto-complete/nile-auto-complete.js +0 -1
- package/dist/src/nile-auto-complete/nile-auto-complete.js.map +1 -1
- package/dist/src/nile-circular-progressbar/nile-circular-progressbar.css.d.ts +5 -5
- package/dist/src/nile-circular-progressbar/nile-circular-progressbar.css.js +28 -10
- package/dist/src/nile-circular-progressbar/nile-circular-progressbar.css.js.map +1 -1
- package/dist/src/nile-circular-progressbar/nile-circular-progressbar.d.ts +3 -0
- package/dist/src/nile-circular-progressbar/nile-circular-progressbar.js +46 -20
- package/dist/src/nile-circular-progressbar/nile-circular-progressbar.js.map +1 -1
- package/dist/src/nile-progress-bar/nile-progress-bar.css.js +13 -1
- package/dist/src/nile-progress-bar/nile-progress-bar.css.js.map +1 -1
- package/dist/src/nile-progress-bar/nile-progress-bar.d.ts +1 -0
- package/dist/src/nile-progress-bar/nile-progress-bar.js +6 -1
- package/dist/src/nile-progress-bar/nile-progress-bar.js.map +1 -1
- package/dist/src/nile-stepper/nile-stepper.css.js +6 -0
- package/dist/src/nile-stepper/nile-stepper.css.js.map +1 -1
- package/dist/src/nile-stepper/nile-stepper.d.ts +2 -2
- package/dist/src/nile-stepper/nile-stepper.js +8 -8
- package/dist/src/nile-stepper/nile-stepper.js.map +1 -1
- package/dist/src/nile-stepper-item/nile-stepper-item.css.js +37 -16
- package/dist/src/nile-stepper-item/nile-stepper-item.css.js.map +1 -1
- package/dist/src/nile-stepper-item/nile-stepper-item.d.ts +5 -1
- package/dist/src/nile-stepper-item/nile-stepper-item.js +33 -14
- package/dist/src/nile-stepper-item/nile-stepper-item.js.map +1 -1
- package/dist/src/nile-tab-group/nile-tab-group.css.js +3 -3
- package/dist/src/nile-tab-group/nile-tab-group.css.js.map +1 -1
- package/dist/src/nile-tab-group/nile-tab-group.js.map +1 -1
- package/dist/src/nile-vertical-stepper-item/nile-vertical-stepper-item.css.js +28 -14
- package/dist/src/nile-vertical-stepper-item/nile-vertical-stepper-item.css.js.map +1 -1
- package/dist/src/nile-vertical-stepper-item/nile-vertical-stepper-item.d.ts +1 -0
- package/dist/src/nile-vertical-stepper-item/nile-vertical-stepper-item.js +10 -8
- package/dist/src/nile-vertical-stepper-item/nile-vertical-stepper-item.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-auto-complete/nile-auto-complete.ts +0 -1
- package/src/nile-circular-progressbar/nile-circular-progressbar.css.ts +24 -6
- package/src/nile-circular-progressbar/nile-circular-progressbar.ts +39 -15
- package/src/nile-progress-bar/nile-progress-bar.css.ts +14 -2
- package/src/nile-progress-bar/nile-progress-bar.ts +4 -1
- package/src/nile-stepper/nile-stepper.css.ts +6 -0
- package/src/nile-stepper/nile-stepper.ts +11 -11
- package/src/nile-stepper-item/nile-stepper-item.css.ts +37 -16
- package/src/nile-stepper-item/nile-stepper-item.ts +34 -17
- package/src/nile-tab-group/nile-tab-group.css.ts +3 -3
- package/src/nile-tab-group/nile-tab-group.ts +1 -1
- package/src/nile-vertical-stepper-item/nile-vertical-stepper-item.css.ts +28 -14
- package/src/nile-vertical-stepper-item/nile-vertical-stepper-item.ts +12 -8
- package/vscode-html-custom-data.json +37 -6
@@ -13,25 +13,28 @@ import{css as e}from"lit";const t=e`
|
|
13
13
|
}
|
14
14
|
|
15
15
|
.stepper__item--sm {
|
16
|
-
--item-spacing: var(--nile-spacing-spacing-
|
16
|
+
--item-spacing: var(--nile-spacing-spacing-md);
|
17
17
|
--stepper-item-title-size:14px;
|
18
|
+
--stepper-item-title-margin-top:15%;
|
18
19
|
--stepper-item-subtitle-size:14px;
|
19
20
|
--stepper-item-text-line-height:20px;
|
20
21
|
--circle-height:16px;
|
21
22
|
}
|
22
23
|
|
23
24
|
.stepper__item--md {
|
24
|
-
--item-spacing: var(--nile-spacing-spacing-
|
25
|
+
--item-spacing: var(--nile-spacing-spacing-md);
|
25
26
|
--stepper-item-title-size:16px;
|
26
|
-
--stepper-item-
|
27
|
-
--stepper-item-
|
27
|
+
--stepper-item-title-margin-top:15%;
|
28
|
+
--stepper-item-subtitle-size:14px;
|
29
|
+
--stepper-item-text-line-height:24px;
|
28
30
|
--circle-height:20px;
|
29
31
|
}
|
30
32
|
|
31
33
|
.stepper__item--lg {
|
32
|
-
--item-spacing: var(--nile-spacing-spacing-
|
34
|
+
--item-spacing: var(--nile-spacing-spacing-lg);
|
33
35
|
--stepper-item-title-size:16px;
|
34
|
-
--stepper-item-
|
36
|
+
--stepper-item-title-margin-top:25%;
|
37
|
+
--stepper-item-subtitle-size:14px;
|
35
38
|
--stepper-item-text-line-height:24px;
|
36
39
|
--circle-height:28px;
|
37
40
|
}
|
@@ -40,22 +43,28 @@ import{css as e}from"lit";const t=e`
|
|
40
43
|
display: flex;
|
41
44
|
flex-direction: column;
|
42
45
|
}
|
46
|
+
|
43
47
|
.stepper__item__bulletin {
|
44
48
|
display:grid;
|
45
49
|
place-content:center;
|
46
50
|
}
|
47
51
|
|
52
|
+
.stepper__item__bulletin {
|
53
|
+
margin-top:3px;
|
54
|
+
margin-bottom:3px;
|
55
|
+
}
|
56
|
+
|
48
57
|
.stepper__bulletin--dot {
|
49
58
|
width: var(--circle-height);
|
50
59
|
aspect-ratio: 1 / 1;
|
51
60
|
border-radius: 50%;
|
52
|
-
background: radial-gradient(var(--nile-colors-
|
53
|
-
border: 2px solid var(--nile-colors-
|
61
|
+
background: radial-gradient(var(--nile-colors-neutral-500) var(--bulletin--dot--seperation), var(--nile-colors-dark-200) var(--bulletin--dot--seperation));
|
62
|
+
border: 2px solid var(--nile-colors-neutral-500);
|
54
63
|
}
|
55
64
|
|
56
65
|
.stepper__bulletin__dot--active{
|
57
66
|
background: radial-gradient(var(--nile-colors-white-base) var(--bulletin--dot--seperation), var(--nile-colors-primary-600) var(--bulletin--dot--seperation));
|
58
|
-
border: 2px solid var(--nile-colors-primary-
|
67
|
+
border: 2px solid var(--nile-colors-primary-500);
|
59
68
|
}
|
60
69
|
|
61
70
|
.stepper__bulletin--icon {
|
@@ -79,7 +88,7 @@ import{css as e}from"lit";const t=e`
|
|
79
88
|
|
80
89
|
.stepper__item__line{
|
81
90
|
height:100%;
|
82
|
-
border-left: 2px solid var(--nile-colors-
|
91
|
+
border-left: 2px solid var(--nile-colors-neutral-500);
|
83
92
|
}
|
84
93
|
.stepper__item__line--active{
|
85
94
|
border-left: 2px solid var(--nile-colors-primary-600);
|
@@ -91,19 +100,24 @@ import{css as e}from"lit";const t=e`
|
|
91
100
|
justify-content:start;
|
92
101
|
}
|
93
102
|
.stepper__content__title {
|
94
|
-
color:var(--nile-colors-
|
103
|
+
color:var(--nile-colors-dark-900);
|
95
104
|
font-size: var(--stepper-item-title-size);
|
96
105
|
line-height: var(--stepper-item-text-line-height);
|
97
106
|
font-family: var(--nile-font-family-medium);
|
98
|
-
font-weight:
|
107
|
+
font-weight: 400;
|
108
|
+
}
|
109
|
+
|
110
|
+
.stepper__content__title--alone{
|
111
|
+
margin-top: var(--stepper-item-title-margin-top);
|
99
112
|
}
|
100
113
|
|
101
114
|
.stepper__content__title--active{
|
102
|
-
color:var(--nile-colors-primary-
|
115
|
+
color:var(--nile-colors-primary-600);
|
116
|
+
font-weight: 600;
|
103
117
|
}
|
104
118
|
|
105
119
|
.stepper__content__subtitle {
|
106
|
-
color:var(--nile-colors-
|
120
|
+
color:var(--nile-colors-dark-500);
|
107
121
|
font-size: var(--stepper-item-subtitle-size);
|
108
122
|
line-height: var(--stepper-item-text-line-height);
|
109
123
|
font-family: var( --nile-font-family-sans-serif);
|
@@ -1,22 +1,20 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{html as e,nothing as i}from"lit";import{property as s,state as l,customElement as p}from"lit/decorators.js";import{s as r}from"./nile-vertical-stepper-item.css.esm.js";import{N as _}from"../internal/nile-element.esm.js";import{classMap as
|
2
|
-
<div class="${
|
1
|
+
import{__decorate as t}from"tslib";import{html as e,nothing as i}from"lit";import{property as s,state as l,customElement as p}from"lit/decorators.js";import{s as r}from"./nile-vertical-stepper-item.css.esm.js";import{N as _}from"../internal/nile-element.esm.js";import{classMap as o}from"lit/directives/class-map.js";let d=class extends _{constructor(){super(...arguments),this.title="",this.subtitle="",this.contentBelow=!1,this.size="md",this.icon="tick",this.isFirst=!1,this.isLast=!1,this.isComplete=!1,this.isCurrent=!1,this.haveFlex=!0}static get styles(){return[r]}render(){this.isLast&&this.style.setProperty("--vertical-stepper-flex-val","0");const t=this.isCurrent,s=this.isComplete;let l=!1;(s&&!t||this.completedStepValue==this.value)&&(l=!0);let p=!1;return s&&(p=!0,this.calculatedCompletedStepValue==this.value&&(p=!1)),"sm"==this.size||this.size,e`
|
2
|
+
<div class="${o({stepper__item:!0,"stepper__item--selected":t,"stepper__item--default":!t,"stepper__item--sm":"sm"==this.size,"stepper__item--md":"md"==this.size,"stepper__item--lg":"lg"==this.size})}">
|
3
3
|
<div class="stepper-item__connector-content">
|
4
4
|
<div class="stepper__item__bulletin">
|
5
|
-
${l?e`<div class="stepper__bulletin--icon"
|
6
|
-
<svg width="${r}" height="${r}" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
7
|
-
<g clip-path="url(#clip0_10902_1507)">
|
8
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.7953 9.85334L13.2487 19.0667L10.7153 16.36C10.2487 15.92 9.51534 15.8933 8.982 16.2667C8.462 16.6533 8.31534 17.3333 8.63534 17.88L11.6353 22.76C11.9287 23.2133 12.4353 23.4933 13.0087 23.4933C13.5553 23.4933 14.0753 23.2133 14.3687 22.76C14.8487 22.1333 24.0087 11.2133 24.0087 11.2133C25.2087 9.98668 23.7553 8.90668 22.7953 9.84001V9.85334Z" fill="white"/>
|
9
|
-
</g>
|
10
|
-
</svg>
|
11
|
-
</div>`:e`<div class="${d({"stepper__bulletin--dot":!0,"stepper__bulletin__dot--active":t})}"></div>`}
|
5
|
+
${l?e`<div class="stepper__bulletin--icon">${this.getSvg()}</div>`:e`<div class="${o({"stepper__bulletin--dot":!0,"stepper__bulletin__dot--active":t})}"></div>`}
|
12
6
|
</div>
|
13
7
|
<div class="stepper__item__line__container">
|
14
|
-
${this.isLast?i:e`<div class="${
|
8
|
+
${this.isLast?i:e`<div class="${o({stepper__item__line:!0,"stepper__item__line--active":p})}"></div>`}
|
15
9
|
</div>
|
16
10
|
</div>
|
17
11
|
<div class="stepper__item__content">
|
18
|
-
<div class="${
|
19
|
-
<div class="${
|
12
|
+
<div class="${o({stepper__content__title:!0,"stepper__content__title--alone":!this.subtitle,"stepper__content__title--active":t})}">${this.title}</div>
|
13
|
+
<div class="${o({stepper__content__subtitle:!0,"stepper__content__subtitle--active":t})}">${this.subtitle}</div>
|
20
14
|
</div>
|
21
15
|
</div>
|
22
|
-
`}
|
16
|
+
`}getSvg(){let t="sm"==this.size?20:"md"==this.size?24:28;return e`
|
17
|
+
<svg width="${t}" height="${t}" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
18
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.7953 9.85334L13.2487 19.0667L10.7153 16.36C10.2487 15.92 9.51534 15.8933 8.982 16.2667C8.462 16.6533 8.31534 17.3333 8.63534 17.88L11.6353 22.76C11.9287 23.2133 12.4353 23.4933 13.0087 23.4933C13.5553 23.4933 14.0753 23.2133 14.3687 22.76C14.8487 22.1333 24.0087 11.2133 24.0087 11.2133C25.2087 9.98668 23.7553 8.90668 22.7953 9.84001V9.85334Z" fill="white"/>
|
19
|
+
</svg>
|
20
|
+
`}};t([s()],d.prototype,"title",void 0),t([s()],d.prototype,"subtitle",void 0),t([l()],d.prototype,"contentBelow",void 0),t([l()],d.prototype,"size",void 0),t([l()],d.prototype,"icon",void 0),t([l()],d.prototype,"isFirst",void 0),t([l()],d.prototype,"isLast",void 0),t([l()],d.prototype,"isComplete",void 0),t([l()],d.prototype,"isCurrent",void 0),t([l()],d.prototype,"currentStepValue",void 0),t([l()],d.prototype,"completedStepValue",void 0),t([l()],d.prototype,"calculatedCompletedStepValue",void 0),t([l()],d.prototype,"value",void 0),t([l()],d.prototype,"haveFlex",void 0),d=t([p("nile-vertical-stepper-item")],d);export{d as N};
|
@@ -88,7 +88,6 @@ let NileAutoComplete = class NileAutoComplete extends NileElement {
|
|
88
88
|
handleSelect(event) {
|
89
89
|
this.value = event.detail.value;
|
90
90
|
this.emit('nile-complete', { value: event.detail.value });
|
91
|
-
this.emit('nile-input', { value: event.detail.value });
|
92
91
|
this.isDropdownOpen = false;
|
93
92
|
this.dropdownElement?.hide();
|
94
93
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-auto-complete.js","sourceRoot":"","sources":["../../../src/nile-auto-complete/nile-auto-complete.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,IAAI,EAGJ,OAAO,GACR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,WAAW,MAAM,0BAA0B,CAAC;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zB,CAA0B;AAEf;IAAvB,KAAK,CAAC,eAAe,CAAC;yDAA+B;AAIzB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAA2B;AAE1B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDAAiC;AAEhC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6DAAsC;AAErC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qDAA8B;AAE9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAoB;AAEnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAsC;AAEpC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAA2B;AAE1B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAA0B;AAExB;IAA7B,QAAQ,CAAC,EAAE,SAAS,EAAC,KAAK,EAAC,CAAC;wDAA0J;AAEzJ;IAA7B,QAAQ,CAAC,EAAE,SAAS,EAAC,KAAK,EAAC,CAAC;4DAA2D;AAE7D;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;sDAAwB;AAEzC;IAAR,KAAK,EAAE;mDAAqB;AA9BlB,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CA0J5B;;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n nothing,\n} from 'lit';\nimport { customElement, query, state, property } from 'lit/decorators.js';\nimport { styles } from './nile-auto-complete.css';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup, PropertyValues } from 'lit';\nimport { NileDropdown } from '../nile-dropdown';\n\nimport { virtualize } from '@lit-labs/virtualizer/virtualize.js';\n\n// Define the custom element 'nile-auto-complete'\n@customElement('nile-auto-complete')\nexport class NileAutoComplete extends NileElement {\n\n static styles: CSSResultGroup = styles;\n\n @query('nile-dropdown') dropdownElement: NileDropdown;\n\n // Define component properties\n\n @property({ type: Boolean }) disabled: boolean = false;\n\n @property({ type: Boolean }) isDropdownOpen: boolean = false;\n\n @property({ type: Boolean }) enableVirtualScroll: boolean = false;\n\n @property({ type: Boolean }) openOnFocus: boolean = false;\n\n @property({ type: String }) value: string = '';\n\n @property({ type: String }) placeholder: string = 'Type here ..';\n\n @property({ type: Boolean }) noBorder: boolean = false;\n\n @property({ type: Boolean }) loading: boolean = false;\n\n @property({ attribute:false}) filterFunction: (item:string,searchedValue:string)=>boolean=(item:string,searchedValue:string)=>item.toLowerCase().includes(searchedValue.toLowerCase());\n\n @property({ attribute:false}) renderItemFunction: (item:any)=>string = (item:any)=>item;\n\n @property({ type: Array }) allMenuItems: any = [];\n\n @state() menuItems: any = [];\n\n connectedCallback() {\n super.connectedCallback();\n this.renderItemFunction=(item:any)=>item;\n }\n\n protected updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has('allMenuItems')){\n this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n this.setVirtualMenuWidth();\n }\n if (changedProperties.has('isDropdownOpen')) this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n if (changedProperties.has('value')){\n this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n }\n }\n\n public render(): TemplateResult {\n const content=this.enableVirtualScroll?this.getVirtualizedContent():this.getContent();\n return html`\n <nile-dropdown class=\"nile-dropdown--input\" ?open=${this.isDropdownOpen} noOpenOnCLick>\n <nile-input class=\"nile-auto-complete--input\"\n ?no-border=${this.noBorder}\n .disabled=${this.disabled}\n .value=${this.value}\n @nile-input=${this.handleSearch}\n @focus=${this.handleFocus}\n @click=${this.handleClick}\n slot=\"trigger\"\n placeholder=${this.placeholder}\n >\n ${this.loading?html`<nile-icon slot=\"suffix\" color=\"var(--nile-colors-primary-600)\" name=\"button-loading-blue-animated\"></nile-icon>`:nothing}\n </nile-input>\n ${this.menuItems.length > 0 && !this.loading\n ? content\n : nothing}\n </nile-dropdown>\n `;\n } \n \n getVirtualizedContent():TemplateResult{\n return html`\n <nile-menu class=\"virtualized__menu\" @nile-select=${this.handleSelect} id=\"content-menu\" exportparts=\"menu__items-wrapper:options__wrapper\">\n ${virtualize({\n items: this.menuItems,\n renderItem: (item:any):TemplateResult=>this.getItemRenderFunction(item),\n\t\t\t\t\tscroller:true\n })}\n </nile-menu>\n `\n }\n\n getContent():TemplateResult{\n return html`\n <nile-menu id=\"content-menu\" @nile-select=${this.handleSelect} exportparts=\"menu__items-wrapper:options__wrapper\">\n ${this.menuItems.map((item: any) => this.getItemRenderFunction(item))}\n </nile-menu>`\n }\n\n getItemRenderFunction(item:any):TemplateResult{\n const value=this.renderItemFunction(item)\n return html`\n <nile-menu-item value=${value}>\n ${value}\n </nile-menu-item>\n `;\n }\n\n private handleSelect(event: CustomEvent) {\n this.value = event.detail.value;\n this.emit('nile-complete', { value: event.detail.value });\n this.emit('nile-input', { value: event.detail.value });\n this.isDropdownOpen = false;\n this.dropdownElement?.hide();\n }\n\n private setVirtualMenuWidth() {\n const maxLengthOption = this.menuItems\n .reduce((acc: number, curr: any) => {\n const currLength = this.renderItemFunction(curr).length\n return acc > currLength ? acc : currLength\n }, 0)\n const defaultWith = 110;\n const pixelMultiplier = 9.5;\n const menuWidth = maxLengthOption * pixelMultiplier < defaultWith ? defaultWith : maxLengthOption * pixelMultiplier;\n this.style.setProperty(\"--virtual-scroll-container-width\", menuWidth + \"px\");\n }\n\n private handleSearch(event: CustomEvent) {\n this.value = event.detail.value.toLowerCase();\n\n // Filter menu items based on the search value\n this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n\n this.isDropdownOpen = this.menuItems.length > 0;\n if (this.isDropdownOpen) this.dropdownElement?.show();\n }\n\n public handleFocus() {\n if (!this.openOnFocus) {\n return;\n }\n\n // Delay opening the dropdown to allow focus to take effect\n setTimeout(() => {\n this.isDropdownOpen = true;\n this.dropdownElement?.show();\n }, 300);\n }\n\n private handleClick() {\n this.isDropdownOpen = true;\n this.dropdownElement?.show();\n }\n\n applyFilter<T>(list: T[], filterFn: (item: T,searchValue?:string) => boolean): T[] {\n if(typeof(list)!=='object') return []\n const res:T[]=[]\n list.forEach( el=> filterFn(el,this.value) && res.push(el) )\n return res\n }\n\n}\n\nexport default NileAutoComplete;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-auto-complete': NileAutoComplete;\n }\n}"]}
|
1
|
+
{"version":3,"file":"nile-auto-complete.js","sourceRoot":"","sources":["../../../src/nile-auto-complete/nile-auto-complete.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,IAAI,EAGJ,OAAO,GACR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAInD,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEjE,iDAAiD;AAE1C,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,WAAW;IAA1C;;QAML,8BAA8B;QAED,aAAQ,GAAY,KAAK,CAAC;QAE1B,mBAAc,GAAY,KAAK,CAAC;QAEhC,wBAAmB,GAAY,KAAK,CAAC;QAErC,gBAAW,GAAY,KAAK,CAAC;QAE9B,UAAK,GAAW,EAAE,CAAC;QAEnB,gBAAW,GAAW,cAAc,CAAC;QAEpC,aAAQ,GAAY,KAAK,CAAC;QAE1B,YAAO,GAAY,KAAK,CAAC;QAExB,mBAAc,GAA8C,CAAC,IAAW,EAAC,aAAoB,EAAC,EAAE,CAAA,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,aAAa,CAA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DAA0B;AAExB;IAA7B,QAAQ,CAAC,EAAE,SAAS,EAAC,KAAK,EAAC,CAAC;wDAA0J;AAEzJ;IAA7B,QAAQ,CAAC,EAAE,SAAS,EAAC,KAAK,EAAC,CAAC;4DAA2D;AAE7D;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;sDAAwB;AAEzC;IAAR,KAAK,EAAE;mDAAqB;AA9BlB,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CAyJ5B;;AAED,eAAe,gBAAgB,CAAC","sourcesContent":["import {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n nothing,\n} from 'lit';\nimport { customElement, query, state, property } from 'lit/decorators.js';\nimport { styles } from './nile-auto-complete.css';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup, PropertyValues } from 'lit';\nimport { NileDropdown } from '../nile-dropdown';\n\nimport { virtualize } from '@lit-labs/virtualizer/virtualize.js';\n\n// Define the custom element 'nile-auto-complete'\n@customElement('nile-auto-complete')\nexport class NileAutoComplete extends NileElement {\n\n static styles: CSSResultGroup = styles;\n\n @query('nile-dropdown') dropdownElement: NileDropdown;\n\n // Define component properties\n\n @property({ type: Boolean }) disabled: boolean = false;\n\n @property({ type: Boolean }) isDropdownOpen: boolean = false;\n\n @property({ type: Boolean }) enableVirtualScroll: boolean = false;\n\n @property({ type: Boolean }) openOnFocus: boolean = false;\n\n @property({ type: String }) value: string = '';\n\n @property({ type: String }) placeholder: string = 'Type here ..';\n\n @property({ type: Boolean }) noBorder: boolean = false;\n\n @property({ type: Boolean }) loading: boolean = false;\n\n @property({ attribute:false}) filterFunction: (item:string,searchedValue:string)=>boolean=(item:string,searchedValue:string)=>item.toLowerCase().includes(searchedValue.toLowerCase());\n\n @property({ attribute:false}) renderItemFunction: (item:any)=>string = (item:any)=>item;\n\n @property({ type: Array }) allMenuItems: any = [];\n\n @state() menuItems: any = [];\n\n connectedCallback() {\n super.connectedCallback();\n this.renderItemFunction=(item:any)=>item;\n }\n\n protected updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n if (changedProperties.has('allMenuItems')){\n this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n this.setVirtualMenuWidth();\n }\n if (changedProperties.has('isDropdownOpen')) this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n if (changedProperties.has('value')){\n this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n }\n }\n\n public render(): TemplateResult {\n const content=this.enableVirtualScroll?this.getVirtualizedContent():this.getContent();\n return html`\n <nile-dropdown class=\"nile-dropdown--input\" ?open=${this.isDropdownOpen} noOpenOnCLick>\n <nile-input class=\"nile-auto-complete--input\"\n ?no-border=${this.noBorder}\n .disabled=${this.disabled}\n .value=${this.value}\n @nile-input=${this.handleSearch}\n @focus=${this.handleFocus}\n @click=${this.handleClick}\n slot=\"trigger\"\n placeholder=${this.placeholder}\n >\n ${this.loading?html`<nile-icon slot=\"suffix\" color=\"var(--nile-colors-primary-600)\" name=\"button-loading-blue-animated\"></nile-icon>`:nothing}\n </nile-input>\n ${this.menuItems.length > 0 && !this.loading\n ? content\n : nothing}\n </nile-dropdown>\n `;\n } \n \n getVirtualizedContent():TemplateResult{\n return html`\n <nile-menu class=\"virtualized__menu\" @nile-select=${this.handleSelect} id=\"content-menu\" exportparts=\"menu__items-wrapper:options__wrapper\">\n ${virtualize({\n items: this.menuItems,\n renderItem: (item:any):TemplateResult=>this.getItemRenderFunction(item),\n\t\t\t\t\tscroller:true\n })}\n </nile-menu>\n `\n }\n\n getContent():TemplateResult{\n return html`\n <nile-menu id=\"content-menu\" @nile-select=${this.handleSelect} exportparts=\"menu__items-wrapper:options__wrapper\">\n ${this.menuItems.map((item: any) => this.getItemRenderFunction(item))}\n </nile-menu>`\n }\n\n getItemRenderFunction(item:any):TemplateResult{\n const value=this.renderItemFunction(item)\n return html`\n <nile-menu-item value=${value}>\n ${value}\n </nile-menu-item>\n `;\n }\n\n private handleSelect(event: CustomEvent) {\n this.value = event.detail.value;\n this.emit('nile-complete', { value: event.detail.value });\n this.isDropdownOpen = false;\n this.dropdownElement?.hide();\n }\n\n private setVirtualMenuWidth() {\n const maxLengthOption = this.menuItems\n .reduce((acc: number, curr: any) => {\n const currLength = this.renderItemFunction(curr).length\n return acc > currLength ? acc : currLength\n }, 0)\n const defaultWith = 110;\n const pixelMultiplier = 9.5;\n const menuWidth = maxLengthOption * pixelMultiplier < defaultWith ? defaultWith : maxLengthOption * pixelMultiplier;\n this.style.setProperty(\"--virtual-scroll-container-width\", menuWidth + \"px\");\n }\n\n private handleSearch(event: CustomEvent) {\n this.value = event.detail.value.toLowerCase();\n\n // Filter menu items based on the search value\n this.menuItems = this.applyFilter(this.allMenuItems,this.filterFunction);\n\n this.isDropdownOpen = this.menuItems.length > 0;\n if (this.isDropdownOpen) this.dropdownElement?.show();\n }\n\n public handleFocus() {\n if (!this.openOnFocus) {\n return;\n }\n\n // Delay opening the dropdown to allow focus to take effect\n setTimeout(() => {\n this.isDropdownOpen = true;\n this.dropdownElement?.show();\n }, 300);\n }\n\n private handleClick() {\n this.isDropdownOpen = true;\n this.dropdownElement?.show();\n }\n\n applyFilter<T>(list: T[], filterFn: (item: T,searchValue?:string) => boolean): T[] {\n if(typeof(list)!=='object') return []\n const res:T[]=[]\n list.forEach( el=> filterFn(el,this.value) && res.push(el) )\n return res\n }\n\n}\n\nexport default NileAutoComplete;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-auto-complete': NileAutoComplete;\n }\n}"]}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/**
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
7
|
/**
|
8
8
|
* Progressbar CSS
|
9
9
|
*/
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/**
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
* Copyright Aquera Inc 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
7
|
import { css } from 'lit';
|
8
8
|
/**
|
9
9
|
* Progressbar CSS
|
@@ -12,16 +12,18 @@ export const styles = css `
|
|
12
12
|
:host{
|
13
13
|
|
14
14
|
}
|
15
|
+
|
15
16
|
.track {
|
16
|
-
stroke-width:
|
17
|
-
stroke: var(--nile-colors-
|
17
|
+
stroke-width: 4px;
|
18
|
+
stroke: var(--nile-colors-neutral-400);
|
18
19
|
opacity: 0.5;
|
19
20
|
fill: none;
|
21
|
+
height: 2px;
|
20
22
|
}
|
21
23
|
|
22
24
|
.progress {
|
23
|
-
stroke-width:
|
24
|
-
stroke: var(--nile-colors-
|
25
|
+
stroke-width: 4px;
|
26
|
+
stroke: var(--nile-colors-primary-600);
|
25
27
|
stroke-linecap: round;
|
26
28
|
fill: none;
|
27
29
|
transform: rotate(270deg);
|
@@ -36,7 +38,23 @@ export const styles = css `
|
|
36
38
|
font-weight: var(--nile-font-weight-regular);
|
37
39
|
line-height: var(--nile-type-scale-1);
|
38
40
|
letter-spacing: 0.2px;
|
39
|
-
|
41
|
+
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
.nile-progress-bar__status {
|
46
|
+
display: flex;
|
47
|
+
justify-content: space-between;
|
48
|
+
align-items: center;
|
49
|
+
margin-bottom: 4px;
|
50
|
+
}
|
51
|
+
|
52
|
+
.nile-progress-bar__message {
|
53
|
+
flex-grow: 1;
|
54
|
+
}
|
55
|
+
|
56
|
+
.nile-progress-bar__percentage {
|
57
|
+
white-space: nowrap;
|
40
58
|
}
|
41
59
|
`;
|
42
60
|
export default [styles];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-circular-progressbar.css.js","sourceRoot":"","sources":["../../../src/nile-circular-progressbar/nile-circular-progressbar.css.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"nile-circular-progressbar.css.js","sourceRoot":"","sources":["../../../src/nile-circular-progressbar/nile-circular-progressbar.css.ts"],"names":[],"mappings":"AAAC;;;;;EAKE;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":[" /**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * Progressbar CSS\n */\nexport const styles = css`\n :host{\n \n }\n\n .track {\n stroke-width: 4px;\n stroke: var(--nile-colors-neutral-400);\n opacity: 0.5;\n fill: none;\n height: 2px;\n }\n\n .progress {\n stroke-width: 4px;\n stroke: var(--nile-colors-primary-600);\n stroke-linecap: round;\n fill: none;\n transform: rotate(270deg);\n transform-origin: center;\n }\n\n .circle__text {\n color: var(--nile-colors-dark-900);\n text-align: center;\n font-size: var(--nile-type-scale-1);\n font-style: normal;\n font-weight: var(--nile-font-weight-regular);\n line-height: var(--nile-type-scale-1);\n letter-spacing: 0.2px;\n \n }\n\n \n .nile-progress-bar__status {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 4px; \n }\n\n .nile-progress-bar__message {\n flex-grow: 1;\n }\n\n .nile-progress-bar__percentage {\n white-space: nowrap;\n }\n`;\n\nexport default [styles];\n"]}
|
@@ -20,10 +20,13 @@ export declare class NileCircularProgressbar extends NileElement {
|
|
20
20
|
static get styles(): CSSResultArray;
|
21
21
|
progressCircle: any;
|
22
22
|
progress: number;
|
23
|
+
content: String;
|
23
24
|
/**
|
24
25
|
* Render method
|
25
26
|
* @slot This is a slot test
|
26
27
|
*/
|
28
|
+
size: 'sm' | 'md' | 'lg';
|
29
|
+
private get circleSize();
|
27
30
|
connectedCallback(): void;
|
28
31
|
private setProgress;
|
29
32
|
render(): TemplateResult;
|
@@ -20,6 +20,14 @@ let NileCircularProgressbar = class NileCircularProgressbar extends NileElement
|
|
20
20
|
super(...arguments);
|
21
21
|
this.progress = 50;
|
22
22
|
/* #endregion */
|
23
|
+
/* #region Methods */
|
24
|
+
/**
|
25
|
+
* Render method
|
26
|
+
* @slot This is a slot test
|
27
|
+
*/
|
28
|
+
// make reactive to pass through
|
29
|
+
this.size = 'md';
|
30
|
+
/* #endregion */
|
23
31
|
}
|
24
32
|
/**
|
25
33
|
* The styles for Progressbar
|
@@ -28,13 +36,16 @@ let NileCircularProgressbar = class NileCircularProgressbar extends NileElement
|
|
28
36
|
static get styles() {
|
29
37
|
return [styles];
|
30
38
|
}
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
39
|
+
get circleSize() {
|
40
|
+
switch (this.size) {
|
41
|
+
case 'sm':
|
42
|
+
return { radius: 9, viewBox: 24, fontSize: '5px' };
|
43
|
+
case 'lg':
|
44
|
+
return { radius: 28, viewBox: 64, fontSize: '10px' };
|
45
|
+
default:
|
46
|
+
return { radius: 18, viewBox: 40, fontSize: '10px' };
|
47
|
+
}
|
48
|
+
}
|
38
49
|
connectedCallback() {
|
39
50
|
super.connectedCallback();
|
40
51
|
this.updateComplete.then(() => {
|
@@ -55,20 +66,29 @@ let NileCircularProgressbar = class NileCircularProgressbar extends NileElement
|
|
55
66
|
circumference - (percent / 100) * circumference;
|
56
67
|
}
|
57
68
|
render() {
|
69
|
+
const { radius, viewBox, fontSize } = this.circleSize;
|
70
|
+
const innerText = this.content === undefined ? `${Math.round(this.progress)}%` : this.content;
|
58
71
|
return html `
|
59
|
-
<svg width="
|
60
|
-
<circle r="
|
61
|
-
<circle r="
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
+
<svg width="${viewBox}" height="${viewBox}" viewBox="0 0 ${viewBox} ${viewBox}">
|
73
|
+
<circle r="${radius}" cx="${viewBox / 2}" cy="${viewBox / 2}" class="track"></circle>
|
74
|
+
<circle r="${radius}" cx="${viewBox / 2}" cy="${viewBox / 2}" class="progress"></circle>
|
75
|
+
|
76
|
+
|
77
|
+
<text
|
78
|
+
x="50%"
|
79
|
+
y="53%"
|
80
|
+
text-anchor="middle"
|
81
|
+
alignment-baseline="middle"
|
82
|
+
class="circle__text"
|
83
|
+
style="font-size: ${fontSize};"
|
84
|
+
>
|
85
|
+
${innerText}
|
86
|
+
</text>
|
87
|
+
|
88
|
+
</svg>
|
89
|
+
|
90
|
+
|
91
|
+
|
72
92
|
`;
|
73
93
|
}
|
74
94
|
};
|
@@ -78,6 +98,12 @@ __decorate([
|
|
78
98
|
__decorate([
|
79
99
|
property({ type: Number, reflect: true })
|
80
100
|
], NileCircularProgressbar.prototype, "progress", void 0);
|
101
|
+
__decorate([
|
102
|
+
property({ reflect: true })
|
103
|
+
], NileCircularProgressbar.prototype, "content", void 0);
|
104
|
+
__decorate([
|
105
|
+
property({ type: String, reflect: true })
|
106
|
+
], NileCircularProgressbar.prototype, "size", void 0);
|
81
107
|
NileCircularProgressbar = __decorate([
|
82
108
|
customElement('nile-circular-progressbar')
|
83
109
|
], NileCircularProgressbar);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-circular-progressbar.js","sourceRoot":"","sources":["../../../src/nile-circular-progressbar/nile-circular-progressbar.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,GAGL,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAGnD;;;;;GAKG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,WAAW;IAAjD;;
|
1
|
+
{"version":3,"file":"nile-circular-progressbar.js","sourceRoot":"","sources":["../../../src/nile-circular-progressbar/nile-circular-progressbar.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,GAGL,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAGnD;;;;;GAKG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,WAAW;IAAjD;;QAUsC,aAAQ,GAAG,EAAE,CAAC;QAExD,gBAAgB;QAEjB,qBAAqB;QAErB;;;WAGG;QACH,gCAAgC;QACW,SAAI,GAAuB,IAAI,CAAC;QA8D3E,gBAAgB;IAClB,CAAC;IAnFC;;;OAGG;IACI,MAAM,KAAK,MAAM;QACtB,OAAO,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IAgBD,IAAY,UAAU;QACpB,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YAClB,KAAK,IAAI;gBACP,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;YACrD,KAAK,IAAI;gBACP,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;YACvD;gBACE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;QACzD,CAAC;IACH,CAAC;IAED,iBAAiB;QACf,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SAAS,OAAO,GAAG,CAAC;;;;;;;;;gCASnC,QAAQ;;cAE1B,SAAS;;;;;;;KAOlB,CAAC;IACJ,CAAC;CAGF,CAAA;AA3EqB;IAAnB,KAAK,CAAC,WAAW,CAAC;+DAAqB;AACG;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yDAAe;AAC5B;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;wDAAiB;AAUF;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qDAAiC;AArBhE,uBAAuB;IADnC,aAAa,CAAC,2BAA2B,CAAC;GAC9B,uBAAuB,CAoFnC;;AAED,eAAe,uBAAuB,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n CSSResultArray,\n TemplateResult,\n} from 'lit';\nimport { customElement, query, property } from 'lit/decorators.js';\nimport { styles } from './nile-circular-progressbar.css';\nimport NileElement from '../internal/nile-element';\nimport logInfo from '../nile-icon/icons/svg/log-info';\n\n/**\n * Nile icon component.\n *\n * @tag nile-progressbar\n *\n */\n@customElement('nile-circular-progressbar')\nexport class NileCircularProgressbar extends NileElement {\n /**\n * The styles for Progressbar\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @query('.progress') progressCircle: any;\n @property({ type: Number, reflect: true }) progress = 50;\n @property({ reflect: true }) content: String;\n /* #endregion */\n\n /* #region Methods */\n\n /**\n * Render method\n * @slot This is a slot test\n */\n // make reactive to pass through\n @property({ type: String, reflect: true }) size: 'sm' | 'md' | 'lg' = 'md';\n\n private get circleSize() {\n switch (this.size) {\n case 'sm':\n return { radius: 9, viewBox: 24, fontSize: '5px' };\n case 'lg':\n return { radius: 28, viewBox: 64, fontSize: '10px' };\n default:\n return { radius: 18, viewBox: 40, fontSize: '10px' };\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.updateComplete.then(() => {\n if (this.progress < 0) {\n this.progress = 0;\n }\n if (this.progress > 100) {\n this.progress = 100;\n }\n this.setProgress(this.progress);\n });\n }\n private setProgress(percent: number) {\n const circleRadius = this.progressCircle.r.baseVal.value;\n let circumference = circleRadius * 2 * Math.PI;\n this.progressCircle.style.strokeDasharray = circumference;\n this.progressCircle.style.strokeDashoffset =\n circumference - (percent / 100) * circumference;\n }\n\n public render(): TemplateResult {\n const { radius, viewBox, fontSize } = this.circleSize;\n const innerText = this.content === undefined ? `${Math.round(this.progress)}%` : this.content;\n\n\n return html`\n <svg width=\"${viewBox}\" height=\"${viewBox}\" viewBox=\"0 0 ${viewBox} ${viewBox}\">\n <circle r=\"${radius}\" cx=\"${viewBox / 2}\" cy=\"${viewBox / 2}\" class=\"track\"></circle>\n <circle r=\"${radius}\" cx=\"${viewBox / 2}\" cy=\"${viewBox / 2}\" class=\"progress\"></circle>\n \n \n <text\n x=\"50%\"\n y=\"53%\"\n text-anchor=\"middle\"\n alignment-baseline=\"middle\"\n class=\"circle__text\"\n style=\"font-size: ${fontSize};\"\n >\n ${innerText}\n </text>\n \n </svg>\n\n\n \n `;\n }\n\n /* #endregion */\n}\n\nexport default NileCircularProgressbar;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-circular-progressbar': NileCircularProgressbar;\n }\n}\n"]}
|
@@ -23,6 +23,13 @@ export default css `
|
|
23
23
|
background-color: var(--nile-colors-neutral-400);
|
24
24
|
}
|
25
25
|
|
26
|
+
|
27
|
+
.nile-progress-bar__progress-bar.rounded li {
|
28
|
+
height: 4px;
|
29
|
+
border-radius: 4px;
|
30
|
+
overflow: hidden;
|
31
|
+
}
|
32
|
+
|
26
33
|
.nile-progress-bar__progress-bar li.changeColor::after {
|
27
34
|
background-color: var(--nile-colors-primary-600);
|
28
35
|
}
|
@@ -32,10 +39,15 @@ export default css `
|
|
32
39
|
top: 0;
|
33
40
|
left: 0;
|
34
41
|
background-color: var(--nile-colors-primary-600);
|
35
|
-
height:
|
42
|
+
height: 100%;
|
36
43
|
transition: all 1s linear;
|
37
44
|
}
|
38
45
|
|
46
|
+
|
47
|
+
.nile-progress-bar__progress-bar.rounded li span {
|
48
|
+
border-radius: 4px;
|
49
|
+
}
|
50
|
+
|
39
51
|
.nile-progress-bar__reset {
|
40
52
|
background-color: var(--nile-colors-neutral-400);
|
41
53
|
position: absolute;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-progress-bar.css.js","sourceRoot":"","sources":["../../../src/nile-progress-bar/nile-progress-bar.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,eAAe,GAAG,CAAA
|
1
|
+
{"version":3,"file":"nile-progress-bar.css.js","sourceRoot":"","sources":["../../../src/nile-progress-bar/nile-progress-bar.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,eAAe,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDjB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport default css`\n .nile-progress-bar__container {\n width: 100%;\n margin: 0 auto;\n }\n\n .nile-progress-bar__progress-bar {\n width: 100%;\n counter-reset: step;\n padding: 0;\n margin: 0 auto;\n list-style: none;\n display: flex;\n height: 2px;\n justify-content: space-between;\n }\n\n .nile-progress-bar__progress-bar li {\n position: relative;\n width: 100%;\n height: 2px;\n background-color: var(--nile-colors-neutral-400);\n }\n\n \n .nile-progress-bar__progress-bar.rounded li {\n height: 4px; \n border-radius: 4px;\n overflow: hidden; \n }\n\n .nile-progress-bar__progress-bar li.changeColor::after {\n background-color: var(--nile-colors-primary-600);\n }\n\n .nile-progress-bar__progress-bar li span {\n position: absolute;\n top: 0;\n left: 0;\n background-color: var(--nile-colors-primary-600);\n height: 100%; \n transition: all 1s linear;\n }\n\n \n .nile-progress-bar__progress-bar.rounded li span {\n border-radius: 4px;\n }\n\n .nile-progress-bar__reset {\n background-color: var(--nile-colors-neutral-400);\n position: absolute;\n z-index: 1;\n }\n`;"]}
|
@@ -6,11 +6,13 @@ let NileProgressBar = class NileProgressBar extends LitElement {
|
|
6
6
|
constructor() {
|
7
7
|
super(...arguments);
|
8
8
|
this.value = 0;
|
9
|
+
this.variant = 'normal';
|
9
10
|
}
|
10
11
|
render() {
|
12
|
+
const variantClass = this.variant === 'rounded' ? 'rounded' : '';
|
11
13
|
return html `
|
12
14
|
<div class="nile-progress-bar__container">
|
13
|
-
<ul class="nile-progress-bar__progress-bar">
|
15
|
+
<ul class="nile-progress-bar__progress-bar ${variantClass}">
|
14
16
|
<li><span style="width: ${this.value}%"></span></li>
|
15
17
|
</ul>
|
16
18
|
</div>
|
@@ -21,6 +23,9 @@ NileProgressBar.styles = styles;
|
|
21
23
|
__decorate([
|
22
24
|
property({ type: Number })
|
23
25
|
], NileProgressBar.prototype, "value", void 0);
|
26
|
+
__decorate([
|
27
|
+
property({ type: String })
|
28
|
+
], NileProgressBar.prototype, "variant", void 0);
|
24
29
|
NileProgressBar = __decorate([
|
25
30
|
customElement('nile-progress-bar')
|
26
31
|
], NileProgressBar);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-progress-bar.js","sourceRoot":"","sources":["../../../src/nile-progress-bar/nile-progress-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGrD,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QAGuB,UAAK,GAAG,CAAC,CAAC;
|
1
|
+
{"version":3,"file":"nile-progress-bar.js","sourceRoot":"","sources":["../../../src/nile-progress-bar/nile-progress-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,MAAM,MAAM,yBAAyB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGrD,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,UAAU;IAAxC;;QAGuB,UAAK,GAAG,CAAC,CAAC;QACV,YAAO,GAAyB,QAAQ,CAAC;IAavE,CAAC;IAXU,MAAM;QACb,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QAEjE,OAAO,IAAI,CAAA;;qDAEsC,YAAY;oCAC7B,IAAI,CAAC,KAAK;;;KAGzC,CAAC;IACJ,CAAC;;AAfe,sBAAM,GAAmB,MAAM,AAAzB,CAA0B;AAEpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAA0C;AAJ1D,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAiB3B","sourcesContent":["import { LitElement, html, css, CSSResultGroup } from 'lit';\nimport styles from './nile-progress-bar.css';\nimport { customElement, property } from 'lit/decorators.js';\n\n@customElement('nile-progress-bar')\nexport class NileProgressBar extends LitElement {\n static override styles: CSSResultGroup = styles;\n\n @property({ type: Number }) value = 0;\n @property({ type: String }) variant: 'normal' | 'rounded' = 'normal';\n\n override render() {\n const variantClass = this.variant === 'rounded' ? 'rounded' : '';\n\n return html`\n <div class=\"nile-progress-bar__container\">\n <ul class=\"nile-progress-bar__progress-bar ${variantClass}\">\n <li><span style=\"width: ${this.value}%\"></span></li>\n </ul>\n </div>\n `;\n }\n}\n"]}
|
@@ -9,6 +9,9 @@ import { css } from 'lit';
|
|
9
9
|
* Stepper CSS
|
10
10
|
*/
|
11
11
|
export const styles = css `
|
12
|
+
*{
|
13
|
+
box-sizing:border-box;
|
14
|
+
}
|
12
15
|
:host {
|
13
16
|
display:block;
|
14
17
|
height:100%;
|
@@ -16,11 +19,14 @@ export const styles = css `
|
|
16
19
|
.nile-stepper--horizontal{
|
17
20
|
display:flex;
|
18
21
|
align-items:center;
|
22
|
+
padding: var(--nile-spacing-spacing-3xl) 0;
|
19
23
|
}
|
24
|
+
|
20
25
|
.nile-stepper--vertical{
|
21
26
|
height:100%;
|
22
27
|
display:flex;
|
23
28
|
flex-direction:column;
|
29
|
+
padding: var(--nile-spacing-spacing-3xl) var(--nile-spacing-spacing-3xl) 0;
|
24
30
|
}
|
25
31
|
`;
|
26
32
|
export default [styles];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-stepper.css.js","sourceRoot":"","sources":["../../../src/nile-stepper/nile-stepper.css.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AAEF,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
1
|
+
{"version":3,"file":"nile-stepper.css.js","sourceRoot":"","sources":["../../../src/nile-stepper/nile-stepper.css.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AAEF,OAAO,EAAC,GAAG,EAAC,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;CAoBxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n* Copyright Aquera Inc 2023\n*\n* This source code is licensed under the BSD-3-Clause license found in the\n* LICENSE file in the root directory of this source tree.\n*/\n\nimport {css} from 'lit';\n\n/**\n * Stepper CSS\n */\nexport const styles = css`\n\t*{\n\t\tbox-sizing:border-box;\n\t}\n\t:host {\n\t\tdisplay:block;\n\t\theight:100%;\n\t}\n\t.nile-stepper--horizontal{\n\t\tdisplay:flex;\n\t\talign-items:center;\n\t\tpadding: var(--nile-spacing-spacing-3xl) 0;\n\t}\n\n\t.nile-stepper--vertical{\n\t\theight:100%;\n\t\tdisplay:flex;\n\t\tflex-direction:column;\n\t\tpadding: var(--nile-spacing-spacing-3xl) var(--nile-spacing-spacing-3xl) 0;\n\t}\n`;\n\nexport default [styles];"]}
|
@@ -4,7 +4,7 @@
|
|
4
4
|
* This source code is licensed under the BSD-3-Clause license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
|
-
import { CSSResultArray, TemplateResult } from 'lit';
|
7
|
+
import { CSSResultArray, TemplateResult, PropertyValueMap } from 'lit';
|
8
8
|
import NileElement from '../internal/nile-element';
|
9
9
|
/**
|
10
10
|
* Nile stepper component.
|
@@ -19,7 +19,7 @@ export declare class NileStepper extends NileElement {
|
|
19
19
|
completedStep: number;
|
20
20
|
size: 'sm' | 'md' | 'lg';
|
21
21
|
icon: string;
|
22
|
-
|
22
|
+
protected update(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
23
23
|
handleCurrentStepChanges(): void;
|
24
24
|
handleCompletedStepChanges(): void;
|
25
25
|
private updateItems;
|
@@ -28,11 +28,11 @@ let NileStepper = class NileStepper extends NileElement {
|
|
28
28
|
this.icon = 'tick';
|
29
29
|
/* #endregion */
|
30
30
|
}
|
31
|
-
|
32
|
-
super.
|
33
|
-
|
31
|
+
update(changedProperties) {
|
32
|
+
super.update(changedProperties);
|
33
|
+
if (changedProperties.has('currentStep') || changedProperties.has('completedStep')) {
|
34
34
|
this.updateItems();
|
35
|
-
}
|
35
|
+
}
|
36
36
|
}
|
37
37
|
handleCurrentStepChanges() {
|
38
38
|
this.updateItems();
|
@@ -119,16 +119,16 @@ __decorate([
|
|
119
119
|
property({ type: Boolean, attribute: 'vertical' })
|
120
120
|
], NileStepper.prototype, "isVertical", void 0);
|
121
121
|
__decorate([
|
122
|
-
property({ type: Boolean, attribute:
|
122
|
+
property({ type: Boolean, attribute: true, reflect: true })
|
123
123
|
], NileStepper.prototype, "contentBelow", void 0);
|
124
124
|
__decorate([
|
125
|
-
property({ type: Number, attribute:
|
125
|
+
property({ type: Number, attribute: true, reflect: true })
|
126
126
|
], NileStepper.prototype, "currentStep", void 0);
|
127
127
|
__decorate([
|
128
|
-
property({ type: Number, attribute:
|
128
|
+
property({ type: Number, attribute: true, reflect: true })
|
129
129
|
], NileStepper.prototype, "completedStep", void 0);
|
130
130
|
__decorate([
|
131
|
-
property({ type: String, attribute:
|
131
|
+
property({ type: String, attribute: true, reflect: true })
|
132
132
|
], NileStepper.prototype, "size", void 0);
|
133
133
|
__decorate([
|
134
134
|
property()
|