@tamagui/use-direction 1.2.9 → 1.2.11
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.
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
const DirectionContext = React.createContext(void 0);
|
|
4
|
+
const DirectionProvider = (props) => {
|
|
5
|
+
const { dir, children } = props;
|
|
6
|
+
return /* @__PURE__ */ jsx(DirectionContext.Provider, { value: dir, children });
|
|
7
|
+
};
|
|
8
|
+
function useDirection(localDir) {
|
|
9
|
+
const globalDir = React.useContext(DirectionContext);
|
|
10
|
+
return localDir || globalDir || "ltr";
|
|
11
|
+
}
|
|
12
|
+
const Provider = DirectionProvider;
|
|
13
|
+
export {
|
|
14
|
+
DirectionProvider,
|
|
15
|
+
Provider,
|
|
16
|
+
useDirection
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=useDirection.mjs.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 (\n <DirectionContext.Provider value={dir}>{children}</DirectionContext.Provider>\n )\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": "AAeI;AAbJ,YAAY,WAAW;AAGvB,MAAM,mBAAmB,MAAM,cAAqC,MAAS;AAOtE,MAAM,oBAAsD,CAAC,UAAU;AAC5E,QAAM,EAAE,KAAK,SAAS,IAAI;AAC1B,SACE,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,KAAM,UAAS;AAErD;AAEO,SAAS,aAAa,UAAsB;AACjD,QAAM,YAAY,MAAM,WAAW,gBAAgB;AACnD,SAAO,YAAY,aAAa;AAClC;AAEO,MAAM,WAAW;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/use-direction",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.11",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"clean:build": "tamagui-build clean:build"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@tamagui/build": "^1.2.
|
|
21
|
+
"@tamagui/build": "^1.2.11",
|
|
22
22
|
"react": "^18.2.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|