Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
fix: selecting transition property when filtering (#2869)
Jaya Krishna Namburud4de7c6f274f
diff --git a/apps/builder/app/builder/features/style-panel/sections/transitions/transition-property.tsx b/apps/builder/app/builder/features/style-panel/sections/transitions/transition-property.tsxindex 46eb8a0a88..8035b6fa97 100644--- a/apps/builder/app/builder/features/style-panel/sections/transitions/transition-property.tsx+++ b/apps/builder/app/builder/features/style-panel/sections/transitions/transition-property.tsx@@ -23,6 +23,7 @@ import {} from "@webstudio-is/design-system";import type { KeywordValue } from "@webstudio-is/css-engine";import { humanizeString } from "~/shared/string-utils";+import { matchSorter } from "match-sorter";type AnimatableProperties = (typeof animatableProperties)[number];type NameAndLabel = { name: AnimatableProperties; label?: string };@@ -83,6 +84,27 @@ export const TransitionProperty = ({onPropertySelection({ property: { type: "keyword", value: prop.name } });},onInputChange: (value) => setInputValue(value ?? ""),+ /*+ We are splitting the items into two lists.+ But when users pass a input, the list is filtered and mixed together.+ The UI is still showing the lists as separated. But the items are mixed together in background.+ Since, first we show the common-properties followed by filtered-properties. We can use matchSorter to sort the items.+ */+ match: (search, itemsToFilter, itemToString) => {+ if (search === "") {+ return itemsToFilter;+ }++ const sortedItems = matchSorter(itemsToFilter, search, {+ keys: [itemToString],+ sorter: (rankedItems) =>+ rankedItems.sort((a) =>+ commonPropertiesSet.has(a.item.name) ? -1 : 1+ ),+ });++ return sortedItems;+ },});const commonProperties = items.filter(