@tamagui/toast 1.89.26 → 1.89.27-1708113113238
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Toast.native.js +158 -52
- package/dist/cjs/Toast.native.js.map +3 -3
- package/dist/cjs/ToastAnnounce.native.js +139 -31
- package/dist/cjs/ToastAnnounce.native.js.map +3 -3
- package/dist/cjs/ToastImperative.native.js +127 -30
- package/dist/cjs/ToastImperative.native.js.map +3 -3
- package/dist/cjs/ToastImpl.native.js +308 -142
- package/dist/cjs/ToastImpl.native.js.map +3 -3
- package/dist/cjs/ToastPortal.native.js +18 -9
- package/dist/cjs/ToastPortal.native.js.map +3 -3
- package/dist/cjs/ToastProvider.native.js +137 -51
- package/dist/cjs/ToastProvider.native.js.map +3 -3
- package/dist/cjs/ToastViewport.native.js +264 -183
- package/dist/cjs/ToastViewport.native.js.map +3 -3
- package/dist/cjs/constants.native.js +1 -1
- package/dist/cjs/constants.native.js.map +3 -3
- package/dist/cjs/createNativeToast.native.js +29 -7
- package/dist/cjs/createNativeToast.native.js.map +3 -3
- package/dist/cjs/index.native.js.map +2 -2
- package/dist/cjs/types.native.js.map +2 -2
- package/dist/esm/Toast.native.js +157 -52
- package/dist/esm/Toast.native.js.map +3 -3
- package/dist/esm/ToastAnnounce.native.js +138 -31
- package/dist/esm/ToastAnnounce.native.js.map +3 -3
- package/dist/esm/ToastImperative.native.js +126 -30
- package/dist/esm/ToastImperative.native.js.map +3 -3
- package/dist/esm/ToastImpl.mjs +2 -2
- package/dist/esm/ToastImpl.native.js +308 -151
- package/dist/esm/ToastImpl.native.js.map +3 -3
- package/dist/esm/ToastPortal.native.js +8 -7
- package/dist/esm/ToastPortal.native.js.map +3 -3
- package/dist/esm/ToastProvider.native.js +136 -51
- package/dist/esm/ToastProvider.native.js.map +3 -3
- package/dist/esm/ToastViewport.native.js +263 -183
- package/dist/esm/ToastViewport.native.js.map +3 -3
- package/dist/esm/constants.native.js +1 -1
- package/dist/esm/constants.native.js.map +3 -3
- package/dist/esm/createNativeToast.native.js +29 -7
- package/dist/esm/createNativeToast.native.js.map +3 -3
- package/dist/esm/index.native.js.map +1 -1
- package/dist/jsx/Toast.native.js +157 -52
- package/dist/jsx/Toast.native.js.map +3 -3
- package/dist/jsx/ToastAnnounce.native.js +138 -31
- package/dist/jsx/ToastAnnounce.native.js.map +3 -3
- package/dist/jsx/ToastImperative.native.js +126 -30
- package/dist/jsx/ToastImperative.native.js.map +3 -3
- package/dist/jsx/ToastImpl.mjs +2 -2
- package/dist/jsx/ToastImpl.native.js +308 -151
- package/dist/jsx/ToastImpl.native.js.map +3 -3
- package/dist/jsx/ToastPortal.native.js +8 -7
- package/dist/jsx/ToastPortal.native.js.map +3 -3
- package/dist/jsx/ToastProvider.native.js +136 -51
- package/dist/jsx/ToastProvider.native.js.map +3 -3
- package/dist/jsx/ToastViewport.native.js +263 -183
- package/dist/jsx/ToastViewport.native.js.map +3 -3
- package/dist/jsx/constants.native.js +1 -1
- package/dist/jsx/constants.native.js.map +3 -3
- package/dist/jsx/createNativeToast.native.js +29 -7
- package/dist/jsx/createNativeToast.native.js.map +3 -3
- package/dist/jsx/index.native.js.map +1 -1
- package/package.json +16 -16
package/dist/cjs/Toast.native.js
CHANGED
|
@@ -31,8 +31,108 @@ __export(Toast_exports, {
|
|
|
31
31
|
useToastState: () => import_ToastImperative.useToastState
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(Toast_exports);
|
|
34
|
-
var import_core = require("@tamagui/core"), import_helpers = require("@tamagui/helpers"), import_stacks = require("@tamagui/stacks"), import_text = require("@tamagui/text"), import_use_controllable_state = require("@tamagui/use-controllable-state"), React = __toESM(require("react")), import_constants = require("./constants"), import_ToastAnnounce = require("./ToastAnnounce"), import_ToastImperative = require("./ToastImperative"), import_ToastImpl = require("./ToastImpl"), import_ToastProvider = require("./ToastProvider"), import_ToastViewport = require("./ToastViewport")
|
|
35
|
-
|
|
34
|
+
var import_core = require("@tamagui/core"), import_helpers = require("@tamagui/helpers"), import_stacks = require("@tamagui/stacks"), import_text = require("@tamagui/text"), import_use_controllable_state = require("@tamagui/use-controllable-state"), React = __toESM(require("react")), import_constants = require("./constants"), import_ToastAnnounce = require("./ToastAnnounce"), import_ToastImperative = require("./ToastImperative"), import_ToastImpl = require("./ToastImpl"), import_ToastProvider = require("./ToastProvider"), import_ToastViewport = require("./ToastViewport");
|
|
35
|
+
function _array_like_to_array(arr, len) {
|
|
36
|
+
(len == null || len > arr.length) && (len = arr.length);
|
|
37
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
38
|
+
arr2[i] = arr[i];
|
|
39
|
+
return arr2;
|
|
40
|
+
}
|
|
41
|
+
function _array_with_holes(arr) {
|
|
42
|
+
if (Array.isArray(arr))
|
|
43
|
+
return arr;
|
|
44
|
+
}
|
|
45
|
+
function _define_property(obj, key, value) {
|
|
46
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
47
|
+
value,
|
|
48
|
+
enumerable: !0,
|
|
49
|
+
configurable: !0,
|
|
50
|
+
writable: !0
|
|
51
|
+
}) : obj[key] = value, obj;
|
|
52
|
+
}
|
|
53
|
+
function _iterable_to_array_limit(arr, i) {
|
|
54
|
+
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
55
|
+
if (_i != null) {
|
|
56
|
+
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
57
|
+
try {
|
|
58
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
59
|
+
;
|
|
60
|
+
} catch (err) {
|
|
61
|
+
_d = !0, _e = err;
|
|
62
|
+
} finally {
|
|
63
|
+
try {
|
|
64
|
+
!_n && _i.return != null && _i.return();
|
|
65
|
+
} finally {
|
|
66
|
+
if (_d)
|
|
67
|
+
throw _e;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return _arr;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function _non_iterable_rest() {
|
|
74
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
75
|
+
}
|
|
76
|
+
function _object_spread(target) {
|
|
77
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
78
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
79
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
80
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
81
|
+
}))), ownKeys2.forEach(function(key) {
|
|
82
|
+
_define_property(target, key, source[key]);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return target;
|
|
86
|
+
}
|
|
87
|
+
function ownKeys(object, enumerableOnly) {
|
|
88
|
+
var keys = Object.keys(object);
|
|
89
|
+
if (Object.getOwnPropertySymbols) {
|
|
90
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
91
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
92
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
93
|
+
})), keys.push.apply(keys, symbols);
|
|
94
|
+
}
|
|
95
|
+
return keys;
|
|
96
|
+
}
|
|
97
|
+
function _object_spread_props(target, source) {
|
|
98
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
99
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
100
|
+
}), target;
|
|
101
|
+
}
|
|
102
|
+
function _object_without_properties(source, excluded) {
|
|
103
|
+
if (source == null)
|
|
104
|
+
return {};
|
|
105
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
106
|
+
if (Object.getOwnPropertySymbols) {
|
|
107
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
108
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
109
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
110
|
+
}
|
|
111
|
+
return target;
|
|
112
|
+
}
|
|
113
|
+
function _object_without_properties_loose(source, excluded) {
|
|
114
|
+
if (source == null)
|
|
115
|
+
return {};
|
|
116
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
117
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
118
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
119
|
+
return target;
|
|
120
|
+
}
|
|
121
|
+
function _sliced_to_array(arr, i) {
|
|
122
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
123
|
+
}
|
|
124
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
125
|
+
if (o) {
|
|
126
|
+
if (typeof o == "string")
|
|
127
|
+
return _array_like_to_array(o, minLen);
|
|
128
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
129
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
|
|
130
|
+
return Array.from(n);
|
|
131
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
132
|
+
return _array_like_to_array(o, minLen);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
var TITLE_NAME = "ToastTitle", ToastTitle = (0, import_core.styled)(import_text.SizableText, {
|
|
36
136
|
name: TITLE_NAME,
|
|
37
137
|
variants: {
|
|
38
138
|
unstyled: {
|
|
@@ -47,7 +147,7 @@ const TITLE_NAME = "ToastTitle", ToastTitle = (0, import_core.styled)(import_tex
|
|
|
47
147
|
}
|
|
48
148
|
});
|
|
49
149
|
ToastTitle.displayName = TITLE_NAME;
|
|
50
|
-
|
|
150
|
+
var DESCRIPTION_NAME = "ToastDescription", ToastDescription = (0, import_core.styled)(import_text.SizableText, {
|
|
51
151
|
name: DESCRIPTION_NAME,
|
|
52
152
|
variants: {
|
|
53
153
|
unstyled: {
|
|
@@ -62,63 +162,69 @@ const DESCRIPTION_NAME = "ToastDescription", ToastDescription = (0, import_core.
|
|
|
62
162
|
}
|
|
63
163
|
});
|
|
64
164
|
ToastDescription.displayName = DESCRIPTION_NAME;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
165
|
+
var ACTION_NAME = "ToastAction", ToastAction = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
166
|
+
var altText2 = props.altText, actionProps = _object_without_properties(props, [
|
|
167
|
+
"altText"
|
|
168
|
+
]);
|
|
169
|
+
return altText2 ? /* @__PURE__ */ React.createElement(import_ToastAnnounce.ToastAnnounceExclude, {
|
|
170
|
+
altText: altText2,
|
|
171
|
+
asChild: !0
|
|
172
|
+
}, /* @__PURE__ */ React.createElement(ToastClose, _object_spread_props(_object_spread({}, actionProps), {
|
|
173
|
+
ref: forwardedRef
|
|
174
|
+
}))) : null;
|
|
175
|
+
});
|
|
71
176
|
ToastAction.propTypes = {
|
|
72
|
-
altText(props) {
|
|
73
|
-
return props.altText ? null : new Error(
|
|
177
|
+
altText: function(props) {
|
|
178
|
+
return props.altText ? null : new Error("Missing prop `altText` expected on `".concat(ACTION_NAME, "`"));
|
|
74
179
|
}
|
|
75
180
|
};
|
|
76
181
|
ToastAction.displayName = ACTION_NAME;
|
|
77
|
-
|
|
182
|
+
var CLOSE_NAME = "ToastClose", ToastCloseFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
78
183
|
name: CLOSE_NAME,
|
|
79
184
|
tag: "button"
|
|
80
|
-
}), ToastClose = React.forwardRef(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
);
|
|
185
|
+
}), ToastClose = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
186
|
+
var __scopeToast = props.__scopeToast, closeProps = _object_without_properties(props, [
|
|
187
|
+
"__scopeToast"
|
|
188
|
+
]), interactiveContext = (0, import_ToastImpl.useToastInteractiveContext)(__scopeToast);
|
|
189
|
+
return /* @__PURE__ */ React.createElement(import_ToastAnnounce.ToastAnnounceExclude, {
|
|
190
|
+
asChild: !0
|
|
191
|
+
}, /* @__PURE__ */ React.createElement(ToastCloseFrame, _object_spread_props(_object_spread({
|
|
192
|
+
accessibilityLabel: "Dialog Close"
|
|
193
|
+
}, closeProps), {
|
|
194
|
+
ref: forwardedRef,
|
|
195
|
+
onPress: (0, import_helpers.composeEventHandlers)(props.onPress, interactiveContext.onClose)
|
|
196
|
+
})));
|
|
197
|
+
});
|
|
94
198
|
ToastClose.displayName = CLOSE_NAME;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
)
|
|
199
|
+
var ToastComponent = import_ToastImpl.ToastImplFrame.styleable(function(props, forwardedRef) {
|
|
200
|
+
var forceMount = props.forceMount, openProp = props.open, defaultOpen = props.defaultOpen, onOpenChange = props.onOpenChange, toastProps = _object_without_properties(props, [
|
|
201
|
+
"forceMount",
|
|
202
|
+
"open",
|
|
203
|
+
"defaultOpen",
|
|
204
|
+
"onOpenChange"
|
|
205
|
+
]), _useControllableState = _sliced_to_array((0, import_use_controllable_state.useControllableState)({
|
|
206
|
+
prop: openProp,
|
|
207
|
+
defaultProp: defaultOpen ?? !0,
|
|
208
|
+
onChange: onOpenChange,
|
|
209
|
+
strategy: "most-recent-wins"
|
|
210
|
+
}), 2), open = _useControllableState[0], setOpen = _useControllableState[1], id = React.useId(), onPause = (0, import_core.useEvent)(props.onPause), onResume = (0, import_core.useEvent)(props.onResume), shouldShow = forceMount || open;
|
|
211
|
+
return shouldShow ? /* @__PURE__ */ React.createElement(import_ToastImpl.ToastImpl, _object_spread_props(_object_spread({
|
|
212
|
+
id,
|
|
213
|
+
open
|
|
214
|
+
}, toastProps), {
|
|
215
|
+
ref: forwardedRef,
|
|
216
|
+
onClose: function() {
|
|
217
|
+
return setOpen(!1);
|
|
218
|
+
},
|
|
219
|
+
onPause,
|
|
220
|
+
onResume,
|
|
221
|
+
onSwipeEnd: (0, import_helpers.composeEventHandlers)(props.onSwipeEnd, function(event) {
|
|
222
|
+
setOpen(!1);
|
|
223
|
+
})
|
|
224
|
+
})) : null;
|
|
225
|
+
});
|
|
120
226
|
ToastComponent.displayName = import_constants.TOAST_NAME;
|
|
121
|
-
|
|
227
|
+
var Toast = (0, import_helpers.withStaticProperties)(ToastComponent, {
|
|
122
228
|
Title: ToastTitle,
|
|
123
229
|
Description: ToastDescription,
|
|
124
230
|
Action: ToastAction,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/Toast.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/toast/src/Toast.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,kBAAiC,0BACjC,iBAA2D,6BAC3D,gBAA+B,4BAC/B,cAA4B,0BAC5B,gCAAqC,4CACrC,QAAuB,2BA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;AAGFd,eAAe7B,cAAcqD;AAE7B,IAAMC,YAAQC,qCAAqB1B,gBAAgB;EACjD2B,OAAOrE;EACPsE,aAAavD;EACbwD,QAAQtD;EACRuD,OAAO9C;AACT,CAAA;",
|
|
5
|
+
"names": ["TITLE_NAME", "ToastTitle", "styled", "SizableText", "name", "variants", "unstyled", "false", "color", "size", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "displayName", "DESCRIPTION_NAME", "ToastDescription", "ACTION_NAME", "ToastAction", "React", "forwardRef", "props", "forwardedRef", "altText", "actionProps", "ToastAnnounceExclude", "asChild", "ToastClose", "ref", "propTypes", "Error", "CLOSE_NAME", "ToastCloseFrame", "ThemeableStack", "tag", "__scopeToast", "closeProps", "interactiveContext", "useToastInteractiveContext", "accessibilityLabel", "onPress", "composeEventHandlers", "onClose", "ToastComponent", "ToastImplFrame", "styleable", "forceMount", "openProp", "open", "defaultOpen", "onOpenChange", "toastProps", "useControllableState", "prop", "defaultProp", "onChange", "strategy", "setOpen", "id", "useId", "onPause", "useEvent", "onResume", "shouldShow", "ToastImpl", "onSwipeEnd", "event", "TOAST_NAME", "Toast", "withStaticProperties", "Title", "Description", "Action", "Close"]
|
|
6
6
|
}
|
|
@@ -27,42 +27,150 @@ __export(ToastAnnounce_exports, {
|
|
|
27
27
|
ToastAnnounceExclude: () => ToastAnnounceExclude
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(ToastAnnounce_exports);
|
|
30
|
-
var import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_portal = require("@tamagui/portal"), import_visually_hidden = require("@tamagui/visually-hidden"), React = __toESM(require("react")), import_ToastProvider = require("./ToastProvider")
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
var import_constants = require("@tamagui/constants"), import_core = require("@tamagui/core"), import_portal = require("@tamagui/portal"), import_visually_hidden = require("@tamagui/visually-hidden"), React = __toESM(require("react")), import_ToastProvider = require("./ToastProvider");
|
|
31
|
+
function _array_like_to_array(arr, len) {
|
|
32
|
+
(len == null || len > arr.length) && (len = arr.length);
|
|
33
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
34
|
+
arr2[i] = arr[i];
|
|
35
|
+
return arr2;
|
|
36
|
+
}
|
|
37
|
+
function _array_with_holes(arr) {
|
|
38
|
+
if (Array.isArray(arr))
|
|
39
|
+
return arr;
|
|
40
|
+
}
|
|
41
|
+
function _define_property(obj, key, value) {
|
|
42
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
43
|
+
value,
|
|
44
|
+
enumerable: !0,
|
|
45
|
+
configurable: !0,
|
|
46
|
+
writable: !0
|
|
47
|
+
}) : obj[key] = value, obj;
|
|
48
|
+
}
|
|
49
|
+
function _iterable_to_array_limit(arr, i) {
|
|
50
|
+
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
51
|
+
if (_i != null) {
|
|
52
|
+
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
53
|
+
try {
|
|
54
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
55
|
+
;
|
|
56
|
+
} catch (err) {
|
|
57
|
+
_d = !0, _e = err;
|
|
58
|
+
} finally {
|
|
59
|
+
try {
|
|
60
|
+
!_n && _i.return != null && _i.return();
|
|
61
|
+
} finally {
|
|
62
|
+
if (_d)
|
|
63
|
+
throw _e;
|
|
64
|
+
}
|
|
42
65
|
}
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
66
|
+
return _arr;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function _non_iterable_rest() {
|
|
70
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
71
|
+
}
|
|
72
|
+
function _object_spread(target) {
|
|
73
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
74
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
75
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
76
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
77
|
+
}))), ownKeys2.forEach(function(key) {
|
|
78
|
+
_define_property(target, key, source[key]);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return target;
|
|
82
|
+
}
|
|
83
|
+
function ownKeys(object, enumerableOnly) {
|
|
84
|
+
var keys = Object.keys(object);
|
|
85
|
+
if (Object.getOwnPropertySymbols) {
|
|
86
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
87
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
88
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
89
|
+
})), keys.push.apply(keys, symbols);
|
|
90
|
+
}
|
|
91
|
+
return keys;
|
|
92
|
+
}
|
|
93
|
+
function _object_spread_props(target, source) {
|
|
94
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
95
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
96
|
+
}), target;
|
|
97
|
+
}
|
|
98
|
+
function _object_without_properties(source, excluded) {
|
|
99
|
+
if (source == null)
|
|
100
|
+
return {};
|
|
101
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
102
|
+
if (Object.getOwnPropertySymbols) {
|
|
103
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
104
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
105
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
106
|
+
}
|
|
107
|
+
return target;
|
|
108
|
+
}
|
|
109
|
+
function _object_without_properties_loose(source, excluded) {
|
|
110
|
+
if (source == null)
|
|
111
|
+
return {};
|
|
112
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
113
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
114
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
115
|
+
return target;
|
|
116
|
+
}
|
|
117
|
+
function _sliced_to_array(arr, i) {
|
|
118
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
119
|
+
}
|
|
120
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
121
|
+
if (o) {
|
|
122
|
+
if (typeof o == "string")
|
|
123
|
+
return _array_like_to_array(o, minLen);
|
|
124
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
125
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set")
|
|
126
|
+
return Array.from(n);
|
|
127
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
128
|
+
return _array_like_to_array(o, minLen);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
var ToastAnnounceExcludeFrame = (0, import_core.styled)(import_core.Stack, {
|
|
132
|
+
name: "ToastAnnounceExclude"
|
|
133
|
+
}), ToastAnnounceExclude = /* @__PURE__ */ React.forwardRef(function(props, forwardedRef) {
|
|
134
|
+
var altText = props.altText, announceExcludeProps = _object_without_properties(props, [
|
|
135
|
+
"altText"
|
|
136
|
+
]);
|
|
137
|
+
return /* @__PURE__ */ React.createElement(ToastAnnounceExcludeFrame, _object_spread_props(_object_spread({
|
|
138
|
+
"data-toast-announce-exclude": "",
|
|
139
|
+
"data-toast-announce-alt": altText || void 0
|
|
140
|
+
}, announceExcludeProps), {
|
|
141
|
+
ref: forwardedRef
|
|
142
|
+
}));
|
|
143
|
+
}), ToastAnnounce = function(props) {
|
|
144
|
+
var __scopeToast = props.__scopeToast, children = props.children, announceProps = _object_without_properties(props, [
|
|
145
|
+
"__scopeToast",
|
|
146
|
+
"children"
|
|
147
|
+
]), context = (0, import_ToastProvider.useToastProviderContext)(__scopeToast), _React_useState = _sliced_to_array(React.useState(!1), 2), renderAnnounceText = _React_useState[0], setRenderAnnounceText = _React_useState[1], _React_useState1 = _sliced_to_array(React.useState(!1), 2), isAnnounced = _React_useState1[0], setIsAnnounced = _React_useState1[1];
|
|
148
|
+
return useNextFrame(function() {
|
|
149
|
+
return setRenderAnnounceText(!0);
|
|
150
|
+
}), React.useEffect(function() {
|
|
151
|
+
var timer = setTimeout(function() {
|
|
152
|
+
return setIsAnnounced(!0);
|
|
153
|
+
}, 1e3);
|
|
154
|
+
return function() {
|
|
155
|
+
return clearTimeout(timer);
|
|
156
|
+
};
|
|
157
|
+
}, []), isAnnounced ? null : /* @__PURE__ */ React.createElement(import_portal.Portal, {
|
|
158
|
+
asChild: !0
|
|
159
|
+
}, /* @__PURE__ */ React.createElement(import_visually_hidden.VisuallyHidden, announceProps, renderAnnounceText && /* @__PURE__ */ React.createElement(import_core.Text, null, context.label, " ", children)));
|
|
54
160
|
};
|
|
55
|
-
function useNextFrame(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
(0, import_constants.useIsomorphicLayoutEffect)(()
|
|
59
|
-
|
|
60
|
-
return raf1 = requestAnimationFrame(()
|
|
161
|
+
function useNextFrame() {
|
|
162
|
+
var callback = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : function() {
|
|
163
|
+
}, fn = (0, import_core.useEvent)(callback);
|
|
164
|
+
(0, import_constants.useIsomorphicLayoutEffect)(function() {
|
|
165
|
+
var raf1 = 0, raf2 = 0;
|
|
166
|
+
return raf1 = requestAnimationFrame(function() {
|
|
61
167
|
raf2 = requestAnimationFrame(fn);
|
|
62
|
-
}), ()
|
|
168
|
+
}), function() {
|
|
63
169
|
cancelAnimationFrame(raf1), cancelAnimationFrame(raf2);
|
|
64
170
|
};
|
|
65
|
-
}, [
|
|
171
|
+
}, [
|
|
172
|
+
fn
|
|
173
|
+
]);
|
|
66
174
|
}
|
|
67
175
|
// Annotate the CommonJS export names for ESM import in node:
|
|
68
176
|
0 && (module.exports = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/ToastAnnounce.tsx"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": []
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/packages/toast/src/ToastAnnounce.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAA0C,+BAE1C,cAA8C,0BAC9C,gBAAuB,4BACvB,yBAA+B,qCAC/B,QAAuB,2BAGvB,uBAAwC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAExC,IAAMA,gCAA4BC,oBAAOC,mBAAO;EAC9CC,MAAM;AACR,CAAA,GAMMC,uBAAuBC,sBAAMC,WAGjC,SAACC,OAA+CC,cAAAA;AAChD,MAAQC,UAAqCF,MAArCE,SAAYC,uBAAAA,2BAAyBH,OAAAA;IAArCE;;AAER,SACE,sBAAA,cAACT,2BAAAA,qBAAAA,eAAAA;IACCW,+BAA4B;IAC5BC,2BAAyBH,WAAWI;KAChCH,oBAAAA,GAAAA;IACJI,KAAKN;;AAGX,CAAA,GAQMO,gBAA2D,SAC/DR,OAAAA;AAEA,MAAQS,eAA6CT,MAA7CS,cAAcC,WAA+BV,MAA/BU,UAAaC,gBAAAA,2BAAkBX,OAAAA;IAA7CS;IAAcC;MAChBE,cAAUC,8CAAwBJ,YAAAA,GACYX,kBAAAA,iBAAAA,MAAMgB,SAAS,EAAA,GAAA,CAAA,GAA5DC,qBAA6CjB,gBAAAA,CAAAA,GAAzBkB,wBAAyBlB,gBAAAA,CAAAA,GACdA,mBAAAA,iBAAAA,MAAMgB,SAAS,EAAA,GAAA,CAAA,GAA9CG,cAA+BnB,iBAAAA,CAAAA,GAAlBoB,iBAAkBpB,iBAAAA,CAAAA;AAGtCqB,sBAAa,WAAA;WAAMH,sBAAsB,EAAA;MAGzClB,MAAMsB,UAAU,WAAA;AACd,QAAMC,QAAQC,WAAW,WAAA;aAAMJ,eAAe,EAAA;OAAO,GAAA;AACrD,WAAO,WAAA;aAAMK,aAAaF,KAAAA;;EAC5B,GAAG,CAAA,CAAE,GAEEJ,cAAc,OACnB,sBAAA,cAACO,sBAAAA;IAAOC,SAAAA;KACN,sBAAA,cAACC,uCAAmBf,eACjBI,sBACC,sBAAA,cAACY,kBAAAA,MACEf,QAAQgB,OAAM,KAAElB,QAAAA,CAAAA,CAAAA;AAM7B;AAIA,SAASS,eAAAA;MAAaU,WAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAAW,WAAA;EAAO,GAChCC,SAAKC,sBAASF,QAAAA;AACpBG,kDAA0B,WAAA;AACxB,QAAIC,OAAO,GACPC,OAAO;AACXD,kBAAOE,sBAAsB,WAAA;AAC3BD,aAAOC,sBAAsBL,EAAAA;IAC/B,CAAA,GACO,WAAA;AACLM,2BAAqBH,IAAAA,GACrBG,qBAAqBF,IAAAA;IACvB;EACF,GAAG;IAACJ;GAAG;AACT;",
|
|
5
|
+
"names": ["ToastAnnounceExcludeFrame", "styled", "Stack", "name", "ToastAnnounceExclude", "React", "forwardRef", "props", "forwardedRef", "altText", "announceExcludeProps", "data-toast-announce-exclude", "data-toast-announce-alt", "undefined", "ref", "ToastAnnounce", "__scopeToast", "children", "announceProps", "context", "useToastProviderContext", "useState", "renderAnnounceText", "setRenderAnnounceText", "isAnnounced", "setIsAnnounced", "useNextFrame", "useEffect", "timer", "setTimeout", "clearTimeout", "Portal", "asChild", "VisuallyHidden", "Text", "label", "callback", "fn", "useEvent", "useIsomorphicLayoutEffect", "raf1", "raf2", "requestAnimationFrame", "cancelAnimationFrame"]
|
|
6
6
|
}
|