@myghf/ui 0.3.0 → 0.4.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.
Files changed (42) hide show
  1. package/README.md +27 -223
  2. package/dist/components/avatar/Avatar.vue.d.ts +12 -0
  3. package/dist/components/avatar/Avatar.vue.d.ts.map +1 -0
  4. package/dist/components/button/Button.vue.d.ts +7 -0
  5. package/dist/components/button/Button.vue.d.ts.map +1 -1
  6. package/dist/components/dropdown-menu/DropdownMenuGroup.vue.d.ts +18 -0
  7. package/dist/components/dropdown-menu/DropdownMenuGroup.vue.d.ts.map +1 -0
  8. package/dist/components/dropdown-menu/DropdownMenuItem.vue.d.ts +5 -1
  9. package/dist/components/dropdown-menu/DropdownMenuItem.vue.d.ts.map +1 -1
  10. package/dist/components/dropdown-menu/DropdownMenuLabel.vue.d.ts +18 -0
  11. package/dist/components/dropdown-menu/DropdownMenuLabel.vue.d.ts.map +1 -0
  12. package/dist/components/dropdown-menu/DropdownMenuSeparator.vue.d.ts +3 -0
  13. package/dist/components/dropdown-menu/DropdownMenuSeparator.vue.d.ts.map +1 -0
  14. package/dist/components/form-field/FormDescription.vue.d.ts +22 -0
  15. package/dist/components/form-field/FormDescription.vue.d.ts.map +1 -0
  16. package/dist/components/form-field/FormField.vue.d.ts +37 -0
  17. package/dist/components/form-field/FormField.vue.d.ts.map +1 -0
  18. package/dist/components/form-field/FormMessage.vue.d.ts +22 -0
  19. package/dist/components/form-field/FormMessage.vue.d.ts.map +1 -0
  20. package/dist/components/input/Input.vue.d.ts +8 -0
  21. package/dist/components/input/Input.vue.d.ts.map +1 -1
  22. package/dist/components/label/Label.vue.d.ts +24 -0
  23. package/dist/components/label/Label.vue.d.ts.map +1 -0
  24. package/dist/components/select/Select.vue.d.ts +4 -0
  25. package/dist/components/select/Select.vue.d.ts.map +1 -1
  26. package/dist/components/skeleton/Skeleton.vue.d.ts +51 -0
  27. package/dist/components/skeleton/Skeleton.vue.d.ts.map +1 -0
  28. package/dist/components/spinner/Spinner.vue.d.ts +13 -0
  29. package/dist/components/spinner/Spinner.vue.d.ts.map +1 -0
  30. package/dist/components/textarea/Textarea.vue.d.ts +9 -1
  31. package/dist/components/textarea/Textarea.vue.d.ts.map +1 -1
  32. package/dist/index.d.ts +12 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +845 -517
  35. package/dist/index.js.map +1 -1
  36. package/dist/lib/formField.d.ts +27 -0
  37. package/dist/lib/formField.d.ts.map +1 -0
  38. package/dist/nuxt.d.ts +14 -0
  39. package/dist/nuxt.d.ts.map +1 -0
  40. package/dist/nuxt.js +32 -0
  41. package/dist/nuxt.js.map +1 -0
  42. package/package.json +17 -1
