first commit
This commit is contained in:
commit
24ddfe2f89
26
package.json
Normal file
26
package.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "uikit",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"type": "module",
|
||||||
|
"main": "./dist/index.js",
|
||||||
|
"module": "./dist/index.js",
|
||||||
|
"exports": {
|
||||||
|
".": "./dist/index.js"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"build": "vite build"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^18.0.0 || ^19.0.0",
|
||||||
|
"react-dom": "^18.0.0 || ^19.0.0",
|
||||||
|
"@chakra-ui/react": "^3.0.0",
|
||||||
|
"react-icons": "^5.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vitejs/plugin-react": "^6.0.2",
|
||||||
|
"vite": "^7.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
src/index.js
Normal file
1
src/index.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { toFaNumber, toFaDigits, toEnDigits } from "./utils/numbers.js";
|
||||||
12
src/utils/numbers.js
Normal file
12
src/utils/numbers.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
export const toFaNumber = (value) => {
|
||||||
|
return new Intl.NumberFormat("fa-IR").format(Number(value));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toFaDigits = (value) => {
|
||||||
|
return String(value).replace(/\d/g, (d) => "۰۱۲۳۴۵۶۷۸۹"[Number(d)]);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const toEnDigits = (value) => {
|
||||||
|
const numberString = String(value);
|
||||||
|
return numberString.replace(/[۰-۹]/g, (d) => String("۰۱۲۳۴۵۶۷۸۹".indexOf(d)));
|
||||||
|
};
|
||||||
24
vite.config.js
Normal file
24
vite.config.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import { defineConfig } from "vite";
|
||||||
|
import react from "@vitejs/plugin-react";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [react()],
|
||||||
|
build: {
|
||||||
|
lib: {
|
||||||
|
entry: path.resolve(process.cwd(), "src/index.js"),
|
||||||
|
name: "uikit",
|
||||||
|
formats: ["es"],
|
||||||
|
fileName: () => "index.js",
|
||||||
|
},
|
||||||
|
rolldownOptions: {
|
||||||
|
external: [
|
||||||
|
"react",
|
||||||
|
"react-dom",
|
||||||
|
"react/jsx-runtime",
|
||||||
|
"@chakra-ui/react",
|
||||||
|
"react-icons",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user