classcard-ui 0.2.276 → 0.2.281

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": "classcard-ui",
3
- "version": "0.2.276",
3
+ "version": "0.2.281",
4
4
  "main": "dist/classcard-ui.common.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -5,7 +5,7 @@
5
5
  <div>
6
6
  <button
7
7
  type="white"
8
- @click.prevent="toggleDropdown = !toggleDropdown"
8
+ @click.stop="toggleDropdown = !toggleDropdown"
9
9
  @blur="close()"
10
10
  class="
11
11
  inline-flex
@@ -51,7 +51,7 @@
51
51
  <a
52
52
  v-for="item in items"
53
53
  v-bind:key="item.text"
54
- @mousedown.prevent="dropdownAction(item)"
54
+ @mousedown.stop="dropdownAction(item)"
55
55
  class="
56
56
  flex
57
57
  px-4
@@ -61,6 +61,7 @@
61
61
  hover:text-gray-900
62
62
  cursor-pointer
63
63
  "
64
+ :class="item.class"
64
65
  role="menuitem"
65
66
  >
66
67
  {{ item.text }}
@@ -1,10 +1,18 @@
1
1
  <template>
2
- <div class="bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6">
2
+ <div
3
+ class="bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6"
4
+ >
3
5
  <div class="flex-1 flex justify-between sm:hidden">
4
- <a href="#" class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
6
+ <a
7
+ href="#"
8
+ class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50"
9
+ >
5
10
  Previous
6
11
  </a>
7
- <a href="#" class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
12
+ <a
13
+ href="#"
14
+ class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50"
15
+ >
8
16
  Next
9
17
  </a>
10
18
  </div>
@@ -12,30 +20,44 @@
12
20
  <div>
13
21
  <p class="text-sm text-gray-700">
14
22
  Showing
15
- <span class="font-medium">1</span>
23
+ <span class="font-medium">{{ setPaginationRecords.from }}</span>
16
24
  to
17
- <span class="font-medium">10</span>
25
+ <span class="font-medium">{{ setPaginationRecords.to }}</span>
18
26
  of
19
- <span class="font-medium">97</span>
27
+ <span class="font-medium">{{ setPaginationRecords.totalRecords }}</span>
20
28
  results
21
29
  </p>
22
30
  </div>
23
31
  <div>
24
- <nav class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px" aria-label="Pagination">
32
+ <nav
33
+ class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px"
34
+ aria-label="Pagination"
35
+ >
25
36
  <div class="hidden md:-mt-px md:flex">
26
- <div href="#"
37
+ <div
38
+ href="#"
27
39
  @click="currentPageNumber == '1' ? '' : goToPreviousPage()"
28
40
  class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-r-0 border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50"
29
41
  :class="
30
- currentPageNumber == '1'
31
- ? 'text-gray-400 pointer-events-none'
32
- : 'text-gray-500 hover:text-gray-700 group cursor-pointer'
42
+ currentPageNumber == '1'
43
+ ? 'text-gray-400 pointer-events-none'
44
+ : 'text-gray-500 hover:text-gray-700 group cursor-pointer'
33
45
  "
34
- >
46
+ >
35
47
  <span class="sr-only">Previous</span>
36
48
  <!-- Heroicon name: solid/chevron-left -->
37
- <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
38
- <path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd" />
49
+ <svg
50
+ class="h-5 w-5"
51
+ xmlns="http://www.w3.org/2000/svg"
52
+ viewBox="0 0 20 20"
53
+ fill="currentColor"
54
+ aria-hidden="true"
55
+ >
56
+ <path
57
+ fill-rule="evenodd"
58
+ d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z"
59
+ clip-rule="evenodd"
60
+ />
39
61
  </svg>
40
62
  </div>
41
63
  <div
@@ -45,7 +67,9 @@
45
67
  page == currentPageNumber
46
68
  ? 'z-10 bg-indigo-50 border-indigo-500 text-indigo-600 relative inline-flex items-center px-4 py-2 border text-sm font-medium'
47
69
  : '',
48
- page === '...' ? 'bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border border-r-0 text-sm font-medium' : '',
70
+ page === '...'
71
+ ? 'bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border border-r-0 text-sm font-medium'
72
+ : '',
49
73
  page !== currentPageNumber && page !== '...'
50
74
  ? 'bg-white border-gray-300 text-gray-500 hover:bg-gray-50 relative inline-flex items-center px-4 py-2 border border-r-0 text-sm font-medium'
51
75
  : '',
@@ -57,19 +81,30 @@
57
81
  {{ page }}
58
82
  </div>
59
83
  </div>
60
- <div href="#"
61
- class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50"
62
- @click="currentPageNumber == lastPageNumber ? '' : goToNextPage()"
63
- :class="
64
- currentPageNumber == lastPageNumber
65
- ? 'text-gray-400 pointer-events-none'
66
- : 'text-gray-500 hover:text-gray-700 group cursor-pointer'
67
- "
84
+ <div
85
+ href="#"
86
+ class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50"
87
+ @click="currentPageNumber == lastPageNumber ? '' : goToNextPage()"
88
+ :class="
89
+ currentPageNumber == lastPageNumber
90
+ ? 'text-gray-400 pointer-events-none'
91
+ : 'text-gray-500 hover:text-gray-700 group cursor-pointer'
92
+ "
68
93
  >
