@aquera/nile-elements 0.1.28-beta-1.1 → 0.1.29-beta-1.2

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.
Files changed (32) hide show
  1. package/dist/nile-accordion/nile-accordion.cjs.js +1 -1
  2. package/dist/nile-accordion/nile-accordion.cjs.js.map +1 -1
  3. package/dist/nile-accordion/nile-accordion.esm.js +2 -2
  4. package/dist/nile-circular-progressbar/nile-circular-progressbar.cjs.js +1 -1
  5. package/dist/nile-circular-progressbar/nile-circular-progressbar.cjs.js.map +1 -1
  6. package/dist/nile-circular-progressbar/nile-circular-progressbar.css.cjs.js +1 -1
  7. package/dist/nile-circular-progressbar/nile-circular-progressbar.css.cjs.js.map +1 -1
  8. package/dist/nile-circular-progressbar/nile-circular-progressbar.css.esm.js +47 -47
  9. package/dist/nile-circular-progressbar/nile-circular-progressbar.esm.js +8 -12
  10. package/dist/nile-progress-bar/nile-progress-bar.cjs.js.map +1 -1
  11. package/dist/nile-progress-bar/nile-progress-bar.css.cjs.js +1 -1
  12. package/dist/nile-progress-bar/nile-progress-bar.css.cjs.js.map +1 -1
  13. package/dist/nile-progress-bar/nile-progress-bar.css.esm.js +1 -0
  14. package/dist/src/nile-accordion/nile-accordion.d.ts +6 -5
  15. package/dist/src/nile-accordion/nile-accordion.js +19 -6
  16. package/dist/src/nile-accordion/nile-accordion.js.map +1 -1
  17. package/dist/src/nile-circular-progressbar/nile-circular-progressbar.css.js +47 -47
  18. package/dist/src/nile-circular-progressbar/nile-circular-progressbar.css.js.map +1 -1
  19. package/dist/src/nile-circular-progressbar/nile-circular-progressbar.d.ts +5 -4
  20. package/dist/src/nile-circular-progressbar/nile-circular-progressbar.js +29 -40
  21. package/dist/src/nile-circular-progressbar/nile-circular-progressbar.js.map +1 -1
  22. package/dist/src/nile-progress-bar/nile-progress-bar.css.js +1 -0
  23. package/dist/src/nile-progress-bar/nile-progress-bar.css.js.map +1 -1
  24. package/dist/src/nile-progress-bar/nile-progress-bar.js.map +1 -1
  25. package/dist/tsconfig.tsbuildinfo +1 -1
  26. package/package.json +1 -1
  27. package/src/nile-accordion/nile-accordion.ts +13 -2
  28. package/src/nile-circular-progressbar/nile-circular-progressbar.css.ts +47 -48
  29. package/src/nile-circular-progressbar/nile-circular-progressbar.ts +33 -34
  30. package/src/nile-progress-bar/nile-progress-bar.css.ts +1 -0
  31. package/src/nile-progress-bar/nile-progress-bar.ts +2 -0
  32. package/vscode-html-custom-data.json +7 -17
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent nile-elements following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "nile-elements",
6
- "version": "0.1.28-beta-1.1",
6
+ "version": "0.1.29-beta-1.2",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -1,4 +1,4 @@
1
- /**
1
+ /**
2
2
  * Copyright Aquera Inc 2023
3
3
  *
4
4
  * This source code is licensed under the BSD-3-Clause license found in the
@@ -57,6 +57,7 @@ static styles: CSSResultGroup = styles;
57
57
  @query('.accordian__header') header: HTMLElement;
58
58
  @query('.accordian__body') body: HTMLElement;
59
59
  @query('.accordian__expand-icon-slot') expandIconSlot: HTMLSlotElement;
60
+ @query('slot[name="summary"]') summarySlot: HTMLSlotElement;
60
61
 
61
62
  /**
62
63
  * Indicates whether or not the accordian is open. You can toggle this attribute to show and hide the accordian, or you
@@ -93,7 +94,17 @@ firstUpdated() {
93
94
  this.body.style.height = this.open ? 'auto' : '0';
94
95
  }
95
96
 
96
- private handleSummaryClick() {
97
+ private handleSummaryClick(event: MouseEvent) {
98
+ const path = event.composedPath();
99
+ const slotIndex = path.indexOf(this.summarySlot);
100
+ if (slotIndex !== -1) {
101
+ for (let i = 0; i < slotIndex; i++) {
102
+ const el = path[i];
103
+ if (el instanceof Element && el.matches('input, button, select, textarea, a, label')) {
104
+ return;
105
+ }
106
+ }
107
+ }
97
108
  if (!this.disabled) {
98
109
  if (this.open) {
99
110
  this.hide();
@@ -11,53 +11,52 @@ import { css } from 'lit';
11
11
  * Progressbar CSS
12
12
  */
