@0xsquid/ui 0.8.0 → 0.8.1

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/dist/cjs/index.js CHANGED
@@ -3283,16 +3283,27 @@ function DropdownMenu({ dropdownRef, items, className, }) {
3283
3283
  return (jsxRuntime.jsx("div", { ref: dropdownRef, className: "tw-relative", children: jsxRuntime.jsx(Menu, { rounded: "sm", containerClassName: cn('tw-absolute tw-right-0 tw-z-20', className), contentClassName: "!tw-p-0", children: jsxRuntime.jsx("ul", { className: "tw-flex tw-w-[144px] tw-flex-col tw-gap-squid-xxs tw-overflow-auto tw-px-0 tw-py-squid-xxs", children: items.map((item) => (jsxRuntime.jsx(DropdownMenuItem, Object.assign({}, item), item.label))) }) }) }));
3284
3284
  }
3285
3285
 
3286
- function Modal({ children, className, onBackdropClick }) {
3286
+ function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, }) {
3287
+ const [isOpen, setIsOpen] = react.useState(_isOpen);
3288
+ react.useEffect(() => {
3289
+ if (_isOpen)
3290
+ return setIsOpen(true);
3291
+ const timeoutId = setTimeout(() => {
3292
+ setIsOpen(false);
3293
+ }, 300);
3294
+ return () => {
3295
+ clearTimeout(timeoutId);
3296
+ };
3297
+ }, [_isOpen]);
3287
3298
  return (
3288
3299
  // modal container (backdrop)
3289
- jsxRuntime.jsx("div", { onClick: onBackdropClick
3300
+ isOpen && (jsxRuntime.jsx("div", { onClick: onBackdropClick
3290
3301
  ? (event) => {
3291
3302
  if (event.target === event.currentTarget) {
3292
3303
  onBackdropClick();
3293
3304
  }
3294
3305
  }
3295
- : undefined, className: "tw-absolute tw-inset-0 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-average tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m tw-backdrop-blur/20 tw-backdrop-saturate-150", children: jsxRuntime.jsx("div", { className: cn('tw-relative tw-flex tw-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end', className), children: children }) }));
3306
+ : undefined, className: cn('tw-absolute tw-inset-0 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-average tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m tw-transition-all', _isOpen ? 'tw-animate-blur-in' : 'tw-animate-blur-out'), children: jsxRuntime.jsx("div", { className: cn('tw-relative tw-flex tw-max-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end', className, _isOpen ? 'tw-animate-slide-to-top' : 'tw-animate-slide-to-bottom'), children: children }) })));
3296
3307
  }
3297
3308
 
