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>();

src/components/Modal/README.stories.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ import {
1414
title="Components / Overlays / Modal"
1515
component={Modal}
1616
argTypes={{
17+
colorScheme: {
18+
table: {
19+
disable: true,
20+
},
21+
},
1722
close: {
1823
description: "Callback when modal is closed",
1924
control: { disable: true },
@@ -132,6 +137,7 @@ export const scrollExample = (args) => ({
132137
template: `
133138
<Modal
134139
:open="active"
140+
:clickOutsideToClose="true"
135141
:primary-action="{ content:'Close', onAction: toggle }"
136142
@close="toggle"
137143
@scrolled-to-bottom="handleScrolledToBottom"
@@ -168,6 +174,7 @@ scrollExample.parameters = {
168174
<Modal
169175
:open="active"
170176
:primary-action="{ content:'Close', onAction: toggle }"
177+
:clickOutsideToClose="true"
171178
@close="toggle"
172179
@scrolled-to-bottom="handleScrolledToBottom"
173180
>

src/components/PageActions/README.stories.mdx

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,23 @@ import { PageActions } from '@/polaris-vue';
1313
},
1414
},
1515
primaryAction: {
16-
table: { type: { summary: 'DisableableAction && LoadableAction' } },
16+
description: 'The primary action for the page',
17+
table: {
18+
category: 'props',
19+
type: { summary: 'DisableableAction && LoadableAction' }
20+
},
1721
control: {
1822
disable: true,
1923
},
2024
},
25+
slotPrimaryAction: {
26+
name: 'primaryAction',
27+
description: 'The primary action for the page. This slot will override the primaryAction prop',
28+
table: {
29+
category: 'slots',
30+
type: { summary: null },
31+
},
32+
}
2133
}}
2234
/>
2335

@@ -68,3 +80,43 @@ Page actions let merchants take key actions at the bottom of specific pages in t
6880
</Canvas>
6981

7082
<ArgsTable story="Page actions" />
83+
84+
---
85+
86+
<br/>
87+
88+
### **DisableableAction & LoadableAction**
89+
90+
| Prop | Type | Description |
91+
| ---------------- | ----------------------------- | --------------- |
92+
| id? | String | A unique identifier for the action. |
93+
| content? | String | Content the action displays. |
94+
| accessibilityLabel? | String | Visually hidden text for screen readers. |
95+
| url? | String | A destination to link to, rendered in the action. |
96+
| external? | String | Forces url to open in a new tab. |
97+
| disabled? | Boolean | Whether or not the action is disabled. |
98+
| loading? | Boolean | Should a spinner be displayed. |
99+
| onAction?() | void | Callback when an action takes place. |
100+
| onMouseEnter?() | void | Callback when mouse enter. |
101+
| onTouchStart?() | void | Callback when element is touched. |
102+
103+
<br/>
104+
105+
### **ComplexAction types**
106+
107+
| Prop | Type | Description |
108+
| ---------------- | ----------------------------- | --------------- |
109+
| id? | String | A unique identifier for the action. |
110+
| content? | String | Content the action displays. |
111+
| accessibilityLabel? | String | Visually hidden text for screen readers. |
112+
| url? | String | A destination to link to, rendered in the action. |
113+
| external? | String | Forces url to open in a new tab. |
114+
| destructive? | Boolean | Destructive action. |
115+
| disabled? | Boolean | Whether or not the action is disabled. |
116+
| icon? | IconSource | Source of the icon. |
117+
| loading? | Boolean | Should a spinner be displayed. |
118+
| outline? | Boolean | Should action be displayed as an outlined button. |
119+
| plain? | Boolean | Should action be displayed as a plain link. |
120+
| onAction?() | void | Callback when an action takes place. |
121+
| onMouseEnter?() | void | Callback when mouse enter. |
122+
| onTouchStart?() | void | Callback when element is touched. |

0 commit comments

Comments
 (0)