goodteditor-ui 1.0.11 → 1.0.12

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 (75) hide show
  1. package/.eslintrc.js +7 -7
  2. package/.idea/codeStyles/Project.xml +51 -0
  3. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  4. package/.idea/goodt-ui.iml +12 -0
  5. package/.idea/inspectionProfiles/Project_Default.xml +6 -0
  6. package/.idea/modules.xml +8 -0
  7. package/.idea/vcs.xml +6 -0
  8. package/.prettierrc +14 -14
  9. package/README.md +35 -35
  10. package/babel.config.js +5 -5
  11. package/index.js +51 -49
  12. package/jsconfig.json +13 -13
  13. package/package.json +57 -57
  14. package/src/App.vue +36 -36
  15. package/src/components/ui/Avatar.md +68 -0
  16. package/src/components/ui/Avatar.vue +177 -0
  17. package/src/components/ui/Badge.md +20 -20
  18. package/src/components/ui/Badge.vue +75 -75
  19. package/src/components/ui/Collapse.md +90 -90
  20. package/src/components/ui/Collapse.vue +86 -86
  21. package/src/components/ui/ColorPicker/Alpha.vue +114 -114
  22. package/src/components/ui/ColorPicker/Colors.vue +117 -117
  23. package/src/components/ui/ColorPicker/Hue.vue +113 -113
  24. package/src/components/ui/ColorPicker/Preview.vue +55 -55
  25. package/src/components/ui/ColorPicker/Saturation.vue +123 -123
  26. package/src/components/ui/ColorPicker/mixin.js +105 -105
  27. package/src/components/ui/ColorPicker.md +17 -17
  28. package/src/components/ui/ColorPicker.vue +314 -314
  29. package/src/components/ui/Datalist.md +41 -41
  30. package/src/components/ui/Datalist.vue +157 -157
  31. package/src/components/ui/DatePicker.md +168 -168
  32. package/src/components/ui/DatePicker.vue +527 -527
  33. package/src/components/ui/FileSelector.md +105 -105
  34. package/src/components/ui/FileSelector.vue +82 -82
  35. package/src/components/ui/Grid.md +130 -130
  36. package/src/components/ui/Grid.vue +92 -92
  37. package/src/components/ui/Image.md +59 -59
  38. package/src/components/ui/Image.vue +57 -57
  39. package/src/components/ui/InputAutocomplete.md +115 -115
  40. package/src/components/ui/InputAutocomplete.vue +341 -341
  41. package/src/components/ui/InputColorPicker.md +51 -51
  42. package/src/components/ui/InputColorPicker.vue +151 -151
  43. package/src/components/ui/InputDatePicker.md +121 -121
  44. package/src/components/ui/InputDatePicker.vue +310 -310
  45. package/src/components/ui/InputTags.md +51 -51
  46. package/src/components/ui/InputTags.vue +184 -184
  47. package/src/components/ui/InputTimePicker.md +25 -25
  48. package/src/components/ui/InputTimePicker.vue +253 -253
  49. package/src/components/ui/InputUnits.md +20 -20
  50. package/src/components/ui/InputUnits.vue +257 -257
  51. package/src/components/ui/Lazy.md +37 -37
  52. package/src/components/ui/Lazy.vue +92 -92
  53. package/src/components/ui/Pagination.md +74 -74
  54. package/src/components/ui/Pagination.vue +138 -138
  55. package/src/components/ui/Paginator.md +34 -34
  56. package/src/components/ui/Paginator.vue +83 -83
  57. package/src/components/ui/Popover.md +34 -34
  58. package/src/components/ui/Popover.vue +209 -209
  59. package/src/components/ui/Popup.md +59 -59
  60. package/src/components/ui/Popup.vue +150 -150
  61. package/src/components/ui/ResponsiveContainer.md +58 -58
  62. package/src/components/ui/ResponsiveContainer.vue +99 -99
  63. package/src/components/ui/Select.md +187 -187
  64. package/src/components/ui/Select.vue +420 -420
  65. package/src/components/ui/TimePicker.md +50 -50
  66. package/src/components/ui/TimePicker.vue +252 -252
  67. package/src/components/ui/Tooltip.md +52 -52
  68. package/src/components/ui/Tooltip.vue +113 -113
  69. package/src/components/ui/utils/FormComponent.js +107 -107
  70. package/src/components/ui/utils/Helpers.js +61 -61
  71. package/src/components/ui/utils/WithPopover.js +81 -81
  72. package/src/main.js +8 -8
  73. package/styleguide.config.js +37 -37
  74. package/vue.config.js +8 -8
  75. package/dist/js.png +0 -0
