@maestro-js/components 1.0.0-alpha.0
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/commands/add.ts +41 -0
- package/commands/index.ts +7 -0
- package/commands/list.ts +9 -0
- package/dist/components.json +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +48 -0
- package/package.json +49 -0
- package/registry.json +1445 -0
- package/scripts/build.ts +44 -0
- package/src/components/alert-dialog.tsx +150 -0
- package/src/components/autocomplete.tsx +288 -0
- package/src/components/autosuggest.tsx +314 -0
- package/src/components/avatar.tsx +54 -0
- package/src/components/boolean-select.tsx +48 -0
- package/src/components/button-group.tsx +75 -0
- package/src/components/button-link.tsx +71 -0
- package/src/components/button.tsx +132 -0
- package/src/components/checkbox-group.tsx +172 -0
- package/src/components/checkbox.tsx +207 -0
- package/src/components/chip.tsx +158 -0
- package/src/components/container.tsx +82 -0
- package/src/components/currency-field.tsx +183 -0
- package/src/components/date-input.tsx +189 -0
- package/src/components/date-picker.tsx +211 -0
- package/src/components/date-range-picker.tsx +290 -0
- package/src/components/date-time-picker.tsx +196 -0
- package/src/components/dialog.tsx +97 -0
- package/src/components/disclosure.tsx +114 -0
- package/src/components/drawer.tsx +78 -0
- package/src/components/enum-chip.tsx +30 -0
- package/src/components/file-input.tsx +245 -0
- package/src/components/form.tsx +82 -0
- package/src/components/headless-file-input.tsx +362 -0
- package/src/components/helpers/animated-popover.tsx +24 -0
- package/src/components/helpers/button-context.ts +10 -0
- package/src/components/helpers/calendar-month-year-picker.tsx +280 -0
- package/src/components/helpers/form-field.tsx +229 -0
- package/src/components/helpers/get-button-classes.ts +138 -0
- package/src/components/helpers/headless-button.tsx +36 -0
- package/src/components/helpers/pdf-dist.client.ts +6 -0
- package/src/components/icon.tsx +26 -0
- package/src/components/image-input.tsx +265 -0
- package/src/components/img.tsx +46 -0
- package/src/components/inline-alert.tsx +54 -0
- package/src/components/labeled-value.tsx +480 -0
- package/src/components/link-tabs.tsx +118 -0
- package/src/components/menu.tsx +152 -0
- package/src/components/month-day-input.tsx +176 -0
- package/src/components/multi-file-input.tsx +244 -0
- package/src/components/multi-image-input.tsx +389 -0
- package/src/components/multicomplete.tsx +322 -0
- package/src/components/multiselect.tsx +325 -0
- package/src/components/multisuggest.tsx +357 -0
- package/src/components/number-field.tsx +143 -0
- package/src/components/numeric-tag-field.tsx +271 -0
- package/src/components/pdf-input.tsx +249 -0
- package/src/components/pdf.tsx +86 -0
- package/src/components/percentage-field.tsx +187 -0
- package/src/components/phone-number-field.tsx +166 -0
- package/src/components/radio-group.tsx +112 -0
- package/src/components/radio.tsx +91 -0
- package/src/components/select.tsx +215 -0
- package/src/components/spinner.tsx +16 -0
- package/src/components/stepper.tsx +181 -0
- package/src/components/switch.tsx +186 -0
- package/src/components/tabs.tsx +151 -0
- package/src/components/tag-field.tsx +250 -0
- package/src/components/text-area.tsx +148 -0
- package/src/components/text-field.tsx +144 -0
- package/src/components/time-input.tsx +198 -0
- package/src/components/toast.tsx +176 -0
- package/src/components/toggle-button-group.tsx +94 -0
- package/src/components/year-month-input.tsx +187 -0
- package/src/utils/colors.ts +44 -0
- package/src/utils/compose-refs.ts +32 -0
- package/src/utils/enum-colors.ts +1 -0
- package/src/utils/file-input.ts +49 -0
- package/src/utils/icons.d.ts +20 -0
- package/src/utils/tw.ts +13 -0
- package/src/utils/use-element-size.ts +35 -0
- package/src/utils/use-number-input.ts +143 -0
- package/src/utils/use-pagination.ts +38 -0
- package/src/utils/use-prevent-default.ts +27 -0
- package/src/utils/use-render-props.ts +39 -0
- package/src/utils/use-spin-delay.ts +24 -0
- package/src/utils/use-stable-accessor.ts +11 -0
- package/src/utils/use-tab-indicator.ts +106 -0
- package/tests/commands.test.ts +81 -0
- package/tsconfig.json +27 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare function add(options: {
|
|
2
|
+
components: string[];
|
|
3
|
+
directory: string;
|
|
4
|
+
overwrite?: boolean;
|
|
5
|
+
}): Promise<string[]>;
|
|
6
|
+
|
|
7
|
+
declare function list(): Promise<string[]>;
|
|
8
|
+
|
|
9
|
+
declare const Components: {
|
|
10
|
+
list: typeof list;
|
|
11
|
+
add: typeof add;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { Components };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// commands/add.ts
|
|
2
|
+
import { readFile, writeFile, mkdir, access } from "fs/promises";
|
|
3
|
+
import { resolve, dirname } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
async function add(options) {
|
|
6
|
+
const registryPath = resolve(dirname(fileURLToPath(import.meta.url)), "./components.json");
|
|
7
|
+
const registry = JSON.parse(await readFile(registryPath, "utf-8"));
|
|
8
|
+
const written = [];
|
|
9
|
+
for (const componentName of options.components) {
|
|
10
|
+
const component = registry.find((c) => c.name === componentName);
|
|
11
|
+
if (!component) {
|
|
12
|
+
throw new Error(`Component "${componentName}" not found in registry`);
|
|
13
|
+
}
|
|
14
|
+
for (const file of component.files) {
|
|
15
|
+
const targetPath = resolve(options.directory, file.name);
|
|
16
|
+
if (!options.overwrite) {
|
|
17
|
+
try {
|
|
18
|
+
await access(targetPath);
|
|
19
|
+
continue;
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
await mkdir(dirname(targetPath), { recursive: true });
|
|
24
|
+
await writeFile(targetPath, file.content);
|
|
25
|
+
written.push(targetPath);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return written;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// commands/list.ts
|
|
32
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
33
|
+
import { resolve as resolve2, dirname as dirname2 } from "path";
|
|
34
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
35
|
+
async function list() {
|
|
36
|
+
const registryPath = resolve2(dirname2(fileURLToPath2(import.meta.url)), "./components.json");
|
|
37
|
+
const registry = JSON.parse(await readFile2(registryPath, "utf-8"));
|
|
38
|
+
return registry.map((c) => c.name);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// commands/index.ts
|
|
42
|
+
var Components = {
|
|
43
|
+
list,
|
|
44
|
+
add
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
Components
|
|
48
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maestro-js/components",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"dependencies": {},
|
|
5
|
+
"devDependencies": {
|
|
6
|
+
"@types/node": "^22.19.11",
|
|
7
|
+
"@types/react": "^19.1.8",
|
|
8
|
+
"@types/react-dom": "^19.1.6",
|
|
9
|
+
"react-pdf-hook": "^1.0.3",
|
|
10
|
+
"vaul": "^1.1.2",
|
|
11
|
+
"@maestro-js/form": "1.0.0-alpha.0"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"@bundled-es-modules/pdfjs-dist": "3.6.172-alpha.1",
|
|
15
|
+
"@internationalized/date": "^3.8.0",
|
|
16
|
+
"@react-aria/interactions": "^3.27.0",
|
|
17
|
+
"@react-aria/utils": "^3.33.0",
|
|
18
|
+
"iso-fns": "2.0.0-alpha.26",
|
|
19
|
+
"match-sorter": "^8.0.0",
|
|
20
|
+
"react-aria-components": "^1.7.1",
|
|
21
|
+
"tailwind-merge": "^3.3.0",
|
|
22
|
+
"pdfjs-dist": ">=5",
|
|
23
|
+
"react": ">=19",
|
|
24
|
+
"react-dom": ">=19",
|
|
25
|
+
"react-pdf-hook": "^1.0.3",
|
|
26
|
+
"react-router": ">=7",
|
|
27
|
+
"vite-env-only": "^3.0.2",
|
|
28
|
+
"vaul": ">=1",
|
|
29
|
+
"@maestro-js/form": "1.0.0-alpha.0"
|
|
30
|
+
},
|
|
31
|
+
"version": "1.0.0-alpha.0",
|
|
32
|
+
"license": "UNLICENSED",
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=22.18.0"
|
|
35
|
+
},
|
|
36
|
+
"repository": "https://github.com/Marcato-Partners/maestro-js",
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"default": "./dist/index.js"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsup --config ../../tsup.config.ts ./commands/index.ts && node scripts/build.ts",
|
|
45
|
+
"watch": "tsup --config ../../tsup.config.ts ./commands/index.ts --watch",
|
|
46
|
+
"typecheck": "tsc --noEmit",
|
|
47
|
+
"format": "prettier --write src/"
|
|
48
|
+
}
|
|
49
|
+
}
|