Skip to content

Commit e26aaa1

Browse files
committed
Chore: v0.8.0
2 parents 22dddb3 + 005c7d6 commit e26aaa1

File tree

16 files changed

+189
-56
lines changed

16 files changed

+189
-56
lines changed

.storybook/stories/Faqs.stories.mdx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,21 @@ We will try to fix this issue in the future.
2828
#### **CSS Variables & Polaris Tokens**
2929

3030
All tokens & variables are following the [Polaris Design Tokens](https://polaris.shopify.com/tokens/all-tokens).
31-
Feel free to change the variables, based on your project scheme.
3231

32+
<br/>
33+
34+
#### **Volar Support**
35+
36+
If you are using Volar, you can specify global component types by configuring `compilerOptions.types` in `tsconfig.json`.
3337

38+
```json
39+
// tsconfig.json
40+
{
41+
"compilerOptions": {
42+
// ...
43+
"types": ["@ownego/polaris-vue/dist/volar"]
44+
}
45+
}
46+
```
3447

3548

.storybook/stories/GetStarted.stories.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { Meta } from '@storybook/addon-docs';
2424

2525
Polaris Vue by Ownego is a component library for [Vue 3](https://vuejs.org/) based on [Shopify Polaris style guide](https://polaris.shopify.com/). We try to keep the package light-weight and easy to use (mostly similar with original Polaris Library).
2626

27-
**Follow Polaris React version:** [9.9.0](https://github.com/Shopify/polaris/releases/tag/v9.9.0) - Migrated date: *May 26th, 2022*.
27+
**Follow Polaris React version:** [9.12.2](https://github.com/Shopify/polaris/releases/tag/%40shopify%2Fpolaris%409.12.2) - Migrated date: *Jun 3rd, 2022*.
2828

2929
<a href="https://github.com/ownego/polaris-vue"><img src="https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white" alt="Github"/></a>
3030

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Polaris Vue by Ownego only supports **Vue 3.0+**.
55
Polaris Vue based on [Shopify Polaris style guide](https://polaris.shopify.com/), built especially for Vue 3.
66
We're trying to make it mostly close with Shopify style guide and get a better performance.
77

8-
**Follow Polaris React version:** [9.9.0](https://github.com/Shopify/polaris/releases/tag/v9.9.0) - Migrated date: *May 26th, 2022*.
8+
**Follow Polaris React version:** [9.12.2](https://github.com/Shopify/polaris/releases/tag/%40shopify%2Fpolaris%409.12.2) - Migrated date: *Jun 3rd, 2022*.
99

1010
<br/>
1111

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ownego/polaris-vue",
3-
"version": "0.7.6",
4-
"polaris_version": "9.9.0",
3+
"version": "0.8.0",
4+
"polaris_version": "9.12.2",
55
"description": "Shopify Polaris UI library for Vue 3",
66
"author": "Ownego Team",
77
"keywords": [

src/classes/Avatar.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"Avatar":"Polaris-Avatar","hidden":"Polaris-Avatar--hidden","sizeExtraSmall":"Polaris-Avatar--sizeExtraSmall","sizeSmall":"Polaris-Avatar--sizeSmall","sizeMedium":"Polaris-Avatar--sizeMedium","sizeLarge":"Polaris-Avatar--sizeLarge","styleOne":"Polaris-Avatar--styleOne","styleTwo":"Polaris-Avatar--styleTwo","styleThree":"Polaris-Avatar--styleThree","styleFour":"Polaris-Avatar--styleFour","styleFive":"Polaris-Avatar--styleFive","hasImage":"Polaris-Avatar--hasImage","Image":"Polaris-Avatar__Image","Initials":"Polaris-Avatar__Initials","Svg":"Polaris-Avatar__Svg"}
1+
{"Avatar":"Polaris-Avatar","hidden":"Polaris-Avatar--hidden","sizeExtraSmall":"Polaris-Avatar--sizeExtraSmall","sizeSmall":"Polaris-Avatar--sizeSmall","sizeMedium":"Polaris-Avatar--sizeMedium","sizeLarge":"Polaris-Avatar--sizeLarge","styleOne":"Polaris-Avatar--styleOne","styleTwo":"Polaris-Avatar--styleTwo","styleThree":"Polaris-Avatar--styleThree","styleFour":"Polaris-Avatar--styleFour","styleFive":"Polaris-Avatar--styleFive","imageHasLoaded":"Polaris-Avatar--imageHasLoaded","Image":"Polaris-Avatar__Image","Initials":"Polaris-Avatar__Initials","Svg":"Polaris-Avatar__Svg"}

src/classes/Image.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Image":"Polaris-Image","isLoading":"Polaris-Image--isLoading"}

src/components/Avatar/Avatar.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ span(
1818
) {{ initials }}
1919
Image(
2020
v-if="source && status !== Status.Errored",
21-
:class="styles.Image",
21+
:class="imageClassName",
2222
:source="source",
2323
alt="",
2424
role="presentation",
@@ -85,10 +85,14 @@ const className = computed(() => {
8585
styles.Avatar,
8686
size && styles[size],
8787
!props.customer && styles[style],
88-
(hasImage.value || (props.initials && props.initials.length === 0))
89-
&& status.value !== 'LOADED'
90-
&& styles.hidden,
91-
hasImage.value && styles.hasImage,
88+
hasImage.value && status.value === 'LOADED' && styles.imageHasLoaded,
89+
);
90+
});
91+
92+
const imageClassName = computed(() => {
93+
return classNames(
94+
styles.Image,
95+
status.value !== 'LOADED' && styles.hidden,
9296
);
9397
});
9498

src/components/Button/ButtonMarkup.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const props = defineProps<Props>();
6666
const attrs = useAttrs();
6767
6868
const listeners = computed(() => {
69-
const events = ['blur', 'click', 'focus', 'keydown', 'keypress', 'keyup', 'mouseover', 'touchstart'];
69+
const events = ['blur', 'click', 'focus', 'keydown', 'keypress', 'keyup', 'mouseover', 'touchstart', 'pointerdown'];
7070
const eventBindings: Record<string, unknown> = {};
7171
for (const event of events) {
7272
const eventName = `on${capitalize(event)}`;

src/components/Image/Image.vue

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
<template lang="pug">
22
img(
3-
v-if="finalSourceSet",
4-
:src="source",
5-
:srcSet="sourceSet",
6-
:crossOrigin="crossOrigin",
7-
)
8-
img(
9-
v-else,
103
:src="source",
4+
:src-set="finalSourceSet ? finalSourceSet : undefined",
115
:crossOrigin="crossOrigin",
6+
:class="className",
7+
@load="handleLoad",
128
)
139
</template>
1410

1511
<script setup lang="ts">
16-
import { computed } from 'vue';
12+
import { computed, onUpdated, ref, watch } from 'vue';
13+
import { classNames } from 'polaris/polaris-react/src/utilities/css';
14+
import styles from '@/classes/Image.json';
1715
1816
interface SourceSet {
1917
source: string;
@@ -29,10 +27,31 @@ interface Props {
2927
}
3028
3129
const props = defineProps<Props>();
30+
const emits = defineEmits<{
31+
(e: 'load'): void;
32+
}>();
33+
34+
const status = ref('loading');
3235
3336
const finalSourceSet = computed(() => props.sourceSet
3437
? props.sourceSet
3538
.map(({ source: subSource, descriptor }) => `${subSource} ${descriptor}`).join(',')
3639
: null,
3740
);
41+
42+
const className = computed(() => {
43+
return classNames(
44+
styles.Image,
45+
status.value === 'loading' && styles.isLoading,
46+
);
47+
});
48+
49+
const handleLoad = () => {
50+
status.value = 'loaded';
51+
emits('load');
52+
};
3853
</script>
54+
55+
<style lang="scss">
56+
@import 'polaris/polaris-react/src/components/Image/Image.scss';
57+
</style>

src/components/Modal/Modal.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ div
6565
key="footer",
6666
)
6767
slot(name="footer")
68-
Backdrop
68+
Backdrop(@click="clickOutsideToClose ? emit('close') : null")
6969
</template>
7070

7171
<script setup lang="ts">
@@ -113,6 +113,8 @@ interface Props {
113113
primaryAction?: ComplexAction;
114114
/** Collection of secondary actions */
115115
secondaryActions?: ComplexAction[];
116+
/** Click or tap the area outside to close the modal */
117+
clickOutsideToClose?: boolean;
116118
}
117119
118120
defineProps<Props>();

0 commit comments

Comments
 (0)