classcard-ui 0.2.278 → 0.2.283

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.278",
3
+ "version": "0.2.283",
4
4
  "main": "dist/classcard-ui.common.js",
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -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 }}
@@ -210,7 +210,7 @@ export default {
210
210
  computed: {
211
211
  classes() {
212
212
  return {
213
- "text-gray-900 hover:bg-gray-200 bg-gray-100 focus:ring-2 focus:border-gray-200 focus:ring-gray-200 focus:ring-offset-2 shadow-sm":
213
+ "text-gray-900 border border-gray-200 hover:bg-gray-200 bg-gray-100 focus:ring-2 focus:border-gray-200 focus:ring-gray-200 focus:ring-offset-2 shadow-sm":
214
214
  this.type == "gray",
215
215
  "bg-white border border-gray-200 hover:bg-indigo-100 text-indigo-600 hover:text-indigo-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-200":
216
216
  this.type == "tertiary",
@@ -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);
package/src/icons.js CHANGED
@@ -43,6 +43,8 @@ export default {
43
43
  "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2",
44
44
  package:
45
45
  "M12 8v13m0-13V6a2 2 0 112 2h-2zm0 0V5.5A2.5 2.5 0 109.5 8H12zm-7 4h14M5 12a2 2 0 110-4h14a2 2 0 110 4M5 12v7a2 2 0 002 2h10a2 2 0 002-2v-7",
46
+ document:
47
+ "M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z",
46
48
  refresh:
47
49
  "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15",
48
50
  product: "M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4",
@@ -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:{