adata-ui 0.1.2 → 0.1.3

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 (40) hide show
  1. package/README.md +3 -20
  2. package/dist/adata-ui.common.js +558 -72
  3. package/dist/adata-ui.common.js.map +1 -1
  4. package/dist/adata-ui.css +1 -1
  5. package/dist/adata-ui.umd.js +558 -72
  6. package/dist/adata-ui.umd.js.map +1 -1
  7. package/dist/adata-ui.umd.min.js +1 -1
  8. package/dist/adata-ui.umd.min.js.map +1 -1
  9. package/package-lock.json +8132 -241
  10. package/package.json +19 -3
  11. package/src/App.vue +1 -6
  12. package/src/components/Alert/Alert.stories.js +17 -0
  13. package/src/components/Alert/Alert.vue +61 -0
  14. package/src/components/Button/BaseButton.vue +241 -0
  15. package/src/components/Button/Button.stories.js +16 -0
  16. package/src/components/PasswordField/PasswordField.stories.js +16 -0
  17. package/src/components/PasswordField/PasswordField.vue +68 -0
  18. package/src/components/TextField/TextField.stories.js +16 -0
  19. package/src/components/TextField/TextField.vue +355 -0
  20. package/src/components/index.js +8 -4
  21. package/src/stories/Button.stories.js +46 -0
  22. package/src/stories/Button.vue +54 -0
  23. package/src/stories/Header.stories.js +21 -0
  24. package/src/stories/Header.vue +59 -0
  25. package/src/stories/Introduction.stories.mdx +211 -0
  26. package/src/stories/Page.stories.js +25 -0
  27. package/src/stories/Page.vue +88 -0
  28. package/src/stories/assets/code-brackets.svg +1 -0
  29. package/src/stories/assets/colors.svg +1 -0
  30. package/src/stories/assets/comments.svg +1 -0
  31. package/src/stories/assets/direction.svg +1 -0
  32. package/src/stories/assets/flow.svg +1 -0
  33. package/src/stories/assets/plugin.svg +1 -0
  34. package/src/stories/assets/repo.svg +1 -0
  35. package/src/stories/assets/stackalt.svg +1 -0
  36. package/src/stories/button.css +30 -0
  37. package/src/stories/header.css +26 -0
  38. package/src/stories/page.css +69 -0
  39. package/src/components/Button.vue +0 -18
  40. package/src/components/HelloWorld.vue +0 -58
package/package.json CHANGED
@@ -1,25 +1,41 @@
1
1
  {
2
2
  "name": "adata-ui",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
7
7
  "build": "vue-cli-service build",
8
8
  "build-bundle": "vue-cli-service build --target lib --name adata-ui ./src/components/index.js",
9
- "lint": "vue-cli-service lint"
9
+ "lint": "vue-cli-service lint",
10
+ "storybook": "start-storybook -p 6006",
11
+ "build-storybook": "build-storybook"
10
12
  },
11
13
  "dependencies": {
12
14
  "core-js": "^3.6.5",
15
+ "node-sass": "^5.0.0",
13
16
  "user": "0.0.0",
14
- "vue": "^2.6.11"
17
+ "vue": "^2.6.11",
18
+ "vue-the-mask": "^0.11.1"
15
19
  },
16
20
  "devDependencies": {
21
+ "@babel/core": "^7.16.7",
22
+ "@storybook/addon-actions": "^6.4.13",
23
+ "@storybook/addon-essentials": "^6.4.13",
24
+ "@storybook/addon-links": "^6.4.13",
25
+ "@storybook/preset-scss": "^1.0.3",
26
+ "@storybook/vue": "^6.4.13",
17
27
  "@vue/cli-plugin-babel": "~4.5.0",
18
28
  "@vue/cli-plugin-eslint": "~4.5.0",
19
29
  "@vue/cli-service": "~4.5.0",
20
30
  "babel-eslint": "^10.1.0",
31
+ "babel-loader": "^8.2.3",
32
+ "css-loader": "^5.2.7",
21
33
  "eslint": "^6.7.2",
22
34
  "eslint-plugin-vue": "^6.2.2",
35
+ "sass": "^1.48.0",
36
+ "sass-loader": "^10.1.1",
37
+ "style-loader": "^2.0.0",
38
+ "vue-loader": "^15.9.8",
23
39
  "vue-template-compiler": "^2.6.11"
24
40
  },
