@weni/unnnic-system 1.2.0 → 1.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "main": "./dist/unnnic.common.js",
5
5
  "files": [
6
6
  "dist/*",
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <div :class="['unnnic-card-number', { 'v-full': fullSize }]">
3
+ <h4>{{ description }}</h4>
4
+ <span>{{ number }}</span>
5
+ </div>
6
+ </template>
7
+
8
+ <script>
9
+ export default {
10
+ props: {
11
+ description: {
12
+ type: String,
13
+ default: '',
14
+ },
15
+
16
+ number: {
17
+ type: String,
18
+ default: '',
19
+ },
20
+
21
+ fullSize: {
22
+ type: Boolean,
23
+ default: false,
24
+ },
25
+ },
26
+ };
27
+ </script>
28
+
29
+ <style lang="scss" scoped>
30
+ @import "../../assets/scss/unnnic.scss";
31
+
32
+ .unnnic-card-number {
33
+ background-color: $unnnic-color-background-carpet;
34
+ border-radius: $unnnic-border-radius-md;
35
+ padding: $unnnic-inset-sm;
36
+ font-family: $unnnic-font-family-secondary;
37
+
38
+ width: 100%;
39
+ max-width: 179px;
40
+
41
+ &.v-full {
42
+ max-width: unset;
43
+ }
44
+
45
+ h4 {
46
+ margin: 0 0 $unnnic-spacing-stack-xs 0;
47
+ font-weight: $unnnic-font-weight-regular;
48
+ font-size: $unnnic-font-size-body-gt;
49
+ line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
50
+
51
+ color: $unnnic-color-neutral-cloudy;
52
+ }
53
+
54
+ span {
55
+ font-weight: $unnnic-font-weight-black;
56
+ font-size: $unnnic-font-size-title-lg;
57
+ color: $unnnic-color-neutral-black;
58
+ line-height: $unnnic-font-size-title-lg + $unnnic-line-height-md;
59
+ }
60
+ }
61
+ </style>
@@ -129,7 +129,7 @@ export default {
129
129
  align-items: center;
130
130
 
131
131
  .action {
132
- margin: $unnnic-spacing-inset-xs;
132
+ margin: $unnnic-spacing-inset-nano;
133
133
  }
134
134
  }
135
135
  }
