tamagui 1.0.11 → 1.0.13
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 +44 -44
- package/dist/cjs/helpers/focusableInputHOC.js +0 -92
- package/dist/cjs/helpers/focusableInputHOC.js.map +0 -7
- package/dist/cjs/helpers/getSpace.js +0 -34
- package/dist/cjs/helpers/getSpace.js.map +0 -7
- package/dist/cjs/helpers/prevent.js +0 -28
- package/dist/cjs/helpers/prevent.js.map +0 -7
- package/dist/cjs/hooks/useKeyboardDismissable.js +0 -95
- package/dist/cjs/hooks/useKeyboardDismissable.js.map +0 -7
- package/dist/cjs/lib/focusable.js +0 -16
- package/dist/cjs/lib/focusable.js.map +0 -7
- package/dist/cjs/lib/linear-gradient.js +0 -29
- package/dist/cjs/lib/linear-gradient.js.map +0 -7
- package/dist/cjs/lib/registerFocusable.js +0 -37
- package/dist/cjs/lib/registerFocusable.js.map +0 -7
- package/dist/cjs/lib/registerFocusable.native.js +0 -60
- package/dist/cjs/lib/registerFocusable.native.js.map +0 -7
- package/dist/cjs/polyfills.js +0 -11
- package/dist/cjs/polyfills.js.map +0 -7
- package/dist/cjs/views/BlurView.js +0 -90
- package/dist/cjs/views/BlurView.js.map +0 -7
- package/dist/cjs/views/BlurView.native.js +0 -38
- package/dist/cjs/views/BlurView.native.js.map +0 -7
- package/dist/cjs/views/ExitAnimationContext.js +0 -34
- package/dist/cjs/views/ExitAnimationContext.js.map +0 -7
- package/dist/cjs/views/Hoverable.js +0 -92
- package/dist/cjs/views/Hoverable.js.map +0 -7
- package/dist/cjs/views/Label.js +0 -177
- package/dist/cjs/views/Label.js.map +0 -7
- package/dist/cjs/views/LinearGradient.js +0 -81
- package/dist/cjs/views/LinearGradient.js.map +0 -7
- package/dist/cjs/views/Switch.js +0 -265
- package/dist/cjs/views/Switch.js.map +0 -7
- package/dist/cjs/views/Table.js +0 -84
- package/dist/cjs/views/Table.js.map +0 -7
- package/dist/cjs/views/Toast.js +0 -129
- package/dist/cjs/views/Toast.js.map +0 -7
- package/dist/esm/helpers/focusableInputHOC.js +0 -68
- package/dist/esm/helpers/focusableInputHOC.js.map +0 -7
- package/dist/esm/helpers/getSpace.js +0 -11
- package/dist/esm/helpers/getSpace.js.map +0 -7
- package/dist/esm/helpers/prevent.js +0 -5
- package/dist/esm/helpers/prevent.js.map +0 -7
- package/dist/esm/hooks/useKeyboardDismissable.js +0 -69
- package/dist/esm/hooks/useKeyboardDismissable.js.map +0 -7
- package/dist/esm/lib/focusable.js +0 -1
- package/dist/esm/lib/focusable.js.map +0 -7
- package/dist/esm/lib/linear-gradient.js +0 -5
- package/dist/esm/lib/linear-gradient.js.map +0 -7
- package/dist/esm/lib/registerFocusable.js +0 -12
- package/dist/esm/lib/registerFocusable.js.map +0 -7
- package/dist/esm/lib/registerFocusable.native.js +0 -35
- package/dist/esm/lib/registerFocusable.native.js.map +0 -7
- package/dist/esm/polyfills.js +0 -10
- package/dist/esm/polyfills.js.map +0 -7
- package/dist/esm/views/BlurView.js +0 -66
- package/dist/esm/views/BlurView.js.map +0 -7
- package/dist/esm/views/BlurView.native.js +0 -15
- package/dist/esm/views/BlurView.native.js.map +0 -7
- package/dist/esm/views/ExitAnimationContext.js +0 -10
- package/dist/esm/views/ExitAnimationContext.js.map +0 -7
- package/dist/esm/views/Hoverable.js +0 -66
- package/dist/esm/views/Hoverable.js.map +0 -7
- package/dist/esm/views/Label.js +0 -158
- package/dist/esm/views/Label.js.map +0 -7
- package/dist/esm/views/LinearGradient.js +0 -58
- package/dist/esm/views/LinearGradient.js.map +0 -7
- package/dist/esm/views/Switch.js +0 -244
- package/dist/esm/views/Switch.js.map +0 -7
- package/dist/esm/views/Table.js +0 -56
- package/dist/esm/views/Table.js.map +0 -7
- package/dist/esm/views/Toast.js +0 -107
- package/dist/esm/views/Toast.js.map +0 -7
- package/dist/jsx/helpers/focusableInputHOC.js +0 -49
- package/dist/jsx/helpers/focusableInputHOC.js.map +0 -7
- package/dist/jsx/helpers/getSpace.js +0 -11
- package/dist/jsx/helpers/getSpace.js.map +0 -7
- package/dist/jsx/helpers/prevent.js +0 -5
- package/dist/jsx/helpers/prevent.js.map +0 -7
- package/dist/jsx/hooks/useKeyboardDismissable.js +0 -69
- package/dist/jsx/hooks/useKeyboardDismissable.js.map +0 -7
- package/dist/jsx/lib/focusable.js +0 -1
- package/dist/jsx/lib/focusable.js.map +0 -7
- package/dist/jsx/lib/linear-gradient.js +0 -5
- package/dist/jsx/lib/linear-gradient.js.map +0 -7
- package/dist/jsx/lib/registerFocusable.js +0 -12
- package/dist/jsx/lib/registerFocusable.js.map +0 -7
- package/dist/jsx/lib/registerFocusable.native.js +0 -35
- package/dist/jsx/lib/registerFocusable.native.js.map +0 -7
- package/dist/jsx/polyfills.js +0 -10
- package/dist/jsx/polyfills.js.map +0 -7
- package/dist/jsx/views/BlurView.js +0 -27
- package/dist/jsx/views/BlurView.js.map +0 -7
- package/dist/jsx/views/BlurView.native.js +0 -15
- package/dist/jsx/views/BlurView.native.js.map +0 -7
- package/dist/jsx/views/ExitAnimationContext.js +0 -10
- package/dist/jsx/views/ExitAnimationContext.js.map +0 -7
- package/dist/jsx/views/Hoverable.js +0 -58
- package/dist/jsx/views/Hoverable.js.map +0 -7
- package/dist/jsx/views/Label.js +0 -118
- package/dist/jsx/views/Label.js.map +0 -7
- package/dist/jsx/views/LinearGradient.js +0 -46
- package/dist/jsx/views/LinearGradient.js.map +0 -7
- package/dist/jsx/views/Switch.js +0 -164
- package/dist/jsx/views/Switch.js.map +0 -7
- package/dist/jsx/views/Table.js +0 -56
- package/dist/jsx/views/Table.js.map +0 -7
- package/dist/jsx/views/Toast.js +0 -73
- package/dist/jsx/views/Toast.js.map +0 -7
- package/types/lib/linear-gradient.d.ts +0 -3
- package/types/views/LinearGradient.d.ts +0 -10
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { isWeb } from "@tamagui/core";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
import { BackHandler } from "react-native";
|
|
4
|
-
let keyboardDismissHandlers = [];
|
|
5
|
-
const keyboardDismissHandlerManager = {
|
|
6
|
-
push: (handler) => {
|
|
7
|
-
keyboardDismissHandlers.push(handler);
|
|
8
|
-
return () => {
|
|
9
|
-
keyboardDismissHandlers = keyboardDismissHandlers.filter((h) => h !== handler);
|
|
10
|
-
};
|
|
11
|
-
},
|
|
12
|
-
length: () => keyboardDismissHandlers.length,
|
|
13
|
-
pop: () => {
|
|
14
|
-
return keyboardDismissHandlers.pop();
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
const useKeyboardDismissable = ({ enabled, callback }) => {
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
let cleanupFn = () => {
|
|
20
|
-
};
|
|
21
|
-
if (enabled) {
|
|
22
|
-
cleanupFn = keyboardDismissHandlerManager.push(callback);
|
|
23
|
-
} else {
|
|
24
|
-
cleanupFn();
|
|
25
|
-
}
|
|
26
|
-
return () => {
|
|
27
|
-
cleanupFn();
|
|
28
|
-
};
|
|
29
|
-
}, [enabled, callback]);
|
|
30
|
-
useBackHandler({ enabled, callback });
|
|
31
|
-
};
|
|
32
|
-
const callbackOnEscape = (callback) => (e) => {
|
|
33
|
-
if (e.key === "Escape") {
|
|
34
|
-
if (!(document.activeElement instanceof HTMLInputElement) && !(document.activeElement instanceof HTMLTextAreaElement)) {
|
|
35
|
-
e.preventDefault();
|
|
36
|
-
e.stopPropagation();
|
|
37
|
-
callback();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
function useBackHandler({ enabled, callback }) {
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
let backHandler = () => {
|
|
44
|
-
callback();
|
|
45
|
-
return true;
|
|
46
|
-
};
|
|
47
|
-
const keyHandler = callbackOnEscape(callback);
|
|
48
|
-
if (enabled) {
|
|
49
|
-
BackHandler.addEventListener("hardwareBackPress", backHandler);
|
|
50
|
-
if (isWeb) {
|
|
51
|
-
window.addEventListener("keydown", keyHandler);
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
55
|
-
}
|
|
56
|
-
return () => {
|
|
57
|
-
BackHandler.removeEventListener("hardwareBackPress", backHandler);
|
|
58
|
-
if (isWeb) {
|
|
59
|
-
window.removeEventListener("keydown", keyHandler);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
}, [enabled, callback]);
|
|
63
|
-
}
|
|
64
|
-
export {
|
|
65
|
-
keyboardDismissHandlerManager,
|
|
66
|
-
useBackHandler,
|
|
67
|
-
useKeyboardDismissable
|
|
68
|
-
};
|
|
69
|
-
//# sourceMappingURL=useKeyboardDismissable.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hooks/useKeyboardDismissable.tsx"],
|
|
4
|
-
"sourcesContent": ["// forked from NativeBase\n// The MIT License (MIT)\n\n// Copyright (c) 2021 GeekyAnts India Pvt Ltd\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy of\n// this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to\n// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n// the Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nimport { isWeb } from '@tamagui/core'\nimport { useEffect } from 'react'\nimport { BackHandler } from 'react-native'\n\ntype IParams = {\n enabled?: boolean\n callback: () => any\n}\n\nlet keyboardDismissHandlers: Array<() => any> = []\nexport const keyboardDismissHandlerManager = {\n push: (handler: () => any) => {\n keyboardDismissHandlers.push(handler)\n return () => {\n keyboardDismissHandlers = keyboardDismissHandlers.filter((h) => h !== handler)\n }\n },\n length: () => keyboardDismissHandlers.length,\n pop: () => {\n return keyboardDismissHandlers.pop()\n },\n}\n\nexport const useKeyboardDismissable = ({ enabled, callback }: IParams) => {\n useEffect(() => {\n let cleanupFn = () => {}\n if (enabled) {\n cleanupFn = keyboardDismissHandlerManager.push(callback)\n } else {\n cleanupFn()\n }\n return () => {\n cleanupFn()\n }\n }, [enabled, callback])\n\n useBackHandler({ enabled, callback })\n}\n\nconst callbackOnEscape = (callback) => (e) => {\n if (e.key === 'Escape') {\n if (\n !(document.activeElement instanceof HTMLInputElement) &&\n !(document.activeElement instanceof HTMLTextAreaElement)\n ) {\n e.preventDefault()\n e.stopPropagation()\n callback()\n }\n }\n}\n\nexport function useBackHandler({ enabled, callback }: IParams) {\n useEffect(() => {\n let backHandler = () => {\n callback()\n return true\n }\n const keyHandler = callbackOnEscape(callback)\n if (enabled) {\n BackHandler.addEventListener('hardwareBackPress', backHandler)\n if (isWeb) {\n window.addEventListener('keydown', keyHandler)\n }\n } else {\n BackHandler.removeEventListener('hardwareBackPress', backHandler)\n }\n return () => {\n BackHandler.removeEventListener('hardwareBackPress', backHandler)\n if (isWeb) {\n window.removeEventListener('keydown', keyHandler)\n }\n }\n }, [enabled, callback])\n}\n"],
|
|
5
|
-
"mappings": "AAsBA;AACA;AACA;AAOA,IAAI,0BAA4C,CAAC;AAC1C,MAAM,gCAAgC;AAAA,EAC3C,MAAM,CAAC,YAAuB;AAC5B,4BAAwB,KAAK,OAAO;AACpC,WAAO,MAAM;AACX,gCAA0B,wBAAwB,OAAO,CAAC,MAAM,MAAM,OAAO;AAAA,IAC/E;AAAA,EACF;AAAA,EACA,QAAQ,MAAM,wBAAwB;AAAA,EACtC,KAAK,MAAM;AACT,WAAO,wBAAwB,IAAI;AAAA,EACrC;AACF;AAEO,MAAM,yBAAyB,CAAC,EAAE,SAAS,eAAwB;AACxE,YAAU,MAAM;AACd,QAAI,YAAY,MAAM;AAAA,IAAC;AACvB,QAAI,SAAS;AACX,kBAAY,8BAA8B,KAAK,QAAQ;AAAA,IACzD,OAAO;AACL,gBAAU;AAAA,IACZ;AACA,WAAO,MAAM;AACX,gBAAU;AAAA,IACZ;AAAA,EACF,GAAG,CAAC,SAAS,QAAQ,CAAC;AAEtB,iBAAe,EAAE,SAAS,SAAS,CAAC;AACtC;AAEA,MAAM,mBAAmB,CAAC,aAAa,CAAC,MAAM;AAC5C,MAAI,EAAE,QAAQ,UAAU;AACtB,QACE,CAAE,UAAS,yBAAyB,qBACpC,CAAE,UAAS,yBAAyB,sBACpC;AACA,QAAE,eAAe;AACjB,QAAE,gBAAgB;AAClB,eAAS;AAAA,IACX;AAAA,EACF;AACF;AAEO,wBAAwB,EAAE,SAAS,YAAqB;AAC7D,YAAU,MAAM;AACd,QAAI,cAAc,MAAM;AACtB,eAAS;AACT,aAAO;AAAA,IACT;AACA,UAAM,aAAa,iBAAiB,QAAQ;AAC5C,QAAI,SAAS;AACX,kBAAY,iBAAiB,qBAAqB,WAAW;AAC7D,UAAI,OAAO;AACT,eAAO,iBAAiB,WAAW,UAAU;AAAA,MAC/C;AAAA,IACF,OAAO;AACL,kBAAY,oBAAoB,qBAAqB,WAAW;AAAA,IAClE;AACA,WAAO,MAAM;AACX,kBAAY,oBAAoB,qBAAqB,WAAW;AAChE,UAAI,OAAO;AACT,eAAO,oBAAoB,WAAW,UAAU;AAAA,MAClD;AAAA,IACF;AAAA,EACF,GAAG,CAAC,SAAS,QAAQ,CAAC;AACxB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=focusable.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/lib/linear-gradient.ts"],
|
|
4
|
-
"sourcesContent": ["export { LinearGradient } from 'expo-linear-gradient'\nexport type { LinearGradientProps } from 'expo-linear-gradient'\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,sBAAsB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const registerFocusable = (id, input) => {
|
|
2
|
-
};
|
|
3
|
-
const unregisterFocusable = (id) => {
|
|
4
|
-
};
|
|
5
|
-
const focusFocusable = (id) => {
|
|
6
|
-
};
|
|
7
|
-
export {
|
|
8
|
-
focusFocusable,
|
|
9
|
-
registerFocusable,
|
|
10
|
-
unregisterFocusable
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=registerFocusable.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/lib/registerFocusable.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Focusable } from './focusable'\n\nexport const registerFocusable = (id: string, input: Focusable) => {\n // noop focus is handed natively\n}\n\nexport const unregisterFocusable = (id: string) => {\n // noop focus is handed natively\n}\n\nexport const focusFocusable = (id: string) => {\n // noop focus is handed natively\n}\n"],
|
|
5
|
-
"mappings": "AAEO,MAAM,oBAAoB,CAAC,IAAY,UAAqB;AAEnE;AAEO,MAAM,sBAAsB,CAAC,OAAe;AAEnD;AAEO,MAAM,iBAAiB,CAAC,OAAe;AAE9C;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const InputsMap = /* @__PURE__ */ new Map();
|
|
2
|
-
const registerFocusable = (id, input) => {
|
|
3
|
-
if (process.env.NODE_ENV !== "production") {
|
|
4
|
-
if (InputsMap.has(id)) {
|
|
5
|
-
console.warn(`Warning, duplicate ID for input: ${id}`);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
InputsMap.set(id, input);
|
|
9
|
-
return () => {
|
|
10
|
-
InputsMap.delete(id);
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
const unregisterFocusable = (id) => {
|
|
14
|
-
InputsMap.delete(id);
|
|
15
|
-
};
|
|
16
|
-
const focusFocusable = (id, select = false) => {
|
|
17
|
-
const input = InputsMap.get(id);
|
|
18
|
-
if (!input) {
|
|
19
|
-
if (process.env.NODE_ENV !== "production") {
|
|
20
|
-
console.warn("No input found for id", id);
|
|
21
|
-
}
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (select || !input.focusAndSelect) {
|
|
25
|
-
input.focus();
|
|
26
|
-
} else {
|
|
27
|
-
input.focusAndSelect();
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
export {
|
|
31
|
-
focusFocusable,
|
|
32
|
-
registerFocusable,
|
|
33
|
-
unregisterFocusable
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=registerFocusable.native.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/lib/registerFocusable.native.tsx"],
|
|
4
|
-
"sourcesContent": ["// used for focusing on native\n\nimport { Focusable } from './focusable'\n\nconst InputsMap = new Map<string, Focusable>()\n\nexport const registerFocusable = (id: string, input: Focusable) => {\n if (process.env.NODE_ENV !== 'production') {\n if (InputsMap.has(id)) {\n console.warn(`Warning, duplicate ID for input: ${id}`)\n }\n }\n InputsMap.set(id, input)\n return () => {\n InputsMap.delete(id)\n }\n}\n\nexport const unregisterFocusable = (id: string) => {\n InputsMap.delete(id)\n}\n\nexport const focusFocusable = (id: string, select = false) => {\n const input = InputsMap.get(id)\n if (!input) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn('No input found for id', id)\n }\n return\n }\n if (select || !input.focusAndSelect) {\n input.focus()\n } else {\n input.focusAndSelect()\n }\n}\n"],
|
|
5
|
-
"mappings": "AAIA,MAAM,YAAY,oBAAI,IAAuB;AAEtC,MAAM,oBAAoB,CAAC,IAAY,UAAqB;AACjE,MAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,QAAI,UAAU,IAAI,EAAE,GAAG;AACrB,cAAQ,KAAK,oCAAoC,IAAI;AAAA,IACvD;AAAA,EACF;AACA,YAAU,IAAI,IAAI,KAAK;AACvB,SAAO,MAAM;AACX,cAAU,OAAO,EAAE;AAAA,EACrB;AACF;AAEO,MAAM,sBAAsB,CAAC,OAAe;AACjD,YAAU,OAAO,EAAE;AACrB;AAEO,MAAM,iBAAiB,CAAC,IAAY,SAAS,UAAU;AAC5D,QAAM,QAAQ,UAAU,IAAI,EAAE;AAC9B,MAAI,CAAC,OAAO;AACV,QAAI,QAAQ,IAAI,aAAa,cAAc;AACzC,cAAQ,KAAK,yBAAyB,EAAE;AAAA,IAC1C;AACA;AAAA,EACF;AACA,MAAI,UAAU,CAAC,MAAM,gBAAgB;AACnC,UAAM,MAAM;AAAA,EACd,OAAO;AACL,UAAM,eAAe;AAAA,EACvB;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/esm/polyfills.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/polyfills.ts"],
|
|
4
|
-
"sourcesContent": ["// for SSR\nif (typeof requestAnimationFrame === 'undefined') {\n globalThis['requestAnimationFrame'] = setImmediate\n}\n\n// for vite / Animated.spring()\nglobal.cancelAnimationFrame = (x) => {\n try {\n cancelAnimationFrame(x)\n } catch {\n // illegal invocation :/\n }\n}\n"],
|
|
5
|
-
"mappings": "AACA,IAAI,OAAO,0BAA0B,aAAa;AAChD,aAAW,2BAA2B;AACxC;AAGA,OAAO,uBAAuB,CAAC,MAAM;AACnC,MAAI;AACF,yBAAqB,CAAC;AAAA,EACxB,QAAE;AAAA,EAEF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
-
var __spreadValues = (a, b) => {
|
|
7
|
-
for (var prop in b || (b = {}))
|
|
8
|
-
if (__hasOwnProp.call(b, prop))
|
|
9
|
-
__defNormalProp(a, prop, b[prop]);
|
|
10
|
-
if (__getOwnPropSymbols)
|
|
11
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
-
if (__propIsEnum.call(b, prop))
|
|
13
|
-
__defNormalProp(a, prop, b[prop]);
|
|
14
|
-
}
|
|
15
|
-
return a;
|
|
16
|
-
};
|
|
17
|
-
var __objRest = (source, exclude) => {
|
|
18
|
-
var target = {};
|
|
19
|
-
for (var prop in source)
|
|
20
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
-
target[prop] = source[prop];
|
|
22
|
-
if (source != null && __getOwnPropSymbols)
|
|
23
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
-
target[prop] = source[prop];
|
|
26
|
-
}
|
|
27
|
-
return target;
|
|
28
|
-
};
|
|
29
|
-
import { YStack } from "@tamagui/stacks";
|
|
30
|
-
import React from "react";
|
|
31
|
-
function BlurView(_a) {
|
|
32
|
-
var _b = _a, {
|
|
33
|
-
children,
|
|
34
|
-
borderRadius,
|
|
35
|
-
fallbackBackgroundColor,
|
|
36
|
-
blurRadius = 20,
|
|
37
|
-
blurType,
|
|
38
|
-
downsampleFactor
|
|
39
|
-
} = _b, props = __objRest(_b, [
|
|
40
|
-
"children",
|
|
41
|
-
"borderRadius",
|
|
42
|
-
"fallbackBackgroundColor",
|
|
43
|
-
"blurRadius",
|
|
44
|
-
"blurType",
|
|
45
|
-
"downsampleFactor"
|
|
46
|
-
]);
|
|
47
|
-
return /* @__PURE__ */ React.createElement(YStack, __spreadValues({
|
|
48
|
-
position: "relative",
|
|
49
|
-
borderRadius
|
|
50
|
-
}, props), /* @__PURE__ */ React.createElement("div", {
|
|
51
|
-
className: "backdrop-filter",
|
|
52
|
-
style: {
|
|
53
|
-
position: "absolute",
|
|
54
|
-
width: "100%",
|
|
55
|
-
height: "100%",
|
|
56
|
-
backdropFilter: `blur(${blurRadius}px)`,
|
|
57
|
-
borderRadius,
|
|
58
|
-
zIndex: -1,
|
|
59
|
-
pointerEvents: "none"
|
|
60
|
-
}
|
|
61
|
-
}), children);
|
|
62
|
-
}
|
|
63
|
-
export {
|
|
64
|
-
BlurView
|
|
65
|
-
};
|
|
66
|
-
//# sourceMappingURL=BlurView.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/views/BlurView.tsx"],
|
|
4
|
-
"sourcesContent": ["import { StackProps } from '@tamagui/core'\nimport { YStack } from '@tamagui/stacks'\nimport React from 'react'\n\nexport type BlurViewProps = StackProps & {\n blurAmount?: number // 0 - 100\n blurRadius?: number\n fallbackBackgroundColor?: string\n blurType?:\n | 'xlight'\n | 'light'\n | 'dark'\n // iOS 13+ only\n | 'chromeMaterial'\n | 'material'\n | 'thickMaterial'\n | 'thinMaterial'\n | 'ultraThinMaterial'\n | 'chromeMaterialDark'\n | 'materialDark'\n | 'thickMaterialDark'\n | 'thinMaterialDark'\n | 'ultraThinMaterialDark'\n | 'chromeMaterialLight'\n | 'materialLight'\n | 'thickMaterialLight'\n | 'thinMaterialLight'\n | 'ultraThinMaterialLight'\n // tvOS and iOS 10+ only\n | 'regular'\n | 'prominent'\n // tvOS only\n | 'extraDark'\n downsampleFactor?: number\n}\n\nexport function BlurView({\n children,\n borderRadius,\n fallbackBackgroundColor,\n blurRadius = 20,\n blurType,\n downsampleFactor,\n ...props\n}: BlurViewProps) {\n return (\n // @ts-ignore\n <YStack position=\"relative\" borderRadius={borderRadius} {...props}>\n <div\n // fallback for safari but non customizable\n className=\"backdrop-filter\"\n style={{\n position: 'absolute',\n width: '100%',\n height: '100%',\n backdropFilter: `blur(${blurRadius}px)`,\n // @ts-ignore\n borderRadius,\n zIndex: -1,\n pointerEvents: 'none',\n }}\n />\n {children}\n </YStack>\n )\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AACA;AAkCO,kBAAkB,IAQP;AARO,eACvB;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb;AAAA,IACA;AAAA,MANuB,IAOpB,kBAPoB,IAOpB;AAAA,IANH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGA,SAEE,oCAAC;AAAA,IAAO,UAAS;AAAA,IAAW;AAAA,KAAgC,QAC1D,oCAAC;AAAA,IAEC,WAAU;AAAA,IACV,OAAO;AAAA,MACL,UAAU;AAAA,MACV,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,gBAAgB,QAAQ;AAAA,MAExB;AAAA,MACA,QAAQ;AAAA,MACR,eAAe;AAAA,IACjB;AAAA,GACF,GACC,QACH;AAEJ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BlurView as NativeBlurView } from "@react-native-community/blur";
|
|
2
|
-
import { styled } from "@tamagui/core";
|
|
3
|
-
const BlurView = styled(NativeBlurView, {
|
|
4
|
-
blurType: "light",
|
|
5
|
-
blurAmount: 10,
|
|
6
|
-
position: "absolute",
|
|
7
|
-
top: 0,
|
|
8
|
-
right: 0,
|
|
9
|
-
bottom: 0,
|
|
10
|
-
left: 0
|
|
11
|
-
});
|
|
12
|
-
export {
|
|
13
|
-
BlurView
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=BlurView.native.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/views/BlurView.native.tsx"],
|
|
4
|
-
"sourcesContent": ["import { BlurView as NativeBlurView } from '@react-native-community/blur'\nimport { styled } from '@tamagui/core'\n\nexport const BlurView = styled(NativeBlurView, {\n blurType: 'light',\n blurAmount: 10,\n position: 'absolute',\n top: 0,\n right: 0,\n bottom: 0,\n left: 0,\n})\n"],
|
|
5
|
-
"mappings": "AAAA;AACA;AAEO,MAAM,WAAW,OAAO,gBAAgB;AAAA,EAC7C,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACR,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/views/ExitAnimationContext.ts"],
|
|
4
|
-
"sourcesContent": ["// forked from NativeBase\n// The MIT License (MIT)\n\n// Copyright (c) 2021 GeekyAnts India Pvt Ltd\n\n// Permission is hereby granted, free of charge, to any person obtaining a copy of\n// this software and associated documentation files (the \"Software\"), to deal in\n// the Software without restriction, including without limitation the rights to\n// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n// the Software, and to permit persons to whom the Software is furnished to do so,\n// subject to the following conditions:\n\n// The above copyright notice and this permission notice shall be included in all\n// copies or substantial portions of the Software.\n\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\n// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nimport { createContext } from 'react'\n\nexport const ExitAnimationContext = createContext({\n exited: true,\n setExited: (_exited: boolean) => {},\n})\n"],
|
|
5
|
-
"mappings": "AAsBA;AAEO,MAAM,uBAAuB,cAAc;AAAA,EAChD,QAAQ;AAAA,EACR,WAAW,CAAC,YAAqB;AAAA,EAAC;AACpC,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { isWeb } from "@tamagui/core";
|
|
2
|
-
import { useDebounce } from "@tamagui/use-debounce";
|
|
3
|
-
import React, { forwardRef, useEffect, useImperativeHandle, useState } from "react";
|
|
4
|
-
React["createElement"];
|
|
5
|
-
const Hoverable = forwardRef(({
|
|
6
|
-
onPressIn,
|
|
7
|
-
onPressOut,
|
|
8
|
-
onHoverIn,
|
|
9
|
-
onHoverOut,
|
|
10
|
-
onHoverMove,
|
|
11
|
-
disableUntilSettled,
|
|
12
|
-
hoverDelay = 0,
|
|
13
|
-
children
|
|
14
|
-
}, ref) => {
|
|
15
|
-
if (!isWeb) {
|
|
16
|
-
return children;
|
|
17
|
-
}
|
|
18
|
-
const [isActive, set] = useState(false);
|
|
19
|
-
const setOffSlow = useDebounce(() => set(false), hoverDelay / 2);
|
|
20
|
-
const setOnSlow = useDebounce(() => set(true), hoverDelay);
|
|
21
|
-
const cancelAll = () => {
|
|
22
|
-
setOnSlow.cancel();
|
|
23
|
-
setOffSlow.cancel();
|
|
24
|
-
};
|
|
25
|
-
useImperativeHandle(ref, () => ({
|
|
26
|
-
close: () => {
|
|
27
|
-
set(false);
|
|
28
|
-
}
|
|
29
|
-
}));
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (isActive) {
|
|
32
|
-
onHoverIn == null ? void 0 : onHoverIn();
|
|
33
|
-
} else {
|
|
34
|
-
onHoverOut == null ? void 0 : onHoverOut();
|
|
35
|
-
}
|
|
36
|
-
}, [isActive]);
|
|
37
|
-
const setOff = () => {
|
|
38
|
-
cancelAll();
|
|
39
|
-
setOffSlow();
|
|
40
|
-
};
|
|
41
|
-
const setOn = () => {
|
|
42
|
-
cancelAll();
|
|
43
|
-
setOnSlow();
|
|
44
|
-
};
|
|
45
|
-
const hoverMove = () => {
|
|
46
|
-
if (onHoverMove)
|
|
47
|
-
onHoverMove();
|
|
48
|
-
if (disableUntilSettled)
|
|
49
|
-
setOn();
|
|
50
|
-
};
|
|
51
|
-
return /* @__PURE__ */ React.createElement("span", {
|
|
52
|
-
ref,
|
|
53
|
-
style: {
|
|
54
|
-
display: "contents"
|
|
55
|
-
},
|
|
56
|
-
onMouseEnter: setOn,
|
|
57
|
-
onMouseLeave: setOff,
|
|
58
|
-
onMouseMove: hoverMove,
|
|
59
|
-
onMouseDown: onPressIn,
|
|
60
|
-
onClick: onPressOut
|
|
61
|
-
}, children);
|
|
62
|
-
});
|
|
63
|
-
export {
|
|
64
|
-
Hoverable
|
|
65
|
-
};
|
|
66
|
-
//# sourceMappingURL=Hoverable.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/views/Hoverable.tsx"],
|
|
4
|
-
"sourcesContent": ["import { isWeb } from '@tamagui/core'\nimport { useDebounce } from '@tamagui/use-debounce'\nimport React, { forwardRef, useEffect, useImperativeHandle, useState } from 'react'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\ntype SpanProps = React.DOMAttributes<HTMLSpanElement>\n\nexport type HoverableProps = {\n children?: any\n disableUntilSettled?: boolean\n hoverDelay?: number\n onHoverIn?: () => void\n onHoverOut?: () => void\n onHoverMove?: () => void\n onPressIn?: SpanProps['onMouseDown']\n onPressOut?: SpanProps['onClick']\n}\n\nexport type HoverableHandle = {\n close: () => void\n}\n\nexport const Hoverable = forwardRef<HoverableHandle, HoverableProps>(\n (\n {\n onPressIn,\n onPressOut,\n onHoverIn,\n onHoverOut,\n onHoverMove,\n disableUntilSettled,\n hoverDelay = 0,\n children,\n }: HoverableProps,\n ref\n ) => {\n if (!isWeb) {\n return children\n }\n\n const [isActive, set] = useState(false)\n const setOffSlow = useDebounce(() => set(false), hoverDelay / 2) // math.min(a bit less than in)\n const setOnSlow = useDebounce(() => set(true), hoverDelay)\n const cancelAll = () => {\n setOnSlow.cancel()\n setOffSlow.cancel()\n }\n\n useImperativeHandle(ref, () => ({\n close: () => {\n set(false)\n },\n }))\n\n useEffect(() => {\n if (isActive) {\n onHoverIn?.()\n } else {\n onHoverOut?.()\n }\n }, [isActive])\n\n const setOff = () => {\n cancelAll()\n setOffSlow()\n }\n const setOn = () => {\n cancelAll()\n setOnSlow()\n }\n\n const hoverMove = () => {\n if (onHoverMove) onHoverMove()\n if (disableUntilSettled) setOn()\n }\n\n return (\n <span\n ref={ref as any}\n style={{\n display: 'contents',\n }}\n onMouseEnter={setOn}\n onMouseLeave={setOff}\n onMouseMove={hoverMove}\n onMouseDown={onPressIn}\n onClick={onPressOut}\n >\n {children}\n </span>\n )\n }\n)\n"],
|
|
5
|
-
"mappings": "AAAA;AACA;AACA;AAGA,MAAM;AAmBC,MAAM,YAAY,WACvB,CACE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb;AAAA,GAEF,QACG;AACH,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AAEA,QAAM,CAAC,UAAU,OAAO,SAAS,KAAK;AACtC,QAAM,aAAa,YAAY,MAAM,IAAI,KAAK,GAAG,aAAa,CAAC;AAC/D,QAAM,YAAY,YAAY,MAAM,IAAI,IAAI,GAAG,UAAU;AACzD,QAAM,YAAY,MAAM;AACtB,cAAU,OAAO;AACjB,eAAW,OAAO;AAAA,EACpB;AAEA,sBAAoB,KAAK,MAAO;AAAA,IAC9B,OAAO,MAAM;AACX,UAAI,KAAK;AAAA,IACX;AAAA,EACF,EAAE;AAEF,YAAU,MAAM;AACd,QAAI,UAAU;AACZ;AAAA,IACF,OAAO;AACL;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,CAAC;AAEb,QAAM,SAAS,MAAM;AACnB,cAAU;AACV,eAAW;AAAA,EACb;AACA,QAAM,QAAQ,MAAM;AAClB,cAAU;AACV,cAAU;AAAA,EACZ;AAEA,QAAM,YAAY,MAAM;AACtB,QAAI;AAAa,kBAAY;AAC7B,QAAI;AAAqB,YAAM;AAAA,EACjC;AAEA,SACE,oCAAC;AAAA,IACC;AAAA,IACA,OAAO;AAAA,MACL,SAAS;AAAA,IACX;AAAA,IACA,cAAc;AAAA,IACd,cAAc;AAAA,IACd,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,KAER,QACH;AAEJ,CACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/esm/views/Label.js
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
import { useComposedRefs } from "@tamagui/compose-refs";
|
|
33
|
-
import {
|
|
34
|
-
getButtonSize,
|
|
35
|
-
getFont,
|
|
36
|
-
isWeb,
|
|
37
|
-
styled,
|
|
38
|
-
themeable,
|
|
39
|
-
useId
|
|
40
|
-
} from "@tamagui/core";
|
|
41
|
-
import { createContext } from "@tamagui/create-context";
|
|
42
|
-
import { SizableText } from "@tamagui/text";
|
|
43
|
-
import * as React from "react";
|
|
44
|
-
import { focusFocusable } from "../lib/registerFocusable";
|
|
45
|
-
const NAME = "Label";
|
|
46
|
-
const [LabelProvider, useLabelContextImpl] = createContext(NAME, {
|
|
47
|
-
id: void 0,
|
|
48
|
-
controlRef: { current: null }
|
|
49
|
-
});
|
|
50
|
-
const LabelFrame = styled(SizableText, {
|
|
51
|
-
name: "Label",
|
|
52
|
-
tag: "label",
|
|
53
|
-
size: "$4",
|
|
54
|
-
backgroundColor: "transparent",
|
|
55
|
-
display: "flex",
|
|
56
|
-
alignItems: "center",
|
|
57
|
-
cursor: "default",
|
|
58
|
-
pressStyle: {
|
|
59
|
-
color: "$colorPress"
|
|
60
|
-
},
|
|
61
|
-
variants: {
|
|
62
|
-
size: {
|
|
63
|
-
"...size": (val, extras) => {
|
|
64
|
-
const buttonStyle = getButtonSize(val, extras);
|
|
65
|
-
return __spreadProps(__spreadValues({}, getFont(val, extras)), {
|
|
66
|
-
height: buttonStyle.height,
|
|
67
|
-
lineHeight: buttonStyle.height
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
const LabelComponent = React.forwardRef((props, forwardedRef) => {
|
|
74
|
-
const _a = props, { htmlFor, id: idProp } = _a, labelProps = __objRest(_a, ["htmlFor", "id"]);
|
|
75
|
-
const controlRef = React.useRef(null);
|
|
76
|
-
const ref = React.useRef(null);
|
|
77
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
78
|
-
const id = useId(idProp);
|
|
79
|
-
if (isWeb) {
|
|
80
|
-
React.useEffect(() => {
|
|
81
|
-
if (htmlFor) {
|
|
82
|
-
const element = document.getElementById(htmlFor);
|
|
83
|
-
const label = ref.current;
|
|
84
|
-
if (label && element) {
|
|
85
|
-
const getAriaLabel = () => element.getAttribute("aria-labelledby");
|
|
86
|
-
const ariaLabelledBy = [id, getAriaLabel()].filter(Boolean).join(" ");
|
|
87
|
-
element.setAttribute("aria-labelledby", ariaLabelledBy);
|
|
88
|
-
controlRef.current = element;
|
|
89
|
-
return () => {
|
|
90
|
-
var _a2;
|
|
91
|
-
if (!id)
|
|
92
|
-
return;
|
|
93
|
-
const ariaLabelledBy2 = (_a2 = getAriaLabel()) == null ? void 0 : _a2.replace(id, "");
|
|
94
|
-
if (ariaLabelledBy2 === "") {
|
|
95
|
-
element.removeAttribute("aria-labelledby");
|
|
96
|
-
} else if (ariaLabelledBy2) {
|
|
97
|
-
element.setAttribute("aria-labelledby", ariaLabelledBy2);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}, [id, htmlFor]);
|
|
103
|
-
}
|
|
104
|
-
return /* @__PURE__ */ React.createElement(LabelProvider, {
|
|
105
|
-
id,
|
|
106
|
-
controlRef
|
|
107
|
-
}, /* @__PURE__ */ React.createElement(LabelFrame, __spreadProps(__spreadValues({
|
|
108
|
-
role: "label",
|
|
109
|
-
id
|
|
110
|
-
}, labelProps), {
|
|
111
|
-
ref: composedRefs,
|
|
112
|
-
onMouseDown: (event) => {
|
|
113
|
-
var _a2;
|
|
114
|
-
(_a2 = props.onMouseDown) == null ? void 0 : _a2.call(props, event);
|
|
115
|
-
if (!event.defaultPrevented && event.detail > 1) {
|
|
116
|
-
event.preventDefault();
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
onPress: (event) => {
|
|
120
|
-
var _a2;
|
|
121
|
-
(_a2 = props.onPress) == null ? void 0 : _a2.call(props, event);
|
|
122
|
-
if (isWeb) {
|
|
123
|
-
if (!controlRef.current || event.defaultPrevented)
|
|
124
|
-
return;
|
|
125
|
-
const isClickingControl = controlRef.current.contains(event.target);
|
|
126
|
-
const isUserClick = event.isTrusted === true;
|
|
127
|
-
if (!isClickingControl && isUserClick) {
|
|
128
|
-
controlRef.current.click();
|
|
129
|
-
controlRef.current.focus();
|
|
130
|
-
}
|
|
131
|
-
} else {
|
|
132
|
-
if (props.htmlFor) {
|
|
133
|
-
focusFocusable(props.htmlFor);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
})));
|
|
138
|
-
});
|
|
139
|
-
LabelComponent.displayName = NAME;
|
|
140
|
-
const Label = LabelFrame.extractable(themeable(LabelComponent), {
|
|
141
|
-
neverFlatten: true
|
|
142
|
-
});
|
|
143
|
-
const useLabelContext = (element) => {
|
|
144
|
-
const context = useLabelContextImpl("LabelConsumer");
|
|
145
|
-
const { controlRef } = context;
|
|
146
|
-
React.useEffect(() => {
|
|
147
|
-
if (element)
|
|
148
|
-
controlRef.current = element;
|
|
149
|
-
}, [element, controlRef]);
|
|
150
|
-
return context.id;
|
|
151
|
-
};
|
|
152
|
-
const Root = Label;
|
|
153
|
-
export {
|
|
154
|
-
Label,
|
|
155
|
-
LabelFrame,
|
|
156
|
-
useLabelContext
|
|
157
|
-
};
|
|
158
|
-
//# sourceMappingURL=Label.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/views/Label.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useComposedRefs } from '@tamagui/compose-refs'\nimport {\n GetProps,\n ReactComponentWithRef,\n getButtonSize,\n getFont,\n isWeb,\n styled,\n themeable,\n useId,\n} from '@tamagui/core'\nimport { createContext } from '@tamagui/create-context'\nimport { SizableText } from '@tamagui/text'\nimport * as React from 'react'\nimport { View } from 'react-native'\n\nimport { focusFocusable } from '../lib/registerFocusable'\n\nconst NAME = 'Label'\n\ntype LabelContextValue = {\n id?: string\n controlRef: React.MutableRefObject<HTMLElement | null>\n}\n\nconst [LabelProvider, useLabelContextImpl] = createContext<LabelContextValue>(NAME, {\n id: undefined,\n controlRef: { current: null },\n})\n\nexport const LabelFrame = styled(SizableText, {\n name: 'Label',\n tag: 'label',\n size: '$4',\n backgroundColor: 'transparent',\n display: 'flex',\n alignItems: 'center',\n cursor: 'default',\n pressStyle: {\n color: '$colorPress',\n },\n variants: {\n size: {\n '...size': (val, extras) => {\n const buttonStyle = getButtonSize(val, extras)\n return {\n ...getFont(val, extras),\n height: buttonStyle.height,\n lineHeight: buttonStyle.height,\n }\n },\n },\n },\n})\n\nexport type LabelProps = GetProps<typeof LabelFrame> & {\n htmlFor?: string\n}\n\nconst LabelComponent = React.forwardRef<typeof LabelFrame, LabelProps>((props, forwardedRef) => {\n const { htmlFor, id: idProp, ...labelProps } = props\n const controlRef = React.useRef<HTMLElement | null>(null)\n const ref = React.useRef<any>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref)\n const id = useId(idProp)\n\n if (isWeb) {\n React.useEffect(() => {\n if (htmlFor) {\n const element = document.getElementById(htmlFor)\n const label = ref.current\n if (label && element) {\n const getAriaLabel = () => element.getAttribute('aria-labelledby')\n const ariaLabelledBy = [id, getAriaLabel()].filter(Boolean).join(' ')\n element.setAttribute('aria-labelledby', ariaLabelledBy)\n controlRef.current = element\n return () => {\n /**\n * We get the latest attribute value because at the time that this cleanup fires,\n * the values from the closure may have changed.\n */\n if (!id) return\n const ariaLabelledBy = getAriaLabel()?.replace(id, '')\n if (ariaLabelledBy === '') {\n element.removeAttribute('aria-labelledby')\n } else if (ariaLabelledBy) {\n element.setAttribute('aria-labelledby', ariaLabelledBy)\n }\n }\n }\n }\n }, [id, htmlFor])\n }\n\n return (\n <LabelProvider id={id} controlRef={controlRef}>\n <LabelFrame\n // @ts-ignore\n role=\"label\"\n id={id}\n {...labelProps}\n ref={composedRefs}\n onMouseDown={(event) => {\n props.onMouseDown?.(event)\n // prevent text selection when double clicking label\n if (!event.defaultPrevented && event.detail > 1) {\n event.preventDefault()\n }\n }}\n onPress={(event) => {\n props.onPress?.(event)\n\n if (isWeb) {\n if (!controlRef.current || event.defaultPrevented) return\n const isClickingControl = controlRef.current.contains(event.target as any as Node)\n // Ensure event was generated by a user action\n // https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted\n const isUserClick = event.isTrusted === true\n /**\n * When a label is wrapped around the control it labels, we trigger the appropriate events\n * on the control when the label is clicked. We do nothing if the user is already clicking the\n * control inside the label.\n */\n if (!isClickingControl && isUserClick) {\n controlRef.current.click()\n controlRef.current.focus()\n }\n } else {\n if (props.htmlFor) {\n focusFocusable(props.htmlFor)\n }\n }\n }}\n />\n </LabelProvider>\n )\n})\n\nLabelComponent.displayName = NAME\n\nexport const Label: ReactComponentWithRef<LabelProps, HTMLButtonElement | View> =\n LabelFrame.extractable(themeable(LabelComponent as any) as any, {\n neverFlatten: true,\n })\n\nexport const useLabelContext = (element?: HTMLElement | null) => {\n const context = useLabelContextImpl('LabelConsumer')\n const { controlRef } = context\n\n React.useEffect(() => {\n if (element) controlRef.current = element\n }, [element, controlRef])\n\n return context.id\n}\n\nconst Root = Label\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
getVariable,
|
|
4
|
-
styled,
|
|
5
|
-
themeable,
|
|
6
|
-
useTheme
|
|
7
|
-
} from "@tamagui/core";
|
|
8
|
-
import { YStack } from "@tamagui/stacks";
|
|
9
|
-
import * as React from "react";
|
|
10
|
-
import { StyleSheet } from "react-native";
|
|
11
|
-
import {
|
|
12
|
-
LinearGradient as ExpoLinearGradient
|
|
13
|
-
} from "../lib/linear-gradient";
|
|
14
|
-
const LinearGradient = YStack.extractable(
|
|
15
|
-
themeable(
|
|
16
|
-
React.forwardRef((props, ref) => {
|
|
17
|
-
const {
|
|
18
|
-
start,
|
|
19
|
-
end,
|
|
20
|
-
colors: colorsProp,
|
|
21
|
-
locations,
|
|
22
|
-
children,
|
|
23
|
-
...stackProps
|
|
24
|
-
} = props;
|
|
25
|
-
const colors = useThemeColors(colorsProp || []);
|
|
26
|
-
return /* @__PURE__ */ jsx(LinearGradientFrame, {
|
|
27
|
-
ref,
|
|
28
|
-
...stackProps,
|
|
29
|
-
children: /* @__PURE__ */ jsx(ExpoLinearGradient, {
|
|
30
|
-
start,
|
|
31
|
-
end,
|
|
32
|
-
colors,
|
|
33
|
-
locations,
|
|
34
|
-
style: StyleSheet.absoluteFill,
|
|
35
|
-
children
|
|
36
|
-
})
|
|
37
|
-
});
|
|
38
|
-
})
|
|
39
|
-
)
|
|
40
|
-
);
|
|
41
|
-
const LinearGradientFrame = styled(YStack, {
|
|
42
|
-
name: "LinearGradient",
|
|
43
|
-
overflow: "hidden",
|
|
44
|
-
position: "relative"
|
|
45
|
-
});
|
|
46
|
-
const useThemeColors = (colors) => {
|
|
47
|
-
const theme = useTheme();
|
|
48
|
-
return colors.map((color) => {
|
|
49
|
-
if (color[0] === "$") {
|
|
50
|
-
return getVariable(theme[color] || color);
|
|
51
|
-
}
|
|
52
|
-
return color;
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
export {
|
|
56
|
-
LinearGradient
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL=LinearGradient.js.map
|