@lerx/promise-modal 0.0.64 → 0.0.65

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.
Files changed (2) hide show
  1. package/README.md +34 -61
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -631,63 +631,7 @@ function showToastExample() {
631
631
  }
632
632
  ```
633
633
 
634
- ### 6. Nested Modal Providers
635
-
636
- You can use multiple modal providers with different settings within the same application:
637
-
638
- ```tsx
639
- import { ModalProvider, alert } from '@lerx/promise-modal';
640
-
641
- function NestedModalProviders() {
642
- return (
643
- <ModalProvider
644
- options={{
645
- duration: 300,
646
- backdrop: 'rgba(0, 0, 0, 0.5)',
647
- }}
648
- >
649
- {/* Modal using outer provider settings */}
650
- <button
651
- onClick={() =>
652
- alert({
653
- title: 'Outer Modal',
654
- content: 'This uses outer modal provider settings.',
655
- })
656
- }
657
- >
658
- Open Outer Modal
659
- </button>
660
-
661
- {/* Inner provider with different settings */}
662
- <div className="inner-section">
663
- <ModalProvider
664
- SubtitleComponent={() => (
665
- <div className="custom-subtitle">Inner Modal</div>
666
- )}
667
- options={{
668
- duration: 500,
669
- backdrop: 'rgba(0, 0, 0, 0.8)',
670
- }}
671
- >
672
- {/* Modal using inner provider settings */}
673
- <button
674
- onClick={() =>
675
- alert({
676
- title: 'Inner Modal',
677
- content: 'This uses inner modal provider settings.',
678
- })
679
- }
680
- >
681
- Open Inner Modal
682
- </button>
683
- </ModalProvider>
684
- </div>
685
- </ModalProvider>
686
- );
687
- }
688
- ```
689
-
690
- ### 7. Various Modal Configuration Options
634
+ ### 6. Various Modal Configuration Options
691
635
 
692
636
  Examples utilizing various modal configuration options:
693
637
 
@@ -1025,10 +969,23 @@ Provides modal animation state and control.
1025
969
  ```typescript
1026
970
  import { useModalAnimation } from '@lerx/promise-modal';
1027
971
 
1028
- function Component() {
1029
- const { isAnimating, animate } = useModalAnimation();
1030
-
1031
- // ...
972
+ export const Foreground = ({
973
+ id,
974
+ visible,
975
+ children,
976
+ onClose,
977
+ hideAfterMs,
978
+ }: PropsWithChildren<ForegroundProps>) => {
979
+ const modalRef = useRef<HTMLDivElement>(null);
980
+ useModalAnimation(visible, {
981
+ onVisible: () => {
982
+ modalRef.current?.classList.add(styles.visible);
983
+ },
984
+ onHidden: () => {
985
+ modalRef.current?.classList.remove(styles.visible);
986
+ },
987
+ });
988
+ ...
1032
989
  }
1033
990
  ```
1034
991
 
@@ -1228,3 +1185,19 @@ async function promptWithNestedModal() {
1228
1185
  console.log('Input value:', value);
1229
1186
  }
1230
1187
  ```
1188
+
1189
+ ## Browser Support
1190
+
1191
+ `@lerx/promise-modal` supports all modern browsers (Chrome, Firefox, Safari, Edge), but IE11 is not support.
1192
+
1193
+ ---
1194
+
1195
+ ## License
1196
+
1197
+ This repository is licensed under the MIT License. Please refer to the [`LICENSE`](./LICENSE) file for details.
1198
+
1199
+ ---
1200
+
1201
+ ## Contact
1202
+
1203
+ For inquiries or suggestions related to the project, please create an issue.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lerx/promise-modal",
3
- "version": "0.0.64",
3
+ "version": "0.0.65",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/vincent-kk/albatrion.git",
@@ -48,8 +48,8 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@emotion/css": "^11.0.0",
51
- "@winglet/common-utils": "^0.0.64",
52
- "@winglet/react-utils": "^0.0.64"
51
+ "@winglet/common-utils": "^0.0.65",
52
+ "@winglet/react-utils": "^0.0.65"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@babel/core": "^7.26.0",