torch-glare 2.4.0 → 2.4.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.
Files changed (264) hide show
  1. package/README.md +8 -0
  2. package/apps/lib/components/ActionButton.tsx +7 -12
  3. package/apps/lib/components/ActionsGroup.tsx +4 -15
  4. package/apps/lib/components/AlertDialog.tsx +173 -191
  5. package/apps/lib/components/Avatar.tsx +13 -16
  6. package/apps/lib/components/Badge.tsx +1 -3
  7. package/apps/lib/components/BadgeField.tsx +76 -71
  8. package/apps/lib/components/Breadcrumb.tsx +49 -85
  9. package/apps/lib/components/Button.tsx +20 -19
  10. package/apps/lib/components/ButtonGroup.tsx +31 -41
  11. package/apps/lib/components/Calendar.tsx +51 -29
  12. package/apps/lib/components/Card.tsx +2 -13
  13. package/apps/lib/components/ChartBlockTool.ts +17 -52
  14. package/apps/lib/components/Checkbox.tsx +9 -16
  15. package/apps/lib/components/ContextMenu.tsx +97 -96
  16. package/apps/lib/components/CountBadge.tsx +4 -6
  17. package/apps/lib/components/DataTable.tsx +196 -216
  18. package/apps/lib/components/DataViews/DataViewRadio.tsx +1 -6
  19. package/apps/lib/components/DataViews/DataViewsConfigPanel.tsx +13 -47
  20. package/apps/lib/components/DataViews/DataViewsHeader.tsx +1 -3
  21. package/apps/lib/components/DataViews/DataViewsLayout.tsx +5 -12
  22. package/apps/lib/components/DataViews/FilterPanel.tsx +155 -149
  23. package/apps/lib/components/DataViews/HeaderSearch.tsx +1 -5
  24. package/apps/lib/components/DataViews/InboxView.tsx +22 -68
  25. package/apps/lib/components/DataViews/InboxViewCard.tsx +68 -77
  26. package/apps/lib/components/DataViews/KanbanView.tsx +8 -25
  27. package/apps/lib/components/DataViews/PanelControls.tsx +3 -13
  28. package/apps/lib/components/DataViews/SettingsPanel.tsx +83 -89
  29. package/apps/lib/components/DataViews/TableView.tsx +8 -28
  30. package/apps/lib/components/DataViews/TreeView.tsx +12 -40
  31. package/apps/lib/components/DataViews/badgeAdapter.ts +32 -28
  32. package/apps/lib/components/DataViews/fieldRenderers.tsx +106 -141
  33. package/apps/lib/components/DataViews/filters/DatePickerRangeFilter.tsx +30 -23
  34. package/apps/lib/components/DataViews/filters/DateRangePopover.tsx +39 -32
  35. package/apps/lib/components/DataViews/filters/PresetChips.tsx +15 -15
  36. package/apps/lib/components/DataViews/filters/RangeSliderWithInputs.tsx +69 -58
  37. package/apps/lib/components/DataViews/index.ts +26 -26
  38. package/apps/lib/components/DataViews/tree/TreeDrawer.tsx +12 -16
  39. package/apps/lib/components/DataViews/tree/TreeSidebar.tsx +28 -31
  40. package/apps/lib/components/DataViews/types.ts +104 -115
  41. package/apps/lib/components/DatePicker.tsx +198 -196
  42. package/apps/lib/components/Dialog.tsx +92 -105
  43. package/apps/lib/components/Divider.tsx +21 -24
  44. package/apps/lib/components/Drawer.tsx +79 -139
  45. package/apps/lib/components/DropdownMenu.tsx +131 -171
  46. package/apps/lib/components/FieldHint.tsx +4 -11
  47. package/apps/lib/components/Form.tsx +146 -155
  48. package/apps/lib/components/FormStepper.tsx +9 -39
  49. package/apps/lib/components/HeaderBar.tsx +1 -9
  50. package/apps/lib/components/ImageAttachment.tsx +111 -73
  51. package/apps/lib/components/InnerLabelField.tsx +20 -16
  52. package/apps/lib/components/Input.tsx +171 -172
  53. package/apps/lib/components/InputField.tsx +44 -45
  54. package/apps/lib/components/InputOTP.tsx +68 -69
  55. package/apps/lib/components/Label.tsx +31 -35
  56. package/apps/lib/components/LabelField.tsx +4 -5
  57. package/apps/lib/components/LabeledCheckBox.tsx +8 -12
  58. package/apps/lib/components/LabeledRadio.tsx +7 -5
  59. package/apps/lib/components/LinkButton.tsx +2 -9
  60. package/apps/lib/components/LoginButton.tsx +4 -9
  61. package/apps/lib/components/PasswordLevel.tsx +5 -5
  62. package/apps/lib/components/Popover.tsx +15 -33
  63. package/apps/lib/components/ProfileMenu.tsx +67 -72
  64. package/apps/lib/components/Radio.tsx +1 -5
  65. package/apps/lib/components/RadioCard.tsx +9 -28
  66. package/apps/lib/components/ScrollArea.tsx +45 -43
  67. package/apps/lib/components/SearchField.tsx +49 -39
  68. package/apps/lib/components/SearchableSelect.tsx +8 -14
  69. package/apps/lib/components/SearchableTable.tsx +108 -118
  70. package/apps/lib/components/SearchableTree.tsx +469 -0
  71. package/apps/lib/components/SearchableTreeDialog.tsx +493 -0
  72. package/apps/lib/components/SectionBlock.tsx +4 -16
  73. package/apps/lib/components/Select.tsx +53 -80
  74. package/apps/lib/components/SimpleSelect.tsx +196 -187
  75. package/apps/lib/components/Skeleton.tsx +9 -12
  76. package/apps/lib/components/SlideDatePicker.tsx +215 -166
  77. package/apps/lib/components/SpinLoading.tsx +33 -49
  78. package/apps/lib/components/Stepper.tsx +13 -56
  79. package/apps/lib/components/Switch.tsx +8 -10
  80. package/apps/lib/components/TabFormItem.tsx +3 -12
  81. package/apps/lib/components/TabSwitch.tsx +7 -34
  82. package/apps/lib/components/Table.tsx +60 -75
  83. package/apps/lib/components/TableDnDWrapper.ts +15 -48
  84. package/apps/lib/components/TextEditor.tsx +93 -104
  85. package/apps/lib/components/Textarea.tsx +8 -12
  86. package/apps/lib/components/Timeline.tsx +21 -41
  87. package/apps/lib/components/Toast.tsx +83 -83
  88. package/apps/lib/components/Toggle.tsx +112 -114
  89. package/apps/lib/components/ToggleButton.tsx +1 -1
  90. package/apps/lib/components/Tooltip.tsx +24 -19
  91. package/apps/lib/components/TransparentLabel.tsx +61 -62
  92. package/apps/lib/components/TreeDropDown.tsx +86 -52
  93. package/apps/lib/components/TreeFolder/TreeFolder.tsx +15 -48
  94. package/apps/lib/components/TreeFolder/TreeFolderBreadcrumb.tsx +16 -21
  95. package/apps/lib/components/TreeFolder/TreeFolderRow.tsx +9 -20
  96. package/apps/lib/components/TreeFolder/TreeFolderStyles.tsx +3 -3
  97. package/apps/lib/components/TreeFolder/icons.tsx +14 -17
  98. package/apps/lib/components/TreeFolder/index.ts +15 -8
  99. package/apps/lib/components/TreeFolder/treeFolderUtils.ts +47 -52
  100. package/apps/lib/components/TreeFolder/types.ts +32 -32
  101. package/apps/lib/components/TreeFolder/useTreeFolderDnD.ts +117 -123
  102. package/apps/lib/hooks/useActiveTreeItem.ts +52 -55
  103. package/apps/lib/hooks/useClickOutside.ts +21 -20
  104. package/apps/lib/hooks/useDataViewsState.ts +86 -80
  105. package/apps/lib/hooks/useIsMobile.ts +12 -12
  106. package/apps/lib/hooks/useResize.ts +54 -65
  107. package/apps/lib/hooks/useTagSelection.ts +201 -201
  108. package/apps/lib/layouts/CNLayout.tsx +181 -140
  109. package/apps/lib/layouts/DataViewCard.tsx +4 -18
  110. package/apps/lib/layouts/FieldSection.tsx +2 -6
  111. package/apps/lib/layouts/TreeSubLayout.tsx +24 -38
  112. package/apps/lib/providers/ThemeProvider.tsx +8 -23
  113. package/apps/lib/registry.json +1004 -0
  114. package/apps/lib/tsconfig.json +9 -0
  115. package/apps/lib/utils/cn.ts +1 -1
  116. package/apps/lib/utils/dataViews/columnUtils.ts +46 -44
  117. package/apps/lib/utils/dataViews/fieldUtils.ts +70 -71
  118. package/apps/lib/utils/dataViews/nestedDataUtils.tsx +129 -122
  119. package/apps/lib/utils/dataViews/pathUtils.ts +74 -67
  120. package/apps/lib/utils/dataViews/rangeUtils.ts +121 -112
  121. package/apps/lib/utils/dataViews/treeUtils.ts +204 -211
  122. package/apps/lib/utils/dateFormat.ts +64 -54
  123. package/apps/lib/utils/markdownParser.ts +2 -7
  124. package/apps/lib/utils/resize.ts +21 -25
  125. package/apps/lib/utils/types.ts +13 -13
  126. package/dist/bin/index.js +8 -2
  127. package/dist/bin/index.js.map +1 -1
  128. package/dist/src/shared/getAvailableFiles.d.ts.map +1 -1
  129. package/dist/src/shared/getAvailableFiles.js +6 -1
  130. package/dist/src/shared/getAvailableFiles.js.map +1 -1
  131. package/dist/src/shared/loadRegistry.d.ts +7 -0
  132. package/dist/src/shared/loadRegistry.d.ts.map +1 -0
  133. package/dist/src/shared/loadRegistry.js +31 -0
  134. package/dist/src/shared/loadRegistry.js.map +1 -0
  135. package/dist/src/shared/resolveInstallPlan.d.ts +12 -0
  136. package/dist/src/shared/resolveInstallPlan.d.ts.map +1 -0
  137. package/dist/src/shared/resolveInstallPlan.js +39 -0
  138. package/dist/src/shared/resolveInstallPlan.js.map +1 -0
  139. package/dist/src/types/main.d.ts +24 -0
  140. package/dist/src/types/main.d.ts.map +1 -1
  141. package/docs/README.md +10 -2
  142. package/docs/components/action-button.md +30 -24
  143. package/docs/components/actions-group.md +26 -20
  144. package/docs/components/alert-dialog.md +45 -45
  145. package/docs/components/avatar.md +6 -2
  146. package/docs/components/badge-field.md +6 -2
  147. package/docs/components/badge.md +7 -1
  148. package/docs/components/breadcrumb.md +15 -40
  149. package/docs/components/button-group.md +13 -10
  150. package/docs/components/button.md +58 -33
  151. package/docs/components/calendar.md +26 -19
  152. package/docs/components/card.md +19 -16
  153. package/docs/components/chart-block-tool.md +128 -0
  154. package/docs/components/checkbox.md +16 -8
  155. package/docs/components/cn-layout.md +7 -1
  156. package/docs/components/context-menu.md +18 -25
  157. package/docs/components/count-badge.md +7 -1
  158. package/docs/components/data-table.md +45 -33
  159. package/docs/components/data-views-config-panel.md +15 -11
  160. package/docs/components/data-views-layout.md +13 -16
  161. package/docs/components/date-picker.md +30 -23
  162. package/docs/components/dialog.md +43 -42
  163. package/docs/components/divider.md +10 -4
  164. package/docs/components/drawer.md +8 -33
  165. package/docs/components/dropdown-menu.md +25 -34
  166. package/docs/components/field-hint.md +37 -25
  167. package/docs/components/field-section.md +9 -3
  168. package/docs/components/form-stepper.md +6 -0
  169. package/docs/components/form.md +17 -20
  170. package/docs/components/header-bar.md +6 -0
  171. package/docs/components/image-attachment.md +33 -41
  172. package/docs/components/inbox-view.md +16 -5
  173. package/docs/components/inner-label-field.md +34 -24
  174. package/docs/components/input-field.md +18 -10
  175. package/docs/components/input-otp.md +14 -11
  176. package/docs/components/input.md +22 -16
  177. package/docs/components/kanban-view.md +15 -5
  178. package/docs/components/label-field.md +32 -22
  179. package/docs/components/label.md +43 -32
  180. package/docs/components/labeled-check-box.md +16 -8
  181. package/docs/components/labeled-radio.md +18 -11
  182. package/docs/components/link-button.md +7 -1
  183. package/docs/components/login-button.md +8 -2
  184. package/docs/components/password-level.md +37 -24
  185. package/docs/components/popover.md +26 -23
  186. package/docs/components/profile-menu.md +38 -27
  187. package/docs/components/radio-card.md +16 -9
  188. package/docs/components/radio.md +16 -8
  189. package/docs/components/scroll-area.md +6 -2
  190. package/docs/components/search-field.md +14 -6
  191. package/docs/components/searchable-select.md +19 -14
  192. package/docs/components/searchable-table.md +18 -13
  193. package/docs/components/searchable-tree-dialog.md +190 -0
  194. package/docs/components/searchable-tree.md +200 -0
  195. package/docs/components/section-block.md +12 -4
  196. package/docs/components/select.md +23 -18
  197. package/docs/components/simple-select.md +14 -10
  198. package/docs/components/skeleton.md +43 -33
  199. package/docs/components/slide-date-picker.md +37 -29
  200. package/docs/components/spin-loading.md +32 -23
  201. package/docs/components/stepper.md +6 -0
  202. package/docs/components/switch.md +14 -6
  203. package/docs/components/tab-form-item.md +7 -1
  204. package/docs/components/tab-switch.md +13 -6
  205. package/docs/components/table-dnd-wrapper.md +105 -0
  206. package/docs/components/table-view.md +15 -5
  207. package/docs/components/table.md +28 -28
  208. package/docs/components/text-editor.md +19 -13
  209. package/docs/components/textarea.md +15 -7
  210. package/docs/components/timeline.md +6 -0
  211. package/docs/components/toast.md +35 -26
  212. package/docs/components/toggle-button.md +24 -21
  213. package/docs/components/toggle.md +23 -15
  214. package/docs/components/tooltip.md +42 -30
  215. package/docs/components/transparent-label.md +29 -20
  216. package/docs/components/tree-drop-down.md +31 -23
  217. package/docs/components/tree-sub-layout.md +6 -2
  218. package/docs/components/tree-view.md +16 -5
  219. package/docs/explanation/architecture.md +54 -0
  220. package/docs/explanation/design-system.md +52 -0
  221. package/docs/how-to/data-views-from-backend-response.md +6 -4
  222. package/docs/how-to/guides.md +24 -18
  223. package/docs/migration/changelog.md +38 -0
  224. package/docs/reference/cli.md +87 -0
  225. package/docs/reference/components.md +11 -12
  226. package/docs/reference/hooks.md +8 -8
  227. package/docs/reference/providers.md +22 -22
  228. package/docs/reference/tailwind-plugins.md +2 -2
  229. package/docs/reference/theme.md +85 -0
  230. package/docs/reference/types.md +4 -4
  231. package/docs/reference/utilities.md +19 -26
  232. package/docs/tutorials/building-first-form.md +20 -13
  233. package/docs/tutorials/component-composition.md +34 -50
  234. package/docs/tutorials/getting-started.md +2 -2
  235. package/docs/tutorials/theming-basics.md +13 -10
  236. package/package.json +31 -3
  237. package/dist/src/commands/block.d.ts +0 -5
  238. package/dist/src/commands/block.d.ts.map +0 -1
  239. package/dist/src/commands/block.js +0 -255
  240. package/dist/src/commands/block.js.map +0 -1
  241. package/dist/src/shared/configureFonts.d.ts +0 -6
  242. package/dist/src/shared/configureFonts.d.ts.map +0 -1
  243. package/dist/src/shared/configureFonts.js +0 -106
  244. package/dist/src/shared/configureFonts.js.map +0 -1
  245. package/dist/src/shared/configureGlobalCss.d.ts +0 -6
  246. package/dist/src/shared/configureGlobalCss.d.ts.map +0 -1
  247. package/dist/src/shared/configureGlobalCss.js +0 -154
  248. package/dist/src/shared/configureGlobalCss.js.map +0 -1
  249. package/dist/src/shared/configureTailwind.d.ts +0 -7
  250. package/dist/src/shared/configureTailwind.d.ts.map +0 -1
  251. package/dist/src/shared/configureTailwind.js +0 -163
  252. package/dist/src/shared/configureTailwind.js.map +0 -1
  253. package/dist/src/shared/detectFramework.d.ts +0 -23
  254. package/dist/src/shared/detectFramework.d.ts.map +0 -1
  255. package/dist/src/shared/detectFramework.js +0 -119
  256. package/dist/src/shared/detectFramework.js.map +0 -1
  257. package/dist/src/shared/installBaseUtils.d.ts +0 -5
  258. package/dist/src/shared/installBaseUtils.d.ts.map +0 -1
  259. package/dist/src/shared/installBaseUtils.js +0 -79
  260. package/dist/src/shared/installBaseUtils.js.map +0 -1
  261. package/dist/src/shared/resolveAliases.d.ts +0 -24
  262. package/dist/src/shared/resolveAliases.d.ts.map +0 -1
  263. package/dist/src/shared/resolveAliases.js +0 -98
  264. package/dist/src/shared/resolveAliases.js.map +0 -1
