Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
juzser committed Mar 13, 2024
2 parents 67e30ca + 6677bb3 commit e589415
Show file tree
Hide file tree
Showing 6 changed files with 209 additions and 125 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ownego/polaris-vue",
"version": "2.0.1",
"version": "2.0.2",
"polaris_version": "12.20.0",
"description": "Shopify Polaris 12 - UI library for Vue 3",
"author": "Ownego Team",
Expand Down
20 changes: 12 additions & 8 deletions src/components/Filters/Filters.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<template lang="pug">
div(:class="filtersClassName")
div(
ref="containerRef",
:class="filtersClassName",
:style="searchFieldStyle",
)
//- QueryField
div(
v-if="!hideQueryField",
Expand All @@ -13,7 +17,6 @@ div(:class="filtersClassName")
)
div(
:class="styles.SearchField",
:style="searchFieldStyle",
)
SearchField(
v-model="modelValue",
Expand All @@ -37,7 +40,7 @@ div(:class="filtersClassName")
:hide-query-field="hideQueryField",
:disable-filters="disableFilters",
:close-on-child-overlay-click="closeOnChildOverlayClick",
:mounted-state-styles="mountedStateStyles",
:style="mountedStateStyles",
@add-filter-click="emits('add-filter-click')",
@clear-all="emits('clear-all')",
)
Expand All @@ -57,6 +60,7 @@ import {
SearchField,
} from './components';
import styles from '@polaris/components/Filters/Filters.module.scss';
import { type TransitionStatus } from '../IndexFilters/types';
const TRANSITION_DURATION = 'var(--p-motion-duration-150)';
const TRANSITION_MARGIN = '-36px';
Expand Down Expand Up @@ -103,8 +107,6 @@ const transitionFilterStyles = {
},
};
type TransitionStatus = "entering" | "entered" | "exiting" | "exited" | "unmounted";
export type FiltersProps = {
/** Currently entered text in the query field */
queryValue?: string;
Expand Down Expand Up @@ -159,8 +161,6 @@ const slots = defineSlots<{
default?: (_?: VueNode) => VNode[];
}>();
// const modelValue = defineModel<string>();
const modelValue = computed({
get: () => props.queryValue || '',
set: (value: string) => emits('query-change', value),
Expand All @@ -171,7 +171,11 @@ const filtersClassName = computed(() => classNames(
props.hideQueryField && styles.hideQueryField,
));
const searchFieldStyle = computed(() => {
return props.mountedState && !props.hideQueryField
if (props.mountedState === 'entered') {
return undefined;
}
return props.mountedState
? {
...defaultStyle,
...transitionStyles[props.mountedState],
Expand Down
16 changes: 8 additions & 8 deletions src/components/Filters/components/FiltersBar/FiltersBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
div(
aria-live="polite",
:class="filterWrapperClass",
:style="mountedStateStyles",
)
div(:class="classNames(styles.FiltersInner)")
div(:class="classNames(styles.FiltersStickyArea)")
Expand Down Expand Up @@ -70,7 +69,7 @@ div(
</template>

<script setup lang="ts">
import { ref, computed, onMounted } from 'vue';
import { ref, computed, onMounted, watch } from 'vue';
import {
Popover,
ActionList,
Expand All @@ -81,7 +80,6 @@ import {
Button,
} from '@/components';
import FilterPill from '../FilterPill/FilterPill.vue';
import { useOnValueChange } from '@/utilities/use-on-value-change';
import { classNames } from '@/utilities/css';
import { useBreakpoints } from '@/use/useBreakpoints';
import type {
Expand Down Expand Up @@ -112,7 +110,6 @@ type FiltersBarProps = {
disableFilters?: boolean;
/** Whether the filter should close when clicking inside another Popover. */
closeOnChildOverlayClick?: boolean;
mountedStateStyles?: any;
};
type FilterBarEvents = {
Expand Down Expand Up @@ -156,10 +153,6 @@ const localPinnedFilters = ref<string[]>(
pinnedFiltersFromPropsAndAppliedFilters.value.map((filter) => filter.name),
);
useOnValueChange(props.filters.length, () => {
localPinnedFilters.value = pinnedFiltersFromPropsAndAppliedFilters.value.map((filter) => filter.name);
});
const pinnedFilters = computed(() => {
return localPinnedFilters.value
.map((key) => props.filters.find((filter) => filter.name === key))
Expand Down Expand Up @@ -280,4 +273,11 @@ const handleClearAllFilters = () => {
onMounted(() => {
hasMounted.value = true;
});
watch(
() => props.filters.length,
() => {
localPinnedFilters.value = pinnedFiltersFromPropsAndAppliedFilters.value.map((filter) => filter.name);
},
);
</script>
Loading

0 comments on commit e589415

Please sign in to comment.