@gfazioli/mantine-flip 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -0
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +1 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.mts +2 -1
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,66 @@
|
|
|
1
1
|
# Mantine Flip Component
|
|
2
2
|
|
|
3
|
+
https://github.com/gfazioli/mantine-flip/assets/432181/67dce395-4a33-42c9-a71d-8fea81712463
|
|
4
|
+
|
|
5
|
+
This component is created on top of the [Mantine](https://mantine.dev/) library.
|
|
6
|
+
It allows for easy management of two separate views, such as in the cases of a registration form and a login form.
|
|
7
|
+
Essentially, when switching between views, the component will handle the flip animation.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install @gfazioli/mantine-flip
|
|
13
|
+
```
|
|
14
|
+
or
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
yarn add @gfazioli/mantine-flip
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { Flip } from '@gfazioli/mantine-flip';
|
|
24
|
+
|
|
25
|
+
function Demo() {
|
|
26
|
+
return (
|
|
27
|
+
<Flip h={200} w={200}>
|
|
28
|
+
|
|
29
|
+
<Paper radius="md" withBorder p="lg" shadow="md">
|
|
30
|
+
<h3>Front Card</h3>
|
|
31
|
+
<Flip.Target>
|
|
32
|
+
<Button>Flip Back</Button>
|
|
33
|
+
</Flip.Target>
|
|
34
|
+
</Paper>
|
|
35
|
+
|
|
36
|
+
<Paper radius="md" withBorder p="lg" shadow="md">
|
|
37
|
+
<h3>Back Card</h3>
|
|
38
|
+
<Flip.Target>
|
|
39
|
+
<Button>Flip Front</Button>
|
|
40
|
+
</Flip.Target>
|
|
41
|
+
</Paper>
|
|
42
|
+
|
|
43
|
+
</Flip>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
As you can see, the `Flip` component wraps two children, which are the two views that you want to flip between.
|
|
49
|
+
The `Flip.Target` component is used to define the trigger for the flip animation. It can be any component, such as a button, or a link, or even a div.
|
|
50
|
+
|
|
51
|
+
## Props
|
|
52
|
+
|
|
53
|
+
| Prop | Type | Default | Description |
|
|
54
|
+
| ---- | ---- | ------- | ----------- |
|
|
55
|
+
| perspective | string | 1000px | The perspective property defines how far the object is away from the user. |
|
|
56
|
+
| duration | number | .8 | The duration in seconds of the flip animation. |
|
|
57
|
+
| easing | string | ease-in-out | The easing function to be used for the flip animation. |
|
|
58
|
+
| flipped | boolean | false | The initial state of the controlled Flip component. |
|
|
59
|
+
| defaultFlipped | boolean | false | The default state of the uncontrolled flip component. |
|
|
60
|
+
| direction | 'horizontal' or 'vertical' | 'horizontal' | The direction of the flip animation. |
|
|
61
|
+
| directionFlipIn | 'negative' or 'positive' | 'negative' | The direction of the flip animation when flipping in. |
|
|
62
|
+
| directionFlipOut | 'negative' or 'positive' | 'positive' | The direction of the flip animation when flipping out. |
|
|
63
|
+
| onChange | (flipped: boolean) => void | - | Callback to be called when the flip state changes. |
|
|
64
|
+
| onBack | () => void | - | Callback to be called when the flip state changes to false. |
|
|
65
|
+
| onFront | () => void | - | Callback to be called when the flip state changes to true. |
|
|
3
66
|
|
package/dist/cjs/index.cjs
CHANGED
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
package/dist/esm/index.mjs
CHANGED
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { Flip } from './Flip';
|
|
2
|
-
export type { FlipBaseProps, FlipCssVariables, FlipDirection, FlipFactory, FlipIn, FlipOut
|
|
2
|
+
export type { FlipBaseProps, FlipCssVariables, FlipDirection, FlipFactory, FlipIn, FlipOut } from './Flip';
|
|
3
|
+
export { useFlipContext } from './Flip.context';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { Flip } from './Flip';
|
|
2
|
-
export type { FlipBaseProps, FlipCssVariables, FlipDirection, FlipFactory, FlipIn, FlipOut
|
|
2
|
+
export type { FlipBaseProps, FlipCssVariables, FlipDirection, FlipFactory, FlipIn, FlipOut } from './Flip';
|
|
3
|
+
export { useFlipContext } from './Flip.context';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gfazioli/mantine-flip",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"description": "Flip component is a wrapper for any component that can be flipped. It is used to create cards, flip boxes and more.",
|
|
5
5
|
"homepage": "https://github.com/gfazioli/mantine-flip#readme",
|
|
6
6
|
"packageManager": "yarn@4.0.1",
|