69
94
  <span class="sr-only">Next</span>
70
95
  <!-- Heroicon name: solid/chevron-right -->
71
- <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
72
- <path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
96
+ <svg
97
+ class="h-5 w-5"
98
+ xmlns="http://www.w3.org/2000/svg"
99
+ viewBox="0 0 20 20"
100
+ fill="currentColor"
101
+ aria-hidden="true"
102
+ >
103
+ <path
104
+ fill-rule="evenodd"
105
+ d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
106
+ clip-rule="evenodd"
107
+ />
73
108
  </svg>
74
109
  </div>
75
110
  </div>
@@ -95,9 +130,7 @@ export default {
95
130
  type: Function,
96
131
  },
97
132
  },
98
- components: {
99
-
100
- },
133
+ components: {},
101
134
  data() {
102
135
  return {
103
136
  currentPageNumber: this.setPaginationRecords.currentPage,
@@ -152,4 +185,4 @@ export default {
152
185
  },
153
186
  },
154
187
  };
155
- </script>
188
+ </script>
@@ -2,43 +2,16 @@
2
2
  <div>
3
3
  <div v-if="type === 'default'">
4
4
  <slot></slot>
5
- <div
6
- :class="errorClasses"
7
- class=""
8
- id="c-file-area"
9
- @click.prevent="uploader.open()"
10
- >
5
+ <div :class="errorClasses" class="" id="c-file-area" @click.prevent="uploader.open()">
11
6
  <button
12
7
  type="white"
13
- class="
14
- inline-flex
15
- items-center
16
- px-4
17
- py-2
18
- shadow-sm
19
- text-sm
20
- font-medium
21
- rounded-md
22
- focus:outline-none
23
- focus:ring-2 focus:ring-offset-2
24
- disabled:opacity-50
25
- text-gray-700
26
- border
27
- bg-white
28
- border-gray-300
29
- hover:bg-gray-50
30
- focus:ring-indigo-600
31
- "
8
+ class="pic-btn inline-flex items-center px-4 py-2 shadow-sm text-sm font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 text-gray-700 border bg-white border-gray-300 hover:bg-gray-50 focus:ring-indigo-600"
32
9
  >
33
10
  {{ buttonText }}
34
11
  </button>
35
12
  </div>
36
13
  </div>
37
- <div
38
- v-if="type === 'filestack'"
39
- :class="filestackClasses"
40
- id="filestack-uploader"
41
- ></div>
14
+ <div v-if="type === 'filestack'" :class="filestackClasses" id="filestack-uploader"></div>
42
15
  <p v-if="!isValidate" class="mt-2 text-sm text-red-600">
43
16
  {{ errorMessage }}
44
17
  </p>
@@ -78,10 +51,26 @@ export default {
78
51
  type: String,
79
52
  default: "w-96 h-96",
80
53
  },
54
+ url: {
55
+ type: String,
56
+ },
81
57
  maxFiles: {
82
58
  type: Number,
83
59
  default: 1,
84
60
  },
61
+ onUploadSuccess: {
62
+ type: Function,
63
+ },
64
+ includeUnsplash: {
65
+ type: Boolean,
66
+ },
67
+ cropImage: {
68
+ type: Boolean,
69
+ },
70
+ aspectRatioDimensions: {
71
+ type: Number,
72
+ default: 23 / 45,
73
+ },
85
74
  },
86
75
  data() {
87
76
  return {
@@ -109,23 +98,20 @@ export default {
109
98
  compressionToMime: "image/jpeg",
110
99
  maxSize: [500, 1000],
111
100
  uploader: xhrUploader({
112
- endpoint: `https://reportcard.tech/api/saveImage/`,
101
+ endpoint: `${this.url}`,
113
102
  fileKeyName: "image",
114
- // settingsFunction: (xmlHttp) => {
115
- // xmlHttp.setRequestHeader("Authorization", `Bearer ${token}`);
116
- // },
117
103
  responseFunction: (response) => {
118
- console.log(response);
104
+ this.$emit("onUploadSuccess", response);
119
105
  },
120
106
  }),
121
- // bind: document.querySelector("#imagePreview"),
122
107
  });
123
108
  this.uploader.use([
124
109
  new Local(),
125
- new Unsplash("hXfo-C0svXV4IDCncBo7s-ySQpVJVeZrGuWxwwgC7qw"),
126
- new Crop({ aspectRatio: 23 / 45 }),
110
+ ...(this.includeUnsplash
111
+ ? [new Unsplash("hXfo-C0svXV4IDCncBo7s-ySQpVJVeZrGuWxwwgC7qw")]
112
+ : []),
113
+ ...(this.cropImage ? [new Crop({ aspectRatio: this.aspectRatioDimensions })] : []),
127
114
  ]);
128
-
129
115
  // Uppload Error Handle
130
116
  this.uploader.on("error", (error) => {
131
117
  console.log("The error message is", error);
@@ -21,7 +21,7 @@ const Template = (args, { argTypes }) => ({
21
21
  export const Default = Template.bind({});
22
22
  Default.args = {
23
23
  items: [
24
- { icon: "check", text: "one", action:'alert' },
24
+ { icon: "check", text: "one", action:'alert', class:'hover:bg-red-100 hover:text-red-500' },
25
25
  { icon: "check", text: "two" },
26
26
  ],
27
27
  icon:{