@@ -0,0 +1,27 @@
1
+ import { ComputedRef, InjectionKey } from 'vue';
2
+ /**
3
+ * Shared context provided by `FormField` and consumed by `Label` (and, in
4
+ * later tasks, `Input`, `Textarea`, and `Select`) to auto-wire `for`/`id`,
5
+ * `aria-describedby`, `aria-invalid`, and `required` onto a control.
6
+ *
7
+ * Every member is a computed ref so the context stays reactive when the
8
+ * `FormField` props change after mount.
9
+ */
10
+ export interface FormFieldContext {
11
+ /** The control id: the `FormField` `id` prop, or a generated fallback. */
12
+ id: ComputedRef<string>;
13
+ /** Space-joined description/error ids, or `undefined` when neither exists. */
14
+ describedBy: ComputedRef<string | undefined>;
15
+ /** `true` when the field should be marked invalid (defaults to `Boolean(error)`). */
16
+ invalid: ComputedRef<boolean>;
17
+ /** `true` when the field is required. */
18
+ required: ComputedRef<boolean>;
19
+ }
20
+ export declare const formFieldKey: InjectionKey<FormFieldContext>;
21
+ /**
22
+ * Reads the nearest `FormField` context. Returns `null` when there is no
23
+ * provider, so consumers can fall back to their explicit props and behave
24
+ * exactly as they did before the context existed.
25
+ */
26
+ export declare function useFormField(): FormFieldContext | null;
27
+ //# sourceMappingURL=formField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formField.d.ts","sourceRoot":"","sources":["../../src/lib/formField.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,KAAK,CAAA;AAEjE;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,0EAA0E;IAC1E,EAAE,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACvB,8EAA8E;IAC9E,WAAW,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC5C,qFAAqF;IACrF,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;IAC7B,yCAAyC;IACzC,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAA;CAC/B;AAED,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,gBAAgB,CAA8B,CAAA;AAEtF;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,gBAAgB,GAAG,IAAI,CAEtD"}
package/dist/nuxt.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ export interface ModuleOptions {
2
+ /** Auto-import the component exports. */
3
+ autoImports?: boolean;
4
+ /** Optional prefix for auto-imported components. */
5
+ prefix?: string;
6
+ }
7
+ /**
8
+ * Vue component exports that can be auto-imported by the Nuxt module.
9
+ * Kept in sync with the component `default` exports in `src/index.ts`.
10
+ */
11
+ export declare const AUTO_IMPORT_COMPONENTS: string[];
12
+ declare const _default: import('@nuxt/schema').NuxtModule<ModuleOptions, ModuleOptions, false>;
13
+ export default _default;
14
+ //# sourceMappingURL=nuxt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nuxt.d.ts","sourceRoot":"","sources":["../src/nuxt.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,UAgDlC,CAAA;;AAED,wBAiCE"}
package/dist/nuxt.js ADDED
@@ -0,0 +1,32 @@
1
+ import { addComponent as e, defineNuxtModule as t } from "@nuxt/kit";
2
+ //#region src/nuxt.ts
3
+ var n = /* @__PURE__ */ "ThemeToggle.Icon.Button.Input.InputNumber.Textarea.Password.Label.FormField.FormDescription.FormMessage.Checkbox.Tag.Alert.Message.Spinner.Skeleton.Avatar.Tabs.TabsList.TabsTrigger.TabsContent.Select.SelectButton.DatePicker.Dialog.Drawer.DropdownMenu.DropdownMenuTrigger.DropdownMenuContent.DropdownMenuItem.DropdownMenuSeparator.DropdownMenuLabel.DropdownMenuGroup.TransferList.Table.TableHeader.TableBody.TableRow.TableHead.TableCell.TableEmpty.TablePagination.DataTable.TreeTable.TreeSelect.Toaster".split("."), r = t({
4
+ meta: {
5
+ name: "@myghf/ui",
6
+ configKey: "myghfUi"
7
+ },
8
+ defaults: {
9
+ autoImports: !0,
10
+ prefix: ""
11
+ },
12
+ async setup(t, r) {
13
+ r.options.build.transpile.push("@myghf/ui"), r.options.css.unshift("@myghf/ui/tokens.css");
14
+ let i = r.options.tailwindcss;
15
+ if (i) {
16
+ i.config ??= {};
17
+ let e = i.config.content ?? [];
18
+ e.push("./node_modules/@myghf/ui/dist/**/*.js"), i.config.content = e;
19
+ let t = i.config.presets ?? [], n = (await import("@myghf/ui/tailwind-preset")).default;
20
+ t.push(n), i.config.presets = t;
21
+ }
22
+ if (t.autoImports) for (let r of n) e({
23
+ name: `${t.prefix}${r}`,
24
+ export: r,
25
+ filePath: "@myghf/ui"
26
+ });
27
+ }
28
+ });
29
+ //#endregion
30
+ export { n as AUTO_IMPORT_COMPONENTS, r as default };
31
+
32
+ //# sourceMappingURL=nuxt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nuxt.js","names":[],"sources":["../src/nuxt.ts"],"sourcesContent":["import { addComponent, defineNuxtModule } from '@nuxt/kit'\n\nexport interface ModuleOptions {\n /** Auto-import the component exports. */\n autoImports?: boolean\n /** Optional prefix for auto-imported components. */\n prefix?: string\n}\n\n/**\n * Vue component exports that can be auto-imported by the Nuxt module.\n * Kept in sync with the component `default` exports in `src/index.ts`.\n */\nexport const AUTO_IMPORT_COMPONENTS = [\n 'ThemeToggle',\n 'Icon',\n 'Button',\n 'Input',\n 'InputNumber',\n 'Textarea',\n 'Password',\n 'Label',\n 'FormField',\n 'FormDescription',\n 'FormMessage',\n 'Checkbox',\n 'Tag',\n 'Alert',\n 'Message',\n 'Spinner',\n 'Skeleton',\n 'Avatar',\n 'Tabs',\n 'TabsList',\n 'TabsTrigger',\n 'TabsContent',\n 'Select',\n 'SelectButton',\n 'DatePicker',\n 'Dialog',\n 'Drawer',\n 'DropdownMenu',\n 'DropdownMenuTrigger',\n 'DropdownMenuContent',\n 'DropdownMenuItem',\n 'DropdownMenuSeparator',\n 'DropdownMenuLabel',\n 'DropdownMenuGroup',\n 'TransferList',\n 'Table',\n 'TableHeader',\n 'TableBody',\n 'TableRow',\n 'TableHead',\n 'TableCell',\n 'TableEmpty',\n 'TablePagination',\n 'DataTable',\n 'TreeTable',\n 'TreeSelect',\n 'Toaster',\n]\n\nexport default defineNuxtModule<ModuleOptions>({\n meta: { name: '@myghf/ui', configKey: 'myghfUi' },\n defaults: { autoImports: true, prefix: '' },\n async setup(options, nuxt) {\n nuxt.options.build.transpile.push('@myghf/ui')\n nuxt.options.css.unshift('@myghf/ui/tokens.css')\n\n // Tailwind is provided by @nuxtjs/tailwindcss, which is not a dependency\n // here, so access its config defensively.\n const tw = (nuxt.options as unknown as Record<string, unknown>).tailwindcss as\n | { config?: Record<string, unknown> }\n | undefined\n if (tw) {\n tw.config ??= {}\n const content = (tw.config.content as string[] | undefined) ?? []\n content.push('./node_modules/@myghf/ui/dist/**/*.js')\n tw.config.content = content\n const presets = (tw.config.presets as unknown[] | undefined) ?? []\n // Tailwind requires preset *objects*; it does not resolve string paths.\n // The specifier is a variable so it is resolved at runtime by the\n // consumer rather than bundled into this module.\n const presetId = '@myghf/ui/tailwind-preset'\n const preset = (await import(presetId)).default\n presets.push(preset)\n tw.config.presets = presets\n }\n\n if (options.autoImports) {\n for (const name of AUTO_IMPORT_COMPONENTS) {\n addComponent({ name: `${options.prefix}${name}`, export: name, filePath: '@myghf/ui' })\n }\n }\n },\n})\n"],"mappings":";;AAaA,IAAa,IAAyB,ihBAgDtC,GAEA,IAAe,EAAgC;CAC7C,MAAM;EAAE,MAAM;EAAa,WAAW;CAAU;CAChD,UAAU;EAAE,aAAa;EAAM,QAAQ;CAAG;CAC1C,MAAM,MAAM,GAAS,GAAM;EAEzB,AADA,EAAK,QAAQ,MAAM,UAAU,KAAK,WAAW,GAC7C,EAAK,QAAQ,IAAI,QAAQ,sBAAsB;EAI/C,IAAM,IAAM,EAAK,QAA+C;EAGhE,IAAI,GAAI;GACN,EAAG,WAAW,CAAC;GACf,IAAM,IAAW,EAAG,OAAO,WAAoC,CAAC;GAEhE,AADA,EAAQ,KAAK,uCAAuC,GACpD,EAAG,OAAO,UAAU;GACpB,IAAM,IAAW,EAAG,OAAO,WAAqC,CAAC,GAK3D,KAAU,MAAM,OAAO,6BAAA,CAAW;GAExC,AADA,EAAQ,KAAK,CAAM,GACnB,EAAG,OAAO,UAAU;EACtB;EAEA,IAAI,EAAQ,aACV,KAAK,IAAM,KAAQ,GACjB,EAAa;GAAE,MAAM,GAAG,EAAQ,SAAS;GAAQ,QAAQ;GAAM,UAAU;EAAY,CAAC;CAG5F;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myghf/ui",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -23,6 +23,10 @@
23
23
  "./tailwind-preset": {
24
24
  "import": "./dist/tailwindPreset.js"
25
25
  },
26
+ "./nuxt": {
27
+ "types": "./dist/nuxt.d.ts",
28
+ "import": "./dist/nuxt.js"
29
+ },
26
30
  "./package.json": "./package.json"
27
31
  },
28
32
  "files": [
@@ -51,11 +55,23 @@
51
55
  "tailwind-variants": "^1.0.0"
52
56
  },
53
57
  "peerDependencies": {
58
+ "@nuxt/kit": ">=3.0.0",
59
+ "@nuxt/schema": ">=3.0.0",
54
60
  "tailwindcss": "^3.4.0",
55
61
  "vue": "^3.5.0"
56
62
  },
63
+ "peerDependenciesMeta": {
64
+ "@nuxt/kit": {
65
+ "optional": true
66
+ },
67
+ "@nuxt/schema": {
68
+ "optional": true
69
+ }
70
+ },
57
71
  "devDependencies": {
58
72
  "@changesets/cli": "^3.0.3",
73
+ "@nuxt/kit": "^4.5.2",
74
+ "@nuxt/schema": "^4.5.2",
59
75
  "@types/node": "^24.0.0",
60
76
  "@vitejs/plugin-vue": "^6.0.7",
61
77
  "@vue/test-utils": "^2.5.1",