@shopify/shop-minis-react 0.0.1 → 0.0.2
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 +110 -90
- package/dist/_virtual/_commonjsHelpers.js +9 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/index.js +8 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/index2.js +5 -0
- package/dist/_virtual/index2.js.map +1 -0
- package/dist/components/ui/alert-dialog.js +141 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/button.js +50 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/card.js +91 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/sonner.js +23 -0
- package/dist/components/ui/sonner.js.map +1 -0
- package/dist/hooks/navigation/useCloseMini.js +12 -0
- package/dist/hooks/navigation/useCloseMini.js.map +1 -0
- package/dist/hooks/navigation/useShopNavigation.js +20 -0
- package/dist/hooks/navigation/useShopNavigation.js.map +1 -0
- package/dist/hooks/product/usePopularProducts.js +20 -0
- package/dist/hooks/product/usePopularProducts.js.map +1 -0
- package/dist/hooks/product/useProductList.js +29 -0
- package/dist/hooks/product/useProductList.js.map +1 -0
- package/dist/hooks/product/useProductListActions.js +22 -0
- package/dist/hooks/product/useProductListActions.js.map +1 -0
- package/dist/hooks/product/useProductLists.js +20 -0
- package/dist/hooks/product/useProductLists.js.map +1 -0
- package/dist/hooks/product/useRecommendedProducts.js +20 -0
- package/dist/hooks/product/useRecommendedProducts.js.map +1 -0
- package/dist/hooks/shop/useRecommendedShops.js +21 -0
- package/dist/hooks/shop/useRecommendedShops.js.map +1 -0
- package/dist/hooks/shop/useShopCartActions.js +13 -0
- package/dist/hooks/shop/useShopCartActions.js.map +1 -0
- package/dist/hooks/storage/useAsyncStorage.js +22 -0
- package/dist/hooks/storage/useAsyncStorage.js.map +1 -0
- package/dist/hooks/storage/useImageUpload.js +62 -0
- package/dist/hooks/storage/useImageUpload.js.map +1 -0
- package/dist/hooks/storage/useSecureStorage.js +14 -0
- package/dist/hooks/storage/useSecureStorage.js.map +1 -0
- package/dist/hooks/user/useBuyerAttributes.js +20 -0
- package/dist/hooks/user/useBuyerAttributes.js.map +1 -0
- package/dist/hooks/user/useCurrentUser.js +20 -0
- package/dist/hooks/user/useCurrentUser.js.map +1 -0
- package/dist/hooks/user/useFollowedShopsActions.js +13 -0
- package/dist/hooks/user/useFollowedShopsActions.js.map +1 -0
- package/dist/hooks/user/useOrders.js +20 -0
- package/dist/hooks/user/useOrders.js.map +1 -0
- package/dist/hooks/user/useSavedProductsActions.js +13 -0
- package/dist/hooks/user/useSavedProductsActions.js.map +1 -0
- package/dist/hooks/util/useErrorScreen.js +9 -0
- package/dist/hooks/util/useErrorScreen.js.map +1 -0
- package/dist/hooks/util/useErrorToast.js +9 -0
- package/dist/hooks/util/useErrorToast.js.map +1 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/useHandleAction.js +13 -0
- package/dist/internal/useHandleAction.js.map +1 -0
- package/dist/internal/useShopActions.js +7 -0
- package/dist/internal/useShopActions.js.map +1 -0
- package/dist/internal/useShopActionsDataFetching.js +79 -0
- package/dist/internal/useShopActionsDataFetching.js.map +1 -0
- package/dist/internal/useShopActionsPaginatedDataFetching.js +96 -0
- package/dist/internal/useShopActionsPaginatedDataFetching.js.map +1 -0
- package/dist/lib/utils.js +9 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.2/node_modules/@radix-ui/primitive/dist/index.js +10 -0
- package/dist/node_modules/.pnpm/@radix-ui_primitive@1.1.2/node_modules/@radix-ui/primitive/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-alert-dialog@1.1.14_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react_5smkpul3xqqoqjowwwfk226yey/node_modules/@radix-ui/react-alert-dialog/dist/index.js +127 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-alert-dialog@1.1.14_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react_5smkpul3xqqoqjowwwfk226yey/node_modules/@radix-ui/react-alert-dialog/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-compose-refs@1.1.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-compose-refs/dist/index.js +30 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-compose-refs@1.1.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-compose-refs/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-context/dist/index.js +69 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-context@1.1.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-context/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-dialog@1.1.14_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1._sjczexpvrqz6fttoobpwnns2oa/node_modules/@radix-ui/react-dialog/dist/index.js +259 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-dialog@1.1.14_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1._sjczexpvrqz6fttoobpwnns2oa/node_modules/@radix-ui/react-dialog/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.10_@types_react-dom@19.1.6_@types_react@19.1.6__@types__ipor64qsap4jnr6m7nflv4q5v4/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +128 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-dismissable-layer@1.1.10_@types_react-dom@19.1.6_@types_react@19.1.6__@types__ipor64qsap4jnr6m7nflv4q5v4/node_modules/@radix-ui/react-dismissable-layer/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-focus-guards@1.1.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-focus-guards/dist/index.js +18 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-focus-guards@1.1.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-focus-guards/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@1_zpdtvgogfsfavk62phevpdv4fu/node_modules/@radix-ui/react-focus-scope/dist/index.js +137 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@1_zpdtvgogfsfavk62phevpdv4fu/node_modules/@radix-ui/react-focus-scope/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-id@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-id/dist/index.js +14 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-id@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-id/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.9_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1.6_sr45arufxpp6hzdn2l7kcrtvqe/node_modules/@radix-ui/react-portal/dist/index.js +16 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-portal@1.1.9_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1.6_sr45arufxpp6hzdn2l7kcrtvqe/node_modules/@radix-ui/react-portal/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.4_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1_5ga5lr7i6zouk7rhd63vbsmjyu/node_modules/@radix-ui/react-presence/dist/index.js +71 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.4_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19.1_5ga5lr7i6zouk7rhd63vbsmjyu/node_modules/@radix-ui/react-presence/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.1.3_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19._5iu4xtybujtep4zwi6jviky6tu/node_modules/@radix-ui/react-primitive/dist/index.js +37 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-primitive@2.1.3_@types_react-dom@19.1.6_@types_react@19.1.6__@types_react@19._5iu4xtybujtep4zwi6jviky6tu/node_modules/@radix-ui/react-primitive/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-slot/dist/index.js +59 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-slot/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +11 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-callback-ref/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +53 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +15 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.1.6_react@19.1.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.js +53 -0
- package/dist/node_modules/.pnpm/aria-hidden@1.2.6/node_modules/aria-hidden/dist/es2015/index.js.map +1 -0
- package/dist/node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js +36 -0
- package/dist/node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js +18 -0
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js.map +1 -0
- package/dist/node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.js +8 -0
- package/dist/node_modules/.pnpm/get-nonce@1.0.1/node_modules/get-nonce/dist/es2015/index.js.map +1 -0
- package/dist/node_modules/.pnpm/next-themes@0.4.6_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/next-themes/dist/index.js +34 -0
- package/dist/node_modules/.pnpm/next-themes@0.4.6_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/next-themes/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js +44 -0
- package/dist/node_modules/.pnpm/querystringify@2.2.0/node_modules/querystringify/index.js.map +1 -0
- package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll-bar/dist/es2015/component.js +72 -0
- package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll-bar/dist/es2015/component.js.map +1 -0
- package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +8 -0
- package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll-bar/dist/es2015/constants.js.map +1 -0
- package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +26 -0
- package/dist/node_modules/.pnpm/react-remove-scroll-bar@2.3.8_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll-bar/dist/es2015/utils.js.map +1 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/Combination.js +12 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/Combination.js.map +1 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +113 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/SideEffect.js.map +1 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/UI.js +32 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/UI.js.map +1 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +17 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js.map +1 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +69 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/handleScroll.js.map +1 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/medium.js +6 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/medium.js.map +1 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/sidecar.js +8 -0
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.1.6_react@19.1.0/node_modules/react-remove-scroll/dist/es2015/sidecar.js.map +1 -0
- package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.1.6_react@19.1.0/node_modules/react-style-singleton/dist/es2015/component.js +12 -0
- package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.1.6_react@19.1.0/node_modules/react-style-singleton/dist/es2015/component.js.map +1 -0
- package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.1.6_react@19.1.0/node_modules/react-style-singleton/dist/es2015/hook.js +16 -0
- package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.1.6_react@19.1.0/node_modules/react-style-singleton/dist/es2015/hook.js.map +1 -0
- package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.1.6_react@19.1.0/node_modules/react-style-singleton/dist/es2015/singleton.js +31 -0
- package/dist/node_modules/.pnpm/react-style-singleton@2.2.3_@types_react@19.1.6_react@19.1.0/node_modules/react-style-singleton/dist/es2015/singleton.js.map +1 -0
- package/dist/node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.js +25 -0
- package/dist/node_modules/.pnpm/requires-port@1.0.0/node_modules/requires-port/index.js.map +1 -0
- package/dist/node_modules/.pnpm/sonner@2.0.5_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/sonner/dist/index.js +743 -0
- package/dist/node_modules/.pnpm/sonner@2.0.5_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/sonner/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/tailwind-merge@2.6.0/node_modules/tailwind-merge/dist/bundle-mjs.js +2265 -0
- package/dist/node_modules/.pnpm/tailwind-merge@2.6.0/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
- package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.js +28 -0
- package/dist/node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/node_modules/.pnpm/url-parse@1.5.10/node_modules/url-parse/index.js +133 -0
- package/dist/node_modules/.pnpm/url-parse@1.5.10/node_modules/url-parse/index.js.map +1 -0
- package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.1.6_react@19.1.0/node_modules/use-callback-ref/dist/es2015/assignRef.js +7 -0
- package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.1.6_react@19.1.0/node_modules/use-callback-ref/dist/es2015/assignRef.js.map +1 -0
- package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.1.6_react@19.1.0/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +27 -0
- package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.1.6_react@19.1.0/node_modules/use-callback-ref/dist/es2015/useMergeRef.js.map +1 -0
- package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.1.6_react@19.1.0/node_modules/use-callback-ref/dist/es2015/useRef.js +26 -0
- package/dist/node_modules/.pnpm/use-callback-ref@1.3.3_@types_react@19.1.6_react@19.1.0/node_modules/use-callback-ref/dist/es2015/useRef.js.map +1 -0
- package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.1.6_react@19.1.0/node_modules/use-sidecar/dist/es2015/exports.js +19 -0
- package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.1.6_react@19.1.0/node_modules/use-sidecar/dist/es2015/exports.js.map +1 -0
- package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.1.6_react@19.1.0/node_modules/use-sidecar/dist/es2015/medium.js +68 -0
- package/dist/node_modules/.pnpm/use-sidecar@1.1.3_@types_react@19.1.6_react@19.1.0/node_modules/use-sidecar/dist/es2015/medium.js.map +1 -0
- package/dist/types/minisSDK.generated.d.js +18 -0
- package/dist/types/minisSDK.generated.d.js.map +1 -0
- package/dist/utils/errors.js +39 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/parseUrl.js +8 -0
- package/dist/utils/parseUrl.js.map +1 -0
- package/package.json +29 -14
- package/src/components/index.ts +4 -7
- package/src/components/ui/alert-dialog.tsx +151 -0
- package/src/components/ui/button.tsx +60 -0
- package/src/components/ui/card.tsx +92 -0
- package/src/components/ui/sonner.tsx +23 -0
- package/src/dev.tsx +116 -38
- package/src/hooks/index.ts +31 -5
- package/src/hooks/navigation/useCloseMini.doc.ts +32 -0
- package/src/hooks/navigation/useCloseMini.example.tsx +7 -0
- package/src/hooks/navigation/useCloseMini.ts +17 -0
- package/src/hooks/navigation/useShopNavigation.doc.ts +32 -0
- package/src/hooks/navigation/useShopNavigation.example.tsx +29 -0
- package/src/hooks/navigation/useShopNavigation.ts +41 -0
- package/src/hooks/product/usePopularProducts.ts +37 -0
- package/src/hooks/product/useProductList.doc.ts +32 -0
- package/src/hooks/product/useProductList.example.tsx +9 -0
- package/src/hooks/product/useProductList.ts +56 -0
- package/src/hooks/product/useProductListActions.doc.ts +32 -0
- package/src/hooks/product/useProductListActions.example.tsx +57 -0
- package/src/hooks/product/useProductListActions.ts +51 -0
- package/src/hooks/product/useProductLists.doc.ts +32 -0
- package/src/hooks/product/useProductLists.example.tsx +9 -0
- package/src/hooks/product/useProductLists.ts +39 -0
- package/src/hooks/product/useRecommendedProducts.doc.ts +32 -0
- package/src/hooks/product/useRecommendedProducts.example.tsx +7 -0
- package/src/hooks/product/useRecommendedProducts.ts +37 -0
- package/src/hooks/shop/useRecommendedShops.doc.ts +32 -0
- package/src/hooks/shop/useRecommendedShops.example.tsx +7 -0
- package/src/hooks/shop/useRecommendedShops.ts +43 -0
- package/src/hooks/shop/useShopCartActions.doc.ts +32 -0
- package/src/hooks/shop/useShopCartActions.example.tsx +28 -0
- package/src/hooks/shop/useShopCartActions.ts +23 -0
- package/src/hooks/storage/useAsyncStorage.doc.ts +32 -0
- package/src/hooks/storage/useAsyncStorage.example.tsx +30 -0
- package/src/hooks/storage/useAsyncStorage.ts +48 -0
- package/src/hooks/storage/useImageUpload.doc.ts +32 -0
- package/src/hooks/storage/useImageUpload.example.tsx +20 -0
- package/src/hooks/storage/useImageUpload.ts +135 -0
- package/src/hooks/storage/useSecureStorage.doc.ts +32 -0
- package/src/hooks/storage/useSecureStorage.example.tsx +23 -0
- package/src/hooks/storage/useSecureStorage.ts +28 -0
- package/src/hooks/user/useBuyerAttributes.doc.ts +32 -0
- package/src/hooks/user/useBuyerAttributes.example.tsx +14 -0
- package/src/hooks/user/useBuyerAttributes.ts +34 -0
- package/src/hooks/user/useCurrentUser.doc.ts +31 -0
- package/src/hooks/user/useCurrentUser.example.tsx +7 -0
- package/src/hooks/user/useCurrentUser.ts +37 -0
- package/src/hooks/user/useFollowedShopsActions.doc.ts +32 -0
- package/src/hooks/user/useFollowedShopsActions.example.tsx +18 -0
- package/src/hooks/user/useFollowedShopsActions.ts +23 -0
- package/src/hooks/user/useOrders.doc.ts +32 -0
- package/src/hooks/user/useOrders.example.tsx +7 -0
- package/src/hooks/user/useOrders.ts +32 -0
- package/src/hooks/user/useSavedProductsActions.doc.ts +32 -0
- package/src/hooks/user/useSavedProductsActions.example.tsx +30 -0
- package/src/hooks/user/useSavedProductsActions.ts +23 -0
- package/src/hooks/util/useErrorScreen.doc.ts +32 -0
- package/src/hooks/util/useErrorScreen.example.tsx +16 -0
- package/src/hooks/util/useErrorScreen.ts +15 -0
- package/src/hooks/util/useErrorToast.doc.ts +32 -0
- package/src/hooks/util/useErrorToast.example.tsx +15 -0
- package/src/hooks/util/useErrorToast.ts +15 -0
- package/src/index.css +120 -2
- package/src/internal/useHandleAction.ts +24 -0
- package/src/internal/useShopActions.ts +5 -0
- package/src/internal/useShopActionsDataFetching.ts +153 -0
- package/src/internal/useShopActionsPaginatedDataFetching.ts +193 -0
- package/src/lib/utils.ts +9 -0
- package/src/types/index.ts +2 -0
- package/src/types/minisSDK.generated.d.ts +2 -74
- package/src/utils/errors.ts +86 -0
- package/src/utils/index.ts +2 -11
- package/src/utils/parseUrl.ts +5 -0
- package/tailwind.config.js +3 -0
- package/src/components/HelloWorld/HelloWorld.tsx +0 -43
- package/src/components/HelloWorld/index.ts +0 -2
- package/src/tailwind-theme.css +0 -39
|
@@ -0,0 +1,743 @@
|
|
|
1
|
+
import a from "react";
|
|
2
|
+
import Ut from "react-dom";
|
|
3
|
+
function Xt(r) {
|
|
4
|
+
if (typeof document > "u") return;
|
|
5
|
+
let o = document.head || document.getElementsByTagName("head")[0], e = document.createElement("style");
|
|
6
|
+
e.type = "text/css", o.appendChild(e), e.styleSheet ? e.styleSheet.cssText = r : e.appendChild(document.createTextNode(r));
|
|
7
|
+
}
|
|
8
|
+
const Wt = (r) => {
|
|
9
|
+
switch (r) {
|
|
10
|
+
case "success":
|
|
11
|
+
return Gt;
|
|
12
|
+
case "info":
|
|
13
|
+
return Jt;
|
|
14
|
+
case "warning":
|
|
15
|
+
return Qt;
|
|
16
|
+
case "error":
|
|
17
|
+
return Zt;
|
|
18
|
+
default:
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}, Kt = Array(12).fill(0), qt = ({ visible: r, className: o }) => /* @__PURE__ */ a.createElement("div", {
|
|
22
|
+
className: [
|
|
23
|
+
"sonner-loading-wrapper",
|
|
24
|
+
o
|
|
25
|
+
].filter(Boolean).join(" "),
|
|
26
|
+
"data-visible": r
|
|
27
|
+
}, /* @__PURE__ */ a.createElement("div", {
|
|
28
|
+
className: "sonner-spinner"
|
|
29
|
+
}, Kt.map((e, s) => /* @__PURE__ */ a.createElement("div", {
|
|
30
|
+
className: "sonner-loading-bar",
|
|
31
|
+
key: `spinner-bar-${s}`
|
|
32
|
+
})))), Gt = /* @__PURE__ */ a.createElement("svg", {
|
|
33
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
34
|
+
viewBox: "0 0 20 20",
|
|
35
|
+
fill: "currentColor",
|
|
36
|
+
height: "20",
|
|
37
|
+
width: "20"
|
|
38
|
+
}, /* @__PURE__ */ a.createElement("path", {
|
|
39
|
+
fillRule: "evenodd",
|
|
40
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
|
|
41
|
+
clipRule: "evenodd"
|
|
42
|
+
})), Qt = /* @__PURE__ */ a.createElement("svg", {
|
|
43
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
44
|
+
viewBox: "0 0 24 24",
|
|
45
|
+
fill: "currentColor",
|
|
46
|
+
height: "20",
|
|
47
|
+
width: "20"
|
|
48
|
+
}, /* @__PURE__ */ a.createElement("path", {
|
|
49
|
+
fillRule: "evenodd",
|
|
50
|
+
d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
|
|
51
|
+
clipRule: "evenodd"
|
|
52
|
+
})), Jt = /* @__PURE__ */ a.createElement("svg", {
|
|
53
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
54
|
+
viewBox: "0 0 20 20",
|
|
55
|
+
fill: "currentColor",
|
|
56
|
+
height: "20",
|
|
57
|
+
width: "20"
|
|
58
|
+
}, /* @__PURE__ */ a.createElement("path", {
|
|
59
|
+
fillRule: "evenodd",
|
|
60
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
|
|
61
|
+
clipRule: "evenodd"
|
|
62
|
+
})), Zt = /* @__PURE__ */ a.createElement("svg", {
|
|
63
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
64
|
+
viewBox: "0 0 20 20",
|
|
65
|
+
fill: "currentColor",
|
|
66
|
+
height: "20",
|
|
67
|
+
width: "20"
|
|
68
|
+
}, /* @__PURE__ */ a.createElement("path", {
|
|
69
|
+
fillRule: "evenodd",
|
|
70
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
|
|
71
|
+
clipRule: "evenodd"
|
|
72
|
+
})), te = /* @__PURE__ */ a.createElement("svg", {
|
|
73
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
74
|
+
width: "12",
|
|
75
|
+
height: "12",
|
|
76
|
+
viewBox: "0 0 24 24",
|
|
77
|
+
fill: "none",
|
|
78
|
+
stroke: "currentColor",
|
|
79
|
+
strokeWidth: "1.5",
|
|
80
|
+
strokeLinecap: "round",
|
|
81
|
+
strokeLinejoin: "round"
|
|
82
|
+
}, /* @__PURE__ */ a.createElement("line", {
|
|
83
|
+
x1: "18",
|
|
84
|
+
y1: "6",
|
|
85
|
+
x2: "6",
|
|
86
|
+
y2: "18"
|
|
87
|
+
}), /* @__PURE__ */ a.createElement("line", {
|
|
88
|
+
x1: "6",
|
|
89
|
+
y1: "6",
|
|
90
|
+
x2: "18",
|
|
91
|
+
y2: "18"
|
|
92
|
+
})), ee = () => {
|
|
93
|
+
const [r, o] = a.useState(document.hidden);
|
|
94
|
+
return a.useEffect(() => {
|
|
95
|
+
const e = () => {
|
|
96
|
+
o(document.hidden);
|
|
97
|
+
};
|
|
98
|
+
return document.addEventListener("visibilitychange", e), () => window.removeEventListener("visibilitychange", e);
|
|
99
|
+
}, []), r;
|
|
100
|
+
};
|
|
101
|
+
let yt = 1;
|
|
102
|
+
class ae {
|
|
103
|
+
constructor() {
|
|
104
|
+
this.subscribe = (o) => (this.subscribers.push(o), () => {
|
|
105
|
+
const e = this.subscribers.indexOf(o);
|
|
106
|
+
this.subscribers.splice(e, 1);
|
|
107
|
+
}), this.publish = (o) => {
|
|
108
|
+
this.subscribers.forEach((e) => e(o));
|
|
109
|
+
}, this.addToast = (o) => {
|
|
110
|
+
this.publish(o), this.toasts = [
|
|
111
|
+
...this.toasts,
|
|
112
|
+
o
|
|
113
|
+
];
|
|
114
|
+
}, this.create = (o) => {
|
|
115
|
+
var e;
|
|
116
|
+
const { message: s, ...D } = o, c = typeof o?.id == "number" || ((e = o.id) == null ? void 0 : e.length) > 0 ? o.id : yt++, v = this.toasts.find((h) => h.id === c), N = o.dismissible === void 0 ? !0 : o.dismissible;
|
|
117
|
+
return this.dismissedToasts.has(c) && this.dismissedToasts.delete(c), v ? this.toasts = this.toasts.map((h) => h.id === c ? (this.publish({
|
|
118
|
+
...h,
|
|
119
|
+
...o,
|
|
120
|
+
id: c,
|
|
121
|
+
title: s
|
|
122
|
+
}), {
|
|
123
|
+
...h,
|
|
124
|
+
...o,
|
|
125
|
+
id: c,
|
|
126
|
+
dismissible: N,
|
|
127
|
+
title: s
|
|
128
|
+
}) : h) : this.addToast({
|
|
129
|
+
title: s,
|
|
130
|
+
...D,
|
|
131
|
+
dismissible: N,
|
|
132
|
+
id: c
|
|
133
|
+
}), c;
|
|
134
|
+
}, this.dismiss = (o) => (o ? (this.dismissedToasts.add(o), requestAnimationFrame(() => this.subscribers.forEach((e) => e({
|
|
135
|
+
id: o,
|
|
136
|
+
dismiss: !0
|
|
137
|
+
})))) : this.toasts.forEach((e) => {
|
|
138
|
+
this.subscribers.forEach((s) => s({
|
|
139
|
+
id: e.id,
|
|
140
|
+
dismiss: !0
|
|
141
|
+
}));
|
|
142
|
+
}), o), this.message = (o, e) => this.create({
|
|
143
|
+
...e,
|
|
144
|
+
message: o
|
|
145
|
+
}), this.error = (o, e) => this.create({
|
|
146
|
+
...e,
|
|
147
|
+
message: o,
|
|
148
|
+
type: "error"
|
|
149
|
+
}), this.success = (o, e) => this.create({
|
|
150
|
+
...e,
|
|
151
|
+
type: "success",
|
|
152
|
+
message: o
|
|
153
|
+
}), this.info = (o, e) => this.create({
|
|
154
|
+
...e,
|
|
155
|
+
type: "info",
|
|
156
|
+
message: o
|
|
157
|
+
}), this.warning = (o, e) => this.create({
|
|
158
|
+
...e,
|
|
159
|
+
type: "warning",
|
|
160
|
+
message: o
|
|
161
|
+
}), this.loading = (o, e) => this.create({
|
|
162
|
+
...e,
|
|
163
|
+
type: "loading",
|
|
164
|
+
message: o
|
|
165
|
+
}), this.promise = (o, e) => {
|
|
166
|
+
if (!e)
|
|
167
|
+
return;
|
|
168
|
+
let s;
|
|
169
|
+
e.loading !== void 0 && (s = this.create({
|
|
170
|
+
...e,
|
|
171
|
+
promise: o,
|
|
172
|
+
type: "loading",
|
|
173
|
+
message: e.loading,
|
|
174
|
+
description: typeof e.description != "function" ? e.description : void 0
|
|
175
|
+
}));
|
|
176
|
+
const D = Promise.resolve(o instanceof Function ? o() : o);
|
|
177
|
+
let c = s !== void 0, v;
|
|
178
|
+
const N = D.then(async (i) => {
|
|
179
|
+
if (v = [
|
|
180
|
+
"resolve",
|
|
181
|
+
i
|
|
182
|
+
], a.isValidElement(i))
|
|
183
|
+
c = !1, this.create({
|
|
184
|
+
id: s,
|
|
185
|
+
type: "default",
|
|
186
|
+
message: i
|
|
187
|
+
});
|
|
188
|
+
else if (se(i) && !i.ok) {
|
|
189
|
+
c = !1;
|
|
190
|
+
const t = typeof e.error == "function" ? await e.error(`HTTP error! status: ${i.status}`) : e.error, C = typeof e.description == "function" ? await e.description(`HTTP error! status: ${i.status}`) : e.description, w = typeof t == "object" && !a.isValidElement(t) ? t : {
|
|
191
|
+
message: t
|
|
192
|
+
};
|
|
193
|
+
this.create({
|
|
194
|
+
id: s,
|
|
195
|
+
type: "error",
|
|
196
|
+
description: C,
|
|
197
|
+
...w
|
|
198
|
+
});
|
|
199
|
+
} else if (i instanceof Error) {
|
|
200
|
+
c = !1;
|
|
201
|
+
const t = typeof e.error == "function" ? await e.error(i) : e.error, C = typeof e.description == "function" ? await e.description(i) : e.description, w = typeof t == "object" && !a.isValidElement(t) ? t : {
|
|
202
|
+
message: t
|
|
203
|
+
};
|
|
204
|
+
this.create({
|
|
205
|
+
id: s,
|
|
206
|
+
type: "error",
|
|
207
|
+
description: C,
|
|
208
|
+
...w
|
|
209
|
+
});
|
|
210
|
+
} else if (e.success !== void 0) {
|
|
211
|
+
c = !1;
|
|
212
|
+
const t = typeof e.success == "function" ? await e.success(i) : e.success, C = typeof e.description == "function" ? await e.description(i) : e.description, w = typeof t == "object" && !a.isValidElement(t) ? t : {
|
|
213
|
+
message: t
|
|
214
|
+
};
|
|
215
|
+
this.create({
|
|
216
|
+
id: s,
|
|
217
|
+
type: "success",
|
|
218
|
+
description: C,
|
|
219
|
+
...w
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}).catch(async (i) => {
|
|
223
|
+
if (v = [
|
|
224
|
+
"reject",
|
|
225
|
+
i
|
|
226
|
+
], e.error !== void 0) {
|
|
227
|
+
c = !1;
|
|
228
|
+
const x = typeof e.error == "function" ? await e.error(i) : e.error, t = typeof e.description == "function" ? await e.description(i) : e.description, z = typeof x == "object" && !a.isValidElement(x) ? x : {
|
|
229
|
+
message: x
|
|
230
|
+
};
|
|
231
|
+
this.create({
|
|
232
|
+
id: s,
|
|
233
|
+
type: "error",
|
|
234
|
+
description: t,
|
|
235
|
+
...z
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}).finally(() => {
|
|
239
|
+
c && (this.dismiss(s), s = void 0), e.finally == null || e.finally.call(e);
|
|
240
|
+
}), h = () => new Promise((i, x) => N.then(() => v[0] === "reject" ? x(v[1]) : i(v[1])).catch(x));
|
|
241
|
+
return typeof s != "string" && typeof s != "number" ? {
|
|
242
|
+
unwrap: h
|
|
243
|
+
} : Object.assign(s, {
|
|
244
|
+
unwrap: h
|
|
245
|
+
});
|
|
246
|
+
}, this.custom = (o, e) => {
|
|
247
|
+
const s = e?.id || yt++;
|
|
248
|
+
return this.create({
|
|
249
|
+
jsx: o(s),
|
|
250
|
+
id: s,
|
|
251
|
+
...e
|
|
252
|
+
}), s;
|
|
253
|
+
}, this.getActiveToasts = () => this.toasts.filter((o) => !this.dismissedToasts.has(o.id)), this.subscribers = [], this.toasts = [], this.dismissedToasts = /* @__PURE__ */ new Set();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
const E = new ae(), oe = (r, o) => {
|
|
257
|
+
const e = o?.id || yt++;
|
|
258
|
+
return E.addToast({
|
|
259
|
+
title: r,
|
|
260
|
+
...o,
|
|
261
|
+
id: e
|
|
262
|
+
}), e;
|
|
263
|
+
}, se = (r) => r && typeof r == "object" && "ok" in r && typeof r.ok == "boolean" && "status" in r && typeof r.status == "number", ne = oe, re = () => E.toasts, ie = () => E.getActiveToasts();
|
|
264
|
+
Object.assign(ne, {
|
|
265
|
+
success: E.success,
|
|
266
|
+
info: E.info,
|
|
267
|
+
warning: E.warning,
|
|
268
|
+
error: E.error,
|
|
269
|
+
custom: E.custom,
|
|
270
|
+
message: E.message,
|
|
271
|
+
promise: E.promise,
|
|
272
|
+
dismiss: E.dismiss,
|
|
273
|
+
loading: E.loading
|
|
274
|
+
}, {
|
|
275
|
+
getHistory: re,
|
|
276
|
+
getToasts: ie
|
|
277
|
+
});
|
|
278
|
+
Xt("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
|
|
279
|
+
function ct(r) {
|
|
280
|
+
return r.label !== void 0;
|
|
281
|
+
}
|
|
282
|
+
const le = 3, de = "24px", ce = "16px", Bt = 4e3, ue = 356, fe = 14, me = 45, pe = 200;
|
|
283
|
+
function O(...r) {
|
|
284
|
+
return r.filter(Boolean).join(" ");
|
|
285
|
+
}
|
|
286
|
+
function ge(r) {
|
|
287
|
+
const [o, e] = r.split("-"), s = [];
|
|
288
|
+
return o && s.push(o), e && s.push(e), s;
|
|
289
|
+
}
|
|
290
|
+
const he = (r) => {
|
|
291
|
+
var o, e, s, D, c, v, N, h, i;
|
|
292
|
+
const { invert: x, toast: t, unstyled: C, interacting: z, setHeights: w, visibleToasts: ut, heights: u, index: P, toasts: st, expanded: Q, removeToast: nt, defaultRichColors: A, closeButton: U, style: ft, cancelButtonStyle: rt, actionButtonStyle: mt, className: pt = "", descriptionClassName: j = "", duration: X, position: J, gap: gt, expandByDefault: H, classNames: l, icons: R, closeButtonAriaLabel: L = "Close toast" } = r, [B, Z] = a.useState(null), [d, m] = a.useState(null), [f, k] = a.useState(!1), [F, p] = a.useState(!1), [tt, W] = a.useState(!1), [et, at] = a.useState(!1), [It, wt] = a.useState(!1), [Ct, ht] = a.useState(0), [At, xt] = a.useState(0), ot = a.useRef(t.duration || X || Bt), Et = a.useRef(null), Y = a.useRef(null), Ht = P === 0, Ot = P + 1 <= ut, T = t.type, K = t.dismissible !== !1, zt = t.className || "", Pt = t.descriptionClassName || "", it = a.useMemo(() => u.findIndex((n) => n.toastId === t.id) || 0, [
|
|
293
|
+
u,
|
|
294
|
+
t.id
|
|
295
|
+
]), jt = a.useMemo(() => {
|
|
296
|
+
var n;
|
|
297
|
+
return (n = t.closeButton) != null ? n : U;
|
|
298
|
+
}, [
|
|
299
|
+
t.closeButton,
|
|
300
|
+
U
|
|
301
|
+
]), Tt = a.useMemo(() => t.duration || X || Bt, [
|
|
302
|
+
t.duration,
|
|
303
|
+
X
|
|
304
|
+
]), bt = a.useRef(0), q = a.useRef(0), St = a.useRef(0), G = a.useRef(null), [Lt, Yt] = J.split("-"), Nt = a.useMemo(() => u.reduce((n, g, y) => y >= it ? n : n + g.height, 0), [
|
|
305
|
+
u,
|
|
306
|
+
it
|
|
307
|
+
]), kt = ee(), $t = t.invert || x, vt = T === "loading";
|
|
308
|
+
q.current = a.useMemo(() => it * gt + Nt, [
|
|
309
|
+
it,
|
|
310
|
+
Nt
|
|
311
|
+
]), a.useEffect(() => {
|
|
312
|
+
ot.current = Tt;
|
|
313
|
+
}, [
|
|
314
|
+
Tt
|
|
315
|
+
]), a.useEffect(() => {
|
|
316
|
+
k(!0);
|
|
317
|
+
}, []), a.useEffect(() => {
|
|
318
|
+
const n = Y.current;
|
|
319
|
+
if (n) {
|
|
320
|
+
const g = n.getBoundingClientRect().height;
|
|
321
|
+
return xt(g), w((y) => [
|
|
322
|
+
{
|
|
323
|
+
toastId: t.id,
|
|
324
|
+
height: g,
|
|
325
|
+
position: t.position
|
|
326
|
+
},
|
|
327
|
+
...y
|
|
328
|
+
]), () => w((y) => y.filter((S) => S.toastId !== t.id));
|
|
329
|
+
}
|
|
330
|
+
}, [
|
|
331
|
+
w,
|
|
332
|
+
t.id
|
|
333
|
+
]), a.useLayoutEffect(() => {
|
|
334
|
+
if (!f) return;
|
|
335
|
+
const n = Y.current, g = n.style.height;
|
|
336
|
+
n.style.height = "auto";
|
|
337
|
+
const y = n.getBoundingClientRect().height;
|
|
338
|
+
n.style.height = g, xt(y), w((S) => S.find((b) => b.toastId === t.id) ? S.map((b) => b.toastId === t.id ? {
|
|
339
|
+
...b,
|
|
340
|
+
height: y
|
|
341
|
+
} : b) : [
|
|
342
|
+
{
|
|
343
|
+
toastId: t.id,
|
|
344
|
+
height: y,
|
|
345
|
+
position: t.position
|
|
346
|
+
},
|
|
347
|
+
...S
|
|
348
|
+
]);
|
|
349
|
+
}, [
|
|
350
|
+
f,
|
|
351
|
+
t.title,
|
|
352
|
+
t.description,
|
|
353
|
+
w,
|
|
354
|
+
t.id,
|
|
355
|
+
t.jsx,
|
|
356
|
+
t.action,
|
|
357
|
+
t.cancel
|
|
358
|
+
]);
|
|
359
|
+
const $ = a.useCallback(() => {
|
|
360
|
+
p(!0), ht(q.current), w((n) => n.filter((g) => g.toastId !== t.id)), setTimeout(() => {
|
|
361
|
+
nt(t);
|
|
362
|
+
}, pe);
|
|
363
|
+
}, [
|
|
364
|
+
t,
|
|
365
|
+
nt,
|
|
366
|
+
w,
|
|
367
|
+
q
|
|
368
|
+
]);
|
|
369
|
+
a.useEffect(() => {
|
|
370
|
+
if (t.promise && T === "loading" || t.duration === 1 / 0 || t.type === "loading") return;
|
|
371
|
+
let n;
|
|
372
|
+
return Q || z || kt ? (() => {
|
|
373
|
+
if (St.current < bt.current) {
|
|
374
|
+
const S = (/* @__PURE__ */ new Date()).getTime() - bt.current;
|
|
375
|
+
ot.current = ot.current - S;
|
|
376
|
+
}
|
|
377
|
+
St.current = (/* @__PURE__ */ new Date()).getTime();
|
|
378
|
+
})() : (() => {
|
|
379
|
+
ot.current !== 1 / 0 && (bt.current = (/* @__PURE__ */ new Date()).getTime(), n = setTimeout(() => {
|
|
380
|
+
t.onAutoClose == null || t.onAutoClose.call(t, t), $();
|
|
381
|
+
}, ot.current));
|
|
382
|
+
})(), () => clearTimeout(n);
|
|
383
|
+
}, [
|
|
384
|
+
Q,
|
|
385
|
+
z,
|
|
386
|
+
t,
|
|
387
|
+
T,
|
|
388
|
+
kt,
|
|
389
|
+
$
|
|
390
|
+
]), a.useEffect(() => {
|
|
391
|
+
t.delete && ($(), t.onDismiss == null || t.onDismiss.call(t, t));
|
|
392
|
+
}, [
|
|
393
|
+
$,
|
|
394
|
+
t.delete
|
|
395
|
+
]);
|
|
396
|
+
function Ft() {
|
|
397
|
+
var n;
|
|
398
|
+
if (R?.loading) {
|
|
399
|
+
var g;
|
|
400
|
+
return /* @__PURE__ */ a.createElement("div", {
|
|
401
|
+
className: O(l?.loader, t == null || (g = t.classNames) == null ? void 0 : g.loader, "sonner-loader"),
|
|
402
|
+
"data-visible": T === "loading"
|
|
403
|
+
}, R.loading);
|
|
404
|
+
}
|
|
405
|
+
return /* @__PURE__ */ a.createElement(qt, {
|
|
406
|
+
className: O(l?.loader, t == null || (n = t.classNames) == null ? void 0 : n.loader),
|
|
407
|
+
visible: T === "loading"
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
const Vt = t.icon || R?.[T] || Wt(T);
|
|
411
|
+
var _t, Dt;
|
|
412
|
+
return /* @__PURE__ */ a.createElement("li", {
|
|
413
|
+
tabIndex: 0,
|
|
414
|
+
ref: Y,
|
|
415
|
+
className: O(pt, zt, l?.toast, t == null || (o = t.classNames) == null ? void 0 : o.toast, l?.default, l?.[T], t == null || (e = t.classNames) == null ? void 0 : e[T]),
|
|
416
|
+
"data-sonner-toast": "",
|
|
417
|
+
"data-rich-colors": (_t = t.richColors) != null ? _t : A,
|
|
418
|
+
"data-styled": !(t.jsx || t.unstyled || C),
|
|
419
|
+
"data-mounted": f,
|
|
420
|
+
"data-promise": !!t.promise,
|
|
421
|
+
"data-swiped": It,
|
|
422
|
+
"data-removed": F,
|
|
423
|
+
"data-visible": Ot,
|
|
424
|
+
"data-y-position": Lt,
|
|
425
|
+
"data-x-position": Yt,
|
|
426
|
+
"data-index": P,
|
|
427
|
+
"data-front": Ht,
|
|
428
|
+
"data-swiping": tt,
|
|
429
|
+
"data-dismissible": K,
|
|
430
|
+
"data-type": T,
|
|
431
|
+
"data-invert": $t,
|
|
432
|
+
"data-swipe-out": et,
|
|
433
|
+
"data-swipe-direction": d,
|
|
434
|
+
"data-expanded": !!(Q || H && f),
|
|
435
|
+
style: {
|
|
436
|
+
"--index": P,
|
|
437
|
+
"--toasts-before": P,
|
|
438
|
+
"--z-index": st.length - P,
|
|
439
|
+
"--offset": `${F ? Ct : q.current}px`,
|
|
440
|
+
"--initial-height": H ? "auto" : `${At}px`,
|
|
441
|
+
...ft,
|
|
442
|
+
...t.style
|
|
443
|
+
},
|
|
444
|
+
onDragEnd: () => {
|
|
445
|
+
W(!1), Z(null), G.current = null;
|
|
446
|
+
},
|
|
447
|
+
onPointerDown: (n) => {
|
|
448
|
+
vt || !K || (Et.current = /* @__PURE__ */ new Date(), ht(q.current), n.target.setPointerCapture(n.pointerId), n.target.tagName !== "BUTTON" && (W(!0), G.current = {
|
|
449
|
+
x: n.clientX,
|
|
450
|
+
y: n.clientY
|
|
451
|
+
}));
|
|
452
|
+
},
|
|
453
|
+
onPointerUp: () => {
|
|
454
|
+
var n, g, y;
|
|
455
|
+
if (et || !K) return;
|
|
456
|
+
G.current = null;
|
|
457
|
+
const S = Number(((n = Y.current) == null ? void 0 : n.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), lt = Number(((g = Y.current) == null ? void 0 : g.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), b = (/* @__PURE__ */ new Date()).getTime() - ((y = Et.current) == null ? void 0 : y.getTime()), _ = B === "x" ? S : lt, dt = Math.abs(_) / b;
|
|
458
|
+
if (Math.abs(_) >= me || dt > 0.11) {
|
|
459
|
+
ht(q.current), t.onDismiss == null || t.onDismiss.call(t, t), m(B === "x" ? S > 0 ? "right" : "left" : lt > 0 ? "down" : "up"), $(), at(!0);
|
|
460
|
+
return;
|
|
461
|
+
} else {
|
|
462
|
+
var M, I;
|
|
463
|
+
(M = Y.current) == null || M.style.setProperty("--swipe-amount-x", "0px"), (I = Y.current) == null || I.style.setProperty("--swipe-amount-y", "0px");
|
|
464
|
+
}
|
|
465
|
+
wt(!1), W(!1), Z(null);
|
|
466
|
+
},
|
|
467
|
+
onPointerMove: (n) => {
|
|
468
|
+
var g, y, S;
|
|
469
|
+
if (!G.current || !K || ((g = window.getSelection()) == null ? void 0 : g.toString().length) > 0) return;
|
|
470
|
+
const b = n.clientY - G.current.y, _ = n.clientX - G.current.x;
|
|
471
|
+
var dt;
|
|
472
|
+
const M = (dt = r.swipeDirections) != null ? dt : ge(J);
|
|
473
|
+
!B && (Math.abs(_) > 1 || Math.abs(b) > 1) && Z(Math.abs(_) > Math.abs(b) ? "x" : "y");
|
|
474
|
+
let I = {
|
|
475
|
+
x: 0,
|
|
476
|
+
y: 0
|
|
477
|
+
};
|
|
478
|
+
const Rt = (V) => 1 / (1.5 + Math.abs(V) / 20);
|
|
479
|
+
if (B === "y") {
|
|
480
|
+
if (M.includes("top") || M.includes("bottom"))
|
|
481
|
+
if (M.includes("top") && b < 0 || M.includes("bottom") && b > 0)
|
|
482
|
+
I.y = b;
|
|
483
|
+
else {
|
|
484
|
+
const V = b * Rt(b);
|
|
485
|
+
I.y = Math.abs(V) < Math.abs(b) ? V : b;
|
|
486
|
+
}
|
|
487
|
+
} else if (B === "x" && (M.includes("left") || M.includes("right")))
|
|
488
|
+
if (M.includes("left") && _ < 0 || M.includes("right") && _ > 0)
|
|
489
|
+
I.x = _;
|
|
490
|
+
else {
|
|
491
|
+
const V = _ * Rt(_);
|
|
492
|
+
I.x = Math.abs(V) < Math.abs(_) ? V : _;
|
|
493
|
+
}
|
|
494
|
+
(Math.abs(I.x) > 0 || Math.abs(I.y) > 0) && wt(!0), (y = Y.current) == null || y.style.setProperty("--swipe-amount-x", `${I.x}px`), (S = Y.current) == null || S.style.setProperty("--swipe-amount-y", `${I.y}px`);
|
|
495
|
+
}
|
|
496
|
+
}, jt && !t.jsx && T !== "loading" ? /* @__PURE__ */ a.createElement("button", {
|
|
497
|
+
"aria-label": L,
|
|
498
|
+
"data-disabled": vt,
|
|
499
|
+
"data-close-button": !0,
|
|
500
|
+
onClick: vt || !K ? () => {
|
|
501
|
+
} : () => {
|
|
502
|
+
$(), t.onDismiss == null || t.onDismiss.call(t, t);
|
|
503
|
+
},
|
|
504
|
+
className: O(l?.closeButton, t == null || (s = t.classNames) == null ? void 0 : s.closeButton)
|
|
505
|
+
}, (Dt = R?.close) != null ? Dt : te) : null, (T || t.icon || t.promise) && t.icon !== null && (R?.[T] !== null || t.icon) ? /* @__PURE__ */ a.createElement("div", {
|
|
506
|
+
"data-icon": "",
|
|
507
|
+
className: O(l?.icon, t == null || (D = t.classNames) == null ? void 0 : D.icon)
|
|
508
|
+
}, t.promise || t.type === "loading" && !t.icon ? t.icon || Ft() : null, t.type !== "loading" ? Vt : null) : null, /* @__PURE__ */ a.createElement("div", {
|
|
509
|
+
"data-content": "",
|
|
510
|
+
className: O(l?.content, t == null || (c = t.classNames) == null ? void 0 : c.content)
|
|
511
|
+
}, /* @__PURE__ */ a.createElement("div", {
|
|
512
|
+
"data-title": "",
|
|
513
|
+
className: O(l?.title, t == null || (v = t.classNames) == null ? void 0 : v.title)
|
|
514
|
+
}, t.jsx ? t.jsx : typeof t.title == "function" ? t.title() : t.title), t.description ? /* @__PURE__ */ a.createElement("div", {
|
|
515
|
+
"data-description": "",
|
|
516
|
+
className: O(j, Pt, l?.description, t == null || (N = t.classNames) == null ? void 0 : N.description)
|
|
517
|
+
}, typeof t.description == "function" ? t.description() : t.description) : null), /* @__PURE__ */ a.isValidElement(t.cancel) ? t.cancel : t.cancel && ct(t.cancel) ? /* @__PURE__ */ a.createElement("button", {
|
|
518
|
+
"data-button": !0,
|
|
519
|
+
"data-cancel": !0,
|
|
520
|
+
style: t.cancelButtonStyle || rt,
|
|
521
|
+
onClick: (n) => {
|
|
522
|
+
ct(t.cancel) && K && (t.cancel.onClick == null || t.cancel.onClick.call(t.cancel, n), $());
|
|
523
|
+
},
|
|
524
|
+
className: O(l?.cancelButton, t == null || (h = t.classNames) == null ? void 0 : h.cancelButton)
|
|
525
|
+
}, t.cancel.label) : null, /* @__PURE__ */ a.isValidElement(t.action) ? t.action : t.action && ct(t.action) ? /* @__PURE__ */ a.createElement("button", {
|
|
526
|
+
"data-button": !0,
|
|
527
|
+
"data-action": !0,
|
|
528
|
+
style: t.actionButtonStyle || mt,
|
|
529
|
+
onClick: (n) => {
|
|
530
|
+
ct(t.action) && (t.action.onClick == null || t.action.onClick.call(t.action, n), !n.defaultPrevented && $());
|
|
531
|
+
},
|
|
532
|
+
className: O(l?.actionButton, t == null || (i = t.classNames) == null ? void 0 : i.actionButton)
|
|
533
|
+
}, t.action.label) : null);
|
|
534
|
+
};
|
|
535
|
+
function Mt() {
|
|
536
|
+
if (typeof window > "u" || typeof document > "u") return "ltr";
|
|
537
|
+
const r = document.documentElement.getAttribute("dir");
|
|
538
|
+
return r === "auto" || !r ? window.getComputedStyle(document.documentElement).direction : r;
|
|
539
|
+
}
|
|
540
|
+
function be(r, o) {
|
|
541
|
+
const e = {};
|
|
542
|
+
return [
|
|
543
|
+
r,
|
|
544
|
+
o
|
|
545
|
+
].forEach((s, D) => {
|
|
546
|
+
const c = D === 1, v = c ? "--mobile-offset" : "--offset", N = c ? ce : de;
|
|
547
|
+
function h(i) {
|
|
548
|
+
[
|
|
549
|
+
"top",
|
|
550
|
+
"right",
|
|
551
|
+
"bottom",
|
|
552
|
+
"left"
|
|
553
|
+
].forEach((x) => {
|
|
554
|
+
e[`${v}-${x}`] = typeof i == "number" ? `${i}px` : i;
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
typeof s == "number" || typeof s == "string" ? h(s) : typeof s == "object" ? [
|
|
558
|
+
"top",
|
|
559
|
+
"right",
|
|
560
|
+
"bottom",
|
|
561
|
+
"left"
|
|
562
|
+
].forEach((i) => {
|
|
563
|
+
s[i] === void 0 ? e[`${v}-${i}`] = N : e[`${v}-${i}`] = typeof s[i] == "number" ? `${s[i]}px` : s[i];
|
|
564
|
+
}) : h(N);
|
|
565
|
+
}), e;
|
|
566
|
+
}
|
|
567
|
+
const xe = /* @__PURE__ */ a.forwardRef(function(o, e) {
|
|
568
|
+
const { invert: s, position: D = "bottom-right", hotkey: c = [
|
|
569
|
+
"altKey",
|
|
570
|
+
"KeyT"
|
|
571
|
+
], expand: v, closeButton: N, className: h, offset: i, mobileOffset: x, theme: t = "light", richColors: C, duration: z, style: w, visibleToasts: ut = le, toastOptions: u, dir: P = Mt(), gap: st = fe, icons: Q, containerAriaLabel: nt = "Notifications" } = o, [A, U] = a.useState([]), ft = a.useMemo(() => Array.from(new Set([
|
|
572
|
+
D
|
|
573
|
+
].concat(A.filter((d) => d.position).map((d) => d.position)))), [
|
|
574
|
+
A,
|
|
575
|
+
D
|
|
576
|
+
]), [rt, mt] = a.useState([]), [pt, j] = a.useState(!1), [X, J] = a.useState(!1), [gt, H] = a.useState(t !== "system" ? t : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), l = a.useRef(null), R = c.join("+").replace(/Key/g, "").replace(/Digit/g, ""), L = a.useRef(null), B = a.useRef(!1), Z = a.useCallback((d) => {
|
|
577
|
+
U((m) => {
|
|
578
|
+
var f;
|
|
579
|
+
return (f = m.find((k) => k.id === d.id)) != null && f.delete || E.dismiss(d.id), m.filter(({ id: k }) => k !== d.id);
|
|
580
|
+
});
|
|
581
|
+
}, []);
|
|
582
|
+
return a.useEffect(() => E.subscribe((d) => {
|
|
583
|
+
if (d.dismiss) {
|
|
584
|
+
requestAnimationFrame(() => {
|
|
585
|
+
U((m) => m.map((f) => f.id === d.id ? {
|
|
586
|
+
...f,
|
|
587
|
+
delete: !0
|
|
588
|
+
} : f));
|
|
589
|
+
});
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
setTimeout(() => {
|
|
593
|
+
Ut.flushSync(() => {
|
|
594
|
+
U((m) => {
|
|
595
|
+
const f = m.findIndex((k) => k.id === d.id);
|
|
596
|
+
return f !== -1 ? [
|
|
597
|
+
...m.slice(0, f),
|
|
598
|
+
{
|
|
599
|
+
...m[f],
|
|
600
|
+
...d
|
|
601
|
+
},
|
|
602
|
+
...m.slice(f + 1)
|
|
603
|
+
] : [
|
|
604
|
+
d,
|
|
605
|
+
...m
|
|
606
|
+
];
|
|
607
|
+
});
|
|
608
|
+
});
|
|
609
|
+
});
|
|
610
|
+
}), [
|
|
611
|
+
A
|
|
612
|
+
]), a.useEffect(() => {
|
|
613
|
+
if (t !== "system") {
|
|
614
|
+
H(t);
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
if (t === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? H("dark") : H("light")), typeof window > "u") return;
|
|
618
|
+
const d = window.matchMedia("(prefers-color-scheme: dark)");
|
|
619
|
+
try {
|
|
620
|
+
d.addEventListener("change", ({ matches: m }) => {
|
|
621
|
+
H(m ? "dark" : "light");
|
|
622
|
+
});
|
|
623
|
+
} catch {
|
|
624
|
+
d.addListener(({ matches: f }) => {
|
|
625
|
+
try {
|
|
626
|
+
H(f ? "dark" : "light");
|
|
627
|
+
} catch (k) {
|
|
628
|
+
console.error(k);
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
}, [
|
|
633
|
+
t
|
|
634
|
+
]), a.useEffect(() => {
|
|
635
|
+
A.length <= 1 && j(!1);
|
|
636
|
+
}, [
|
|
637
|
+
A
|
|
638
|
+
]), a.useEffect(() => {
|
|
639
|
+
const d = (m) => {
|
|
640
|
+
var f;
|
|
641
|
+
if (c.every((p) => m[p] || m.code === p)) {
|
|
642
|
+
var F;
|
|
643
|
+
j(!0), (F = l.current) == null || F.focus();
|
|
644
|
+
}
|
|
645
|
+
m.code === "Escape" && (document.activeElement === l.current || (f = l.current) != null && f.contains(document.activeElement)) && j(!1);
|
|
646
|
+
};
|
|
647
|
+
return document.addEventListener("keydown", d), () => document.removeEventListener("keydown", d);
|
|
648
|
+
}, [
|
|
649
|
+
c
|
|
650
|
+
]), a.useEffect(() => {
|
|
651
|
+
if (l.current)
|
|
652
|
+
return () => {
|
|
653
|
+
L.current && (L.current.focus({
|
|
654
|
+
preventScroll: !0
|
|
655
|
+
}), L.current = null, B.current = !1);
|
|
656
|
+
};
|
|
657
|
+
}, [
|
|
658
|
+
l.current
|
|
659
|
+
]), // Remove item from normal navigation flow, only available via hotkey
|
|
660
|
+
/* @__PURE__ */ a.createElement("section", {
|
|
661
|
+
ref: e,
|
|
662
|
+
"aria-label": `${nt} ${R}`,
|
|
663
|
+
tabIndex: -1,
|
|
664
|
+
"aria-live": "polite",
|
|
665
|
+
"aria-relevant": "additions text",
|
|
666
|
+
"aria-atomic": "false",
|
|
667
|
+
suppressHydrationWarning: !0
|
|
668
|
+
}, ft.map((d, m) => {
|
|
669
|
+
var f;
|
|
670
|
+
const [k, F] = d.split("-");
|
|
671
|
+
return A.length ? /* @__PURE__ */ a.createElement("ol", {
|
|
672
|
+
key: d,
|
|
673
|
+
dir: P === "auto" ? Mt() : P,
|
|
674
|
+
tabIndex: -1,
|
|
675
|
+
ref: l,
|
|
676
|
+
className: h,
|
|
677
|
+
"data-sonner-toaster": !0,
|
|
678
|
+
"data-sonner-theme": gt,
|
|
679
|
+
"data-y-position": k,
|
|
680
|
+
"data-x-position": F,
|
|
681
|
+
style: {
|
|
682
|
+
"--front-toast-height": `${((f = rt[0]) == null ? void 0 : f.height) || 0}px`,
|
|
683
|
+
"--width": `${ue}px`,
|
|
684
|
+
"--gap": `${st}px`,
|
|
685
|
+
...w,
|
|
686
|
+
...be(i, x)
|
|
687
|
+
},
|
|
688
|
+
onBlur: (p) => {
|
|
689
|
+
B.current && !p.currentTarget.contains(p.relatedTarget) && (B.current = !1, L.current && (L.current.focus({
|
|
690
|
+
preventScroll: !0
|
|
691
|
+
}), L.current = null));
|
|
692
|
+
},
|
|
693
|
+
onFocus: (p) => {
|
|
694
|
+
p.target instanceof HTMLElement && p.target.dataset.dismissible === "false" || B.current || (B.current = !0, L.current = p.relatedTarget);
|
|
695
|
+
},
|
|
696
|
+
onMouseEnter: () => j(!0),
|
|
697
|
+
onMouseMove: () => j(!0),
|
|
698
|
+
onMouseLeave: () => {
|
|
699
|
+
X || j(!1);
|
|
700
|
+
},
|
|
701
|
+
onDragEnd: () => j(!1),
|
|
702
|
+
onPointerDown: (p) => {
|
|
703
|
+
p.target instanceof HTMLElement && p.target.dataset.dismissible === "false" || J(!0);
|
|
704
|
+
},
|
|
705
|
+
onPointerUp: () => J(!1)
|
|
706
|
+
}, A.filter((p) => !p.position && m === 0 || p.position === d).map((p, tt) => {
|
|
707
|
+
var W, et;
|
|
708
|
+
return /* @__PURE__ */ a.createElement(he, {
|
|
709
|
+
key: p.id,
|
|
710
|
+
icons: Q,
|
|
711
|
+
index: tt,
|
|
712
|
+
toast: p,
|
|
713
|
+
defaultRichColors: C,
|
|
714
|
+
duration: (W = u?.duration) != null ? W : z,
|
|
715
|
+
className: u?.className,
|
|
716
|
+
descriptionClassName: u?.descriptionClassName,
|
|
717
|
+
invert: s,
|
|
718
|
+
visibleToasts: ut,
|
|
719
|
+
closeButton: (et = u?.closeButton) != null ? et : N,
|
|
720
|
+
interacting: X,
|
|
721
|
+
position: d,
|
|
722
|
+
style: u?.style,
|
|
723
|
+
unstyled: u?.unstyled,
|
|
724
|
+
classNames: u?.classNames,
|
|
725
|
+
cancelButtonStyle: u?.cancelButtonStyle,
|
|
726
|
+
actionButtonStyle: u?.actionButtonStyle,
|
|
727
|
+
closeButtonAriaLabel: u?.closeButtonAriaLabel,
|
|
728
|
+
removeToast: Z,
|
|
729
|
+
toasts: A.filter((at) => at.position == p.position),
|
|
730
|
+
heights: rt.filter((at) => at.position == p.position),
|
|
731
|
+
setHeights: mt,
|
|
732
|
+
expandByDefault: v,
|
|
733
|
+
gap: st,
|
|
734
|
+
expanded: pt,
|
|
735
|
+
swipeDirections: o.swipeDirections
|
|
736
|
+
});
|
|
737
|
+
})) : null;
|
|
738
|
+
}));
|
|
739
|
+
});
|
|
740
|
+
export {
|
|
741
|
+
xe as Toaster
|
|
742
|
+
};
|
|
743
|
+
//# sourceMappingURL=index.js.map
|