3298
3309
  function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, onBackButtonClick, label = '', onAddressButtonClick, isLoading, }) {
@@ -3,6 +3,7 @@ interface ModalProps {
3
3
  children: React.ReactNode;
4
4
  className?: string;
5
5
  onBackdropClick?: () => void;
6
+ isOpen?: boolean;
6
7
  }
7
- export declare function Modal({ children, className, onBackdropClick }: ModalProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function Modal({ children, className, onBackdropClick, isOpen: _isOpen, }: ModalProps): false | import("react/jsx-runtime").JSX.Element;
8
9
  export {};
package/dist/esm/index.js CHANGED
@@ -3281,16 +3281,27 @@ function DropdownMenu({ dropdownRef, items, className, }) {
3281
3281
  return (jsx("div", { ref: dropdownRef, className: "tw-relative", children: jsx(Menu, { rounded: "sm", containerClassName: cn('tw-absolute tw-right-0 tw-z-20', className), contentClassName: "!tw-p-0", children: jsx("ul", { className: "tw-flex tw-w-[144px] tw-flex-col tw-gap-squid-xxs tw-overflow-auto tw-px-0 tw-py-squid-xxs", children: items.map((item) => (jsx(DropdownMenuItem, Object.assign({}, item), item.label))) }) }) }));
3282
3282
  }
3283
3283
 
3284
- function Modal({ children, className, onBackdropClick }) {
3284
+ function Modal({ children, className, onBackdropClick, isOpen: _isOpen = true, }) {
3285
+ const [isOpen, setIsOpen] = useState(_isOpen);
3286
+ useEffect(() => {
3287
+ if (_isOpen)
3288
+ return setIsOpen(true);
3289
+ const timeoutId = setTimeout(() => {
3290
+ setIsOpen(false);
3291
+ }, 300);
3292
+ return () => {
3293
+ clearTimeout(timeoutId);
3294
+ };
3295
+ }, [_isOpen]);
3285
3296
  return (
3286
3297
  // modal container (backdrop)
3287
- jsx("div", { onClick: onBackdropClick
3298
+ isOpen && (jsx("div", { onClick: onBackdropClick
3288
3299
  ? (event) => {
3289
3300
  if (event.target === event.currentTarget) {
3290
3301
  onBackdropClick();
3291
3302
  }
3292
3303
  }
3293
- : undefined, className: "tw-absolute tw-inset-0 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-average tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m tw-backdrop-blur/20 tw-backdrop-saturate-150", children: jsx("div", { className: cn('tw-relative tw-flex tw-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end', className), children: children }) }));
3304
+ : undefined, className: cn('tw-absolute tw-inset-0 tw-flex tw-items-start tw-justify-center tw-bg-material-dark-average tw-px-squid-xs tw-py-squid-xl tw-pb-squid-m tw-transition-all', _isOpen ? 'tw-animate-blur-in' : 'tw-animate-blur-out'), children: jsx("div", { className: cn('tw-relative tw-flex tw-max-h-[600px] tw-w-[400px] tw-flex-col tw-items-start tw-justify-end tw-gap-squid-xxs tw-self-end', className, _isOpen ? 'tw-animate-slide-to-top' : 'tw-animate-slide-to-bottom'), children: children }) })));
3294
3305
  }
3295
3306
 
3296
3307
  function NavigationBar({ title, displayBackButton = false, logoUrl, transparent = false, displayButtonShadows = false, onBackButtonClick, label = '', onAddressButtonClick, isLoading, }) {
@@ -3,6 +3,7 @@ interface ModalProps {
3
3
  children: React.ReactNode;
4
4
  className?: string;
5
5
  onBackdropClick?: () => void;
6
+ isOpen?: boolean;
6
7
  }
7
- export declare function Modal({ children, className, onBackdropClick }: ModalProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function Modal({ children, className, onBackdropClick, isOpen: _isOpen, }: ModalProps): false | import("react/jsx-runtime").JSX.Element;
8
9
  export {};
package/dist/index.css CHANGED
@@ -928,10 +928,6 @@ video {
928
928
  height: 55px;
929
929
  }
930
930
 
931
- .tw-h-\[600px\] {
932
- height: 600px;
933
- }
934
-
935
931
  .tw-h-\[60px\] {
936
932
  height: 60px;
937
933
  }
@@ -1008,6 +1004,10 @@ video {
1008
1004
  max-height: 570px;
1009
1005
  }
1010
1006
 
1007
+ .tw-max-h-\[600px\] {
1008
+ max-height: 600px;
1009
+ }
1010
+
1011
1011
  .tw-max-h-\[60px\] {
1012
1012
  max-height: 60px;
1013
1013
  }
@@ -1351,6 +1351,42 @@ video {
1351
1351
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
1352
1352
  }
1353
1353
 
1354
+ @keyframes tw-blur-in {
1355
+ 0% {
1356
+ -webkit-backdrop-filter: blur(0px) saturate(0%);
1357
+ backdrop-filter: blur(0px) saturate(0%);
1358
+ opacity: 0;
1359
+ }
1360
+
1361
+ 100% {
1362
+ -webkit-backdrop-filter: blur(20px) saturate(150%);
1363
+ backdrop-filter: blur(20px) saturate(150%);
1364
+ opacity: 1;
1365
+ }
1366
+ }
1367
+
1368
+ .tw-animate-blur-in {
1369
+ animation: tw-blur-in 0.2s ease-out both;
1370
+ }
1371
+
1372
+ @keyframes tw-blur-out {
1373
+ 0% {
1374
+ -webkit-backdrop-filter: blur(20px) saturate(150%);
1375
+ backdrop-filter: blur(20px) saturate(150%);
1376
+ opacity: 1;
1377
+ }
1378
+
1379
+ 100% {
1380
+ -webkit-backdrop-filter: blur(0px) saturate(0%);
1381
+ backdrop-filter: blur(0px) saturate(0%);
1382
+ opacity: 0;
1383
+ }
1384
+ }
1385
+
1386
+ .tw-animate-blur-out {
1387
+ animation: tw-blur-out 0.2s ease-out both;
1388
+ }
1389
+
1354
1390
  @keyframes tw-fade-in {
1355
1391
  0% {
1356
1392
  opacity: 0;
package/dist/index.d.ts CHANGED
@@ -283,8 +283,9 @@ interface ModalProps {
283
283
  children: React.ReactNode;
284
284
  className?: string;
285
285
  onBackdropClick?: () => void;
286
+ isOpen?: boolean;
286
287
  }
287
- declare function Modal({ children, className, onBackdropClick }: ModalProps): react_jsx_runtime.JSX.Element;
288
+ declare function Modal({ children, className, onBackdropClick, isOpen: _isOpen, }: ModalProps): false | react_jsx_runtime.JSX.Element;
288
289
 
289
290
  interface NavigationBarProps {
290
291
  title?: string;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "git+https://github.com/0xsquid/squid-ui.git"
6
6
  },
7
7
  "description": "Squid's UI components",
8
- "version": "0.8.0",
8
+ "version": "0.8.1",
9
9
  "author": "",
10
10
  "license": "MIT",
11
11
  "scripts": {