13
13
  export const styles = css`
14
- :host{
15
-
16
- }
17
-
18
- .track {
19
- stroke-width: 4px;
20
- stroke: var(--nile-colors-neutral-400);
21
- opacity: 0.5;
22
- fill: none;
23
- height: 2px;
24
- }
25
-
26
- .progress {
27
- stroke-width: 4px;
28
- stroke: var(--nile-colors-primary-600);
29
- stroke-linecap: round;
30
- fill: none;
31
- transform: rotate(270deg);
32
- transform-origin: center;
33
- }
34
-
35
- .circle__text {
36
- color: var(--nile-colors-dark-900);
37
- text-align: center;
38
- font-size: var(--nile-type-scale-1);
39
- font-style: normal;
40
- font-weight: var(--nile-font-weight-regular);
41
- line-height: var(--nile-type-scale-1);
42
- letter-spacing: 0.2px;
43
-
44
- }
45
-
46
-
47
- .nile-progress-bar__status {
48
- display: flex;
49
- justify-content: space-between;
50
- align-items: center;
51
- margin-bottom: 4px;
52
- }
53
-
54
- .nile-progress-bar__message {
55
- flex-grow: 1;
56
- }
57
-
58
- .nile-progress-bar__percentage {
59
- white-space: nowrap;
60
- }
61
- `;
62
14
 
