@tamagui/toast 1.9.18 → 1.9.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/toast",
3
- "version": "1.9.18",
3
+ "version": "1.9.21",
4
4
  "source": "src/index.ts",
5
5
  "types": "./types/index.d.ts",
6
6
  "main": "dist/cjs",
@@ -31,24 +31,24 @@
31
31
  }
32
32
  },
33
33
  "dependencies": {
34
- "@tamagui/animate-presence": "1.9.18",
35
- "@tamagui/compose-refs": "1.9.18",
36
- "@tamagui/core": "1.9.18",
37
- "@tamagui/create-context": "1.9.18",
38
- "@tamagui/dismissable": "1.9.18",
39
- "@tamagui/polyfill-dev": "1.9.18",
40
- "@tamagui/portal": "1.9.18",
41
- "@tamagui/stacks": "1.9.18",
42
- "@tamagui/text": "1.9.18",
43
- "@tamagui/use-controllable-state": "1.9.18",
44
- "@tamagui/visually-hidden": "1.9.18"
34
+ "@tamagui/animate-presence": "1.9.21",
35
+ "@tamagui/compose-refs": "1.9.21",
36
+ "@tamagui/core": "1.9.21",
37
+ "@tamagui/create-context": "1.9.21",
38
+ "@tamagui/dismissable": "1.9.21",
39
+ "@tamagui/polyfill-dev": "1.9.21",
40
+ "@tamagui/portal": "1.9.21",
41
+ "@tamagui/stacks": "1.9.21",
42
+ "@tamagui/text": "1.9.21",
43
+ "@tamagui/use-controllable-state": "1.9.21",
44
+ "@tamagui/visually-hidden": "1.9.21"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "react": "*",
48
48
  "react-native": "*"
49
49
  },
50
50
  "devDependencies": {
51
- "@tamagui/build": "1.9.18",
51
+ "@tamagui/build": "1.9.21",
52
52
  "react": "^18.2.0",
53
53
  "react-native": "^0.71.4"
54
54
  },