@@ -0,0 +1,177 @@
1
+ <template>
2
+ <div class="ui-avatar" :style="cssStyle">
3
+ <img
4
+ class="ui-avatar__img"
5
+ :src="src"
6
+ :alt="isDoneState ? alt : ''"
7
+ @error="onImageError"
8
+ @load="onImageLoad"
9
+ v-if="isLoadingState || isDoneState"
10
+ />
11
+ <div class="ui-avatar__alt" v-if="isErrorState">
12
+ <!--
13
+ @slot Alternative content slot (displayed if no image provided)
14
+ @binding {string} alt alternative text
15
+ @binding {string} abbr alternative text abbr
16
+ -->
17
+ <slot v-bind="{ alt, abbr }">
18
+ <b class="ui-avatar__abbr">{{ abbr }}</b>
19
+ </slot>
20
+ </div>
21
+ <div class="ui-avatar__loading" v-else-if="isLoadingState">
22
+ <!--
23
+ @slot Loading content slot
24
+ -->
25
+ <slot name="loading">
26
+ <div class="preloader color-inherit"></div>
27
+ </slot>
28
+ </div>
29
+ </div>
30
+ </template>
31
+ <style lang="less" scoped>
32
+ .ui-avatar {
33
+ --size: 2rem;
34
+ --alt-scale: 0.4;
35
+ position: relative;
36
+ width: var(--size);
37
+ height: var(--size);
38
+ display: inline-flex;
39
+ align-items: center;
40
+ justify-content: center;
41
+ overflow: hidden;
42
+ &__abbr {
43
+ font-size: calc(var(--size) * var(--alt-scale));
44
+ line-height: 1;
45
+ }
46
+ &__img {
47
+ width: 100%;
48
+ height: 100%;
49
+ object-fit: cover;
50
+ }
51
+ &__alt,
52
+ &__loading {
53
+ position: absolute;
54
+ }
55
+ }
56
+ </style>
57
+ <script>
58
+ const State = {
59
+ LOADING: 'loading',
60
+ ERROR: 'error',
61
+ DONE: 'done',
62
+ };
63
+ export default {
64
+ props: {
65
+ /**
66
+ * Avatar src url
67
+ */
68
+ src: {
69
+ type: String,
70
+ default: '',
71
+ },
72
+ /**
73
+ * Alternative text
74
+ */
75
+ alt: {
76
+ type: String,
77
+ default: '',
78
+ },
79
+ /**
80
+ * Color (any web color format)
81
+ */
82
+ color: {
83
+ type: String,
84
+ default: '#fff',
85
+ },
86
+ /**
87
+ * Background color (any web color format)
88
+ */
89
+ background: {
90
+ type: String,
91
+ default: '#999',
92
+ },
93
+ /**
94
+ * Whether the avatar should be around
95
+ */
96
+ round: {
97
+ type: Boolean,
98
+ default: true,
99
+ },
100
+ /**
101
+ * Defines avatar's size (any web size)
102
+ */
103
+ size: {
104
+ type: String,
105
+ default: '2rem',
106
+ },
107
+ },
108
+ data: () => ({ state: State.LOADING }),
109
+ computed: {
110
+ /**
111
+ * @return {boolean}
112
+ */
113
+ isLoadingState() {
114
+ return this.state === State.LOADING;
115
+ },
116
+ /**
117
+ * @return {boolean}
118
+ */
119
+ isErrorState() {
120
+ return this.state === State.ERROR;
121
+ },
122
+ /**
123
+ * @return {boolean}
124
+ */
125
+ isDoneState() {
126
+ return this.state === State.DONE;
127
+ },
128
+ /**
129
+ * @return {object}
130
+ */
131
+ cssClass() {
132
+ return { 'ui-avatar--round': this.round };
133
+ },
134
+ /**
135
+ * @return {object}
136
+ */
137
+ cssStyle() {
138
+ const { size, color, round, background } = this;
139
+ const borderRadius = round ? '50%' : 0;
140
+ return { '--size': size, height: size, color, background, borderRadius };
141
+ },
142
+ /**
143
+ * @return {string}
144
+ */
145
+ abbr() {
146
+ const str = this.alt ?? '';
147
+ return str
148
+ .split(' ')
149
+ .map(s => (s.length ? s[0].toUpperCase() : ''))
150
+ .join('');
151
+ },
152
+ },
153
+ watch: {
154
+ src() {
155
+ this.state = State.LOADING;
156
+ },
157
+ },
158
+ methods: {
159
+ onImageError(event) {
160
+ this.state = State.ERROR;
161
+ /**
162
+ * Error event
163
+ * @property {Event} event
164
+ */
165
+ this.$emit('error', event);
166
+ },
167
+ onImageLoad(event) {
168
+ this.state = State.DONE;
169
+ /**
170
+ * Load event
171
+ * @property {Event} event
172
+ */
173
+ this.$emit('load', event);
174
+ },
175
+ },
176
+ };
177
+ </script>
@@ -1,20 +1,20 @@
1
- ```vue
2
- <template>
3
- <div class="pad-l5">
4
- <ui-badge>badge</ui-badge>
5
- <ui-badge theme="success" removable @remove="onRemove">badge</ui-badge>
6
- </div>
7
- </template>
8
- <script>
9
- import UiBadge from './Badge.vue';
10
-
11
- export default {
12
- components: { UiBadge },
13
- methods: {
14
- onRemove() {
15
- alert('remove badge');
16
- },
17
- },
18
- };
19
- </script>
20
- ```
1
+ ```vue
2
+ <template>
3
+ <div class="pad-l5">
4
+ <ui-badge>badge</ui-badge>
5
+ <ui-badge theme="success" removable @remove="onRemove">badge</ui-badge>
6
+ </div>
7
+ </template>
8
+ <script>
9
+ import UiBadge from './Badge.vue';
10
+
11
+ export default {
12
+ components: { UiBadge },
13
+ methods: {
14
+ onRemove() {
15
+ alert('remove badge');
16
+ },
17
+ },
18
+ };
19
+ </script>
20
+ ```
@@ -1,75 +1,75 @@
1
- <template>
2
- <div class="ui-badge badge" :class="cssClass">
3
- <!-- @slot Content slot -->
4
- <slot></slot>
5
- <!--
6
- @slot Custom 'remove' content (icon, button etc)
7
- @binding {function} remove remove function
8
- -->
9
- <slot name="remove" v-if="removable" :remove="onRemove">
10
- <i class="mdi mdi-close text-small mar-left-2 cursor-pointer" @click="onRemove"></i>
11
- </slot>
12
- </div>
13
- </template>
14
- <style lang="less" scoped>
15
- .ui-badge {
16
- white-space: normal;
17
- overflow-wrap: break-word;
18
- word-break: break-word;
19
- }
20
- </style>
21
- <script>
22
- export default {
23
- props: {
24
- /**
25
- * Size of the badge
26
- * @values '', xsmall, small, large
27
- */
28
- size: {
29
- type: String,
30
- default: '',
31
- validator(val) {
32
- return ['', 'xsmall', 'small', 'large'].indexOf(val) >= 0;
33
- },
34
- },
35
- /**
36
- * Theme of the badge
37
- * @values '', primary, success, warn, error, misc
38
- */
39
- theme: {
40
- type: String,
41
- default: '',
42
- validator(val) {
43
- return ['', 'primary', 'success', 'warn', 'error', 'misc'].indexOf(val) >= 0;
44
- },
45
- },
46
- /**
47
- * Whether the badge has a remove <slot>
48
- */
49
- removable: {
50
- type: Boolean,
51
- default: false,
52
- },
53
- },
54
- computed: {
55
- cssClass() {
56
- let o = {};
57
- if (this.size) {
58
- o[`text-${this.size}`] = true;
59
- }
60
- if (this.theme) {
61
- o[`badge-${this.theme}`] = true;
62
- }
63
- return o;
64
- },
65
- },
66
- methods: {
67
- onRemove() {
68
- /**
69
- * Remove event, emitted when close method is invoked
70
- */
71
- this.$emit('remove');
72
- },
73
- },
74
- };
75
- </script>
1
+ <template>
2
+ <div class="ui-badge badge" :class="cssClass">
3
+ <!-- @slot Content slot -->
4
+ <slot></slot>
5
+ <!--
6
+ @slot Custom 'remove' content (icon, button etc)
7
+ @binding {function} remove remove function
8
+ -->
9
+ <slot name="remove" v-if="removable" :remove="onRemove">
10
+ <i class="mdi mdi-close text-small mar-left-2 cursor-pointer" @click="onRemove"></i>
11
+ </slot>
12
+ </div>
13
+ </template>
14
+ <style lang="less" scoped>
15
+ .ui-badge {
16
+ white-space: normal;
17
+ overflow-wrap: break-word;
18
+ word-break: break-word;
19
+ }
20
+ </style>
21
+ <script>
22
+ export default {
23
+ props: {
24
+ /**
25
+ * Size of the badge
26
+ * @values '', xsmall, small, large
27
+ */
28
+ size: {
29
+ type: String,
30
+ default: '',
31
+ validator(val) {
32
+ return ['', 'xsmall', 'small', 'large'].indexOf(val) >= 0;
33
+ },
34
+ },
35
+ /**
36
+ * Theme of the badge
37
+ * @values '', primary, success, warn, error, misc
38
+ */
39
+ theme: {
40
+ type: String,
41
+ default: '',
42
+ validator(val) {
43
+ return ['', 'primary', 'success', 'warn', 'error', 'misc'].indexOf(val) >= 0;
44
+ },
45
+ },
46
+ /**
47
+ * Whether the badge has a remove <slot>
48
+ */
49
+ removable: {
50
+ type: Boolean,
51
+ default: false,
52
+ },
53
+ },
54
+ computed: {
55
+ cssClass() {
56
+ let o = {};
57
+ if (this.size) {
58
+ o[`text-${this.size}`] = true;
59
+ }
60
+ if (this.theme) {
61
+ o[`badge-${this.theme}`] = true;
62
+ }
63
+ return o;
64
+ },
65
+ },
66
+ methods: {
67
+ onRemove() {
68
+ /**
69
+ * Remove event, emitted when close method is invoked
70
+ */
71
+ this.$emit('remove');
72
+ },
73
+ },
74
+ };
75
+ </script>
@@ -1,90 +1,90 @@
1
- Example using <mark>header</mark> <mark>icon-\*</mark> slots
2
-
3
- ```vue
4
- <template>
5
- <div class="pad-l5">
6
- <ui-collapse v-bind="props">
7
- <template #header="{ toggle }">
8
- <h3 class="last cursor-pointer" @click="toggle">My header</h3>
9
- </template>
10
- <div>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos, natus.</div>
11
- </ui-collapse>
12
- </div>
13
- </template>
14
- <script>
15
- import UiCollapse from './Collapse.vue';
16
-
17
- export default {
18
- components: { UiCollapse },
19
- data() {
20
- return {
21
- props: {
22
- visible: true,
23
- icon: true,
24
- },
25
- };
26
- },
27
- };
28
- </script>
29
- ```
30
-
31
- Example using <mark>heading</mark> slot
32
-
33
- ```vue
34
- <template>
35
- <div class="pad-l5">
36
- <ui-collapse class="ui-collapse-custom" v-bind="props">
37
- <template #heading="{ isOpen, toggle }">
38
- <div
39
- class="ui-collapse-custom-heading pad-v-3 pad-h-5 cursor-pointer u-select-none pos-rel"
40
- :class="{ 'color-primary': isOpen, 'bg-primary-focus': isOpen }"
41
- @click="toggle"
42
- >
43
- <div class="row row-collapse">
44
- <div class="col col-vmid">My header</div>
45
- <div class="col col-auto col-vmid">
46
- <div class="icon w-auto pull-left">
47
- <i
48
- class="mdi mdi-chevron-right"
49
- :class="{ 'mdi-rotate-90': isOpen }"
50
- ></i>
51
- </div>
52
- </div>
53
- </div>
54
- </div>
55
- </template>
56
- <div class="pad-5">
57
- <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos, natus.</p>
58
- <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos, natus.</p>
59
- <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos, natus.</p>
60
- <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos, natus.</p>
61
- <p class="last">
62
- Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos, natus.
63
- </p>
64
- </div>
65
- </ui-collapse>
66
- </div>
67
- </template>
68
- <style lang="less" scoped>
69
- .ui-collapse-custom {
70
- overflow: hidden;
71
- border-radius: var(--border-radius);
72
- border: 1px solid var(--color-grey-light);
73
- }
74
- .ui-collapse-custom-heading {
75
- transition: all 0.5s ease;
76
- }
77
- </style>
78
- <script>
79
- import UiCollapse from './Collapse.vue';
80
-
81
- export default {
82
- components: { UiCollapse },
83
- data() {
84
- return {
85
- props: {},
86
- };
87
- },
88
- };
89
- </script>
90
- ```
1
+ Example using <mark>header</mark> <mark>icon-\*</mark> slots
2
+
3
+ ```vue
4
+ <template>
5
+ <div class="pad-l5">
6
+ <ui-collapse v-bind="props">
7
+ <template #header="{ toggle }">
8
+ <h3 class="last cursor-pointer" @click="toggle">My header</h3>
9
+ </template>
10
+ <div>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos, natus.</div>
11
+ </ui-collapse>
12
+ </div>
13
+ </template>
14
+ <script>
15
+ import UiCollapse from './Collapse.vue';
16
+
17
+ export default {
18
+ components: { UiCollapse },
19
+ data() {
20
+ return {
21
+ props: {
22
+ visible: true,
23
+ icon: true,
24
+ },
25
+ };
26
+ },
27
+ };
28
+ </script>
29
+ ```
30
+
31
+ Example using <mark>heading</mark> slot
32
+
33
+ ```vue
34
+ <template>
35
+ <div class="pad-l5">
36
+ <ui-collapse class="ui-collapse-custom" v-bind="props">
37
+ <template #heading="{ isOpen, toggle }">
38
+ <div
39
+ class="ui-collapse-custom-heading pad-v-3 pad-h-5 cursor-pointer u-select-none pos-rel"
40
+ :class="{ 'color-primary': isOpen, 'bg-primary-focus': isOpen }"
41
+ @click="toggle"
42
+ >
43
+ <div class="row row-collapse">
44
+ <div class="col col-vmid">My header</div>
45
+ <div class="col col-auto col-vmid">
46
+ <div class="icon w-auto pull-left">
47
+ <i
48
+ class="mdi mdi-chevron-right"
49
+ :class="{ 'mdi-rotate-90': isOpen }"
50
+ ></i>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ </template>
56
+ <div class="pad-5">
57
+ <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos, natus.</p>
58
+ <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos, natus.</p>
59
+ <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos, natus.</p>
60
+ <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos, natus.</p>
61
+ <p class="last">
62
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Dignissimos, natus.
63
+ </p>
64
+ </div>
65
+ </ui-collapse>
66
+ </div>
67
+ </template>
68
+ <style lang="less" scoped>
69
+ .ui-collapse-custom {
70
+ overflow: hidden;
71
+ border-radius: var(--border-radius);
72
+ border: 1px solid var(--color-grey-light);
73
+ }
74
+ .ui-collapse-custom-heading {
75
+ transition: all 0.5s ease;
76
+ }
77
+ </style>
78
+ <script>
79
+ import UiCollapse from './Collapse.vue';
80
+
81
+ export default {
82
+ components: { UiCollapse },
83
+ data() {
84
+ return {
85
+ props: {},
86
+ };
87
+ },
88
+ };
89
+ </script>
90
+ ```