torch-glare 1.1.13 → 1.2.7
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 -21
- package/README.md +25 -25
- package/docs/README.md +207 -207
- package/lib/components/ActionButton.tsx +65 -65
- package/lib/components/ActionsGroup.tsx +38 -38
- package/lib/components/AlertDialog.tsx +222 -222
- package/lib/components/Avatar.tsx +49 -49
- package/lib/components/Badge.tsx +116 -116
- package/lib/components/BadgeField.tsx +203 -203
- package/lib/components/Button.tsx +265 -265
- package/lib/components/Calendar.tsx +102 -102
- package/lib/components/Card.tsx +64 -64
- package/lib/components/Checkbox.tsx +49 -49
- package/lib/components/CountBadge.tsx +54 -54
- package/lib/components/DataTable.tsx +232 -232
- package/lib/components/DatePicker.tsx +223 -223
- package/lib/components/Dialog.tsx +129 -129
- package/lib/components/Divider.tsx +31 -31
- package/lib/components/Drawer.tsx +118 -118
- package/lib/components/DropdownMenu.tsx +399 -399
- package/lib/components/FieldHint.tsx +76 -76
- package/lib/components/Form.tsx +191 -191
- package/lib/components/ImageAttachment.tsx +196 -196
- package/lib/components/InnerLabelField.tsx +150 -150
- package/lib/components/Input.tsx +206 -206
- package/lib/components/InputField.tsx +149 -149
- package/lib/components/InputOTP.tsx +85 -85
- package/lib/components/Label.tsx +126 -126
- package/lib/components/LabelField.tsx +77 -77
- package/lib/components/LabeledCheckBox.tsx +55 -55
- package/lib/components/LabeledRadio.tsx +48 -48
- package/lib/components/LinkButton.tsx +93 -93
- package/lib/components/LoginButton.tsx +56 -56
- package/lib/components/PasswordLevel.tsx +58 -58
- package/lib/components/Popover.tsx +274 -274
- package/lib/components/ProfileMenu.tsx +90 -90
- package/lib/components/Radio.tsx +65 -65
- package/lib/components/RadioCard.tsx +66 -66
- package/lib/components/ScrollArea.tsx +52 -52
- package/lib/components/SearchField.tsx +51 -51
- package/lib/components/Select.tsx +418 -418
- package/lib/components/SimpleSelect.tsx +216 -216
- package/lib/components/Skeleton.tsx +15 -15
- package/lib/components/SlideDatePicker.tsx +193 -193
- package/lib/components/SpinLoading.tsx +190 -190
- package/lib/components/Switch.tsx +81 -81
- package/lib/components/TabFormItem.tsx +161 -161
- package/lib/components/Table.tsx +397 -397
- package/lib/components/Textarea.tsx +96 -96
- package/lib/components/Toast.tsx +86 -86
- package/lib/components/Toggle.tsx +127 -127
- package/lib/components/Tooltip.tsx +111 -111
- package/lib/components/TransparentLabel.tsx +72 -72
- package/lib/components/TreeDropDown-dev.tsx +69 -0
- package/lib/components/TreeDropDown.tsx +69 -69
- package/lib/hooks/useActiveTreeItem.ts +60 -60
- package/lib/hooks/useClickOutside.ts +26 -26
- package/lib/hooks/useResize.ts +78 -78
- package/lib/hooks/useTagSelection.ts +214 -214
- package/lib/layouts/CNLayout.tsx +330 -330
- package/lib/layouts/FieldSection.tsx +63 -63
- package/lib/layouts/TreeSubLayout.tsx +187 -187
- package/lib/providers/ThemeProvider.tsx +98 -98
- package/lib/utils/cn.ts +6 -6
- package/lib/utils/dateFormat.ts +98 -98
- package/lib/utils/resize.ts +34 -34
- package/lib/utils/types.ts +12 -12
- package/package.json +29 -29
- package/dist/bin/index.d.ts +0 -3
- package/dist/bin/index.d.ts.map +0 -1
- package/dist/bin/index.js +0 -44
- package/dist/bin/index.js.map +0 -1
- package/dist/src/commands/add.d.ts +0 -7
- package/dist/src/commands/add.d.ts.map +0 -1
- package/dist/src/commands/add.js +0 -62
- package/dist/src/commands/add.js.map +0 -1
- package/dist/src/commands/hook.d.ts +0 -7
- package/dist/src/commands/hook.d.ts.map +0 -1
- package/dist/src/commands/hook.js +0 -69
- package/dist/src/commands/hook.js.map +0 -1
- package/dist/src/commands/init.d.ts +0 -3
- package/dist/src/commands/init.d.ts.map +0 -1
- package/dist/src/commands/init.js +0 -16
- package/dist/src/commands/init.js.map +0 -1
- package/dist/src/commands/layout.d.ts +0 -7
- package/dist/src/commands/layout.d.ts.map +0 -1
- package/dist/src/commands/layout.js +0 -69
- package/dist/src/commands/layout.js.map +0 -1
- package/dist/src/commands/provider.d.ts +0 -7
- package/dist/src/commands/provider.d.ts.map +0 -1
- package/dist/src/commands/provider.js +0 -69
- package/dist/src/commands/provider.js.map +0 -1
- package/dist/src/commands/update.d.ts +0 -5
- package/dist/src/commands/update.d.ts.map +0 -1
- package/dist/src/commands/update.js +0 -113
- package/dist/src/commands/update.js.map +0 -1
- package/dist/src/commands/utils.d.ts +0 -7
- package/dist/src/commands/utils.d.ts.map +0 -1
- package/dist/src/commands/utils.js +0 -71
- package/dist/src/commands/utils.js.map +0 -1
- package/dist/src/shared/copyComponentsRecursively.d.ts +0 -13
- package/dist/src/shared/copyComponentsRecursively.d.ts.map +0 -1
- package/dist/src/shared/copyComponentsRecursively.js +0 -44
- package/dist/src/shared/copyComponentsRecursively.js.map +0 -1
- package/dist/src/shared/detectPackageManager.d.ts +0 -6
- package/dist/src/shared/detectPackageManager.d.ts.map +0 -1
- package/dist/src/shared/detectPackageManager.js +0 -20
- package/dist/src/shared/detectPackageManager.js.map +0 -1
- package/dist/src/shared/ensureDirectoryExists.d.ts +0 -2
- package/dist/src/shared/ensureDirectoryExists.d.ts.map +0 -1
- package/dist/src/shared/ensureDirectoryExists.js +0 -11
- package/dist/src/shared/ensureDirectoryExists.js.map +0 -1
- package/dist/src/shared/getAvailableFiles.d.ts +0 -7
- package/dist/src/shared/getAvailableFiles.d.ts.map +0 -1
- package/dist/src/shared/getAvailableFiles.js +0 -11
- package/dist/src/shared/getAvailableFiles.js.map +0 -1
- package/dist/src/shared/getConfig.d.ts +0 -2
- package/dist/src/shared/getConfig.d.ts.map +0 -1
- package/dist/src/shared/getConfig.js +0 -15
- package/dist/src/shared/getConfig.js.map +0 -1
- package/dist/src/shared/getCurrentInstalledDependencies.d.ts +0 -7
- package/dist/src/shared/getCurrentInstalledDependencies.d.ts.map +0 -1
- package/dist/src/shared/getCurrentInstalledDependencies.js +0 -24
- package/dist/src/shared/getCurrentInstalledDependencies.js.map +0 -1
- package/dist/src/shared/getDependenciesAndInstallNestedComponents.d.ts +0 -8
- package/dist/src/shared/getDependenciesAndInstallNestedComponents.d.ts.map +0 -1
- package/dist/src/shared/getDependenciesAndInstallNestedComponents.js +0 -50
- package/dist/src/shared/getDependenciesAndInstallNestedComponents.js.map +0 -1
- package/dist/src/shared/getInstallCommand.d.ts +0 -8
- package/dist/src/shared/getInstallCommand.d.ts.map +0 -1
- package/dist/src/shared/getInstallCommand.js +0 -18
- package/dist/src/shared/getInstallCommand.js.map +0 -1
- package/dist/src/shared/getInstallPaths.d.ts +0 -14
- package/dist/src/shared/getInstallPaths.d.ts.map +0 -1
- package/dist/src/shared/getInstallPaths.js +0 -16
- package/dist/src/shared/getInstallPaths.js.map +0 -1
- package/dist/src/shared/installDependencies.d.ts +0 -6
- package/dist/src/shared/installDependencies.d.ts.map +0 -1
- package/dist/src/shared/installDependencies.js +0 -36
- package/dist/src/shared/installDependencies.js.map +0 -1
- package/dist/src/shared/isFileExists.d.ts +0 -7
- package/dist/src/shared/isFileExists.d.ts.map +0 -1
- package/dist/src/shared/isFileExists.js +0 -10
- package/dist/src/shared/isFileExists.js.map +0 -1
- package/dist/src/shared/tailwindInit.d.ts +0 -2
- package/dist/src/shared/tailwindInit.d.ts.map +0 -1
- package/dist/src/shared/tailwindInit.js +0 -76
- package/dist/src/shared/tailwindInit.js.map +0 -1
- package/dist/src/types/main.d.ts +0 -8
- package/dist/src/types/main.d.ts.map +0 -1
- package/dist/src/types/main.js +0 -2
- package/dist/src/types/main.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 TORCH corp.
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 TORCH corp.
|
|
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
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
# TORCH Glare Components Library
|
|
2
|
-
|
|
3
|
-
Welcome to the **TORCH Glare Components Library**! This library offers a comprehensive set of reusable React components designed to help you build modern, efficient user interfaces. It also includes a powerful CLI tool (**torch-glare CLI**) to simplify component management and integration.
|
|
4
|
-
|
|
5
|
-

