@thinkpixellab-public/px-vue 3.0.1
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/.eslintrc.js +14 -0
- package/.prettierrc.js +10 -0
- package/LICENSE.md +9 -0
- package/README.md +83 -0
- package/assets/feather/activity.svg +1 -0
- package/assets/feather/airplay.svg +1 -0
- package/assets/feather/alert-circle.svg +1 -0
- package/assets/feather/alert-octagon.svg +1 -0
- package/assets/feather/alert-triangle.svg +1 -0
- package/assets/feather/align-center.svg +1 -0
- package/assets/feather/align-justify.svg +1 -0
- package/assets/feather/align-left.svg +1 -0
- package/assets/feather/align-right.svg +1 -0
- package/assets/feather/anchor.svg +1 -0
- package/assets/feather/aperture.svg +1 -0
- package/assets/feather/archive.svg +1 -0
- package/assets/feather/arrow-down-circle.svg +1 -0
- package/assets/feather/arrow-down-left.svg +1 -0
- package/assets/feather/arrow-down-right.svg +1 -0
- package/assets/feather/arrow-down.svg +1 -0
- package/assets/feather/arrow-left-circle.svg +1 -0
- package/assets/feather/arrow-left.svg +1 -0
- package/assets/feather/arrow-right-circle.svg +1 -0
- package/assets/feather/arrow-right.svg +1 -0
- package/assets/feather/arrow-up-circle.svg +1 -0
- package/assets/feather/arrow-up-left.svg +1 -0
- package/assets/feather/arrow-up-right.svg +1 -0
- package/assets/feather/arrow-up.svg +1 -0
- package/assets/feather/at-sign.svg +1 -0
- package/assets/feather/award.svg +1 -0
- package/assets/feather/bar-chart-2.svg +1 -0
- package/assets/feather/bar-chart.svg +1 -0
- package/assets/feather/battery-charging.svg +1 -0
- package/assets/feather/battery.svg +1 -0
- package/assets/feather/bell-off.svg +1 -0
- package/assets/feather/bell.svg +1 -0
- package/assets/feather/bluetooth.svg +1 -0
- package/assets/feather/bold.svg +1 -0
- package/assets/feather/book-open.svg +1 -0
- package/assets/feather/book.svg +1 -0
- package/assets/feather/bookmark.svg +1 -0
- package/assets/feather/box.svg +1 -0
- package/assets/feather/briefcase.svg +1 -0
- package/assets/feather/calendar.svg +1 -0
- package/assets/feather/camera-off.svg +1 -0
- package/assets/feather/camera.svg +1 -0
- package/assets/feather/cast.svg +1 -0
- package/assets/feather/check-circle.svg +1 -0
- package/assets/feather/check-square.svg +1 -0
- package/assets/feather/check.svg +1 -0
- package/assets/feather/chevron-down.svg +1 -0
- package/assets/feather/chevron-left.svg +1 -0
- package/assets/feather/chevron-right.svg +1 -0
- package/assets/feather/chevron-up.svg +1 -0
- package/assets/feather/chevrons-down.svg +1 -0
- package/assets/feather/chevrons-left.svg +1 -0
- package/assets/feather/chevrons-right.svg +1 -0
- package/assets/feather/chevrons-up.svg +1 -0
- package/assets/feather/chrome.svg +1 -0
- package/assets/feather/circle.svg +1 -0
- package/assets/feather/clipboard.svg +1 -0
- package/assets/feather/clock.svg +1 -0
- package/assets/feather/cloud-drizzle.svg +1 -0
- package/assets/feather/cloud-lightning.svg +1 -0
- package/assets/feather/cloud-off.svg +1 -0
- package/assets/feather/cloud-rain.svg +1 -0
- package/assets/feather/cloud-snow.svg +1 -0
- package/assets/feather/cloud.svg +1 -0
- package/assets/feather/code.svg +1 -0
- package/assets/feather/codepen.svg +1 -0
- package/assets/feather/codesandbox.svg +1 -0
- package/assets/feather/coffee.svg +1 -0
- package/assets/feather/columns.svg +1 -0
- package/assets/feather/command.svg +1 -0
- package/assets/feather/compass.svg +1 -0
- package/assets/feather/copy.svg +1 -0
- package/assets/feather/corner-down-left.svg +1 -0
- package/assets/feather/corner-down-right.svg +1 -0
- package/assets/feather/corner-left-down.svg +1 -0
- package/assets/feather/corner-left-up.svg +1 -0
- package/assets/feather/corner-right-down.svg +1 -0
- package/assets/feather/corner-right-up.svg +1 -0
- package/assets/feather/corner-up-left.svg +1 -0
- package/assets/feather/corner-up-right.svg +1 -0
- package/assets/feather/cpu.svg +1 -0
- package/assets/feather/credit-card.svg +1 -0
- package/assets/feather/crop.svg +1 -0
- package/assets/feather/crosshair.svg +1 -0
- package/assets/feather/database.svg +1 -0
- package/assets/feather/delete.svg +1 -0
- package/assets/feather/disc.svg +1 -0
- package/assets/feather/divide-circle.svg +1 -0
- package/assets/feather/divide-square.svg +1 -0
- package/assets/feather/divide.svg +1 -0
- package/assets/feather/dollar-sign.svg +1 -0
- package/assets/feather/download-cloud.svg +1 -0
- package/assets/feather/download.svg +1 -0
- package/assets/feather/dribbble.svg +1 -0
- package/assets/feather/droplet.svg +1 -0
- package/assets/feather/edit-2.svg +1 -0
- package/assets/feather/edit-3.svg +1 -0
- package/assets/feather/edit.svg +1 -0
- package/assets/feather/external-link.svg +1 -0
- package/assets/feather/eye-off.svg +1 -0
- package/assets/feather/eye.svg +1 -0
- package/assets/feather/facebook.svg +1 -0
- package/assets/feather/fast-forward.svg +1 -0
- package/assets/feather/feather.svg +1 -0
- package/assets/feather/figma.svg +1 -0
- package/assets/feather/file-minus.svg +1 -0
- package/assets/feather/file-plus.svg +1 -0
- package/assets/feather/file-text.svg +1 -0
- package/assets/feather/file.svg +1 -0
- package/assets/feather/film.svg +1 -0
- package/assets/feather/filter.svg +1 -0
- package/assets/feather/flag.svg +1 -0
- package/assets/feather/folder-minus.svg +1 -0
- package/assets/feather/folder-plus.svg +1 -0
- package/assets/feather/folder.svg +1 -0
- package/assets/feather/framer.svg +1 -0
- package/assets/feather/frown.svg +1 -0
- package/assets/feather/gift.svg +1 -0
- package/assets/feather/git-branch.svg +1 -0
- package/assets/feather/git-commit.svg +1 -0
- package/assets/feather/git-merge.svg +1 -0
- package/assets/feather/git-pull-request.svg +1 -0
- package/assets/feather/github.svg +1 -0
- package/assets/feather/gitlab.svg +1 -0
- package/assets/feather/globe.svg +1 -0
- package/assets/feather/grid.svg +1 -0
- package/assets/feather/hard-drive.svg +1 -0
- package/assets/feather/hash.svg +1 -0
- package/assets/feather/headphones.svg +1 -0
- package/assets/feather/heart.svg +1 -0
- package/assets/feather/help-circle.svg +1 -0
- package/assets/feather/hexagon.svg +1 -0
- package/assets/feather/home.svg +1 -0
- package/assets/feather/image.svg +1 -0
- package/assets/feather/inbox.svg +1 -0
- package/assets/feather/info.svg +1 -0
- package/assets/feather/instagram.svg +1 -0
- package/assets/feather/italic.svg +1 -0
- package/assets/feather/key.svg +1 -0
- package/assets/feather/layers.svg +1 -0
- package/assets/feather/layout.svg +1 -0
- package/assets/feather/life-buoy.svg +1 -0
- package/assets/feather/link-2.svg +1 -0
- package/assets/feather/link.svg +1 -0
- package/assets/feather/linkedin.svg +1 -0
- package/assets/feather/list.svg +1 -0
- package/assets/feather/loader.svg +1 -0
- package/assets/feather/lock.svg +1 -0
- package/assets/feather/log-in.svg +1 -0
- package/assets/feather/log-out.svg +1 -0
- package/assets/feather/mail.svg +1 -0
- package/assets/feather/map-pin.svg +1 -0
- package/assets/feather/map.svg +1 -0
- package/assets/feather/maximize-2.svg +1 -0
- package/assets/feather/maximize.svg +1 -0
- package/assets/feather/meh.svg +1 -0
- package/assets/feather/menu.svg +1 -0
- package/assets/feather/message-circle.svg +1 -0
- package/assets/feather/message-square.svg +1 -0
- package/assets/feather/mic-off.svg +1 -0
- package/assets/feather/mic.svg +1 -0
- package/assets/feather/minimize-2.svg +1 -0
- package/assets/feather/minimize.svg +1 -0
- package/assets/feather/minus-circle.svg +1 -0
- package/assets/feather/minus-square.svg +1 -0
- package/assets/feather/minus.svg +1 -0
- package/assets/feather/monitor.svg +1 -0
- package/assets/feather/moon.svg +1 -0
- package/assets/feather/more-horizontal.svg +1 -0
- package/assets/feather/more-vertical.svg +1 -0
- package/assets/feather/mouse-pointer.svg +1 -0
- package/assets/feather/move.svg +1 -0
- package/assets/feather/music.svg +1 -0
- package/assets/feather/navigation-2.svg +1 -0
- package/assets/feather/navigation.svg +1 -0
- package/assets/feather/octagon.svg +1 -0
- package/assets/feather/package.svg +1 -0
- package/assets/feather/paperclip.svg +1 -0
- package/assets/feather/pause-circle.svg +1 -0
- package/assets/feather/pause.svg +1 -0
- package/assets/feather/pen-tool.svg +1 -0
- package/assets/feather/percent.svg +1 -0
- package/assets/feather/phone-call.svg +1 -0
- package/assets/feather/phone-forwarded.svg +1 -0
- package/assets/feather/phone-incoming.svg +1 -0
- package/assets/feather/phone-missed.svg +1 -0
- package/assets/feather/phone-off.svg +1 -0
- package/assets/feather/phone-outgoing.svg +1 -0
- package/assets/feather/phone.svg +1 -0
- package/assets/feather/pie-chart.svg +1 -0
- package/assets/feather/play-circle.svg +1 -0
- package/assets/feather/play.svg +1 -0
- package/assets/feather/plus-circle.svg +1 -0
- package/assets/feather/plus-square.svg +1 -0
- package/assets/feather/plus.svg +1 -0
- package/assets/feather/pocket.svg +1 -0
- package/assets/feather/power.svg +1 -0
- package/assets/feather/printer.svg +1 -0
- package/assets/feather/radio.svg +1 -0
- package/assets/feather/refresh-ccw.svg +1 -0
- package/assets/feather/refresh-cw.svg +1 -0
- package/assets/feather/repeat.svg +1 -0
- package/assets/feather/rewind.svg +1 -0
- package/assets/feather/rotate-ccw.svg +1 -0
- package/assets/feather/rotate-cw.svg +1 -0
- package/assets/feather/rss.svg +1 -0
- package/assets/feather/save.svg +1 -0
- package/assets/feather/scissors.svg +1 -0
- package/assets/feather/search.svg +1 -0
- package/assets/feather/send.svg +1 -0
- package/assets/feather/server.svg +1 -0
- package/assets/feather/settings.svg +1 -0
- package/assets/feather/share-2.svg +1 -0
- package/assets/feather/share.svg +1 -0
- package/assets/feather/shield-off.svg +1 -0
- package/assets/feather/shield.svg +1 -0
- package/assets/feather/shopping-bag.svg +1 -0
- package/assets/feather/shopping-cart.svg +1 -0
- package/assets/feather/shuffle.svg +1 -0
- package/assets/feather/sidebar.svg +1 -0
- package/assets/feather/skip-back.svg +1 -0
- package/assets/feather/skip-forward.svg +1 -0
- package/assets/feather/slack.svg +1 -0
- package/assets/feather/slash.svg +1 -0
- package/assets/feather/sliders.svg +1 -0
- package/assets/feather/smartphone.svg +1 -0
- package/assets/feather/smile.svg +1 -0
- package/assets/feather/speaker.svg +1 -0
- package/assets/feather/square.svg +1 -0
- package/assets/feather/star.svg +1 -0
- package/assets/feather/stop-circle.svg +1 -0
- package/assets/feather/sun.svg +1 -0
- package/assets/feather/sunrise.svg +1 -0
- package/assets/feather/sunset.svg +1 -0
- package/assets/feather/table.svg +1 -0
- package/assets/feather/tablet.svg +1 -0
- package/assets/feather/tag.svg +1 -0
- package/assets/feather/target.svg +1 -0
- package/assets/feather/terminal.svg +1 -0
- package/assets/feather/thermometer.svg +1 -0
- package/assets/feather/thumbs-down.svg +1 -0
- package/assets/feather/thumbs-up.svg +1 -0
- package/assets/feather/toggle-left.svg +1 -0
- package/assets/feather/toggle-right.svg +1 -0
- package/assets/feather/tool.svg +1 -0
- package/assets/feather/trash-2.svg +1 -0
- package/assets/feather/trash.svg +1 -0
- package/assets/feather/trello.svg +1 -0
- package/assets/feather/trending-down.svg +1 -0
- package/assets/feather/trending-up.svg +1 -0
- package/assets/feather/triangle.svg +1 -0
- package/assets/feather/truck.svg +1 -0
- package/assets/feather/tv.svg +1 -0
- package/assets/feather/twitch.svg +1 -0
- package/assets/feather/twitter.svg +1 -0
- package/assets/feather/type.svg +1 -0
- package/assets/feather/umbrella.svg +1 -0
- package/assets/feather/underline.svg +1 -0
- package/assets/feather/unlock.svg +1 -0
- package/assets/feather/upload-cloud.svg +1 -0
- package/assets/feather/upload.svg +1 -0
- package/assets/feather/user-check.svg +1 -0
- package/assets/feather/user-minus.svg +1 -0
- package/assets/feather/user-plus.svg +1 -0
- package/assets/feather/user-x.svg +1 -0
- package/assets/feather/user.svg +1 -0
- package/assets/feather/users.svg +1 -0
- package/assets/feather/video-off.svg +1 -0
- package/assets/feather/video.svg +1 -0
- package/assets/feather/voicemail.svg +1 -0
- package/assets/feather/volume-1.svg +1 -0
- package/assets/feather/volume-2.svg +1 -0
- package/assets/feather/volume-x.svg +1 -0
- package/assets/feather/volume.svg +1 -0
- package/assets/feather/watch.svg +1 -0
- package/assets/feather/wifi-off.svg +1 -0
- package/assets/feather/wifi.svg +1 -0
- package/assets/feather/wind.svg +1 -0
- package/assets/feather/x-circle.svg +1 -0
- package/assets/feather/x-octagon.svg +1 -0
- package/assets/feather/x-square.svg +1 -0
- package/assets/feather/x.svg +1 -0
- package/assets/feather/youtube.svg +1 -0
- package/assets/feather/zap-off.svg +1 -0
- package/assets/feather/zap.svg +1 -0
- package/assets/feather/zoom-in.svg +1 -0
- package/assets/feather/zoom-out.svg +1 -0
- package/assets/icons/calendar.svg +6 -0
- package/assets/icons/check.svg +1 -0
- package/assets/icons/close-sm.svg +1 -0
- package/assets/icons/close.svg +1 -0
- package/assets/icons/copy.svg +1 -0
- package/assets/icons/dropdown.svg +8 -0
- package/assets/icons/invalid.svg +1 -0
- package/assets/icons/menu.svg +1 -0
- package/assets/icons/nav-next.svg +1 -0
- package/assets/icons/nav-prev.svg +1 -0
- package/assets/icons/sort-asc.svg +1 -0
- package/assets/icons/sort-desc.svg +1 -0
- package/assets/test/README.md +1 -0
- package/assets/test/trash.svg +8 -0
- package/babel.config.js +16 -0
- package/components/PxAspect.vue +127 -0
- package/components/PxAutoClamp.vue +75 -0
- package/components/PxBalancedText.vue +118 -0
- package/components/PxBase.vue +15 -0
- package/components/PxBaseDate.vue +27 -0
- package/components/PxBaseItems.vue +72 -0
- package/components/PxBaseItemsSelect.vue +230 -0
- package/components/PxBaseResize.vue +60 -0
- package/components/PxBaseToggle.vue +56 -0
- package/components/PxBaseVariants.vue +62 -0
- package/components/PxBaseVisible.vue +40 -0
- package/components/PxCalendar.vue +385 -0
- package/components/PxCard.vue +47 -0
- package/components/PxCardGrid.vue +386 -0
- package/components/PxClock.vue +510 -0
- package/components/PxCopyText.vue +78 -0
- package/components/PxDatePicker.vue +249 -0
- package/components/PxDropdown.vue +181 -0
- package/components/PxExpander.vue +46 -0
- package/components/PxFeatherIcon.vue +29 -0
- package/components/PxFeatherIconButton.vue +19 -0
- package/components/PxFit.vue +274 -0
- package/components/PxFlex.vue +93 -0
- package/components/PxFloat.vue +32 -0
- package/components/PxIcon.vue +43 -0
- package/components/PxIconButton.vue +115 -0
- package/components/PxIdUniquer.vue +59 -0
- package/components/PxModal.vue +365 -0
- package/components/PxNineGrid.vue +94 -0
- package/components/PxPivot.vue +207 -0
- package/components/PxPopup.vue +230 -0
- package/components/PxPortal.vue +138 -0
- package/components/PxPortalTarget.vue +25 -0
- package/components/PxProgressCircle.vue +73 -0
- package/components/PxRadioButton.vue +83 -0
- package/components/PxSideDrawer.vue +164 -0
- package/components/PxSlideTransition.vue +116 -0
- package/components/PxSlides.vue +217 -0
- package/components/PxStylesPreview.vue +129 -0
- package/components/PxSvg.vue +157 -0
- package/components/PxSwiper.vue +271 -0
- package/components/PxSwiperSlide.vue +42 -0
- package/components/PxSyncHeight.vue +137 -0
- package/components/PxTable.vue +323 -0
- package/components/PxTabs.vue +1 -0
- package/components/PxTextbox.vue +90 -0
- package/components/PxToggle.vue +125 -0
- package/components/PxToggleButton.vue +139 -0
- package/components/PxToggleButtonList.vue +131 -0
- package/components/PxTransitionExpand.vue +100 -0
- package/components/PxValidator.vue +431 -0
- package/components/PxVueTest.vue +761 -0
- package/components/README.md +0 -0
- package/dev/data/fruits.js +59 -0
- package/dev/data/random.js +13 -0
- package/dev/demos/Demo-PxBaseDrag.vue +94 -0
- package/dev/demos/Demo-PxCardGrid.vue +53 -0
- package/dev/demos/Demo-PxPivot.vue +58 -0
- package/dev/demos/Demo-PxSideDrawer.vue +72 -0
- package/dev/demos/Demo-PxSlideTransition.vue +86 -0
- package/dev/demos/Demo-PxSlides.vue +142 -0
- package/dev/demos/Demo-PxStylesPreview.vue +46 -0
- package/dev/demos/Demo-PxSwiper.vue +44 -0
- package/dev/demos/DemoPicker.vue +79 -0
- package/dev/dev.vue +56 -0
- package/dev/serve.js +17 -0
- package/package.json +45 -0
- package/plugins/common-client.js +13 -0
- package/plugins/common-lib.js +4 -0
- package/plugins/common.js +39 -0
- package/plugins/filters/aspect.js +14 -0
- package/plugins/filters/date.js +26 -0
- package/plugins/filters/kebab.js +9 -0
- package/plugins/filters/phone.js +7 -0
- package/plugins/filters/slug.js +26 -0
- package/plugins/filters/spacenator.js +11 -0
- package/plugins/filters/stringToItems.js +28 -0
- package/plugins/filters/striphtml.js +10 -0
- package/plugins/mixins/eventBus.js +23 -0
- package/px-styles.config.scss +12 -0
- package/styles/helpers.scss +14 -0
- package/styles/px.scss +6 -0
- package/utils/balanceText.js +123 -0
- package/utils/bem.js +99 -0
- package/utils/cardGrid.js +383 -0
- package/utils/cssStr.js +45 -0
- package/utils/drag.js +363 -0
- package/utils/fit.js +73 -0
- package/utils/tween.js +129 -0
- package/utils/utils.js +167 -0
- package/utils/variants.js +33 -0
- package/vue.config.js +12 -0
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="bem()">
|
|
3
|
+
<div :class="['px-clock__time', 'mode-' + mode, { hovering: isHovering }]">
|
|
4
|
+
<div class="px-clock__hour" @click="mode = 'hours'">
|
|
5
|
+
<span>{{ displayHour }}</span>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="px-clock__sep">:</div>
|
|
8
|
+
<div class="px-clock__min" @click="mode = 'minutes'">
|
|
9
|
+
<span>{{ displayMinute }}</span>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="px-clock__period" @click="togglePeriod">
|
|
12
|
+
<div>
|
|
13
|
+
<span :class="{ 'is-selected': selectedPeriod === 'AM' }">AM</span>
|
|
14
|
+
<span :class="{ 'is-selected': selectedPeriod === 'PM' }">PM</span>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<div
|
|
19
|
+
ref="clock"
|
|
20
|
+
:data-hour="hourNumber"
|
|
21
|
+
:data-minute="minuteNumber"
|
|
22
|
+
:data-hover="hoverNumber"
|
|
23
|
+
:class="['px-clock__clock', 'mode-' + mode]"
|
|
24
|
+
>
|
|
25
|
+
<div class="px-clock__hand-hour-hover"></div>
|
|
26
|
+
<div class="px-clock__hand-min-hover"></div>
|
|
27
|
+
|
|
28
|
+
<div class="px-clock__hand-hour-shadow"></div>
|
|
29
|
+
<div class="px-clock__hand-hour"></div>
|
|
30
|
+
|
|
31
|
+
<div
|
|
32
|
+
class="px-clock__hand-min"
|
|
33
|
+
:style="{
|
|
34
|
+
transform: `rotate(${minuteDegrees})`,
|
|
35
|
+
}"
|
|
36
|
+
></div>
|
|
37
|
+
<div class="px-clock__numbers">
|
|
38
|
+
<div
|
|
39
|
+
v-for="(num, index) in numbers"
|
|
40
|
+
:key="index"
|
|
41
|
+
class="px-clock__number"
|
|
42
|
+
@click="select(num)"
|
|
43
|
+
@mouseenter="mouseenter(num)"
|
|
44
|
+
@mouseleave="mouseleave(num)"
|
|
45
|
+
tabindex="0"
|
|
46
|
+
>
|
|
47
|
+
<span>{{ toClockNumber(num) }}</span>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
|
|
54
|
+
<script>
|
|
55
|
+
import PxBaseDate from './PxBaseDate.vue';
|
|
56
|
+
import PxBase from './PxBase.vue';
|
|
57
|
+
export default {
|
|
58
|
+
name: 'px-clock',
|
|
59
|
+
mixins: [PxBase, PxBaseDate],
|
|
60
|
+
props: {
|
|
61
|
+
date: { type: Date, default: null },
|
|
62
|
+
},
|
|
63
|
+
data: function () {
|
|
64
|
+
return {
|
|
65
|
+
mode: 'hours', // 'minutes'
|
|
66
|
+
numbers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
|
|
67
|
+
hoverNumber: -1,
|
|
68
|
+
};
|
|
69
|
+
},
|
|
70
|
+
watch: {
|
|
71
|
+
mode() {
|
|
72
|
+
// require the user to the move the mouse again before we show hover
|
|
73
|
+
// after switching between minutes/hours (slightly less confusing ux)
|
|
74
|
+
this.hoverNumber = -1;
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
computed: {
|
|
78
|
+
// a number (1-12) representing the clock's hour hand number
|
|
79
|
+
hourNumber() {
|
|
80
|
+
return this.dateValue ? this.dateValue.getHours() % 12 || 12 : 12;
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
// a number (1-12) representing the clock's minute hand number
|
|
84
|
+
minuteNumber() {
|
|
85
|
+
return this.dateValue ? Math.round(this.dateValue.getMinutes() / 5) || 12 : 12;
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
// css friendly string representing the angle of the minute hand
|
|
89
|
+
minuteDegrees() {
|
|
90
|
+
let d = this.dateValue ? Math.round(this.dateValue.getMinutes()) * 6 || 360 : 360;
|
|
91
|
+
return d + 'deg';
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
// the display version of the selected hour
|
|
95
|
+
displayHour() {
|
|
96
|
+
if (this.isHovering && this.mode === 'hours') {
|
|
97
|
+
return this.hoverNumber;
|
|
98
|
+
} else {
|
|
99
|
+
if (!this.dateValue) {
|
|
100
|
+
return '12';
|
|
101
|
+
}
|
|
102
|
+
return this.hourNumber; // unless we add 24 hour support, this is the same as hourNumber
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
// the display version of the selected minute
|
|
107
|
+
displayMinute() {
|
|
108
|
+
if (this.isHovering && this.mode === 'minutes') {
|
|
109
|
+
return this.hoverNumber % 12 < 2
|
|
110
|
+
? '0' + (this.hoverNumber % 12) * 5
|
|
111
|
+
: this.hoverNumber * 5;
|
|
112
|
+
} else {
|
|
113
|
+
if (!this.dateValue) {
|
|
114
|
+
return '00';
|
|
115
|
+
}
|
|
116
|
+
const m = this.dateValue.getMinutes();
|
|
117
|
+
return m < 10 ? '0' + m : m;
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
// the period (AM or PM)
|
|
122
|
+
selectedPeriod() {
|
|
123
|
+
if (!this.dateValue) {
|
|
124
|
+
return 'AM';
|
|
125
|
+
}
|
|
126
|
+
return this.dateValue.getHours() < 12 ? 'AM' : 'PM';
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
isHovering() {
|
|
130
|
+
return this.hoverNumber > -1;
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
methods: {
|
|
134
|
+
toClockNumber(num) {
|
|
135
|
+
if (this.mode === 'hours') {
|
|
136
|
+
return num;
|
|
137
|
+
} else {
|
|
138
|
+
return num % 12 < 2 ? '0' + (num % 12) * 5 : num * 5;
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
select(num) {
|
|
142
|
+
let d = this.dateValue ? this.dateValue : new Date(new Date().toDateString());
|
|
143
|
+
|
|
144
|
+
if (this.mode == 'hours') {
|
|
145
|
+
let h = this.selectedPeriod === 'PM' ? (num % 12) + 12 : num % 12;
|
|
146
|
+
this.dateValue = new Date(d.setHours(h));
|
|
147
|
+
setTimeout(() => {
|
|
148
|
+
this.mode = 'minutes';
|
|
149
|
+
}, 400);
|
|
150
|
+
} else {
|
|
151
|
+
this.dateValue = new Date(d.setMinutes((num % 12) * 5));
|
|
152
|
+
setTimeout(() => {
|
|
153
|
+
this.mode = 'hours';
|
|
154
|
+
}, 400);
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
togglePeriod() {
|
|
158
|
+
let h = this.dateValue.getHours();
|
|
159
|
+
|
|
160
|
+
if (this.selectedPeriod === 'AM') {
|
|
161
|
+
this.dateValue = new Date(this.dateValue.setHours(h + 12));
|
|
162
|
+
} else {
|
|
163
|
+
this.dateValue = new Date(this.dateValue.setHours(h - 12));
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
setMode(mode) {
|
|
167
|
+
this.mode = mode;
|
|
168
|
+
},
|
|
169
|
+
mouseenter(num) {
|
|
170
|
+
clearTimeout(this.timeout);
|
|
171
|
+
this.hoverNumber = num;
|
|
172
|
+
},
|
|
173
|
+
mouseleave() {
|
|
174
|
+
clearTimeout(this.timeout);
|
|
175
|
+
this.timeout = setTimeout(() => {
|
|
176
|
+
this.hoverNumber = -1;
|
|
177
|
+
}, 100);
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
</script>
|
|
182
|
+
|
|
183
|
+
<style lang="scss">
|
|
184
|
+
@use '../styles/px.scss' as *;
|
|
185
|
+
.px-clock {
|
|
186
|
+
@include control-reset();
|
|
187
|
+
$clock-color: white;
|
|
188
|
+
$num-size: 2.25em;
|
|
189
|
+
|
|
190
|
+
$hour-color: accent();
|
|
191
|
+
$hour-hover: mix($hour-color, $clock-color, 10%);
|
|
192
|
+
$hour-width: 4px;
|
|
193
|
+
$hour-height: 25%;
|
|
194
|
+
|
|
195
|
+
$min-color: adjust-color(accent(), $hue: 60deg);
|
|
196
|
+
$min-hover: mix($min-color, $clock-color, 10%);
|
|
197
|
+
$min-width: 2px;
|
|
198
|
+
$min-height: 33%;
|
|
199
|
+
|
|
200
|
+
width: 12em;
|
|
201
|
+
|
|
202
|
+
&__clock {
|
|
203
|
+
width: 100%;
|
|
204
|
+
background-color: $clock-color;
|
|
205
|
+
@include aspect-before(1);
|
|
206
|
+
border-radius: 50%;
|
|
207
|
+
position: relative;
|
|
208
|
+
@include no-select();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
&__hand-hour,
|
|
212
|
+
&__hand-hour-hover,
|
|
213
|
+
&__hand-hour-shadow,
|
|
214
|
+
&__hand-min,
|
|
215
|
+
&__hand-min-hover {
|
|
216
|
+
@include abs;
|
|
217
|
+
&:before,
|
|
218
|
+
&:after {
|
|
219
|
+
content: '';
|
|
220
|
+
display: block;
|
|
221
|
+
position: absolute;
|
|
222
|
+
}
|
|
223
|
+
&:before {
|
|
224
|
+
border-radius: 50%;
|
|
225
|
+
top: 50%;
|
|
226
|
+
left: 50%;
|
|
227
|
+
transform: translate(-50%, -50%);
|
|
228
|
+
}
|
|
229
|
+
&:after {
|
|
230
|
+
bottom: 50%;
|
|
231
|
+
left: 50%;
|
|
232
|
+
transform: translateX(-50%);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
&__hand-hour-shadow,
|
|
237
|
+
&__hand-hour-hover,
|
|
238
|
+
&__hand-hour {
|
|
239
|
+
&:before {
|
|
240
|
+
width: $hour-width + 4px;
|
|
241
|
+
height: $hour-width + 4px;
|
|
242
|
+
background-color: $hour-color;
|
|
243
|
+
}
|
|
244
|
+
&:after {
|
|
245
|
+
height: $hour-height;
|
|
246
|
+
width: $hour-width;
|
|
247
|
+
background-color: $hour-color;
|
|
248
|
+
border-radius: $hour-width * 0.5;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
&__hand-hour-hover {
|
|
253
|
+
&:before,
|
|
254
|
+
&:after {
|
|
255
|
+
background-color: $hour-hover;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
&__hand-hour-shadow {
|
|
260
|
+
margin-top: 3px;
|
|
261
|
+
&:before {
|
|
262
|
+
background-color: rgba(black, 0.5);
|
|
263
|
+
box-shadow: 0px 0px 4px black;
|
|
264
|
+
opacity: 0.25;
|
|
265
|
+
}
|
|
266
|
+
&:after {
|
|
267
|
+
background-color: rgba(black, 0.5);
|
|
268
|
+
box-shadow: 0px 0px 4px black;
|
|
269
|
+
opacity: 0.25;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
&__hand-min,
|
|
274
|
+
&__hand-min-hover {
|
|
275
|
+
&:before {
|
|
276
|
+
width: $min-width + 2px;
|
|
277
|
+
height: $min-width + 2px;
|
|
278
|
+
background-color: $min-color;
|
|
279
|
+
}
|
|
280
|
+
&:after {
|
|
281
|
+
height: $min-height;
|
|
282
|
+
width: $min-width;
|
|
283
|
+
background-color: $min-color;
|
|
284
|
+
border-radius: $min-width * 0.5;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
&__hand-min-hover {
|
|
289
|
+
&:before,
|
|
290
|
+
&:after {
|
|
291
|
+
background-color: $min-hover;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// clock numbers
|
|
296
|
+
|
|
297
|
+
&__number {
|
|
298
|
+
width: $num-size;
|
|
299
|
+
height: $num-size;
|
|
300
|
+
margin-top: $num-size * -0.5;
|
|
301
|
+
margin-left: $num-size * -0.5;
|
|
302
|
+
|
|
303
|
+
position: absolute;
|
|
304
|
+
top: 50%;
|
|
305
|
+
left: 50%;
|
|
306
|
+
border-radius: 50%;
|
|
307
|
+
cursor: pointer;
|
|
308
|
+
|
|
309
|
+
//@include transition-props((background-color, color), $dur: 50ms);
|
|
310
|
+
@for $n from 1 through 12 {
|
|
311
|
+
&:nth-child(#{$n}) {
|
|
312
|
+
transform: rotate(#{30 * $n}deg) translateY(-4.75em);
|
|
313
|
+
span {
|
|
314
|
+
width: 100%;
|
|
315
|
+
text-align: center;
|
|
316
|
+
line-height: $num-size;
|
|
317
|
+
display: block;
|
|
318
|
+
transform: rotate(-#{30 * $n}deg);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
&:focus {
|
|
323
|
+
outline: none;
|
|
324
|
+
// background-color: $hour-hover;
|
|
325
|
+
// color: $hour-color;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// clock hands
|
|
330
|
+
.px-clock__hand-min,
|
|
331
|
+
.px-clock__hand-hour,
|
|
332
|
+
.px-clock__hand-hour-shadow {
|
|
333
|
+
transition: transform 400ms $ease-out-cubic;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
&__clock {
|
|
337
|
+
@for $n from 1 through 12 {
|
|
338
|
+
&[data-minute='#{$n}'] {
|
|
339
|
+
.px-clock__hand-min {
|
|
340
|
+
transform: rotate(#{30 * $n}deg);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
&[data-hour='#{$n}'] {
|
|
344
|
+
.px-clock__hand-hour-shadow,
|
|
345
|
+
.px-clock__hand-hour {
|
|
346
|
+
transform: rotate(#{30 * $n}deg);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// clock hover states
|
|
353
|
+
|
|
354
|
+
.px-clock__hand-hour-hover,
|
|
355
|
+
.px-clock__hand-min-hover {
|
|
356
|
+
opacity: 0;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
@mixin clock-hover($hand-sel, $col, $hov) {
|
|
360
|
+
@for $n from 1 through 12 {
|
|
361
|
+
&[data-hover='#{$n}'] {
|
|
362
|
+
.px-clock__number:nth-child(#{$n}) {
|
|
363
|
+
background-color: $hov;
|
|
364
|
+
color: $col;
|
|
365
|
+
}
|
|
366
|
+
#{$hand-sel} {
|
|
367
|
+
opacity: 1;
|
|
368
|
+
transform: rotate(#{30 * $n}deg);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
&__clock.mode-hours {
|
|
375
|
+
@include clock-hover('.px-clock__hand-hour-hover', $hour-color, $hour-hover);
|
|
376
|
+
}
|
|
377
|
+
&__clock.mode-minutes {
|
|
378
|
+
@include clock-hover('.px-clock__hand-min-hover', $min-color, $min-hover);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// text version of time display
|
|
382
|
+
|
|
383
|
+
&__time {
|
|
384
|
+
@include no-select();
|
|
385
|
+
margin-top: sp(1.5);
|
|
386
|
+
display: flex;
|
|
387
|
+
font-size: 2em;
|
|
388
|
+
justify-content: center;
|
|
389
|
+
align-items: center;
|
|
390
|
+
margin-bottom: 0.5em;
|
|
391
|
+
position: relative;
|
|
392
|
+
z-index: 10;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
&__time & {
|
|
396
|
+
&__hour,
|
|
397
|
+
&__min,
|
|
398
|
+
&__period {
|
|
399
|
+
line-height: 1.1;
|
|
400
|
+
height: 1.1em;
|
|
401
|
+
display: block;
|
|
402
|
+
position: relative;
|
|
403
|
+
white-space: normal;
|
|
404
|
+
padding: 0 0.1em;
|
|
405
|
+
border-radius: 3px;
|
|
406
|
+
box-sizing: border-box;
|
|
407
|
+
cursor: pointer;
|
|
408
|
+
@include transition((background-color, color), $dur: 100ms);
|
|
409
|
+
}
|
|
410
|
+
&__hour,
|
|
411
|
+
&__min {
|
|
412
|
+
span {
|
|
413
|
+
white-space: nowrap;
|
|
414
|
+
display: block;
|
|
415
|
+
@include abs(0, 0.1em, 0, 0.1em);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
&__sep {
|
|
420
|
+
line-height: 1;
|
|
421
|
+
border-bottom: 3px solid transparent;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
&__hour {
|
|
425
|
+
text-align: right;
|
|
426
|
+
&:before {
|
|
427
|
+
// derive a fixed size from this
|
|
428
|
+
content: '10';
|
|
429
|
+
color: transparent;
|
|
430
|
+
}
|
|
431
|
+
&:hover {
|
|
432
|
+
background-color: rgba($hour-color, 0.1);
|
|
433
|
+
color: $hour-color;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
&__min {
|
|
438
|
+
text-align: center;
|
|
439
|
+
&:before {
|
|
440
|
+
// derive a fixed size from this
|
|
441
|
+
content: '00';
|
|
442
|
+
color: transparent;
|
|
443
|
+
}
|
|
444
|
+
&:hover {
|
|
445
|
+
background-color: rgba($min-color, 0.1);
|
|
446
|
+
color: $min-color;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
&__hour:after {
|
|
451
|
+
background-color: $hour-color;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
&__min:after {
|
|
455
|
+
background-color: $min-color;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
&__period {
|
|
459
|
+
> div {
|
|
460
|
+
display: flex;
|
|
461
|
+
flex-direction: column;
|
|
462
|
+
align-items: center;
|
|
463
|
+
justify-content: center;
|
|
464
|
+
height: 100%;
|
|
465
|
+
}
|
|
466
|
+
span {
|
|
467
|
+
line-height: 1;
|
|
468
|
+
font-size: 0.4em;
|
|
469
|
+
font-weight: 800;
|
|
470
|
+
display: block;
|
|
471
|
+
opacity: 0.33;
|
|
472
|
+
&.is-selected {
|
|
473
|
+
opacity: 1;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
&__period:hover {
|
|
479
|
+
background-color: rgba($hour-color, 0.1);
|
|
480
|
+
color: $hour-color;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
&__time.mode-hours.hovering {
|
|
485
|
+
.px-clock__hour {
|
|
486
|
+
background-color: rgba($hour-color, 0.1);
|
|
487
|
+
color: $hour-color;
|
|
488
|
+
// border-color: $app-fg;
|
|
489
|
+
// border-bottom-left-radius: 0;
|
|
490
|
+
// border-bottom-right-radius: 0;
|
|
491
|
+
|
|
492
|
+
// border-color: $hour-color;
|
|
493
|
+
// border-bottom-left-radius: 0;
|
|
494
|
+
// border-bottom-right-radius: 0;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
&__time.mode-minutes.hovering {
|
|
499
|
+
.px-clock__min {
|
|
500
|
+
background-color: rgba($min-color, 0.1);
|
|
501
|
+
color: $min-color;
|
|
502
|
+
// border-color: $min-color;
|
|
503
|
+
// border-bottom-left-radius: 0;
|
|
504
|
+
// border-bottom-right-radius: 0;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// adjust colors for minute mode
|
|
509
|
+
}
|
|
510
|
+
</style>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Describe this component...
|
|
3
|
+
-->
|
|
4
|
+
<template>
|
|
5
|
+
<component :class="bem({ active: !!text })" :is="tag" class="px-copy-text" @click="click">
|
|
6
|
+
<slot>
|
|
7
|
+
{{ text }}
|
|
8
|
+
</slot>
|
|
9
|
+
<px-icon :class="iconClass" v-if="showIcon" :src="icon" :size="iconSize" />
|
|
10
|
+
</component>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import PxIcon from './PxIcon.vue';
|
|
15
|
+
// import MyComponent from '~/components/MyComponent.vue';
|
|
16
|
+
export default {
|
|
17
|
+
components: { PxIcon },
|
|
18
|
+
name: 'px-copy-text',
|
|
19
|
+
|
|
20
|
+
props: {
|
|
21
|
+
// will always copy this text even if the slot content has been changed
|
|
22
|
+
text: { type: String, default: '' },
|
|
23
|
+
|
|
24
|
+
// tag to generate
|
|
25
|
+
tag: { type: String, default: 'span' },
|
|
26
|
+
|
|
27
|
+
// show an inline icon after the text
|
|
28
|
+
showIcon: { type: Boolean, default: true },
|
|
29
|
+
icon: { type: String, default: require('../assets/icons/copy.svg') },
|
|
30
|
+
iconSize: { default: 0.8 },
|
|
31
|
+
iconClass: { type: String, default: 'px-copy-text__icon' },
|
|
32
|
+
|
|
33
|
+
// TODO
|
|
34
|
+
|
|
35
|
+
// // show a tooltip hint on hover
|
|
36
|
+
// showHint: { type: Boolean, default: true },
|
|
37
|
+
// hintMessage: { type: String, default: 'Click to copy' },
|
|
38
|
+
|
|
39
|
+
// // show a message after copy
|
|
40
|
+
// showCopied: { type: Boolean, default: true },
|
|
41
|
+
// copiedMessage: { type: String, default: 'Copied' },
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
methods: {
|
|
45
|
+
click() {
|
|
46
|
+
if (!process.server && this.text) {
|
|
47
|
+
navigator?.clipboard?.writeText(this.text);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<style lang="scss">
|
|
55
|
+
@use '../styles/px.scss' as *;
|
|
56
|
+
|
|
57
|
+
.px-copy-text {
|
|
58
|
+
&--active {
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&__icon {
|
|
63
|
+
opacity: 0.5;
|
|
64
|
+
@include transition(transform opacity);
|
|
65
|
+
}
|
|
66
|
+
&:hover & {
|
|
67
|
+
&__icon {
|
|
68
|
+
opacity: 1;
|
|
69
|
+
transform: translateY(-1px);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
&:active & {
|
|
73
|
+
&__icon {
|
|
74
|
+
transform: translateY(1px);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
</style>
|