@tamagui/use-direction 1.0.1-beta.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/useDirection.js +47 -0
- package/dist/cjs/useDirection.js.map +7 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/useDirection.js +19 -0
- package/dist/esm/useDirection.js.map +7 -0
- package/dist/jsx/index.js +2 -0
- package/dist/jsx/index.js.map +7 -0
- package/dist/jsx/useDirection.js +17 -0
- package/dist/jsx/useDirection.js.map +7 -0
- package/package.json +30 -0
- package/src/index.ts +1 -0
- package/src/useDirection.tsx +23 -0
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -0
- package/types/useDirection.d.ts +11 -0
- package/types/useDirection.d.ts.map +1 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var src_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(src_exports);
|
|
17
|
+
__reExport(src_exports, require("./useDirection"), module.exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var useDirection_exports = {};
|
|
22
|
+
__export(useDirection_exports, {
|
|
23
|
+
DirectionProvider: () => DirectionProvider,
|
|
24
|
+
Provider: () => Provider,
|
|
25
|
+
useDirection: () => useDirection
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(useDirection_exports);
|
|
28
|
+
var React = __toESM(require("react"));
|
|
29
|
+
const DirectionContext = React.createContext(void 0);
|
|
30
|
+
const DirectionProvider = (props) => {
|
|
31
|
+
const { dir, children } = props;
|
|
32
|
+
return /* @__PURE__ */ React.createElement(DirectionContext.Provider, {
|
|
33
|
+
value: dir
|
|
34
|
+
}, children);
|
|
35
|
+
};
|
|
36
|
+
function useDirection(localDir) {
|
|
37
|
+
const globalDir = React.useContext(DirectionContext);
|
|
38
|
+
return localDir || globalDir || "ltr";
|
|
39
|
+
}
|
|
40
|
+
const Provider = DirectionProvider;
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
DirectionProvider,
|
|
44
|
+
Provider,
|
|
45
|
+
useDirection
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=useDirection.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/useDirection.tsx"],
|
|
4
|
+
"sourcesContent": ["// forked from https://github.com/radix-ui/primitives/blob/main/packages/react/direction/src/Direction.tsx\n\nimport * as React from 'react'\n\ntype Direction = 'ltr' | 'rtl'\nconst DirectionContext = React.createContext<Direction | undefined>(undefined)\n\ninterface DirectionProviderProps {\n children?: React.ReactNode\n dir: Direction\n}\n\nexport const DirectionProvider: React.FC<DirectionProviderProps> = (props) => {\n const { dir, children } = props\n return <DirectionContext.Provider value={dir}>{children}</DirectionContext.Provider>\n}\n\nexport function useDirection(localDir?: Direction) {\n const globalDir = React.useContext(DirectionContext)\n return localDir || globalDir || 'ltr'\n}\n\nexport const Provider = DirectionProvider\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,YAAuB;AAGvB,MAAM,mBAAmB,MAAM,cAAqC,MAAS;AAOtE,MAAM,oBAAsD,CAAC,UAAU;AAC5E,QAAM,EAAE,KAAK,aAAa;AAC1B,SAAO,oCAAC,iBAAiB,UAAjB;AAAA,IAA0B,OAAO;AAAA,KAAM,QAAS;AAC1D;AAEO,sBAAsB,UAAsB;AACjD,QAAM,YAAY,MAAM,WAAW,gBAAgB;AACnD,SAAO,YAAY,aAAa;AAClC;AAEO,MAAM,WAAW;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const DirectionContext = React.createContext(void 0);
|
|
3
|
+
const DirectionProvider = (props) => {
|
|
4
|
+
const { dir, children } = props;
|
|
5
|
+
return /* @__PURE__ */ React.createElement(DirectionContext.Provider, {
|
|
6
|
+
value: dir
|
|
7
|
+
}, children);
|
|
8
|
+
};
|
|
9
|
+
function useDirection(localDir) {
|
|
10
|
+
const globalDir = React.useContext(DirectionContext);
|
|
11
|
+
return localDir || globalDir || "ltr";
|
|
12
|
+
}
|
|
13
|
+
const Provider = DirectionProvider;
|
|
14
|
+
export {
|
|
15
|
+
DirectionProvider,
|
|
16
|
+
Provider,
|
|
17
|
+
useDirection
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=useDirection.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/useDirection.tsx"],
|
|
4
|
+
"sourcesContent": ["// forked from https://github.com/radix-ui/primitives/blob/main/packages/react/direction/src/Direction.tsx\n\nimport * as React from 'react'\n\ntype Direction = 'ltr' | 'rtl'\nconst DirectionContext = React.createContext<Direction | undefined>(undefined)\n\ninterface DirectionProviderProps {\n children?: React.ReactNode\n dir: Direction\n}\n\nexport const DirectionProvider: React.FC<DirectionProviderProps> = (props) => {\n const { dir, children } = props\n return <DirectionContext.Provider value={dir}>{children}</DirectionContext.Provider>\n}\n\nexport function useDirection(localDir?: Direction) {\n const globalDir = React.useContext(DirectionContext)\n return localDir || globalDir || 'ltr'\n}\n\nexport const Provider = DirectionProvider\n"],
|
|
5
|
+
"mappings": "AAEA;AAGA,MAAM,mBAAmB,MAAM,cAAqC,MAAS;AAOtE,MAAM,oBAAsD,CAAC,UAAU;AAC5E,QAAM,EAAE,KAAK,aAAa;AAC1B,SAAO,oCAAC,iBAAiB,UAAjB;AAAA,IAA0B,OAAO;AAAA,KAAM,QAAS;AAC1D;AAEO,sBAAsB,UAAsB;AACjD,QAAM,YAAY,MAAM,WAAW,gBAAgB;AACnD,SAAO,YAAY,aAAa;AAClC;AAEO,MAAM,WAAW;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const DirectionContext = React.createContext(void 0);
|
|
3
|
+
const DirectionProvider = (props) => {
|
|
4
|
+
const { dir, children } = props;
|
|
5
|
+
return <DirectionContext.Provider value={dir}>{children}</DirectionContext.Provider>;
|
|
6
|
+
};
|
|
7
|
+
function useDirection(localDir) {
|
|
8
|
+
const globalDir = React.useContext(DirectionContext);
|
|
9
|
+
return localDir || globalDir || "ltr";
|
|
10
|
+
}
|
|
11
|
+
const Provider = DirectionProvider;
|
|
12
|
+
export {
|
|
13
|
+
DirectionProvider,
|
|
14
|
+
Provider,
|
|
15
|
+
useDirection
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useDirection.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/useDirection.tsx"],
|
|
4
|
+
"sourcesContent": ["// forked from https://github.com/radix-ui/primitives/blob/main/packages/react/direction/src/Direction.tsx\n\nimport * as React from 'react'\n\ntype Direction = 'ltr' | 'rtl'\nconst DirectionContext = React.createContext<Direction | undefined>(undefined)\n\ninterface DirectionProviderProps {\n children?: React.ReactNode\n dir: Direction\n}\n\nexport const DirectionProvider: React.FC<DirectionProviderProps> = (props) => {\n const { dir, children } = props\n return <DirectionContext.Provider value={dir}>{children}</DirectionContext.Provider>\n}\n\nexport function useDirection(localDir?: Direction) {\n const globalDir = React.useContext(DirectionContext)\n return localDir || globalDir || 'ltr'\n}\n\nexport const Provider = DirectionProvider\n"],
|
|
5
|
+
"mappings": "AAEA;AAGA,MAAM,mBAAmB,MAAM,cAAqC,MAAS;AAOtE,MAAM,oBAAsD,CAAC,UAAU;AAC5E,QAAM,EAAE,KAAK,aAAa;AAC1B,SAAO,CAAC,iBAAiB,SAAS,OAAO,MAAM,SAAS,EAAhD,iBAAiB;AAC3B;AAEO,sBAAsB,UAAsB;AACjD,QAAM,YAAY,MAAM,WAAW,gBAAgB;AACnD,SAAO,YAAY,aAAa;AAClC;AAEO,MAAM,WAAW;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tamagui/use-direction",
|
|
3
|
+
"version": "1.0.1-beta.100",
|
|
4
|
+
"types": "./types/index.d.ts",
|
|
5
|
+
"main": "dist/cjs",
|
|
6
|
+
"module": "dist/esm",
|
|
7
|
+
"module:jsx": "dist/jsx",
|
|
8
|
+
"files": [
|
|
9
|
+
"src",
|
|
10
|
+
"types",
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tamagui-build",
|
|
15
|
+
"watch": "tamagui-build --watch",
|
|
16
|
+
"clean": "tamagui-build clean",
|
|
17
|
+
"clean:build": "tamagui-build clean:build"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@tamagui/build": "^1.0.1-beta.100",
|
|
21
|
+
"react": "*"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"react": "*"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14"
|
|
30
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useDirection'
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// forked from https://github.com/radix-ui/primitives/blob/main/packages/react/direction/src/Direction.tsx
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
|
|
5
|
+
type Direction = 'ltr' | 'rtl'
|
|
6
|
+
const DirectionContext = React.createContext<Direction | undefined>(undefined)
|
|
7
|
+
|
|
8
|
+
interface DirectionProviderProps {
|
|
9
|
+
children?: React.ReactNode
|
|
10
|
+
dir: Direction
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const DirectionProvider: React.FC<DirectionProviderProps> = (props) => {
|
|
14
|
+
const { dir, children } = props
|
|
15
|
+
return <DirectionContext.Provider value={dir}>{children}</DirectionContext.Provider>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function useDirection(localDir?: Direction) {
|
|
19
|
+
const globalDir = React.useContext(DirectionContext)
|
|
20
|
+
return localDir || globalDir || 'ltr'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const Provider = DirectionProvider
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare type Direction = 'ltr' | 'rtl';
|
|
3
|
+
interface DirectionProviderProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
dir: Direction;
|
|
6
|
+
}
|
|
7
|
+
export declare const DirectionProvider: React.FC<DirectionProviderProps>;
|
|
8
|
+
export declare function useDirection(localDir?: Direction): Direction;
|
|
9
|
+
export declare const Provider: React.FC<DirectionProviderProps>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=useDirection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDirection.d.ts","sourceRoot":"","sources":["../src/useDirection.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,aAAK,SAAS,GAAG,KAAK,GAAG,KAAK,CAAA;AAG9B,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,GAAG,EAAE,SAAS,CAAA;CACf;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAG9D,CAAA;AAED,wBAAgB,YAAY,CAAC,QAAQ,CAAC,EAAE,SAAS,aAGhD;AAED,eAAO,MAAM,QAAQ,kCAAoB,CAAA"}
|