@@ -11,14 +11,22 @@ keywords: [toast, notification, message, alert, feedback, react-hot-toast]
11
11
 
12
12
  ## Installation
13
13
 
14
+ TORCH Glare is a copy-in library: the CLI copies this component's source into your project
15
+ (you do **not** install it from the npm package). Run `init` once, then `add`:
16
+
14
17
  ```bash
15
- npm install react-hot-toast
18
+ npx torch-glare@latest init
19
+ npx torch-glare@latest add Toast
16
20
  ```
17
21
 
22
+ `add` also copies any components, hooks, and utilities that `Toast` depends on.
23
+
18
24
  ## Import
19
25
 
20
- ```typescript
21
- import { Toaster, toast } from '@torch-ui/components'
26
+ Import from your project's local path — the alias configured in `glare.json` (e.g. `@/*`):
27
+
28
+ ```tsx
29
+ import { Toast } from "@/components/Toast";
22
30
  ```
23
31
 
24
32
  ## Quick Examples
@@ -26,8 +34,8 @@ import { Toaster, toast } from '@torch-ui/components'
26
34
  ### Basic Setup
27
35
 
28
36
  ```typescript
29
- import { Toaster, toast } from '@torch-ui/components'
30
- import { Button } from '@torch-ui/components'
37
+ import { Toaster, toast } from "@/components/Toast";
38
+ import { Button } from "@/components/Button";
31
39
 
32
40
  function App() {
33
41
  return (
@@ -44,8 +52,8 @@ function App() {
44
52
  ### Success Toast
45
53
 
46
54
  ```typescript
47
- import { toast } from '@torch-ui/components'
48
- import { Button } from '@torch-ui/components'
55
+ import { toast } from "@/components/Toast";
56
+ import { Button } from "@/components/Button";
49
57
 
50
58
  function SuccessExample() {
51
59
  const handleSuccess = () => {
@@ -63,8 +71,8 @@ function SuccessExample() {
63
71
  ### Error Toast
64
72
 
65
73
  ```typescript
66
- import { toast } from '@torch-ui/components'
67
- import { Button } from '@torch-ui/components'
74
+ import { toast } from "@/components/Toast";
75
+ import { Button } from "@/components/Button";
68
76
 
69
77
  function ErrorExample() {
70
78
  const handleError = () => {
@@ -82,8 +90,8 @@ function ErrorExample() {
82
90
  ### Loading Toast
83
91
 
84
92
  ```typescript
85
- import { toast } from '@torch-ui/components'
86
- import { Button } from '@torch-ui/components'
93
+ import { toast } from "@/components/Toast";
94
+ import { Button } from "@/components/Button";
87
95
 
88
96
  function LoadingExample() {
89
97
  const handleAsync = async () => {
@@ -108,7 +116,7 @@ function LoadingExample() {
108
116
  ### Promise Toast
109
117
 
110
118
  ```typescript
111
- import { toast } from '@torch-ui/components'
119
+ import { toast } from "@/components/Toast";
112
120
 
113
121
  function PromiseExample() {
114
122
  const saveData = async () => {
@@ -132,7 +140,7 @@ function PromiseExample() {
132
140
  ### Custom Duration
133
141
 
134
142
  ```typescript
135
- import { toast } from '@torch-ui/components'
143
+ import { toast } from "@/components/Toast";
136
144
 
137
145
  function CustomDuration() {
138
146
  return (
@@ -156,7 +164,7 @@ function CustomDuration() {
156
164
  ### Custom Position
157
165
 
158
166
  ```typescript
159
- import { Toaster, toast } from '@torch-ui/components'
167
+ import { Toaster, toast } from "@/components/Toast";
160
168
 
161
169
  function PositionExample() {
162
170
  return (
@@ -179,8 +187,8 @@ function PositionExample() {
179
187
  ### Dismissible Toast
180
188
 
181
189
  ```typescript
182
- import { toast } from '@torch-ui/components'
183
- import { Button } from '@torch-ui/components'
190
+ import { toast } from "@/components/Toast";
191
+ import { Button } from "@/components/Button";
184
192
 
185
193
  function DismissibleExample() {
186
194
  const showDismissible = () => {
@@ -209,7 +217,7 @@ function DismissibleExample() {
209
217
  ### Custom Styling
210
218
 
211
219
  ```typescript
212
- import { toast } from '@torch-ui/components'
220
+ import { toast } from "@/components/Toast";
213
221
 
214
222
  function CustomStyleExample() {
215
223
  const showCustom = () => {
@@ -238,7 +246,7 @@ function CustomStyleExample() {
238
246
  ### With Icon
239
247
 
240
248
  ```typescript
241
- import { toast } from '@torch-ui/components'
249
+ import { toast } from "@/components/Toast";
242
250
 
243
251
  function IconExample() {
244
252
  return (
@@ -263,8 +271,9 @@ function IconExample() {
263
271
  ### Form Validation
264
272
 
265
273
  ```typescript
266
- import { toast } from '@torch-ui/components'
267
- import { InputField, Button } from '@torch-ui/components'
274
+ import { toast } from "@/components/Toast";
275
+ import { Button } from "@/components/Button";
276
+ import { InputField } from "@/components/InputField";
268
277
  import { useState } from 'react'
269
278
 
270
279
  function FormValidation() {
@@ -404,7 +413,7 @@ const dismissToast = (id: string): void => {
404
413
  ### API Error Handling
405
414
 
406
415
  ```typescript
407
- import { toast } from '@torch-ui/components'
416
+ import { toast } from "@/components/Toast";
408
417
 
409
418
  async function fetchData() {
410
419
  try {
@@ -435,7 +444,7 @@ async function fetchData() {
435
444
  ### Multi-Step Process
436
445
 
437
446
  ```typescript
438
- import { toast } from '@torch-ui/components'
447
+ import { toast } from "@/components/Toast";
439
448
 
440
449
  async function multiStepProcess() {
441
450
  const toastId = toast.loading('Step 1: Validating data...')
@@ -458,8 +467,8 @@ async function multiStepProcess() {
458
467
  ### Undo Action
459
468
 
460
469
  ```typescript
461
- import { toast } from '@torch-ui/components'
462
- import { Button } from '@torch-ui/components'
470
+ import { toast } from "@/components/Toast";
471
+ import { Button } from "@/components/Button";
463
472
 
464
473
  function UndoExample() {
465
474
  const handleDelete = (item: Item) => {
@@ -496,7 +505,7 @@ function UndoExample() {
496
505
  ### Rate Limited Actions
497
506
 
498
507
  ```typescript
499
- import { toast } from '@torch-ui/components'
508
+ import { toast } from "@/components/Toast";
500
509
 
501
510
  let lastToastTime = 0
502
511
  const TOAST_COOLDOWN = 2000 // 2 seconds
@@ -528,7 +537,7 @@ function SpamProtectedButton() {
528
537
 
529
538
  ```typescript
530
539
  import { render, screen, waitFor } from '@testing-library/react'
531
- import { Toaster, toast } from '@torch-ui/components'
540
+ import { Toaster, toast } from "@/components/Toast";
532
541
  import userEvent from '@testing-library/user-event'
533
542
 
534
543
  describe('Toast', () => {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ToggleButton
3
- version: 1.1.15
3
+ version: 2.4.0
4
4
  status: stable
5
5
  category: components/buttons
6
6
  tags: [toggle, button, pressed, radix-ui, accessible, variants]
@@ -17,19 +17,22 @@ dependencies:
17
17
 
18
18
  ## Installation
19
19
 
20
+ TORCH Glare is a copy-in library: the CLI copies this component's source into your project
21
+ (you do **not** install it from the npm package). Run `init` once, then `add`:
22
+
20
23
  ```bash
21
- npm install torch-glare
24
+ npx torch-glare@latest init
25
+ npx torch-glare@latest add ToggleButton
22
26
  ```
23
27
 
28
+ `add` also copies any components, hooks, and utilities that `ToggleButton` depends on.
29
+
24
30
  ## Import
25
31
 
26
- ```typescript
27
- import { ToggleButton } from 'torch-glare/lib/components/ToggleButton'
28
- // or
29
- import { ToggleButton } from 'torch-glare/lib/components'
32
+ Import from your project's local path — the alias configured in `glare.json` (e.g. `@/*`):
30
33
 
31
- // Also available via ButtonGroup re-export
32
- import { ToggleButton } from 'torch-glare/lib/components/ButtonGroup'
34
+ ```tsx
35
+ import { ToggleButton } from "@/components/ToggleButton";
33
36
  ```
34
37
 
35
38
  ## Quick Examples
@@ -37,7 +40,7 @@ import { ToggleButton } from 'torch-glare/lib/components/ButtonGroup'
37
40
  ### Basic Usage
38
41
 
39
42
  ```typescript
40
- import { ToggleButton } from 'torch-glare/lib/components/ToggleButton'
43
+ import { ToggleButton } from "@/components/ButtonGroup";
41
44
 
42
45
  function Example() {
43
46
  const [pressed, setPressed] = useState(false)
@@ -57,7 +60,7 @@ function Example() {
57
60
 
58
61
  ```typescript
59
62
  <ToggleButton variant="PrimeStyle">Prime</ToggleButton>
60
- <ToggleButton variant="BlueSecStyle">Blue Secondary</ToggleButton>
63
+ <ToggleButton variant="BluSecStyle">Blue Secondary</ToggleButton>
61
64
  <ToggleButton variant="BorderStyle">Border</ToggleButton>
62
65
  <ToggleButton variant="PrimeContStyle">Prime Container</ToggleButton>
63
66
  <ToggleButton variant="SystemStyle">System</ToggleButton>
@@ -110,7 +113,7 @@ function BookmarkButton() {
110
113
 
111
114
  return (
112
115
  <ToggleButton
113
- variant={bookmarked ? 'BlueSecStyle' : 'BorderStyle'}
116
+ variant={bookmarked ? 'BluSecStyle' : 'BorderStyle'}
114
117
  pressed={bookmarked}
115
118
  onPressedChange={setBookmarked}
116
119
  buttonType="icon"
@@ -145,7 +148,7 @@ function BookmarkButton() {
145
148
  Dark Theme
146
149
  </ToggleButton>
147
150
 
148
- <ToggleButton theme="light" variant="BlueSecStyle">
151
+ <ToggleButton theme="light" variant="BluSecStyle">
149
152
  Light Theme
150
153
  </ToggleButton>
151
154
  ```
@@ -172,7 +175,7 @@ function BookmarkButton() {
172
175
  | Variant | Background | Active State | Description |
173
176
  |---------|-----------|-------------|-------------|
174
177
  | `PrimeStyle` | Secondary | Hover highlight | Default primary toggle style |
175
- | `BlueSecStyle` | Secondary | Information blue | Blue secondary accent |
178
+ | `BluSecStyle` | Secondary | Information blue | Blue secondary accent |
176
179
  | `BorderStyle` | Border-style bg | Hover highlight | Bordered toggle style |
177
180
  | `PrimeContStyle` | Transparent | Container hover | Minimal container style |
178
181
  | `SystemStyle` | Black alpha 20 | White alpha 20 | Dark/system UI style |
@@ -229,7 +232,7 @@ function FavoriteButton({ itemId }: { itemId: string }) {
229
232
 
230
233
  return (
231
234
  <ToggleButton
232
- variant={isFavorite ? 'BlueSecStyle' : 'BorderStyle'}
235
+ variant={isFavorite ? 'BluSecStyle' : 'BorderStyle'}
233
236
  buttonType="icon"
234
237
  size="M"
235
238
  pressed={isFavorite}
@@ -368,7 +371,7 @@ function ThemeSwitcher() {
368
371
 
369
372
  ```typescript
370
373
  import { render, screen, fireEvent } from '@testing-library/react'
371
- import { ToggleButton } from 'torch-glare/lib/components/ToggleButton'
374
+ import { ToggleButton } from "@/components/ButtonGroup";
372
375
 
373
376
  describe('ToggleButton', () => {
374
377
  it('toggles pressed state on click', () => {
@@ -403,7 +406,7 @@ describe('ToggleButton', () => {
403
406
 
404
407
  it('applies variant styles', () => {
405
408
  const { container } = render(
406
- <ToggleButton variant="BlueSecStyle">Blue</ToggleButton>
409
+ <ToggleButton variant="BluSecStyle">Blue</ToggleButton>
407
410
  )
408
411
 
409
412
  const button = container.querySelector('button')
@@ -507,7 +510,7 @@ Radix UI Toggle automatically provides:
507
510
  ### Variant Details
508
511
 
509
512
  - **PrimeStyle**: `bg-background-presentation-action-secondary` with hover/active highlight
510
- - **BlueSecStyle**: Same base as PrimeStyle but active state uses information blue (`bg-background-presentation-state-information-primary`)
513
+ - **BluSecStyle**: Same base as PrimeStyle but active state uses information blue (`bg-background-presentation-state-information-primary`)
511
514
  - **BorderStyle**: `bg-background-presentation-action-borderstyle` with visible border (`border-border-presentation-action-disabled`)
512
515
  - **PrimeContStyle**: Transparent background, minimal with container-style hover
513
516
  - **SystemStyle**: `bg-black-alpha-20` with white text and `border-[#2C2D2E]`, white alpha hover/active
@@ -521,7 +524,7 @@ All variants use `data-[state=on]` for the active/pressed visual:
521
524
  data-[state=on]:bg-background-presentation-action-hover
522
525
  data-[state=on]:text-content-presentation-action-hover
523
526
 
524
- /* BlueSecStyle active */
527
+ /* BluSecStyle active */
525
528
  data-[state=on]:bg-background-presentation-state-information-primary
