Skip to content

Commit 59c5648

Browse files
committed
Merge remote-tracking branch 'origin/dev'
2 parents ac14002 + b0c0a50 commit 59c5648

File tree

27 files changed

+521
-169
lines changed

27 files changed

+521
-169
lines changed

.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.19.0](https://github.com/Shopify/polaris/releases/tag/%40shopify%2Fpolaris%409.19.0) - Migrated date: *Jun 30th, 2022*.
27+
**Follow Polaris React version:** [9.20.0](https://github.com/Shopify/polaris/releases/tag/%40shopify%2Fpolaris%409.20.0) - Migrated date: *Jul 12th, 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.19.0](https://github.com/Shopify/polaris/releases/tag/%40shopify%2Fpolaris%409.19.0) - Migrated date: *Jun 30th, 2022*.
8+
**Follow Polaris React version:** [9.20.0](https://github.com/Shopify/polaris/releases/tag/%40shopify%2Fpolaris%409.20.0) - Migrated date: *Jul 12th, 2022*.
99

1010
<br/>
1111

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@ownego/polaris-vue",
3-
"version": "1.0.2",
4-
"polaris_version": "9.19.0",
3+
"version": "1.0.3",
4+
"polaris_version": "9.20.0",
55
"description": "Shopify Polaris UI library for Vue 3",
66
"author": "Ownego Team",
77
"keywords": [
@@ -35,15 +35,15 @@
3535
"remove-trashes": "rimraf dist/index.html dist/favicon.ico dist/images"
3636
},
3737
"dependencies": {
38-
"@shopify/polaris-icons": "^4.23.0",
38+
"@shopify/polaris-icons": "^5.0.0",
3939
"vite-svg-loader": "^3.1.2",
4040
"vue": "^3.2.31",
4141
"vue-router": "^3.1.6"
4242
},
4343
"devDependencies": {
4444
"@babel/core": "^7.17.5",
4545
"@rushstack/eslint-patch": "^1.1.0",
46-
"@shopify/polaris-tokens": "^5.4.0",
46+
"@shopify/polaris-tokens": "^5.5.0",
4747
"@shopify/typescript-configs": "^5.1.0",
4848
"@storybook/addon-a11y": "^6.5.5",
4949
"@storybook/addon-actions": "^6.5.5",

src/components/AppProvider/AppProvider.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { provide, ref, onMounted, watch } from 'vue';
1010
import { debounce } from 'polaris/polaris-react/src/utilities/debounce';
1111
import { ScrollLockManager } from 'polaris/polaris-react/src/utilities/scroll-lock-manager/scroll-lock-manager';
1212
import { UniqueIdFactory, globalIdGeneratorFactory } from 'polaris/polaris-react/src/utilities/unique-id/unique-id-factory';
13-
import { navigationBarCollapsed } from 'polaris/polaris-react/src/utilities/breakpoints';
13+
import { navigationBarCollapsed } from '@/utilities/breakpoints';
1414
import { I18n } from '@/utilities/i18n';
1515
import lang from 'polaris/polaris-react/locales/en.json';
1616
import { EventListener, CustomProperties } from '@/components';

src/components/Button/Button.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ interface Props {
148148
* Disclosure button connected right of the button. Toggles a popover action list.
149149
*/
150150
connectedDisclosure?: ConnectedDisclosure;
151+
/** Indicates whether or not the button is the primary navigation link when rendered inside of an `IndexTable.Row` */
152+
dataPrimaryLink?: boolean;
151153
}
152154
153155
const props = withDefaults(defineProps<Props>(), {
@@ -226,7 +228,12 @@ const commonProps = computed(() => {
226228
id, accessibilityLabel, role, ariaDescribedBy,
227229
} = props;
228230
return {
229-
id, class: className.value, accessibilityLabel, role, ariaDescribedBy,
231+
id,
232+
class: className.value,
233+
accessibilityLabel,
234+
role,
235+
ariaDescribedBy,
236+
'data-primary-link': props.dataPrimaryLink,
230237
};
231238
});
232239

src/components/Card/README.stories.mdx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ export const TemplateSimple = (args) => ({
3333
components: { Card },
3434
setup() { return { args }; },
3535
template: `
36-
<Card sectioned :actions="[{content: 'Add variant'}]">
37-
<template #title>Variants</template>
36+
<Card sectioned title="Variants" :actions="[{content: 'Add variant'}]">
3837
<p>Add variants if this product comes in multiple versions, like different sizes or colors.</p>
3938
</Card>
4039
`,
@@ -162,8 +161,7 @@ Cards are used to group similar concepts and tasks together to make Shopify easi
162161
source: {
163162
state: 'close',
164163
code: dedent`
165-
<Card sectioned :actions="[{content: 'Add variant'}]">
166-
<template #title>Variants</template>
164+
<Card sectioned title="Variants" :actions="[{content: 'Add variant'}]">
167165
<p>Add variants if this product comes in multiple versions, like different sizes or colors.</p>
168166
</Card>`,
169167
},

src/components/Checkbox/Checkbox.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ Choice(
77
@mouseover="mouseOver = true",
88
@mouseout="mouseOver = false",
99
)
10-
template(#label, v-if="slots.label")
11-
slot(name="label")
12-
template(#help-text, v-if="slots['help-text']")
13-
slot(name="help-text")
10+
template(#label, v-if="slots.label || label")
11+
slot(v-if="slots.label", name="label")
12+
template(v-else) {{ label }}
13+
template(#help-text, v-if="slots['help-text'] || helpText")
14+
slot(v-if="slots['help-text']", name="help-text")
15+
template(v-else) {{ helpText }}
1416
span(:class="wrapperClassName")
1517
input(
1618
:id="uniqueId",
@@ -58,10 +60,14 @@ interface Props {
5860
ariaControls?: string;
5961
/** Indicates the ID of the element that describes the checkbox */
6062
ariaDescribedBy?: string;
63+
/** Label for the checkbox. This will be overriden by `label` slot. */
64+
label?: string;
6165
/** Visually hide the label */
6266
labelHidden?: boolean;
6367
/** Checkbox is selected. `indeterminate` shows a horizontal line in the checkbox */
6468
checked?: boolean | 'indeterminate';
69+
/** Additional text to aide in use.This will be overriden by `help-text` slot. */
70+
helpText?: string;
6571
/** Disable input */
6672
disabled?: boolean;
6773
/** ID for form input */

src/components/Checkbox/README.stories.mdx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ import { Checkbox } from '@/polaris-vue';
4949
},
5050
},
5151
},
52+
propLabel: {
53+
name: 'label',
54+
description: 'Label for the checkbox. This will be overriden by `label` slot.',
55+
control: {
56+
type: 'text',
57+
},
58+
table: {
59+
category: 'props',
60+
type: {
61+
summary: 'string',
62+
},
63+
},
64+
},
5265
modelValue: {
5366
description: 'v-model is available for this component, string type should be used with multiple checkbox',
5467
control: {
@@ -116,15 +129,17 @@ export const Template = (args) => ({
116129
setup() { return { args }; },
117130
template: `
118131
<div>
132+
<Checkbox label="Basic Label" helpText="Basic help text" v-model="checkboxValue"/>
119133
<Checkbox v-bind="args" v-model="isChecked">
120-
<template #label>Checkbox label</template>
121-
<template #help-text>Basic help text</template>
134+
<template #label>Dynamic checkbox label</template>
135+
<template #help-text>Dynamic help text</template>
122136
</Checkbox>
123137
<p style="margin-top: 30px">Checked: {{ isChecked }} </p>
124138
</div>`,
125139
data() {
126140
return {
127141
isChecked: false,
142+
checkboxValue: false,
128143
};
129144
},
130145
});
@@ -133,9 +148,10 @@ Template.parameters = {
133148
source: {
134149
code: dedent`
135150
<div>
151+
<Checkbox label="Basic Label" helpText="Basic help text" v-model="checkboxValue"/>
136152
<Checkbox v-model="isChecked">
137-
<template #label>Checkbox label</template>
138-
<template #help-text>Basic help text</template>
153+
<template #label>Dynamic checkbox label</template>
154+
<template #help-text>Dynamic help text</template>
139155
</Checkbox>
140156
<p>Checked: {{ isChecked }} </p>
141157
</div>

src/components/Choice/Choice.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ div(v-if="error && typeof error !== 'boolean' || $slots['help-text']")
99
span(:class="styles.Control")
1010
slot
1111
span(:class="styles.Label")
12-
slot(name="label")
12+
slot(v-if="$slots.label", name="label")
13+
template(v-else-if="label") {{ label }}
1314
div(:class="styles.Descriptions")
1415
div(
15-
v-if="$slots['help-text']",
16+
v-if="$slots['help-text'] || helpText",
1617
:id="helpTextID(id)",
1718
:class="styles.HelpText",
1819
)
19-
slot(name="help-text")
20+
slot(v-if="$slots['help-text']", name="help-text")
21+
template(v-else) {{ helpText }}
2022
InlineError(
2123
v-if="(error && typeof error !== 'boolean')",
2224
:fieldID="id",
@@ -32,7 +34,8 @@ label(
3234
span(:class="styles.Control")
3335
slot
3436
span(:class="styles.Label")
35-
slot(name="label")
37+
slot(v-if="$slots.label", name="label")
38+
template(v-else-if="label") {{ label }}
3639
</template>
3740

3841
<script setup lang="ts">
@@ -46,12 +49,16 @@ import { InlineError } from '../InlineError';
4649
interface Props {
4750
/** A unique identifier for the choice */
4851
id: string;
52+
/** Label for the choice */
53+
label?: string;
4954
/** Whether the associated form control is disabled */
5055
disabled?: boolean;
5156
/** Display an error message */
5257
error?: Error;
5358
/** Visually hide the label */
5459
labelHidden?: boolean;
60+
/** Additional text to aide in use */
61+
helpText?: string;
5562
}
5663
5764
const props = defineProps<Props>();

src/components/Combobox/components/TextField/TextField.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ PolarisTextField(
99
:ariaActiveDescendant="activeOptionId",
1010
:ariaControls="listboxId",
1111
:ariaExpanded="expanded",
12+
:label="label",
13+
:helpText="helpText",
14+
:suffix="suffix",
15+
:prefix="prefix",
1216
@focus="handleFocus",
1317
@blur="handleBlur",
1418
@change="handleChange",
@@ -70,6 +74,14 @@ interface TextFieldProps {
7074
placeholder?: string;
7175
/** Initial value for the input */
7276
modelValue?: string;
77+
/** Text to display before value */
78+
prefix?: string;
79+
/** Text to display after value */
80+
suffix?: string;
81+
/** Additional hint text to display */
82+
helpText?: string;
83+
/** Label for the input */
84+
label?: string;
7385
/** Adds an action to the label */
7486
labelAction?: LabelledProps['action'];
7587
/** Visually hide the label */

0 commit comments

Comments
 (0)