@huin-core/react-direction 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +7 -0
- package/dist/index.mjs +19 -0
- package/dist/index.mjs.map +7 -0
- package/package.json +3 -2
package/dist/index.d.mts
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
|
3
|
+
type Direction = 'ltr' | 'rtl';
|
4
|
+
interface DirectionProviderProps {
|
5
|
+
children?: React.ReactNode;
|
6
|
+
dir: Direction;
|
7
|
+
}
|
8
|
+
declare const DirectionProvider: React.FC<DirectionProviderProps>;
|
9
|
+
declare function useDirection(localDir?: Direction): Direction;
|
10
|
+
declare const Provider: React.FC<DirectionProviderProps>;
|
11
|
+
|
12
|
+
export { DirectionProvider, Provider, useDirection };
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
|
3
|
+
type Direction = 'ltr' | 'rtl';
|
4
|
+
interface DirectionProviderProps {
|
5
|
+
children?: React.ReactNode;
|
6
|
+
dir: Direction;
|
7
|
+
}
|
8
|
+
declare const DirectionProvider: React.FC<DirectionProviderProps>;
|
9
|
+
declare function useDirection(localDir?: Direction): Direction;
|
10
|
+
declare const Provider: React.FC<DirectionProviderProps>;
|
11
|
+
|
12
|
+
export { DirectionProvider, Provider, useDirection };
|
package/dist/index.js
ADDED
@@ -0,0 +1,52 @@
|
|
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
|
+
|
30
|
+
// packages/react/direction/src/index.ts
|
31
|
+
var src_exports = {};
|
32
|
+
__export(src_exports, {
|
33
|
+
DirectionProvider: () => DirectionProvider,
|
34
|
+
Provider: () => Provider,
|
35
|
+
useDirection: () => useDirection
|
36
|
+
});
|
37
|
+
module.exports = __toCommonJS(src_exports);
|
38
|
+
|
39
|
+
// packages/react/direction/src/Direction.tsx
|
40
|
+
var React = __toESM(require("react"));
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
42
|
+
var DirectionContext = React.createContext(void 0);
|
43
|
+
var DirectionProvider = (props) => {
|
44
|
+
const { dir, children } = props;
|
45
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DirectionContext.Provider, { value: dir, children });
|
46
|
+
};
|
47
|
+
function useDirection(localDir) {
|
48
|
+
const globalDir = React.useContext(DirectionContext);
|
49
|
+
return localDir || globalDir || "ltr";
|
50
|
+
}
|
51
|
+
var Provider = DirectionProvider;
|
52
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../src/index.ts", "../src/Direction.tsx"],
|
4
|
+
"sourcesContent": ["export {\n useDirection,\n //\n Provider,\n //\n DirectionProvider,\n} from './Direction';\n", "import * as React from 'react';\n\ntype Direction = 'ltr' | 'rtl';\nconst DirectionContext = React.createContext<Direction | undefined>(undefined);\n\n/* -------------------------------------------------------------------------------------------------\n * Direction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DirectionProviderProps {\n children?: React.ReactNode;\n dir: Direction;\n}\nconst DirectionProvider: React.FC<DirectionProviderProps> = (props) => {\n const { dir, children } = props;\n return <DirectionContext.Provider value={dir}>{children}</DirectionContext.Provider>;\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction useDirection(localDir?: Direction) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || 'ltr';\n}\n\nconst Provider = DirectionProvider;\n\nexport {\n useDirection,\n //\n Provider,\n //\n DirectionProvider,\n};\n"],
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AAed;AAZT,IAAM,mBAAyB,oBAAqC,MAAS;AAU7E,IAAM,oBAAsD,CAAC,UAAU;AACrE,QAAM,EAAE,KAAK,SAAS,IAAI;AAC1B,SAAO,4CAAC,iBAAiB,UAAjB,EAA0B,OAAO,KAAM,UAAS;AAC1D;AAIA,SAAS,aAAa,UAAsB;AAC1C,QAAM,YAAkB,iBAAW,gBAAgB;AACnD,SAAO,YAAY,aAAa;AAClC;AAEA,IAAM,WAAW;",
|
6
|
+
"names": []
|
7
|
+
}
|
package/dist/index.mjs
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
// packages/react/direction/src/Direction.tsx
|
2
|
+
import * as React from "react";
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
4
|
+
var DirectionContext = React.createContext(void 0);
|
5
|
+
var DirectionProvider = (props) => {
|
6
|
+
const { dir, children } = props;
|
7
|
+
return /* @__PURE__ */ jsx(DirectionContext.Provider, { value: dir, children });
|
8
|
+
};
|
9
|
+
function useDirection(localDir) {
|
10
|
+
const globalDir = React.useContext(DirectionContext);
|
11
|
+
return localDir || globalDir || "ltr";
|
12
|
+
}
|
13
|
+
var Provider = DirectionProvider;
|
14
|
+
export {
|
15
|
+
DirectionProvider,
|
16
|
+
Provider,
|
17
|
+
useDirection
|
18
|
+
};
|
19
|
+
//# sourceMappingURL=index.mjs.map
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"version": 3,
|
3
|
+
"sources": ["../src/Direction.tsx"],
|
4
|
+
"sourcesContent": ["import * as React from 'react';\n\ntype Direction = 'ltr' | 'rtl';\nconst DirectionContext = React.createContext<Direction | undefined>(undefined);\n\n/* -------------------------------------------------------------------------------------------------\n * Direction\n * -----------------------------------------------------------------------------------------------*/\n\ninterface DirectionProviderProps {\n children?: React.ReactNode;\n dir: Direction;\n}\nconst DirectionProvider: React.FC<DirectionProviderProps> = (props) => {\n const { dir, children } = props;\n return <DirectionContext.Provider value={dir}>{children}</DirectionContext.Provider>;\n};\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction useDirection(localDir?: Direction) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || 'ltr';\n}\n\nconst Provider = DirectionProvider;\n\nexport {\n useDirection,\n //\n Provider,\n //\n DirectionProvider,\n};\n"],
|
5
|
+
"mappings": ";AAAA,YAAY,WAAW;AAed;AAZT,IAAM,mBAAyB,oBAAqC,MAAS;AAU7E,IAAM,oBAAsD,CAAC,UAAU;AACrE,QAAM,EAAE,KAAK,SAAS,IAAI;AAC1B,SAAO,oBAAC,iBAAiB,UAAjB,EAA0B,OAAO,KAAM,UAAS;AAC1D;AAIA,SAAS,aAAa,UAAsB;AAC1C,QAAM,YAAkB,iBAAW,gBAAgB;AACnD,SAAO,YAAY,aAAa;AAClC;AAEA,IAAM,WAAW;",
|
6
|
+
"names": []
|
7
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@huin-core/react-direction",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.4",
|
4
4
|
"license": "MIT",
|
5
5
|
"exports": {
|
6
6
|
".": {
|
@@ -20,7 +20,8 @@
|
|
20
20
|
"types": "./dist/index.d.ts",
|
21
21
|
"files": [
|
22
22
|
"dist",
|
23
|
-
"README.md"
|
23
|
+
"README.md",
|
24
|
+
"package.json"
|
24
25
|
],
|
25
26
|
"sideEffects": false,
|
26
27
|
"scripts": {
|