From 0ff5eca777389cbe8dbab6789309cbfa57faef59 Mon Sep 17 00:00:00 2001 From: lawvs <18554747+lawvs@users.noreply.github.com> Date: Wed, 28 Aug 2024 19:41:07 +0800 Subject: [PATCH] chore: upgrade fn-sphere to v0.5 --- package.json | 2 +- src/components/filter-button.tsx | 71 +++++++++++++++++--------------- src/components/filter-sphere.tsx | 10 ++--- 3 files changed, 43 insertions(+), 40 deletions(-) diff --git a/package.json b/package.json index d043cea..d7a456a 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "@blocksuite/sync": "^0.16.0", "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", - "@fn-sphere/filter": "^0.4.0", + "@fn-sphere/filter": "^0.5.0", "@mui/material": "^5.16.7", "@radix-ui/react-dialog": "^1.1.1", "@radix-ui/react-dropdown-menu": "^2.1.1", diff --git a/src/components/filter-button.tsx b/src/components/filter-button.tsx index 073a398..52ac88a 100644 --- a/src/components/filter-button.tsx +++ b/src/components/filter-button.tsx @@ -15,8 +15,8 @@ import { import { createFlattenFilterGroup, filterFnList, + filterTheme, schema, - themeSpec, } from "./filter-sphere"; import { Button } from "./ui/button"; import { @@ -52,25 +52,25 @@ export function FilterButton() { }; return ( - - { - setOpen(open); - if (open) { - return; - } - updateFilter(); - }} + { + setOpen(open); + if (open) { + return; + } + updateFilter(); + }} + > + + + Filter {isFilterEnabled ? `(${countOfFilterData})` : ""} + + { setOpen(false); @@ -80,8 +80,8 @@ export function FilterButton() { reset(); }} /> - - + + ); } @@ -93,7 +93,7 @@ function FilterDialog({ onReset: () => void; }) { return ( - + Filter @@ -101,7 +101,7 @@ function FilterDialog({
- + - - - Powered by  - - Filter Sphere - - + Powered by  + + Filter Sphere + + +
); } diff --git a/src/components/filter-sphere.tsx b/src/components/filter-sphere.tsx index f81fcd4..8811754 100644 --- a/src/components/filter-sphere.tsx +++ b/src/components/filter-sphere.tsx @@ -3,9 +3,9 @@ import { createFilterTheme, createSingleFilter, defineTypedFn, + FilterTheme, presetFilter, SingleFilter, - ThemeSpec, useFilterRule, useRootRule, useView, @@ -98,7 +98,7 @@ const componentsSpec = { onValueChange={handleChange} disabled={disabled} > - + @@ -111,7 +111,7 @@ const componentsSpec = { ); }, -} satisfies Partial; +} satisfies Partial; export type SingleFilterRuleProps = { rule: SingleFilter; @@ -217,9 +217,9 @@ const templatesSpec = { ); }, -} satisfies Partial; +} satisfies Partial; -export const themeSpec = createFilterTheme({ +export const filterTheme = createFilterTheme({ components: componentsSpec, templates: templatesSpec, });