526
529
  data-[state=on]:text-content-presentation-action-hover
527
530
 
@@ -580,8 +583,8 @@ focus-visible:ring-2 focus-visible:ring-white/50
580
583
  ```diff
581
584
  // Toggle and ToggleButton share a similar API
582
585
  // ToggleButton adds buttonType="icon" mode and slightly different variants
583
- - import { Toggle } from 'torch-glare/lib/components/Toggle'
584
- + import { ToggleButton } from 'torch-glare/lib/components/ToggleButton'
586
+ - import { Toggle } from "@/components/Toggle";
587
+ + import { ToggleButton } from "@/components/ButtonGroup";
585
588
 
586
589
  - <Toggle pressed={value} onPressedChange={setValue}>
587
590
  + <ToggleButton pressed={value} onPressedChange={setValue}>
@@ -634,7 +637,7 @@ focus-visible:ring-2 focus-visible:ring-white/50
634
637
 
635
638
  ### v1.1.15
636
639
  - Initial stable release
637
- - 5 visual variants (PrimeStyle, BlueSecStyle, BorderStyle, PrimeContStyle, SystemStyle)
640
+ - 5 visual variants (PrimeStyle, BluSecStyle, BorderStyle, PrimeContStyle, SystemStyle)
638
641
  - 4 size variants (S, M, L, XL)
639
642
  - Icon-only mode via buttonType="icon" with compound variants
640
643
  - Re-exported from ButtonGroup module
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: Toggle
3
- version: 1.1.15
3
+ version: 2.4.0
4
4
  status: stable
5
5
  category: components/forms
6
6
  tags: [form, toggle, button, radix-ui, accessible, variants]
@@ -17,14 +17,22 @@ dependencies:
17
17
 
18
18
  ## Installation
19
19
 
20
+ TORCH Glare is a copy-in library: the CLI copies this component's source into your project
21
+ (you do **not** install it from the npm package). Run `init` once, then `add`:
22
+
20
23
  ```bash
