Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
juzser committed Aug 27, 2022
2 parents 7c16a23 + 5a66ac4 commit ed814c4
Show file tree
Hide file tree
Showing 55 changed files with 683 additions and 484 deletions.
2 changes: 1 addition & 1 deletion .postcssrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
generateScopedName: classConfig,
getJSON: (cssFileName, json) => {
/* Ignore generate common polaris tokens style file */
if (cssFileName.indexOf('@shopify/polaris-tokens') !== -1 || cssFileName.indexOf('CustomProperties') !== -1) {
if (cssFileName.indexOf('@shopify/polaris-tokens') !== -1) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion .storybook/stories/GetStarted.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { Meta } from '@storybook/addon-docs';

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).

**Follow Polaris React version:** [9.23.1](https://github.com/Shopify/polaris/releases/tag/%40shopify%2Fpolaris%409.23.1) - Migrated date: *Aug 18th, 2022*.
**Follow Polaris React version:** [10.0.0](https://github.com/Shopify/polaris/releases/tag/%40shopify%2Fpolaris%4010.0.0) - Migrated date: *Aug 27th, 2022*.

<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>

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Polaris Vue by Ownego only supports **Vue 3.0+**.
Polaris Vue based on [Shopify Polaris style guide](https://polaris.shopify.com/), built especially for Vue 3.
We're trying to make it mostly close with Shopify style guide and get a better performance.

**Follow Polaris React version:** [9.23.1](https://github.com/Shopify/polaris/releases/tag/%40shopify%2Fpolaris%409.23.1) - Migrated date: *Aug 18th, 2022*.
**Follow Polaris React version:** [10.0.0](https://github.com/Shopify/polaris/releases/tag/%40shopify%2Fpolaris%4010.0.0) - Migrated date: *Aug 27th, 2022*.

<br/>

Expand Down
2 changes: 1 addition & 1 deletion build/namespaced-classname.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const NESTED_COMPONENT_PATH_REGEX = /.*\/components\/(.*)\/components/;
const scopedHashes = {};

module.exports = function generateScopedName(name, filename, css) {
if (filename.includes('@shopify/polaris-tokens') || filename.includes('CustomProperties')) {
if (filename.includes('@shopify/polaris-tokens')) {
return name;
}

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@ownego/polaris-vue",
"version": "1.0.6",
"polaris_version": "9.23.1",
"version": "1.1.0",
"polaris_version": "10.0.0",
"description": "Shopify Polaris UI library for Vue 3",
"author": "Ownego Team",
"keywords": [
Expand Down Expand Up @@ -44,7 +44,7 @@
"devDependencies": {
"@babel/core": "^7.17.5",
"@rushstack/eslint-patch": "^1.1.0",
"@shopify/polaris-tokens": "^5.5.1",
"@shopify/polaris-tokens": "^6.0.0",
"@shopify/typescript-configs": "^5.1.0",
"@storybook/addon-a11y": "^6.5.5",
"@storybook/addon-actions": "^6.5.5",
Expand Down
2 changes: 1 addition & 1 deletion src/classes/IndexTable.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"IndexTable":"Polaris-IndexTable","LoadingContainer-enter":"Polaris-IndexTable__LoadingContainer--enter","LoadingContainer-enter-active":"Polaris-IndexTable--loadingContainerEnterActive","LoadingContainer-exit":"Polaris-IndexTable__LoadingContainer--exit","LoadingContainer-exit-active":"Polaris-IndexTable--loadingContainerExitActive","LoadingPanel":"Polaris-IndexTable__LoadingPanel","LoadingPanelRow":"Polaris-IndexTable__LoadingPanelRow","LoadingPanelText":"Polaris-IndexTable__LoadingPanelText","Table":"Polaris-IndexTable__Table","Table-scrolling":"Polaris-IndexTable__Table--scrolling","TableCell-first":"Polaris-IndexTable__TableCell--first","TableCell":"Polaris-IndexTable__TableCell","TableHeading-first":"Polaris-IndexTable__TableHeading--first","TableHeading-second":"Polaris-IndexTable__TableHeading--second","Table-unselectable":"Polaris-IndexTable__Table--unselectable","TableRow":"Polaris-IndexTable__TableRow","TableRow-unclickable":"Polaris-IndexTable__TableRow--unclickable","statusSuccess":"Polaris-IndexTable--statusSuccess","statusSubdued":"Polaris-IndexTable--statusSubdued","TableRow-hovered":"Polaris-IndexTable__TableRow--hovered","TableRow-selected":"Polaris-IndexTable__TableRow--selected","TableRow-subdued":"Polaris-IndexTable__TableRow--subdued","TableRow-disabled":"Polaris-IndexTable__TableRow--disabled","TableHeading":"Polaris-IndexTable__TableHeading","TableHeading-flush":"Polaris-IndexTable__TableHeading--flush","ColumnHeaderCheckboxWrapper":"Polaris-IndexTable__ColumnHeaderCheckboxWrapper","FirstStickyHeaderElement":"Polaris-IndexTable__FirstStickyHeaderElement","TableHeading-unselectable":"Polaris-IndexTable__TableHeading--unselectable","TableCell-flush":"Polaris-IndexTable__TableCell--flush","Table-sticky-scrolling":"Polaris-IndexTable--tableStickyScrolling","TableHeading-last":"Polaris-IndexTable__TableHeading--last","Table-sticky-last":"Polaris-IndexTable--tableStickyLast","StickyTable":"Polaris-IndexTable__StickyTable","StickyTableHeader":"Polaris-IndexTable__StickyTableHeader","StickyTableHeader-isSticky":"Polaris-IndexTable__StickyTableHeader--isSticky","StickyTableColumnHeader":"Polaris-IndexTable__StickyTableColumnHeader","StickyTableColumnHeader-isScrolling":"Polaris-IndexTable__StickyTableColumnHeader--isScrolling","StickyTableHeadings":"Polaris-IndexTable__StickyTableHeadings","StickyTableHeading-second":"Polaris-IndexTable__StickyTableHeading--second","unselectable":"Polaris-IndexTable--unselectable","StickyTableHeading-second-scrolling":"Polaris-IndexTable--stickyTableHeadingSecondScrolling","ScrollLeft":"Polaris-IndexTable__ScrollLeft","ScrollRight":"Polaris-IndexTable__ScrollRight","ScrollRight-onboarding":"Polaris-IndexTable__ScrollRight--onboarding","BulkActionsWrapper":"Polaris-IndexTable__BulkActionsWrapper","ScrollBarContainer":"Polaris-IndexTable__ScrollBarContainer","scrollBarContainerCondensed":"Polaris-IndexTable--scrollBarContainerCondensed","scrollBarContainerHidden":"Polaris-IndexTable--scrollBarContainerHidden","ScrollBar":"Polaris-IndexTable__ScrollBar","disableTextSelection":"Polaris-IndexTable--disableTextSelection","selectMode":"Polaris-IndexTable--selectMode","EmptySearchResultWrapper":"Polaris-IndexTable__EmptySearchResultWrapper","condensedRow":"Polaris-IndexTable--condensedRow","CondensedList":"Polaris-IndexTable__CondensedList","HeaderWrapper":"Polaris-IndexTable__HeaderWrapper","StickyTable-condensed":"Polaris-IndexTable__StickyTable--condensed","StickyTableHeader-condensed":"Polaris-IndexTable__StickyTableHeader--condensed","ScrollBarContent":"Polaris-IndexTable__ScrollBarContent"}
{"IndexTable":"Polaris-IndexTable","LoadingContainer-enter":"Polaris-IndexTable__LoadingContainer--enter","LoadingContainer-enter-active":"Polaris-IndexTable--loadingContainerEnterActive","LoadingContainer-exit":"Polaris-IndexTable__LoadingContainer--exit","LoadingContainer-exit-active":"Polaris-IndexTable--loadingContainerExitActive","LoadingPanel":"Polaris-IndexTable__LoadingPanel","LoadingPanelRow":"Polaris-IndexTable__LoadingPanelRow","LoadingPanelText":"Polaris-IndexTable__LoadingPanelText","Table":"Polaris-IndexTable__Table","Table-scrolling":"Polaris-IndexTable__Table--scrolling","TableCell-first":"Polaris-IndexTable__TableCell--first","TableCell":"Polaris-IndexTable__TableCell","TableHeading-first":"Polaris-IndexTable__TableHeading--first","TableHeading-second":"Polaris-IndexTable__TableHeading--second","Table-unselectable":"Polaris-IndexTable__Table--unselectable","TableRow":"Polaris-IndexTable__TableRow","TableRow-unclickable":"Polaris-IndexTable__TableRow--unclickable","statusSuccess":"Polaris-IndexTable--statusSuccess","statusSubdued":"Polaris-IndexTable--statusSubdued","TableRow-hovered":"Polaris-IndexTable__TableRow--hovered","TableRow-selected":"Polaris-IndexTable__TableRow--selected","TableRow-subdued":"Polaris-IndexTable__TableRow--subdued","TableRow-disabled":"Polaris-IndexTable__TableRow--disabled","TableHeading":"Polaris-IndexTable__TableHeading","TableHeading-sortable":"Polaris-IndexTable__TableHeading--sortable","TableHeading-flush":"Polaris-IndexTable__TableHeading--flush","TableHeadingSortButton":"Polaris-IndexTable__TableHeadingSortButton","TableHeadingSortIcon":"Polaris-IndexTable__TableHeadingSortIcon","TableHeadingSortIcon-visible":"Polaris-IndexTable__TableHeadingSortIcon--visible","ColumnHeaderCheckboxWrapper":"Polaris-IndexTable__ColumnHeaderCheckboxWrapper","FirstStickyHeaderElement":"Polaris-IndexTable__FirstStickyHeaderElement","TableHeading-unselectable":"Polaris-IndexTable__TableHeading--unselectable","TableCell-flush":"Polaris-IndexTable__TableCell--flush","Table-sticky-scrolling":"Polaris-IndexTable--tableStickyScrolling","TableHeading-last":"Polaris-IndexTable__TableHeading--last","Table-sticky-last":"Polaris-IndexTable--tableStickyLast","StickyTable":"Polaris-IndexTable__StickyTable","StickyTableHeader":"Polaris-IndexTable__StickyTableHeader","StickyTableHeader-isSticky":"Polaris-IndexTable__StickyTableHeader--isSticky","StickyTableColumnHeader":"Polaris-IndexTable__StickyTableColumnHeader","StickyTableColumnHeader-isScrolling":"Polaris-IndexTable__StickyTableColumnHeader--isScrolling","StickyTableHeadings":"Polaris-IndexTable__StickyTableHeadings","StickyTableHeading-second":"Polaris-IndexTable__StickyTableHeading--second","unselectable":"Polaris-IndexTable--unselectable","StickyTableHeading-second-scrolling":"Polaris-IndexTable--stickyTableHeadingSecondScrolling","ScrollLeft":"Polaris-IndexTable__ScrollLeft","ScrollRight":"Polaris-IndexTable__ScrollRight","ScrollRight-onboarding":"Polaris-IndexTable__ScrollRight--onboarding","BulkActionsWrapper":"Polaris-IndexTable__BulkActionsWrapper","ScrollBarContainer":"Polaris-IndexTable__ScrollBarContainer","scrollBarContainerCondensed":"Polaris-IndexTable--scrollBarContainerCondensed","scrollBarContainerHidden":"Polaris-IndexTable--scrollBarContainerHidden","ScrollBar":"Polaris-IndexTable__ScrollBar","disableTextSelection":"Polaris-IndexTable--disableTextSelection","selectMode":"Polaris-IndexTable--selectMode","EmptySearchResultWrapper":"Polaris-IndexTable__EmptySearchResultWrapper","condensedRow":"Polaris-IndexTable--condensedRow","CondensedList":"Polaris-IndexTable__CondensedList","HeaderWrapper":"Polaris-IndexTable__HeaderWrapper","StickyTable-condensed":"Polaris-IndexTable__StickyTable--condensed","StickyTableHeader-condensed":"Polaris-IndexTable__StickyTableHeader--condensed","ScrollBarContent":"Polaris-IndexTable__ScrollBarContent"}
1 change: 1 addition & 0 deletions src/classes/InlineCode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Code":"Polaris-InlineCode__Code"}
1 change: 1 addition & 0 deletions src/classes/Text.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"root":"Polaris-Text--root","block":"Polaris-Text--block","truncate":"Polaris-Text--truncate","visuallyHidden":"Polaris-Text--visuallyHidden","start":"Polaris-Text--start","center":"Polaris-Text--center","end":"Polaris-Text--end","justify":"Polaris-Text--justify","success":"Polaris-Text--success","critical":"Polaris-Text--critical","warning":"Polaris-Text--warning","subdued":"Polaris-Text--subdued","regular":"Polaris-Text--regular","medium":"Polaris-Text--medium","semibold":"Polaris-Text--semibold","bold":"Polaris-Text--bold","headingXs":"Polaris-Text--headingXs","headingSm":"Polaris-Text--headingSm","headingMd":"Polaris-Text--headingMd","headingLg":"Polaris-Text--headingLg","headingXl":"Polaris-Text--headingXl","heading2xl":"Polaris-Text--heading2xl","heading3xl":"Polaris-Text--heading3xl","heading4xl":"Polaris-Text--heading4xl","bodySm":"Polaris-Text--bodySm","bodyMd":"Polaris-Text--bodyMd","bodyLg":"Polaris-Text--bodyLg"}
27 changes: 5 additions & 22 deletions src/components/AppProvider/AppProvider.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
<template lang="pug">
CustomProperties(:color-scheme="colorScheme")
.polaris-app-provider
EventListener(event="resize", :handler="handleResize")
slot
#PolarisPortalsContainer
component(is="style") {{ style }}
</template>

<script setup lang="ts">
import { provide, ref, onMounted, watch } from 'vue';
import { provide, ref, onMounted } from 'vue';
import { debounce } from 'polaris/polaris-react/src/utilities/debounce';
import { ScrollLockManager } from 'polaris/polaris-react/src/utilities/scroll-lock-manager/scroll-lock-manager';
import { UniqueIdFactory, globalIdGeneratorFactory } from 'polaris/polaris-react/src/utilities/unique-id/unique-id-factory';
import { navigationBarCollapsed } from '@/utilities/breakpoints';
import { I18n } from '@/utilities/i18n';
import lang from 'polaris/polaris-react/locales/en.json';
import { EventListener, CustomProperties } from '@/components';
import { EventListener } from '@/components';
import { PortalManager } from '@/utilities/portal-manager';
import { FocusManager } from '@/utilities/focus-manager';
import { StickyManager } from '@/utilities/sticky-manager';
import type { CustomPropertiesProps } from '../CustomProperties/utils';
import { DEFAULT_COLOR_SCHEME } from '../CustomProperties/utils';
const props = defineProps({
colorScheme: {
type: String as () => CustomPropertiesProps['colorScheme'],
default: DEFAULT_COLOR_SCHEME,
},
});
import style from '@shopify/polaris-tokens/css/styles.css?raw';
const stickyManager = new StickyManager();
Expand All @@ -42,7 +35,6 @@ const isNavigationCollapsed = ref(navigationBarCollapsed().matches);
const setBodyStyles = () => {
// Inlining the following custom properties to maintain backward
// compatibility with the legacy ThemeProvider implementation.
document.body.setAttribute('p-color-scheme', props.colorScheme || DEFAULT_COLOR_SCHEME);
document.body.style.backgroundColor = 'var(--p-background)';
document.body.style.color = 'var(--p-text)';
};
Expand All @@ -57,15 +49,6 @@ const handleResize = debounce(
{trailing: true, leading: true, maxWait: 40},
);
watch(
() => props.colorScheme,
(newColorScheme: CustomPropertiesProps['colorScheme'], oldColorScheme: CustomPropertiesProps['colorScheme']) => {
if (newColorScheme !== oldColorScheme) {
setBodyStyles();
}
},
);
onMounted(() => {
if (document !== null) {
setBodyStyles();
Expand Down
5 changes: 5 additions & 0 deletions src/components/Autocomplete/Autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ const isShowEmptyState = computed(() => {
});
const updateSelection = (newSelection: string) => {
if (props.actionBefore && newSelection === props.actionBefore.content) {
props.actionBefore.onAction && props.actionBefore.onAction();
return;
}
if (props.allowMultiple) {
if (props.modelValue.includes(newSelection)) {
emits('select', props.modelValue.filter((option) => option !== newSelection));
Expand Down
3 changes: 3 additions & 0 deletions src/components/ChoiceList/ChoiceList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fieldset(
component(
:is="allowMultiple ? Checkbox : RadioButton",
:name="finalName",
:id="id",
:value="choice.value",
:checked="isChoiceSelected(choice)",
:disabled="choice.disabled || disabled",
Expand Down Expand Up @@ -72,6 +73,8 @@ interface Props {
titleHidden?: boolean;
/** Display an error message */
error?: ErrorType;
/** A unique identifier for the choice */
id?: string;
/** Disable all choices */
disabled?: boolean;
}
Expand Down
11 changes: 2 additions & 9 deletions src/components/Combobox/Combobox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const activeOptionId = ref('');
const textFieldLabelId = ref('');
const listboxId = ref('');
const textFieldFocused = ref(false);
const disableCloseOnSelect = ref(false);
const popoverRef = ref(null);
const slots = useSlots();
Expand All @@ -58,10 +57,8 @@ const shouldOpen = computed(() => !popoverActive.value && defaultSlot);
const willLoadMoreOptions = computed(() => props.willLoadMoreOptions);
const handleClose = (): void => {
if (!disableCloseOnSelect.value) {
popoverActive.value = false;
emits('close');
}
popoverActive.value = false;
emits('close');
activeOptionId.value = '';
};
Expand All @@ -76,8 +73,6 @@ const onOptionSelected = (): void => {
handleClose();
activeOptionId.value = '';
return;
} else {
disableCloseOnSelect.value = true;
}
// TODO: waiting for forceUpdatePosition method in Popover
Expand All @@ -97,8 +92,6 @@ const handleChange = (): void => {
};
const handleBlur = (): void => {
disableCloseOnSelect.value = false;
if (popoverActive.value) {
handleClose();
}
Expand Down
37 changes: 0 additions & 37 deletions src/components/CustomProperties/CustomProperties.vue

This file was deleted.

Loading

0 comments on commit ed814c4

Please sign in to comment.