Skip to content

Commit 10c38a6

Browse files
authored
Add subpath imports to @tabler/icons-react-native (#1373)
1 parent 6dda2c5 commit 10c38a6

File tree

14 files changed

+375
-138
lines changed

14 files changed

+375
-138
lines changed

packages/icons-react-native/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@
3232
"types": "./dist/esm/tabler-icons-react-native.d.ts",
3333
"default": "./dist/esm/tabler-icons-react-native.mjs"
3434
}
35+
},
36+
"./*": {
37+
"require": {
38+
"types": "./dist/cjs/icons/*.d.cts",
39+
"default": "./dist/cjs/icons/*.cjs"
40+
},
41+
"import": {
42+
"types": "./dist/esm/icons/*.d.ts",
43+
"default": "./dist/esm/icons/*.mjs"
44+
}
3545
}
3646
},
3747
"sideEffects": false,

packages/icons-react-native/rollup.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const bundles = [
1111
format: 'cjs',
1212
inputs,
1313
extension: 'cjs',
14+
preserveModules: true,
1415
},
1516
{
1617
format: 'esm',

pnpm-lock.yaml

Lines changed: 160 additions & 138 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/test-react-native/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

test/test-react-native/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>Vite + React + TS</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="/src/main.tsx"></script>
11+
</body>
12+
</html>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "test-react-native",
3+
"private": true,
4+
"version": "3.34.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc && vite build",
9+
"preview": "vite preview",
10+
"clean": "rm -rf dist"
11+
},
12+
"dependencies": {
13+
"@tabler/icons-react-native": "3.34.0",
14+
"react": "^18.2.0",
15+
"react-dom": "^18.2.0"
16+
},
17+
"devDependencies": {
18+
"@types/react": "^18.2.60",
19+
"@types/react-dom": "^18.2.19",
20+
"@vitejs/plugin-react": "^4.2.1"
21+
}
22+
}

test/test-react-native/src/App.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#root {
2+
max-width: 1280px;
3+
margin: 0 auto;
4+
padding: 2rem;
5+
text-align: center;
6+
}
7+

test/test-react-native/src/App.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { useState } from 'react'
2+
import './App.css'
3+
import { IconAd, IconAdOff } from '@tabler/icons-react-native';
4+
import IconAdFilled from '@tabler/icons-react-native/IconAdFilled'
5+
6+
function App() {
7+
const [active, setActive] = useState(false)
8+
9+
return (
10+
<div className="App">
11+
<a onClick={() => setActive(!active)}>
12+
{active ? <IconAdOff size={48} /> : <IconAd size={48} />}
13+
</a>
14+
<IconAd size={48} strokeWidth={1} />
15+
<IconAdOff size={48} strokeWidth={1.5} />
16+
<IconAdFilled size={48} strokeWidth={2} />
17+
</div>
18+
);
19+
}
20+
21+
export default App
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
:root {
2+
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
3+
font-size: 16px;
4+
line-height: 24px;
5+
font-weight: 400;
6+
7+
color-scheme: light dark;
8+
color: rgba(255, 255, 255, 0.87);
9+
background-color: #242424;
10+
11+
font-synthesis: none;
12+
text-rendering: optimizeLegibility;
13+
-webkit-font-smoothing: antialiased;
14+
-moz-osx-font-smoothing: grayscale;
15+
-webkit-text-size-adjust: 100%;
16+
}
17+
18+
a {
19+
font-weight: 500;
20+
color: #646cff;
21+
text-decoration: inherit;
22+
}
23+
a:hover {
24+
color: #535bf2;
25+
}
26+
27+
body {
28+
margin: 0;
29+
display: flex;
30+
place-items: center;
31+
min-width: 320px;
32+
min-height: 100vh;
33+
}
34+
35+
h1 {
36+
font-size: 3.2em;
37+
line-height: 1.1;
38+
}
39+
40+
button {
41+
border-radius: 8px;
42+
border: 1px solid transparent;
43+
padding: 0.6em 1.2em;
44+
font-size: 1em;
45+
font-weight: 500;
46+
font-family: inherit;
47+
background-color: #1a1a1a;
48+
cursor: pointer;
49+
transition: border-color 0.25s;
50+
}
51+
button:hover {
52+
border-color: #646cff;
53+
}
54+
button:focus,
55+
button:focus-visible {
56+
outline: 4px auto -webkit-focus-ring-color;
57+
}
58+
59+
@media (prefers-color-scheme: light) {
60+
:root {
61+
color: #213547;
62+
background-color: #ffffff;
63+
}
64+
a:hover {
65+
color: #747bff;
66+
}
67+
button {
68+
background-color: #f9f9f9;
69+
}
70+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from 'react'
2+
import ReactDOM from 'react-dom/client'
3+
import App from './App'
4+
import './index.css'
5+
6+
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
7+
<React.StrictMode>
8+
<App />
9+
</React.StrictMode>,
10+
)

0 commit comments

Comments
 (0)