@thinkpixellab-public/px-vue 3.0.44 → 4.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/README.md +22 -64
- package/{components → bases}/PxBase.vue +4 -0
- package/bases/PxBaseDate.vue +49 -0
- package/bases/PxBaseIcon.vue +32 -0
- package/bases/PxBaseItems.vue +105 -0
- package/bases/PxBaseItemsSelect.vue +415 -0
- package/{components → bases}/PxBaseMobileAware.vue +4 -2
- package/{components → bases}/PxBaseResize.vue +11 -4
- package/bases/PxBaseScroll.vue +46 -0
- package/bases/PxBaseToggle.vue +67 -0
- package/bases/PxBaseUniqueId.vue +18 -0
- package/{components → bases}/PxBaseVariants.vue +10 -0
- package/{components → bases}/PxBaseVariantsOverride.vue +4 -2
- package/{components → bases}/PxBaseVisible.vue +2 -0
- package/components/PxArrowScroller.vue +9 -7
- package/components/PxAspect.vue +28 -10
- package/components/PxAutoClamp.vue +3 -1
- package/components/PxBalancedText.vue +22 -9
- package/components/PxButton.vue +42 -0
- package/components/PxCalendar.vue +3 -2
- package/components/PxCard.vue +2 -3
- package/components/PxCardGrid.vue +3 -1
- package/components/PxClock.vue +5 -2
- package/components/PxContain.vue +3 -1
- package/components/PxCopyText.vue +6 -2
- package/components/PxDatePicker.vue +6 -4
- package/components/PxDropdown.vue +77 -61
- package/components/PxExpander.vue +36 -20
- package/components/PxFit.vue +4 -1
- package/components/PxFlex.vue +27 -17
- package/components/PxFloat.vue +152 -86
- package/components/PxIcon.vue +88 -15
- package/components/PxIconButton.vue +43 -29
- package/components/PxIdUniquer.vue +5 -1
- package/components/PxModal.vue +1 -0
- package/components/PxNineGrid.vue +4 -0
- package/components/PxPivot.vue +20 -8
- package/components/PxPopup.vue +8 -6
- package/components/PxProgressCircle.vue +3 -3
- package/components/PxQrCode.vue +6 -2
- package/components/PxRadioButton.vue +30 -10
- package/components/PxResizer.vue +207 -0
- package/components/PxSideDrawer.vue +16 -10
- package/components/PxSlideTransition.vue +3 -1
- package/components/PxSlides.vue +4 -3
- package/components/PxSpinner.vue +4 -2
- package/components/PxSvg.vue +97 -45
- package/components/PxSwiperSlide.vue +3 -7
- package/components/PxSyncHeight.vue +3 -0
- package/components/PxTable.vue +8 -2
- package/components/PxToggle.vue +9 -7
- package/components/PxToggleButton.vue +94 -60
- package/components/PxToggleButtonList.vue +61 -38
- package/components/PxTransitionExpand.vue +8 -1
- package/components/PxValidator.vue +5 -2
- package/package.json +37 -29
- package/plugins/common-client.js +19 -8
- package/plugins/common.js +35 -53
- package/plugins/filters/kebab.js +1 -1
- package/plugins/filters/unkebab.js +11 -0
- package/stories/PxAspect.stories.js +62 -0
- package/stories/PxBalancedText.stories.js +57 -0
- package/stories/PxButton.stories.js +44 -0
- package/stories/PxDropdown.stories.js +49 -0
- package/stories/PxExpander.stories.js +31 -0
- package/stories/PxFloat.stories.js +69 -0
- package/stories/PxIcon.mdx +62 -0
- package/stories/PxIcon.stories.js +70 -0
- package/stories/PxPivot.stories.js +38 -0
- package/stories/PxRadioButton.stories.js +33 -0
- package/stories/PxSvg.stories.js +37 -0
- package/stories/PxToggleButton.stories.js +86 -0
- package/stories/PxToggleButtonList.stories.js +97 -0
- package/stories/assets/alpha.svg +6 -0
- package/stories/helpers/extractArgTypes.js +31 -0
- package/stories/helpers/sampleData.js +28 -0
- package/stories/helpers/scratch.vue +30 -0
- package/styles/px.scss +1 -1
- package/test/PxBaseItems.test.js +92 -0
- package/test/PxBaseItemsSelect.test.js +430 -0
- package/utils/getFeatherIcons.js +25 -0
- package/utils/hasSlot.js +9 -0
- package/utils/uniqueId.js +30 -0
- package/vite.config.js +34 -0
- package/assets/icons/calendar.svg +0 -6
- package/assets/icons/check.svg +0 -1
- package/assets/icons/close-sm.svg +0 -1
- package/assets/icons/close.svg +0 -1
- package/assets/icons/copy.svg +0 -1
- package/assets/icons/dropdown.svg +0 -1
- package/assets/icons/invalid.svg +0 -1
- package/assets/icons/menu.svg +0 -1
- package/assets/icons/nav-next.svg +0 -1
- package/assets/icons/nav-prev.svg +0 -1
- package/assets/icons/sort-asc.svg +0 -1
- package/assets/icons/sort-desc.svg +0 -1
- package/assets/test/README.md +0 -1
- package/assets/test/trash.svg +0 -8
- package/components/PxBaseDate.vue +0 -27
- package/components/PxBaseItems.vue +0 -72
- package/components/PxBaseItemsSelect.vue +0 -230
- package/components/PxBaseToggle.vue +0 -56
- package/components/PxFeatherIcon.vue +0 -29
- package/components/PxFeatherIconButton.vue +0 -19
- package/components/PxPortal.vue +0 -138
- package/components/PxPortalTarget.vue +0 -27
- package/components/PxStylesPreview.vue +0 -159
- package/components/PxSwiper.vue +0 -271
- package/components/PxTabs.vue +0 -1
- package/components/PxTextbox.vue +0 -90
- package/components/README.md +0 -0
- package/plugins/common-lib.js +0 -4
- package/plugins/common-vue3.js +0 -60
- package/plugins/mixins/eventBus.js +0 -30
- package/styles/helpers.scss +0 -14
package/README.md
CHANGED
|
@@ -1,83 +1,41 @@
|
|
|
1
1
|
# px-vue
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This template should help get you started developing with Vue 3 in Vite.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Recommended IDE Setup
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
dev.vue. This file can be thought of as a scratch file and shouldn't contain anything that needs to
|
|
9
|
-
be preserved.
|
|
7
|
+
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
|
|
10
8
|
|
|
11
|
-
##
|
|
9
|
+
## Customize configuration
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
See [Vite Configuration Reference](https://vitejs.dev/config/).
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
import PxToggle from '@thinkpixellab-public/px-vue/components/PxToggle.vue';
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Dependency on px-styles
|
|
20
|
-
|
|
21
|
-
#### TLDR;
|
|
22
|
-
|
|
23
|
-
When you import a component in your Vue project you may also need to include a file at the root of your project called `/px-styles.config.scss` that configures px-styles. If that file isn't present, many of the components in this package won't build.
|
|
24
|
-
|
|
25
|
-
The most basic version of this file looks like this:
|
|
26
|
-
|
|
27
|
-
```scss
|
|
28
|
-
/*
|
|
29
|
-
px-styles.config.scss
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
// import the library (so we can configure it)
|
|
33
|
-
@use '@thinkpixellab-public/px-styles' as px;
|
|
34
|
-
|
|
35
|
-
// add configuration as needed (this is optional)
|
|
36
|
-
@include px.config('colors:accent', purple);
|
|
13
|
+
## Project Setup
|
|
37
14
|
|
|
38
|
-
|
|
39
|
-
|
|
15
|
+
```sh
|
|
16
|
+
npm install
|
|
40
17
|
```
|
|
41
18
|
|
|
42
|
-
|
|
19
|
+
### Compile and Hot-Reload for Development
|
|
43
20
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
1. **SomeProject** imports **PxToggle.vue** from **@thinkpixellab\px-vue**
|
|
49
|
-
2. **PxToggle** style section imports **px-styles** from **@thinkpixellab/px-styles**
|
|
50
|
-
3. **px-styles** needs to be configured somehow but that configuration should come from **SomeProject** and sass is really bad at figuring that out dynamically.
|
|
51
|
-
|
|
52
|
-
So, the solution becomes:
|
|
53
|
-
|
|
54
|
-
1. **PxToggle** looks for a file called **px-styles.scss** at the root of **SomeProject** which it expects to do the job of configuring px-styles.
|
|
55
|
-
|
|
56
|
-
Because we use a hard coded path to px-styles.scss, that file will get resolved within the project that is importing the component instead the root of this package.
|
|
21
|
+
```sh
|
|
22
|
+
npm run dev
|
|
23
|
+
```
|
|
57
24
|
|
|
58
|
-
|
|
25
|
+
### Compile and Minify for Production
|
|
59
26
|
|
|
60
|
-
|
|
27
|
+
```sh
|
|
28
|
+
npm run build
|
|
29
|
+
```
|
|
61
30
|
|
|
62
|
-
|
|
63
|
-
const path = require('path');
|
|
31
|
+
### Run Unit Tests with [Vitest](https://vitest.dev/)
|
|
64
32
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
resolve: {
|
|
68
|
-
alias: {
|
|
69
|
-
'@thinkpixellab-public/px-vue': path.resolve(__dirname, '../px-vue'),
|
|
70
|
-
},
|
|
71
|
-
}
|
|
72
|
-
}
|
|
33
|
+
```sh
|
|
34
|
+
npm run test:unit
|
|
73
35
|
```
|
|
74
36
|
|
|
75
|
-
|
|
37
|
+
### Lint with [ESLint](https://eslint.org/)
|
|
76
38
|
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
configureWebpack: {
|
|
80
|
-
// add the config from above
|
|
81
|
-
},
|
|
82
|
-
};
|
|
39
|
+
```sh
|
|
40
|
+
npm run lint
|
|
83
41
|
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
#VUE3 Todo
|
|
3
|
+
-->
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
/**
|
|
7
|
+
* Base class for managing a date-focused component. Exposes a v-model prop called date and a
|
|
8
|
+
* synced data value called dateValue. Both the v-model and :sync should work for two-way binding.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
model: {
|
|
13
|
+
prop: 'date',
|
|
14
|
+
event: 'changed',
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
props: {
|
|
18
|
+
/**
|
|
19
|
+
* Publicly exposed date property (use .dateValue if modifying internally).
|
|
20
|
+
*/
|
|
21
|
+
date: { type: Date, default: null },
|
|
22
|
+
},
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
dateValue: this.date,
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
watch: {
|
|
29
|
+
date: {
|
|
30
|
+
handler(nv) {
|
|
31
|
+
this.dateValue = nv;
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
dateValue(nv) {
|
|
35
|
+
/**
|
|
36
|
+
* Fired when the date changes. Expected to primarily be used for :sync scenarios.
|
|
37
|
+
* @property {Date} nv The new date value.
|
|
38
|
+
*/
|
|
39
|
+
this.$emit('update:date', nv);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Fired when the date changes.
|
|
43
|
+
* @property {Date} nv The new date value.
|
|
44
|
+
*/
|
|
45
|
+
this.$emit('changed', nv);
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
</script>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
#VUE3 Todo
|
|
3
|
+
-->
|
|
4
|
+
|
|
5
|
+
<!--
|
|
6
|
+
Adds properties that describe an icon that will ultimately be used with PxIcon. This can be used
|
|
7
|
+
as a mixin or just a guide for the correct pattern for expose PxIcon properties on a parent
|
|
8
|
+
component.
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
|
|
12
|
+
<my-component>
|
|
13
|
+
<px-icon :icon="icon" v-bind="iconProps" />
|
|
14
|
+
</my-component>
|
|
15
|
+
|
|
16
|
+
-->
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
export default {
|
|
20
|
+
props: {
|
|
21
|
+
/**
|
|
22
|
+
* The icon for the component, either the name of an app-level icon or else the svg src for an icon.
|
|
23
|
+
*/
|
|
24
|
+
icon: { type: String, default: null },
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Additional customization for the icon (an object containing attributes that will be bound on the PxIcon instance). (see PxIcon for details).
|
|
28
|
+
*/
|
|
29
|
+
iconProps: { type: Object, default: null },
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
#VUE3 Done (has breaking changes)
|
|
3
|
+
|
|
4
|
+
Provides basic items services for controls that maintain lists of items.
|
|
5
|
+
|
|
6
|
+
-->
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
function getFromItem(item, propOrFunc) {
|
|
10
|
+
if (!item) {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (typeof propOrFunc == 'string' && propOrFunc in item) {
|
|
15
|
+
return item[propOrFunc];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (typeof propOrFunc == 'function') {
|
|
19
|
+
return propOrFunc(item);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default {
|
|
26
|
+
props: {
|
|
27
|
+
items: { type: Array },
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Value needed to get a unique id from a given item. Can either be a string representing
|
|
31
|
+
* the property name or a function that takes the item and returns the id.
|
|
32
|
+
*/
|
|
33
|
+
itemsKey: { type: [String, Function], default: 'id' },
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Value needed to get a string representation (label) for a given item. Can either be a
|
|
37
|
+
* string representing the property name or a function that takes the item and returns the id.
|
|
38
|
+
*/
|
|
39
|
+
itemsLabel: { type: [String, Function], default: 'label' },
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Value needed to determine whether an item has been disabled. Can either be a string
|
|
43
|
+
* representing the property name or a function that takes the item and returns the id.
|
|
44
|
+
*/
|
|
45
|
+
itemsDisabled: { type: [String, Function], default: 'disabled' },
|
|
46
|
+
},
|
|
47
|
+
computed: {
|
|
48
|
+
itemKeys() {
|
|
49
|
+
if (this.items && Array.isArray(this.items)) {
|
|
50
|
+
return this.items.map(item => this.getItemKey(item));
|
|
51
|
+
}
|
|
52
|
+
return [];
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
methods: {
|
|
56
|
+
getItem(key) {
|
|
57
|
+
if (typeof key !== 'undefined') {
|
|
58
|
+
return this.items.find(item => this.getItemKey(item) === key);
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
getItemKey(item) {
|
|
64
|
+
if (!this.isValidItem(item)) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
return getFromItem(item, this.itemsKey);
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
getItemLabel(item) {
|
|
71
|
+
if (!this.isValidItem(item)) {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
return getFromItem(item, this.itemsLabel);
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
getItemDisabled(item) {
|
|
78
|
+
if (!this.isValidItem(item)) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
return getFromItem(item, this.itemsDisabled);
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
getItemKeyLabel(key) {
|
|
85
|
+
const item = this.getItem(key);
|
|
86
|
+
if (item) {
|
|
87
|
+
return this.getItemLabel(item);
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
getItemKeyIndex(key) {
|
|
93
|
+
return (this.items || []).indexOf(this.getItem(key));
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
isValidItem(item) {
|
|
97
|
+
return !!this.items.includes(item);
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
isValidItemKey(key) {
|
|
101
|
+
return !!this.itemKeys.includes(key);
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
</script>
|