@ivex0002/stack-modal 1.0.3 → 1.0.4
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 +13 -13
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ npm install @ivex0002/stack-modal-presets
|
|
|
48
48
|
## Quick Start
|
|
49
49
|
|
|
50
50
|
```typescript
|
|
51
|
-
import {
|
|
51
|
+
import { createStackModal } from "@ivex0002/stack-modal";
|
|
52
52
|
import { defaultPreset } from "@ivex0002/stack-modal-presets";
|
|
53
53
|
|
|
54
54
|
// Define your modals
|
|
@@ -68,7 +68,7 @@ const modals = {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
// Create modal instance with preset
|
|
71
|
-
const modal =
|
|
71
|
+
const modal = createStackModal(modals, defaultPreset);
|
|
72
72
|
|
|
73
73
|
// Use in your component
|
|
74
74
|
function App() {
|
|
@@ -101,7 +101,7 @@ A centered modal with stacking animation. Multiple modals are displayed with off
|
|
|
101
101
|
```typescript
|
|
102
102
|
import { defaultPreset } from "@ivex0002/stack-modal-presets";
|
|
103
103
|
|
|
104
|
-
const modal =
|
|
104
|
+
const modal = createStackModal(modals, defaultPreset);
|
|
105
105
|
```
|
|
106
106
|
|
|
107
107
|
### Minimal Preset
|
|
@@ -111,7 +111,7 @@ A simple centered modal with fade transitions. Only the top modal is visible.
|
|
|
111
111
|
```typescript
|
|
112
112
|
import { minimalPreset } from "@ivex0002/stack-modal-presets";
|
|
113
113
|
|
|
114
|
-
const modal =
|
|
114
|
+
const modal = createStackModal(modals, minimalPreset);
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
### Drawer Preset
|
|
@@ -121,12 +121,12 @@ A bottom sheet style modal that slides up from the bottom of the screen.
|
|
|
121
121
|
```typescript
|
|
122
122
|
import { drawerPreset } from "@ivex0002/stack-modal-presets";
|
|
123
123
|
|
|
124
|
-
const modal =
|
|
124
|
+
const modal = createStackModal(modals, drawerPreset);
|
|
125
125
|
```
|
|
126
126
|
|
|
127
127
|
## API Reference
|
|
128
128
|
|
|
129
|
-
### `
|
|
129
|
+
### `createStackModal(modals, modalLayout)`
|
|
130
130
|
|
|
131
131
|
Creates a modal instance with the specified modals and layout.
|
|
132
132
|
|
|
@@ -142,7 +142,7 @@ Creates a modal instance with the specified modals and layout.
|
|
|
142
142
|
### Modal Control Object
|
|
143
143
|
|
|
144
144
|
```typescript
|
|
145
|
-
const modal =
|
|
145
|
+
const modal = createStackModal(modals, preset);
|
|
146
146
|
|
|
147
147
|
// Push a modal
|
|
148
148
|
modal.modalName.push(props);
|
|
@@ -278,7 +278,7 @@ export const twfmModalLayoutExample: ModalLayout = {
|
|
|
278
278
|
},
|
|
279
279
|
};
|
|
280
280
|
|
|
281
|
-
const modal =
|
|
281
|
+
const modal = createStackModal(modals, twfmModalLayoutExample);
|
|
282
282
|
```
|
|
283
283
|
|
|
284
284
|
### ModalLayout Interface
|
|
@@ -394,7 +394,7 @@ const modals = {
|
|
|
394
394
|
),
|
|
395
395
|
};
|
|
396
396
|
|
|
397
|
-
const modal =
|
|
397
|
+
const modal = createStackModal(modals, defaultPreset);
|
|
398
398
|
|
|
399
399
|
// ✅ Correct
|
|
400
400
|
modal.user.push({ name: "John", age: 30 });
|
|
@@ -520,7 +520,7 @@ const modals = {
|
|
|
520
520
|
};
|
|
521
521
|
|
|
522
522
|
// 2. Create modal instance
|
|
523
|
-
const modal =
|
|
523
|
+
const modal = createStackModal(modals, preset);
|
|
524
524
|
|
|
525
525
|
// This creates:
|
|
526
526
|
// - A store to manage modal stack
|
|
@@ -569,11 +569,11 @@ modal.pop();
|
|
|
569
569
|
|
|
570
570
|
### Modals not appearing?
|
|
571
571
|
|
|
572
|
-
Make sure `
|
|
572
|
+
Make sure `createStackModal` is called at the module level, not inside a component:
|
|
573
573
|
|
|
574
574
|
```typescript
|
|
575
575
|
// ✅ Correct
|
|
576
|
-
const modal =
|
|
576
|
+
const modal = createStackModal(modals, preset);
|
|
577
577
|
|
|
578
578
|
function App() {
|
|
579
579
|
return <button onClick={() => modal.alert.push()}>Open</button>;
|
|
@@ -581,7 +581,7 @@ function App() {
|
|
|
581
581
|
|
|
582
582
|
// ❌ Wrong - creates new instance on every render
|
|
583
583
|
function App() {
|
|
584
|
-
const modal =
|
|
584
|
+
const modal = createStackModal(modals, preset);
|
|
585
585
|
return <button onClick={() => modal.alert.push()}>Open</button>;
|
|
586
586
|
}
|
|
587
587
|
```
|