@@ -1,88 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var createToast_exports = {};
30
- __export(createToast_exports, {
31
- createToast: () => createToast
32
- });
33
- module.exports = __toCommonJS(createToast_exports);
34
- var import_jsx_runtime = require("react/jsx-runtime");
35
- var import_core = require("@tamagui/core");
36
- var import_create_context = require("@tamagui/create-context");
37
- var import_react = __toESM(require("react"));
38
- var import_createNativeToast = require("./createNativeToast");
39
- const [createImperativeToastContext, createImperativeToastScope] = (0, import_create_context.createContextScope)("ImperativeToast");
40
- const [ImperativeToastProvider, useToastProviderContext] = createImperativeToastContext("ImperativeToastProvider");
41
- const createToast = (options = {}) => {
42
- return {
43
- ImperativeToastProvider: ({
44
- __scopeToast,
45
- children
46
- }) => {
47
- const counterRef = (0, import_react.useRef)(0);
48
- const [toast, setToast] = import_react.default.useState(null);
49
- const addToast = import_react.default.useCallback(
50
- (title, options2) => {
51
- counterRef.current++;
52
- setToast({ title, id: counterRef.current.toString(), ...options2 });
53
- },
54
- [setToast]
55
- );
56
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
57
- ImperativeToastProvider,
58
- {
59
- scope: __scopeToast,
60
- addToast,
61
- currentToast: toast,
62
- children
63
- }
64
- );
65
- },
66
- useToast: () => {
67
- const context = useToastProviderContext("useToast", void 0);
68
- return {
69
- /**
70
- * The toast to get and show if not using native
71
- */
72
- currentToast: context.currentToast,
73
- show(title, showOptions) {
74
- const native = (showOptions == null ? void 0 : showOptions.native) || options.native;
75
- if (native === true || Array.isArray(options.native) && (import_core.isWeb && options.native.includes("web") || !import_core.isWeb && options.native.includes("mobile"))) {
76
- return (0, import_createNativeToast.createNativeToast)(title, showOptions ?? {});
77
- }
78
- context.addToast(title, showOptions ?? {});
79
- }
80
- };
81
- }
82
- };
83
- };
84
- // Annotate the CommonJS export names for ESM import in node:
85
- 0 && (module.exports = {
86
- createToast
87
- });
88
- //# sourceMappingURL=createToast.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/createToast.tsx"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/core'\nimport { Scope, createContextScope } from '@tamagui/create-context'\nimport React, { useRef } from 'react'\n\nimport { createNativeToast } from './createNativeToast'\nimport { CreateNativeToastsOptions, CreateNativeToastsOptionsFn } from './types'\n\ntype NativeValue = boolean | 'web' | 'mobile'\ninterface CreateToastOptions {\n /**\n * Will show a native toast if is true or is set to the current platform. On iOS, it wraps `SPIndicator` and `SPAlert`. On Android, it wraps `ToastAndroid`. On web, it wraps Notification API. Mobile's native features are handled by `burnt`.\n */\n native?: NativeValue\n}\ninterface ToastOptions extends CreateNativeToastsOptions {\n /**\n * Used when need custom data\n */\n additionalInfo?: Record<string, any>\n /**\n * Overrides the native option on `createToast()`\n */\n native?: NativeValue\n}\ntype ScopedProps<P> = P & { __scopeToast?: Scope }\n\ntype ToastData = { title: string; id: string } & CreateNativeToastsOptions\n\ninterface ImperativeToastContextValue {\n currentToast: ToastData | null\n addToast: CreateNativeToastsOptionsFn\n}\n\nconst [createImperativeToastContext, createImperativeToastScope] =\n createContextScope('ImperativeToast')\n\nconst [ImperativeToastProvider, useToastProviderContext] =\n createImperativeToastContext<ImperativeToastContextValue>('ImperativeToastProvider')\n\nconst createToast = (options = {} as CreateToastOptions) => {\n return {\n ImperativeToastProvider: ({\n __scopeToast,\n children,\n }: ScopedProps<{ children: React.ReactNode }>) => {\n const counterRef = useRef(0)\n const [toast, setToast] =\n React.useState<ImperativeToastContextValue['currentToast']>(null)\n const addToast = React.useCallback<CreateNativeToastsOptionsFn>(\n (title, options) => {\n counterRef.current++\n setToast({ title, id: counterRef.current.toString(), ...options })\n },\n [setToast]\n )\n\n return (\n <ImperativeToastProvider\n scope={__scopeToast}\n addToast={addToast}\n currentToast={toast}\n >\n {children}\n </ImperativeToastProvider>\n )\n },\n useToast: () => {\n const context = useToastProviderContext('useToast', undefined)\n\n return {\n /**\n * The toast to get and show if not using native\n */\n currentToast: context.currentToast,\n show(title: string, showOptions?: ToastOptions) {\n const native = showOptions?.native || options.native\n if (\n native === true ||\n (Array.isArray(options.native) &&\n ((isWeb && options.native.includes('web')) ||\n (!isWeb && options.native.includes('mobile'))))\n ) {\n return createNativeToast(title, showOptions ?? {})\n }\n context.addToast(title, showOptions ?? {})\n },\n }\n },\n }\n}\n\nexport { createToast }\nexport type { CreateToastOptions }\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyDQ;AAzDR,kBAAsB;AACtB,4BAA0C;AAC1C,mBAA8B;AAE9B,+BAAkC;AA6BlC,MAAM,CAAC,8BAA8B,0BAA0B,QAC7D,0CAAmB,iBAAiB;AAEtC,MAAM,CAAC,yBAAyB,uBAAuB,IACrD,6BAA0D,yBAAyB;AAErF,MAAM,cAAc,CAAC,UAAU,CAAC,MAA4B;AAC1D,SAAO;AAAA,IACL,yBAAyB,CAAC;AAAA,MACxB;AAAA,MACA;AAAA,IACF,MAAkD;AAChD,YAAM,iBAAa,qBAAO,CAAC;AAC3B,YAAM,CAAC,OAAO,QAAQ,IACpB,aAAAA,QAAM,SAAsD,IAAI;AAClE,YAAM,WAAW,aAAAA,QAAM;AAAA,QACrB,CAAC,OAAOC,aAAY;AAClB,qBAAW;AACX,mBAAS,EAAE,OAAO,IAAI,WAAW,QAAQ,SAAS,GAAG,GAAGA,SAAQ,CAAC;AAAA,QACnE;AAAA,QACA,CAAC,QAAQ;AAAA,MACX;AAEA,aACE;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,UACP;AAAA,UACA,cAAc;AAAA,UAEb;AAAA;AAAA,MACH;AAAA,IAEJ;AAAA,IACA,UAAU,MAAM;AACd,YAAM,UAAU,wBAAwB,YAAY,MAAS;AAE7D,aAAO;AAAA;AAAA;AAAA;AAAA,QAIL,cAAc,QAAQ;AAAA,QACtB,KAAK,OAAe,aAA4B;AAC9C,gBAAM,UAAS,2CAAa,WAAU,QAAQ;AAC9C,cACE,WAAW,QACV,MAAM,QAAQ,QAAQ,MAAM,MACzB,qBAAS,QAAQ,OAAO,SAAS,KAAK,KACrC,CAAC,qBAAS,QAAQ,OAAO,SAAS,QAAQ,IAC/C;AACA,uBAAO,4CAAkB,OAAO,eAAe,CAAC,CAAC;AAAA,UACnD;AACA,kBAAQ,SAAS,OAAO,eAAe,CAAC,CAAC;AAAA,QAC3C;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
6
- "names": ["React", "options"]
7
- }
@@ -1,54 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { isWeb } from "@tamagui/core";
3
- import { createContextScope } from "@tamagui/create-context";
4
- import React, { useRef } from "react";
5
- import { createNativeToast } from "./createNativeToast";
6
- const [createImperativeToastContext, createImperativeToastScope] = createContextScope("ImperativeToast");
7
- const [ImperativeToastProvider, useToastProviderContext] = createImperativeToastContext("ImperativeToastProvider");
8
- const createToast = (options = {}) => {
9
- return {
10
- ImperativeToastProvider: ({
11
- __scopeToast,
12
- children
13
- }) => {
14
- const counterRef = useRef(0);
15
- const [toast, setToast] = React.useState(null);
16
- const addToast = React.useCallback(
17
- (title, options2) => {
18
- counterRef.current++;
19
- setToast({ title, id: counterRef.current.toString(), ...options2 });
20
- },
21
- [setToast]
22
- );
23
- return /* @__PURE__ */ jsx(
24
- ImperativeToastProvider,
25
- {
26
- scope: __scopeToast,
27
- addToast,
28
- currentToast: toast,
29
- children
30
- }
31
- );
32
- },
33
- useToast: () => {
34
- const context = useToastProviderContext("useToast", void 0);
35
- return {
36
- /**
37
- * The toast to get and show if not using native
38
- */
39
- currentToast: context.currentToast,
40
- show(title, showOptions) {
41
- const native = (showOptions == null ? void 0 : showOptions.native) || options.native;
42
- if (native === true || Array.isArray(options.native) && (isWeb && options.native.includes("web") || !isWeb && options.native.includes("mobile"))) {
43
- return createNativeToast(title, showOptions ?? {});
44
- }
45
- context.addToast(title, showOptions ?? {});
46
- }
47
- };
48
- }
49
- };
50
- };
51
- export {
52
- createToast
53
- };
54
- //# sourceMappingURL=createToast.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/createToast.tsx"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/core'\nimport { Scope, createContextScope } from '@tamagui/create-context'\nimport React, { useRef } from 'react'\n\nimport { createNativeToast } from './createNativeToast'\nimport { CreateNativeToastsOptions, CreateNativeToastsOptionsFn } from './types'\n\ntype NativeValue = boolean | 'web' | 'mobile'\ninterface CreateToastOptions {\n /**\n * Will show a native toast if is true or is set to the current platform. On iOS, it wraps `SPIndicator` and `SPAlert`. On Android, it wraps `ToastAndroid`. On web, it wraps Notification API. Mobile's native features are handled by `burnt`.\n */\n native?: NativeValue\n}\ninterface ToastOptions extends CreateNativeToastsOptions {\n /**\n * Used when need custom data\n */\n additionalInfo?: Record<string, any>\n /**\n * Overrides the native option on `createToast()`\n */\n native?: NativeValue\n}\ntype ScopedProps<P> = P & { __scopeToast?: Scope }\n\ntype ToastData = { title: string; id: string } & CreateNativeToastsOptions\n\ninterface ImperativeToastContextValue {\n currentToast: ToastData | null\n addToast: CreateNativeToastsOptionsFn\n}\n\nconst [createImperativeToastContext, createImperativeToastScope] =\n createContextScope('ImperativeToast')\n\nconst [ImperativeToastProvider, useToastProviderContext] =\n createImperativeToastContext<ImperativeToastContextValue>('ImperativeToastProvider')\n\nconst createToast = (options = {} as CreateToastOptions) => {\n return {\n ImperativeToastProvider: ({\n __scopeToast,\n children,\n }: ScopedProps<{ children: React.ReactNode }>) => {\n const counterRef = useRef(0)\n const [toast, setToast] =\n React.useState<ImperativeToastContextValue['currentToast']>(null)\n const addToast = React.useCallback<CreateNativeToastsOptionsFn>(\n (title, options) => {\n counterRef.current++\n setToast({ title, id: counterRef.current.toString(), ...options })\n },\n [setToast]\n )\n\n return (\n <ImperativeToastProvider\n scope={__scopeToast}\n addToast={addToast}\n currentToast={toast}\n >\n {children}\n </ImperativeToastProvider>\n )\n },\n useToast: () => {\n const context = useToastProviderContext('useToast', undefined)\n\n return {\n /**\n * The toast to get and show if not using native\n */\n currentToast: context.currentToast,\n show(title: string, showOptions?: ToastOptions) {\n const native = showOptions?.native || options.native\n if (\n native === true ||\n (Array.isArray(options.native) &&\n ((isWeb && options.native.includes('web')) ||\n (!isWeb && options.native.includes('mobile'))))\n ) {\n return createNativeToast(title, showOptions ?? {})\n }\n context.addToast(title, showOptions ?? {})\n },\n }\n },\n }\n}\n\nexport { createToast }\nexport type { CreateToastOptions }\n"],
5
- "mappings": "AAyDQ;AAzDR,SAAS,aAAa;AACtB,SAAgB,0BAA0B;AAC1C,OAAO,SAAS,cAAc;AAE9B,SAAS,yBAAyB;AA6BlC,MAAM,CAAC,8BAA8B,0BAA0B,IAC7D,mBAAmB,iBAAiB;AAEtC,MAAM,CAAC,yBAAyB,uBAAuB,IACrD,6BAA0D,yBAAyB;AAErF,MAAM,cAAc,CAAC,UAAU,CAAC,MAA4B;AAC1D,SAAO;AAAA,IACL,yBAAyB,CAAC;AAAA,MACxB;AAAA,MACA;AAAA,IACF,MAAkD;AAChD,YAAM,aAAa,OAAO,CAAC;AAC3B,YAAM,CAAC,OAAO,QAAQ,IACpB,MAAM,SAAsD,IAAI;AAClE,YAAM,WAAW,MAAM;AAAA,QACrB,CAAC,OAAOA,aAAY;AAClB,qBAAW;AACX,mBAAS,EAAE,OAAO,IAAI,WAAW,QAAQ,SAAS,GAAG,GAAGA,SAAQ,CAAC;AAAA,QACnE;AAAA,QACA,CAAC,QAAQ;AAAA,MACX;AAEA,aACE;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,UACP;AAAA,UACA,cAAc;AAAA,UAEb;AAAA;AAAA,MACH;AAAA,IAEJ;AAAA,IACA,UAAU,MAAM;AACd,YAAM,UAAU,wBAAwB,YAAY,MAAS;AAE7D,aAAO;AAAA;AAAA;AAAA;AAAA,QAIL,cAAc,QAAQ;AAAA,QACtB,KAAK,OAAe,aAA4B;AAC9C,gBAAM,UAAS,2CAAa,WAAU,QAAQ;AAC9C,cACE,WAAW,QACV,MAAM,QAAQ,QAAQ,MAAM,MACzB,SAAS,QAAQ,OAAO,SAAS,KAAK,KACrC,CAAC,SAAS,QAAQ,OAAO,SAAS,QAAQ,IAC/C;AACA,mBAAO,kBAAkB,OAAO,eAAe,CAAC,CAAC;AAAA,UACnD;AACA,kBAAQ,SAAS,OAAO,eAAe,CAAC,CAAC;AAAA,QAC3C;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
6
- "names": ["options"]
7
- }
@@ -1,54 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { isWeb } from "@tamagui/core";
3
- import { createContextScope } from "@tamagui/create-context";
4
- import React, { useRef } from "react";
5
- import { createNativeToast } from "./createNativeToast";
6
- const [createImperativeToastContext, createImperativeToastScope] = createContextScope("ImperativeToast");
7
- const [ImperativeToastProvider, useToastProviderContext] = createImperativeToastContext("ImperativeToastProvider");
8
- const createToast = (options = {}) => {
9
- return {
10
- ImperativeToastProvider: ({
11
- __scopeToast,
12
- children
13
- }) => {
14
- const counterRef = useRef(0);
15
- const [toast, setToast] = React.useState(null);
16
- const addToast = React.useCallback(
17
- (title, options2) => {
18
- counterRef.current++;
19
- setToast({ title, id: counterRef.current.toString(), ...options2 });
20
- },
21
- [setToast]
22
- );
23
- return /* @__PURE__ */ jsx(
24
- ImperativeToastProvider,
25
- {
26
- scope: __scopeToast,
27
- addToast,
28
- currentToast: toast,
29
- children
30
- }
31
- );
32
- },
33
- useToast: () => {
34
- const context = useToastProviderContext("useToast", void 0);
35
- return {
36
- /**
37
- * The toast to get and show if not using native
38
- */
39
- currentToast: context.currentToast,
40
- show(title, showOptions) {
41
- const native = (showOptions == null ? void 0 : showOptions.native) || options.native;
42
- if (native === true || Array.isArray(options.native) && (isWeb && options.native.includes("web") || !isWeb && options.native.includes("mobile"))) {
43
- return createNativeToast(title, showOptions ?? {});
44
- }
45
- context.addToast(title, showOptions ?? {});
46
- }
47
- };
48
- }
49
- };
50
- };
51
- export {
52
- createToast
53
- };
54
- //# sourceMappingURL=createToast.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/createToast.tsx"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/core'\nimport { Scope, createContextScope } from '@tamagui/create-context'\nimport React, { useRef } from 'react'\n\nimport { createNativeToast } from './createNativeToast'\nimport { CreateNativeToastsOptions, CreateNativeToastsOptionsFn } from './types'\n\ntype NativeValue = boolean | 'web' | 'mobile'\ninterface CreateToastOptions {\n /**\n * Will show a native toast if is true or is set to the current platform. On iOS, it wraps `SPIndicator` and `SPAlert`. On Android, it wraps `ToastAndroid`. On web, it wraps Notification API. Mobile's native features are handled by `burnt`.\n */\n native?: NativeValue\n}\ninterface ToastOptions extends CreateNativeToastsOptions {\n /**\n * Used when need custom data\n */\n additionalInfo?: Record<string, any>\n /**\n * Overrides the native option on `createToast()`\n */\n native?: NativeValue\n}\ntype ScopedProps<P> = P & { __scopeToast?: Scope }\n\ntype ToastData = { title: string; id: string } & CreateNativeToastsOptions\n\ninterface ImperativeToastContextValue {\n currentToast: ToastData | null\n addToast: CreateNativeToastsOptionsFn\n}\n\nconst [createImperativeToastContext, createImperativeToastScope] =\n createContextScope('ImperativeToast')\n\nconst [ImperativeToastProvider, useToastProviderContext] =\n createImperativeToastContext<ImperativeToastContextValue>('ImperativeToastProvider')\n\nconst createToast = (options = {} as CreateToastOptions) => {\n return {\n ImperativeToastProvider: ({\n __scopeToast,\n children,\n }: ScopedProps<{ children: React.ReactNode }>) => {\n const counterRef = useRef(0)\n const [toast, setToast] =\n React.useState<ImperativeToastContextValue['currentToast']>(null)\n const addToast = React.useCallback<CreateNativeToastsOptionsFn>(\n (title, options) => {\n counterRef.current++\n setToast({ title, id: counterRef.current.toString(), ...options })\n },\n [setToast]\n )\n\n return (\n <ImperativeToastProvider\n scope={__scopeToast}\n addToast={addToast}\n currentToast={toast}\n >\n {children}\n </ImperativeToastProvider>\n )\n },\n useToast: () => {\n const context = useToastProviderContext('useToast', undefined)\n\n return {\n /**\n * The toast to get and show if not using native\n */\n currentToast: context.currentToast,\n show(title: string, showOptions?: ToastOptions) {\n const native = showOptions?.native || options.native\n if (\n native === true ||\n (Array.isArray(options.native) &&\n ((isWeb && options.native.includes('web')) ||\n (!isWeb && options.native.includes('mobile'))))\n ) {\n return createNativeToast(title, showOptions ?? {})\n }\n context.addToast(title, showOptions ?? {})\n },\n }\n },\n }\n}\n\nexport { createToast }\nexport type { CreateToastOptions }\n"],
5
- "mappings": "AAyDQ;AAzDR,SAAS,aAAa;AACtB,SAAgB,0BAA0B;AAC1C,OAAO,SAAS,cAAc;AAE9B,SAAS,yBAAyB;AA6BlC,MAAM,CAAC,8BAA8B,0BAA0B,IAC7D,mBAAmB,iBAAiB;AAEtC,MAAM,CAAC,yBAAyB,uBAAuB,IACrD,6BAA0D,yBAAyB;AAErF,MAAM,cAAc,CAAC,UAAU,CAAC,MAA4B;AAC1D,SAAO;AAAA,IACL,yBAAyB,CAAC;AAAA,MACxB;AAAA,MACA;AAAA,IACF,MAAkD;AAChD,YAAM,aAAa,OAAO,CAAC;AAC3B,YAAM,CAAC,OAAO,QAAQ,IACpB,MAAM,SAAsD,IAAI;AAClE,YAAM,WAAW,MAAM;AAAA,QACrB,CAAC,OAAOA,aAAY;AAClB,qBAAW;AACX,mBAAS,EAAE,OAAO,IAAI,WAAW,QAAQ,SAAS,GAAG,GAAGA,SAAQ,CAAC;AAAA,QACnE;AAAA,QACA,CAAC,QAAQ;AAAA,MACX;AAEA,aACE;AAAA,QAAC;AAAA;AAAA,UACC,OAAO;AAAA,UACP;AAAA,UACA,cAAc;AAAA,UAEb;AAAA;AAAA,MACH;AAAA,IAEJ;AAAA,IACA,UAAU,MAAM;AACd,YAAM,UAAU,wBAAwB,YAAY,MAAS;AAE7D,aAAO;AAAA;AAAA;AAAA;AAAA,QAIL,cAAc,QAAQ;AAAA,QACtB,KAAK,OAAe,aAA4B;AAC9C,gBAAM,UAAS,2CAAa,WAAU,QAAQ;AAC9C,cACE,WAAW,QACV,MAAM,QAAQ,QAAQ,MAAM,MACzB,SAAS,QAAQ,OAAO,SAAS,KAAK,KACrC,CAAC,SAAS,QAAQ,OAAO,SAAS,QAAQ,IAC/C;AACA,mBAAO,kBAAkB,OAAO,eAAe,CAAC,CAAC;AAAA,UACnD;AACA,kBAAQ,SAAS,OAAO,eAAe,CAAC,CAAC;AAAA,QAC3C;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
6
- "names": ["options"]
7
- }
@@ -1,49 +0,0 @@
1
- import { isWeb } from "@tamagui/core";
2
- import { createContextScope } from "@tamagui/create-context";
3
- import React, { useRef } from "react";
4
- import { createNativeToast } from "./createNativeToast";
5
- const [createImperativeToastContext, createImperativeToastScope] = createContextScope("ImperativeToast");
6
- const [ImperativeToastProvider, useToastProviderContext] = createImperativeToastContext("ImperativeToastProvider");
7
- const createToast = (options = {}) => {
8
- return {
9
- ImperativeToastProvider: ({
10
- __scopeToast,
11
- children
12
- }) => {
13
- const counterRef = useRef(0);
14
- const [toast, setToast] = React.useState(null);
15
- const addToast = React.useCallback(
16
- (title, options2) => {
17
- counterRef.current++;
18
- setToast({ title, id: counterRef.current.toString(), ...options2 });
19
- },
20
- [setToast]
21
- );
22
- return <ImperativeToastProvider
23
- scope={__scopeToast}
24
- addToast={addToast}
25
- currentToast={toast}
26
- >{children}</ImperativeToastProvider>;
27
- },
28
- useToast: () => {
29
- const context = useToastProviderContext("useToast", void 0);
30
- return {
31
- /**
32
- * The toast to get and show if not using native
33
- */
34
- currentToast: context.currentToast,
35
- show(title, showOptions) {
36
- const native = showOptions?.native || options.native;
37
- if (native === true || Array.isArray(options.native) && (isWeb && options.native.includes("web") || !isWeb && options.native.includes("mobile"))) {
38
- return createNativeToast(title, showOptions ?? {});
39
- }
40
- context.addToast(title, showOptions ?? {});
41
- }
42
- };
43
- }
44
- };
45
- };
46
- export {
47
- createToast
48
- };
49
- //# sourceMappingURL=createToast.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/createToast.tsx"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/core'\nimport { Scope, createContextScope } from '@tamagui/create-context'\nimport React, { useRef } from 'react'\n\nimport { createNativeToast } from './createNativeToast'\nimport { CreateNativeToastsOptions, CreateNativeToastsOptionsFn } from './types'\n\ntype NativeValue = boolean | 'web' | 'mobile'\ninterface CreateToastOptions {\n /**\n * Will show a native toast if is true or is set to the current platform. On iOS, it wraps `SPIndicator` and `SPAlert`. On Android, it wraps `ToastAndroid`. On web, it wraps Notification API. Mobile's native features are handled by `burnt`.\n */\n native?: NativeValue\n}\ninterface ToastOptions extends CreateNativeToastsOptions {\n /**\n * Used when need custom data\n */\n additionalInfo?: Record<string, any>\n /**\n * Overrides the native option on `createToast()`\n */\n native?: NativeValue\n}\ntype ScopedProps<P> = P & { __scopeToast?: Scope }\n\ntype ToastData = { title: string; id: string } & CreateNativeToastsOptions\n\ninterface ImperativeToastContextValue {\n currentToast: ToastData | null\n addToast: CreateNativeToastsOptionsFn\n}\n\nconst [createImperativeToastContext, createImperativeToastScope] =\n createContextScope('ImperativeToast')\n\nconst [ImperativeToastProvider, useToastProviderContext] =\n createImperativeToastContext<ImperativeToastContextValue>('ImperativeToastProvider')\n\nconst createToast = (options = {} as CreateToastOptions) => {\n return {\n ImperativeToastProvider: ({\n __scopeToast,\n children,\n }: ScopedProps<{ children: React.ReactNode }>) => {\n const counterRef = useRef(0)\n const [toast, setToast] =\n React.useState<ImperativeToastContextValue['currentToast']>(null)\n const addToast = React.useCallback<CreateNativeToastsOptionsFn>(\n (title, options) => {\n counterRef.current++\n setToast({ title, id: counterRef.current.toString(), ...options })\n },\n [setToast]\n )\n\n return (\n <ImperativeToastProvider\n scope={__scopeToast}\n addToast={addToast}\n currentToast={toast}\n >\n {children}\n </ImperativeToastProvider>\n )\n },\n useToast: () => {\n const context = useToastProviderContext('useToast', undefined)\n\n return {\n /**\n * The toast to get and show if not using native\n */\n currentToast: context.currentToast,\n show(title: string, showOptions?: ToastOptions) {\n const native = showOptions?.native || options.native\n if (\n native === true ||\n (Array.isArray(options.native) &&\n ((isWeb && options.native.includes('web')) ||\n (!isWeb && options.native.includes('mobile'))))\n ) {\n return createNativeToast(title, showOptions ?? {})\n }\n context.addToast(title, showOptions ?? {})\n },\n }\n },\n }\n}\n\nexport { createToast }\nexport type { CreateToastOptions }\n"],
5
- "mappings": "AAAA,SAAS,aAAa;AACtB,SAAgB,0BAA0B;AAC1C,OAAO,SAAS,cAAc;AAE9B,SAAS,yBAAyB;AA6BlC,MAAM,CAAC,8BAA8B,0BAA0B,IAC7D,mBAAmB,iBAAiB;AAEtC,MAAM,CAAC,yBAAyB,uBAAuB,IACrD,6BAA0D,yBAAyB;AAErF,MAAM,cAAc,CAAC,UAAU,CAAC,MAA4B;AAC1D,SAAO;AAAA,IACL,yBAAyB,CAAC;AAAA,MACxB;AAAA,MACA;AAAA,IACF,MAAkD;AAChD,YAAM,aAAa,OAAO,CAAC;AAC3B,YAAM,CAAC,OAAO,QAAQ,IACpB,MAAM,SAAsD,IAAI;AAClE,YAAM,WAAW,MAAM;AAAA,QACrB,CAAC,OAAOA,aAAY;AAClB,qBAAW;AACX,mBAAS,EAAE,OAAO,IAAI,WAAW,QAAQ,SAAS,GAAG,GAAGA,SAAQ,CAAC;AAAA,QACnE;AAAA,QACA,CAAC,QAAQ;AAAA,MACX;AAEA,aACE,CAAC;AAAA,QACC,OAAO;AAAA,QACP,UAAU;AAAA,QACV,cAAc;AAAA,QAEb,SACH,EANC;AAAA,IAQL;AAAA,IACA,UAAU,MAAM;AACd,YAAM,UAAU,wBAAwB,YAAY,MAAS;AAE7D,aAAO;AAAA;AAAA;AAAA;AAAA,QAIL,cAAc,QAAQ;AAAA,QACtB,KAAK,OAAe,aAA4B;AAC9C,gBAAM,SAAS,aAAa,UAAU,QAAQ;AAC9C,cACE,WAAW,QACV,MAAM,QAAQ,QAAQ,MAAM,MACzB,SAAS,QAAQ,OAAO,SAAS,KAAK,KACrC,CAAC,SAAS,QAAQ,OAAO,SAAS,QAAQ,IAC/C;AACA,mBAAO,kBAAkB,OAAO,eAAe,CAAC,CAAC;AAAA,UACnD;AACA,kBAAQ,SAAS,OAAO,eAAe,CAAC,CAAC;AAAA,QAC3C;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
6
- "names": ["options"]
7
- }
@@ -1,49 +0,0 @@
1
- import { isWeb } from "@tamagui/core";
2
- import { createContextScope } from "@tamagui/create-context";
3
- import React, { useRef } from "react";
4
- import { createNativeToast } from "./createNativeToast";
5
- const [createImperativeToastContext, createImperativeToastScope] = createContextScope("ImperativeToast");
6
- const [ImperativeToastProvider, useToastProviderContext] = createImperativeToastContext("ImperativeToastProvider");
7
- const createToast = (options = {}) => {
8
- return {
9
- ImperativeToastProvider: ({
10
- __scopeToast,
11
- children
12
- }) => {
13
- const counterRef = useRef(0);
14
- const [toast, setToast] = React.useState(null);
15
- const addToast = React.useCallback(
16
- (title, options2) => {
17
- counterRef.current++;
18
- setToast({ title, id: counterRef.current.toString(), ...options2 });
19
- },
20
- [setToast]
21
- );
22
- return <ImperativeToastProvider
23
- scope={__scopeToast}
24
- addToast={addToast}
25
- currentToast={toast}
26
- >{children}</ImperativeToastProvider>;
27
- },
28
- useToast: () => {
29
- const context = useToastProviderContext("useToast", void 0);
30
- return {
31
- /**
32
- * The toast to get and show if not using native
33
- */
34
- currentToast: context.currentToast,
35
- show(title, showOptions) {
36
- const native = showOptions?.native || options.native;
37
- if (native === true || Array.isArray(options.native) && (isWeb && options.native.includes("web") || !isWeb && options.native.includes("mobile"))) {
38
- return createNativeToast(title, showOptions ?? {});
39
- }
40
- context.addToast(title, showOptions ?? {});
41
- }
42
- };
43
- }
44
- };
45
- };
46
- export {
47
- createToast
48
- };
49
- //# sourceMappingURL=createToast.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/createToast.tsx"],
4
- "sourcesContent": ["import { isWeb } from '@tamagui/core'\nimport { Scope, createContextScope } from '@tamagui/create-context'\nimport React, { useRef } from 'react'\n\nimport { createNativeToast } from './createNativeToast'\nimport { CreateNativeToastsOptions, CreateNativeToastsOptionsFn } from './types'\n\ntype NativeValue = boolean | 'web' | 'mobile'\ninterface CreateToastOptions {\n /**\n * Will show a native toast if is true or is set to the current platform. On iOS, it wraps `SPIndicator` and `SPAlert`. On Android, it wraps `ToastAndroid`. On web, it wraps Notification API. Mobile's native features are handled by `burnt`.\n */\n native?: NativeValue\n}\ninterface ToastOptions extends CreateNativeToastsOptions {\n /**\n * Used when need custom data\n */\n additionalInfo?: Record<string, any>\n /**\n * Overrides the native option on `createToast()`\n */\n native?: NativeValue\n}\ntype ScopedProps<P> = P & { __scopeToast?: Scope }\n\ntype ToastData = { title: string; id: string } & CreateNativeToastsOptions\n\ninterface ImperativeToastContextValue {\n currentToast: ToastData | null\n addToast: CreateNativeToastsOptionsFn\n}\n\nconst [createImperativeToastContext, createImperativeToastScope] =\n createContextScope('ImperativeToast')\n\nconst [ImperativeToastProvider, useToastProviderContext] =\n createImperativeToastContext<ImperativeToastContextValue>('ImperativeToastProvider')\n\nconst createToast = (options = {} as CreateToastOptions) => {\n return {\n ImperativeToastProvider: ({\n __scopeToast,\n children,\n }: ScopedProps<{ children: React.ReactNode }>) => {\n const counterRef = useRef(0)\n const [toast, setToast] =\n React.useState<ImperativeToastContextValue['currentToast']>(null)\n const addToast = React.useCallback<CreateNativeToastsOptionsFn>(\n (title, options) => {\n counterRef.current++\n setToast({ title, id: counterRef.current.toString(), ...options })\n },\n [setToast]\n )\n\n return (\n <ImperativeToastProvider\n scope={__scopeToast}\n addToast={addToast}\n currentToast={toast}\n >\n {children}\n </ImperativeToastProvider>\n )\n },\n useToast: () => {\n const context = useToastProviderContext('useToast', undefined)\n\n return {\n /**\n * The toast to get and show if not using native\n */\n currentToast: context.currentToast,\n show(title: string, showOptions?: ToastOptions) {\n const native = showOptions?.native || options.native\n if (\n native === true ||\n (Array.isArray(options.native) &&\n ((isWeb && options.native.includes('web')) ||\n (!isWeb && options.native.includes('mobile'))))\n ) {\n return createNativeToast(title, showOptions ?? {})\n }\n context.addToast(title, showOptions ?? {})\n },\n }\n },\n }\n}\n\nexport { createToast }\nexport type { CreateToastOptions }\n"],
5
- "mappings": "AAAA,SAAS,aAAa;AACtB,SAAgB,0BAA0B;AAC1C,OAAO,SAAS,cAAc;AAE9B,SAAS,yBAAyB;AA6BlC,MAAM,CAAC,8BAA8B,0BAA0B,IAC7D,mBAAmB,iBAAiB;AAEtC,MAAM,CAAC,yBAAyB,uBAAuB,IACrD,6BAA0D,yBAAyB;AAErF,MAAM,cAAc,CAAC,UAAU,CAAC,MAA4B;AAC1D,SAAO;AAAA,IACL,yBAAyB,CAAC;AAAA,MACxB;AAAA,MACA;AAAA,IACF,MAAkD;AAChD,YAAM,aAAa,OAAO,CAAC;AAC3B,YAAM,CAAC,OAAO,QAAQ,IACpB,MAAM,SAAsD,IAAI;AAClE,YAAM,WAAW,MAAM;AAAA,QACrB,CAAC,OAAOA,aAAY;AAClB,qBAAW;AACX,mBAAS,EAAE,OAAO,IAAI,WAAW,QAAQ,SAAS,GAAG,GAAGA,SAAQ,CAAC;AAAA,QACnE;AAAA,QACA,CAAC,QAAQ;AAAA,MACX;AAEA,aACE,CAAC;AAAA,QACC,OAAO;AAAA,QACP,UAAU;AAAA,QACV,cAAc;AAAA,QAEb,SACH,EANC;AAAA,IAQL;AAAA,IACA,UAAU,MAAM;AACd,YAAM,UAAU,wBAAwB,YAAY,MAAS;AAE7D,aAAO;AAAA;AAAA;AAAA;AAAA,QAIL,cAAc,QAAQ;AAAA,QACtB,KAAK,OAAe,aAA4B;AAC9C,gBAAM,SAAS,aAAa,UAAU,QAAQ;AAC9C,cACE,WAAW,QACV,MAAM,QAAQ,QAAQ,MAAM,MACzB,SAAS,QAAQ,OAAO,SAAS,KAAK,KACrC,CAAC,SAAS,QAAQ,OAAO,SAAS,QAAQ,IAC/C;AACA,mBAAO,kBAAkB,OAAO,eAAe,CAAC,CAAC;AAAA,UACnD;AACA,kBAAQ,SAAS,OAAO,eAAe,CAAC,CAAC;AAAA,QAC3C;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
6
- "names": ["options"]
7
- }