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.
- package/README.md +8 -0
- package/apps/lib/components/ActionButton.tsx +7 -12
- package/apps/lib/components/ActionsGroup.tsx +4 -15
- package/apps/lib/components/AlertDialog.tsx +173 -191
- package/apps/lib/components/Avatar.tsx +13 -16
- package/apps/lib/components/Badge.tsx +1 -3
- package/apps/lib/components/BadgeField.tsx +76 -71
- package/apps/lib/components/Breadcrumb.tsx +49 -85
- package/apps/lib/components/Button.tsx +20 -19
- package/apps/lib/components/ButtonGroup.tsx +31 -41
- package/apps/lib/components/Calendar.tsx +51 -29
- package/apps/lib/components/Card.tsx +2 -13
- package/apps/lib/components/ChartBlockTool.ts +17 -52
- package/apps/lib/components/Checkbox.tsx +9 -16
- package/apps/lib/components/ContextMenu.tsx +97 -96
- package/apps/lib/components/CountBadge.tsx +4 -6
- package/apps/lib/components/DataTable.tsx +196 -216
- package/apps/lib/components/DataViews/DataViewRadio.tsx +1 -6
- package/apps/lib/components/DataViews/DataViewsConfigPanel.tsx +13 -47
- package/apps/lib/components/DataViews/DataViewsHeader.tsx +1 -3
- package/apps/lib/components/DataViews/DataViewsLayout.tsx +5 -12
- package/apps/lib/components/DataViews/FilterPanel.tsx +155 -149
- package/apps/lib/components/DataViews/HeaderSearch.tsx +1 -5
- package/apps/lib/components/DataViews/InboxView.tsx +22 -68
- package/apps/lib/components/DataViews/InboxViewCard.tsx +68 -77
- package/apps/lib/components/DataViews/KanbanView.tsx +8 -25
- package/apps/lib/components/DataViews/PanelControls.tsx +3 -13
- package/apps/lib/components/DataViews/SettingsPanel.tsx +83 -89
- package/apps/lib/components/DataViews/TableView.tsx +8 -28
- package/apps/lib/components/DataViews/TreeView.tsx +12 -40
- package/apps/lib/components/DataViews/badgeAdapter.ts +32 -28
- package/apps/lib/components/DataViews/fieldRenderers.tsx +106 -141
- package/apps/lib/components/DataViews/filters/DatePickerRangeFilter.tsx +30 -23
- package/apps/lib/components/DataViews/filters/DateRangePopover.tsx +39 -32
- package/apps/lib/components/DataViews/filters/PresetChips.tsx +15 -15
- package/apps/lib/components/DataViews/filters/RangeSliderWithInputs.tsx +69 -58
- package/apps/lib/components/DataViews/index.ts +26 -26
- package/apps/lib/components/DataViews/tree/TreeDrawer.tsx +12 -16
- package/apps/lib/components/DataViews/tree/TreeSidebar.tsx +28 -31
- package/apps/lib/components/DataViews/types.ts +104 -115
- package/apps/lib/components/DatePicker.tsx +198 -196
- package/apps/lib/components/Dialog.tsx +92 -105
- package/apps/lib/components/Divider.tsx +21 -24
- package/apps/lib/components/Drawer.tsx +79 -139
- package/apps/lib/components/DropdownMenu.tsx +131 -171
- package/apps/lib/components/FieldHint.tsx +4 -11
- package/apps/lib/components/Form.tsx +146 -155
- package/apps/lib/components/FormStepper.tsx +9 -39
- package/apps/lib/components/HeaderBar.tsx +1 -9
- package/apps/lib/components/ImageAttachment.tsx +111 -73
- package/apps/lib/components/InnerLabelField.tsx +20 -16
- package/apps/lib/components/Input.tsx +171 -172
- package/apps/lib/components/InputField.tsx +44 -45
- package/apps/lib/components/InputOTP.tsx +68 -69
- package/apps/lib/components/Label.tsx +31 -35
- package/apps/lib/components/LabelField.tsx +4 -5
- package/apps/lib/components/LabeledCheckBox.tsx +8 -12
- package/apps/lib/components/LabeledRadio.tsx +7 -5
- package/apps/lib/components/LinkButton.tsx +2 -9
- package/apps/lib/components/LoginButton.tsx +4 -9
- package/apps/lib/components/PasswordLevel.tsx +5 -5
- package/apps/lib/components/Popover.tsx +15 -33
- package/apps/lib/components/ProfileMenu.tsx +67 -72
- package/apps/lib/components/Radio.tsx +1 -5
- package/apps/lib/components/RadioCard.tsx +9 -28
- package/apps/lib/components/ScrollArea.tsx +45 -43
- package/apps/lib/components/SearchField.tsx +49 -39
- package/apps/lib/components/SearchableSelect.tsx +8 -14
- package/apps/lib/components/SearchableTable.tsx +108 -118
- package/apps/lib/components/SearchableTree.tsx +469 -0
- package/apps/lib/components/SearchableTreeDialog.tsx +493 -0
- package/apps/lib/components/SectionBlock.tsx +4 -16
- package/apps/lib/components/Select.tsx +53 -80
- package/apps/lib/components/SimpleSelect.tsx +196 -187
- package/apps/lib/components/Skeleton.tsx +9 -12
- package/apps/lib/components/SlideDatePicker.tsx +215 -166
- package/apps/lib/components/SpinLoading.tsx +33 -49
- package/apps/lib/components/Stepper.tsx +13 -56
- package/apps/lib/components/Switch.tsx +8 -10
- package/apps/lib/components/TabFormItem.tsx +3 -12
- package/apps/lib/components/TabSwitch.tsx +7 -34
- package/apps/lib/components/Table.tsx +60 -75
- package/apps/lib/components/TableDnDWrapper.ts +15 -48
- package/apps/lib/components/TextEditor.tsx +93 -104
- package/apps/lib/components/Textarea.tsx +8 -12
- package/apps/lib/components/Timeline.tsx +21 -41
- package/apps/lib/components/Toast.tsx +83 -83
- package/apps/lib/components/Toggle.tsx +112 -114
- package/apps/lib/components/ToggleButton.tsx +1 -1
- package/apps/lib/components/Tooltip.tsx +24 -19
- package/apps/lib/components/TransparentLabel.tsx +61 -62
- package/apps/lib/components/TreeDropDown.tsx +86 -52
- package/apps/lib/components/TreeFolder/TreeFolder.tsx +15 -48
- package/apps/lib/components/TreeFolder/TreeFolderBreadcrumb.tsx +16 -21
- package/apps/lib/components/TreeFolder/TreeFolderRow.tsx +9 -20
- package/apps/lib/components/TreeFolder/TreeFolderStyles.tsx +3 -3
- package/apps/lib/components/TreeFolder/icons.tsx +14 -17
- package/apps/lib/components/TreeFolder/index.ts +15 -8
- package/apps/lib/components/TreeFolder/treeFolderUtils.ts +47 -52
- package/apps/lib/components/TreeFolder/types.ts +32 -32
- package/apps/lib/components/TreeFolder/useTreeFolderDnD.ts +117 -123
- package/apps/lib/hooks/useActiveTreeItem.ts +52 -55
- package/apps/lib/hooks/useClickOutside.ts +21 -20
- package/apps/lib/hooks/useDataViewsState.ts +86 -80
- package/apps/lib/hooks/useIsMobile.ts +12 -12
- package/apps/lib/hooks/useResize.ts +54 -65
- package/apps/lib/hooks/useTagSelection.ts +201 -201
- package/apps/lib/layouts/CNLayout.tsx +181 -140
- package/apps/lib/layouts/DataViewCard.tsx +4 -18
- package/apps/lib/layouts/FieldSection.tsx +2 -6
- package/apps/lib/layouts/TreeSubLayout.tsx +24 -38
- package/apps/lib/providers/ThemeProvider.tsx +8 -23
- package/apps/lib/registry.json +1004 -0
- package/apps/lib/tsconfig.json +9 -0
- package/apps/lib/utils/cn.ts +1 -1
- package/apps/lib/utils/dataViews/columnUtils.ts +46 -44
- package/apps/lib/utils/dataViews/fieldUtils.ts +70 -71
- package/apps/lib/utils/dataViews/nestedDataUtils.tsx +129 -122
- package/apps/lib/utils/dataViews/pathUtils.ts +74 -67
- package/apps/lib/utils/dataViews/rangeUtils.ts +121 -112
- package/apps/lib/utils/dataViews/treeUtils.ts +204 -211
- package/apps/lib/utils/dateFormat.ts +64 -54
- package/apps/lib/utils/markdownParser.ts +2 -7
- package/apps/lib/utils/resize.ts +21 -25
- package/apps/lib/utils/types.ts +13 -13
- package/dist/bin/index.js +8 -2
- package/dist/bin/index.js.map +1 -1
- package/dist/src/shared/getAvailableFiles.d.ts.map +1 -1
- package/dist/src/shared/getAvailableFiles.js +6 -1
- package/dist/src/shared/getAvailableFiles.js.map +1 -1
- package/dist/src/shared/loadRegistry.d.ts +7 -0
- package/dist/src/shared/loadRegistry.d.ts.map +1 -0
- package/dist/src/shared/loadRegistry.js +31 -0
- package/dist/src/shared/loadRegistry.js.map +1 -0
- package/dist/src/shared/resolveInstallPlan.d.ts +12 -0
- package/dist/src/shared/resolveInstallPlan.d.ts.map +1 -0
- package/dist/src/shared/resolveInstallPlan.js +39 -0
- package/dist/src/shared/resolveInstallPlan.js.map +1 -0
- package/dist/src/types/main.d.ts +24 -0
- package/dist/src/types/main.d.ts.map +1 -1
- package/docs/README.md +10 -2
- package/docs/components/action-button.md +30 -24
- package/docs/components/actions-group.md +26 -20
- package/docs/components/alert-dialog.md +45 -45
- package/docs/components/avatar.md +6 -2
- package/docs/components/badge-field.md +6 -2
- package/docs/components/badge.md +7 -1
- package/docs/components/breadcrumb.md +15 -40
- package/docs/components/button-group.md +13 -10
- package/docs/components/button.md +58 -33
- package/docs/components/calendar.md +26 -19
- package/docs/components/card.md +19 -16
- package/docs/components/chart-block-tool.md +128 -0
- package/docs/components/checkbox.md +16 -8
- package/docs/components/cn-layout.md +7 -1
- package/docs/components/context-menu.md +18 -25
- package/docs/components/count-badge.md +7 -1
- package/docs/components/data-table.md +45 -33
- package/docs/components/data-views-config-panel.md +15 -11
- package/docs/components/data-views-layout.md +13 -16
- package/docs/components/date-picker.md +30 -23
- package/docs/components/dialog.md +43 -42
- package/docs/components/divider.md +10 -4
- package/docs/components/drawer.md +8 -33
- package/docs/components/dropdown-menu.md +25 -34
- package/docs/components/field-hint.md +37 -25
- package/docs/components/field-section.md +9 -3
- package/docs/components/form-stepper.md +6 -0
- package/docs/components/form.md +17 -20
- package/docs/components/header-bar.md +6 -0
- package/docs/components/image-attachment.md +33 -41
- package/docs/components/inbox-view.md +16 -5
- package/docs/components/inner-label-field.md +34 -24
- package/docs/components/input-field.md +18 -10
- package/docs/components/input-otp.md +14 -11
- package/docs/components/input.md +22 -16
- package/docs/components/kanban-view.md +15 -5
- package/docs/components/label-field.md +32 -22
- package/docs/components/label.md +43 -32
- package/docs/components/labeled-check-box.md +16 -8
- package/docs/components/labeled-radio.md +18 -11
- package/docs/components/link-button.md +7 -1
- package/docs/components/login-button.md +8 -2
- package/docs/components/password-level.md +37 -24
- package/docs/components/popover.md +26 -23
- package/docs/components/profile-menu.md +38 -27
- package/docs/components/radio-card.md +16 -9
- package/docs/components/radio.md +16 -8
- package/docs/components/scroll-area.md +6 -2
- package/docs/components/search-field.md +14 -6
- package/docs/components/searchable-select.md +19 -14
- package/docs/components/searchable-table.md +18 -13
- package/docs/components/searchable-tree-dialog.md +190 -0
- package/docs/components/searchable-tree.md +200 -0
- package/docs/components/section-block.md +12 -4
- package/docs/components/select.md +23 -18
- package/docs/components/simple-select.md +14 -10
- package/docs/components/skeleton.md +43 -33
- package/docs/components/slide-date-picker.md +37 -29
- package/docs/components/spin-loading.md +32 -23
- package/docs/components/stepper.md +6 -0
- package/docs/components/switch.md +14 -6
- package/docs/components/tab-form-item.md +7 -1
- package/docs/components/tab-switch.md +13 -6
- package/docs/components/table-dnd-wrapper.md +105 -0
- package/docs/components/table-view.md +15 -5
- package/docs/components/table.md +28 -28
- package/docs/components/text-editor.md +19 -13
- package/docs/components/textarea.md +15 -7
- package/docs/components/timeline.md +6 -0
- package/docs/components/toast.md +35 -26
- package/docs/components/toggle-button.md +24 -21
- package/docs/components/toggle.md +23 -15
- package/docs/components/tooltip.md +42 -30
- package/docs/components/transparent-label.md +29 -20
- package/docs/components/tree-drop-down.md +31 -23
- package/docs/components/tree-sub-layout.md +6 -2
- package/docs/components/tree-view.md +16 -5
- package/docs/explanation/architecture.md +54 -0
- package/docs/explanation/design-system.md +52 -0
- package/docs/how-to/data-views-from-backend-response.md +6 -4
- package/docs/how-to/guides.md +24 -18
- package/docs/migration/changelog.md +38 -0
- package/docs/reference/cli.md +87 -0
- package/docs/reference/components.md +11 -12
- package/docs/reference/hooks.md +8 -8
- package/docs/reference/providers.md +22 -22
- package/docs/reference/tailwind-plugins.md +2 -2
- package/docs/reference/theme.md +85 -0
- package/docs/reference/types.md +4 -4
- package/docs/reference/utilities.md +19 -26
- package/docs/tutorials/building-first-form.md +20 -13
- package/docs/tutorials/component-composition.md +34 -50
- package/docs/tutorials/getting-started.md +2 -2
- package/docs/tutorials/theming-basics.md +13 -10
- package/package.json +31 -3
- package/dist/src/commands/block.d.ts +0 -5
- package/dist/src/commands/block.d.ts.map +0 -1
- package/dist/src/commands/block.js +0 -255
- package/dist/src/commands/block.js.map +0 -1
- package/dist/src/shared/configureFonts.d.ts +0 -6
- package/dist/src/shared/configureFonts.d.ts.map +0 -1
- package/dist/src/shared/configureFonts.js +0 -106
- package/dist/src/shared/configureFonts.js.map +0 -1
- package/dist/src/shared/configureGlobalCss.d.ts +0 -6
- package/dist/src/shared/configureGlobalCss.d.ts.map +0 -1
- package/dist/src/shared/configureGlobalCss.js +0 -154
- package/dist/src/shared/configureGlobalCss.js.map +0 -1
- package/dist/src/shared/configureTailwind.d.ts +0 -7
- package/dist/src/shared/configureTailwind.d.ts.map +0 -1
- package/dist/src/shared/configureTailwind.js +0 -163
- package/dist/src/shared/configureTailwind.js.map +0 -1
- package/dist/src/shared/detectFramework.d.ts +0 -23
- package/dist/src/shared/detectFramework.d.ts.map +0 -1
- package/dist/src/shared/detectFramework.js +0 -119
- package/dist/src/shared/detectFramework.js.map +0 -1
- package/dist/src/shared/installBaseUtils.d.ts +0 -5
- package/dist/src/shared/installBaseUtils.d.ts.map +0 -1
- package/dist/src/shared/installBaseUtils.js +0 -79
- package/dist/src/shared/installBaseUtils.js.map +0 -1
- package/dist/src/shared/resolveAliases.d.ts +0 -24
- package/dist/src/shared/resolveAliases.d.ts.map +0 -1
- package/dist/src/shared/resolveAliases.js +0 -98
- package/dist/src/shared/resolveAliases.js.map +0 -1
|
@@ -12,10 +12,16 @@ A compact icon-only button component designed for toolbars, action bars, and inl
|
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
|
+
TORCH Glare is a copy-in library: the CLI copies this component's source into your project
|
|
16
|
+
(you do **not** install it from the npm package). Run `init` once, then `add`:
|
|
17
|
+
|
|
15
18
|
```bash
|
|
16
|
-
npx torch-
|
|
19
|
+
npx torch-glare@latest init
|
|
20
|
+
npx torch-glare@latest add ActionButton
|
|
17
21
|
```
|
|
18
22
|
|
|
23
|
+
`add` also copies any components, hooks, and utilities that `ActionButton` depends on.
|
|
24
|
+
|
|
19
25
|
## Imports
|
|
20
26
|
|
|
21
27
|
```typescript
|
|
@@ -74,25 +80,25 @@ export function Toolbar() {
|
|
|
74
80
|
<i className="ri-save-line"></i>
|
|
75
81
|
</ActionButton>
|
|
76
82
|
|
|
77
|
-
<ActionButton size="S" variant="
|
|
83
|
+
<ActionButton size="S" variant="BluSecStyle">
|
|
78
84
|
<i className="ri-file-copy-line"></i>
|
|
79
85
|
</ActionButton>
|
|
80
86
|
|
|
81
|
-
<ActionButton size="S" variant="
|
|
87
|
+
<ActionButton size="S" variant="BluSecStyle">
|
|
82
88
|
<i className="ri-scissors-line"></i>
|
|
83
89
|
</ActionButton>
|
|
84
90
|
|
|
85
|
-
<ActionButton size="S" variant="
|
|
91
|
+
<ActionButton size="S" variant="BluSecStyle">
|
|
86
92
|
<i className="ri-clipboard-line"></i>
|
|
87
93
|
</ActionButton>
|
|
88
94
|
|
|
89
95
|
<div className="w-px h-6 bg-border-system-global-primary mx-1" />
|
|
90
96
|
|
|
91
|
-
<ActionButton size="S" variant="
|
|
97
|
+
<ActionButton size="S" variant="BluSecStyle">
|
|
92
98
|
<i className="ri-arrow-go-back-line"></i>
|
|
93
99
|
</ActionButton>
|
|
94
100
|
|
|
95
|
-
<ActionButton size="S" variant="
|
|
101
|
+
<ActionButton size="S" variant="BluSecStyle">
|
|
96
102
|
<i className="ri-arrow-go-forward-line"></i>
|
|
97
103
|
</ActionButton>
|
|
98
104
|
</div>
|
|
@@ -112,7 +118,7 @@ export function TableRowActions({ row }) {
|
|
|
112
118
|
<td className="flex items-center gap-1 justify-end">
|
|
113
119
|
<ActionButton
|
|
114
120
|
size="XS"
|
|
115
|
-
variant="
|
|
121
|
+
variant="BluSecStyle"
|
|
116
122
|
onClick={() => setIsEditing(true)}
|
|
117
123
|
aria-label="Edit row"
|
|
118
124
|
>
|
|
@@ -121,7 +127,7 @@ export function TableRowActions({ row }) {
|
|
|
121
127
|
|
|
122
128
|
<ActionButton
|
|
123
129
|
size="XS"
|
|
124
|
-
variant="
|
|
130
|
+
variant="BluSecStyle"
|
|
125
131
|
onClick={() => handleDuplicate(row.id)}
|
|
126
132
|
aria-label="Duplicate row"
|
|
127
133
|
>
|
|
@@ -130,7 +136,7 @@ export function TableRowActions({ row }) {
|
|
|
130
136
|
|
|
131
137
|
<ActionButton
|
|
132
138
|
size="XS"
|
|
133
|
-
variant="
|
|
139
|
+
variant="RedSecStyle"
|
|
134
140
|
onClick={() => handleDelete(row.id)}
|
|
135
141
|
aria-label="Delete row"
|
|
136
142
|
>
|
|
@@ -158,7 +164,7 @@ export function CardWithActions() {
|
|
|
158
164
|
<div className="flex items-center gap-1">
|
|
159
165
|
<ActionButton
|
|
160
166
|
size="S"
|
|
161
|
-
variant={isFavorite ? "YelSecStyle" : "
|
|
167
|
+
variant={isFavorite ? "YelSecStyle" : "BluSecStyle"}
|
|
162
168
|
onClick={() => setIsFavorite(!isFavorite)}
|
|
163
169
|
aria-label={isFavorite ? "Remove from favorites" : "Add to favorites"}
|
|
164
170
|
>
|
|
@@ -167,7 +173,7 @@ export function CardWithActions() {
|
|
|
167
173
|
|
|
168
174
|
<ActionButton
|
|
169
175
|
size="S"
|
|
170
|
-
variant="
|
|
176
|
+
variant="BluSecStyle"
|
|
171
177
|
onClick={() => setIsExpanded(!isExpanded)}
|
|
172
178
|
aria-label={isExpanded ? "Collapse" : "Expand"}
|
|
173
179
|
>
|
|
@@ -176,7 +182,7 @@ export function CardWithActions() {
|
|
|
176
182
|
|
|
177
183
|
<ActionButton
|
|
178
184
|
size="S"
|
|
179
|
-
variant="
|
|
185
|
+
variant="BluSecStyle"
|
|
180
186
|
aria-label="More options"
|
|
181
187
|
>
|
|
182
188
|
<i className="ri-more-2-fill"></i>
|
|
@@ -256,7 +262,7 @@ export function ActionButtonGroup() {
|
|
|
256
262
|
<div className="inline-flex items-center border border-border-system-global-primary rounded-lg overflow-hidden">
|
|
257
263
|
<ActionButton
|
|
258
264
|
size="S"
|
|
259
|
-
variant={activeView === 'list' ? "PrimeStyle" : "
|
|
265
|
+
variant={activeView === 'list' ? "PrimeStyle" : "BluSecStyle"}
|
|
260
266
|
onClick={() => setActiveView('list')}
|
|
261
267
|
className="rounded-none border-0"
|
|
262
268
|
aria-label="List view"
|
|
@@ -266,7 +272,7 @@ export function ActionButtonGroup() {
|
|
|
266
272
|
|
|
267
273
|
<ActionButton
|
|
268
274
|
size="S"
|
|
269
|
-
variant={activeView === 'grid' ? "PrimeStyle" : "
|
|
275
|
+
variant={activeView === 'grid' ? "PrimeStyle" : "BluSecStyle"}
|
|
270
276
|
onClick={() => setActiveView('grid')}
|
|
271
277
|
className="rounded-none border-0 border-l border-border-system-global-primary"
|
|
272
278
|
aria-label="Grid view"
|
|
@@ -276,7 +282,7 @@ export function ActionButtonGroup() {
|
|
|
276
282
|
|
|
277
283
|
<ActionButton
|
|
278
284
|
size="S"
|
|
279
|
-
variant={activeView === 'kanban' ? "PrimeStyle" : "
|
|
285
|
+
variant={activeView === 'kanban' ? "PrimeStyle" : "BluSecStyle"}
|
|
280
286
|
onClick={() => setActiveView('kanban')}
|
|
281
287
|
className="rounded-none border-0 border-l border-border-system-global-primary"
|
|
282
288
|
aria-label="Kanban view"
|
|
@@ -299,25 +305,25 @@ export function ActionButtonsWithTooltips() {
|
|
|
299
305
|
return (
|
|
300
306
|
<div className="flex items-center gap-2">
|
|
301
307
|
<Tooltip content="Bold (Ctrl+B)">
|
|
302
|
-
<ActionButton size="S" variant="
|
|
308
|
+
<ActionButton size="S" variant="BluSecStyle">
|
|
303
309
|
<i className="ri-bold"></i>
|
|
304
310
|
</ActionButton>
|
|
305
311
|
</Tooltip>
|
|
306
312
|
|
|
307
313
|
<Tooltip content="Italic (Ctrl+I)">
|
|
308
|
-
<ActionButton size="S" variant="
|
|
314
|
+
<ActionButton size="S" variant="BluSecStyle">
|
|
309
315
|
<i className="ri-italic"></i>
|
|
310
316
|
</ActionButton>
|
|
311
317
|
</Tooltip>
|
|
312
318
|
|
|
313
319
|
<Tooltip content="Underline (Ctrl+U)">
|
|
314
|
-
<ActionButton size="S" variant="
|
|
320
|
+
<ActionButton size="S" variant="BluSecStyle">
|
|
315
321
|
<i className="ri-underline"></i>
|
|
316
322
|
</ActionButton>
|
|
317
323
|
</Tooltip>
|
|
318
324
|
|
|
319
325
|
<Tooltip content="Strikethrough">
|
|
320
|
-
<ActionButton size="S" variant="
|
|
326
|
+
<ActionButton size="S" variant="BluSecStyle">
|
|
321
327
|
<i className="ri-strikethrough"></i>
|
|
322
328
|
</ActionButton>
|
|
323
329
|
</Tooltip>
|
|
@@ -362,7 +368,7 @@ Inherits all variants from the Button component:
|
|
|
362
368
|
- `SecStyle` - Secondary action style
|
|
363
369
|
- `DangerStyle` - Destructive actions
|
|
364
370
|
- `YelSecStyle` - Yellow secondary style
|
|
365
|
-
- `
|
|
371
|
+
- `BluSecStyle` - Blue secondary style
|
|
366
372
|
- `RedSecStyle` - Red secondary style
|
|
367
373
|
- `BorderStyle` - Border-only style
|
|
368
374
|
- `NoBorderNoFillStyle` - Minimal style
|
|
@@ -414,7 +420,7 @@ type ButtonVariant =
|
|
|
414
420
|
| 'SecStyle'
|
|
415
421
|
| 'DangerStyle'
|
|
416
422
|
| 'YelSecStyle'
|
|
417
|
-
| '
|
|
423
|
+
| 'BluSecStyle'
|
|
418
424
|
| 'RedSecStyle'
|
|
419
425
|
| 'BorderStyle'
|
|
420
426
|
| 'NoBorderNoFillStyle'
|
|
@@ -437,7 +443,7 @@ function IconButtonBar({ onAction }) {
|
|
|
437
443
|
<ActionButton
|
|
438
444
|
key={item.action}
|
|
439
445
|
size="S"
|
|
440
|
-
variant="
|
|
446
|
+
variant="BluSecStyle"
|
|
441
447
|
onClick={() => onAction(item.action)}
|
|
442
448
|
>
|
|
443
449
|
<i className={item.icon}></i>
|
|
@@ -469,7 +475,7 @@ function ConditionalActions({ permissions, item }) {
|
|
|
469
475
|
{permissions.canDelete && (
|
|
470
476
|
<ActionButton
|
|
471
477
|
size="XS"
|
|
472
|
-
variant="
|
|
478
|
+
variant="RedSecStyle"
|
|
473
479
|
onClick={() => deleteItem(item.id)}
|
|
474
480
|
>
|
|
475
481
|
<i className="ri-delete-bin-line"></i>
|
|
@@ -609,7 +615,7 @@ items.map(item => (
|
|
|
609
615
|
|
|
610
616
|
```tsx
|
|
611
617
|
// Before: Material-UI IconButton
|
|
612
|
-
<IconButton size="
|
|
618
|
+
<IconButton size="S" color="primary">
|
|
613
619
|
<AddIcon />
|
|
614
620
|
</IconButton>
|
|
615
621
|
|
|
@@ -12,10 +12,16 @@ A flexible container component for grouping action buttons and controls with opt
|
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
|
+
TORCH Glare is a copy-in library: the CLI copies this component's source into your project
|
|
16
|
+
(you do **not** install it from the npm package). Run `init` once, then `add`:
|
|
17
|
+
|
|
15
18
|
```bash
|
|
16
|
-
npx torch-
|
|
19
|
+
npx torch-glare@latest init
|
|
20
|
+
npx torch-glare@latest add ActionsGroup
|
|
17
21
|
```
|
|
18
22
|
|
|
23
|
+
`add` also copies any components, hooks, and utilities that `ActionsGroup` depends on.
|
|
24
|
+
|
|
19
25
|
## Imports
|
|
20
26
|
|
|
21
27
|
```typescript
|
|
@@ -32,7 +38,7 @@ export function BasicActionsGroup() {
|
|
|
32
38
|
return (
|
|
33
39
|
<ActionsGroup>
|
|
34
40
|
<Button variant="PrimeStyle">Save</Button>
|
|
35
|
-
<Button variant="
|
|
41
|
+
<Button variant="BluSecStyle">Cancel</Button>
|
|
36
42
|
</ActionsGroup>
|
|
37
43
|
)
|
|
38
44
|
}
|
|
@@ -56,7 +62,7 @@ export function ActionsWithDividers() {
|
|
|
56
62
|
<i className="ri-save-line mr-2"></i>
|
|
57
63
|
Save Changes
|
|
58
64
|
</Button>
|
|
59
|
-
<Button variant="
|
|
65
|
+
<Button variant="BluSecStyle" size="M">
|
|
60
66
|
<i className="ri-close-line mr-2"></i>
|
|
61
67
|
Discard
|
|
62
68
|
</Button>
|
|
@@ -89,7 +95,7 @@ export function FormActions() {
|
|
|
89
95
|
</div>
|
|
90
96
|
|
|
91
97
|
<ActionsGroup className="justify-end">
|
|
92
|
-
<Button variant="
|
|
98
|
+
<Button variant="BluSecStyle" type="button">
|
|
93
99
|
Cancel
|
|
94
100
|
</Button>
|
|
95
101
|
<Button variant="PrimeStyle" type="submit">
|
|
@@ -123,10 +129,10 @@ export function ModalFooterActions() {
|
|
|
123
129
|
|
|
124
130
|
{/* Modal Footer */}
|
|
125
131
|
<ActionsGroup withDivider className="p-6 justify-end">
|
|
126
|
-
<Button variant="
|
|
132
|
+
<Button variant="BluSecStyle">
|
|
127
133
|
Cancel
|
|
128
134
|
</Button>
|
|
129
|
-
<Button variant="
|
|
135
|
+
<Button variant="RedSecStyle">
|
|
130
136
|
<i className="ri-delete-bin-line mr-2"></i>
|
|
131
137
|
Delete
|
|
132
138
|
</Button>
|
|
@@ -156,28 +162,28 @@ export function MultiActionGroups() {
|
|
|
156
162
|
<i className="ri-save-line mr-2"></i>
|
|
157
163
|
Save
|
|
158
164
|
</Button>
|
|
159
|
-
<Button variant="
|
|
165
|
+
<Button variant="BluSecStyle" size="S">
|
|
160
166
|
<i className="ri-file-copy-line mr-2"></i>
|
|
161
167
|
Duplicate
|
|
162
168
|
</Button>
|
|
163
169
|
</div>
|
|
164
170
|
|
|
165
|
-
<Button variant="
|
|
171
|
+
<Button variant="BluSecStyle" size="S">
|
|
166
172
|
<i className="ri-more-2-fill"></i>
|
|
167
173
|
</Button>
|
|
168
174
|
</ActionsGroup>
|
|
169
175
|
|
|
170
176
|
{/* Secondary Actions */}
|
|
171
177
|
<ActionsGroup withDivider>
|
|
172
|
-
<Button variant="
|
|
178
|
+
<Button variant="BluSecStyle" size="S">
|
|
173
179
|
<i className="ri-share-line mr-2"></i>
|
|
174
180
|
Share
|
|
175
181
|
</Button>
|
|
176
|
-
<Button variant="
|
|
182
|
+
<Button variant="BluSecStyle" size="S">
|
|
177
183
|
<i className="ri-download-line mr-2"></i>
|
|
178
184
|
Export
|
|
179
185
|
</Button>
|
|
180
|
-
<Button variant="
|
|
186
|
+
<Button variant="BluSecStyle" size="S">
|
|
181
187
|
<i className="ri-printer-line mr-2"></i>
|
|
182
188
|
Print
|
|
183
189
|
</Button>
|
|
@@ -185,7 +191,7 @@ export function MultiActionGroups() {
|
|
|
185
191
|
|
|
186
192
|
{/* Danger Zone */}
|
|
187
193
|
<ActionsGroup withDivider>
|
|
188
|
-
<Button variant="
|
|
194
|
+
<Button variant="RedSecStyle" size="S" className="w-full">
|
|
189
195
|
<i className="ri-delete-bin-line mr-2"></i>
|
|
190
196
|
Delete Document
|
|
191
197
|
</Button>
|
|
@@ -215,7 +221,7 @@ export function CardActions() {
|
|
|
215
221
|
</p>
|
|
216
222
|
|
|
217
223
|
<ActionsGroup className="justify-end">
|
|
218
|
-
<Button variant="
|
|
224
|
+
<Button variant="BluSecStyle" size="S">
|
|
219
225
|
View
|
|
220
226
|
</Button>
|
|
221
227
|
<Button variant="PrimeStyle" size="S">
|
|
@@ -283,7 +289,7 @@ export function ToolbarActions() {
|
|
|
283
289
|
|
|
284
290
|
{/* Save Group */}
|
|
285
291
|
<ActionsGroup>
|
|
286
|
-
<Button variant="
|
|
292
|
+
<Button variant="BluSecStyle" size="S">
|
|
287
293
|
Preview
|
|
288
294
|
</Button>
|
|
289
295
|
<Button variant="PrimeStyle" size="S">
|
|
@@ -336,7 +342,7 @@ export function WizardNavigation() {
|
|
|
336
342
|
{/* Navigation Actions */}
|
|
337
343
|
<ActionsGroup className="justify-between">
|
|
338
344
|
<Button
|
|
339
|
-
variant="
|
|
345
|
+
variant="BluSecStyle"
|
|
340
346
|
disabled={currentStep === 1}
|
|
341
347
|
onClick={() => setCurrentStep(currentStep - 1)}
|
|
342
348
|
>
|
|
@@ -388,10 +394,10 @@ export function ConfirmationDialog({ title, message, onConfirm, onCancel }) {
|
|
|
388
394
|
</div>
|
|
389
395
|
|
|
390
396
|
<ActionsGroup withDivider className="p-6 justify-end gap-3">
|
|
391
|
-
<Button variant="
|
|
397
|
+
<Button variant="BluSecStyle" onClick={onCancel}>
|
|
392
398
|
Cancel
|
|
393
399
|
</Button>
|
|
394
|
-
<Button variant="
|
|
400
|
+
<Button variant="RedSecStyle" onClick={onConfirm}>
|
|
395
401
|
Confirm
|
|
396
402
|
</Button>
|
|
397
403
|
</ActionsGroup>
|
|
@@ -466,7 +472,7 @@ export function LoadingActions() {
|
|
|
466
472
|
return (
|
|
467
473
|
<ActionsGroup className="justify-end">
|
|
468
474
|
<Button
|
|
469
|
-
variant="
|
|
475
|
+
variant="BluSecStyle"
|
|
470
476
|
disabled={isLoading}
|
|
471
477
|
>
|
|
472
478
|
Cancel
|
|
@@ -553,7 +559,7 @@ type Themes = 'light' | 'dark' | 'default'
|
|
|
553
559
|
function ResponsiveActions() {
|
|
554
560
|
return (
|
|
555
561
|
<ActionsGroup className="flex-col sm:flex-row justify-end">
|
|
556
|
-
<Button variant="
|
|
562
|
+
<Button variant="BluSecStyle" className="w-full sm:w-auto">
|
|
557
563
|
Cancel
|
|
558
564
|
</Button>
|
|
559
565
|
<Button variant="PrimeStyle" className="w-full sm:w-auto">
|
|
@@ -576,7 +582,7 @@ function GroupedActions() {
|
|
|
576
582
|
</ActionsGroup>
|
|
577
583
|
|
|
578
584
|
<ActionsGroup withDivider>
|
|
579
|
-
<Button variant="
|
|
585
|
+
<Button variant="RedSecStyle" className="w-full">
|
|
580
586
|
Dangerous Action
|
|
581
587
|
</Button>
|
|
582
588
|
</ActionsGroup>
|
|
@@ -11,25 +11,22 @@ keywords: [alert-dialog, confirmation, modal, alert, warning, error, radix-ui]
|
|
|
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
|
-
|
|
18
|
+
npx torch-glare@latest init
|
|
19
|
+
npx torch-glare@latest add AlertDialog
|
|
16
20
|
```
|
|
17
21
|
|
|
22
|
+
`add` also copies any components, hooks, and utilities that `AlertDialog` depends on.
|
|
23
|
+
|
|
18
24
|
## Import
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
AlertDialogContent,
|
|
25
|
-
AlertDialogHeader,
|
|
26
|
-
AlertDialogFooter,
|
|
27
|
-
AlertDialogTitle,
|
|
28
|
-
AlertDialogLabel,
|
|
29
|
-
AlertDialogDescription,
|
|
30
|
-
AlertDialogAction,
|
|
31
|
-
AlertDialogCancel,
|
|
32
|
-
} 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 { AlertDialog } from "@/components/AlertDialog";
|
|
33
30
|
```
|
|
34
31
|
|
|
35
32
|
## Quick Examples
|
|
@@ -37,8 +34,8 @@ import {
|
|
|
37
34
|
### Basic Alert
|
|
38
35
|
|
|
39
36
|
```typescript
|
|
40
|
-
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogTitle, AlertDialogDescription, AlertDialogAction } from
|
|
41
|
-
import { Button } from
|
|
37
|
+
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogTitle, AlertDialogDescription, AlertDialogAction } from "@/components/AlertDialog";
|
|
38
|
+
import { Button } from "@/components/Button";
|
|
42
39
|
|
|
43
40
|
function Example() {
|
|
44
41
|
return (
|
|
@@ -63,8 +60,8 @@ function Example() {
|
|
|
63
60
|
### Delete Confirmation (Error Variant)
|
|
64
61
|
|
|
65
62
|
```typescript
|
|
66
|
-
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel } from
|
|
67
|
-
import { Button } from
|
|
63
|
+
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel } from "@/components/AlertDialog";
|
|
64
|
+
import { Button } from "@/components/Button";
|
|
68
65
|
|
|
69
66
|
function DeleteConfirmation() {
|
|
70
67
|
const handleDelete = () => {
|
|
@@ -75,7 +72,7 @@ function DeleteConfirmation() {
|
|
|
75
72
|
return (
|
|
76
73
|
<AlertDialog>
|
|
77
74
|
<AlertDialogTrigger asChild>
|
|
78
|
-
<Button variant="
|
|
75
|
+
<Button variant="RedSecStyle">Delete Item</Button>
|
|
79
76
|
</AlertDialogTrigger>
|
|
80
77
|
<AlertDialogContent variant="error">
|
|
81
78
|
<AlertDialogHeader>
|
|
@@ -90,7 +87,7 @@ function DeleteConfirmation() {
|
|
|
90
87
|
<i className="ri-close-line" />
|
|
91
88
|
</AlertDialogCancel>
|
|
92
89
|
<AlertDialogAction
|
|
93
|
-
variant="
|
|
90
|
+
variant="RedSecStyle"
|
|
94
91
|
onClick={handleDelete}
|
|
95
92
|
>
|
|
96
93
|
Delete Permanently
|
|
@@ -105,7 +102,7 @@ function DeleteConfirmation() {
|
|
|
105
102
|
### Success Alert
|
|
106
103
|
|
|
107
104
|
```typescript
|
|
108
|
-
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogAction } from
|
|
105
|
+
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogAction } from "@/components/AlertDialog";
|
|
109
106
|
|
|
110
107
|
function SuccessAlert() {
|
|
111
108
|
return (
|
|
@@ -119,7 +116,7 @@ function SuccessAlert() {
|
|
|
119
116
|
Your task has been successfully completed and saved.
|
|
120
117
|
</AlertDialogDescription>
|
|
121
118
|
<AlertDialogFooter>
|
|
122
|
-
<AlertDialogAction variant="
|
|
119
|
+
<AlertDialogAction variant="PrimeStyle">
|
|
123
120
|
Continue
|
|
124
121
|
</AlertDialogAction>
|
|
125
122
|
</AlertDialogFooter>
|
|
@@ -132,7 +129,7 @@ function SuccessAlert() {
|
|
|
132
129
|
### Warning Alert
|
|
133
130
|
|
|
134
131
|
```typescript
|
|
135
|
-
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel } from
|
|
132
|
+
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel } from "@/components/AlertDialog";
|
|
136
133
|
|
|
137
134
|
function WarningAlert() {
|
|
138
135
|
return (
|
|
@@ -150,7 +147,7 @@ function WarningAlert() {
|
|
|
150
147
|
<AlertDialogCancel>
|
|
151
148
|
<i className="ri-close-line" />
|
|
152
149
|
</AlertDialogCancel>
|
|
153
|
-
<AlertDialogAction variant="
|
|
150
|
+
<AlertDialogAction variant="PrimeStyle">
|
|
154
151
|
Leave Anyway
|
|
155
152
|
</AlertDialogAction>
|
|
156
153
|
</AlertDialogFooter>
|
|
@@ -163,7 +160,7 @@ function WarningAlert() {
|
|
|
163
160
|
### Info Alert
|
|
164
161
|
|
|
165
162
|
```typescript
|
|
166
|
-
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogAction } from
|
|
163
|
+
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogAction } from "@/components/AlertDialog";
|
|
167
164
|
|
|
168
165
|
function InfoAlert() {
|
|
169
166
|
return (
|
|
@@ -178,7 +175,7 @@ function InfoAlert() {
|
|
|
178
175
|
your next restart. This may take a few minutes.
|
|
179
176
|
</AlertDialogDescription>
|
|
180
177
|
<AlertDialogFooter>
|
|
181
|
-
<AlertDialogAction variant="
|
|
178
|
+
<AlertDialogAction variant="PrimeStyle">
|
|
182
179
|
Got It
|
|
183
180
|
</AlertDialogAction>
|
|
184
181
|
</AlertDialogFooter>
|
|
@@ -191,7 +188,7 @@ function InfoAlert() {
|
|
|
191
188
|
### Controlled State
|
|
192
189
|
|
|
193
190
|
```typescript
|
|
194
|
-
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogTitle, AlertDialogDescription, AlertDialogAction } from
|
|
191
|
+
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogTitle, AlertDialogDescription, AlertDialogAction } from "@/components/AlertDialog";
|
|
195
192
|
import { useState } from 'react'
|
|
196
193
|
|
|
197
194
|
function ControlledAlert() {
|
|
@@ -229,8 +226,9 @@ function ControlledAlert() {
|
|
|
229
226
|
### Account Deletion Flow
|
|
230
227
|
|
|
231
228
|
```typescript
|
|
232
|
-
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel } from
|
|
233
|
-
import { Button
|
|
229
|
+
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel } from "@/components/AlertDialog";
|
|
230
|
+
import { Button } from "@/components/Button";
|
|
231
|
+
import { Input } from "@/components/Input";
|
|
234
232
|
import { useState } from 'react'
|
|
235
233
|
|
|
236
234
|
function DeleteAccountDialog() {
|
|
@@ -240,7 +238,7 @@ function DeleteAccountDialog() {
|
|
|
240
238
|
return (
|
|
241
239
|
<AlertDialog>
|
|
242
240
|
<AlertDialogTrigger asChild>
|
|
243
|
-
<Button variant="
|
|
241
|
+
<Button variant="RedSecStyle">Delete Account</Button>
|
|
244
242
|
</AlertDialogTrigger>
|
|
245
243
|
<AlertDialogContent variant="error">
|
|
246
244
|
<AlertDialogLabel title="Delete Account" />
|
|
@@ -260,7 +258,7 @@ function DeleteAccountDialog() {
|
|
|
260
258
|
<i className="ri-close-line" />
|
|
261
259
|
</AlertDialogCancel>
|
|
262
260
|
<AlertDialogAction
|
|
263
|
-
variant="
|
|
261
|
+
variant="RedSecStyle"
|
|
264
262
|
disabled={!isValid}
|
|
265
263
|
>
|
|
266
264
|
Delete My Account
|
|
@@ -275,7 +273,7 @@ function DeleteAccountDialog() {
|
|
|
275
273
|
### Multi-Action Alert
|
|
276
274
|
|
|
277
275
|
```typescript
|
|
278
|
-
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel } from
|
|
276
|
+
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel } from "@/components/AlertDialog";
|
|
279
277
|
|
|
280
278
|
function MultiActionAlert() {
|
|
281
279
|
const handleSave = () => console.log('Saved')
|
|
@@ -295,10 +293,10 @@ function MultiActionAlert() {
|
|
|
295
293
|
<AlertDialogCancel>
|
|
296
294
|
Cancel
|
|
297
295
|
</AlertDialogCancel>
|
|
298
|
-
<AlertDialogAction variant="
|
|
296
|
+
<AlertDialogAction variant="BluSecStyle" onClick={handleDiscard}>
|
|
299
297
|
Don't Save
|
|
300
298
|
</AlertDialogAction>
|
|
301
|
-
<AlertDialogAction variant="
|
|
299
|
+
<AlertDialogAction variant="PrimeStyle" onClick={handleSave}>
|
|
302
300
|
Save Changes
|
|
303
301
|
</AlertDialogAction>
|
|
304
302
|
</AlertDialogFooter>
|
|
@@ -311,8 +309,8 @@ function MultiActionAlert() {
|
|
|
311
309
|
### With Loading State
|
|
312
310
|
|
|
313
311
|
```typescript
|
|
314
|
-
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel } from
|
|
315
|
-
import { SpinLoading } from
|
|
312
|
+
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel } from "@/components/AlertDialog";
|
|
313
|
+
import { SpinLoading } from "@/components/SpinLoading";
|
|
316
314
|
import { useState } from 'react'
|
|
317
315
|
|
|
318
316
|
function AsyncAlert() {
|
|
@@ -358,7 +356,7 @@ function AsyncAlert() {
|
|
|
358
356
|
### Permission Request
|
|
359
357
|
|
|
360
358
|
```typescript
|
|
361
|
-
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel } from
|
|
359
|
+
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel } from "@/components/AlertDialog";
|
|
362
360
|
|
|
363
361
|
function PermissionAlert() {
|
|
364
362
|
const handleAllow = () => {
|
|
@@ -381,7 +379,7 @@ function PermissionAlert() {
|
|
|
381
379
|
<AlertDialogCancel>
|
|
382
380
|
Not Now
|
|
383
381
|
</AlertDialogCancel>
|
|
384
|
-
<AlertDialogAction variant="
|
|
382
|
+
<AlertDialogAction variant="PrimeStyle" onClick={handleAllow}>
|
|
385
383
|
Allow Camera Access
|
|
386
384
|
</AlertDialogAction>
|
|
387
385
|
</AlertDialogFooter>
|
|
@@ -648,7 +646,7 @@ Once the patches above are in place, every consumer renders correctly with bare
|
|
|
648
646
|
|
|
649
647
|
```typescript
|
|
650
648
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'
|
|
651
|
-
import { ButtonVariant } from
|
|
649
|
+
import { ButtonVariant } from "@/utils/types";
|
|
652
650
|
|
|
653
651
|
// Root component
|
|
654
652
|
interface AlertDialogProps {
|
|
@@ -693,7 +691,7 @@ export const AlertDialogCancel: React.ForwardRefExoticComponent<AlertDialogActio
|
|
|
693
691
|
### useAlertDialog Hook
|
|
694
692
|
|
|
695
693
|
```typescript
|
|
696
|
-
import { AlertDialog, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel } from
|
|
694
|
+
import { AlertDialog, AlertDialogContent, AlertDialogLabel, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel } from "@/components/AlertDialog";
|
|
697
695
|
import { useState } from 'react'
|
|
698
696
|
|
|
699
697
|
function useAlertDialog() {
|
|
@@ -763,7 +761,7 @@ function App() {
|
|
|
763
761
|
|
|
764
762
|
```typescript
|
|
765
763
|
import { render, screen, fireEvent } from '@testing-library/react'
|
|
766
|
-
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogTitle, AlertDialogAction } from
|
|
764
|
+
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogTitle, AlertDialogAction } from "@/components/AlertDialog";
|
|
767
765
|
|
|
768
766
|
describe('AlertDialog', () => {
|
|
769
767
|
it('renders with correct variant', () => {
|
|
@@ -775,8 +773,10 @@ describe('AlertDialog', () => {
|
|
|
775
773
|
</AlertDialog>
|
|
776
774
|
)
|
|
777
775
|
|
|
776
|
+
// AlertDialogContent applies the variant as StatusTextStyle classes
|
|
777
|
+
// (it does not set a data-variant attribute).
|
|
778
778
|
const content = screen.getByRole('alertdialog')
|
|
779
|
-
expect(content).
|
|
779
|
+
expect(content).toHaveClass('[&_strong]:text-content-presentation-state-negative')
|
|
780
780
|
})
|
|
781
781
|
|
|
782
782
|
it('calls action handler', () => {
|
|
@@ -845,8 +845,8 @@ describe('AlertDialog', () => {
|
|
|
845
845
|
## Migration from Dialog
|
|
846
846
|
|
|
847
847
|
```diff
|
|
848
|
-
- import { Dialog, DialogTrigger, DialogContent } from
|
|
849
|
-
+ import { AlertDialog, AlertDialogTrigger, AlertDialogContent } from
|
|
848
|
+
- import { Dialog, DialogTrigger, DialogContent } from "@/components/Dialog";
|
|
849
|
+
+ import { AlertDialog, AlertDialogTrigger, AlertDialogContent } from "@/components/AlertDialog";
|
|
850
850
|
|
|
851
851
|
- <Dialog>
|
|
852
852
|
- <DialogTrigger>Delete</DialogTrigger>
|
|
@@ -891,7 +891,7 @@ describe('AlertDialog', () => {
|
|
|
891
891
|
4. **Distinguish action buttons**: Make destructive action clear
|
|
892
892
|
```typescript
|
|
893
893
|
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
894
|
-
<AlertDialogAction variant="
|
|
894
|
+
<AlertDialogAction variant="RedSecStyle">Delete</AlertDialogAction>
|
|
895
895
|
```
|
|
896
896
|
|
|
897
897
|
5. **Don't overuse**: Reserve for important decisions only
|
|
@@ -12,11 +12,15 @@ A flexible avatar component for displaying user profile images with automatic fa
|
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
|
+
TORCH Glare is a copy-in library: the CLI copies this component's source into your project
|
|
16
|
+
(you do **not** install it from the npm package). Run `init` once, then `add`:
|
|
17
|
+
|
|
15
18
|
```bash
|
|
16
|
-
npx torch-
|
|
19
|
+
npx torch-glare@latest init
|
|
20
|
+
npx torch-glare@latest add Avatar
|
|
17
21
|
```
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
`add` also copies any components, hooks, and utilities that `Avatar` depends on.
|
|
20
24
|
|
|
21
25
|
## Imports
|
|
22
26
|
|
|
@@ -12,11 +12,15 @@ An advanced tag selection input component that combines badges with search funct
|
|
|
12
12
|
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
|
+
TORCH Glare is a copy-in library: the CLI copies this component's source into your project
|
|
16
|
+
(you do **not** install it from the npm package). Run `init` once, then `add`:
|
|
17
|
+
|
|
15
18
|
```bash
|
|
16
|
-
npx torch-
|
|
19
|
+
npx torch-glare@latest init
|
|
20
|
+
npx torch-glare@latest add BadgeField
|
|
17
21
|
```
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
`add` also copies any components, hooks, and utilities that `BadgeField` depends on.
|
|
20
24
|
|
|
21
25
|
## Imports
|
|
22
26
|
|