25
41
  "eslintConfig": {
package/src/App.vue CHANGED
@@ -1,18 +1,13 @@
1
1
  <template>
2
2
  <div id="app">
3
- <img alt="Vue logo" src="./assets/logo.png">
4
- <HelloWorld msg="Welcome to Your Vue.js App"/>
5
3
  </div>
6
4
  </template>
7
5
 
8
6
  <script>
9
- import HelloWorld from './components/HelloWorld.vue'
10
7
 
11
8
  export default {
12
9
  name: 'App',
13
- components: {
14
- HelloWorld
15
- }
10
+ components: {}
16
11
  }
17
12
  </script>
18
13
 
@@ -0,0 +1,17 @@
1
+ import Alert from './Alert.vue'
2
+
3
+ export default {
4
+ title: 'Alert',
5
+ component: Alert,
6
+ template: '<alert>button</alert>'
7
+ }
8
+
9
+ const Template = (args, { argTypes }) => ({
10
+ components: { Alert },
11
+ props: Object.keys(argTypes),
12
+ template: '<alert v-bind="$props">Alert</alert>'
13
+ })
14
+
15
+ export const Info = Template.bind({})
16
+ export const Error = Template.bind({})
17
+ Error.args = {error: true}
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <div :class="['note', {'note--error': error}]">
3
+ <svg class="note-svg" v-if="!error" width="14" height="14" fill="none"
4
+ xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="note-svg">
5
+ <circle cx="8" cy="8" r="6.5" stroke="#007AFF"></circle>
6
+ <path
7
+ d="M9.661 11.137l-.111.457c-.336.132-.604.233-.803.302-.2.07-.432.104-.696.104-.406 0-.722-.1-.947-.297a.961.961 0 01-.338-.755c0-.117.008-.239.025-.363.017-.123.045-.263.082-.419l.419-1.483c.037-.142.069-.277.094-.404.026-.126.038-.243.038-.348 0-.189-.039-.321-.117-.396-.078-.074-.227-.112-.448-.112-.108 0-.22.017-.333.051a4.649 4.649 0 00-.294.096l.112-.457c.275-.112.537-.207.788-.287.251-.08.489-.12.713-.12.403 0 .714.098.933.293a.97.97 0 01.327.76c0 .064-.007.177-.022.34a2.277 2.277 0 01-.084.447l-.417 1.478a3.921 3.921 0 00-.133.752c0 .196.044.33.132.401.088.071.24.107.456.107.102 0 .217-.018.345-.054.128-.035.221-.066.28-.093zm.106-6.203a.865.865 0 01-.292.658.994.994 0 01-.703.272 1 1 0 01-.706-.272.863.863 0 01-.295-.658c0-.257.098-.477.295-.66A1 1 0 018.772 4a.99.99 0 01.703.274.873.873 0 01.292.66z"
8
+ fill="#007AFF"
9
+ ></path>
10
+ </svg>
11
+ <svg class="note-svg" width="14" height="14" v-else fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="note-error-svg">
12
+ <circle cx="8" cy="8" r="6.5" stroke="#e60000"></circle>
13
+ <path
14
+ d="M9.661 11.137l-.111.457c-.336.132-.604.233-.803.302-.2.07-.432.104-.696.104-.406 0-.722-.1-.947-.297a.961.961 0 01-.338-.755c0-.117.008-.239.025-.363.017-.123.045-.263.082-.419l.419-1.483c.037-.142.069-.277.094-.404.026-.126.038-.243.038-.348 0-.189-.039-.321-.117-.396-.078-.074-.227-.112-.448-.112-.108 0-.22.017-.333.051a4.649 4.649 0 00-.294.096l.112-.457c.275-.112.537-.207.788-.287.251-.08.489-.12.713-.12.403 0 .714.098.933.293a.97.97 0 01.327.76c0 .064-.007.177-.022.34a2.277 2.277 0 01-.084.447l-.417 1.478a3.921 3.921 0 00-.133.752c0 .196.044.33.132.401.088.071.24.107.456.107.102 0 .217-.018.345-.054.128-.035.221-.066.28-.093zm.106-6.203a.865.865 0 01-.292.658.994.994 0 01-.703.272 1 1 0 01-.706-.272.863.863 0 01-.295-.658c0-.257.098-.477.295-.66A1 1 0 018.772 4a.99.99 0 01.703.274.873.873 0 01.292.66z"
15
+ fill="#e60000"></path>
16
+ </svg>
17
+ <span class="text">
18
+ <slot></slot>
19
+ </span>
20
+ </div>
21
+ </template>
22
+ <script>
23
+ export default {
24
+ props: {
25
+ error: {
26
+ type: Boolean,
27
+ default: false
28
+ }
29
+ }
30
+ };
31
+ </script>
32
+ <style lang="scss" scoped>
33
+ .note {
34
+ font-weight: 400;
35
+ font-style: italic;
36
+ font-size: 12px;
37
+ line-height: 20px;
38
+ display: flex;
39
+ align-items: center;
40
+ color: #007aff;
41
+ padding: 8px 16px;
42
+ background: #007AFF19;
43
+ border-radius: 2px;
44
+
45
+ &--error {
46
+ background: rgba(220, 88, 88, 0.2);
47
+ color: #e60000;
48
+ }
49
+
50
+ @media(max-width: 1025px) {
51
+ width: 100%;
52
+ font-weight: 400;
53
+ font-size: 10px;
54
+ line-height: 16px;
55
+ margin: 0 0 16px;
56
+ }
57
+ &-svg {
58
+ margin-right: 8px;
59
+ }
60
+ }
61
+ </style>
@@ -0,0 +1,241 @@
1
+ <template>
2
+ <component
3
+ :class="[
4
+ 'btn',
5
+ {'full-width': fullwidth},
6
+ `btn-${variant}`,
7
+ `size size-${size}`,
8
+ `size-fz-${fontSize}`,
9
+ ]"
10
+ v-bind="$attrs"
11
+ v-on="$listeners"
12
+ :is="url ? 'nuxt-link' : 'button'"
13
+ :to="url"
14
+ :event="event ? 'click' : ''"
15
+ >
16
+ <slot></slot>
17
+ </component>
18
+ </template>
19
+
20
+
21
+ <script>
22
+ export default {
23
+ name: "BaseButton",
24
+ props: {
25
+ variant: {
26
+ type: String,
27
+ default: "yellow",
28
+ validator: function (value) {
29
+ return (
30
+ [
31
+ 'white',
32
+ 'grey',
33
+ 'yellow',
34
+ 'danger',
35
+ 'success',
36
+ 'primary-outlined',
37
+ 'primary'
38
+ ].includes(value)
39
+ );
40
+ },
41
+ },
42
+ fontSize: {
43
+ type: String,
44
+ validator: function (value) {
45
+ return (
46
+ [
47
+ 'sm',
48
+ ].includes(value)
49
+ );
50
+ },
51
+ },
52
+ size: {
53
+ type: String,
54
+ default: "md",
55
+ validator: function (value) {
56
+ return (
57
+ [
58
+ 'sm',
59
+ 'md',
60
+ 'md-short',
61
+ 'lg',
62
+ ].includes(value)
63
+ );
64
+ },
65
+ },
66
+ tag: {
67
+ type: String,
68
+ default: "button",
69
+ },
70
+ url: {
71
+ type: [String, Boolean],
72
+ default: false
73
+ },
74
+ event: {
75
+ type: Boolean,
76
+ default: true
77
+ },
78
+ fullwidth: {
79
+ type: Boolean,
80
+ default: false
81
+ },
82
+ disabled: {
83
+ type: Boolean,
84
+ default: false
85
+ }
86
+ },
87
+ }
88
+ </script>
89
+
90
+ <style lang="scss" scoped>
91
+
92
+ .btn {
93
+ cursor: pointer;
94
+ border: none;
95
+
96
+ &:disabled {
97
+ cursor: not-allowed;
98
+ }
99
+
100
+ &.full-width {
101
+ width: 100%;
102
+ }
103
+
104
+ &:disabled {
105
+ cursor: not-allowed;
106
+ }
107
+
108
+ &.size {
109
+ box-sizing: border-box;
110
+
111
+ &-sm {
112
+ padding: 6px 16px;
113
+ font-size: 12px;
114
+ line-height: 18px;
115
+ }
116
+
117
+ &-md {
118
+ padding: 8px 36px;
119
+ font-size: 14px;
120
+ line-height: 24px;
121
+
122
+ &-short {
123
+ padding: 8px 16px;
124
+ font-size: 14px;
125
+ line-height: 24px;
126
+ }
127
+ }
128
+
129
+ &-lg {
130
+ padding: 8px 40px;
131
+ font-size: 14px;
132
+ line-height: 24px;
133
+ }
134
+
135
+ &-fz-sm {
136
+ font-size: 12px;
137
+ line-height: 20px;
138
+ }
139
+ }
140
+
141
+ &-grey {
142
+ color: var(--newGray);
143
+ border: 1px solid #9da3ac;
144
+ background: #fff;
145
+
146
+ &:hover {
147
+ background: #eef0f5;
148
+ }
149
+
150
+ &:active {
151
+ background: #eef0f5;
152
+ }
153
+ }
154
+
155
+ &-white {
156
+ background: #FFFFFF;
157
+ color: #007AFF;
158
+
159
+ &:hover {
160
+ background: #eef0f5;
161
+ }
162
+
163
+ &:active {
164
+ background: #d6d6d7;
165
+ }
166
+ }
167
+
168
+ &-yellow {
169
+ background: #FFCD33;
170
+ color: #333333;
171
+
172
+ &:hover {
173
+ background: rgba(255, 205, 51, 0.7);
174
+ }
175
+
176
+ &:active {
177
+ background: #fab619;
178
+ }
179
+ }
180
+
181
+ &-danger {
182
+ border: 1px solid #FF2E43;
183
+ color: #FF2E43;
184
+
185
+ &:hover {
186
+ background: #FF2E43;
187
+ color: #fff;
188
+ }
189
+
190
+ &:active {
191
+ background: #FF2E43;
192
+ color: #fff;
193
+ }
194
+ }
195
+
196
+ &-success {
197
+ background: #00B92D;
198
+ color: #fff;
199
+
200
+ &:hover {
201
+ background: #008621;
202
+ }
203
+
204
+ &:active {
205
+ background: #008621;
206
+ }
207
+ }
208
+
209
+ &-primary-outlined {
210
+ border: 1px solid #007AFF;
211
+ color: #007AFF;
212
+
213
+ &:hover {
214
+ background: #007AFF;
215
+ color: #fff;
216
+ }
217
+
218
+ &:active {
219
+ background: #0055BB;
220
+ color: #fff;
221
+ }
222
+ }
223
+
224
+ &-primary {
225
+ background: #1E88E5;
226
+ color: #FFF;
227
+
228
+ &:hover {
229
+ background: #007AFF;
230
+ color: #fff;
231
+ }
232
+
233
+ &:active {
234
+ background: #0055BB;
235
+ color: #fff;
236
+ }
237
+ }
238
+
239
+ box-sizing: border-box;
240
+ }
241
+ </style>
@@ -0,0 +1,16 @@
1
+ import BaseButton from './BaseButton.vue'
2
+
3
+ export default {
4
+ title: 'BaseButton',
5
+ component: BaseButton,
6
+ template: '<base-button>button</base-button>'
7
+ }
8
+
9
+ const Template = (args, { argTypes }) => ({
10
+ components: { BaseButton },
11
+ props: Object.keys(argTypes),
12
+ template: '<base-button v-bind="$props">button</base-button>'
13
+ })
14
+
15
+ export const Simple = Template.bind({})
16
+ Simple.args = { size: 'lg' }
@@ -0,0 +1,16 @@
1
+ import PasswordField from "./PasswordField.vue";
2
+
3
+ export default {
4
+ title: 'PasswordField',
5
+ component: PasswordField,
6
+ template: "<text-field label='Example'></text-field>>"
7
+ }
8
+
9
+ const Template = (args, { argTypes }) => ({
10
+ components: { PasswordField },
11
+ props: Object.keys(argTypes),
12
+ template: '<password-field v-bind="$props"></password-field>'
13
+ })
14
+
15
+ export const BasePasswordField = Template.bind({});
16
+ BasePasswordField.args = {label: 'Password'}
@@ -0,0 +1,68 @@
1
+ <template>
2
+ <div class="adt-text-block">
3
+ <div class="adt-text-block__field">
4
+ <input
5
+ ref="input"
6
+ :type="type"
7
+ :value="value"
8
+ required
9
+ @input="$emit('input', $event.target.value)"
10
+ class="adt-text-block__input"
11
+ :class="{ error: !!errorText }"
12
+ />
13
+ <label class="adt-text-block__label">{{ label }}</label>
14
+ <div v-if="showPassword" @click="showPassword = false" class="adt-text-block__icon desktop">
15
+ <svg width="12" height="12" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 511.992 511.992" id="openedEye">
16
+ <path
17
+ d="M510.096 249.937c-4.032-5.867-100.928-143.275-254.101-143.275-131.435 0-248.555 136.619-253.483 142.443-3.349 3.968-3.349 9.792 0 13.781C7.44 268.71 124.56 405.329 255.995 405.329S504.549 268.71 509.477 262.886c3.094-3.669 3.371-8.981.619-12.949zM255.995 383.996c-105.365 0-205.547-100.48-230.997-128 25.408-27.541 125.483-128 230.997-128 123.285 0 210.304 100.331 231.552 127.424-24.534 26.645-125.291 128.576-231.552 128.576z"></path>
18
+ <path
19
+ d="M255.995 170.662c-47.061 0-85.333 38.272-85.333 85.333s38.272 85.333 85.333 85.333 85.333-38.272 85.333-85.333-38.272-85.333-85.333-85.333zm0 149.334c-35.285 0-64-28.715-64-64s28.715-64 64-64 64 28.715 64 64-28.715 64-64 64z"></path>
20
+ </svg>
21
+ </div>
22
+ <div v-else @click="showPassword = true" class="adt-text-block__icon desktop">
23
+ <svg width="12" height="12" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512.001 512.001" id="closedEye">
24
+ <path
25
+ d="M316.332 195.662c-4.16-4.16-10.923-4.16-15.083 0s-4.16 10.944 0 15.083c12.075 12.075 18.752 28.139 18.752 45.248 0 35.285-28.715 64-64 64-17.109 0-33.173-6.656-45.248-18.752-4.16-4.16-10.923-4.16-15.083 0-4.16 4.139-4.16 10.923 0 15.083 16.085 16.128 37.525 25.003 60.331 25.003 47.061 0 85.333-38.272 85.333-85.333 0-22.807-8.874-44.247-25.002-60.332zm-45.462-23.531c-4.843-.853-9.792-1.472-14.869-1.472-47.061 0-85.333 38.272-85.333 85.333 0 5.077.619 10.027 1.493 14.869.917 5.163 5.419 8.811 10.475 8.811.619 0 1.237-.043 1.877-.171 5.781-1.024 9.664-6.571 8.64-12.352-.661-3.627-1.152-7.317-1.152-11.157 0-35.285 28.715-64 64-64 3.84 0 7.531.491 11.157 1.131 5.675 1.152 11.328-2.859 12.352-8.64 1.024-5.781-2.858-11.328-8.64-12.352z"></path>
26
+ <path
27
+ d="M509.462 249.102c-2.411-2.859-60.117-70.208-139.712-111.445-5.163-2.709-11.669-.661-14.379 4.587-2.709 5.227-.661 11.669 4.587 14.379 61.312 31.744 110.293 81.28 127.04 99.371-25.429 27.541-125.504 128-230.997 128-35.797 0-71.872-8.64-107.264-25.707-5.248-2.581-11.669-.341-14.229 4.971-2.581 5.291-.341 11.669 4.971 14.229 38.293 18.496 77.504 27.84 116.523 27.84 131.435 0 248.555-136.619 253.483-142.443 3.369-3.969 3.348-9.793-.023-13.782zM325.996 118.947c-24.277-8.171-47.829-12.288-69.995-12.288-131.435 0-248.555 136.619-253.483 142.443-3.115 3.669-3.371 9.003-.597 12.992 1.472 2.112 36.736 52.181 97.856 92.779a10.48 10.48 0 005.888 1.792c3.435 0 6.827-1.664 8.875-4.8 3.264-4.885 1.92-11.52-2.987-14.763-44.885-29.845-75.605-65.877-87.104-80.533 24.555-26.667 125.291-128.576 231.552-128.576 19.861 0 41.131 3.755 63.189 11.157 5.589 2.005 11.648-1.088 13.504-6.699 1.878-5.589-1.109-11.626-6.698-13.504z"></path>
28
+ <path
29
+ d="M444.865 67.128c-4.16-4.16-10.923-4.16-15.083 0L67.116 429.795c-4.16 4.16-4.16 10.923 0 15.083a10.716 10.716 0 007.552 3.115c2.731 0 5.461-1.045 7.531-3.115L444.865 82.211c4.16-4.16 4.16-10.923 0-15.083z"></path>
30
+ </svg>
31
+ </div>
32
+ </div>
33
+ <div class="adt-text-block__error" v-if="!!errorText">
34
+ {{ errorText }}
35
+ </div>
36
+ </div>
37
+ </template>
38
+
39
+ <script>
40
+ export default {
41
+ name: "PasswordField",
42
+ props: {
43
+ errorText: {
44
+ type: String,
45
+ default: ""
46
+ },
47
+ label: {
48
+ type: String,
49
+ required: true,
50
+ },
51
+ value: {
52
+ type: [String, null],
53
+ required: true,
54
+ }
55
+ },
56
+ data() {
57
+ return {
58
+ showPassword: false
59
+ }
60
+ },
61
+ computed: {
62
+ type() {
63
+ return this.showPassword ? "text" : "password";
64
+ }
65
+ }
66
+ }
67
+ </script>
68
+
@@ -0,0 +1,16 @@
1
+ import TextField from "./TextField.vue";
2
+
3
+ export default {
4
+ title: 'TextField',
5
+ component: TextField,
6
+ template: "<text-field label='Example'></text-field>>"
7
+ }
8
+
9
+ const Template = (args, { argTypes }) => ({
10
+ components: { TextField },
11
+ props: Object.keys(argTypes),
12
+ template: '<text-field v-bind="$props"></text-field>'
13
+ })
14
+
15
+ export const Clearable = Template.bind({});
16
+ Clearable.args = {label: 'Clearable', clearable: true}