@exmg/exm-progress 1.2.7

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 (28) hide show
  1. package/.rollup.cache/root/repo/packages/exm-progress/dist/exm-circular-progress.d.ts +25 -0
  2. package/.rollup.cache/root/repo/packages/exm-progress/dist/exm-circular-progress.js +71 -0
  3. package/.rollup.cache/root/repo/packages/exm-progress/dist/exm-circular-progress.stories.d.ts +19 -0
  4. package/.rollup.cache/root/repo/packages/exm-progress/dist/exm-circular-progress.stories.js +20 -0
  5. package/.rollup.cache/root/repo/packages/exm-progress/dist/exm-linear-progress.d.ts +29 -0
  6. package/.rollup.cache/root/repo/packages/exm-progress/dist/exm-linear-progress.js +67 -0
  7. package/.rollup.cache/root/repo/packages/exm-progress/dist/exm-linear-progress.stories.d.ts +24 -0
  8. package/.rollup.cache/root/repo/packages/exm-progress/dist/exm-linear-progress.stories.js +40 -0
  9. package/.rollup.cache/root/repo/packages/exm-progress/dist/index.d.ts +2 -0
  10. package/.rollup.cache/root/repo/packages/exm-progress/dist/index.js +3 -0
  11. package/.rollup.cache/root/repo/packages/exm-progress/dist/styles/exm-circular-progress-css.d.ts +1 -0
  12. package/.rollup.cache/root/repo/packages/exm-progress/dist/styles/exm-circular-progress-css.js +35 -0
  13. package/.rollup.cache/root/repo/packages/exm-progress/dist/styles/exm-linear-progress-css.d.ts +1 -0
  14. package/.rollup.cache/root/repo/packages/exm-progress/dist/styles/exm-linear-progress-css.js +84 -0
  15. package/README.md +3 -0
  16. package/dist/exm-circular-progress.d.ts +25 -0
  17. package/dist/exm-circular-progress.js +73 -0
  18. package/dist/exm-circular-progress.stories.d.ts +19 -0
  19. package/dist/exm-linear-progress.d.ts +29 -0
  20. package/dist/exm-linear-progress.js +69 -0
  21. package/dist/exm-linear-progress.stories.d.ts +24 -0
  22. package/dist/index.d.ts +2 -0
  23. package/dist/index.js +3 -0
  24. package/dist/styles/exm-circular-progress-css.d.ts +1 -0
  25. package/dist/styles/exm-circular-progress-css.js +38 -0
  26. package/dist/styles/exm-linear-progress-css.d.ts +1 -0
  27. package/dist/styles/exm-linear-progress-css.js +87 -0
  28. package/package.json +47 -0