21
- npm install torch-glare
24
+ npx torch-glare@latest init
25
+ npx torch-glare@latest add Toggle
22
26
  ```
23
27
 
28
+ `add` also copies any components, hooks, and utilities that `Toggle` depends on.
29
+
24
30
  ## Import
25
31
 
26
- ```typescript
27
- import { Toggle } from 'torch-glare/lib/components/Toggle'
32
+ Import from your project's local path — the alias configured in `glare.json` (e.g. `@/*`):
33
+
34
+ ```tsx
35
+ import { Toggle } from "@/components/Toggle";
28
36
  ```
29
37
 
30
38
  ## Quick Examples
@@ -32,7 +40,7 @@ import { Toggle } from 'torch-glare/lib/components/Toggle'
32
40
  ### Basic Usage
33
41
 
34
42
  ```typescript
35
- import { Toggle } from 'torch-glare/lib/components/Toggle'
43
+ import { Toggle } from '@/components/Toggle'
36
44
 
37
45
  function Example() {
38
46
  const [pressed, setPressed] = useState(false)
@@ -139,7 +147,7 @@ function VariantExamples() {
139
147
  <div className="space-y-4">
140
148
  <div className="flex gap-2">
141
149
  <Toggle variant="PrimeStyle">Prime</Toggle>
142
- <Toggle variant="BlueSecStyle">Blue</Toggle>
150
+ <Toggle variant="BluSecStyle">Blue</Toggle>
143
151
  <Toggle variant="YelSecStyle">Yellow</Toggle>
144
152
  <Toggle variant="RedSecStyle">Red</Toggle>
145
153
  </div>
@@ -147,7 +155,7 @@ function VariantExamples() {
147
155
  <div className="flex gap-2">
148
156
  <Toggle variant="BorderStyle">Border</Toggle>
149
157
  <Toggle variant="PrimeContStyle">Prime Cont</Toggle>
150
- <Toggle variant="BlueContStyle">Blue Cont</Toggle>
158
+ <Toggle variant="BluContStyle">Blue Cont</Toggle>
151
159
  <Toggle variant="RedContStyle">Red Cont</Toggle>
152
160
  </div>
153
161
  </div>
@@ -275,7 +283,7 @@ function FilterToggles() {
275
283
  <h4 className="font-semibold">Filters</h4>
276
284
  <div className="flex flex-wrap gap-2">
277
285
  <Toggle
278
- variant="BlueSecStyle"
286
+ variant="BluSecStyle"
279
287
  pressed={filters.inStock}
280
288
  onPressedChange={() => toggleFilter('inStock')}
281
289
  >
@@ -350,12 +358,12 @@ function DisabledToggles() {
350
358
  ```typescript