@@ -0,0 +1,160 @@
1
+ <template>
2
+ <div class="unnnic-chart-rainbow">
3
+ <svg width="332" height="166" class="semicircle">
4
+ <defs xmlns="http://www.w3.org/2000/svg">
5
+ <linearGradient
6
+ id="paint0_linear_10224_36584"
7
+ x1="178"
8
+ y1="45"
9
+ x2="28"
10
+ y2="198"
11
+ gradientUnits="userSpaceOnUse"
12
+ >
13
+ <stop stop-color="#00DED2"/>
14
+ <stop offset="1" stop-color="#00DED2" stop-opacity="0"/>
15
+ </linearGradient>
16
+ </defs>
17
+
18
+ <path
19
+ id="path"
20
+ fill="none"
21
+ stroke-linecap="round"
22
+ ref="background"
23
+ class="background"
24
+ stroke-width="26.56px"
25
+ >
26
+ </path>
27
+
28
+ <path
29
+ id="path"
30
+ fill="none"
31
+ stroke-linecap="round"
32
+ ref="front"
33
+ class="front"
34
+ stroke-width="26.56px"
35
+ >
36
+ </path>
37
+ </svg>
38
+
39
+ <div class="content">
40
+ <div class="percentage">
41
+ <span class="number">{{ value }}</span><span class="symbol">%</span>
42
+ </div>
43
+
44
+ <div v-if="description" class="description">{{ description }}</div>
45
+ </div>
46
+ </div>
47
+ </template>
48
+
49
+ <script>
50
+ export default {
51
+ components: {},
52
+
53
+ props: {
54
+ value: {
55
+ type: Number,
56
+ default: 0,
57
+ },
58
+
59
+ description: {
60
+ type: String,
61
+ },
62
+ },
63
+
64
+ mounted() {
65
+ function polarToCartesian(centerX, centerY, radius, angleInDegrees) {
66
+ const angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0;
67
+
68
+ return {
69
+ x: centerX + radius * Math.cos(angleInRadians),
70
+ y: centerY + radius * Math.sin(angleInRadians),
71
+ };
72
+ }
73
+
74
+ function describeArc(x, y, innerRadius, outerRadius, startAngle, endAngle) {
75
+ const radius = innerRadius;
76
+ const spread = outerRadius - innerRadius;
77
+ const outerStart = polarToCartesian(x, y, radius + spread, endAngle);
78
+ const outerEnd = polarToCartesian(x, y, radius + spread, startAngle);
79
+
80
+ const largeArcFlag = endAngle - startAngle <= 180 ? '0' : '1';
81
+
82
+ const d = [
83
+ 'M',
84
+ outerStart.x,
85
+ outerStart.y,
86
+ 'A',
87
+ radius + spread,
88
+ radius + spread,
89
+ 0,
90
+ largeArcFlag,
91
+ 0,
92
+ outerEnd.x,
93
+ outerEnd.y,
94
+ ].join(' ');
95
+
96
+ return d;
97
+ }
98
+
99
+ const path = describeArc(166, 166, 139.44, 152.72, -85, 85);
100
+
101
+ this.$refs.background.setAttribute('d', path);
102
+
103
+ this.$refs.front.setAttribute('d', describeArc(166, 166, 139.44, 152.72, -85, -85 + ((this.value / 100) * 170)));
104
+ },
105
+ };
106
+ </script>
107
+
108
+ <style lang="scss" scoped>
109
+ @import "../../assets/scss/unnnic.scss";
110
+
111
+ .unnnic-chart-rainbow {
112
+ position: relative;
113
+ width: fit-content;
114
+
115
+ .semicircle {
116
+ display: block;
117
+ }
118
+
119
+ .background {
120
+ stroke: $unnnic-color-background-sky;
121
+ }
122
+
123
+ .front {
124
+ stroke: url(#paint0_linear_10224_36584);
125
+ }
126
+
127
+ .content {
128
+ position: absolute;
129
+ bottom: 0;
130
+ text-align: center;
131
+ width: 100%;
132
+
133
+ .percentage {
134
+ font-family: $unnnic-font-family-secondary;
135
+ font-weight: $unnnic-font-weight-black;
136
+
137
+ .number {
138
+ color: $unnnic-color-neutral-black;
139
+ font-size: $unnnic-font-size-h3;
140
+ line-height: $unnnic-font-size-h3 + $unnnic-line-height-md;
141
+ }
142
+
143
+ .symbol {
144
+ color: $unnnic-color-neutral-soft;
145
+ font-size: $unnnic-font-size-h4;
146
+ line-height: $unnnic-font-size-h4 + $unnnic-line-height-md;
147
+ }
148
+ }
149
+
150
+ .description {
151
+ color: $unnnic-color-neutral-cleanest;
152
+ font-family: $unnnic-font-family-secondary;
153
+ font-size: $unnnic-font-size-body-lg;
154
+ line-height: $unnnic-font-size-body-lg + $unnnic-line-height-md;
155
+ font-weight: $unnnic-font-weight-regular;
156
+ margin-top: $unnnic-spacing-stack-nano;
157
+ }
158
+ }
159
+ }
160
+ </style>
@@ -49,6 +49,8 @@ import ImportCard from './ImportCard/ImportCard.vue';
49
49
  import DateFilter from './DateFilter/DateFilter.vue';
50
50
  import ChatText from './ChatText/ChatText.vue';
51
51
  import TextArea from './TextArea/TextArea.vue';
52
+ import CardNumber from './CardNumber/CardNumber.vue';
53
+ import chartRainbow from './ChartRainbow/ChartRainbow.vue';
52
54
 
53
55
  const components = {
54
56
  unnnicInput: input,
@@ -100,6 +102,8 @@ const components = {
100
102
  unnnicDateFilter: DateFilter,
101
103
  unnnicChatText: ChatText,
102
104
  unnnicTextArea: TextArea,
105
+ unnnicCardNumber: CardNumber,
106
+ unnnicChartRainbow: chartRainbow,
103
107
  };
104
108
 
105
109
  Object.keys(components).forEach((name) => {
@@ -157,3 +161,5 @@ export const unnnicImportCard = ImportCard;
157
161
  export const unnnicDateFilter = DateFilter;
158
162
  export const unnnicChatText = ChatText;
159
163
  export const unnnicTextArea = TextArea;
164
+ export const unnnicCardNumber = CardNumber;
165
+ export const unnnicChartRainbow = chartRainbow;
@@ -0,0 +1,35 @@
1
+ import unnnicCardNumber from '../components/CardNumber/CardNumber.vue';
2
+
3
+ export default {
4
+ title: 'example/CardNumber',
5
+ component: unnnicCardNumber,
6
+ argTypes: {},
7
+ };
8
+
9
+ const Template = (args, { argTypes }) => ({
10
+ props: Object.keys(argTypes),
11
+
12
+ components: {
13
+ unnnicCardNumber,
14
+ },
15
+
16
+ data() {
17
+ return {};
18
+ },
19
+
20
+ template: `
21
+ <div>
22
+ <unnnic-card-number v-bind="$props">
23
+ </unnnic-card-number>
24
+ </div>
25
+ `,
26
+
27
+ methods: {},
28
+ });
29
+
30
+ export const Default = Template.bind({});
31
+
32
+ Default.args = {
33
+ description: 'Description',
34
+ number: '00',
35
+ };
@@ -0,0 +1,34 @@
1
+ import unnnicChartRainbow from '../components/ChartRainbow/ChartRainbow.vue';
2
+
3
+ export default {
4
+ title: 'example/ChartRainbow',
5
+ component: unnnicChartRainbow,
6
+ argTypes: {},
7
+ };
8
+
9
+ const Template = (args, { argTypes }) => ({
10
+ props: Object.keys(argTypes),
11
+
12
+ components: {
13
+ unnnicChartRainbow,
14
+ },
15
+
16
+ data() {
17
+ return {};
18
+ },
19
+
20
+ template: `
21
+ <div>
22
+ <unnnic-chart-rainbow v-bind="$props" />
23
+ </div>
24
+ `,
25
+
26
+ methods: {},
27
+ });
28
+
29
+ export const Default = Template.bind({});
30
+
31
+ Default.args = {
32
+ value: 50,
33
+ description: 'Description',
34
+ };