@dangerousthings/react-native 0.2.0 → 0.2.1
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/LICENSE +21 -0
- package/README.md +154 -0
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dangerous Things
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# @dangerousthings/react-native
|
|
2
|
+
|
|
3
|
+
React Native components for the Dangerous Things design system — 18 themed components built on React Native Paper with cyberpunk beveled aesthetics.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @dangerousthings/react-native
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Peer Dependencies
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install react-native-paper react-native-safe-area-context react-native-svg
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Optional for custom fonts:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx expo install expo-font
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Setup
|
|
24
|
+
|
|
25
|
+
Wrap your app with `DTThemeProvider`:
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { DTThemeProvider } from "@dangerousthings/react-native";
|
|
29
|
+
|
|
30
|
+
export default function App() {
|
|
31
|
+
return (
|
|
32
|
+
<DTThemeProvider>
|
|
33
|
+
{/* your app */}
|
|
34
|
+
</DTThemeProvider>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Options:
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
<DTThemeProvider
|
|
43
|
+
includeSafeArea={true} // wraps in SafeAreaProvider (default: true)
|
|
44
|
+
/>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Components
|
|
48
|
+
|
|
49
|
+
### Basic
|
|
50
|
+
|
|
51
|
+
| Component | Description |
|
|
52
|
+
|-----------|-------------|
|
|
53
|
+
| `DTButton` | Beveled button with variant colors (normal, emphasis, warning, success, other) |
|
|
54
|
+
| `DTCard` | Beveled card with optional header and title |
|
|
55
|
+
| `DTChip` | Compact labeled element (MD3 chip style) |
|
|
56
|
+
| `DTLabel` | Top-right beveled label with status colors |
|
|
57
|
+
|
|
58
|
+
### Forms
|
|
59
|
+
|
|
60
|
+
| Component | Description |
|
|
61
|
+
|-----------|-------------|
|
|
62
|
+
| `DTTextInput` | Sharp-cornered input with focus glow |
|
|
63
|
+
| `DTCheckbox` | Beveled checkbox with opposing corner cuts |
|
|
64
|
+
| `DTSwitch` | Angular toggle switch |
|
|
65
|
+
| `DTRadioGroup` | Hexagonal radio buttons |
|
|
66
|
+
| `DTQuantityStepper` | Beveled +/- increment buttons |
|
|
67
|
+
| `DTSearchInput` | Search-styled text input |
|
|
68
|
+
|
|
69
|
+
### Layout & Display
|
|
70
|
+
|
|
71
|
+
| Component | Description |
|
|
72
|
+
|-----------|-------------|
|
|
73
|
+
| `DTProgressBar` | Angular progress bar with optional label |
|
|
74
|
+
| `DTMediaFrame` | Diagonal beveled frame for images |
|
|
75
|
+
| `DTAccordion` | Collapsible sections with accent border |
|
|
76
|
+
| `DTHexagon` | Decorative hexagon SVG shape |
|
|
77
|
+
|
|
78
|
+
### Interactive
|
|
79
|
+
|
|
80
|
+
| Component | Description |
|
|
81
|
+
|-----------|-------------|
|
|
82
|
+
| `DTModal` | Modal dialog with beveled corners |
|
|
83
|
+
| `DTDrawer` | Side drawer with edge bevels |
|
|
84
|
+
| `DTGallery` | Image gallery |
|
|
85
|
+
| `DTMenu` | Dropdown menu with item variants |
|
|
86
|
+
|
|
87
|
+
## Usage Examples
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
import { DTButton, DTCard, DTTextInput } from "@dangerousthings/react-native";
|
|
91
|
+
|
|
92
|
+
// Button with variant
|
|
93
|
+
<DTButton variant="normal" onPress={handlePress}>
|
|
94
|
+
Scan NFC
|
|
95
|
+
</DTButton>
|
|
96
|
+
|
|
97
|
+
// Card with title
|
|
98
|
+
<DTCard title="Scan Results" mode="normal">
|
|
99
|
+
<Text>Chip detected</Text>
|
|
100
|
+
</DTCard>
|
|
101
|
+
|
|
102
|
+
// Text input with error state
|
|
103
|
+
<DTTextInput
|
|
104
|
+
variant="normal"
|
|
105
|
+
label="Username"
|
|
106
|
+
error={true}
|
|
107
|
+
errorMessage="Required"
|
|
108
|
+
/>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Theme Utilities
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import { useDTTheme, getColor, getVariantColor } from "@dangerousthings/react-native";
|
|
115
|
+
|
|
116
|
+
// Access the full theme in a component
|
|
117
|
+
const theme = useDTTheme();
|
|
118
|
+
theme.colors.primary; // "#00FFFF"
|
|
119
|
+
|
|
120
|
+
// Get a color with optional opacity
|
|
121
|
+
getColor("modeNormal", 0.5); // "rgba(0, 255, 255, 0.5)"
|
|
122
|
+
|
|
123
|
+
// Resolve a variant name to its color
|
|
124
|
+
getVariantColor("emphasis"); // "#FFFF00"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Bevel Utilities
|
|
128
|
+
|
|
129
|
+
Build SVG paths for custom beveled shapes:
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import {
|
|
133
|
+
buildBeveledRectPath,
|
|
134
|
+
buildButtonBevelPath,
|
|
135
|
+
buildCardBevelPath,
|
|
136
|
+
} from "@dangerousthings/react-native";
|
|
137
|
+
|
|
138
|
+
// Custom bevel
|
|
139
|
+
const path = buildBeveledRectPath(200, 48, { bottomRight: 12 });
|
|
140
|
+
|
|
141
|
+
// Preset bevel paths
|
|
142
|
+
const buttonPath = buildButtonBevelPath(200, 48);
|
|
143
|
+
const cardPath = buildCardBevelPath(300, 200);
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Re-exported Paper Components
|
|
147
|
+
|
|
148
|
+
For convenience, these React Native Paper components are re-exported:
|
|
149
|
+
|
|
150
|
+
`Text`, `Surface`, `IconButton`, `ActivityIndicator`, `Divider`, `List`, `Portal`, `Modal`, `Snackbar`, `TextInput`
|
|
151
|
+
|
|
152
|
+
## License
|
|
153
|
+
|
|
154
|
+
[MIT](LICENSE)
|