-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
157 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { vars } from "@seed-design/vars"; | ||
import { defineRecipe } from "../utils/define-recipe"; | ||
|
||
const pullToRefresh = defineRecipe({ | ||
name: "pullToRefresh", | ||
slots: ["root", "indicator"], | ||
base: { | ||
root: { | ||
"--ptr-size": "44px", | ||
"--ptr-transition-duration": vars.$duration.s6, | ||
}, | ||
indicator: { | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "center", | ||
}, | ||
}, | ||
variants: {}, | ||
defaultVariants: {}, | ||
}); | ||
|
||
export default pullToRefresh; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/react/src/components/PullToRefresh/PullToRefresh.namespace.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export { | ||
PullToRefreshContent as Content, | ||
PullToRefreshIndicator as Indicator, | ||
PullToRefreshRoot as Root, | ||
type PullToRefreshContentProps as ContentProps, | ||
type PullToRefreshIndicatorProps as IndicatorProps, | ||
type PullToRefreshRootProps as RootProps, | ||
} from "./PullToRefresh"; |
25 changes: 25 additions & 0 deletions
25
packages/react/src/components/PullToRefresh/PullToRefresh.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { PullToRefresh as PullToRefreshPrimitive } from "@seed-design/react-pull-to-refresh"; | ||
import { pullToRefresh, type PullToRefreshVariantProps } from "@seed-design/recipe/pullToRefresh"; | ||
import { createStyleContext } from "../../utils/createStyleContext"; | ||
|
||
const { withContext, withProvider } = createStyleContext(pullToRefresh); | ||
|
||
export interface PullToRefreshRootProps | ||
extends PullToRefreshVariantProps, | ||
PullToRefreshPrimitive.RootProps {} | ||
|
||
export const PullToRefreshRoot = withProvider<SVGSVGElement, PullToRefreshRootProps>( | ||
PullToRefreshPrimitive.Root, | ||
"root", | ||
); | ||
|
||
export interface PullToRefreshIndicatorProps extends PullToRefreshPrimitive.IndicatorProps {} | ||
|
||
export const PullToRefreshIndicator = withContext<SVGCircleElement, PullToRefreshIndicatorProps>( | ||
PullToRefreshPrimitive.Indicator, | ||
"indicator", | ||
); | ||
|
||
export interface PullToRefreshContentProps extends PullToRefreshPrimitive.ContentProps {} | ||
|
||
export const PullToRefreshContent = PullToRefreshPrimitive.Content; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export { | ||
PullToRefreshContent, | ||
PullToRefreshIndicator, | ||
PullToRefreshRoot, | ||
type PullToRefreshContentProps, | ||
type PullToRefreshIndicatorProps, | ||
type PullToRefreshRootProps, | ||
} from "./PullToRefresh"; | ||
|
||
export * as PullToRefresh from "./PullToRefresh.namespace"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
declare interface PullToRefreshVariant { | ||
|
||
} | ||
|
||
declare type PullToRefreshVariantMap = { | ||
[key in keyof PullToRefreshVariant]: Array<PullToRefreshVariant[key]>; | ||
}; | ||
|
||
export declare type PullToRefreshVariantProps = Partial<PullToRefreshVariant>; | ||
|
||
export declare type PullToRefreshSlotName = "root" | "indicator"; | ||
|
||
export declare const pullToRefreshVariantMap: PullToRefreshVariantMap; | ||
|
||
export declare const pullToRefresh: (( | ||
props?: PullToRefreshVariantProps, | ||
) => Record<PullToRefreshSlotName, string>) & { | ||
splitVariantProps: <T extends PullToRefreshVariantProps>( | ||
props: T, | ||
) => [PullToRefreshVariantProps, Omit<T, keyof PullToRefreshVariantProps>]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { createClassName } from "./className.mjs"; | ||
import { mergeVariants } from "./mergeVariants.mjs"; | ||
import { splitVariantProps } from "./splitVariantProps.mjs"; | ||
|
||
const pullToRefreshSlotNames = [ | ||
[ | ||
"root", | ||
"pullToRefresh__root" | ||
], | ||
[ | ||
"indicator", | ||
"pullToRefresh__indicator" | ||
] | ||
]; | ||
|
||
const defaultVariant = {}; | ||
|
||
const compoundVariants = []; | ||
|
||
export const pullToRefreshVariantMap = {}; | ||
|
||
export const pullToRefreshVariantKeys = Object.keys(pullToRefreshVariantMap); | ||
|
||
export function pullToRefresh(props) { | ||
return Object.fromEntries( | ||
pullToRefreshSlotNames.map(([slot, className]) => { | ||
return [ | ||
slot, | ||
createClassName(className, mergeVariants(defaultVariant, props), compoundVariants), | ||
]; | ||
}), | ||
); | ||
} | ||
|
||
Object.assign(pullToRefresh, { splitVariantProps: (props) => splitVariantProps(props, pullToRefreshVariantMap) }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.pullToRefresh__root { | ||
--ptr-size: 44px; | ||
--ptr-transition-duration: var(--seed-v3-duration-s6) | ||
} | ||
.pullToRefresh__indicator { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center | ||
} |