15
+ :host {
16
+ display: inline-block;
17
+ }
18
+
19
+ .track {
20
+ stroke-width: 4px;
21
+ stroke: var(--nile-colors-neutral-400);
22
+ opacity: 0.5;
23
+ fill: none;
24
+ }
25
+
26
+ .progress {
27
+ stroke-width: 4px;
28
+ stroke: var(--nile-colors-primary-600);
29
+ stroke-linecap: round;
30
+ fill: none;
31
+ transform: rotate(270deg);
32
+ transform-origin: center;
33
+ transition: stroke-dashoffset 0.8s ease-in-out;
34
+ }
35
+
36
+ .circle__text {
37
+ fill: var(--nile-colors-dark-900);
38
+ text-align: center;
39
+ font-size: var(--nile-type-scale-1);
40
+ font-style: normal;
41
+ font-weight: var(--nile-font-weight-regular);
42
+ line-height: var(--nile-type-scale-1);
43
+ letter-spacing: 0.2px;
44
+ }
45
+
46
+ .nile-progress-bar__status {
47
+ display: flex;
48
+ justify-content: space-between;
49
+ align-items: center;
50
+ margin-bottom: 4px;
51
+ }
52
+
53
+ .nile-progress-bar__message {
54
+ flex-grow: 1;
55
+ }
56
+
57
+ .nile-progress-bar__percentage {
58
+ white-space: nowrap;
59
+ }
60
+
61
+ `
63
62
  export default [styles];
@@ -32,10 +32,10 @@ export class NileCircularProgressbar extends NileElement {
32
32
  return [styles];
33
33
  }
34
34
 
35
- @query('.progress') progressCircle: any;
36
- @property({ type: Number, reflect: true }) progress = 50;
37
- @property({ reflect: true }) content: String;
38
- /* #endregion */
35
+ @query('.progress') progressCircle!: SVGCircleElement;
36
+
37
+ @property({ type: Number, reflect: true }) value = 0;
38
+ /* #endregion */
39
39
 
40
40
  /* #region Methods */
41
41
 
@@ -44,43 +44,46 @@ export class NileCircularProgressbar extends NileElement {
44
44
  * @slot This is a slot test
45
45
  */
46
46
  // make reactive to pass through
47
- @property({ type: String, reflect: true }) size: 'sm' | 'md' | 'lg' = 'md';
47
+ @property({ type: String, reflect: true }) content?: string;
48
+ @property({ type: Number, reflect: true }) size = 40;
48
49
 
49
50
  private get circleSize() {
50
- switch (this.size) {
51
- case 'sm':
52
- return { radius: 9, viewBox: 24, fontSize: '5px' };
53
- case 'lg':
54
- return { radius: 28, viewBox: 64, fontSize: '10px' };
55
- default:
56
- return { radius: 18, viewBox: 40, fontSize: '10px' };
57
- }
51
+ const radius = this.size / 2 - 4;
52
+ return {
53
+ radius,
54
+ viewBox: this.size,
55
+ fontSize: `${this.size * 0.25}px`,
56
+ };
58
57
  }
59
58
 
60
59
  connectedCallback() {
61
60
  super.connectedCallback();
62
61
  this.updateComplete.then(() => {
63
- if (this.progress < 0) {
64
- this.progress = 0;
65
- }
66
- if (this.progress > 100) {
67
- this.progress = 100;
68
- }
69
- this.setProgress(this.progress);
62
+ this.value = Math.max(0, Math.min(100, this.value));
63
+ this.setProgress(this.value);
70
64
  });
71
65
  }
66
+
72
67
  private setProgress(percent: number) {
73
- const circleRadius = this.progressCircle.r.baseVal.value;
74
- let circumference = circleRadius * 2 * Math.PI;
75
- this.progressCircle.style.strokeDasharray = circumference;
76
- this.progressCircle.style.strokeDashoffset =
77
- circumference - (percent / 100) * circumference;
68
+ if (this.progressCircle) {
69
+ const circleRadius = this.progressCircle.r.baseVal.value;
70
+ const circumference = circleRadius * 2 * Math.PI;
71
+
72
+ this.progressCircle.style.transition = 'stroke-dashoffset 0.8s ease-in-out';
73
+ this.progressCircle.style.strokeDasharray = `${circumference}`;
74
+ this.progressCircle.style.strokeDashoffset = `${circumference - (percent / 100) * circumference}`;
75
+ }
76
+ }
77
+
78
+ updated(changedProperties: Map<string, any>) {
79
+ if (changedProperties.has('value')) {
80
+ this.setProgress(this.value);
81
+ }
78
82
  }
79
83
 
80
84
  public render(): TemplateResult {
81
85
  const { radius, viewBox, fontSize } = this.circleSize;
82
- const innerText = this.content === undefined ? `${Math.round(this.progress)}%` : this.content;
83
-
86
+ const innerText = this.content ?? `${Math.round(this.value)}%`;
84
87
 
85
88
  return html`
86
89
  <svg width="${viewBox}" height="${viewBox}" viewBox="0 0 ${viewBox} ${viewBox}">
@@ -96,13 +99,9 @@ export class NileCircularProgressbar extends NileElement {
96
99
  class="circle__text"
97
100
  style="font-size: ${fontSize};"
98
101
  >
99
- ${innerText}
100
- </text>
101
-
102
- </svg>
103
-
104
-
105
-
102
+ ${innerText}
103
+ </text>
104
+ </svg>
106
105
  `;
107
106
  }
108
107
 
@@ -22,6 +22,7 @@ export default css`
22
22
  width: 100%;
23
23
  height: 2px;
24
24
  background-color: var(--nile-colors-neutral-400);
25
+ transition: stroke-dashoffset 0.8s ease-in-out
25
26
  }