351
359
  type VariantType =
352
360
  | 'PrimeStyle'
353
- | 'BlueSecStyle'
361
+ | 'BluSecStyle'
354
362
  | 'YelSecStyle'
355
363
  | 'RedSecStyle'
356
364
  | 'BorderStyle'
357
365
  | 'PrimeContStyle'
358
- | 'BlueContStyle'
366
+ | 'BluContStyle'
359
367
  | 'RedContStyle'
360
368
  ```
361
369
 
@@ -582,7 +590,7 @@ function SettingsToggles() {
582
590
  <label className="text-sm capitalize">{key.replace(/([A-Z])/g, ' $1')}</label>
583
591
  <Toggle
584
592
  size="S"
585
- variant="BlueSecStyle"
593
+ variant="BluSecStyle"
586
594
  pressed={value}
587
595
  onPressedChange={(pressed) =>
588
596
  setSettings(prev => ({ ...prev, [key]: pressed }))
@@ -603,7 +611,7 @@ function SettingsToggles() {
603
611
 
604
612
  ```typescript
605
613
  import { render, screen, fireEvent } from '@testing-library/react'
606
- import { Toggle } from 'torch-glare/lib/components/Toggle'
614
+ import { Toggle } from '@/components/Toggle'
607
615
 
608
616
  describe('Toggle', () => {
609
617
  it('toggles pressed state on click', () => {
@@ -622,7 +630,7 @@ describe('Toggle', () => {
622
630
 
623
631
  it('applies variant styles', () => {
624
632
  const { container } = render(
625
- <Toggle variant="BlueSecStyle">Blue</Toggle>
633
+ <Toggle variant="BluSecStyle">Blue</Toggle>
626
634
  )
627
635
 
628
636
  const toggle = container.querySelector('button')
@@ -736,12 +744,12 @@ Radix UI automatically provides:
736
744
  Each variant provides different visual styles:
737
745
 
738
746
  - **PrimeStyle**: Default primary style
739
- - **BlueSecStyle**: Blue secondary style
747
+ - **BluSecStyle**: Blue secondary style
740
748
  - **YelSecStyle**: Yellow secondary style
741
749
  - **RedSecStyle**: Red secondary style
742
750
  - **BorderStyle**: Border-focused style
743
751
  - **PrimeContStyle**: Primary container style
744
- - **BlueContStyle**: Blue container style
752
+ - **BluContStyle**: Blue container style
745
753
  - **RedContStyle**: Red container style
746
754
 
747
755
  ### Size Classes
@@ -11,16 +11,22 @@ keywords: [tooltip, hint, popover, radix-ui, hover, help]
11
11
 
12
12
  ## Installation
13
13
 
14
+ TORCH Glare is a copy-in library: the CLI copies this component's source into your project
15
+ (you do **not** install it from the npm package). Run `init` once, then `add`:
16
+
14
17
  ```bash
15
- npm install @radix-ui/react-tooltip
18
+ npx torch-glare@latest init
19
+ npx torch-glare@latest add Tooltip
16
20
  ```
17
21
 
22
+ `add` also copies any components, hooks, and utilities that `Tooltip` depends on.
23
+
18
24
  ## Import
19
25
 
20
- ```typescript
21
- import { Tooltip } from '@torch-ui/components'
22
- // Or for advanced usage:
23
- import { TooltipProvider, ToolTipRoot, TooltipTrigger, TooltipContent, TooltipArrow } from '@torch-ui/components'
26
+ Import from your project's local path — the alias configured in `glare.json` (e.g. `@/*`):
27
+
28
+ ```tsx
29
+ import { Tooltip } from "@/components/Tooltip";
24
30
  ```
25
31
 
26
32
  ## Quick Examples
@@ -28,8 +34,8 @@ import { TooltipProvider, ToolTipRoot, TooltipTrigger, TooltipContent, TooltipAr
28
34
  ### Basic Usage
29
35
 
30
36
  ```typescript
31
- import { Tooltip } from '@torch-ui/components'
32
- import { Button } from '@torch-ui/components'
37
+ import { Tooltip } from "@/components/Tooltip";
38
+ import { Button } from "@/components/Button";
33
39
 
34
40
  function Example() {
35
41
  return (
@@ -43,8 +49,8 @@ function Example() {
43
49
  ### Icon with Tooltip
44
50
 
45
51
  ```typescript
46
- import { Tooltip } from '@torch-ui/components'
47
- import { ActionButton } from '@torch-ui/components'
52
+ import { Tooltip } from "@/components/Tooltip";
53
+ import { ActionButton } from "@/components/ActionButton";
48
54
 
49
55
  function IconTooltip() {
50
56
  return (
@@ -60,7 +66,7 @@ function IconTooltip() {
60
66
  ### Different Positions
61
67
 
62
68
  ```typescript
63
- import { Tooltip } from '@torch-ui/components'
69
+ import { Tooltip } from "@/components/Tooltip";
64
70
 
65
71
  function PositionedTooltips() {
66
72
  return (
@@ -88,7 +94,7 @@ function PositionedTooltips() {
88
94
  ### Highlight Variant
89
95
 
90
96
  ```typescript
91
- import { Tooltip } from '@torch-ui/components'
97
+ import { Tooltip } from "@/components/Tooltip";
92
98
 
93
99
  function HighlightTooltip() {
94
100
  return (
@@ -105,7 +111,7 @@ function HighlightTooltip() {
105
111
  ### Without Arrow
106
112
 
107
113
  ```typescript
108
- import { Tooltip } from '@torch-ui/components'
114
+ import { Tooltip } from "@/components/Tooltip";
109
115
 
110
116
  function NoArrowTooltip() {
111
117
  return (
@@ -119,7 +125,7 @@ function NoArrowTooltip() {
119
125
  ### Custom Delay
120
126
 
121
127
  ```typescript
122
- import { Tooltip } from '@torch-ui/components'
128
+ import { Tooltip } from "@/components/Tooltip";
123
129
 
124
130
  function CustomDelayTooltip() {
125
131
  return (
@@ -136,7 +142,7 @@ function CustomDelayTooltip() {
136
142
  ### Rich Content Tooltip
137
143
 
138
144
  ```typescript
139
- import { Tooltip } from '@torch-ui/components'
145
+ import { Tooltip } from "@/components/Tooltip";
140
146
 
141
147
  function RichTooltip() {
142
148
  return (
@@ -157,7 +163,7 @@ function RichTooltip() {
157
163
  ### Controlled Tooltip
158
164
 
159
165
  ```typescript
160
- import { Tooltip } from '@torch-ui/components'
166
+ import { Tooltip } from "@/components/Tooltip";
161
167
  import { useState } from 'react'
162
168
 
163
169
  function ControlledTooltip() {
@@ -178,18 +184,24 @@ function ControlledTooltip() {
178
184
  }
179
185
  ```
180
186
 
181
- ### Disabled Tooltip
187
+ ### Conditionally Suppressing a Tooltip
188
+
189
+ > **Note:** The `disabled` prop is accepted by the type but is **not implemented** — passing
190
+ > `disabled` has no effect and will not hide the tooltip. To conditionally suppress a tooltip,
191
+ > render the wrapped element with or without the `Tooltip` wrapper instead.
182
192
 
183
193
  ```typescript
184
- import { Tooltip } from '@torch-ui/components'
194
+ import { Tooltip } from "@/components/Tooltip";
195
+
196
+ function MaybeTooltip({ disabled }: { disabled: boolean }) {
197
+ const button = <button>Hover me</button>
198
+
199
+ // Render without the Tooltip wrapper when you don't want a tooltip.
200
+ if (disabled) return button
185
201
 
186
- function DisabledTooltip({ disabled }: { disabled: boolean }) {
187
202
  return (
188
- <Tooltip
189
- text="This tooltip is disabled"
190
- disabled={disabled}
191
- >
192
- <button>Hover me</button>
203
+ <Tooltip text="Helpful information">
204
+ {button}
193
205
  </Tooltip>
194
206
  )
195
207
  }
@@ -198,8 +210,8 @@ function DisabledTooltip({ disabled }: { disabled: boolean }) {
198
210
  ### Form Field Tooltip
199
211
 
200
212
  ```typescript
201
- import { Tooltip } from '@torch-ui/components'
202
- import { Input } from '@torch-ui/components'
213
+ import { Tooltip } from "@/components/Tooltip";
214
+ import { Input } from "@/components/Input";
203
215
 
204
216
  function FormTooltip() {
205
217
  return (
@@ -228,7 +240,7 @@ function FormTooltip() {
228
240
  | `tip` | `boolean` | `true` | Show arrow indicator |
229
241
  | `open` | `boolean` | - | Controlled open state |
230
242
  | `onOpenChange` | `(open: boolean) => void` | - | Callback when state changes |
231
- | `disabled` | `boolean` | `false` | Disable tooltip |
243
+ | `disabled` | `boolean` | `false` | **Not supported.** Accepted by the type but has no effect — the current implementation does not disable the tooltip. To conditionally suppress a tooltip, render it conditionally instead. |
232
244
  | `avoidCollisions` | `boolean` | `true` | Adjust position to stay in viewport |
233
245
  | `theme` | `'dark' \| 'light' \| 'default'` | `'dark'` | Theme variant |
234
246
  | `className` | `string` | - | Additional CSS classes |
@@ -259,7 +271,7 @@ interface TooltipProps {
259
271
  tip?: boolean
260
272
  open?: boolean
261
273
  onOpenChange?: (open: boolean) => void
262
- disabled?: boolean
274
+ disabled?: boolean // Accepted but not implemented — has no effect
263
275
  theme?: 'dark' | 'light' | 'default'
264
276
  className?: string
265
277
  }
@@ -332,7 +344,7 @@ function ConditionalTooltip({ showTooltip, children }) {
332
344
  ```typescript
333
345
  import { render, screen, waitFor } from '@testing-library/react'
334
346
  import userEvent from '@testing-library/user-event'
335
- import { Tooltip } from '@torch-ui/components'
347
+ import { Tooltip } from "@/components/Tooltip";
336
348
 
337
349
  describe('Tooltip', () => {
338
350
  it('shows tooltip on hover', async () => {
@@ -432,7 +444,7 @@ describe('Tooltip', () => {
432
444
 
433
445
  ```diff
434
446
  - import { Tooltip } from '@mui/material'
435
- + import { Tooltip } from '@torch-ui/components'
447
+ + import { Tooltip } from "@/components/Tooltip";
436
448
 
437
449
  - <Tooltip title="Help text">
438
450
  + <Tooltip text="Help text">
@@ -445,7 +457,7 @@ describe('Tooltip', () => {
445
457
 
446
458
  ```diff
447
459
  - import * as Tooltip from '@radix-ui/react-tooltip'
448
- + import { Tooltip } from '@torch-ui/components'
460
+ + import { Tooltip } from "@/components/Tooltip";
449
461
 
450
462
  - <Tooltip.Provider>
451
463
  - <Tooltip.Root>