@everymatrix/general-icon-progress-ring 1.43.4 → 1.45.0
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/components/GeneralIconProgressRing-CaQzJzkv.js +572 -0
- package/components/GeneralIconProgressRing-DXjKqhRI.cjs +1 -0
- package/es2015/general-icon-progress-ring.cjs +1 -0
- package/es2015/general-icon-progress-ring.js +16 -0
- package/package.json +15 -33
- package/README.md +0 -30
- package/dist/general-icon-progress-ring.js +0 -90
- package/dist/general-icon-progress-ring.js.map +0 -1
- package/index.html +0 -53
- package/index.js +0 -1
- package/public/favicon.png +0 -0
- package/public/reset.css +0 -48
- package/rollup.config.js +0 -59
- package/src/GeneralIconProgressRing.svelte +0 -195
- package/src/index.ts +0 -4
- package/stories/GeneralIconProgressRing.stories.js +0 -13
- package/tsconfig.json +0 -6
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
<svelte:options tag={null} />
|
|
2
|
-
<script lang="ts">
|
|
3
|
-
import {onMount} from "svelte";
|
|
4
|
-
|
|
5
|
-
export let currentstep:number=0;
|
|
6
|
-
export let livecolor:string='#00AEEF'; //expired:#C4C4C4
|
|
7
|
-
export let expiredcolor = '#C4C4C4';
|
|
8
|
-
export let status:string='true';
|
|
9
|
-
|
|
10
|
-
let widthinpx:number=100;
|
|
11
|
-
let totalWidth75,halfOfProgressBarRing,totalWidth61;
|
|
12
|
-
let progressRingWidth,innerSectionWidth,innerSectionLeft;
|
|
13
|
-
let percentSectionWidth,percentSectionLeft;
|
|
14
|
-
let leftRotateSectionWidth, leftRotateSectionAfterWidth;
|
|
15
|
-
let leftRotateDeg,rightRotateDeg;
|
|
16
|
-
let progressElement, progresscolor;
|
|
17
|
-
|
|
18
|
-
const setCssVariables=(node, variables)=> {
|
|
19
|
-
for (const name in variables) {
|
|
20
|
-
node.style.setProperty(`--${name}`, variables[name]);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
const cssVariables=(node, variables)=> {
|
|
24
|
-
setCssVariables(node, variables);
|
|
25
|
-
return {
|
|
26
|
-
update(variables) {
|
|
27
|
-
setCssVariables(node, variables);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const initProgress = ()=>{
|
|
32
|
-
if(status == 'true'){
|
|
33
|
-
progresscolor = livecolor;
|
|
34
|
-
}else{
|
|
35
|
-
progresscolor = expiredcolor;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
totalWidth75 = widthinpx * 0.74;
|
|
39
|
-
halfOfProgressBarRing = (widthinpx - totalWidth75)/2;
|
|
40
|
-
totalWidth61 = widthinpx * 0.70;
|
|
41
|
-
|
|
42
|
-
progressRingWidth = `${widthinpx}px`;
|
|
43
|
-
innerSectionWidth = `${totalWidth75}px`;
|
|
44
|
-
innerSectionLeft = `${halfOfProgressBarRing}px`;
|
|
45
|
-
//percent
|
|
46
|
-
percentSectionWidth = `${totalWidth61}px`;
|
|
47
|
-
percentSectionLeft = `${(totalWidth75 - totalWidth61) /2}px`;
|
|
48
|
-
//rotate part
|
|
49
|
-
leftRotateSectionWidth = `${widthinpx/2}px`;
|
|
50
|
-
leftRotateSectionAfterWidth = `${widthinpx/2 + 1}px`;
|
|
51
|
-
|
|
52
|
-
cssVariables(progressElement, {progressRingWidth, innerSectionWidth, innerSectionLeft, progresscolor,
|
|
53
|
-
percentSectionWidth, percentSectionLeft, leftRotateSectionWidth,leftRotateSectionAfterWidth});
|
|
54
|
-
}
|
|
55
|
-
const resetProgressByValue=()=>{
|
|
56
|
-
if(!progressElement)return;
|
|
57
|
-
leftRotateDeg = '0deg';
|
|
58
|
-
rightRotateDeg = '0deg';
|
|
59
|
-
if(currentstep > 100){
|
|
60
|
-
currentstep = 100;
|
|
61
|
-
leftRotateDeg = '360deg';
|
|
62
|
-
}else{
|
|
63
|
-
if(currentstep >= 50){
|
|
64
|
-
let deg = (currentstep - 50)/50 * 180 + 180;
|
|
65
|
-
leftRotateDeg = `${deg}deg`;
|
|
66
|
-
rightRotateDeg = '0deg';
|
|
67
|
-
}else {
|
|
68
|
-
leftRotateDeg = '180deg';
|
|
69
|
-
rightRotateDeg = `${ (currentstep)/50 * 180 - 180}deg`;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
cssVariables(progressElement, {rightRotateDeg, leftRotateDeg});
|
|
73
|
-
}
|
|
74
|
-
onMount(()=>{
|
|
75
|
-
if(progressElement.offsetWidth == 0){
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
let width = progressElement.offsetWidth;
|
|
79
|
-
let height = progressElement.offsetHeight;
|
|
80
|
-
widthinpx = width > height && width*height > 0 ? height || 100 : width || 100;
|
|
81
|
-
initProgress();
|
|
82
|
-
});
|
|
83
|
-
//$:currentstep && livecolor && expiredcolor && status && initProgress();
|
|
84
|
-
$:currentstep && resetProgressByValue();
|
|
85
|
-
$:status && resetProgressByValue();
|
|
86
|
-
</script>
|
|
87
|
-
<div class="general-icon-progress-ring Progress" part="ProgressRing" bind:this={progressElement}>
|
|
88
|
-
<div class="Left" part="Progress Left"></div><div class="Right" part="Progress Right"></div>
|
|
89
|
-
<div class="InnerSection" part="Progress InnerSection"><div class="Percent" part="Progress Percent">{currentstep}%</div></div>
|
|
90
|
-
</div>
|
|
91
|
-
<style lang="scss">
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
*,
|
|
95
|
-
*::before,
|
|
96
|
-
*::after {
|
|
97
|
-
margin: 0;
|
|
98
|
-
padding: 0;
|
|
99
|
-
list-style: none;
|
|
100
|
-
text-decoration: none;
|
|
101
|
-
outline: none;
|
|
102
|
-
box-sizing: border-box;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.general-icon-progress-ring {
|
|
106
|
-
background: var(--emfe-w-color-black, #000000);
|
|
107
|
-
color: var(--emfe-w-color-white, #FFFFFF);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
.Progress {
|
|
111
|
-
margin: auto;
|
|
112
|
-
width: var(--progressRingWidth);
|
|
113
|
-
height: var(--progressRingWidth);
|
|
114
|
-
position: relative;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.Progress .InnerSection {
|
|
118
|
-
position: absolute;
|
|
119
|
-
width: var(--innerSectionWidth);
|
|
120
|
-
height: var(--innerSectionWidth);
|
|
121
|
-
background-color: white;
|
|
122
|
-
border-radius: 50%;
|
|
123
|
-
left: var(--innerSectionLeft, 1rem);
|
|
124
|
-
top: var(--innerSectionLeft, 1rem);
|
|
125
|
-
line-height: var(--innerSectionWidth);
|
|
126
|
-
text-align: center;
|
|
127
|
-
}
|
|
128
|
-
.Progress .InnerSection .Percent{
|
|
129
|
-
background-color: var(--progresscolor);
|
|
130
|
-
border-radius: 50%;
|
|
131
|
-
width: var(--percentSectionWidth);
|
|
132
|
-
height: var(--percentSectionWidth);
|
|
133
|
-
position: absolute;
|
|
134
|
-
left: var(--percentSectionLeft, 0.1rem);
|
|
135
|
-
top: var(--percentSectionLeft, 0.1rem);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.Left,
|
|
139
|
-
.Right {
|
|
140
|
-
width: var(--leftRotateSectionWidth);
|
|
141
|
-
height: var(--progressRingWidth);
|
|
142
|
-
overflow: hidden;
|
|
143
|
-
position: relative;
|
|
144
|
-
float: left;
|
|
145
|
-
background-color: #F2F4F6
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.Left {
|
|
149
|
-
border-radius: 0;
|
|
150
|
-
border-top-left-radius: var(--progressRingWidth);
|
|
151
|
-
border-bottom-left-radius: var(--progressRingWidth);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.Right {
|
|
155
|
-
border-radius: 0;
|
|
156
|
-
border-top-right-radius: var(--progressRingWidth);
|
|
157
|
-
border-bottom-right-radius: var(--progressRingWidth);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
.Left:after,.Right:after {
|
|
162
|
-
content: "";
|
|
163
|
-
position: absolute;
|
|
164
|
-
display: block;
|
|
165
|
-
width: var(--leftRotateSectionAfterWidth);
|
|
166
|
-
height: var(--progressRingWidth, 8em);
|
|
167
|
-
background-color: white;
|
|
168
|
-
border-radius: 0;
|
|
169
|
-
border-top-left-radius: var(--progressRingWidth);
|
|
170
|
-
border-bottom-left-radius: var(--progressRingWidth);
|
|
171
|
-
background-color: var(--progresscolor);
|
|
172
|
-
|
|
173
|
-
transition-property: transform;
|
|
174
|
-
transition-duration: 1.1s;
|
|
175
|
-
transition-timing-function: cubic-bezier(.43,0.8,.95,.88);
|
|
176
|
-
transition-delay: 0.5s;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.Right:after {
|
|
180
|
-
content: "";
|
|
181
|
-
position: absolute;
|
|
182
|
-
display: block;
|
|
183
|
-
border-radius: 0 ;
|
|
184
|
-
border-top-right-radius: var(--widthInPx);
|
|
185
|
-
border-bottom-right-radius: var(--widthInPx);
|
|
186
|
-
}
|
|
187
|
-
.Left:after {
|
|
188
|
-
transform-origin: right center;
|
|
189
|
-
transform: rotateZ(var(--leftRotateDeg, 180deg));
|
|
190
|
-
}
|
|
191
|
-
.Right:after {
|
|
192
|
-
transform-origin: left center;
|
|
193
|
-
transform: rotateZ(var(--rightRotateDeg, 0deg));
|
|
194
|
-
}
|
|
195
|
-
</style>
|
package/src/index.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit-element';
|
|
2
|
-
|
|
3
|
-
import GeneralIconProgressRing from '../src/GeneralIconProgressRing';
|
|
4
|
-
|
|
5
|
-
// This default export determines where your story goes in the story list
|
|
6
|
-
export default {
|
|
7
|
-
title: 'GeneralIconProgressRing',
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
// 👇 We create a “template” of how args map to rendering
|
|
11
|
-
const GeneralIconProgressRing = ({ aProperty }) => html`<general-icon-progress-ring></general-icon-progress-ring>`;
|
|
12
|
-
|
|
13
|
-
export const FirstStory = GeneralIconProgressRing.bind({});
|