26
27
 
27
28
 
@@ -11,6 +11,8 @@ export class NileProgressBar extends LitElement {
11
11
 
12
12
  override render() {
13
13
  const variantClass = this.variant === 'rounded' ? 'rounded' : '';
14
+
15
+
14
16
 
15
17
  return html`
16
18
  <div class="nile-progress-bar__container">
@@ -3,7 +3,7 @@
3
3
  "tags": [
4
4
  {
5
5
  "name": "nile-accordion",
6
- "description": "Nile detail component.\n\nAttributes:\n\n * `open` {`boolean`} - Indicates whether or not the accordian is open. You can toggle this attribute to show and hide the accordian, or you\ncan use the `show()` and `hide()` methods and this attribute will reflect the accordian' open state.\n\n * `variant` {`\"dark\" | \"light\"`} - Indicates the visual style of the accordian component. Accepted values are `'dark'` or `'light'`.\nDefaults to `'light'`.\n\n * `expandIconPlacement` {`\"left\" | \"right\"`} - Specifies the direction of the arrow indicator. Accepted values are `'left'` or `'right'`.\nDefaults to `'right'`.\n\n * `size` {`\"sm\" | \"md\" | \"lg\"`} - Specifies the size of the accordian component. Accepted values are `'sm'`, `'md'`, or `'lg'`.\nDefaults to `'md'`.\n\n * `summary` {`string`} - The summary to show in the header. If you need to display HTML, use the `summary` slot instead.\n\n * `disabled` {`boolean`} - Disables the accordian so it can't be toggled.\n\nProperties:\n\n * `styles` - \n\n * `accordian` {`HTMLElement`} - \n\n * `header` {`HTMLElement`} - \n\n * `body` {`HTMLElement`} - \n\n * `expandIconSlot` {`HTMLSlotElement`} - \n\n * `open` {`boolean`} - Indicates whether or not the accordian is open. You can toggle this attribute to show and hide the accordian, or you\ncan use the `show()` and `hide()` methods and this attribute will reflect the accordian' open state.\n\n * `variant` {`\"dark\" | \"light\"`} - Indicates the visual style of the accordian component. Accepted values are `'dark'` or `'light'`.\nDefaults to `'light'`.\n\n * `expandIconPlacement` {`\"left\" | \"right\"`} - Specifies the direction of the arrow indicator. Accepted values are `'left'` or `'right'`.\nDefaults to `'right'`.\n\n * `size` {`\"sm\" | \"md\" | \"lg\"`} - Specifies the size of the accordian component. Accepted values are `'sm'`, `'md'`, or `'lg'`.\nDefaults to `'md'`.\n\n * `summary` {`string`} - The summary to show in the header. If you need to display HTML, use the `summary` slot instead.\n\n * `disabled` {`boolean`} - Disables the accordian so it can't be toggled.\n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
6
+ "description": "Nile detail component.\n\nAttributes:\n\n * `open` {`boolean`} - Indicates whether or not the accordian is open. You can toggle this attribute to show and hide the accordian, or you\ncan use the `show()` and `hide()` methods and this attribute will reflect the accordian' open state.\n\n * `variant` {`\"dark\" | \"light\"`} - Indicates the visual style of the accordian component. Accepted values are `'dark'` or `'light'`.\nDefaults to `'light'`.\n\n * `expandIconPlacement` {`\"left\" | \"right\"`} - Specifies the direction of the arrow indicator. Accepted values are `'left'` or `'right'`.\nDefaults to `'right'`.\n\n * `size` {`\"sm\" | \"md\" | \"lg\"`} - Specifies the size of the accordian component. Accepted values are `'sm'`, `'md'`, or `'lg'`.\nDefaults to `'md'`.\n\n * `summary` {`string`} - The summary to show in the header. If you need to display HTML, use the `summary` slot instead.\n\n * `disabled` {`boolean`} - Disables the accordian so it can't be toggled.\n\nProperties:\n\n * `styles` - \n\n * `accordian` {`HTMLElement`} - \n\n * `header` {`HTMLElement`} - \n\n * `body` {`HTMLElement`} - \n\n * `expandIconSlot` {`HTMLSlotElement`} - \n\n * `summarySlot` {`HTMLSlotElement`} - \n\n * `open` {`boolean`} - Indicates whether or not the accordian is open. You can toggle this attribute to show and hide the accordian, or you\ncan use the `show()` and `hide()` methods and this attribute will reflect the accordian' open state.\n\n * `variant` {`\"dark\" | \"light\"`} - Indicates the visual style of the accordian component. Accepted values are `'dark'` or `'light'`.\nDefaults to `'light'`.\n\n * `expandIconPlacement` {`\"left\" | \"right\"`} - Specifies the direction of the arrow indicator. Accepted values are `'left'` or `'right'`.\nDefaults to `'right'`.\n\n * `size` {`\"sm\" | \"md\" | \"lg\"`} - Specifies the size of the accordian component. Accepted values are `'sm'`, `'md'`, or `'lg'`.\nDefaults to `'md'`.\n\n * `summary` {`string`} - The summary to show in the header. If you need to display HTML, use the `summary` slot instead.\n\n * `disabled` {`boolean`} - Disables the accordian so it can't be toggled.\n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
7
7
  "attributes": [
8
8
  {
9
9
  "name": "open",
@@ -799,30 +799,20 @@
799
799
  },
800
800
  {
801
801
  "name": "nile-circular-progressbar",
802
- "description": "Nile icon component.\n\nAttributes:\n\n * `progress` {`number`} - \n\n * `content` {`String`} - \n\n * `size` {`\"sm\" | \"md\" | \"lg\"`} - Render method\n\nProperties:\n\n * `progressCircle` - \n\n * `progress` {`number`} - \n\n * `content` {`String`} - \n\n * `size` {`\"sm\" | \"md\" | \"lg\"`} - Render method\n\n * `circleSize` {`{ radius: number; viewBox: number; fontSize: string; }`} - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
802
+ "description": "Nile icon component.\n\nAttributes:\n\n * `value` {`number`} - \n\n * `content` {`string | undefined`} - Render method\n\n * `size` {`number`} - \n\nProperties:\n\n * `progressCircle` {`SVGCircleElement`} - \n\n * `value` {`number`} - \n\n * `content` {`string | undefined`} - Render method\n\n * `size` {`number`} - \n\n * `circleSize` {`{ radius: number; viewBox: number; fontSize: string; }`} - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
803
803
  "attributes": [
804
804
  {
805
- "name": "progress",
806
- "description": "`progress` {`number`} - \n\nProperty: progress\n\nDefault: 50"
805
+ "name": "value",
806
+ "description": "`value` {`number`} - \n\nProperty: value\n\nDefault: 0"
807
807
  },
808
808
  {
809
809
  "name": "content",
810
- "description": "`content` {`String`} - \n\nProperty: content"
810
+ "description": "`content` {`string | undefined`} - Render method\n\nProperty: content",
811
+ "values": []
811
812
  },
812
813
  {
813
814
  "name": "size",
814
- "description": "`size` {`\"sm\" | \"md\" | \"lg\"`} - Render method\n\nProperty: size\n\nDefault: md",
815
- "values": [
816
- {
817
- "name": "sm"
818
- },
819
- {
820
- "name": "md"
821
- },
822
- {
823
- "name": "lg"
824
- }
825
- ]
815
+ "description": "`size` {`number`} - \n\nProperty: size\n\nDefault: 40"
826
816
  }
827
817
  ]
828
818
  },