classcard-ui 0.2.522 → 0.2.525
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/README.md +24 -24
- package/dist/classcard-ui.common.js +92 -89
- package/dist/classcard-ui.common.js.map +1 -1
- package/dist/classcard-ui.umd.js +92 -89
- package/dist/classcard-ui.umd.js.map +1 -1
- package/dist/classcard-ui.umd.min.js +8 -8
- package/dist/classcard-ui.umd.min.js.map +1 -1
- package/package.json +81 -81
- package/src/App.vue +16 -16
- package/src/components/CAlerts/CAlerts.vue +70 -70
- package/src/components/CAlerts/index.js +2 -2
- package/src/components/CAnchorTabs/CAnchorTabs.vue +104 -104
- package/src/components/CAnchorTabs/index.js +2 -2
- package/src/components/CAnchorTag/CAnchorTag.vue +62 -62
- package/src/components/CAnchorTag/index.js +2 -2
- package/src/components/CAvatar/CAvatar.vue +89 -89
- package/src/components/CAvatar/index.js +2 -2
- package/src/components/CAvatarGroup/CAvatarGroup.vue +145 -145
- package/src/components/CAvatarGroup/index.js +2 -2
- package/src/components/CBasicTable/CBasicTable.vue +184 -184
- package/src/components/CBasicTable/index.js +2 -2
- package/src/components/CBreadcrumbs/CBreadcrumbs.vue +38 -38
- package/src/components/CBreadcrumbs/index.js +2 -2
- package/src/components/CButton/CButton.vue +150 -150
- package/src/components/CButton/index.js +2 -2
- package/src/components/CButtonGroup/CButtonGroup.vue +116 -116
- package/src/components/CButtonGroup/index.js +2 -2
- package/src/components/CButtonIcon/CButtonIcon.vue +91 -91
- package/src/components/CButtonIcon/index.js +2 -2
- package/src/components/CButtonLink/CButtonLink.vue +39 -39
- package/src/components/CButtonLink/index.js +2 -2
- package/src/components/CButtonSelect/CButtonSelect.vue +103 -103
- package/src/components/CButtonSelect/index.js +2 -2
- package/src/components/CButtonWithDropdown/CButtonWithDropdown.vue +168 -168
- package/src/components/CButtonWithDropdown/index.js +2 -2
- package/src/components/CCalendar/CCalendar.vue +320 -318
- package/src/components/CCalendar/index.js +3 -3
- package/src/components/CCard/CCard.vue +49 -49
- package/src/components/CCard/index.js +2 -2
- package/src/components/CCheckbox/CCheckbox.vue +70 -70
- package/src/components/CCheckbox/index.js +2 -2
- package/src/components/CCollapsibleSection/CCollapsibleSection.vue +99 -99
- package/src/components/CCollapsibleSection/index.js +2 -2
- package/src/components/CColorDots/CColorDots.vue +35 -35
- package/src/components/CColorDots/index.js +3 -3
- package/src/components/CConfirmActionModal/CConfirmActionModal.vue +120 -120
- package/src/components/CConfirmActionModal/index.js +3 -3
- package/src/components/CDatepicker/CDatepicker.vue +134 -134
- package/src/components/CDatepicker/index.js +2 -2
- package/src/components/CDualSelect/CDualSelect.vue +193 -193
- package/src/components/CDualSelect/index.js +2 -2
- package/src/components/CEditor/CEditor.vue +91 -91
- package/src/components/CEditor/index.js +2 -2
- package/src/components/CFormSectionHeading/CFormSectionHeading.vue +52 -52
- package/src/components/CFormSectionHeading/index.js +2 -2
- package/src/components/CGroupedSelect/CGroupedSelect.vue +217 -217
- package/src/components/CGroupedSelect/index.js +3 -3
- package/src/components/CIcon/CIcon.vue +72 -72
- package/src/components/CIcon/index.js +2 -2
- package/src/components/CIconDropdown/CIconDropdown.vue +105 -94
- package/src/components/CIconDropdown/index.js +2 -2
- package/src/components/CInput/CInput.vue +115 -115
- package/src/components/CInput/index.js +2 -2
- package/src/components/CInputAddon/CInputAddon.vue +202 -202
- package/src/components/CInputAddon/index.js +2 -2
- package/src/components/CInputEmail/CInputEmail.vue +84 -84
- package/src/components/CInputEmail/index.js +2 -2
- package/src/components/CModalHeading/CModalHeading.vue +22 -22
- package/src/components/CModalHeading/index.js +2 -2
- package/src/components/CModuleHelpLinks/CModuleHelpLinks.vue +39 -39
- package/src/components/CModuleHelpLinks/index.js +3 -3
- package/src/components/CMultiselect/CMultiselect.vue +313 -313
- package/src/components/CMultiselect/index.js +2 -2
- package/src/components/CMultiselectr/CMultiselectr.vue +44 -44
- package/src/components/CMultiselectr/index.js +2 -2
- package/src/components/CPageHeading/CPageHeading.vue +56 -56
- package/src/components/CPageHeading/index.js +2 -2
- package/src/components/CPagination/CPagination.vue +202 -202
- package/src/components/CPagination/index.js +2 -2
- package/src/components/CPhoneNumber/CPhoneNumber.vue +62 -62
- package/src/components/CPhoneNumber/index.js +2 -2
- package/src/components/CRadio/CRadio.vue +114 -112
- package/src/components/CRadio/index.js +2 -2
- package/src/components/CRangeSlider/CRangeSlider.vue +55 -55
- package/src/components/CRangeSlider/index.js +2 -2
- package/src/components/CReorderableStackedList/CReorderableStackedList.vue +94 -94
- package/src/components/CReorderableStackedList/index.js +2 -2
- package/src/components/CSelect/CSelect.vue +310 -310
- package/src/components/CSelect/index.js +2 -2
- package/src/components/CSmallTimeline/CSmallTimeline.vue +40 -40
- package/src/components/CSmallTimeline/index.js +2 -2
- package/src/components/CStackedList/CStackedList.vue +94 -94
- package/src/components/CStackedList/index.js +2 -2
- package/src/components/CStats/CStats.vue +88 -88
- package/src/components/CStats/index.js +2 -2
- package/src/components/CSwitch/CSwitch.vue +132 -132
- package/src/components/CSwitch/index.js +2 -2
- package/src/components/CTable/CTable.vue +501 -501
- package/src/components/CTable/index.js +2 -2
- package/src/components/CTabs/CTabs.vue +107 -107
- package/src/components/CTabs/index.js +2 -2
- package/src/components/CTag/CTag.vue +36 -36
- package/src/components/CTag/index.js +2 -2
- package/src/components/CTextarea/CTextarea.vue +85 -85
- package/src/components/CTextarea/index.js +2 -2
- package/src/components/CTimeline/CTimeline.vue +237 -237
- package/src/components/CTimeline/index.js +2 -2
- package/src/components/CUpload/CUpload.vue +201 -201
- package/src/components/CUpload/index.js +2 -2
- package/src/components/index.js +48 -48
- package/src/icons.js +254 -254
- package/src/main.js +22 -22
- package/src/stories/CAlerts.stories.js +37 -37
- package/src/stories/CAnchorTabs.stories.js +29 -29
- package/src/stories/CAnchorTag.stories.js +36 -36
- package/src/stories/CAvatar.stories.js +38 -38
- package/src/stories/CAvatarGroup.stories.js +100 -100
- package/src/stories/CBasicTable.stories.js +316 -316
- package/src/stories/CBreadcrumbs.stories.js +24 -24
- package/src/stories/CButton.stories.js +46 -46
- package/src/stories/CButtonGroup.stories.js +33 -33
- package/src/stories/CButtonIcon.stories.js +27 -27
- package/src/stories/CButtonLink.stories.js +24 -24
- package/src/stories/CButtonSelect.stories.js +32 -32
- package/src/stories/CButtonWithDropdown.stories.js +41 -41
- package/src/stories/CCalendar.stories.js +16 -16
- package/src/stories/CCard.stories.js +30 -30
- package/src/stories/CCheckbox.stories.js +29 -29
- package/src/stories/CCollapsibleSection.stories.js +28 -28
- package/src/stories/CColorDots.stories.js +28 -28
- package/src/stories/CConfirmActionModal.stories.js +59 -59
- package/src/stories/CDatepicker.stories.js +30 -30
- package/src/stories/CDualSelect.stories.js +29 -29
- package/src/stories/CEditor.stories.js +30 -30
- package/src/stories/CFormSectionHeading.stories.js +34 -34
- package/src/stories/CGroupedSelect.stories.js +69 -69
- package/src/stories/CIcon.stories.js +26 -26
- package/src/stories/CIconDropdown.stories.js +39 -39
- package/src/stories/CInput.stories.js +36 -36
- package/src/stories/CInputAddon.stories.js +37 -37
- package/src/stories/CInputEmail.stories.js +27 -27
- package/src/stories/CModalHeading.stories.js +25 -25
- package/src/stories/CModuleHelpLinks.stories.js +25 -25
- package/src/stories/CMultiselect.stories.js +97 -97
- package/src/stories/CMultiselectr.stories.js +23 -23
- package/src/stories/CPageHeading.stories.js +32 -32
- package/src/stories/CPagination.stories.js +30 -30
- package/src/stories/CPhoneNumber.stories.js +29 -29
- package/src/stories/CRadio.stories.js +36 -36
- package/src/stories/CRangeSlider.stories.js +23 -23
- package/src/stories/CReorderableStackedList.stories.js +23 -23
- package/src/stories/CSelect.stories.js +50 -50
- package/src/stories/CSmallTimeline.stories.js +26 -26
- package/src/stories/CStackedList.stories.js +37 -37
- package/src/stories/CStats.stories.js +33 -33
- package/src/stories/CSwitch.stories.js +28 -28
- package/src/stories/CTable.stories.js +77 -77
- package/src/stories/CTabs.stories.js +29 -29
- package/src/stories/CTag.stories.js +23 -23
- package/src/stories/CTextarea.stories.js +32 -32
- package/src/stories/CTimeline.stories.js +26 -26
- package/src/stories/CUpload.stories.js +36 -36
- package/src/stories/Introduction.stories.mdx +207 -207
- package/src/stories/Page.vue +88 -88
- package/src/stories/assets/code-brackets.svg +0 -0
- package/src/stories/assets/colors.svg +0 -0
- package/src/stories/assets/comments.svg +0 -0
- package/src/stories/assets/direction.svg +0 -0
- package/src/stories/assets/flow.svg +0 -0
- package/src/stories/assets/plugin.svg +0 -0
- package/src/stories/assets/repo.svg +0 -0
- package/src/stories/assets/stackalt.svg +0 -0
- package/src/stories/header.css +26 -26
- package/src/stories/page.css +69 -69
- package/src/stories/utils.css +17 -17
|
@@ -1,318 +1,320 @@
|
|
|
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="eventsCount" class="sr-only"
|
|
94
|
-
>{{ getEventsCountForDate(date) }} events</span
|
|
95
|
-
>
|
|
96
|
-
<span
|
|
97
|
-
v-if="eventsCount"
|
|
98
|
-
class="-mx-0.5 mt-auto flex flex-wrap-reverse"
|
|
99
|
-
>
|
|
100
|
-
<span
|
|
101
|
-
class="mx-0.5 mb-1 h-1.5 w-1.5 rounded-full bg-gray-400"
|
|
102
|
-
></span>
|
|
103
|
-
</span>
|
|
104
|
-
</button>
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
<section v-if="eventData" class="mt-12">
|
|
109
|
-
<h2 class="font-semibold text-gray-900">
|
|
110
|
-
Schedule for
|
|
111
|
-
<time :datetime="selectedDateForDateTime">{{
|
|
112
|
-
formattedSelectedDate
|
|
113
|
-
}}</time>
|
|
114
|
-
</h2>
|
|
115
|
-
<ol class="mt-4 space-y-1 text-sm leading-6 text-gray-500">
|
|
116
|
-
<li
|
|
117
|
-
class="group flex items-center space-x-4 rounded-xl py-2 px-4 focus-within:bg-gray-100 hover:bg-gray-100"
|
|
118
|
-
>
|
|
119
|
-
<img
|
|
120
|
-
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"
|
|
121
|
-
alt=""
|
|
122
|
-
class="h-10 w-10 flex-none rounded-full"
|
|
123
|
-
/>
|
|
124
|
-
<div class="flex-auto">
|
|
125
|
-
<p class="text-gray-900">Leslie Alexander</p>
|
|
126
|
-
<p class="mt-0.5">
|
|
127
|
-
<time datetime="2022-01-21T13:00">1:00 PM</time> -
|
|
128
|
-
<time datetime="2022-01-21T14:30">2:30 PM</time>
|
|
129
|
-
</p>
|
|
130
|
-
</div>
|
|
131
|
-
<div
|
|
132
|
-
class="relative opacity-0 focus-within:opacity-100 group-hover:opacity-100"
|
|
133
|
-
>
|
|
134
|
-
<div>
|
|
135
|
-
<button
|
|
136
|
-
type="button"
|
|
137
|
-
class="-m-2 flex items-center rounded-full p-1.5 text-gray-500 hover:text-gray-600"
|
|
138
|
-
id="menu-0-button"
|
|
139
|
-
aria-expanded="false"
|
|
140
|
-
aria-haspopup="true"
|
|
141
|
-
>
|
|
142
|
-
<span class="sr-only">Open options</span>
|
|
143
|
-
<!-- Heroicon name: outline/dots-vertical -->
|
|
144
|
-
<svg
|
|
145
|
-
class="h-6 w-6"
|
|
146
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
147
|
-
fill="none"
|
|
148
|
-
viewBox="0 0 24 24"
|
|
149
|
-
stroke-width="2"
|
|
150
|
-
stroke="currentColor"
|
|
151
|
-
aria-hidden="true"
|
|
152
|
-
>
|
|
153
|
-
<path
|
|
154
|
-
stroke-linecap="round"
|
|
155
|
-
stroke-linejoin="round"
|
|
156
|
-
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"
|
|
157
|
-
/>
|
|
158
|
-
</svg>
|
|
159
|
-
</button>
|
|
160
|
-
</div>
|
|
161
|
-
|
|
162
|
-
<!--
|
|
163
|
-
Dropdown menu, show/hide based on menu state.
|
|
164
|
-
|
|
165
|
-
Entering: "transition ease-out duration-100"
|
|
166
|
-
From: "transform opacity-0 scale-95"
|
|
167
|
-
To: "transform opacity-100 scale-100"
|
|
168
|
-
Leaving: "transition ease-in duration-75"
|
|
169
|
-
From: "transform opacity-100 scale-100"
|
|
170
|
-
To: "transform opacity-0 scale-95"
|
|
171
|
-
-->
|
|
172
|
-
<div
|
|
173
|
-
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"
|
|
174
|
-
role="menu"
|
|
175
|
-
aria-orientation="vertical"
|
|
176
|
-
aria-labelledby="menu-0-button"
|
|
177
|
-
tabindex="-1"
|
|
178
|
-
>
|
|
179
|
-
<div class="py-1" role="none">
|
|
180
|
-
<!-- Active: "bg-gray-100 text-gray-900", Not Active: "text-gray-700" -->
|
|
181
|
-
<a
|
|
182
|
-
href="#"
|
|
183
|
-
class="block px-4 py-2 text-sm text-gray-700"
|
|
184
|
-
role="menuitem"
|
|
185
|
-
tabindex="-1"
|
|
186
|
-
id="menu-0-item-0"
|
|
187
|
-
>Edit</a
|
|
188
|
-
>
|
|
189
|
-
<a
|
|
190
|
-
href="#"
|
|
191
|
-
class="block px-4 py-2 text-sm text-gray-700"
|
|
192
|
-
role="menuitem"
|
|
193
|
-
tabindex="-1"
|
|
194
|
-
id="menu-0-item-1"
|
|
195
|
-
>Cancel</a
|
|
196
|
-
>
|
|
197
|
-
</div>
|
|
198
|
-
</div>
|
|
199
|
-
</div>
|
|
200
|
-
</li>
|
|
201
|
-
|
|
202
|
-
<!-- More meetings... -->
|
|
203
|
-
</ol>
|
|
204
|
-
</section>
|
|
205
|
-
</div>
|
|
206
|
-
</template>
|
|
207
|
-
|
|
208
|
-
<script>
|
|
209
|
-
import * as dayjs from "dayjs";
|
|
210
|
-
|
|
211
|
-
export default {
|
|
212
|
-
name: "CCalendar",
|
|
213
|
-
props: {
|
|
214
|
-
value: {
|
|
215
|
-
type: [String, Date],
|
|
216
|
-
default: () => null,
|
|
217
|
-
},
|
|
218
|
-
eventsCount: {
|
|
219
|
-
type: Array,
|
|
220
|
-
default: () => null,
|
|
221
|
-
},
|
|
222
|
-
eventsData: {
|
|
223
|
-
type: Array,
|
|
224
|
-
default: () => null,
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
data() {
|
|
228
|
-
return {
|
|
229
|
-
activeDate: dayjs(),
|
|
230
|
-
};
|
|
231
|
-
},
|
|
232
|
-
methods: {
|
|
233
|
-
handlePreviousMonthClick() {
|
|
234
|
-
this.activeDate = this.activeDate.subtract(1, "month");
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
)
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
return
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
let
|
|
282
|
-
let
|
|
283
|
-
let
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
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="eventsCount" class="sr-only"
|
|
94
|
+
>{{ getEventsCountForDate(date) }} events</span
|
|
95
|
+
>
|
|
96
|
+
<span
|
|
97
|
+
v-if="eventsCount && getEventsCountForDate(date) > 0"
|
|
98
|
+
class="-mx-0.5 mt-auto flex flex-wrap-reverse"
|
|
99
|
+
>
|
|
100
|
+
<span
|
|
101
|
+
class="mx-0.5 mb-1 h-1.5 w-1.5 rounded-full bg-gray-400"
|
|
102
|
+
></span>
|
|
103
|
+
</span>
|
|
104
|
+
</button>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
<section v-if="eventData" class="mt-12">
|
|
109
|
+
<h2 class="font-semibold text-gray-900">
|
|
110
|
+
Schedule for
|
|
111
|
+
<time :datetime="selectedDateForDateTime">{{
|
|
112
|
+
formattedSelectedDate
|
|
113
|
+
}}</time>
|
|
114
|
+
</h2>
|
|
115
|
+
<ol class="mt-4 space-y-1 text-sm leading-6 text-gray-500">
|
|
116
|
+
<li
|
|
117
|
+
class="group flex items-center space-x-4 rounded-xl py-2 px-4 focus-within:bg-gray-100 hover:bg-gray-100"
|
|
118
|
+
>
|
|
119
|
+
<img
|
|
120
|
+
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"
|
|
121
|
+
alt=""
|
|
122
|
+
class="h-10 w-10 flex-none rounded-full"
|
|
123
|
+
/>
|
|
124
|
+
<div class="flex-auto">
|
|
125
|
+
<p class="text-gray-900">Leslie Alexander</p>
|
|
126
|
+
<p class="mt-0.5">
|
|
127
|
+
<time datetime="2022-01-21T13:00">1:00 PM</time> -
|
|
128
|
+
<time datetime="2022-01-21T14:30">2:30 PM</time>
|
|
129
|
+
</p>
|
|
130
|
+
</div>
|
|
131
|
+
<div
|
|
132
|
+
class="relative opacity-0 focus-within:opacity-100 group-hover:opacity-100"
|
|
133
|
+
>
|
|
134
|
+
<div>
|
|
135
|
+
<button
|
|
136
|
+
type="button"
|
|
137
|
+
class="-m-2 flex items-center rounded-full p-1.5 text-gray-500 hover:text-gray-600"
|
|
138
|
+
id="menu-0-button"
|
|
139
|
+
aria-expanded="false"
|
|
140
|
+
aria-haspopup="true"
|
|
141
|
+
>
|
|
142
|
+
<span class="sr-only">Open options</span>
|
|
143
|
+
<!-- Heroicon name: outline/dots-vertical -->
|
|
144
|
+
<svg
|
|
145
|
+
class="h-6 w-6"
|
|
146
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
147
|
+
fill="none"
|
|
148
|
+
viewBox="0 0 24 24"
|
|
149
|
+
stroke-width="2"
|
|
150
|
+
stroke="currentColor"
|
|
151
|
+
aria-hidden="true"
|
|
152
|
+
>
|
|
153
|
+
<path
|
|
154
|
+
stroke-linecap="round"
|
|
155
|
+
stroke-linejoin="round"
|
|
156
|
+
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"
|
|
157
|
+
/>
|
|
158
|
+
</svg>
|
|
159
|
+
</button>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<!--
|
|
163
|
+
Dropdown menu, show/hide based on menu state.
|
|
164
|
+
|
|
165
|
+
Entering: "transition ease-out duration-100"
|
|
166
|
+
From: "transform opacity-0 scale-95"
|
|
167
|
+
To: "transform opacity-100 scale-100"
|
|
168
|
+
Leaving: "transition ease-in duration-75"
|
|
169
|
+
From: "transform opacity-100 scale-100"
|
|
170
|
+
To: "transform opacity-0 scale-95"
|
|
171
|
+
-->
|
|
172
|
+
<div
|
|
173
|
+
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"
|
|
174
|
+
role="menu"
|
|
175
|
+
aria-orientation="vertical"
|
|
176
|
+
aria-labelledby="menu-0-button"
|
|
177
|
+
tabindex="-1"
|
|
178
|
+
>
|
|
179
|
+
<div class="py-1" role="none">
|
|
180
|
+
<!-- Active: "bg-gray-100 text-gray-900", Not Active: "text-gray-700" -->
|
|
181
|
+
<a
|
|
182
|
+
href="#"
|
|
183
|
+
class="block px-4 py-2 text-sm text-gray-700"
|
|
184
|
+
role="menuitem"
|
|
185
|
+
tabindex="-1"
|
|
186
|
+
id="menu-0-item-0"
|
|
187
|
+
>Edit</a
|
|
188
|
+
>
|
|
189
|
+
<a
|
|
190
|
+
href="#"
|
|
191
|
+
class="block px-4 py-2 text-sm text-gray-700"
|
|
192
|
+
role="menuitem"
|
|
193
|
+
tabindex="-1"
|
|
194
|
+
id="menu-0-item-1"
|
|
195
|
+
>Cancel</a
|
|
196
|
+
>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
</div>
|
|
200
|
+
</li>
|
|
201
|
+
|
|
202
|
+
<!-- More meetings... -->
|
|
203
|
+
</ol>
|
|
204
|
+
</section>
|
|
205
|
+
</div>
|
|
206
|
+
</template>
|
|
207
|
+
|
|
208
|
+
<script>
|
|
209
|
+
import * as dayjs from "dayjs";
|
|
210
|
+
|
|
211
|
+
export default {
|
|
212
|
+
name: "CCalendar",
|
|
213
|
+
props: {
|
|
214
|
+
value: {
|
|
215
|
+
type: [String, Date],
|
|
216
|
+
default: () => null,
|
|
217
|
+
},
|
|
218
|
+
eventsCount: {
|
|
219
|
+
type: Array,
|
|
220
|
+
default: () => null,
|
|
221
|
+
},
|
|
222
|
+
eventsData: {
|
|
223
|
+
type: Array,
|
|
224
|
+
default: () => null,
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
data() {
|
|
228
|
+
return {
|
|
229
|
+
activeDate: dayjs(),
|
|
230
|
+
};
|
|
231
|
+
},
|
|
232
|
+
methods: {
|
|
233
|
+
handlePreviousMonthClick() {
|
|
234
|
+
this.activeDate = this.activeDate.subtract(1, "month");
|
|
235
|
+
this.$emit("prev-month", this.getActiveStartAndEndDates());
|
|
236
|
+
},
|
|
237
|
+
handleNextMonthClick() {
|
|
238
|
+
this.activeDate = this.activeDate.add(1, "month");
|
|
239
|
+
this.$emit("next-month", this.getActiveStartAndEndDates());
|
|
240
|
+
},
|
|
241
|
+
getDayFromDate(date) {
|
|
242
|
+
return dayjs(date).format("D");
|
|
243
|
+
},
|
|
244
|
+
isSelected(date) {
|
|
245
|
+
return dayjs(date).isSame(this.value, "day");
|
|
246
|
+
},
|
|
247
|
+
isToday(date) {
|
|
248
|
+
return dayjs(date).isSame(dayjs(), "day");
|
|
249
|
+
},
|
|
250
|
+
isCurrentMonth(date) {
|
|
251
|
+
return dayjs(date).isSame(this.activeDate, "month");
|
|
252
|
+
},
|
|
253
|
+
getDateKey(date) {
|
|
254
|
+
return dayjs(date).format();
|
|
255
|
+
},
|
|
256
|
+
formatForDateTime(date) {
|
|
257
|
+
return dayjs(date).format("YYYY-MM-DD");
|
|
258
|
+
},
|
|
259
|
+
getEventsCountForDate(date) {
|
|
260
|
+
let eventsCountObj = this.eventsCount.find((event) =>
|
|
261
|
+
dayjs(date).isSame(dayjs(event.date))
|
|
262
|
+
);
|
|
263
|
+
if (eventsCountObj) {
|
|
264
|
+
return eventsCountObj.eventsCount;
|
|
265
|
+
} else {
|
|
266
|
+
return 0;
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
getActiveStartAndEndDates() {
|
|
270
|
+
return {
|
|
271
|
+
startDate: this.daysArray[0],
|
|
272
|
+
endDate: this.daysArray[this.daysArray.length - 1],
|
|
273
|
+
};
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
computed: {
|
|
277
|
+
currentMonthAndYear() {
|
|
278
|
+
return dayjs(this.activeDate).format("MMMM YYYY");
|
|
279
|
+
},
|
|
280
|
+
daysArray() {
|
|
281
|
+
let dates = [];
|
|
282
|
+
let firstDayOfmonth = dayjs(this.activeDate).startOf("month");
|
|
283
|
+
let lastDayOfmonth = dayjs(this.activeDate).endOf("month");
|
|
284
|
+
let firstDayOfMonthInWeek = firstDayOfmonth.day();
|
|
285
|
+
let lastDayOfMonthInWeek = lastDayOfmonth.day();
|
|
286
|
+
if (firstDayOfMonthInWeek === 0) {
|
|
287
|
+
firstDayOfMonthInWeek = 7;
|
|
288
|
+
}
|
|
289
|
+
if (lastDayOfMonthInWeek === 0) {
|
|
290
|
+
lastDayOfMonthInWeek = 7;
|
|
291
|
+
}
|
|
292
|
+
for (let i = 0; i < firstDayOfMonthInWeek - 1; i++) {
|
|
293
|
+
dates.unshift(firstDayOfmonth.subtract(i + 1, "day"));
|
|
294
|
+
}
|
|
295
|
+
for (let i = 0; i < dayjs(this.activeDate).daysInMonth(); i++) {
|
|
296
|
+
dates.push(firstDayOfmonth.add(i, "day"));
|
|
297
|
+
}
|
|
298
|
+
let cursor = 1;
|
|
299
|
+
for (let i = lastDayOfMonthInWeek; i < 7; i++) {
|
|
300
|
+
dates.push(lastDayOfmonth.add(cursor, "day"));
|
|
301
|
+
cursor++;
|
|
302
|
+
}
|
|
303
|
+
return dates;
|
|
304
|
+
},
|
|
305
|
+
formattedSelectedDate() {
|
|
306
|
+
return dayjs(this.value ?? dayjs()).format("MMMM D, YYYY");
|
|
307
|
+
},
|
|
308
|
+
selectedDateForDateTime() {
|
|
309
|
+
return dayjs(this.value ?? dayjs()).format("YYYY-MM-DD");
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
mounted() {
|
|
313
|
+
if (this.value) {
|
|
314
|
+
this.activeDate = dayjs(this.value);
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
};
|
|
318
|
+
</script>
|
|
319
|
+
|
|
320
|
+
<style></style>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import CCalendar from "./CCalendar.vue";
|
|
2
|
-
|
|
3
|
-
export default CCalendar;
|
|
1
|
+
import CCalendar from "./CCalendar.vue";
|
|
2
|
+
|
|
3
|
+
export default CCalendar;
|