@@ -0,0 +1,25 @@
1
+ import { LitElement } from 'lit';
2
+ /**
3
+ * exm-circular-progress
4
+ * Material 3 circular progress
5
+ */
6
+ export declare class ExmCircularProgress extends LitElement {
7
+ private lineRatio;
8
+ /**
9
+ * Progress value (0-100)
10
+ */
11
+ progress: number;
12
+ /**
13
+ * width and height of the progress circle
14
+ */
15
+ size: number;
16
+ radius: number;
17
+ static styles: import("lit").CSSResult[];
18
+ attributeChangedCallback(_name: string, _old: string | null, _value: string | null): void;
19
+ protected render(): import("lit-html").TemplateResult<2>;
20
+ }
21
+ declare global {
22
+ interface HTMLElementTagNameMap {
23
+ 'exm-circular-progress': ExmCircularProgress;
24
+ }
25
+ }
@@ -0,0 +1,71 @@
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, svg } from 'lit';
3
+ import { customElement, property, state } from 'lit/decorators.js';
4
+ import { styles } from './styles/exm-circular-progress-css.js';
5
+ /**
6
+ * exm-circular-progress
7
+ * Material 3 circular progress
8
+ */
9
+ let ExmCircularProgress = class ExmCircularProgress extends LitElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.lineRatio = 5 / 60;
13
+ /**
14
+ * Progress value (0-100)
15
+ */
16
+ this.progress = 0;
17
+ /**
18
+ * width and height of the progress circle
19
+ */
20
+ this.size = 60;
21
+ this.radius = 51;
22
+ }
23
+ attributeChangedCallback(_name, _old, _value) {
24
+ const lineWidth = this.lineRatio * this.size;
25
+ const radius = this.size - lineWidth;
26
+ this.radius = radius;
27
+ const lineGap = this.progress <= 0 ? 0 : this.progress >= 100 ? 0 : lineWidth * 3.5;
28
+ const dashLength = Math.PI * 2 * radius - (lineGap * this.progress) / 100;
29
+ this.style.setProperty('--exm-progress-progress', `${Math.min(Math.max(0, this.progress), 100) / 100}`);
30
+ this.style.setProperty('--exm-progress-dash-length', `${dashLength}`);
31
+ this.style.setProperty('--exm-progress-gap', `${this.progress <= 0 ? 0 : this.progress >= 100 ? 0 : lineWidth * 3.5}`);
32
+ }
33
+ render() {
34
+ const lineWidth = this.lineRatio * this.size;
35
+ const dashLength = Math.PI * 2 * this.radius;
36
+ const rotationOffset = this.progress <= 0 || this.progress >= 100 ? 0 : 360 / (dashLength / (lineWidth * 1.75));
37
+ return svg `<svg
38
+ width="${this.size}px"
39
+ height="${this.size}px"
40
+ class="circular-progress"
41
+ viewBox="-${this.size} -${this.size} ${this.size * 2} ${this.size * 2}"
42
+ xmlns="http://www.w3.org/2000/svg"
43
+ role="progressbar"
44
+ >
45
+ <circle class="base-circle" cx="0" cy="0" r="${this.radius}" stroke-linecap="round" transform="rotate(${-90 - rotationOffset})" stroke-width="${lineWidth * 2}"/>
46
+ <circle class="progress-circle" cx="0" cy="0" r="${this.radius}" stroke-linecap="round" transform="rotate(${-90 + rotationOffset})" stroke-width="${lineWidth * 2}"/>
47
+ </svg>
48
+ `;
49
+ }
50
+ };
51
+ ExmCircularProgress.styles = [styles];
52
+ __decorate([
53
+ property({
54
+ type: Number,
55
+ reflect: true,
56
+ })
57
+ ], ExmCircularProgress.prototype, "progress", void 0);
58
+ __decorate([
59
+ property({
60
+ type: Number,
61
+ reflect: true,
62
+ })
63
+ ], ExmCircularProgress.prototype, "size", void 0);
64
+ __decorate([
65
+ state()
66
+ ], ExmCircularProgress.prototype, "radius", void 0);
67
+ ExmCircularProgress = __decorate([
68
+ customElement('exm-circular-progress')
69
+ ], ExmCircularProgress);
70
+ export { ExmCircularProgress };
71
+ //# sourceMappingURL=exm-circular-progress.js.map
@@ -0,0 +1,19 @@
1
+ import type { StoryObj } from '@storybook/web-components-vite';
2
+ import { ExmCircularProgress } from './exm-circular-progress.js';
3
+ import './exm-circular-progress.js';
4
+ declare const meta: {
5
+ title: string;
6
+ tags: string[];
7
+ render: (args: ExmCircularProgress) => import("lit-html").TemplateResult<1>;
8
+ argTypes: {
9
+ progress: {
10
+ control: "number";
11
+ };
12
+ size: {
13
+ control: "number";
14
+ };
15
+ };
16
+ };
17
+ export default meta;
18
+ type Story = StoryObj<ExmCircularProgress>;
19
+ export declare const Default: Story;
@@ -0,0 +1,20 @@
1
+ import { html } from 'lit';
2
+ import './exm-circular-progress.js';
3
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
4
+ const meta = {
5
+ title: 'Packages/ExmProgress/CircularProgress',
6
+ tags: ['autodocs'],
7
+ render: (args) => html `<exm-circular-progress .progress=${args.progress} .size=${args.size}></exm-circular-progress>`,
8
+ argTypes: {
9
+ progress: { control: 'number' },
10
+ size: { control: 'number' },
11
+ },
12
+ };
13
+ export default meta;
14
+ export const Default = {
15
+ args: {
16
+ progress: 20,
17
+ size: 60,
18
+ },
19
+ };
20
+ //# sourceMappingURL=exm-circular-progress.stories.js.map
@@ -0,0 +1,29 @@
1
+ import { LitElement } from 'lit';
2
+ /**
3
+ * exm-linear-progress
4
+ * Material 3 linear progress
5
+ */
6
+ export declare class ExmLinearProgress extends LitElement {
7
+ /**
8
+ * Progress value (0-100)
9
+ */
10
+ progress: number;
11
+ /**
12
+ * Wether or not to display the dots/steps.
13
+ * When engaged, it will show a dot at ± every 10% interval.
14
+ */
15
+ steps: boolean;
16
+ /**
17
+ * Wether or not to display the value label.
18
+ * When engaged, it will show the current progress value.
19
+ */
20
+ showValue: boolean;
21
+ static styles: import("lit").CSSResult[];
22
+ attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
23
+ protected render(): import("lit-html").TemplateResult<1>;
24
+ }
25
+ declare global {
26
+ interface HTMLElementTagNameMap {
27
+ 'exm-linear-progress': ExmLinearProgress;
28
+ }
29
+ }
@@ -0,0 +1,67 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, LitElement, nothing } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import { styles } from './styles/exm-linear-progress-css.js';
5
+ import { classMap } from 'lit/directives/class-map.js';
6
+ /**
7
+ * exm-linear-progress
8
+ * Material 3 linear progress
9
+ */
10
+ let ExmLinearProgress = class ExmLinearProgress extends LitElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ /**
14
+ * Progress value (0-100)
15
+ */
16
+ this.progress = 0;
17
+ /**
18
+ * Wether or not to display the dots/steps.
19
+ * When engaged, it will show a dot at ± every 10% interval.
20
+ */
21
+ this.steps = false;
22
+ /**
23
+ * Wether or not to display the value label.
24
+ * When engaged, it will show the current progress value.
25
+ */
26
+ this.showValue = false;
27
+ }
28
+ attributeChangedCallback(name, _old, value) {
29
+ super.attributeChangedCallback(name, _old, value);
30
+ if (name === 'progress') {
31
+ this.style.setProperty('--exm-progress-progress', `${Math.min(Math.max(0, this.progress), 100)}%`);
32
+ }
33
+ }
34
+ render() {
35
+ const trackClass = classMap({
36
+ track: true,
37
+ steps: this.steps,
38
+ });
39
+ return html `
40
+ ${this.showValue
41
+ ? html `<section class="label">${`${Math.min(Math.max(0, this.progress), 100)}%`}</section>`
42
+ : nothing}
43
+ <div class="container" aria-hidden="true" tabindex="0">
44
+ <div class=${trackClass}></div>
45
+ <div class="progress"></div>
46
+ </div>
47
+ `;
48
+ }
49
+ };
50
+ ExmLinearProgress.styles = [styles];
51
+ __decorate([
52
+ property({
53
+ type: Number,
54
+ reflect: true,
55
+ })
56
+ ], ExmLinearProgress.prototype, "progress", void 0);
57
+ __decorate([
58
+ property({ type: Boolean })
59
+ ], ExmLinearProgress.prototype, "steps", void 0);
60
+ __decorate([
61
+ property({ type: Boolean })
62
+ ], ExmLinearProgress.prototype, "showValue", void 0);
63
+ ExmLinearProgress = __decorate([
64
+ customElement('exm-linear-progress')
65
+ ], ExmLinearProgress);
66
+ export { ExmLinearProgress };
67
+ //# sourceMappingURL=exm-linear-progress.js.map
@@ -0,0 +1,24 @@
1
+ import type { StoryObj } from '@storybook/web-components-vite';
2
+ import { ExmLinearProgress } from './exm-linear-progress.js';
3
+ import './exm-linear-progress.js';
4
+ declare const meta: {
5
+ title: string;
6
+ tags: string[];
7
+ render: (args: ExmLinearProgress) => import("lit-html").TemplateResult<1>;
8
+ argTypes: {
9
+ progress: {
10
+ control: "number";
11
+ };
12
+ steps: {
13
+ control: "boolean";
14
+ };
15
+ showValue: {
16
+ control: "boolean";
17
+ };
18
+ };
19
+ };
20
+ export default meta;
21
+ type Story = StoryObj<ExmLinearProgress>;
22
+ export declare const Default: Story;
23
+ export declare const Steps: Story;
24
+ export declare const ProgressLabel: Story;
@@ -0,0 +1,40 @@
1
+ import { html } from 'lit';
2
+ import './exm-linear-progress.js';
3
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories
4
+ const meta = {
5
+ title: 'Packages/ExmProgress/LinearProgress',
6
+ tags: ['autodocs'],
7
+ render: (args) => html `<exm-linear-progress
8
+ .progress=${args.progress}
9
+ .steps=${args.steps}
10
+ .showValue=${args.showValue}
11
+ ></exm-linear-progress>`,
12
+ argTypes: {
13
+ progress: { control: 'number' },
14
+ steps: { control: 'boolean' },
15
+ showValue: { control: 'boolean' },
16
+ },
17
+ };
18
+ export default meta;
19
+ export const Default = {
20
+ args: {
21
+ progress: 20,
22
+ steps: false,
23
+ showValue: false,
24
+ },
25
+ };
26
+ export const Steps = {
27
+ args: {
28
+ progress: 20,
29
+ steps: true,
30
+ showValue: false,
31
+ },
32
+ };
33
+ export const ProgressLabel = {
34
+ args: {
35
+ progress: 20,
36
+ steps: false,
37
+ showValue: true,
38
+ },
39
+ };
40
+ //# sourceMappingURL=exm-linear-progress.stories.js.map
@@ -0,0 +1,2 @@
1
+ export { ExmLinearProgress } from './exm-linear-progress.js';
2
+ export { ExmCircularProgress } from './exm-circular-progress.js';
@@ -0,0 +1,3 @@
1
+ export { ExmLinearProgress } from './exm-linear-progress.js';
2
+ export { ExmCircularProgress } from './exm-circular-progress.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,35 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ --_exm-circular-progress-track-color: var(
5
+ --exm-circular-progress-track-color,
6
+ var(--md-sys-color-surface-container-highest, #e0e0e0)
7
+ );
8
+ --_exm-circular-progress-progress-color: var(
9
+ --exm-circular-progress-progress-color,
10
+ var(--md-sys-color-primary, #6200ee)
11
+ );
12
+
13
+ display: inline-block;
14
+ }
15
+
16
+ circle {
17
+ transition: stroke-dashoffset 0.35s ease;
18
+ fill: none;
19
+ }
20
+
21
+ .base-circle {
22
+ stroke-dashoffset: calc(
23
+ var(--exm-progress-progress) * var(--exm-progress-dash-length, 283) * -1 - var(--exm-progress-gap) * 2
24
+ );
25
+ stroke-dasharray: var(--exm-progress-dash-length, 283) calc(var(--exm-progress-dash-length, 283) * 2);
26
+ stroke: var(--_exm-circular-progress-track-color);
27
+ }
28
+
29
+ .progress-circle {
30
+ stroke-dashoffset: calc((1 - var(--exm-progress-progress)) * var(--exm-progress-dash-length, 283));
31
+ stroke-dasharray: var(--exm-progress-dash-length, 283) var(--exm-progress-dash-length, 283);
32
+ stroke: var(--_exm-circular-progress-progress-color);
33
+ }
34
+ `;
35
+ //# sourceMappingURL=exm-circular-progress-css.js.map
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,84 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `
3
+ :host {
4
+ --_exm-linear-progress-track-height: var(--exm-linear-progress-track-height, 12px);
5
+ --_exm-linear-progress-border-radius: var(--exm-linear-progress-border-radius, 99px);
6
+ --_exm-linear-progress-track-color: var(
7
+ --exm-linear-progress-track-color,
8
+ var(--md-sys-color-surface-container-highest, #e0e0e0)
9
+ );
10
+ --_exm-linear-progress-progress-color: var(
11
+ --exm-linear-progress-progress-color,
12
+ var(--md-sys-color-primary, #6200ee)
13
+ );
14
+
15
+ display: block;
16
+ }
17
+
18
+ .container {
19
+ background-color: transparent;
20
+ height: var(--_exm-linear-progress-track-height);
21
+ position: relative;
22
+ overflow: hidden;
23
+ }
24
+
25
+ .track {
26
+ background-color: var(--_exm-linear-progress-track-color);
27
+ background-image: radial-gradient(
28
+ circle,
29
+ var(--_exm-linear-progress-progress-color) calc(var(--_exm-linear-progress-track-height) / 2),
30
+ transparent calc(var(--_exm-linear-progress-track-height) / 2)
31
+ );
32
+ background-size: var(--_exm-linear-progress-track-height) var(--_exm-linear-progress-track-height);
33
+ background-repeat: no-repeat;
34
+ background-position: right center;
35
+ position: absolute;
36
+ top: 0;
37
+ right: 0;
38
+ width: calc(100% - var(--_exm-linear-progress-track-height) / 2);
39
+ height: 100%;
40
+ border-radius: var(--_exm-linear-progress-border-radius);
41
+ clip-path: xywh(
42
+ var(--exm-progress-progress, 0) 0 100% var(--_exm-linear-progress-track-height) round
43
+ calc(var(--_exm-linear-progress-track-height) / 2) 0% 0px calc(var(--_exm-linear-progress-track-height) / 2)
44
+ );
45
+
46
+ &.steps {
47
+ background-image: radial-gradient(
48
+ circle at calc(100% - 6px) center,
49
+ var(--_exm-linear-progress-progress-color) calc(var(--_exm-linear-progress-track-height) / 2),
50
+ transparent calc(var(--_exm-linear-progress-track-height) / 2)
51
+ );
52
+ background-size: 10% var(--_exm-linear-progress-track-height);
53
+ background-position: center-6px center;
54
+ background-repeat: repeat-x;
55
+ }
56
+ }
57
+
58
+ .progress {
59
+ position: absolute;
60
+ top: 0;
61
+ left: 0;
62
+ background-color: var(--_exm-linear-progress-progress-color);
63
+ width: calc(var(--exm-progress-progress, 0) - var(--_exm-linear-progress-track-height) / 2);
64
+ height: 100%;
65
+ border-radius: var(--_exm-linear-progress-border-radius);
66
+ }
67
+
68
+ .label {
69
+ background-color: var(--md-sys-color-inverse-surface, #333333);
70
+ display: inline-block;
71
+ color: var(--md-sys-color-inverse-on-surface, #ffffff);
72
+ font-size: 0.875rem;
73
+ line-height: 1.25rem;
74
+ padding: 0.75rem;
75
+ min-width: 2rem;
76
+ text-align: center;
77
+ border-radius: 9999px;
78
+ margin-bottom: 0.5rem;
79
+ left: var(--exm-progress-progress, 0);
80
+ position: relative;
81
+ transform: translateX(-50%);
82
+ }
83
+ `;
84
+ //# sourceMappingURL=exm-linear-progress-css.js.map
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @exmg/exm-progress
2
+
3
+ This package provides progress bar functionality.
@@ -0,0 +1,25 @@
1
+ import { LitElement } from 'lit';
2
+ /**
3
+ * exm-circular-progress
4
+ * Material 3 circular progress
5
+ */
6
+ export declare class ExmCircularProgress extends LitElement {
7
+ private lineRatio;
8
+ /**
9
+ * Progress value (0-100)
10
+ */
11
+ progress: number;
12
+ /**
13
+ * width and height of the progress circle
14
+ */
15
+ size: number;
16
+ radius: number;
17
+ static styles: import("lit").CSSResult[];
18
+ attributeChangedCallback(_name: string, _old: string | null, _value: string | null): void;
19
+ protected render(): import("lit-html").TemplateResult<2>;
20
+ }
21
+ declare global {
22
+ interface HTMLElementTagNameMap {
23
+ 'exm-circular-progress': ExmCircularProgress;
24
+ }
25
+ }
@@ -0,0 +1,73 @@
1
+ import { __decorate } from 'tslib';
2
+ import { LitElement, svg } from 'lit';
3
+ import { property, state, customElement } from 'lit/decorators.js';
4
+ import { styles } from './styles/exm-circular-progress-css.js';
5
+
6
+ /**
7
+ * exm-circular-progress
8
+ * Material 3 circular progress
9
+ */
10
+ let ExmCircularProgress = class ExmCircularProgress extends LitElement {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.lineRatio = 5 / 60;
14
+ /**
15
+ * Progress value (0-100)
16
+ */
17
+ this.progress = 0;
18
+ /**
19
+ * width and height of the progress circle
20
+ */
21
+ this.size = 60;
22
+ this.radius = 51;
23
+ }
24
+ attributeChangedCallback(_name, _old, _value) {
25
+ const lineWidth = this.lineRatio * this.size;
26
+ const radius = this.size - lineWidth;
27
+ this.radius = radius;
28
+ const lineGap = this.progress <= 0 ? 0 : this.progress >= 100 ? 0 : lineWidth * 3.5;
29
+ const dashLength = Math.PI * 2 * radius - (lineGap * this.progress) / 100;
30
+ this.style.setProperty('--exm-progress-progress', `${Math.min(Math.max(0, this.progress), 100) / 100}`);
31
+ this.style.setProperty('--exm-progress-dash-length', `${dashLength}`);
32
+ this.style.setProperty('--exm-progress-gap', `${this.progress <= 0 ? 0 : this.progress >= 100 ? 0 : lineWidth * 3.5}`);
33
+ }
34
+ render() {
35
+ const lineWidth = this.lineRatio * this.size;
36
+ const dashLength = Math.PI * 2 * this.radius;
37
+ const rotationOffset = this.progress <= 0 || this.progress >= 100 ? 0 : 360 / (dashLength / (lineWidth * 1.75));
38
+ return svg `<svg
39
+ width="${this.size}px"
40
+ height="${this.size}px"
41
+ class="circular-progress"
42
+ viewBox="-${this.size} -${this.size} ${this.size * 2} ${this.size * 2}"
43
+ xmlns="http://www.w3.org/2000/svg"
44
+ role="progressbar"
45
+ >
46
+ <circle class="base-circle" cx="0" cy="0" r="${this.radius}" stroke-linecap="round" transform="rotate(${ -90 - rotationOffset})" stroke-width="${lineWidth * 2}"/>
47
+ <circle class="progress-circle" cx="0" cy="0" r="${this.radius}" stroke-linecap="round" transform="rotate(${ -90 + rotationOffset})" stroke-width="${lineWidth * 2}"/>
48
+ </svg>
49
+ `;
50
+ }
51
+ };
52
+ ExmCircularProgress.styles = [styles];
53
+ __decorate([
54
+ property({
55
+ type: Number,
56
+ reflect: true,
57
+ })
58
+ ], ExmCircularProgress.prototype, "progress", void 0);
59
+ __decorate([
60
+ property({
61
+ type: Number,
62
+ reflect: true,
63
+ })
64
+ ], ExmCircularProgress.prototype, "size", void 0);
65
+ __decorate([
66
+ state()
67
+ ], ExmCircularProgress.prototype, "radius", void 0);
68
+ ExmCircularProgress = __decorate([
69
+ customElement('exm-circular-progress')
70
+ ], ExmCircularProgress);
71
+
72
+ export { ExmCircularProgress };
73
+ //# sourceMappingURL=exm-circular-progress.js.map
@@ -0,0 +1,19 @@
1
+ import type { StoryObj } from '@storybook/web-components-vite';
2
+ import { ExmCircularProgress } from './exm-circular-progress.js';
3
+ import './exm-circular-progress.js';
4
+ declare const meta: {
5
+ title: string;
6
+ tags: string[];
7
+ render: (args: ExmCircularProgress) => import("lit-html").TemplateResult<1>;
8
+ argTypes: {
9
+ progress: {
10
+ control: "number";
11
+ };
12
+ size: {
13
+ control: "number";
14
+ };
15
+ };
16
+ };
17
+ export default meta;
18
+ type Story = StoryObj<ExmCircularProgress>;
19
+ export declare const Default: Story;
@@ -0,0 +1,29 @@
1
+ import { LitElement } from 'lit';
2
+ /**
3
+ * exm-linear-progress
4
+ * Material 3 linear progress
5
+ */
6
+ export declare class ExmLinearProgress extends LitElement {
7
+ /**
8
+ * Progress value (0-100)
9
+ */
10
+ progress: number;
11
+ /**
12
+ * Wether or not to display the dots/steps.
13
+ * When engaged, it will show a dot at ± every 10% interval.
14
+ */
15
+ steps: boolean;
16
+ /**
17
+ * Wether or not to display the value label.
18
+ * When engaged, it will show the current progress value.
19
+ */
20
+ showValue: boolean;
21
+ static styles: import("lit").CSSResult[];
22
+ attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
23
+ protected render(): import("lit-html").TemplateResult<1>;
24
+ }
25
+ declare global {
26
+ interface HTMLElementTagNameMap {
27
+ 'exm-linear-progress': ExmLinearProgress;
28
+ }
29
+ }
@@ -0,0 +1,69 @@
1
+ import { __decorate } from 'tslib';
2
+ import { LitElement, nothing, html } from 'lit';
3
+ import { property, customElement } from 'lit/decorators.js';
4
+ import { styles } from './styles/exm-linear-progress-css.js';
5
+ import { classMap } from 'lit/directives/class-map.js';
6
+
7
+ /**
8
+ * exm-linear-progress
9
+ * Material 3 linear progress
10
+ */
11
+ let ExmLinearProgress = class ExmLinearProgress extends LitElement {
12
+ constructor() {
13
+ super(...arguments);
14
+ /**
15
+ * Progress value (0-100)
16
+ */
17
+ this.progress = 0;
18
+ /**
19
+ * Wether or not to display the dots/steps.
20
+ * When engaged, it will show a dot at ± every 10% interval.
21
+ */
22
+ this.steps = false;
23
+ /**
24
+ * Wether or not to display the value label.
25
+ * When engaged, it will show the current progress value.
26
+ */
27
+ this.showValue = false;
28
+ }
29
+ attributeChangedCallback(name, _old, value) {
30
+ super.attributeChangedCallback(name, _old, value);
31
+ if (name === 'progress') {
32
+ this.style.setProperty('--exm-progress-progress', `${Math.min(Math.max(0, this.progress), 100)}%`);
33
+ }
34
+ }
35
+ render() {
36
+ const trackClass = classMap({
37
+ track: true,
38
+ steps: this.steps,
39
+ });
40
+ return html `
41
+ ${this.showValue
42
+ ? html `<section class="label">${`${Math.min(Math.max(0, this.progress), 100)}%`}</section>`
43
+ : nothing}
44
+ <div class="container" aria-hidden="true" tabindex="0">
45
+ <div class=${trackClass}></div>
46
+ <div class="progress"></div>
47
+ </div>
48
+ `;
49
+ }
50
+ };
51
+ ExmLinearProgress.styles = [styles];
52
+ __decorate([
53
+ property({
54
+ type: Number,
55
+ reflect: true,
56
+ })
57
+ ], ExmLinearProgress.prototype, "progress", void 0);
58
+ __decorate([
59
+ property({ type: Boolean })
60
+ ], ExmLinearProgress.prototype, "steps", void 0);
61
+ __decorate([
62
+ property({ type: Boolean })
63
+ ], ExmLinearProgress.prototype, "showValue", void 0);
64
+ ExmLinearProgress = __decorate([
65
+ customElement('exm-linear-progress')
66
+ ], ExmLinearProgress);
67
+
68
+ export { ExmLinearProgress };
69
+ //# sourceMappingURL=exm-linear-progress.js.map
@@ -0,0 +1,24 @@
1
+ import type { StoryObj } from '@storybook/web-components-vite';
2
+ import { ExmLinearProgress } from './exm-linear-progress.js';
3
+ import './exm-linear-progress.js';
4
+ declare const meta: {
5
+ title: string;
6
+ tags: string[];
7
+ render: (args: ExmLinearProgress) => import("lit-html").TemplateResult<1>;
8
+ argTypes: {
9
+ progress: {
10
+ control: "number";
11
+ };
12
+ steps: {
13
+ control: "boolean";
14
+ };
15
+ showValue: {
16
+ control: "boolean";
17
+ };
18
+ };
19
+ };
20
+ export default meta;
21
+ type Story = StoryObj<ExmLinearProgress>;
22
+ export declare const Default: Story;
23
+ export declare const Steps: Story;
24
+ export declare const ProgressLabel: Story;
@@ -0,0 +1,2 @@
1
+ export { ExmLinearProgress } from './exm-linear-progress.js';
2
+ export { ExmCircularProgress } from './exm-circular-progress.js';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { ExmLinearProgress } from './exm-linear-progress.js';
2
+ export { ExmCircularProgress } from './exm-circular-progress.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,38 @@
1
+ import { css } from 'lit';
2
+
3
+ const styles = css `
4
+ :host {
5
+ --_exm-circular-progress-track-color: var(
6
+ --exm-circular-progress-track-color,
7
+ var(--md-sys-color-surface-container-highest, #e0e0e0)
8
+ );
9
+ --_exm-circular-progress-progress-color: var(
10
+ --exm-circular-progress-progress-color,
11
+ var(--md-sys-color-primary, #6200ee)
12
+ );
13
+
14
+ display: inline-block;
15
+ }
16
+
17
+ circle {
18
+ transition: stroke-dashoffset 0.35s ease;
19
+ fill: none;
20
+ }
21
+
22
+ .base-circle {
23
+ stroke-dashoffset: calc(
24
+ var(--exm-progress-progress) * var(--exm-progress-dash-length, 283) * -1 - var(--exm-progress-gap) * 2
25
+ );
26
+ stroke-dasharray: var(--exm-progress-dash-length, 283) calc(var(--exm-progress-dash-length, 283) * 2);
27
+ stroke: var(--_exm-circular-progress-track-color);
28
+ }
29
+
30
+ .progress-circle {
31
+ stroke-dashoffset: calc((1 - var(--exm-progress-progress)) * var(--exm-progress-dash-length, 283));
32
+ stroke-dasharray: var(--exm-progress-dash-length, 283) var(--exm-progress-dash-length, 283);
33
+ stroke: var(--_exm-circular-progress-progress-color);
34
+ }
35
+ `;
36
+
37
+ export { styles };
38
+ //# sourceMappingURL=exm-circular-progress-css.js.map
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,87 @@
1
+ import { css } from 'lit';
2
+
3
+ const styles = css `
4
+ :host {
5
+ --_exm-linear-progress-track-height: var(--exm-linear-progress-track-height, 12px);
6
+ --_exm-linear-progress-border-radius: var(--exm-linear-progress-border-radius, 99px);
7
+ --_exm-linear-progress-track-color: var(
8
+ --exm-linear-progress-track-color,
9
+ var(--md-sys-color-surface-container-highest, #e0e0e0)
10
+ );
11
+ --_exm-linear-progress-progress-color: var(
12
+ --exm-linear-progress-progress-color,
13
+ var(--md-sys-color-primary, #6200ee)
14
+ );
15
+
16
+ display: block;
17
+ }
18
+
19
+ .container {
20
+ background-color: transparent;
21
+ height: var(--_exm-linear-progress-track-height);
22
+ position: relative;
23
+ overflow: hidden;
24
+ }
25
+
26
+ .track {
27
+ background-color: var(--_exm-linear-progress-track-color);
28
+ background-image: radial-gradient(
29
+ circle,
30
+ var(--_exm-linear-progress-progress-color) calc(var(--_exm-linear-progress-track-height) / 2),
31
+ transparent calc(var(--_exm-linear-progress-track-height) / 2)
32
+ );
33
+ background-size: var(--_exm-linear-progress-track-height) var(--_exm-linear-progress-track-height);
34
+ background-repeat: no-repeat;
35
+ background-position: right center;
36
+ position: absolute;
37
+ top: 0;
38
+ right: 0;
39
+ width: calc(100% - var(--_exm-linear-progress-track-height) / 2);
40
+ height: 100%;
41
+ border-radius: var(--_exm-linear-progress-border-radius);
42
+ clip-path: xywh(
43
+ var(--exm-progress-progress, 0) 0 100% var(--_exm-linear-progress-track-height) round
44
+ calc(var(--_exm-linear-progress-track-height) / 2) 0% 0px calc(var(--_exm-linear-progress-track-height) / 2)
45
+ );
46
+
47
+ &.steps {
48
+ background-image: radial-gradient(
49
+ circle at calc(100% - 6px) center,
50
+ var(--_exm-linear-progress-progress-color) calc(var(--_exm-linear-progress-track-height) / 2),
51
+ transparent calc(var(--_exm-linear-progress-track-height) / 2)
52
+ );
53
+ background-size: 10% var(--_exm-linear-progress-track-height);
54
+ background-position: center-6px center;
55
+ background-repeat: repeat-x;
56
+ }
57
+ }
58
+
59
+ .progress {
60
+ position: absolute;
61
+ top: 0;
62
+ left: 0;
63
+ background-color: var(--_exm-linear-progress-progress-color);
64
+ width: calc(var(--exm-progress-progress, 0) - var(--_exm-linear-progress-track-height) / 2);
65
+ height: 100%;
66
+ border-radius: var(--_exm-linear-progress-border-radius);
67
+ }
68
+
69
+ .label {
70
+ background-color: var(--md-sys-color-inverse-surface, #333333);
71
+ display: inline-block;
72
+ color: var(--md-sys-color-inverse-on-surface, #ffffff);
73
+ font-size: 0.875rem;
74
+ line-height: 1.25rem;
75
+ padding: 0.75rem;
76
+ min-width: 2rem;
77
+ text-align: center;
78
+ border-radius: 9999px;
79
+ margin-bottom: 0.5rem;
80
+ left: var(--exm-progress-progress, 0);
81
+ position: relative;
82
+ transform: translateX(-50%);
83
+ }
84
+ `;
85
+
86
+ export { styles };
87
+ //# sourceMappingURL=exm-linear-progress-css.js.map
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@exmg/exm-progress",
3
+ "version": "1.2.7",
4
+ "description": "Material style progress bar",
5
+ "contributors": [
6
+ "Ex Machina"
7
+ ],
8
+ "keywords": [
9
+ "web-components",
10
+ "lit",
11
+ "material",
12
+ "progress"
13
+ ],
14
+ "type": "module",
15
+ "main": "dist/index.js",
16
+ "types": "dist/index.d.ts",
17
+ "module": "dist/index.js",
18
+ "exports": {
19
+ ".": "./dist/index.js",
20
+ "./exm-linear-progress.js": "./dist/exm-linear-progress.js",
21
+ "./exm-circular-progress.js": "./dist/exm-circular-progress.js"
22
+ },
23
+ "files": [
24
+ "**/*.scss",
25
+ "**/*.js",
26
+ "**/*.d.ts"
27
+ ],
28
+ "homepage": "https://bitbucket.org/exmachina/exm-web-components",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git@bitbucket.org:exmachina/exm-web-components.git",
32
+ "directory": "packages/exm-progress"
33
+ },
34
+ "license": "MIT",
35
+ "peerDependencies": {
36
+ "@material/web": "^2.2.0",
37
+ "lit": "3.2.1",
38
+ "tslib": "^2.6.2"
39
+ },
40
+ "scripts": {
41
+ "tsc": "tsc"
42
+ },
43
+ "publishConfig": {
44
+ "access": "public"
45
+ },
46
+ "gitHead": "20c45a5fb2f606723218a739897831c27a6f6790"
47
+ }