@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,79 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
<demo-picker :demos="['PxDatePicker', 'PxDropdown']">
|
|
3
|
+
<template #default="{ demoComponent }">
|
|
4
|
+
<component :is="demoComponent" />
|
|
5
|
+
</template>
|
|
6
|
+
</demo-picker>
|
|
7
|
+
-->
|
|
8
|
+
<template>
|
|
9
|
+
<div :class="bem()">
|
|
10
|
+
<div :class="bem('main')">
|
|
11
|
+
<slot name="default" :demoComponent="demoComponent"></slot>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</template>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
import utils from '../../utils/utils.js';
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
name: 'demo-picker',
|
|
21
|
+
// mixins: [],
|
|
22
|
+
// components: {
|
|
23
|
+
// MyComponent
|
|
24
|
+
// },
|
|
25
|
+
props: {
|
|
26
|
+
demos: { type: Array, default: null },
|
|
27
|
+
storageKey: { type: String, default: 'demo' },
|
|
28
|
+
},
|
|
29
|
+
data() {
|
|
30
|
+
return {
|
|
31
|
+
demoComponent: null,
|
|
32
|
+
dropdownVisible: false,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
mounted() {
|
|
36
|
+
const demo = this.getDemoSelection();
|
|
37
|
+
if (demo && demo.trim()) {
|
|
38
|
+
this.setDemoSelection(demo);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
this.demoComponent = demo;
|
|
42
|
+
console.log(this.demoComponent);
|
|
43
|
+
|
|
44
|
+
document.addEventListener('keydown', e => {
|
|
45
|
+
if (e.key == 'F1') {
|
|
46
|
+
this.dropdownVisible = !this.dropdownVisible;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
// watch: {},
|
|
51
|
+
// computed: {}
|
|
52
|
+
methods: {
|
|
53
|
+
setDemoSelection(demo) {
|
|
54
|
+
if (window?.localStorage) {
|
|
55
|
+
window.localStorage.setItem(this.storageKey, demo);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
getDemoSelection() {
|
|
59
|
+
return utils.getQueryParam('demo') || window?.localStorage?.getItem(this.storageKey);
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<style lang="scss">
|
|
66
|
+
// @import '@/styles/include.scss';
|
|
67
|
+
// @import '@/styles/site-utils.scss';
|
|
68
|
+
.demo-picker {
|
|
69
|
+
&__main {
|
|
70
|
+
display: grid;
|
|
71
|
+
min-width: 100vw;
|
|
72
|
+
min-height: 100vh;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&__toolbar {
|
|
76
|
+
background-color: #23272e;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
</style>
|
package/dev/dev.vue
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div id="app">
|
|
3
|
+
<component :is="componentToRender" v-if="componentToRender" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import Vue from 'vue';
|
|
9
|
+
|
|
10
|
+
import PxVueTest from '../components/PxVueTest.vue';
|
|
11
|
+
import DemoPxSlides from './demos/Demo-PxSlides.vue';
|
|
12
|
+
import DemoPxSideDrawer from './demos/Demo-PxSideDrawer.vue';
|
|
13
|
+
import DemoPxCardGrid from './demos/Demo-PxCardGrid.vue';
|
|
14
|
+
import DemoPxSlideTransition from './demos/Demo-PxSlideTransition.vue';
|
|
15
|
+
import DemoPxSwiper from './demos/Demo-PxSwiper.vue';
|
|
16
|
+
import DemoPxBaseDrag from './demos/Demo-PxBaseDrag.vue';
|
|
17
|
+
import DemoPxStylesPreview from './demos/Demo-PxStylesPreview.vue';
|
|
18
|
+
import DemoPxPivot from './demos/Demo-PxPivot.vue';
|
|
19
|
+
|
|
20
|
+
export default Vue.extend({
|
|
21
|
+
components: {
|
|
22
|
+
PxVueTest,
|
|
23
|
+
DemoPxSlides,
|
|
24
|
+
DemoPxSideDrawer,
|
|
25
|
+
DemoPxCardGrid,
|
|
26
|
+
DemoPxSlideTransition,
|
|
27
|
+
DemoPxSwiper,
|
|
28
|
+
DemoPxBaseDrag,
|
|
29
|
+
DemoPxStylesPreview,
|
|
30
|
+
DemoPxPivot,
|
|
31
|
+
},
|
|
32
|
+
name: 'ServeDev',
|
|
33
|
+
data() {
|
|
34
|
+
return {
|
|
35
|
+
componentToRender: null,
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
computed: {},
|
|
39
|
+
mounted() {
|
|
40
|
+
const params = new Proxy(new URLSearchParams(window.location.search), {
|
|
41
|
+
get: (searchParams, prop) => searchParams.get(prop),
|
|
42
|
+
});
|
|
43
|
+
this.componentToRender = params.component || 'PxVueTest';
|
|
44
|
+
console.log(`this.componentToRender: ${this.componentToRender}`);
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
</script>
|
|
48
|
+
<style>
|
|
49
|
+
html,
|
|
50
|
+
body {
|
|
51
|
+
margin: 0;
|
|
52
|
+
padding: 0;
|
|
53
|
+
min-width: 100vw;
|
|
54
|
+
min-height: 100vh;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
package/dev/serve.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
import dev from './dev.vue';
|
|
3
|
+
|
|
4
|
+
import common from '../plugins/common.js';
|
|
5
|
+
Vue.use(common);
|
|
6
|
+
|
|
7
|
+
import commonLib from '../plugins/common-lib.js';
|
|
8
|
+
Vue.use(commonLib);
|
|
9
|
+
|
|
10
|
+
import commonClient from '../plugins/common-client.js';
|
|
11
|
+
Vue.use(commonClient);
|
|
12
|
+
|
|
13
|
+
Vue.config.productionTip = false;
|
|
14
|
+
|
|
15
|
+
new Vue({
|
|
16
|
+
render: h => h(dev),
|
|
17
|
+
}).$mount('#app');
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@thinkpixellab-public/px-vue",
|
|
3
|
+
"version": "3.0.1",
|
|
4
|
+
"description": "General purpose Vue components and helpers that can be used across projects.",
|
|
5
|
+
"author": "Pixel Lab",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/thinkpixellab/px-vue.git"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"serve": "vue-cli-service serve dev/serve.js"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@popperjs/core": "^2.11.5",
|
|
16
|
+
"@thinkpixellab-public/px-styles": "^3.6.2",
|
|
17
|
+
"@thinkpixellab-public/px-vue-tester": "^2.0.0",
|
|
18
|
+
"@thinkpixellab-public/vue-resize-directive": "^1.2.2",
|
|
19
|
+
"body-scroll-lock": "^3.1.5",
|
|
20
|
+
"chrono-node": "^2.3.8",
|
|
21
|
+
"dateformat": "^5.0.3",
|
|
22
|
+
"debounce": "^1.2.1",
|
|
23
|
+
"gsap": "^3.10.4",
|
|
24
|
+
"tiny-date-picker": "^3.2.8",
|
|
25
|
+
"tiny-swiper": "^2.2.0",
|
|
26
|
+
"vue-inline-svg": "^2.1.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@vue/babel-preset-app": "^5.0.1",
|
|
30
|
+
"@vue/cli-plugin-babel": "~4.5.0",
|
|
31
|
+
"@vue/cli-plugin-eslint": "~4.5.0",
|
|
32
|
+
"@vue/cli-service": "~4.5.0",
|
|
33
|
+
"@vue/eslint-config-prettier": "^6.0.0",
|
|
34
|
+
"babel-eslint": "^10.1.0",
|
|
35
|
+
"core-js": "^3.21.1",
|
|
36
|
+
"eslint": "^6.7.2",
|
|
37
|
+
"eslint-plugin-prettier": "^3.3.1",
|
|
38
|
+
"eslint-plugin-vue": "^6.2.2",
|
|
39
|
+
"prettier": "^2.2.1",
|
|
40
|
+
"sass": "^1.49.9",
|
|
41
|
+
"sass-loader": "^8.0.2",
|
|
42
|
+
"vue": "^2.6.14",
|
|
43
|
+
"vue-template-compiler": "^2.6.14"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installs common third-party Vue plugins, directives, filters, etc. Single point of entry for
|
|
3
|
+
* anything that can be "expected" to be there in most projects. This file is specifically for
|
|
4
|
+
* anything that only be loaded on the client (no ssr).
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import resize from '@thinkpixellab-public/vue-resize-directive';
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
install(Vue) {
|
|
11
|
+
Vue.directive('resize', resize);
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installs common custom plugins, directives, filters, etc. Single point of entry for anything that
|
|
3
|
+
* can be "expected" to be there in most projects.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import bem from '../utils/bem';
|
|
7
|
+
import { cssPx, cssEm, cssPcnt, cssUrl } from '../utils/cssStr.js';
|
|
8
|
+
import aspect from './filters/aspect.js';
|
|
9
|
+
import kebab from './filters/kebab.js';
|
|
10
|
+
import slug from './filters/slug.js';
|
|
11
|
+
import spacenator from './filters/spacenator.js';
|
|
12
|
+
import date from './filters/date.js';
|
|
13
|
+
import eventBus from './mixins/eventBus.js';
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
install(Vue) {
|
|
17
|
+
// imported methods
|
|
18
|
+
Vue.prototype.bem = bem;
|
|
19
|
+
Vue.prototype.cssPx = cssPx;
|
|
20
|
+
Vue.prototype.cssEm = cssEm;
|
|
21
|
+
Vue.prototype.cssPcnt = cssPcnt;
|
|
22
|
+
Vue.prototype.cssUrl = cssUrl;
|
|
23
|
+
|
|
24
|
+
// filters
|
|
25
|
+
Vue.filter('aspect', aspect);
|
|
26
|
+
Vue.filter('kebab', kebab);
|
|
27
|
+
Vue.filter('slug', slug);
|
|
28
|
+
Vue.filter('spacenator', spacenator);
|
|
29
|
+
Vue.filter('date', date);
|
|
30
|
+
|
|
31
|
+
// event bus
|
|
32
|
+
eventBus.install(Vue);
|
|
33
|
+
|
|
34
|
+
// other
|
|
35
|
+
Vue.prototype.hasSlot = function (slotName) {
|
|
36
|
+
return this.$slots && slotName in this.$slots;
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Converts an aspect string like '16:9' to it's numeric equivalent (e.g. '16:9' => 16/9 =>
|
|
2
|
+
// 1.77778). If val is not a string, it returns val (so it's safe to pass numbers in because you'll
|
|
3
|
+
// just get the number out).
|
|
4
|
+
|
|
5
|
+
export default val => {
|
|
6
|
+
if (val && typeof val == 'string') {
|
|
7
|
+
let parts = val.split(':');
|
|
8
|
+
if (parts.length == 2) {
|
|
9
|
+
return parseFloat(parts[0]) / parseFloat(parts[1]);
|
|
10
|
+
}
|
|
11
|
+
return parseFloat(val);
|
|
12
|
+
}
|
|
13
|
+
return val;
|
|
14
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Converts a date value or a date string to a date string using toLocaleDateString
|
|
2
|
+
// Options reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat
|
|
3
|
+
//
|
|
4
|
+
// Example: {{ new Date() | date({ month: 'short', day: '2-digit' }) }} => May 18
|
|
5
|
+
|
|
6
|
+
export default (date, options, locale) => {
|
|
7
|
+
if (!date) {
|
|
8
|
+
return '';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (typeof date == 'string') {
|
|
12
|
+
try {
|
|
13
|
+
date = new Date(date);
|
|
14
|
+
} catch {
|
|
15
|
+
return date;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// needs to specically be undefined for it to infer correctly
|
|
20
|
+
locale = locale ? locale : undefined;
|
|
21
|
+
|
|
22
|
+
// no options?
|
|
23
|
+
options = options ? options : {};
|
|
24
|
+
|
|
25
|
+
return date.toLocaleDateString(locale, options);
|
|
26
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Converts a string to it's "slugified" equivalent (replaces spaces and punctuation with dashes,
|
|
2
|
+
// removes weird characters, etc.)
|
|
3
|
+
|
|
4
|
+
export default str => {
|
|
5
|
+
if (!str) {
|
|
6
|
+
return str;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
str = str.replace(/^\s+|\s+$/g, ''); // trim
|
|
10
|
+
str = str.toLowerCase();
|
|
11
|
+
|
|
12
|
+
// remove accents, swap ñ for n, etc
|
|
13
|
+
var from = 'àáäâèéëêìíïîòóöôùúüûñç·/_,:;';
|
|
14
|
+
var to = 'aaaaeeeeiiiioooouuuunc------';
|
|
15
|
+
|
|
16
|
+
for (var i = 0, l = from.length; i < l; i++) {
|
|
17
|
+
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
str = str
|
|
21
|
+
.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
|
|
22
|
+
.replace(/\s+/g, '-') // collapse whitespace and replace by -
|
|
23
|
+
.replace(/-+/g, '-'); // collapse dashes
|
|
24
|
+
|
|
25
|
+
return str;
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Adds non-breaking space character to the end of a string to prevent typographical widows and
|
|
2
|
+
// orphans.
|
|
3
|
+
|
|
4
|
+
export default (str, spaceLength = 8, ignoreLength = 12, nbsp = '\xA0') => {
|
|
5
|
+
if (str.length <= ignoreLength || !spaceLength) {
|
|
6
|
+
return str;
|
|
7
|
+
}
|
|
8
|
+
let sp = Math.max(spaceLength, str.length - str.lastIndexOf(' ') + 1);
|
|
9
|
+
let rep = str.slice(sp * -1).replace(/ /g, nbsp);
|
|
10
|
+
return str.substring(0, str.length - sp) + rep;
|
|
11
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Converts a simple array of strings to an array of string objects that can easily be used with
|
|
3
|
+
PxBaseItems or PxBaseItemsSelect.
|
|
4
|
+
|
|
5
|
+
<px-drop-down :items="['One', 'Two', 'Three'] | stringToItems" />
|
|
6
|
+
|
|
7
|
+
It will also parse a string by commas (and trim the results)...
|
|
8
|
+
|
|
9
|
+
<px-drop-down :items="'apple, orange, strawberry' | stringToItems" />
|
|
10
|
+
|
|
11
|
+
Keys are generated using the slug function, and no attempt is made to prevent duplicates.
|
|
12
|
+
|
|
13
|
+
*/
|
|
14
|
+
import slug from './slug.js';
|
|
15
|
+
|
|
16
|
+
export default (value, delimiter = ',') => {
|
|
17
|
+
if (typeof value == 'string') {
|
|
18
|
+
value = value.split(delimiter).map(s => s.trim());
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return value.map(str => {
|
|
22
|
+
return {
|
|
23
|
+
id: slug(str),
|
|
24
|
+
value: str,
|
|
25
|
+
label: str,
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
install(Vue) {
|
|
3
|
+
if (process.server || Vue.prototype.$eventBus) {
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
Vue.prototype.$eventBus = new Vue();
|
|
8
|
+
|
|
9
|
+
Vue.prototype.$globalEmit = function (eventName, values) {
|
|
10
|
+
if (!this.$eventBus) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
this.$eventBus.$emit(eventName, values);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
Vue.prototype.$globalOn = function (eventName, fn) {
|
|
17
|
+
if (!this.$eventBus) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
this.$eventBus.$on(eventName, fn);
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// forward the library (this has to come first per scss)
|
|
2
|
+
@forward '@thinkpixellab-public/px-styles';
|
|
3
|
+
|
|
4
|
+
// import the library (so we can configure it)
|
|
5
|
+
@use '@thinkpixellab-public/px-styles' as *;
|
|
6
|
+
|
|
7
|
+
// add configuration as needed (this is optional)
|
|
8
|
+
@include config('colors:accent', #5157bd);
|
|
9
|
+
@include config('controls:border-radius', 6px);
|
|
10
|
+
|
|
11
|
+
// initialize
|
|
12
|
+
@include init();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This file contains style helpers that support px-vue components. The file relies on px-styles
|
|
3
|
+
and does emit any css so it can be safely included in any component or other scss file.
|
|
4
|
+
|
|
5
|
+
To import include the following at the top of any scss file:
|
|
6
|
+
|
|
7
|
+
// import px-vue helpers
|
|
8
|
+
@use '@thinkpixellab/px-vue/styles/helpers.scss' as pxvue;
|
|
9
|
+
|
|
10
|
+
And then access mixins from the prefix pxvue (or import as * if you're feeling dangerous).
|
|
11
|
+
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
@use '../styles/px.scss' as *;
|
package/styles/px.scss
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Modified / componentized version of this library: https://github.com/nytimes/text-balancer
|
|
3
|
+
|
|
4
|
+
Changes:
|
|
5
|
+
|
|
6
|
+
1. Use ES6 exports
|
|
7
|
+
|
|
8
|
+
2. Old version was designed to run on it's own (maintain a list of elements to be
|
|
9
|
+
updated and then update them on window resize). We removed all of the resize
|
|
10
|
+
events and collection stuff. Instead, we just export the core function that
|
|
11
|
+
balances a single element.
|
|
12
|
+
|
|
13
|
+
3. Add the "adjust" amount to the final max width to give the text layout a more
|
|
14
|
+
natural look.
|
|
15
|
+
|
|
16
|
+
Usage:
|
|
17
|
+
|
|
18
|
+
import balanceText from '~/utils/balanceText.js';
|
|
19
|
+
balanceText(element);
|
|
20
|
+
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
// HELPER FUNCTION -- initializes recursive binary search
|
|
24
|
+
var balanceText = function (element) {
|
|
25
|
+
if (textElementIsMultipleLines(element)) {
|
|
26
|
+
element.style.maxWidth = '';
|
|
27
|
+
squeezeContainer(element, element.clientHeight, 0, element.clientWidth);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Adjust the final maxwidth by this amount to give a more natural
|
|
32
|
+
// look to the balanced text.
|
|
33
|
+
const ADJUST = 1.15;
|
|
34
|
+
|
|
35
|
+
// Make the headline element as narrow as possible while maintaining
|
|
36
|
+
// its current height (number of lines). Binary search.
|
|
37
|
+
function squeezeContainer(headline, originalHeight, bottomRange, topRange) {
|
|
38
|
+
var mid;
|
|
39
|
+
if (bottomRange >= topRange) {
|
|
40
|
+
headline.style.maxWidth = topRange * ADJUST + 'px';
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
mid = (bottomRange + topRange) / 2;
|
|
44
|
+
headline.style.maxWidth = mid + 'px';
|
|
45
|
+
|
|
46
|
+
if (headline.clientHeight > originalHeight) {
|
|
47
|
+
// we've squoze too far and headline has spilled onto an additional line; recurse on wider range
|
|
48
|
+
squeezeContainer(headline, originalHeight, mid + 1, topRange);
|
|
49
|
+
} else {
|
|
50
|
+
// headline has not wrapped to another line; keep squeezing!
|
|
51
|
+
squeezeContainer(headline, originalHeight, bottomRange + 1, mid);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Function to see if a headline is multiple lines we only want to break if the headline is multiple
|
|
56
|
+
// lines. We achieve this by turning the first word into a span and then we compare the height of
|
|
57
|
+
// that span to the height of the entire headline. If the headline is bigger than the span by 10px
|
|
58
|
+
// we balance the headline.
|
|
59
|
+
function textElementIsMultipleLines(element) {
|
|
60
|
+
if (!element) {
|
|
61
|
+
console.warn('textElementIsMultipleLines called with no element');
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// try to move deeper into the element
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
if (element.nodeType == 1) {
|
|
69
|
+
while (element.firstChild && element.firstChild.nodeType == 1) {
|
|
70
|
+
element = element.firstChild;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
} catch {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var firstWordHeight;
|
|
78
|
+
var elementHeight;
|
|
79
|
+
var HEIGHT_OFFSET;
|
|
80
|
+
var elementWords;
|
|
81
|
+
var firstWord;
|
|
82
|
+
var ORIGINAL_ELEMENT_TEXT;
|
|
83
|
+
|
|
84
|
+
ORIGINAL_ELEMENT_TEXT = element.innerHTML;
|
|
85
|
+
|
|
86
|
+
// Usually there is around a 5px discrepency between the first word and the height of the whole
|
|
87
|
+
// headline so subtract the height of the headline by 10 px and we should be good
|
|
88
|
+
HEIGHT_OFFSET = 10;
|
|
89
|
+
|
|
90
|
+
// Get all the words in the headline as an array -- will include punctuatio. This is used to put
|
|
91
|
+
// the headline back together
|
|
92
|
+
elementWords = element.innerHTML.split(' ');
|
|
93
|
+
|
|
94
|
+
// Make span for first word and give it an id so we can access it in le dom
|
|
95
|
+
firstWord = document.createElement('span');
|
|
96
|
+
firstWord.id = 'element-first-word';
|
|
97
|
+
firstWord.innerHTML = elementWords[0];
|
|
98
|
+
|
|
99
|
+
// This is the entire headline as an array except for first word. We will append it to the
|
|
100
|
+
// headline after the span
|
|
101
|
+
elementWords = elementWords.slice(1);
|
|
102
|
+
|
|
103
|
+
// Empty the headline and append the span to it
|
|
104
|
+
element.innerHTML = '';
|
|
105
|
+
element.appendChild(firstWord);
|
|
106
|
+
|
|
107
|
+
// Add the rest of the element back to it
|
|
108
|
+
element.innerHTML += ' ' + elementWords.join(' ');
|
|
109
|
+
|
|
110
|
+
// Update the first word variable in the dom
|
|
111
|
+
firstWord = document.getElementById('element-first-word');
|
|
112
|
+
|
|
113
|
+
firstWordHeight = firstWord.offsetHeight;
|
|
114
|
+
elementHeight = element.offsetHeight;
|
|
115
|
+
|
|
116
|
+
// Restore the original element text
|
|
117
|
+
element.innerHTML = ORIGINAL_ELEMENT_TEXT;
|
|
118
|
+
|
|
119
|
+
// Compare the height of the element and the height of the first word
|
|
120
|
+
return elementHeight - HEIGHT_OFFSET > firstWordHeight;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export default balanceText;
|