gladvn 0.2.16 → 0.2.18
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/bin/cli.js +9 -6
- package/dist/components/macro/accordion-preset.d.ts.map +1 -1
- package/dist/components/macro/alert-dialog-preset.d.ts.map +1 -1
- package/dist/components/macro/alert-preset.d.ts.map +1 -1
- package/dist/components/macro/avatar-preset.d.ts.map +1 -1
- package/dist/components/macro/breadcrumb-preset.d.ts.map +1 -1
- package/dist/components/macro/card-preset.d.ts.map +1 -1
- package/dist/components/macro/carousel-preset.d.ts.map +1 -1
- package/dist/components/macro/checkbox-preset.d.ts.map +1 -1
- package/dist/components/macro/combobox-preset.d.ts.map +1 -1
- package/dist/components/macro/command-preset.d.ts +1 -1
- package/dist/components/macro/command-preset.d.ts.map +1 -1
- package/dist/components/macro/date-picker.d.ts.map +1 -1
- package/dist/components/macro/dialog-preset.d.ts.map +1 -1
- package/dist/components/macro/empty-preset.d.ts.map +1 -1
- package/dist/components/macro/field-preset.d.ts.map +1 -1
- package/dist/components/macro/input-otp-preset.d.ts +6 -0
- package/dist/components/macro/input-otp-preset.d.ts.map +1 -1
- package/dist/components/macro/input-preset.d.ts +1 -1
- package/dist/components/macro/input-preset.d.ts.map +1 -1
- package/dist/components/macro/pagination-preset.d.ts.map +1 -1
- package/dist/components/macro/progress-preset.d.ts.map +1 -1
- package/dist/components/macro/radio-group-preset.d.ts.map +1 -1
- package/dist/components/macro/select-preset.d.ts.map +1 -1
- package/dist/components/macro/slider-preset.d.ts.map +1 -1
- package/dist/components/macro/switch-preset.d.ts.map +1 -1
- package/dist/components/macro/tabs-preset.d.ts +1 -1
- package/dist/components/macro/tabs-preset.d.ts.map +1 -1
- package/dist/components/macro/textarea-preset.d.ts +1 -1
- package/dist/components/macro/textarea-preset.d.ts.map +1 -1
- package/dist/components/micro/accordion.d.ts +7 -0
- package/dist/components/micro/accordion.d.ts.map +1 -1
- package/dist/components/micro/alert-dialog.d.ts.map +1 -1
- package/dist/components/micro/alert.d.ts +7 -0
- package/dist/components/micro/alert.d.ts.map +1 -1
- package/dist/components/micro/aspect-ratio.d.ts +7 -0
- package/dist/components/micro/aspect-ratio.d.ts.map +1 -1
- package/dist/components/micro/avatar.d.ts.map +1 -1
- package/dist/components/micro/badge.d.ts +8 -1
- package/dist/components/micro/badge.d.ts.map +1 -1
- package/dist/components/micro/breadcrumb.d.ts +7 -0
- package/dist/components/micro/breadcrumb.d.ts.map +1 -1
- package/dist/components/micro/button.d.ts +8 -1
- package/dist/components/micro/button.d.ts.map +1 -1
- package/dist/components/micro/calendar.d.ts +2 -2
- package/dist/components/micro/calendar.d.ts.map +1 -1
- package/dist/components/micro/carousel.d.ts.map +1 -1
- package/dist/components/micro/chart.d.ts.map +1 -1
- package/dist/components/micro/checkbox.d.ts.map +1 -1
- package/dist/components/micro/collapsible.d.ts.map +1 -1
- package/dist/components/micro/combobox.d.ts.map +1 -1
- package/dist/components/micro/command.d.ts.map +1 -1
- package/dist/components/micro/context-menu.d.ts.map +1 -1
- package/dist/components/micro/dialog.d.ts.map +1 -1
- package/dist/components/micro/drawer.d.ts.map +1 -1
- package/dist/components/micro/dropdown-menu.d.ts.map +1 -1
- package/dist/components/micro/empty.d.ts +7 -0
- package/dist/components/micro/empty.d.ts.map +1 -1
- package/dist/components/micro/field.d.ts.map +1 -1
- package/dist/components/micro/hover-card.d.ts +1 -1
- package/dist/components/micro/hover-card.d.ts.map +1 -1
- package/dist/components/micro/input-group.d.ts.map +1 -1
- package/dist/components/micro/input-otp.d.ts.map +1 -1
- package/dist/components/micro/input.d.ts +7 -0
- package/dist/components/micro/input.d.ts.map +1 -1
- package/dist/components/micro/item.d.ts.map +1 -1
- package/dist/components/micro/label.d.ts.map +1 -1
- package/dist/components/micro/menubar.d.ts.map +1 -1
- package/dist/components/micro/navigation-menu.d.ts +8 -1
- package/dist/components/micro/navigation-menu.d.ts.map +1 -1
- package/dist/components/micro/pagination.d.ts.map +1 -1
- package/dist/components/micro/popover.d.ts.map +1 -1
- package/dist/components/micro/progress.d.ts.map +1 -1
- package/dist/components/micro/radio-group.d.ts.map +1 -1
- package/dist/components/micro/select.d.ts +1 -1
- package/dist/components/micro/select.d.ts.map +1 -1
- package/dist/components/micro/sheet.d.ts.map +1 -1
- package/dist/components/micro/sidebar.d.ts.map +1 -1
- package/dist/components/micro/skeleton.d.ts +7 -0
- package/dist/components/micro/skeleton.d.ts.map +1 -1
- package/dist/components/micro/slider.d.ts +7 -0
- package/dist/components/micro/slider.d.ts.map +1 -1
- package/dist/components/micro/sonner.d.ts.map +1 -1
- package/dist/components/micro/spinner.d.ts.map +1 -1
- package/dist/components/micro/switch.d.ts.map +1 -1
- package/dist/components/micro/table.d.ts.map +1 -1
- package/dist/components/micro/tabs.d.ts +1 -1
- package/dist/components/micro/tabs.d.ts.map +1 -1
- package/dist/components/micro/textarea.d.ts +7 -0
- package/dist/components/micro/textarea.d.ts.map +1 -1
- package/dist/components/micro/toggle-group.d.ts.map +1 -1
- package/dist/components/micro/toggle.d.ts.map +1 -1
- package/dist/components/micro/tooltip.d.ts +1 -1
- package/dist/components/micro/tooltip.d.ts.map +1 -1
- package/dist/dev/App.d.ts.map +1 -1
- package/dist/dev/components/code-highlighter.d.ts.map +1 -1
- package/dist/dev/components/dev-context.d.ts.map +1 -1
- package/dist/dev/components/showcase.d.ts +1 -1
- package/dist/dev/components/showcase.d.ts.map +1 -1
- package/dist/dev/data.d.ts.map +1 -1
- package/dist/dev/main.d.ts.map +1 -1
- package/dist/dev/sections/buttons.d.ts.map +1 -1
- package/dist/dev/sections/feedback.d.ts.map +1 -1
- package/dist/dev/sections/overview.d.ts.map +1 -1
- package/dist/dev/showcase/accordion.d.ts.map +1 -1
- package/dist/dev/showcase/alert-dialog.d.ts.map +1 -1
- package/dist/dev/showcase/alert.d.ts.map +1 -1
- package/dist/dev/showcase/aspect-ratio.d.ts.map +1 -1
- package/dist/dev/showcase/avatar.d.ts.map +1 -1
- package/dist/dev/showcase/breadcrumb.d.ts.map +1 -1
- package/dist/dev/showcase/button.d.ts.map +1 -1
- package/dist/dev/showcase/calendar.d.ts.map +1 -1
- package/dist/dev/showcase/card.d.ts.map +1 -1
- package/dist/dev/showcase/carousel.d.ts.map +1 -1
- package/dist/dev/showcase/chart.d.ts.map +1 -1
- package/dist/dev/showcase/checkbox.d.ts.map +1 -1
- package/dist/dev/showcase/collapsible.d.ts.map +1 -1
- package/dist/dev/showcase/combobox.d.ts.map +1 -1
- package/dist/dev/showcase/command.d.ts.map +1 -1
- package/dist/dev/showcase/context-menu.d.ts.map +1 -1
- package/dist/dev/showcase/dialog.d.ts.map +1 -1
- package/dist/dev/showcase/drawer.d.ts.map +1 -1
- package/dist/dev/showcase/dropdown-menu.d.ts.map +1 -1
- package/dist/dev/showcase/empty.d.ts.map +1 -1
- package/dist/dev/showcase/hover-card.d.ts.map +1 -1
- package/dist/dev/showcase/input-group.d.ts.map +1 -1
- package/dist/dev/showcase/input-otp.d.ts.map +1 -1
- package/dist/dev/showcase/input.d.ts.map +1 -1
- package/dist/dev/showcase/item.d.ts.map +1 -1
- package/dist/dev/showcase/kbd.d.ts.map +1 -1
- package/dist/dev/showcase/label.d.ts.map +1 -1
- package/dist/dev/showcase/menubar.d.ts.map +1 -1
- package/dist/dev/showcase/navigation-menu.d.ts.map +1 -1
- package/dist/dev/showcase/overview.d.ts.map +1 -1
- package/dist/dev/showcase/pagination.d.ts.map +1 -1
- package/dist/dev/showcase/popover.d.ts.map +1 -1
- package/dist/dev/showcase/progress.d.ts.map +1 -1
- package/dist/dev/showcase/radio-group.d.ts.map +1 -1
- package/dist/dev/showcase/resizable.d.ts.map +1 -1
- package/dist/dev/showcase/scroll-area.d.ts.map +1 -1
- package/dist/dev/showcase/select.d.ts.map +1 -1
- package/dist/dev/showcase/separator.d.ts.map +1 -1
- package/dist/dev/showcase/sheet.d.ts.map +1 -1
- package/dist/dev/showcase/sidebar.d.ts.map +1 -1
- package/dist/dev/showcase/skeleton.d.ts.map +1 -1
- package/dist/dev/showcase/slider.d.ts.map +1 -1
- package/dist/dev/showcase/sonner.d.ts.map +1 -1
- package/dist/dev/showcase/spinner.d.ts.map +1 -1
- package/dist/dev/showcase/switch.d.ts.map +1 -1
- package/dist/dev/showcase/table.d.ts.map +1 -1
- package/dist/dev/showcase/tabs.d.ts.map +1 -1
- package/dist/dev/showcase/textarea.d.ts.map +1 -1
- package/dist/dev/showcase/theme-provider.d.ts.map +1 -1
- package/dist/dev/showcase/toast.d.ts.map +1 -1
- package/dist/dev/showcase/toggle-group.d.ts.map +1 -1
- package/dist/dev/showcase/toggle.d.ts.map +1 -1
- package/dist/dev/showcase/tooltip.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/package.json +3 -1
- package/scripts/format-codestrings.ts +87 -0
- package/scripts/organize-imports.ts +21 -0
- package/scripts/regex-format.cjs +67 -0
- package/scripts/tmp.tsx +25 -0
- package/src/components/macro/accordion-preset.test.tsx +1 -0
- package/src/components/macro/accordion-preset.tsx +2 -1
- package/src/components/macro/alert-dialog-preset.tsx +44 -43
- package/src/components/macro/alert-preset.tsx +7 -3
- package/src/components/macro/avatar-preset.tsx +2 -1
- package/src/components/macro/breadcrumb-preset.tsx +2 -1
- package/src/components/macro/card-preset.tsx +2 -1
- package/src/components/macro/carousel-preset.tsx +5 -2
- package/src/components/macro/checkbox-preset.test.tsx +1 -0
- package/src/components/macro/checkbox-preset.tsx +6 -2
- package/src/components/macro/combobox-preset.tsx +6 -3
- package/src/components/macro/command-preset.tsx +7 -3
- package/src/components/macro/date-picker.tsx +77 -59
- package/src/components/macro/dialog-preset.tsx +42 -38
- package/src/components/macro/empty-preset.tsx +2 -1
- package/src/components/macro/field-preset.test.tsx +1 -0
- package/src/components/macro/field-preset.tsx +2 -1
- package/src/components/macro/input-otp-preset.tsx +6 -2
- package/src/components/macro/input-preset.test.tsx +1 -0
- package/src/components/macro/input-preset.tsx +4 -2
- package/src/components/macro/pagination-preset.tsx +3 -1
- package/src/components/macro/progress-preset.test.tsx +1 -0
- package/src/components/macro/progress-preset.tsx +2 -1
- package/src/components/macro/radio-group-preset.tsx +4 -1
- package/src/components/macro/select-preset.tsx +35 -30
- package/src/components/macro/slider-preset.test.tsx +1 -0
- package/src/components/macro/slider-preset.tsx +4 -1
- package/src/components/macro/switch-preset.test.tsx +1 -0
- package/src/components/macro/switch-preset.tsx +4 -1
- package/src/components/macro/tabs-preset.test.tsx +1 -0
- package/src/components/macro/tabs-preset.tsx +4 -2
- package/src/components/macro/textarea-preset.test.tsx +1 -0
- package/src/components/macro/textarea-preset.tsx +4 -1
- package/src/components/micro/accordion.tsx +3 -2
- package/src/components/micro/alert-dialog.tsx +2 -1
- package/src/components/micro/alert.tsx +3 -2
- package/src/components/micro/aspect-ratio.tsx +2 -1
- package/src/components/micro/avatar.tsx +2 -1
- package/src/components/micro/badge.tsx +3 -3
- package/src/components/micro/breadcrumb.tsx +3 -2
- package/src/components/micro/button.test.tsx +1 -0
- package/src/components/micro/button.tsx +3 -3
- package/src/components/micro/calendar.tsx +10 -9
- package/src/components/micro/carousel.tsx +3 -2
- package/src/components/micro/chart.tsx +1 -0
- package/src/components/micro/checkbox.tsx +2 -2
- package/src/components/micro/collapsible.tsx +4 -2
- package/src/components/micro/combobox.tsx +47 -29
- package/src/components/micro/command.tsx +23 -16
- package/src/components/micro/context-menu.tsx +3 -2
- package/src/components/micro/dialog.tsx +2 -1
- package/src/components/micro/drawer.tsx +2 -1
- package/src/components/micro/dropdown-menu.tsx +3 -2
- package/src/components/micro/empty.tsx +2 -1
- package/src/components/micro/field.tsx +4 -3
- package/src/components/micro/hover-card.tsx +20 -19
- package/src/components/micro/input-group.tsx +5 -4
- package/src/components/micro/input-otp.tsx +3 -2
- package/src/components/micro/input.tsx +3 -2
- package/src/components/micro/item.tsx +1 -0
- package/src/components/micro/label.tsx +2 -1
- package/src/components/micro/menubar.tsx +2 -1
- package/src/components/micro/navigation-menu.tsx +18 -17
- package/src/components/micro/pagination.tsx +2 -1
- package/src/components/micro/popover.tsx +2 -1
- package/src/components/micro/progress.tsx +2 -1
- package/src/components/micro/radio-group.tsx +3 -3
- package/src/components/micro/select.tsx +5 -4
- package/src/components/micro/sheet.tsx +2 -1
- package/src/components/micro/sidebar.tsx +4 -1
- package/src/components/micro/skeleton.tsx +2 -1
- package/src/components/micro/slider.tsx +4 -1
- package/src/components/micro/sonner.tsx +2 -1
- package/src/components/micro/spinner.tsx +1 -2
- package/src/components/micro/switch.tsx +2 -2
- package/src/components/micro/table.tsx +2 -1
- package/src/components/micro/tabs.tsx +4 -3
- package/src/components/micro/textarea.tsx +2 -1
- package/src/components/micro/toggle-group.tsx +1 -0
- package/src/components/micro/toggle.tsx +1 -3
- package/src/components/micro/tooltip.tsx +9 -3
- package/src/dev/App.tsx +66 -41
- package/src/dev/components/code-highlighter.tsx +2 -1
- package/src/dev/components/dev-context.tsx +1 -0
- package/src/dev/components/showcase.tsx +13 -14
- package/src/dev/data.ts +206 -52
- package/src/dev/main.tsx +4 -4
- package/src/dev/sections/buttons.tsx +14 -12
- package/src/dev/sections/feedback.tsx +7 -2
- package/src/dev/sections/forms.tsx +11 -11
- package/src/dev/sections/overview.tsx +2 -1
- package/src/dev/showcase/accordion.tsx +399 -314
- package/src/dev/showcase/alert-dialog.tsx +387 -384
- package/src/dev/showcase/alert.tsx +271 -258
- package/src/dev/showcase/aspect-ratio.tsx +102 -105
- package/src/dev/showcase/avatar.tsx +216 -145
- package/src/dev/showcase/badge.tsx +78 -50
- package/src/dev/showcase/breadcrumb.tsx +88 -85
- package/src/dev/showcase/button.tsx +72 -96
- package/src/dev/showcase/calendar.tsx +41 -39
- package/src/dev/showcase/card.tsx +170 -148
- package/src/dev/showcase/carousel.tsx +239 -77
- package/src/dev/showcase/chart.tsx +5 -4
- package/src/dev/showcase/checkbox.tsx +206 -140
- package/src/dev/showcase/collapsible.tsx +108 -84
- package/src/dev/showcase/combobox.tsx +272 -199
- package/src/dev/showcase/command.tsx +31 -28
- package/src/dev/showcase/context-menu.tsx +94 -77
- package/src/dev/showcase/dialog.tsx +445 -424
- package/src/dev/showcase/drawer.tsx +142 -135
- package/src/dev/showcase/dropdown-menu.tsx +165 -161
- package/src/dev/showcase/empty.tsx +173 -158
- package/src/dev/showcase/hover-card.tsx +92 -52
- package/src/dev/showcase/input-group.tsx +193 -160
- package/src/dev/showcase/input-otp.tsx +109 -99
- package/src/dev/showcase/input.tsx +78 -42
- package/src/dev/showcase/item.tsx +101 -98
- package/src/dev/showcase/kbd.tsx +78 -62
- package/src/dev/showcase/label.tsx +16 -23
- package/src/dev/showcase/menubar.tsx +274 -251
- package/src/dev/showcase/navigation-menu.tsx +175 -170
- package/src/dev/showcase/overview.tsx +164 -148
- package/src/dev/showcase/pagination.tsx +101 -69
- package/src/dev/showcase/popover.tsx +113 -86
- package/src/dev/showcase/progress.tsx +99 -69
- package/src/dev/showcase/radio-group.tsx +217 -134
- package/src/dev/showcase/resizable.tsx +65 -55
- package/src/dev/showcase/scroll-area.tsx +32 -22
- package/src/dev/showcase/select.tsx +192 -136
- package/src/dev/showcase/separator.tsx +28 -24
- package/src/dev/showcase/sheet.tsx +182 -134
- package/src/dev/showcase/sidebar.tsx +9 -5
- package/src/dev/showcase/skeleton.tsx +54 -59
- package/src/dev/showcase/slider.tsx +158 -129
- package/src/dev/showcase/sonner.tsx +3 -5
- package/src/dev/showcase/spinner.tsx +22 -18
- package/src/dev/showcase/switch.tsx +207 -110
- package/src/dev/showcase/table.tsx +44 -32
- package/src/dev/showcase/tabs.tsx +272 -267
- package/src/dev/showcase/textarea.tsx +162 -116
- package/src/dev/showcase/theme-provider.tsx +596 -534
- package/src/dev/showcase/toast.tsx +37 -38
- package/src/dev/showcase/toggle-group.tsx +87 -39
- package/src/dev/showcase/toggle.tsx +36 -27
- package/src/dev/showcase/tooltip.tsx +154 -119
- package/src/lib/utils.test.ts +1 -0
- package/src/lib/utils.ts +1 -1
- package/src/styles/gladvn.css +1 -1
package/dist/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gladvn",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.18",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "DO NOT 'npm install'. Use 'npx gladvn init' instead! A highly composable React component library built with Tailwind CSS.",
|
|
6
6
|
"keywords": [
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@base-ui/react": "^1.6.0",
|
|
73
|
+
"@trivago/prettier-plugin-sort-imports": "^6.0.2",
|
|
73
74
|
"class-variance-authority": "^0.7.1",
|
|
74
75
|
"clsx": "^2.1.1",
|
|
75
76
|
"cmdk": "^1.1.1",
|
|
@@ -78,6 +79,7 @@
|
|
|
78
79
|
"input-otp": "^1.4.2",
|
|
79
80
|
"lucide-react": "^1.24.0",
|
|
80
81
|
"next-themes": "^0.4.6",
|
|
82
|
+
"prettier": "^3.9.6",
|
|
81
83
|
"react-day-picker": "^10.0.1",
|
|
82
84
|
"react-resizable-panels": "^4.12.1",
|
|
83
85
|
"recharts": "^3.9.2",
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Project, SyntaxKind, JsxAttribute, StringLiteral, NoSubstitutionTemplateLiteral } from "ts-morph";
|
|
2
|
+
import * as prettier from "prettier";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
|
|
6
|
+
async function main() {
|
|
7
|
+
const project = new Project({
|
|
8
|
+
tsConfigFilePath: "tsconfig.json",
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
const sourceFiles = project.getSourceFiles("src/dev/showcase/**/*.tsx");
|
|
12
|
+
console.log(`Found ${sourceFiles.length} showcase files to process.`);
|
|
13
|
+
|
|
14
|
+
let modifiedCount = 0;
|
|
15
|
+
|
|
16
|
+
for (const sourceFile of sourceFiles) {
|
|
17
|
+
let fileModified = false;
|
|
18
|
+
|
|
19
|
+
// Find all JSX attributes named 'codeString'
|
|
20
|
+
const jsxAttributes = sourceFile.getDescendantsOfKind(SyntaxKind.JsxAttribute);
|
|
21
|
+
|
|
22
|
+
for (const attr of jsxAttributes) {
|
|
23
|
+
if (attr.asKind(SyntaxKind.JsxAttribute)?.getNameNode().getText() !== "codeString") continue;
|
|
24
|
+
|
|
25
|
+
const initializer = attr.asKind(SyntaxKind.JsxAttribute)?.getInitializer();
|
|
26
|
+
if (!initializer) continue;
|
|
27
|
+
|
|
28
|
+
let rawText = "";
|
|
29
|
+
|
|
30
|
+
// It can be a StringLiteral `<Example codeString="<div/>" />`
|
|
31
|
+
if (initializer.isKind(SyntaxKind.StringLiteral)) {
|
|
32
|
+
rawText = (initializer as StringLiteral).getLiteralText();
|
|
33
|
+
}
|
|
34
|
+
// Or a JSX Expression with a template literal `<Example codeString={`<div/>`} />`
|
|
35
|
+
else if (initializer.isKind(SyntaxKind.JsxExpression)) {
|
|
36
|
+
const expression = initializer.getExpression();
|
|
37
|
+
if (expression && expression.isKind(SyntaxKind.NoSubstitutionTemplateLiteral)) {
|
|
38
|
+
rawText = (expression as NoSubstitutionTemplateLiteral).getLiteralText();
|
|
39
|
+
} else if (expression && expression.isKind(SyntaxKind.StringLiteral)) {
|
|
40
|
+
rawText = (expression as StringLiteral).getLiteralText();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (!rawText) continue;
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
// Wrap in fragment to allow adjacent JSX elements to be parsed by prettier
|
|
48
|
+
const wrappedText = `<>\n${rawText}\n</>`;
|
|
49
|
+
|
|
50
|
+
// Format the wrappedText as JSX/TSX
|
|
51
|
+
let formatted = await prettier.format(wrappedText, {
|
|
52
|
+
parser: "babel-ts",
|
|
53
|
+
printWidth: 60,
|
|
54
|
+
tabWidth: 2,
|
|
55
|
+
semi: false,
|
|
56
|
+
singleQuote: false,
|
|
57
|
+
trailingComma: "all"
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Remove the wrapping fragment (including any leading semicolons injected by prettier) and trim
|
|
61
|
+
formatted = formatted.replace(/^;?\s*<>\n?/, "").replace(/\n?<\/>;?\s*$/, "").trim();
|
|
62
|
+
|
|
63
|
+
if (formatted !== rawText.trim()) {
|
|
64
|
+
// Replace the initializer with the new formatted template literal
|
|
65
|
+
// Note: we use JSON.stringify or manual escaping if needed, but since it's a template literal
|
|
66
|
+
// we need to escape backticks and ${
|
|
67
|
+
const escaped = formatted.replace(/`/g, '\\`').replace(/\$\{/g, '\\${');
|
|
68
|
+
attr.setInitializer(`{\`${escaped}\`}`);
|
|
69
|
+
fileModified = true;
|
|
70
|
+
}
|
|
71
|
+
} catch (err) {
|
|
72
|
+
console.error(`Failed to format codeString in ${sourceFile.getFilePath()} at line ${attr.getStartLineNumber()}`);
|
|
73
|
+
console.error(err);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (fileModified) {
|
|
78
|
+
sourceFile.saveSync();
|
|
79
|
+
modifiedCount++;
|
|
80
|
+
console.log(`Modified ${sourceFile.getBaseName()}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
console.log(`Successfully formatted codeStrings in ${modifiedCount} files.`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Project } from "ts-morph";
|
|
2
|
+
|
|
3
|
+
const project = new Project({
|
|
4
|
+
tsConfigFilePath: "tsconfig.json",
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
const files = project.getSourceFiles("src/**/*.{ts,tsx}");
|
|
8
|
+
console.log(`Found ${files.length} files. Organizing imports...`);
|
|
9
|
+
|
|
10
|
+
let updatedCount = 0;
|
|
11
|
+
|
|
12
|
+
for (const file of files) {
|
|
13
|
+
const originalText = file.getFullText();
|
|
14
|
+
file.organizeImports();
|
|
15
|
+
if (file.getFullText() !== originalText) {
|
|
16
|
+
updatedCount++;
|
|
17
|
+
await file.save();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
console.log(`Done! Organized imports in ${updatedCount} files.`);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
async function main() {
|
|
5
|
+
const showcaseDir = path.join(__dirname, '../src/dev/showcase');
|
|
6
|
+
const files = fs.readdirSync(showcaseDir).filter(f => f.endsWith('.tsx'));
|
|
7
|
+
|
|
8
|
+
let modifiedCount = 0;
|
|
9
|
+
|
|
10
|
+
for (const file of files) {
|
|
11
|
+
const filePath = path.join(showcaseDir, file);
|
|
12
|
+
let content = fs.readFileSync(filePath, 'utf8');
|
|
13
|
+
let fileModified = false;
|
|
14
|
+
|
|
15
|
+
// Regex to find codeString={`...`}
|
|
16
|
+
// Using a loop to find all matches since there could be multiple per file
|
|
17
|
+
const regex = /codeString=\{\`([\s\S]*?)\`\}/g;
|
|
18
|
+
|
|
19
|
+
// We need to do replacement asynchronously because prettier.format is async
|
|
20
|
+
const replacements = [];
|
|
21
|
+
let match;
|
|
22
|
+
while ((match = regex.exec(content)) !== null) {
|
|
23
|
+
const fullMatch = match[0];
|
|
24
|
+
const rawText = match[1];
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const wrappedText = `<>\n${rawText}\n</>`;
|
|
28
|
+
// Use execSync to run npx prettier
|
|
29
|
+
const tmpFile = path.join(__dirname, 'tmp.tsx');
|
|
30
|
+
fs.writeFileSync(tmpFile, wrappedText, 'utf8');
|
|
31
|
+
let formatted = require('child_process').execSync('npx prettier --parser babel-ts --print-width 60 --tab-width 2 --no-semi --trailing-comma all ' + tmpFile, { encoding: 'utf8' });
|
|
32
|
+
fs.unlinkSync(tmpFile);
|
|
33
|
+
|
|
34
|
+
// Strip leading semicolons and <> tags
|
|
35
|
+
formatted = formatted.replace(/^;?\s*<>\n?/, "").replace(/\n?<\/>;?\s*$/, "").trim();
|
|
36
|
+
|
|
37
|
+
if (formatted !== rawText.trim()) {
|
|
38
|
+
const escaped = formatted.replace(/`/g, '\\`').replace(/\$\{/g, '\\${');
|
|
39
|
+
replacements.push({
|
|
40
|
+
start: match.index,
|
|
41
|
+
end: match.index + fullMatch.length,
|
|
42
|
+
newText: `codeString={\`${escaped}\`}`
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.error(`Failed formatting in ${file}: ${err.message}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Apply replacements from back to front to not mess up indices
|
|
51
|
+
for (let i = replacements.length - 1; i >= 0; i--) {
|
|
52
|
+
const { start, end, newText } = replacements[i];
|
|
53
|
+
content = content.slice(0, start) + newText + content.slice(end);
|
|
54
|
+
fileModified = true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (fileModified) {
|
|
58
|
+
fs.writeFileSync(filePath, content, 'utf8');
|
|
59
|
+
modifiedCount++;
|
|
60
|
+
console.log(`Modified ${file}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
console.log(`Successfully formatted codeStrings in ${modifiedCount} files.`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
main().catch(console.error);
|
package/scripts/tmp.tsx
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<>
|
|
2
|
+
<AccordionPreset
|
|
3
|
+
className="w-full"
|
|
4
|
+
multiple
|
|
5
|
+
defaultValue={["item-1", "item-2"]}
|
|
6
|
+
items={[
|
|
7
|
+
{
|
|
8
|
+
value: "item-1",
|
|
9
|
+
title: "Is it accessible?",
|
|
10
|
+
content: "Yes. It adheres to the WAI-ARIA design pattern. Keyboard navigation and screen readers are fully supported.",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
value: "item-2",
|
|
14
|
+
title: "Is it styled?",
|
|
15
|
+
content: "Yes. It comes with default styles that match the other components' aesthetic.",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: "item-3",
|
|
19
|
+
title: "Is it animated?",
|
|
20
|
+
content: "Yes. It's animated by default with smooth transitions.",
|
|
21
|
+
},
|
|
22
|
+
]}
|
|
23
|
+
/>
|
|
24
|
+
|
|
25
|
+
</>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
Accordion,
|
|
3
5
|
AccordionContent,
|
|
4
6
|
AccordionItem,
|
|
5
7
|
AccordionTrigger,
|
|
6
8
|
} from "../../components/micro/accordion";
|
|
7
|
-
import * as React from "react";
|
|
8
9
|
|
|
9
10
|
export interface AccordionPresetItem {
|
|
10
11
|
value: string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
3
5
|
import {
|
|
4
6
|
AlertDialog,
|
|
5
7
|
AlertDialogAction,
|
|
@@ -9,14 +11,13 @@ import {
|
|
|
9
11
|
AlertDialogFooter,
|
|
10
12
|
AlertDialogHeader,
|
|
11
13
|
AlertDialogMedia,
|
|
14
|
+
AlertDialogPortal,
|
|
12
15
|
AlertDialogTitle,
|
|
13
16
|
AlertDialogTrigger,
|
|
14
|
-
AlertDialogPortal,
|
|
15
17
|
} from "../../components/micro/alert-dialog";
|
|
16
18
|
import { ThemeWrapper } from "../../components/micro/theme-provider";
|
|
17
19
|
import { type Color, type Size, type Variant } from "../../lib/types";
|
|
18
20
|
import { cn } from "../../lib/utils";
|
|
19
|
-
import * as React from "react";
|
|
20
21
|
|
|
21
22
|
type AlertDialogPresetProps = Omit<
|
|
22
23
|
React.ComponentProps<typeof AlertDialog>,
|
|
@@ -62,48 +63,48 @@ function AlertDialogPreset({
|
|
|
62
63
|
<ThemeWrapper>
|
|
63
64
|
<AlertDialogContent size={size}>
|
|
64
65
|
<div
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
66
|
+
className={cn("flex flex-col gap-1.5", {
|
|
67
|
+
"sm:flex-row sm:gap-4": !!icon,
|
|
68
|
+
})}
|
|
69
|
+
>
|
|
70
|
+
{icon && (
|
|
71
|
+
<AlertDialogMedia className="mx-auto mb-2 shrink-0 sm:mx-0 sm:mb-0">
|
|
72
|
+
{icon}
|
|
73
|
+
</AlertDialogMedia>
|
|
74
|
+
)}
|
|
75
|
+
<AlertDialogHeader>
|
|
76
|
+
{title && <AlertDialogTitle>{title}</AlertDialogTitle>}
|
|
77
|
+
{description && (
|
|
78
|
+
<AlertDialogDescription>{description}</AlertDialogDescription>
|
|
79
|
+
)}
|
|
80
|
+
{children}
|
|
81
|
+
</AlertDialogHeader>
|
|
82
|
+
</div>
|
|
83
|
+
{(cancelLabel || actionLabel) && (
|
|
84
|
+
<AlertDialogFooter className="group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 group-data-[size=sm]/alert-dialog-content:sm:flex group-data-[size=sm]/alert-dialog-content:sm:justify-end">
|
|
85
|
+
{cancelLabel && (
|
|
86
|
+
<AlertDialogCancel
|
|
87
|
+
size={size}
|
|
88
|
+
color={cancelColor}
|
|
89
|
+
variant={cancelVariant}
|
|
90
|
+
onClick={onCancel}
|
|
91
|
+
>
|
|
92
|
+
{cancelLabel}
|
|
93
|
+
</AlertDialogCancel>
|
|
94
|
+
)}
|
|
95
|
+
{actionLabel && (
|
|
96
|
+
<AlertDialogAction
|
|
97
|
+
size={size}
|
|
98
|
+
color={actionColor}
|
|
99
|
+
variant={actionVariant}
|
|
100
|
+
onClick={onAction}
|
|
101
|
+
>
|
|
102
|
+
{actionLabel}
|
|
103
|
+
</AlertDialogAction>
|
|
104
|
+
)}
|
|
105
|
+
</AlertDialogFooter>
|
|
103
106
|
)}
|
|
104
|
-
</
|
|
105
|
-
)}
|
|
106
|
-
</AlertDialogContent>
|
|
107
|
+
</AlertDialogContent>
|
|
107
108
|
</ThemeWrapper>
|
|
108
109
|
</AlertDialogPortal>
|
|
109
110
|
</AlertDialog>
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { XIcon } from "lucide-react";
|
|
6
|
+
|
|
1
7
|
import {
|
|
2
8
|
Alert,
|
|
3
9
|
AlertAction,
|
|
4
10
|
AlertDescription,
|
|
5
11
|
AlertIcon,
|
|
6
|
-
AlertTitle,
|
|
7
12
|
type AlertProps,
|
|
13
|
+
AlertTitle,
|
|
8
14
|
} from "../../components/micro/alert";
|
|
9
15
|
import { Button } from "../../components/micro/button";
|
|
10
16
|
import { cn } from "../../lib/utils";
|
|
11
|
-
import { XIcon } from "lucide-react";
|
|
12
|
-
import * as React from "react";
|
|
13
17
|
|
|
14
18
|
export type AlertPresetProps = AlertProps & {
|
|
15
19
|
title?: React.ReactNode;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
Avatar,
|
|
3
5
|
AvatarBadge,
|
|
4
6
|
AvatarFallback,
|
|
5
7
|
AvatarImage,
|
|
6
8
|
} from "../../components/micro/avatar";
|
|
7
|
-
import * as React from "react";
|
|
8
9
|
|
|
9
10
|
export type AvatarPresetProps = React.ComponentProps<typeof Avatar> & {
|
|
10
11
|
src?: string;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
Breadcrumb,
|
|
3
5
|
BreadcrumbItem,
|
|
@@ -6,7 +8,6 @@ import {
|
|
|
6
8
|
BreadcrumbPage,
|
|
7
9
|
BreadcrumbSeparator,
|
|
8
10
|
} from "../../components/micro/breadcrumb";
|
|
9
|
-
import * as React from "react";
|
|
10
11
|
|
|
11
12
|
export interface BreadcrumbPresetItem {
|
|
12
13
|
label: React.ReactNode;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
Card,
|
|
3
5
|
CardContent,
|
|
@@ -6,7 +8,6 @@ import {
|
|
|
6
8
|
CardHeader,
|
|
7
9
|
CardTitle,
|
|
8
10
|
} from "../../components/micro/card";
|
|
9
|
-
import * as React from "react";
|
|
10
11
|
|
|
11
12
|
export type CardPresetProps = Omit<
|
|
12
13
|
React.ComponentProps<typeof Card>,
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
1
5
|
import {
|
|
2
6
|
Carousel,
|
|
7
|
+
type CarouselApi,
|
|
3
8
|
CarouselContent,
|
|
4
9
|
CarouselDots,
|
|
5
10
|
CarouselItem,
|
|
6
11
|
CarouselNext,
|
|
7
12
|
CarouselPrevious,
|
|
8
|
-
type CarouselApi,
|
|
9
13
|
} from "../../components/micro/carousel";
|
|
10
14
|
import { cn } from "../../lib/utils";
|
|
11
|
-
import * as React from "react";
|
|
12
15
|
|
|
13
16
|
export type CarouselPresetProps = Omit<
|
|
14
17
|
React.ComponentProps<typeof Carousel>,
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
import { CheckIcon } from "lucide-react";
|
|
6
|
+
|
|
1
7
|
import { Checkbox, CheckboxIndicator } from "../../components/micro/checkbox";
|
|
2
8
|
import {
|
|
3
9
|
Field,
|
|
@@ -7,8 +13,6 @@ import {
|
|
|
7
13
|
} from "../../components/micro/field";
|
|
8
14
|
import { type Size } from "../../lib/types";
|
|
9
15
|
import { cn } from "../../lib/utils";
|
|
10
|
-
import { CheckIcon } from "lucide-react";
|
|
11
|
-
import * as React from "react";
|
|
12
16
|
|
|
13
17
|
export type CheckboxPresetProps = Omit<
|
|
14
18
|
React.ComponentProps<typeof Checkbox>,
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
1
5
|
import {
|
|
2
6
|
Combobox,
|
|
3
7
|
ComboboxClear,
|
|
@@ -7,18 +11,17 @@ import {
|
|
|
7
11
|
ComboboxInput,
|
|
8
12
|
ComboboxItem,
|
|
9
13
|
ComboboxList,
|
|
14
|
+
ComboboxPortal,
|
|
10
15
|
ComboboxTrigger,
|
|
11
16
|
useComboboxContext,
|
|
12
|
-
ComboboxPortal,
|
|
13
17
|
} from "../../components/micro/combobox";
|
|
14
|
-
import { ThemeWrapper } from "../../components/micro/theme-provider";
|
|
15
18
|
import {
|
|
16
19
|
InputGroup,
|
|
17
20
|
InputGroupAddon,
|
|
18
21
|
InputGroupInput,
|
|
19
22
|
} from "../../components/micro/input-group";
|
|
23
|
+
import { ThemeWrapper } from "../../components/micro/theme-provider";
|
|
20
24
|
import { type Size } from "../../lib/types";
|
|
21
|
-
import * as React from "react";
|
|
22
25
|
import { FieldPreset } from "./field-preset";
|
|
23
26
|
|
|
24
27
|
export interface ComboboxOption {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
3
5
|
import {
|
|
4
6
|
Command,
|
|
5
7
|
CommandEmpty,
|
|
@@ -20,9 +22,11 @@ import {
|
|
|
20
22
|
} from "../../components/micro/dialog";
|
|
21
23
|
import { ThemeWrapper } from "../../components/micro/theme-provider";
|
|
22
24
|
import { cn } from "../../lib/utils";
|
|
23
|
-
import * as React from "react";
|
|
24
25
|
|
|
25
|
-
type CommandDialogProps = Omit<
|
|
26
|
+
type CommandDialogProps = Omit<
|
|
27
|
+
React.ComponentProps<typeof Dialog>,
|
|
28
|
+
"children"
|
|
29
|
+
> & {
|
|
26
30
|
title?: string;
|
|
27
31
|
description?: string;
|
|
28
32
|
className?: string;
|
|
@@ -60,9 +64,9 @@ function CommandDialog({
|
|
|
60
64
|
CommandDialog.displayName = "CommandDialog";
|
|
61
65
|
|
|
62
66
|
export {
|
|
63
|
-
CommandDialog,
|
|
64
67
|
// Re-export primitives for convenience
|
|
65
68
|
Command,
|
|
69
|
+
CommandDialog,
|
|
66
70
|
CommandEmpty,
|
|
67
71
|
CommandGroup,
|
|
68
72
|
CommandInput,
|