torch-glare 2.4.0 ā 2.4.2
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 +21 -20
- package/apps/lib/components/ButtonGroup.tsx +31 -41
- package/apps/lib/components/Calendar.tsx +51 -29
- package/apps/lib/components/Card.tsx +40 -24
- package/apps/lib/components/Checkbox.tsx +9 -16
- package/apps/lib/components/ColorPicker.tsx +441 -0
- package/apps/lib/components/ConclusionHeader.tsx +148 -0
- 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 +200 -196
- package/apps/lib/components/Dialog.tsx +92 -105
- package/apps/lib/components/Divider.tsx +21 -24
- package/apps/lib/components/Drawer.tsx +124 -142
- 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/FormBuilder/DisplayField.tsx +40 -0
- package/apps/lib/components/FormBuilder/context.ts +71 -0
- package/apps/lib/components/FormBuilder/fields/ChoiceFields.tsx +65 -0
- package/apps/lib/components/FormBuilder/fields/ColorField.tsx +76 -0
- package/apps/lib/components/FormBuilder/fields/CustomField.tsx +16 -0
- package/apps/lib/components/FormBuilder/fields/DateField.tsx +34 -0
- package/apps/lib/components/FormBuilder/fields/FieldArray.tsx +79 -0
- package/apps/lib/components/FormBuilder/fields/FieldShell.tsx +174 -0
- package/apps/lib/components/FormBuilder/fields/FileField.tsx +40 -0
- package/apps/lib/components/FormBuilder/fields/OptionListFields.tsx +139 -0
- package/apps/lib/components/FormBuilder/fields/OtpField.tsx +32 -0
- package/apps/lib/components/FormBuilder/fields/PhoneField.tsx +82 -0
- package/apps/lib/components/FormBuilder/fields/RichTextEditorField.tsx +37 -0
- package/apps/lib/components/FormBuilder/fields/SelectField.tsx +101 -0
- package/apps/lib/components/FormBuilder/fields/SignatureField.tsx +175 -0
- package/apps/lib/components/FormBuilder/fields/SliderField.tsx +72 -0
- package/apps/lib/components/FormBuilder/fields/SwitchBoxField.tsx +42 -0
- package/apps/lib/components/FormBuilder/fields/TableField.tsx +312 -0
- package/apps/lib/components/FormBuilder/fields/TextField.tsx +222 -0
- package/apps/lib/components/FormBuilder/fields/TreeSelectField.tsx +49 -0
- package/apps/lib/components/FormBuilder/fields/countries.ts +303 -0
- package/apps/lib/components/FormBuilder/fields/index.ts +25 -0
- package/apps/lib/components/FormBuilder/form-builder.tsx +292 -0
- package/apps/lib/components/FormBuilder/header.tsx +105 -0
- package/apps/lib/components/FormBuilder/index.ts +37 -0
- package/apps/lib/components/FormBuilder/numberFormat.ts +16 -0
- package/apps/lib/components/FormBuilder/stepper.tsx +217 -0
- package/apps/lib/components/FormBuilder/submit.tsx +41 -0
- package/apps/lib/components/FormBuilder/types.ts +264 -0
- package/apps/lib/components/FormBuilder/viewFormat.tsx +137 -0
- package/apps/lib/components/FormRenderer/FormDrawer.tsx +121 -0
- package/apps/lib/components/FormRenderer/form-renderer.tsx +113 -0
- package/apps/lib/components/FormRenderer/index.ts +9 -0
- package/apps/lib/components/FormRenderer/types.ts +79 -0
- package/apps/lib/components/FormStepper.tsx +9 -39
- package/apps/lib/components/FormSummary.tsx +282 -0
- package/apps/lib/components/HeaderBar.tsx +1 -9
- package/apps/lib/components/ImageAttachment.tsx +106 -93
- 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 +61 -58
- 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 +11 -28
- package/apps/lib/components/ScrollArea.tsx +45 -43
- package/apps/lib/components/SearchField.tsx +49 -39
- package/apps/lib/components/SearchableSelect.tsx +16 -16
- 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 +19 -23
- package/apps/lib/components/Select.tsx +80 -186
- 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/{ChartBlockTool.ts ā TextEditor/ChartBlockTool.ts} +17 -52
- package/apps/lib/components/TextEditor/RichTextField.tsx +46 -0
- package/apps/lib/components/{TableDnDWrapper.ts ā TextEditor/TableDnDWrapper.ts} +15 -48
- package/apps/lib/components/{TextEditor.tsx ā TextEditor/TextEditor.tsx} +156 -113
- package/apps/lib/components/TextEditor/TextEditorToolbar.tsx +429 -0
- package/apps/lib/components/TextEditor/editor-tools/AlignmentTune.ts +70 -0
- package/apps/lib/components/TextEditor/editor-tools/ColorInlineTool.ts +50 -0
- package/apps/lib/components/TextEditor/editor-tools/StrikethroughInlineTool.ts +48 -0
- package/apps/lib/components/TextEditor/editor-tools/inlineFormat.ts +98 -0
- package/apps/lib/{types ā components/TextEditor}/editorjs.d.ts +19 -0
- package/apps/lib/components/TextEditor/index.ts +7 -0
- package/apps/lib/{utils ā components/TextEditor}/markdownParser.ts +2 -7
- package/apps/lib/components/Textarea.tsx +9 -13
- 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 +997 -0
- package/apps/lib/tsconfig.json +9 -0
- package/apps/lib/tsconfig.tsbuildinfo +1 -0
- package/apps/lib/utils/cn.ts +1 -1
- package/apps/lib/utils/color.ts +175 -0
- 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/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 +23 -18
- package/docs/components/chart-block-tool.md +129 -0
- package/docs/components/checkbox.md +16 -8
- package/docs/components/cn-layout.md +7 -1
- package/docs/components/color-picker.md +101 -0
- package/docs/components/conclusion-header.md +80 -0
- 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 +161 -135
- 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-builder.md +270 -0
- package/docs/components/form-renderer.md +228 -0
- package/docs/components/form-stepper.md +6 -0
- package/docs/components/form-summary.md +123 -0
- package/docs/components/form.md +17 -20
- package/docs/components/header-bar.md +6 -0
- package/docs/components/image-attachment.md +43 -45
- 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 +107 -0
- package/docs/components/table-view.md +15 -5
- package/docs/components/table.md +28 -28
- package/docs/components/text-editor.md +37 -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/form-and-list-recipes.md +26 -19
- package/docs/how-to/forms-with-form-builder.md +408 -0
- package/docs/how-to/guides.md +177 -197
- 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 +170 -172
- 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
|
@@ -60,13 +60,11 @@ Composition is combining simple components to create more complex ones. Think of
|
|
|
60
60
|
```tsx
|
|
61
61
|
'use client';
|
|
62
62
|
|
|
63
|
-
import {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
toast,
|
|
69
|
-
} from '@torch-ai/torch-glare';
|
|
63
|
+
import { Button } from "@/components/Button";
|
|
64
|
+
import { FieldHint } from "@/components/FieldHint";
|
|
65
|
+
import { LabelField } from "@/components/LabelField";
|
|
66
|
+
import { TextArea } from "@/components/TextArea";
|
|
67
|
+
import { toast } from "@/components/Toast";
|
|
70
68
|
import { useState } from 'react';
|
|
71
69
|
|
|
72
70
|
export default function ContactForm() {
|
|
@@ -136,7 +134,8 @@ export default function ContactForm() {
|
|
|
136
134
|
### Feature Card Component
|
|
137
135
|
|
|
138
136
|
```tsx
|
|
139
|
-
import {
|
|
137
|
+
import { Badge } from "@/components/Badge";
|
|
138
|
+
import { Button } from "@/components/Button";
|
|
140
139
|
|
|
141
140
|
interface FeatureCardProps {
|
|
142
141
|
title: string;
|
|
@@ -167,7 +166,7 @@ export default function FeatureCard({
|
|
|
167
166
|
{title}
|
|
168
167
|
</h3>
|
|
169
168
|
{badge && (
|
|
170
|
-
<Badge theme="light"
|
|
169
|
+
<Badge theme="light" color="gray">
|
|
171
170
|
{badge}
|
|
172
171
|
</Badge>
|
|
173
172
|
)}
|
|
@@ -227,14 +226,10 @@ export default function FeatureCard({
|
|
|
227
226
|
```tsx
|
|
228
227
|
'use client';
|
|
229
228
|
|
|
230
|
-
import {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
Popover,
|
|
235
|
-
PopoverTrigger,
|
|
236
|
-
PopoverContent,
|
|
237
|
-
} from '@torch-ai/torch-glare';
|
|
229
|
+
import { Avatar } from "@/components/Avatar";
|
|
230
|
+
import { Badge } from "@/components/Badge";
|
|
231
|
+
import { Button } from "@/components/Button";
|
|
232
|
+
import { Popover, PopoverTrigger, PopoverContent } from "@/components/Popover";
|
|
238
233
|
|
|
239
234
|
interface User {
|
|
240
235
|
id: string;
|
|
@@ -337,7 +332,7 @@ export default function UserList({ users, onEdit, onDelete }: UserListProps) {
|
|
|
337
332
|
<PopoverTrigger asChild>
|
|
338
333
|
<Button
|
|
339
334
|
theme="light"
|
|
340
|
-
variant="
|
|
335
|
+
variant="PrimeContStyle"
|
|
341
336
|
buttonType="icon"
|
|
342
337
|
size="S"
|
|
343
338
|
>
|
|
@@ -393,20 +388,13 @@ export default function UserList({ users, onEdit, onDelete }: UserListProps) {
|
|
|
393
388
|
'use client';
|
|
394
389
|
|
|
395
390
|
import { useState } from 'react';
|
|
396
|
-
import {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
LabelField,
|
|
404
|
-
TextArea,
|
|
405
|
-
Select,
|
|
406
|
-
SimpleOption,
|
|
407
|
-
Button,
|
|
408
|
-
toast,
|
|
409
|
-
} from '@torch-ai/torch-glare';
|
|
391
|
+
import { Button } from "@/components/Button";
|
|
392
|
+
import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription } from "@/components/Dialog";
|
|
393
|
+
import { LabelField } from "@/components/LabelField";
|
|
394
|
+
import { Select } from "@/components/Select";
|
|
395
|
+
import { SimpleOption } from "@/components/SimpleOption";
|
|
396
|
+
import { TextArea } from "@/components/TextArea";
|
|
397
|
+
import { toast } from "@/components/Toast";
|
|
410
398
|
|
|
411
399
|
export default function CreateProjectModal() {
|
|
412
400
|
const [open, setOpen] = useState(false);
|
|
@@ -509,14 +497,12 @@ export default function CreateProjectModal() {
|
|
|
509
497
|
'use client';
|
|
510
498
|
|
|
511
499
|
import { useState } from 'react';
|
|
512
|
-
import {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
Button,
|
|
519
|
-
} from '@torch-ai/torch-glare';
|
|
500
|
+
import { Badge } from "@/components/Badge";
|
|
501
|
+
import { Button } from "@/components/Button";
|
|
502
|
+
import { InputField } from "@/components/InputField";
|
|
503
|
+
import { Select } from "@/components/Select";
|
|
504
|
+
import { SimpleOption } from "@/components/SimpleOption";
|
|
505
|
+
import { Table } from "@/components/Table";
|
|
520
506
|
|
|
521
507
|
interface TableRow {
|
|
522
508
|
id: string;
|
|
@@ -630,7 +616,7 @@ export default function DataTableWithFilters() {
|
|
|
630
616
|
${row.revenue.toLocaleString()}
|
|
631
617
|
</td>
|
|
632
618
|
<td className="px-4 py-3 text-right">
|
|
633
|
-
<Button theme="light" variant="
|
|
619
|
+
<Button theme="light" variant="PrimeContStyle" size="S">
|
|
634
620
|
View
|
|
635
621
|
</Button>
|
|
636
622
|
</td>
|
|
@@ -661,12 +647,10 @@ export default function DataTableWithFilters() {
|
|
|
661
647
|
```tsx
|
|
662
648
|
'use client';
|
|
663
649
|
|
|
664
|
-
import {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
useTheme,
|
|
669
|
-
} from '@torch-ai/torch-glare';
|
|
650
|
+
import { Avatar } from "@/components/Avatar";
|
|
651
|
+
import { Badge } from "@/components/Badge";
|
|
652
|
+
import { Button } from "@/components/Button";
|
|
653
|
+
import { useTheme } from "@/providers/ThemeProvider";
|
|
670
654
|
import { useState } from 'react';
|
|
671
655
|
|
|
672
656
|
export default function Dashboard() {
|
|
@@ -726,7 +710,7 @@ export default function Dashboard() {
|
|
|
726
710
|
<div className="flex items-center gap-4">
|
|
727
711
|
<Button
|
|
728
712
|
theme={theme as any}
|
|
729
|
-
variant="
|
|
713
|
+
variant="PrimeContStyle"
|
|
730
714
|
buttonType="icon"
|
|
731
715
|
onClick={() => setSidebarOpen(!sidebarOpen)}
|
|
732
716
|
>
|
|
@@ -740,7 +724,7 @@ export default function Dashboard() {
|
|
|
740
724
|
<div className="flex items-center gap-4">
|
|
741
725
|
<Button
|
|
742
726
|
theme={theme as any}
|
|
743
|
-
variant="
|
|
727
|
+
variant="PrimeContStyle"
|
|
744
728
|
buttonType="icon"
|
|
745
729
|
onClick={() => updateTheme(theme === 'light' ? 'dark' : 'light')}
|
|
746
730
|
>
|
|
@@ -780,7 +764,7 @@ export default function Dashboard() {
|
|
|
780
764
|
<p className="typography-display-small-bold text-content-presentation-global-primary mb-2">
|
|
781
765
|
{stat.value}
|
|
782
766
|
</p>
|
|
783
|
-
<Badge theme={theme as any}
|
|
767
|
+
<Badge theme={theme as any} color="green">
|
|
784
768
|
{stat.change}
|
|
785
769
|
</Badge>
|
|
786
770
|
</div>
|
|
@@ -202,8 +202,8 @@ export default function ButtonShowcase() {
|
|
|
202
202
|
return (
|
|
203
203
|
<div className="flex gap-2 flex-wrap">
|
|
204
204
|
<Button variant="PrimeStyle">Primary</Button>
|
|
205
|
-
<Button variant="
|
|
206
|
-
<Button variant="
|
|
205
|
+
<Button variant="PrimeContStyle">Contrast</Button>
|
|
206
|
+
<Button variant="BluSecStyle">Secondary</Button>
|
|
207
207
|
<Button variant="BorderStyle">Outline</Button>
|
|
208
208
|
</div>
|
|
209
209
|
);
|
|
@@ -56,7 +56,7 @@ First, ensure `ThemeProvider` wraps your application:
|
|
|
56
56
|
|
|
57
57
|
```tsx
|
|
58
58
|
// app/layout.tsx
|
|
59
|
-
import { ThemeProvider } from
|
|
59
|
+
import { ThemeProvider } from "@/providers/ThemeProvider";
|
|
60
60
|
|
|
61
61
|
export default function RootLayout({
|
|
62
62
|
children,
|
|
@@ -95,7 +95,8 @@ Let users switch between light and dark modes:
|
|
|
95
95
|
// components/ThemeToggle.tsx
|
|
96
96
|
'use client';
|
|
97
97
|
|
|
98
|
-
import {
|
|
98
|
+
import { Button } from "@/components/Button";
|
|
99
|
+
import { useTheme } from "@/providers/ThemeProvider";
|
|
99
100
|
|
|
100
101
|
export default function ThemeToggle() {
|
|
101
102
|
const { theme, updateTheme } = useTheme();
|
|
@@ -103,7 +104,7 @@ export default function ThemeToggle() {
|
|
|
103
104
|
return (
|
|
104
105
|
<Button
|
|
105
106
|
theme={theme as any}
|
|
106
|
-
variant="
|
|
107
|
+
variant="PrimeContStyle"
|
|
107
108
|
buttonType="icon"
|
|
108
109
|
onClick={() => updateTheme(theme === 'light' ? 'dark' : 'light')}
|
|
109
110
|
aria-label="Toggle theme"
|
|
@@ -119,7 +120,7 @@ export default function ThemeToggle() {
|
|
|
119
120
|
```tsx
|
|
120
121
|
'use client';
|
|
121
122
|
|
|
122
|
-
import { useTheme } from
|
|
123
|
+
import { useTheme } from "@/providers/ThemeProvider";
|
|
123
124
|
|
|
124
125
|
export default function ThemeSelector() {
|
|
125
126
|
const { theme, updateTheme } = useTheme();
|
|
@@ -219,7 +220,7 @@ export default function ThemedCard({
|
|
|
219
220
|
### Theme-Aware Button
|
|
220
221
|
|
|
221
222
|
```tsx
|
|
222
|
-
import { useTheme } from
|
|
223
|
+
import { useTheme } from "@/providers/ThemeProvider";
|
|
223
224
|
|
|
224
225
|
export default function CustomButton({
|
|
225
226
|
children,
|
|
@@ -406,7 +407,9 @@ Here's a complete example combining everything:
|
|
|
406
407
|
```tsx
|
|
407
408
|
'use client';
|
|
408
409
|
|
|
409
|
-
import {
|
|
410
|
+
import { Badge } from "@/components/Badge";
|
|
411
|
+
import { Button } from "@/components/Button";
|
|
412
|
+
import { useTheme } from "@/providers/ThemeProvider";
|
|
410
413
|
|
|
411
414
|
export default function ThemedDashboard() {
|
|
412
415
|
const { theme } = useTheme();
|
|
@@ -423,7 +426,7 @@ export default function ThemedDashboard() {
|
|
|
423
426
|
<h1 className="typography-display-medium-bold text-content-presentation-global-primary">
|
|
424
427
|
Dashboard
|
|
425
428
|
</h1>
|
|
426
|
-
<Badge theme={theme as any}
|
|
429
|
+
<Badge theme={theme as any} color="gray">
|
|
427
430
|
{theme} mode
|
|
428
431
|
</Badge>
|
|
429
432
|
</div>
|
|
@@ -503,7 +506,7 @@ export default function ThemedDashboard() {
|
|
|
503
506
|
<Button theme={theme as any} variant="PrimeStyle">
|
|
504
507
|
Create Project
|
|
505
508
|
</Button>
|
|
506
|
-
<Button theme={theme as any} variant="
|
|
509
|
+
<Button theme={theme as any} variant="PrimeContStyle">
|
|
507
510
|
View Reports
|
|
508
511
|
</Button>
|
|
509
512
|
<Button theme={theme as any} variant="BorderStyle">
|
|
@@ -686,7 +689,7 @@ Ensure theme toggle is keyboard accessible:
|
|
|
686
689
|
### Conditional Styling Based on Theme
|
|
687
690
|
|
|
688
691
|
```tsx
|
|
689
|
-
import { useTheme } from
|
|
692
|
+
import { useTheme } from "@/providers/ThemeProvider";
|
|
690
693
|
|
|
691
694
|
function ThemedComponent() {
|
|
692
695
|
const { theme } = useTheme();
|
|
@@ -707,7 +710,7 @@ function ThemedComponent() {
|
|
|
707
710
|
### Theme-Specific Images
|
|
708
711
|
|
|
709
712
|
```tsx
|
|
710
|
-
import { useTheme } from
|
|
713
|
+
import { useTheme } from "@/providers/ThemeProvider";
|
|
711
714
|
|
|
712
715
|
function Logo() {
|
|
713
716
|
const { theme } = useTheme();
|
package/package.json
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "torch-glare",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"description": "A copy-in React component library (TypeScript + Radix UI + Tailwind CSS). Its CLI copies component source directly into your project ā you own the code.",
|
|
7
|
+
"homepage": "https://glare.torchcorp.com",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/torch-corp/torch-glare"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"react",
|
|
14
|
+
"components",
|
|
15
|
+
"ui",
|
|
16
|
+
"component-library",
|
|
17
|
+
"design-system",
|
|
18
|
+
"tailwindcss",
|
|
19
|
+
"radix-ui",
|
|
20
|
+
"typescript",
|
|
21
|
+
"copy-in",
|
|
22
|
+
"cli"
|
|
23
|
+
],
|
|
6
24
|
"files": [
|
|
7
25
|
"dist",
|
|
8
26
|
"apps/lib",
|
|
@@ -18,7 +36,17 @@
|
|
|
18
36
|
},
|
|
19
37
|
"scripts": {
|
|
20
38
|
"build": "tsc -b",
|
|
21
|
-
"
|
|
39
|
+
"registry": "node scripts/bin/generateRegistry/index.js",
|
|
40
|
+
"docs:fix": "node scripts/bin/fixDocs/index.js",
|
|
41
|
+
"check:ai-docs": "node scripts/bin/checkAiDocs/index.js",
|
|
42
|
+
"typecheck": "pnpm -C apps run typecheck",
|
|
43
|
+
"lint": "pnpm -C apps run lint:lib",
|
|
44
|
+
"format": "pnpm -C apps run format",
|
|
45
|
+
"format:check": "pnpm -C apps run format:check",
|
|
46
|
+
"test": "pnpm -C apps run test",
|
|
47
|
+
"mcp:build": "pnpm -C mcp install && pnpm -C mcp run build",
|
|
48
|
+
"prepare": "pnpm -C mcp install && pnpm -C mcp run build",
|
|
49
|
+
"deploy": "pnpm run registry && npx tsc --build --force && npm publish --access public"
|
|
22
50
|
},
|
|
23
51
|
"dependencies": {
|
|
24
52
|
"commander": "^13.1.0",
|
|
@@ -29,4 +57,4 @@
|
|
|
29
57
|
"@types/node": "^22.14.0",
|
|
30
58
|
"typescript": "^5.0.0"
|
|
31
59
|
}
|
|
32
|
-
}
|
|
60
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../cli/src/commands/block.ts"],"names":[],"mappings":"AA6MA;;GAEG;AACH,wBAAsB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,OAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA2FtF"}
|
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import inquirer from "inquirer";
|
|
4
|
-
import { execSync } from "child_process";
|
|
5
|
-
import { fileURLToPath } from "url";
|
|
6
|
-
import { ensureDirectoryExists } from "../shared/ensureDirectoryExists.js";
|
|
7
|
-
import { getConfig } from "../shared/getConfig.js";
|
|
8
|
-
import { CONFIG_FILE } from "./init.js";
|
|
9
|
-
import { add } from "./add.js";
|
|
10
|
-
import { addUtil } from "./utils.js";
|
|
11
|
-
import { detectPackageManager } from "../shared/detectPackageManager.js";
|
|
12
|
-
import { getInstallCommand } from "../shared/getInstallCommand.js";
|
|
13
|
-
import { getCurrentInstalledDependencies } from "../shared/getCurrentInstalledDependencies.js";
|
|
14
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
-
const __dirname = path.dirname(__filename);
|
|
16
|
-
// Define the path to the blocks templates directory
|
|
17
|
-
const blocksTemplatesDir = path.resolve(__dirname, "../../../apps/lib/blocks");
|
|
18
|
-
// Required dependencies for each block
|
|
19
|
-
const BLOCK_DEPENDENCIES = {
|
|
20
|
-
DataViewPage: {
|
|
21
|
-
components: [
|
|
22
|
-
"Button",
|
|
23
|
-
"Table",
|
|
24
|
-
"Card",
|
|
25
|
-
"Input",
|
|
26
|
-
"Popover",
|
|
27
|
-
"Badge",
|
|
28
|
-
"Checkbox",
|
|
29
|
-
"Select",
|
|
30
|
-
"ButtonGroup",
|
|
31
|
-
"Skeleton",
|
|
32
|
-
],
|
|
33
|
-
utils: ["cn", "types"],
|
|
34
|
-
npmPackages: [
|
|
35
|
-
"@dnd-kit/core",
|
|
36
|
-
"@dnd-kit/sortable",
|
|
37
|
-
"@dnd-kit/utilities",
|
|
38
|
-
"@radix-ui/react-dialog",
|
|
39
|
-
"@tanstack/react-query",
|
|
40
|
-
],
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Get a list of available blocks from the blocks templates directory.
|
|
45
|
-
*/
|
|
46
|
-
function getAvailableBlocks() {
|
|
47
|
-
if (!fs.existsSync(blocksTemplatesDir)) {
|
|
48
|
-
return [];
|
|
49
|
-
}
|
|
50
|
-
return fs.readdirSync(blocksTemplatesDir, { withFileTypes: true })
|
|
51
|
-
.filter((dirent) => dirent.isDirectory())
|
|
52
|
-
.map((dirent) => dirent.name);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Prompt the user to select a block from a list.
|
|
56
|
-
*/
|
|
57
|
-
async function promptBlockSelection(availableBlocks) {
|
|
58
|
-
if (availableBlocks.length === 0) {
|
|
59
|
-
console.error("ā No blocks available.");
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
const { selectedBlock } = await inquirer.prompt([
|
|
63
|
-
{
|
|
64
|
-
type: "list",
|
|
65
|
-
name: "selectedBlock",
|
|
66
|
-
message: "Which block would you like to add?",
|
|
67
|
-
choices: availableBlocks.map((block) => ({
|
|
68
|
-
name: `${block} - Ready-to-use page template`,
|
|
69
|
-
value: block,
|
|
70
|
-
})),
|
|
71
|
-
},
|
|
72
|
-
]);
|
|
73
|
-
return selectedBlock;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Copy a directory recursively (simple version without dependency resolution)
|
|
77
|
-
*/
|
|
78
|
-
function copyBlockDirectory(source, target) {
|
|
79
|
-
if (!fs.existsSync(target)) {
|
|
80
|
-
fs.mkdirSync(target, { recursive: true });
|
|
81
|
-
}
|
|
82
|
-
const entries = fs.readdirSync(source, { withFileTypes: true });
|
|
83
|
-
for (const entry of entries) {
|
|
84
|
-
const srcPath = path.join(source, entry.name);
|
|
85
|
-
const destPath = path.join(target, entry.name);
|
|
86
|
-
if (entry.isDirectory()) {
|
|
87
|
-
copyBlockDirectory(srcPath, destPath);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
fs.copyFileSync(srcPath, destPath);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Update import paths in copied block files to use relative paths
|
|
96
|
-
* From blocks/DataViewPage/ to components/ and utils/
|
|
97
|
-
*/
|
|
98
|
-
function updateImportPaths(targetDir) {
|
|
99
|
-
const processFile = (filePath, depth) => {
|
|
100
|
-
let content = fs.readFileSync(filePath, "utf-8");
|
|
101
|
-
// Calculate relative path prefix based on depth
|
|
102
|
-
// depth 0 = blocks/DataViewPage/*.tsx -> ../../
|
|
103
|
-
// depth 1 = blocks/DataViewPage/views/*.tsx -> ../../../
|
|
104
|
-
const basePrefix = "../".repeat(depth + 2);
|
|
105
|
-
// Replace ../../utils/ and ../../../utils/ with relative path
|
|
106
|
-
content = content.replace(/from ["']\.\.\/\.\.\/utils\//g, `from "${basePrefix}utils/`);
|
|
107
|
-
content = content.replace(/from ["']\.\.\/\.\.\/\.\.\/utils\//g, `from "${basePrefix}utils/`);
|
|
108
|
-
// Replace ../../components/ and ../../../components/ with relative path
|
|
109
|
-
content = content.replace(/from ["']\.\.\/\.\.\/components\//g, `from "${basePrefix}components/`);
|
|
110
|
-
content = content.replace(/from ["']\.\.\/\.\.\/\.\.\/components\//g, `from "${basePrefix}components/`);
|
|
111
|
-
fs.writeFileSync(filePath, content, "utf-8");
|
|
112
|
-
};
|
|
113
|
-
const walkDir = (dir, depth = 0) => {
|
|
114
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
115
|
-
for (const entry of entries) {
|
|
116
|
-
const fullPath = path.join(dir, entry.name);
|
|
117
|
-
if (entry.isDirectory()) {
|
|
118
|
-
walkDir(fullPath, depth + 1);
|
|
119
|
-
}
|
|
120
|
-
else if (entry.name.endsWith(".tsx") || entry.name.endsWith(".ts")) {
|
|
121
|
-
processFile(fullPath, depth);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
walkDir(targetDir);
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Install required npm packages for a block
|
|
129
|
-
*/
|
|
130
|
-
function installNpmPackages(packages) {
|
|
131
|
-
if (packages.length === 0)
|
|
132
|
-
return;
|
|
133
|
-
// Get currently installed dependencies
|
|
134
|
-
const { depsNames } = getCurrentInstalledDependencies();
|
|
135
|
-
// Filter out already installed packages
|
|
136
|
-
const packagesToInstall = packages.filter((pkg) => !depsNames.has(pkg));
|
|
137
|
-
if (packagesToInstall.length === 0) {
|
|
138
|
-
console.log("ā
All npm packages are already installed.");
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const packageManager = detectPackageManager();
|
|
142
|
-
const installCommand = getInstallCommand(packageManager, new Set(packagesToInstall));
|
|
143
|
-
console.log(`š¦ Installing npm packages using ${packageManager}:`, packagesToInstall.join(", "));
|
|
144
|
-
try {
|
|
145
|
-
execSync(installCommand, { stdio: "inherit" });
|
|
146
|
-
console.log("ā
npm packages installed successfully.");
|
|
147
|
-
}
|
|
148
|
-
catch (error) {
|
|
149
|
-
console.error("ā Error installing npm packages:", error.message);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Install required components for a block
|
|
154
|
-
*/
|
|
155
|
-
async function installBlockDependencies(blockName) {
|
|
156
|
-
const deps = BLOCK_DEPENDENCIES[blockName];
|
|
157
|
-
if (!deps)
|
|
158
|
-
return;
|
|
159
|
-
console.log("\nš¦ Installing required components and packages...");
|
|
160
|
-
// Install npm packages first
|
|
161
|
-
installNpmPackages(deps.npmPackages);
|
|
162
|
-
// Install utils
|
|
163
|
-
for (const util of deps.utils) {
|
|
164
|
-
await addUtil(`${util}.ts`);
|
|
165
|
-
}
|
|
166
|
-
// Install components
|
|
167
|
-
for (const component of deps.components) {
|
|
168
|
-
await add(`${component}.tsx`);
|
|
169
|
-
}
|
|
170
|
-
console.log("ā
Dependencies installed.\n");
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Main function to add a block and its dependencies.
|
|
174
|
-
*/
|
|
175
|
-
export async function addBlock(block, replace = false) {
|
|
176
|
-
const targetFile = getConfig(CONFIG_FILE);
|
|
177
|
-
const availableBlocks = getAvailableBlocks();
|
|
178
|
-
if (availableBlocks.length === 0) {
|
|
179
|
-
console.error("ā No blocks found in the template directory.");
|
|
180
|
-
console.log("Blocks directory:", blocksTemplatesDir);
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
// If no block is provided, prompt the user to select one
|
|
184
|
-
if (!block) {
|
|
185
|
-
block = await promptBlockSelection(availableBlocks);
|
|
186
|
-
}
|
|
187
|
-
// Validate if the block exists in the blocks templates directory
|
|
188
|
-
if (!availableBlocks.includes(block)) {
|
|
189
|
-
console.error(`ā Block "${block}" not found.`);
|
|
190
|
-
console.log(`Available blocks: ${availableBlocks.join(", ")}`);
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
// Get source and target paths
|
|
194
|
-
const source = path.join(blocksTemplatesDir, block);
|
|
195
|
-
const targetDir = path.join(targetFile.path, "blocks", block);
|
|
196
|
-
// Check if block already exists
|
|
197
|
-
if (fs.existsSync(targetDir) && !replace) {
|
|
198
|
-
const { shouldReplace } = await inquirer.prompt([
|
|
199
|
-
{
|
|
200
|
-
type: "confirm",
|
|
201
|
-
name: "shouldReplace",
|
|
202
|
-
message: `Block "${block}" already exists. Do you want to replace it?`,
|
|
203
|
-
default: false,
|
|
204
|
-
},
|
|
205
|
-
]);
|
|
206
|
-
if (!shouldReplace) {
|
|
207
|
-
console.log("ā ļø Installation cancelled.");
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
console.log(`\nš¦ Installing ${block} block...`);
|
|
212
|
-
// Install required components first
|
|
213
|
-
await installBlockDependencies(block);
|
|
214
|
-
// Ensure the target directory exists
|
|
215
|
-
ensureDirectoryExists(path.join(targetFile.path, "blocks"));
|
|
216
|
-
// Copy the block directory
|
|
217
|
-
copyBlockDirectory(source, targetDir);
|
|
218
|
-
// Update import paths to use relative paths
|
|
219
|
-
updateImportPaths(targetDir);
|
|
220
|
-
console.log(`\nā
${block} has been added to ${targetFile.path}/blocks/${block}/`);
|
|
221
|
-
console.log(`\nš Usage example:`);
|
|
222
|
-
console.log(`
|
|
223
|
-
import { DataViewPage } from "@/blocks/${block}";
|
|
224
|
-
|
|
225
|
-
function MyPage() {
|
|
226
|
-
return (
|
|
227
|
-
<DataViewPage
|
|
228
|
-
data={data}
|
|
229
|
-
columns={columns}
|
|
230
|
-
defaultView="table"
|
|
231
|
-
>
|
|
232
|
-
<DataViewPage.Toolbar>
|
|
233
|
-
<DataViewPage.Search placeholder="Search..." />
|
|
234
|
-
<DataViewPage.Filters>
|
|
235
|
-
<DataViewPage.FilterItem field="status" label="Status" options={statusOptions} />
|
|
236
|
-
</DataViewPage.Filters>
|
|
237
|
-
<DataViewPage.ViewToggle views={["table", "cards", "kanban"]} />
|
|
238
|
-
</DataViewPage.Toolbar>
|
|
239
|
-
|
|
240
|
-
<DataViewPage.Content>
|
|
241
|
-
<DataViewPage.TableView />
|
|
242
|
-
<DataViewPage.CardsView />
|
|
243
|
-
<DataViewPage.KanbanView groupByField="status" columns={kanbanColumns} />
|
|
244
|
-
</DataViewPage.Content>
|
|
245
|
-
|
|
246
|
-
<DataViewPage.Pagination />
|
|
247
|
-
<DataViewPage.DetailDrawer>
|
|
248
|
-
{(item) => <ItemDetails item={item} />}
|
|
249
|
-
</DataViewPage.DetailDrawer>
|
|
250
|
-
</DataViewPage>
|
|
251
|
-
);
|
|
252
|
-
}
|
|
253
|
-
`);
|
|
254
|
-
}
|
|
255
|
-
//# sourceMappingURL=block.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block.js","sourceRoot":"","sources":["../../../cli/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