|
|
6
|
-
|
|
7
|
-
## Documentation
|
|
8
|
-
You can find the complete documentation at: [https://glare.torchcorp.com](https://glare.torchcorp.com)
|
|
9
|
-
|
|
10
|
-
## Contributing
|
|
11
|
-
We’re excited to welcome contributors! To get started:
|
|
12
|
-
|
|
13
|
-
1. Fork the repository.
|
|
14
|
-
2. Create a new branch.
|
|
15
|
-
3. Implement your changes.
|
|
16
|
-
4. Commit with a descriptive message.
|
|
17
|
-
5. Push your branch and open a pull request.
|
|
18
|
-
|
|
19
|
-
### Contribution Guidelines
|
|
20
|
-
- Adhere to the existing code style.
|
|
21
|
-
- Update or add documentation where applicable.
|
|
22
|
-
|
|
23
|
-
## License
|
|
24
|
-
This project is licensed under the **MIT License**.
|
|
25
|
-
|
|
1
|
+
# TORCH Glare Components Library
|
|
2
|
+
|
|
3
|
+
Welcome to the **TORCH Glare Components Library**! This library offers a comprehensive set of reusable React components designed to help you build modern, efficient user interfaces. It also includes a powerful CLI tool (**torch-glare CLI**) to simplify component management and integration.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Documentation
|
|
8
|
+
You can find the complete documentation at: [https://glare.torchcorp.com](https://glare.torchcorp.com)
|
|
9
|
+
|
|
10
|
+
## Contributing
|
|
11
|
+
We’re excited to welcome contributors! To get started:
|
|
12
|
+
|
|
13
|
+
1. Fork the repository.
|
|
14
|
+
2. Create a new branch.
|
|
15
|
+
3. Implement your changes.
|
|
16
|
+
4. Commit with a descriptive message.
|
|
17
|
+
5. Push your branch and open a pull request.
|
|
18
|
+
|
|
19
|
+
### Contribution Guidelines
|
|
20
|
+
- Adhere to the existing code style.
|
|
21
|
+
- Update or add documentation where applicable.
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
This project is licensed under the **MIT License**.
|
|
25
|
+
|
package/docs/README.md
CHANGED
|
@@ -1,207 +1,207 @@
|
|
|
1
|
-
# TORCH Glare Components Library
|
|
2
|
-
|
|
3
|
-
Welcome to the **TORCH Glare Components Library**! This library provides a collection of reusable React components to help you build user interfaces efficiently. Additionally, a CLI tool (**torch-glare CLI**) is available to streamline component management.
|
|
4
|
-
|
|
5
|
-
## Table of Contents
|
|
6
|
-
|
|
7
|
-
1. [Installation](#installation)
|
|
8
|
-
2. [Usage](#usage)
|
|
9
|
-
3. [CLI Commands](#cli-commands)
|
|
10
|
-
4. [Theming](#theming)
|
|
11
|
-
5. [Contributing](#contributing)
|
|
12
|
-
6. [License](#license)
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## 1. Initialize Your Project
|
|
18
|
-
|
|
19
|
-
To install the TORCH Glare Components Library, run the following command:
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
npx torch-glare@latest init
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
This command will:
|
|
26
|
-
- Create or modify the `tailwind.config.js` file to support Tailwind CSS for Tailwind versions less then 4.
|
|
27
|
-
- Generate a `torch.json` file where you can customize the installation path for components.
|
|
28
|
-
|
|
29
|
-
### Tailwind CSS Requirement
|
|
30
|
-
Ensure that Tailwind CSS is installed in your project before running the initialization command.
|
|
31
|
-
|
|
32
|
-
## 2. Add Essential Plugins for Tailwind CSS
|
|
33
|
-
|
|
34
|
-
If you're using Tailwind CSS version 4 or above, add the following plugins to your global CSS file:
|
|
35
|
-
|
|
36
|
-
```css
|
|
37
|
-
@import "tailwindcss";
|
|
38
|
-
/* Essential plugins */
|
|
39
|
-
@plugin 'glare-typography';
|
|
40
|
-
@plugin 'mapping-color-system';
|
|
41
|
-
@plugin 'glare-torch-mode';
|
|
42
|
-
@plugin 'tailwind-scrollbar-hide';
|
|
43
|
-
@plugin 'tailwindcss-animate';
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
### 2. Add Remix Icon Library
|
|
48
|
-
Include the following in `index.html` or nextjs `layout.tsx` or meta data for icon support:
|
|
49
|
-
|
|
50
|
-
```html
|
|
51
|
-
<html>
|
|
52
|
-
<head>
|
|
53
|
-
<link
|
|
54
|
-
href="https://cdn.jsdelivr.net/npm/remixicon@4.5.0/fonts/remixicon.css"
|
|
55
|
-
rel="stylesheet"
|
|
56
|
-
/>
|
|
57
|
-
</head>
|
|
58
|
-
<body></body>
|
|
59
|
-
</html>
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## 3. Configure Installation Path
|
|
64
|
-
|
|
65
|
-
Adjust the `glare.json` file to specify where you want to install components:
|
|
66
|
-
|
|
67
|
-
```json
|
|
68
|
-
{
|
|
69
|
-
"path": "./src" // The directory where components will be installed
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### 4. Add Components
|
|
74
|
-
To add a specific component, run:
|
|
75
|
-
|
|
76
|
-
```sh
|
|
77
|
-
npx torch-glare@latest add [component-name]
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
Or, to add components interactively:
|
|
81
|
-
|
|
82
|
-
```sh
|
|
83
|
-
npx torch-glare@latest add
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## Usage
|
|
87
|
-
|
|
88
|
-
Once installed, import and use the components as needed:
|
|
89
|
-
|
|
90
|
-
```tsx
|
|
91
|
-
import React from "react";
|
|
92
|
-
import { Button } from "./components";
|
|
93
|
-
|
|
94
|
-
const App = () => {
|
|
95
|
-
return (
|
|
96
|
-
<div>
|
|
97
|
-
<Button >Hello.</Button>
|
|
98
|
-
</div>
|
|
99
|
-
);
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export default App;
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## CLI Commands
|
|
106
|
-
|
|
107
|
-
### Initialize Configuration
|
|
108
|
-
```sh
|
|
109
|
-
npx torch-glare@latest init
|
|
110
|
-
```
|
|
111
|
-
- Creates a `torch.json` configuration file.
|
|
112
|
-
- Create or modify `tailwind.config.ts` file for tailwind support.
|
|
113
|
-
|
|
114
|
-
### Add Components
|
|
115
|
-
```sh
|
|
116
|
-
npx torch-glare@latest add [component]
|
|
117
|
-
```
|
|
118
|
-
Adds a specific component or runs an interactive prompt if no name is provided.
|
|
119
|
-
|
|
120
|
-
### Add Hooks
|
|
121
|
-
```sh
|
|
122
|
-
npx torch-glare@latest hook [hook]
|
|
123
|
-
```
|
|
124
|
-
Adds a specific hook or runs an interactive prompt if no name is provided.
|
|
125
|
-
|
|
126
|
-
### Add Utilities
|
|
127
|
-
```sh
|
|
128
|
-
npx torch-glare@latest util [util]
|
|
129
|
-
```
|
|
130
|
-
Adds a specific utility or runs an interactive prompt if no name is provided.
|
|
131
|
-
|
|
132
|
-
### Providers
|
|
133
|
-
```sh
|
|
134
|
-
npx torch-glare@latest provider [provider]
|
|
135
|
-
```
|
|
136
|
-
Adds a specific provider or runs an interactive prompt if no name is provided.
|
|
137
|
-
|
|
138
|
-
### Update Installed Resources
|
|
139
|
-
|
|
140
|
-
```sh
|
|
141
|
-
npx torch-glare@latest update
|
|
142
|
-
```
|
|
143
|
-
Updates all installed components, hooks, utilities, and providers.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
## Theming
|
|
147
|
-
|
|
148
|
-
The TORCH Glare Components Library supports both light and dark themes. You can set a fixed theme for your components using the `theme` attribute.
|
|
149
|
-
|
|
150
|
-
### Setting a Fixed Theme
|
|
151
|
-
|
|
152
|
-
To apply a fixed theme (dark or light) to a component, add the `theme `attribute with the desired theme value:
|
|
153
|
-
|
|
154
|
-
```tsx
|
|
155
|
-
import React from "react";
|
|
156
|
-
import { Button } from "./components";
|
|
157
|
-
|
|
158
|
-
const App = () => {
|
|
159
|
-
return (
|
|
160
|
-
<div>
|
|
161
|
-
<Button theme="dark">Dark Theme Button</Button>
|
|
162
|
-
<Button theme="light">Light Theme Button</Button>
|
|
163
|
-
</div>
|
|
164
|
-
);
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
export default App;
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Global Theme
|
|
171
|
-
|
|
172
|
-
To apply a theme globally, wrap your application with the `ThemeProvider` and set the optional `defaultTheme` props:
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
```tsx
|
|
176
|
-
import { ThemeProvider } from "./components";
|
|
177
|
-
|
|
178
|
-
const App = () => {
|
|
179
|
-
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
|
|
180
|
-
<ThemeProvider defaultTheme="light" defaultThemeMode="TORCH">
|
|
181
|
-
<App />
|
|
182
|
-
</ThemeProvider>
|
|
183
|
-
);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
export default App;
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## Contributing
|
|
190
|
-
|
|
191
|
-
We welcome contributions! Follow these steps:
|
|
192
|
-
|
|
193
|
-
1. Fork the repository.
|
|
194
|
-
2. Create a new branch.
|
|
195
|
-
3. Implement your changes.
|
|
196
|
-
4. Commit with a clear message.
|
|
197
|
-
5. Push your changes and open a pull request.
|
|
198
|
-
|
|
199
|
-
### Contribution Guidelines
|
|
200
|
-
- Follow existing code style.
|
|
201
|
-
- Update documentation if necessary.
|
|
202
|
-
|
|
203
|
-
## License
|
|
204
|
-
|
|
205
|
-
This project is licensed under the **MIT License**.
|
|
206
|
-
|
|
207
|
-
|
|
1
|
+
# TORCH Glare Components Library
|
|
2
|
+
|
|
3
|
+
Welcome to the **TORCH Glare Components Library**! This library provides a collection of reusable React components to help you build user interfaces efficiently. Additionally, a CLI tool (**torch-glare CLI**) is available to streamline component management.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
1. [Installation](#installation)
|
|
8
|
+
2. [Usage](#usage)
|
|
9
|
+
3. [CLI Commands](#cli-commands)
|
|
10
|
+
4. [Theming](#theming)
|
|
11
|
+
5. [Contributing](#contributing)
|
|
12
|
+
6. [License](#license)
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## 1. Initialize Your Project
|
|
18
|
+
|
|
19
|
+
To install the TORCH Glare Components Library, run the following command:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
npx torch-glare@latest init
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This command will:
|
|
26
|
+
- Create or modify the `tailwind.config.js` file to support Tailwind CSS for Tailwind versions less then 4.
|
|
27
|
+
- Generate a `torch.json` file where you can customize the installation path for components.
|
|
28
|
+
|
|
29
|
+
### Tailwind CSS Requirement
|
|
30
|
+
Ensure that Tailwind CSS is installed in your project before running the initialization command.
|
|
31
|
+
|
|
32
|
+
## 2. Add Essential Plugins for Tailwind CSS
|
|
33
|
+
|
|
34
|
+
If you're using Tailwind CSS version 4 or above, add the following plugins to your global CSS file:
|
|
35
|
+
|
|
36
|
+
```css
|
|
37
|
+
@import "tailwindcss";
|
|
38
|
+
/* Essential plugins */
|
|
39
|
+
@plugin 'glare-typography';
|
|
40
|
+
@plugin 'mapping-color-system';
|
|
41
|
+
@plugin 'glare-torch-mode';
|
|
42
|
+
@plugin 'tailwind-scrollbar-hide';
|
|
43
|
+
@plugin 'tailwindcss-animate';
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
### 2. Add Remix Icon Library
|
|
48
|
+
Include the following in `index.html` or nextjs `layout.tsx` or meta data for icon support:
|
|
49
|
+
|
|
50
|
+
```html
|
|
51
|
+
<html>
|
|
52
|
+
<head>
|
|
53
|
+
<link
|
|
54
|
+
href="https://cdn.jsdelivr.net/npm/remixicon@4.5.0/fonts/remixicon.css"
|
|
55
|
+
rel="stylesheet"
|
|
56
|
+
/>
|
|
57
|
+
</head>
|
|
58
|
+
<body></body>
|
|
59
|
+
</html>
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 3. Configure Installation Path
|
|
64
|
+
|
|
65
|
+
Adjust the `glare.json` file to specify where you want to install components:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"path": "./src" // The directory where components will be installed
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 4. Add Components
|
|
74
|
+
To add a specific component, run:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
npx torch-glare@latest add [component-name]
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Or, to add components interactively:
|
|
81
|
+
|
|
82
|
+
```sh
|
|
83
|
+
npx torch-glare@latest add
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Usage
|
|
87
|
+
|
|
88
|
+
Once installed, import and use the components as needed:
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
import React from "react";
|
|
92
|
+
import { Button } from "./components";
|
|
93
|
+
|
|
94
|
+
const App = () => {
|
|
95
|
+
return (
|
|
96
|
+
<div>
|
|
97
|
+
<Button >Hello.</Button>
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default App;
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## CLI Commands
|
|
106
|
+
|
|
107
|
+
### Initialize Configuration
|
|
108
|
+
```sh
|
|
109
|
+
npx torch-glare@latest init
|
|
110
|
+
```
|
|
111
|
+
- Creates a `torch.json` configuration file.
|
|
112
|
+
- Create or modify `tailwind.config.ts` file for tailwind support.
|
|
113
|
+
|
|
114
|
+
### Add Components
|
|
115
|
+
```sh
|
|
116
|
+
npx torch-glare@latest add [component]
|
|
117
|
+
```
|
|
118
|
+
Adds a specific component or runs an interactive prompt if no name is provided.
|
|
119
|
+
|
|
120
|
+
### Add Hooks
|
|
121
|
+
```sh
|
|
122
|
+
npx torch-glare@latest hook [hook]
|
|
123
|
+
```
|
|
124
|
+
Adds a specific hook or runs an interactive prompt if no name is provided.
|
|
125
|
+
|
|
126
|
+
### Add Utilities
|
|
127
|
+
```sh
|
|
128
|
+
npx torch-glare@latest util [util]
|
|
129
|
+
```
|
|
130
|
+
Adds a specific utility or runs an interactive prompt if no name is provided.
|
|
131
|
+
|
|
132
|
+
### Providers
|
|
133
|
+
```sh
|
|
134
|
+
npx torch-glare@latest provider [provider]
|
|
135
|
+
```
|
|
136
|
+
Adds a specific provider or runs an interactive prompt if no name is provided.
|
|
137
|
+
|
|
138
|
+
### Update Installed Resources
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
npx torch-glare@latest update
|
|
142
|
+
```
|
|
143
|
+
Updates all installed components, hooks, utilities, and providers.
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
## Theming
|
|
147
|
+
|
|
148
|
+
The TORCH Glare Components Library supports both light and dark themes. You can set a fixed theme for your components using the `theme` attribute.
|
|
149
|
+
|
|
150
|
+
### Setting a Fixed Theme
|
|
151
|
+
|
|
152
|
+
To apply a fixed theme (dark or light) to a component, add the `theme `attribute with the desired theme value:
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
import React from "react";
|
|
156
|
+
import { Button } from "./components";
|
|
157
|
+
|
|
158
|
+
const App = () => {
|
|
159
|
+
return (
|
|
160
|
+
<div>
|
|
161
|
+
<Button theme="dark">Dark Theme Button</Button>
|
|
162
|
+
<Button theme="light">Light Theme Button</Button>
|
|
163
|
+
</div>
|
|
164
|
+
);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export default App;
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Global Theme
|
|
171
|
+
|
|
172
|
+
To apply a theme globally, wrap your application with the `ThemeProvider` and set the optional `defaultTheme` props:
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
import { ThemeProvider } from "./components";
|
|
177
|
+
|
|
178
|
+
const App = () => {
|
|
179
|
+
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
|
|
180
|
+
<ThemeProvider defaultTheme="light" defaultThemeMode="TORCH">
|
|
181
|
+
<App />
|
|
182
|
+
</ThemeProvider>
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export default App;
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Contributing
|
|
190
|
+
|
|
191
|
+
We welcome contributions! Follow these steps:
|
|
192
|
+
|
|
193
|
+
1. Fork the repository.
|
|
194
|
+
2. Create a new branch.
|
|
195
|
+
3. Implement your changes.
|
|
196
|
+
4. Commit with a clear message.
|
|
197
|
+
5. Push your changes and open a pull request.
|
|
198
|
+
|
|
199
|
+
### Contribution Guidelines
|
|
200
|
+
- Follow existing code style.
|
|
201
|
+
- Update documentation if necessary.
|
|
202
|
+
|
|
203
|
+
## License
|
|
204
|
+
|
|
205
|
+
This project is licensed under the **MIT License**.
|
|
206
|
+
|
|
207
|
+
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import React, { ButtonHTMLAttributes } from "react";
|
|
2
|
-
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
-
import { Button } from "./Button";
|
|
4
|
-
import { cn } from "../utils/cn";
|
|
5
|
-
import { ButtonVariant, Themes } from "../utils/types";
|
|
6
|
-
|
|
7
|
-
const buttonVariants = cva("!rounded-[4px]", {
|
|
8
|
-
variants: {
|
|
9
|
-
size: {
|
|
10
|
-
XS: "h-[18px] w-[18px] text-[12px]",
|
|
11
|
-
S: "h-[22px] w-[22px] text-[12px]",
|
|
12
|
-
M: "h-[32px] w-[32px] text-[18px]",
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
defaultVariants: {
|
|
16
|
-
size: "M",
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
interface Props
|
|
22
|
-
extends ButtonHTMLAttributes<HTMLButtonElement>,
|
|
23
|
-
VariantProps<typeof buttonVariants> {
|
|
24
|
-
is_loading?: boolean;
|
|
25
|
-
disabled?: boolean;
|
|
26
|
-
asChild?: boolean;
|
|
27
|
-
as?: React.ElementType;
|
|
28
|
-
theme?: Themes
|
|
29
|
-
variant?: ButtonVariant
|
|
30
|
-
}
|
|
31
|
-
export const ActionButton = function ({
|
|
32
|
-
size,
|
|
33
|
-
asChild,
|
|
34
|
-
as: Tag = "button",
|
|
35
|
-
className,
|
|
36
|
-
variant,
|
|
37
|
-
type = "button",
|
|
38
|
-
children,
|
|
39
|
-
theme,
|
|
40
|
-
...props
|
|
41
|
-
}: Props) {
|
|
42
|
-
return (
|
|
43
|
-
<Button
|
|
44
|
-
theme={theme}
|
|
45
|
-
asChild={asChild}
|
|
46
|
-
buttonType="icon"
|
|
47
|
-
type={type}
|
|
48
|
-
size={
|
|
49
|
-
size == "XS" ? "S" :
|
|
50
|
-
size == "S" ? "M" :
|
|
51
|
-
size == "M" ? "L" : "S"
|
|
52
|
-
}
|
|
53
|
-
variant={variant}
|
|
54
|
-
className={cn(
|
|
55
|
-
buttonVariants({
|
|
56
|
-
size,
|
|
57
|
-
})
|
|
58
|
-
, className
|
|
59
|
-
)}
|
|
60
|
-
{...props}
|
|
61
|
-
>
|
|
62
|
-
{children}
|
|
63
|
-
</Button>
|
|
64
|
-
);
|
|
65
|
-
};
|
|
1
|
+
import React, { ButtonHTMLAttributes } from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
import { Button } from "./Button";
|
|
4
|
+
import { cn } from "../utils/cn";
|
|
5
|
+
import { ButtonVariant, Themes } from "../utils/types";
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva("!rounded-[4px]", {
|
|
8
|
+
variants: {
|
|
9
|
+
size: {
|
|
10
|
+
XS: "h-[18px] w-[18px] text-[12px]",
|
|
11
|
+
S: "h-[22px] w-[22px] text-[12px]",
|
|
12
|
+
M: "h-[32px] w-[32px] text-[18px]",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
size: "M",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
interface Props
|
|
22
|
+
extends ButtonHTMLAttributes<HTMLButtonElement>,
|
|
23
|
+
VariantProps<typeof buttonVariants> {
|
|
24
|
+
is_loading?: boolean;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
asChild?: boolean;
|
|
27
|
+
as?: React.ElementType;
|
|
28
|
+
theme?: Themes
|
|
29
|
+
variant?: ButtonVariant
|
|
30
|
+
}
|
|
31
|
+
export const ActionButton = function ({
|
|
32
|
+
size,
|
|
33
|
+
asChild,
|
|
34
|
+
as: Tag = "button",
|
|
35
|
+
className,
|
|
36
|
+
variant,
|
|
37
|
+
type = "button",
|
|
38
|
+
children,
|
|
39
|
+
theme,
|
|
40
|
+
...props
|
|
41
|
+
}: Props) {
|
|
42
|
+
return (
|
|
43
|
+
<Button
|
|
44
|
+
theme={theme}
|
|
45
|
+
asChild={asChild}
|
|
46
|
+
buttonType="icon"
|
|
47
|
+
type={type}
|
|
48
|
+
size={
|
|
49
|
+
size == "XS" ? "S" :
|
|
50
|
+
size == "S" ? "M" :
|
|
51
|
+
size == "M" ? "L" : "S"
|
|
52
|
+
}
|
|
53
|
+
variant={variant}
|
|
54
|
+
className={cn(
|
|
55
|
+
buttonVariants({
|
|
56
|
+
size,
|
|
57
|
+
})
|
|
58
|
+
, className
|
|
59
|
+
)}
|
|
60
|
+
{...props}
|
|
61
|
+
>
|
|
62
|
+
{children}
|
|
63
|
+
</Button>
|
|
64
|
+
);
|
|
65
|
+
};
|