classcard-ui 0.2.503 → 0.2.504
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/dist/classcard-ui.common.js +419 -53
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.umd.js +419 -53
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js +7 -7
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +5 -5
- package/src/components/CCalendar/CCalendar.vue +287 -0
- package/src/components/CCalendar/index.js +3 -0
- package/src/components/CSelect/CSelect.vue +15 -2
- package/src/components/index.js +1 -0
- package/src/stories/CCalendar.stories.js +16 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "classcard-ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.504",
|
|
4
4
|
"main": "dist/classcard-ui.umd.min.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@babel/core": "^7.15.5",
|
|
42
|
-
"@storybook/addon-actions": "^6.4
|
|
43
|
-
"@storybook/addon-essentials": "^6.4
|
|
44
|
-
"@storybook/addon-links": "^6.4
|
|
45
|
-
"@storybook/vue": "^6.4
|
|
42
|
+
"@storybook/addon-actions": "^6.5.4",
|
|
43
|
+
"@storybook/addon-essentials": "^6.5.4",
|
|
44
|
+
"@storybook/addon-links": "^6.5.4",
|
|
45
|
+
"@storybook/vue": "^6.5.4",
|
|
46
46
|
"@tailwindcss/postcss7-compat": "^2.2.14",
|
|
47
47
|
"@types/lodash-es": "^4.17.5",
|
|
48
48
|
"@vue/cli-plugin-babel": "^4.5.13",
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- This example requires Tailwind CSS v2.0+ -->
|
|
3
|
+
<div>
|
|
4
|
+
<div
|
|
5
|
+
class="relative z-20 flex items-center justify-between border-b border-gray-200 py-4"
|
|
6
|
+
>
|
|
7
|
+
<h2 class="flex-auto font-semibold text-gray-900">
|
|
8
|
+
{{ currentMonthAndYear }}
|
|
9
|
+
</h2>
|
|
10
|
+
<button
|
|
11
|
+
type="button"
|
|
12
|
+
@click="handlePreviousMonthClick"
|
|
13
|
+
class="-my-1.5 flex flex-none items-center justify-center p-1.5 text-gray-400 hover:text-gray-500"
|
|
14
|
+
>
|
|
15
|
+
<span class="sr-only">Previous month</span>
|
|
16
|
+
<!-- Heroicon name: solid/chevron-left -->
|
|
17
|
+
<svg
|
|
18
|
+
class="h-5 w-5"
|
|
19
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
20
|
+
viewBox="0 0 20 20"
|
|
21
|
+
fill="currentColor"
|
|
22
|
+
aria-hidden="true"
|
|
23
|
+
>
|
|
24
|
+
<path
|
|
25
|
+
fill-rule="evenodd"
|
|
26
|
+
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"
|
|
27
|
+
clip-rule="evenodd"
|
|
28
|
+
/>
|
|
29
|
+
</svg>
|
|
30
|
+
</button>
|
|
31
|
+
<button
|
|
32
|
+
type="button"
|
|
33
|
+
@click="handleNextMonthClick"
|
|
34
|
+
class="-my-1.5 -mr-1.5 ml-2 flex flex-none items-center justify-center p-1.5 text-gray-400 hover:text-gray-500"
|
|
35
|
+
>
|
|
36
|
+
<span class="sr-only">Next month</span>
|
|
37
|
+
<!-- Heroicon name: solid/chevron-right -->
|
|
38
|
+
<svg
|
|
39
|
+
class="h-5 w-5"
|
|
40
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
41
|
+
viewBox="0 0 20 20"
|
|
42
|
+
fill="currentColor"
|
|
43
|
+
aria-hidden="true"
|
|
44
|
+
>
|
|
45
|
+
<path
|
|
46
|
+
fill-rule="evenodd"
|
|
47
|
+
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"
|
|
48
|
+
clip-rule="evenodd"
|
|
49
|
+
/>
|
|
50
|
+
</svg>
|
|
51
|
+
</button>
|
|
52
|
+
</div>
|
|
53
|
+
<div class="shadow ring-1 ring-gray-200">
|
|
54
|
+
<div
|
|
55
|
+
class="grid grid-cols-7 gap-px border-b border-gray-300 bg-gray-200 text-center text-xs font-semibold leading-6 text-gray-700"
|
|
56
|
+
>
|
|
57
|
+
<div class="bg-white py-2">M<span class="sr-only">on</span></div>
|
|
58
|
+
<div class="bg-white py-2">T<span class="sr-only">ue</span></div>
|
|
59
|
+
<div class="bg-white py-2">W<span class="sr-only">ed</span></div>
|
|
60
|
+
<div class="bg-white py-2">T<span class="sr-only">hu</span></div>
|
|
61
|
+
<div class="bg-white py-2">F<span class="sr-only">ri</span></div>
|
|
62
|
+
<div class="bg-white py-2">S<span class="sr-only">at</span></div>
|
|
63
|
+
<div class="bg-white py-2">S<span class="sr-only">un</span></div>
|
|
64
|
+
</div>
|
|
65
|
+
<div class="flex bg-gray-200 text-xs leading-6 text-gray-700">
|
|
66
|
+
<div class="isolate grid w-full grid-cols-7 grid-rows-6 gap-px">
|
|
67
|
+
<button
|
|
68
|
+
v-for="date in daysArray"
|
|
69
|
+
:key="getDateKey(date)"
|
|
70
|
+
type="button"
|
|
71
|
+
:class="{
|
|
72
|
+
'flex h-14 flex-col py-2 px-3 hover:bg-gray-100 focus:z-10': true,
|
|
73
|
+
'bg-white': isCurrentMonth(date),
|
|
74
|
+
'bg-gray-50': !isCurrentMonth(date),
|
|
75
|
+
'font-semibold': isSelected(date) || isToday(date),
|
|
76
|
+
'text-white': isSelected(date),
|
|
77
|
+
'text-indigo-600': !isSelected(date) && isToday(date),
|
|
78
|
+
'text-gray-900':
|
|
79
|
+
!isSelected(date) && isCurrentMonth(date) && !isToday(date),
|
|
80
|
+
'text-gray-500':
|
|
81
|
+
!isSelected(date) && !isCurrentMonth(date) && !isToday(date),
|
|
82
|
+
}"
|
|
83
|
+
>
|
|
84
|
+
<time
|
|
85
|
+
:datetime="formatForDateTime(date)"
|
|
86
|
+
:class="{
|
|
87
|
+
'ml-auto': true,
|
|
88
|
+
'bg-indigo-600': isSelected(date) && isToday(date),
|
|
89
|
+
'bg-gray-900': isSelected(date) && !isToday(date),
|
|
90
|
+
}"
|
|
91
|
+
>{{ getDayFromDate(date) }}</time
|
|
92
|
+
>
|
|
93
|
+
<span v-if="eventsArray" class="sr-only">0 events</span>
|
|
94
|
+
<span
|
|
95
|
+
v-if="eventsArray"
|
|
96
|
+
class="-mx-0.5 mt-auto flex flex-wrap-reverse"
|
|
97
|
+
>
|
|
98
|
+
<span
|
|
99
|
+
class="mx-0.5 mb-1 h-1.5 w-1.5 rounded-full bg-gray-400"
|
|
100
|
+
></span>
|
|
101
|
+
</span>
|
|
102
|
+
</button>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
<section class="mt-12">
|
|
107
|
+
<h2 class="font-semibold text-gray-900">
|
|
108
|
+
Schedule for <time datetime="2022-01-21">January 21, 2022</time>
|
|
109
|
+
</h2>
|
|
110
|
+
<ol class="mt-4 space-y-1 text-sm leading-6 text-gray-500">
|
|
111
|
+
<li
|
|
112
|
+
class="group flex items-center space-x-4 rounded-xl py-2 px-4 focus-within:bg-gray-100 hover:bg-gray-100"
|
|
113
|
+
>
|
|
114
|
+
<img
|
|
115
|
+
src="https://images.unsplash.com/photo-1494790108377-be9c29b29330?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
|
|
116
|
+
alt=""
|
|
117
|
+
class="h-10 w-10 flex-none rounded-full"
|
|
118
|
+
/>
|
|
119
|
+
<div class="flex-auto">
|
|
120
|
+
<p class="text-gray-900">Leslie Alexander</p>
|
|
121
|
+
<p class="mt-0.5">
|
|
122
|
+
<time datetime="2022-01-21T13:00">1:00 PM</time> -
|
|
123
|
+
<time datetime="2022-01-21T14:30">2:30 PM</time>
|
|
124
|
+
</p>
|
|
125
|
+
</div>
|
|
126
|
+
<div
|
|
127
|
+
class="relative opacity-0 focus-within:opacity-100 group-hover:opacity-100"
|
|
128
|
+
>
|
|
129
|
+
<div>
|
|
130
|
+
<button
|
|
131
|
+
type="button"
|
|
132
|
+
class="-m-2 flex items-center rounded-full p-1.5 text-gray-500 hover:text-gray-600"
|
|
133
|
+
id="menu-0-button"
|
|
134
|
+
aria-expanded="false"
|
|
135
|
+
aria-haspopup="true"
|
|
136
|
+
>
|
|
137
|
+
<span class="sr-only">Open options</span>
|
|
138
|
+
<!-- Heroicon name: outline/dots-vertical -->
|
|
139
|
+
<svg
|
|
140
|
+
class="h-6 w-6"
|
|
141
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
142
|
+
fill="none"
|
|
143
|
+
viewBox="0 0 24 24"
|
|
144
|
+
stroke-width="2"
|
|
145
|
+
stroke="currentColor"
|
|
146
|
+
aria-hidden="true"
|
|
147
|
+
>
|
|
148
|
+
<path
|
|
149
|
+
stroke-linecap="round"
|
|
150
|
+
stroke-linejoin="round"
|
|
151
|
+
d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z"
|
|
152
|
+
/>
|
|
153
|
+
</svg>
|
|
154
|
+
</button>
|
|
155
|
+
</div>
|
|
156
|
+
|
|
157
|
+
<!--
|
|
158
|
+
Dropdown menu, show/hide based on menu state.
|
|
159
|
+
|
|
160
|
+
Entering: "transition ease-out duration-100"
|
|
161
|
+
From: "transform opacity-0 scale-95"
|
|
162
|
+
To: "transform opacity-100 scale-100"
|
|
163
|
+
Leaving: "transition ease-in duration-75"
|
|
164
|
+
From: "transform opacity-100 scale-100"
|
|
165
|
+
To: "transform opacity-0 scale-95"
|
|
166
|
+
-->
|
|
167
|
+
<div
|
|
168
|
+
class="absolute right-0 z-10 mt-2 w-36 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none"
|
|
169
|
+
role="menu"
|
|
170
|
+
aria-orientation="vertical"
|
|
171
|
+
aria-labelledby="menu-0-button"
|
|
172
|
+
tabindex="-1"
|
|
173
|
+
>
|
|
174
|
+
<div class="py-1" role="none">
|
|
175
|
+
<!-- Active: "bg-gray-100 text-gray-900", Not Active: "text-gray-700" -->
|
|
176
|
+
<a
|
|
177
|
+
href="#"
|
|
178
|
+
class="block px-4 py-2 text-sm text-gray-700"
|
|
179
|
+
role="menuitem"
|
|
180
|
+
tabindex="-1"
|
|
181
|
+
id="menu-0-item-0"
|
|
182
|
+
>Edit</a
|
|
183
|
+
>
|
|
184
|
+
<a
|
|
185
|
+
href="#"
|
|
186
|
+
class="block px-4 py-2 text-sm text-gray-700"
|
|
187
|
+
role="menuitem"
|
|
188
|
+
tabindex="-1"
|
|
189
|
+
id="menu-0-item-1"
|
|
190
|
+
>Cancel</a
|
|
191
|
+
>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
</li>
|
|
196
|
+
|
|
197
|
+
<!-- More meetings... -->
|
|
198
|
+
</ol>
|
|
199
|
+
</section>
|
|
200
|
+
</div>
|
|
201
|
+
</template>
|
|
202
|
+
|
|
203
|
+
<script>
|
|
204
|
+
import * as dayjs from "dayjs";
|
|
205
|
+
|
|
206
|
+
export default {
|
|
207
|
+
name: "CCalendar",
|
|
208
|
+
props: {
|
|
209
|
+
value: {
|
|
210
|
+
type: [String, Date],
|
|
211
|
+
default: () => null,
|
|
212
|
+
},
|
|
213
|
+
eventsArray: {
|
|
214
|
+
type: Array,
|
|
215
|
+
default: () => null,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
data() {
|
|
219
|
+
return {
|
|
220
|
+
activeDate: dayjs(),
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
methods: {
|
|
224
|
+
handlePreviousMonthClick() {
|
|
225
|
+
this.activeDate = this.activeDate.subtract(1, "month");
|
|
226
|
+
},
|
|
227
|
+
handleNextMonthClick() {
|
|
228
|
+
this.activeDate = this.activeDate.add(1, "month");
|
|
229
|
+
},
|
|
230
|
+
getDayFromDate(date) {
|
|
231
|
+
return dayjs(date).format("D");
|
|
232
|
+
},
|
|
233
|
+
isSelected(date) {
|
|
234
|
+
return dayjs(date).isSame(this.value, "day");
|
|
235
|
+
},
|
|
236
|
+
isToday(date) {
|
|
237
|
+
return dayjs(date).isSame(dayjs(), "day");
|
|
238
|
+
},
|
|
239
|
+
isCurrentMonth(date) {
|
|
240
|
+
return dayjs(date).isSame(this.activeDate, "month");
|
|
241
|
+
},
|
|
242
|
+
getDateKey(date) {
|
|
243
|
+
return dayjs(date).format();
|
|
244
|
+
},
|
|
245
|
+
formatForDateTime(date) {
|
|
246
|
+
return dayjs(date).format("YYYY-MM-DD");
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
computed: {
|
|
250
|
+
currentMonthAndYear() {
|
|
251
|
+
return dayjs(this.activeDate).format("MMMM YYYY");
|
|
252
|
+
},
|
|
253
|
+
daysArray() {
|
|
254
|
+
let dates = [];
|
|
255
|
+
let firstDayOfmonth = dayjs(this.activeDate).startOf("month");
|
|
256
|
+
let lastDayOfmonth = dayjs(this.activeDate).endOf("month");
|
|
257
|
+
let firstDayOfMonthInWeek = firstDayOfmonth.day();
|
|
258
|
+
let lastDayOfMonthInWeek = lastDayOfmonth.day();
|
|
259
|
+
if (firstDayOfMonthInWeek === 0) {
|
|
260
|
+
firstDayOfMonthInWeek = 7;
|
|
261
|
+
}
|
|
262
|
+
if (lastDayOfMonthInWeek === 0) {
|
|
263
|
+
lastDayOfMonthInWeek = 7;
|
|
264
|
+
}
|
|
265
|
+
for (let i = 0; i < firstDayOfMonthInWeek - 1; i++) {
|
|
266
|
+
dates.unshift(firstDayOfmonth.subtract(i + 1, "day"));
|
|
267
|
+
}
|
|
268
|
+
for (let i = 0; i < dayjs(this.activeDate).daysInMonth(); i++) {
|
|
269
|
+
dates.push(firstDayOfmonth.add(i, "day"));
|
|
270
|
+
}
|
|
271
|
+
let cursor = 1;
|
|
272
|
+
for (let i = lastDayOfMonthInWeek; i < 7; i++) {
|
|
273
|
+
dates.push(lastDayOfmonth.add(cursor, "day"));
|
|
274
|
+
cursor++;
|
|
275
|
+
}
|
|
276
|
+
return dates;
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
mounted() {
|
|
280
|
+
if (this.value) {
|
|
281
|
+
this.activeDate = dayjs(this.value);
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
};
|
|
285
|
+
</script>
|
|
286
|
+
|
|
287
|
+
<style></style>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
<div class="pointer-events-none absolute top-2 left-3 flex">
|
|
33
33
|
<span class="flex items-center" :style="selectedOptionStyles">
|
|
34
34
|
<c-avatar
|
|
35
|
-
v-if="showImage && !selectSearch && value.photo"
|
|
35
|
+
v-if="showImage && !selectSearch && value.photo !== null"
|
|
36
36
|
size="extraextrasmall"
|
|
37
37
|
:image="value.photo"
|
|
38
38
|
:rounded="true"
|
|
@@ -110,11 +110,24 @@
|
|
|
110
110
|
>
|
|
111
111
|
<span class="flex items-center">
|
|
112
112
|
<c-avatar
|
|
113
|
-
v-if="showImage && option.photo"
|
|
113
|
+
v-if="showImage && option.photo !== null"
|
|
114
114
|
size="extraextrasmall"
|
|
115
115
|
:image="option.photo"
|
|
116
116
|
:rounded="true"
|
|
117
117
|
></c-avatar>
|
|
118
|
+
<c-avatar
|
|
119
|
+
v-else
|
|
120
|
+
size="extraextrasmall"
|
|
121
|
+
:nameInitials="option.initials"
|
|
122
|
+
:rounded="true"
|
|
123
|
+
></c-avatar>
|
|
124
|
+
<c-icon
|
|
125
|
+
v-if="!showImage && icon"
|
|
126
|
+
:class="icon.class"
|
|
127
|
+
:name="icon.name"
|
|
128
|
+
:type="icon.type"
|
|
129
|
+
:rounded="true"
|
|
130
|
+
></c-icon>
|
|
118
131
|
<span
|
|
119
132
|
:class="showImage && option.photo ? 'ml-3' : ''"
|
|
120
133
|
class="list-options block break-words font-normal"
|
package/src/components/index.js
CHANGED
|
@@ -45,3 +45,4 @@ export { default as CTextarea } from "./CTextarea";
|
|
|
45
45
|
export { default as CTimeline } from "./CTimeline";
|
|
46
46
|
export { default as CUpload } from "./CUpload";
|
|
47
47
|
export { default as CConfirmActionModal } from "./CConfirmActionModal";
|
|
48
|
+
export { default as CCalendar } from "./CCalendar";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CCalendar } from "../components";
|
|
2
|
+
import "./utils.css";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "CCalendar",
|
|
6
|
+
component: CCalendar,
|
|
7
|
+
argTypes: {},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const Template = (args, { argTypes }) => ({
|
|
11
|
+
props: Object.keys(argTypes),
|
|
12
|
+
components: { CCalendar },
|
|
13
|
+
template: '<c-calendar v-bind="$props" />',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const Default = Template.bind({});
|