@astrake/lumora-ui 0.2.0 → 0.2.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.
Files changed (187) hide show
  1. package/CHANGELOG.md +44 -1
  2. package/dist/LuCodeBlock.vue_vue_type_script_setup_true_lang-BdXflBkJ.js +1672 -0
  3. package/dist/LuEmbeddedStatusBar.vue_vue_type_script_setup_true_lang-D4rqklgo.js +218 -0
  4. package/dist/LuOverlay.vue_vue_type_script_setup_true_lang-C5jhqCgy.js +221 -0
  5. package/dist/components/LuAlert.vue.d.ts +20 -0
  6. package/dist/components/LuAvatar.vue.d.ts +19 -0
  7. package/dist/components/LuBadge.vue.d.ts +16 -0
  8. package/dist/components/LuBreadcrumb.vue.d.ts +16 -0
  9. package/dist/components/LuButton.vue.d.ts +24 -0
  10. package/dist/components/LuCard.vue.d.ts +18 -0
  11. package/dist/components/LuCheckbox.vue.d.ts +27 -0
  12. package/dist/components/LuCodeBlock.vue.d.ts +26 -0
  13. package/dist/components/LuCollapsible.vue.d.ts +25 -0
  14. package/dist/components/LuDivider.vue.d.ts +8 -0
  15. package/dist/components/LuForm.types.d.ts +18 -0
  16. package/dist/components/LuForm.vue.d.ts +55 -0
  17. package/dist/components/LuIcon.vue.d.ts +18 -0
  18. package/dist/components/LuInput.vue.d.ts +26 -0
  19. package/dist/components/LuLink.vue.d.ts +23 -0
  20. package/dist/components/LuMenu.vue.d.ts +26 -0
  21. package/dist/components/LuMenuItem.vue.d.ts +20 -0
  22. package/dist/components/LuModal.vue.d.ts +32 -0
  23. package/dist/components/LuPageHeader.vue.d.ts +10 -0
  24. package/dist/components/LuPagination.vue.d.ts +18 -0
  25. package/dist/components/LuProgressBar.vue.d.ts +7 -0
  26. package/dist/components/LuRadio.vue.d.ts +18 -0
  27. package/dist/components/LuRadioGroup.types.d.ts +8 -0
  28. package/dist/components/LuRadioGroup.vue.d.ts +24 -0
  29. package/dist/components/LuSelect.vue.d.ts +18 -0
  30. package/dist/components/LuSkeleton.vue.d.ts +5 -0
  31. package/dist/components/LuSpinner.vue.d.ts +5 -0
  32. package/dist/components/LuSwitch.vue.d.ts +15 -0
  33. package/dist/components/LuTab.vue.d.ts +16 -0
  34. package/dist/components/LuTabList.vue.d.ts +15 -0
  35. package/dist/components/LuTabPanel.vue.d.ts +16 -0
  36. package/dist/components/LuTable.vue.d.ts +15 -0
  37. package/dist/components/LuTableBody.vue.d.ts +15 -0
  38. package/dist/components/LuTableCell.vue.d.ts +15 -0
  39. package/dist/components/LuTableHead.vue.d.ts +15 -0
  40. package/dist/components/LuTableHeadCell.vue.d.ts +15 -0
  41. package/dist/components/LuTableRow.vue.d.ts +15 -0
  42. package/dist/components/LuTabs.vue.d.ts +20 -0
  43. package/dist/components/LuTag.vue.d.ts +20 -0
  44. package/dist/components/LuText.vue.d.ts +16 -0
  45. package/dist/components/LuTextarea.vue.d.ts +14 -0
  46. package/dist/components/LuThemeSelect.vue.d.ts +2 -0
  47. package/dist/components/LuThemeSwitch.vue.d.ts +2 -0
  48. package/dist/components/LuToggleButton.vue.d.ts +16 -0
  49. package/dist/components/LuToggleGroup.vue.d.ts +20 -0
  50. package/dist/components/LuTooltip.vue.d.ts +19 -0
  51. package/dist/components/__tests__/LuForm.test.d.ts +1 -0
  52. package/dist/components/_all.d.ts +3 -0
  53. package/dist/components/index.js +47 -0
  54. package/{src/composables/index.ts → dist/composables/index.d.ts} +1 -1
  55. package/dist/composables/index.js +31 -0
  56. package/dist/composables/useRail.d.ts +6 -0
  57. package/dist/composables/useShiki.d.ts +2 -0
  58. package/dist/composables/useSplit.d.ts +4 -0
  59. package/dist/composables/useTheme.d.ts +7 -0
  60. package/dist/context-CGS7Ou_x.js +36 -0
  61. package/dist/context.d.ts +8 -0
  62. package/{src/index.ts → dist/index.d.ts} +0 -1
  63. package/dist/index.js +166 -0
  64. package/dist/layout/LuDock.vue.d.ts +9 -0
  65. package/dist/layout/LuDockItem.vue.d.ts +16 -0
  66. package/dist/layout/LuFill.vue.d.ts +18 -0
  67. package/dist/layout/LuFixed.vue.d.ts +18 -0
  68. package/dist/layout/LuGrid.vue.d.ts +22 -0
  69. package/dist/layout/LuOverlay.vue.d.ts +15 -0
  70. package/dist/layout/LuScroll.vue.d.ts +15 -0
  71. package/dist/layout/LuSplit.vue.d.ts +16 -0
  72. package/dist/layout/LuSplitPane.vue.d.ts +18 -0
  73. package/dist/layout/LuSplitResizer.vue.d.ts +5 -0
  74. package/dist/layout/LuStack.vue.d.ts +25 -0
  75. package/{src/layout/index.ts → dist/layout/index.d.ts} +1 -14
  76. package/dist/layout/index.js +14 -0
  77. package/dist/plugin.d.ts +6 -0
  78. package/dist/shell/desktop/LuDesktopRailBar.vue.d.ts +17 -0
  79. package/dist/shell/desktop/LuDesktopRailItem.vue.d.ts +18 -0
  80. package/dist/shell/desktop/LuDesktopShell.vue.d.ts +23 -0
  81. package/dist/shell/desktop/LuDesktopSidebar.vue.d.ts +21 -0
  82. package/dist/shell/desktop/LuDesktopStatusBar.vue.d.ts +15 -0
  83. package/dist/shell/desktop/LuDesktopTopBar.vue.d.ts +15 -0
  84. package/dist/shell/embedded/LuEmbeddedShell.vue.d.ts +19 -0
  85. package/dist/shell/embedded/LuEmbeddedStatusBar.vue.d.ts +17 -0
  86. package/dist/shell/embedded/LuEmbeddedTopBar.vue.d.ts +19 -0
  87. package/{src/shell/index.ts → dist/shell/index.d.ts} +0 -1
  88. package/dist/shell/index.js +15 -0
  89. package/dist/shell/mobile/LuMobileHeader.vue.d.ts +19 -0
  90. package/dist/shell/mobile/LuMobileNavBar.vue.d.ts +15 -0
  91. package/dist/shell/mobile/LuMobileShell.vue.d.ts +21 -0
  92. package/dist/skins/components.d.ts +2 -0
  93. package/dist/skins/default.d.ts +2 -0
  94. package/dist/skins/index.js +446 -0
  95. package/dist/skins/layout.d.ts +2 -0
  96. package/dist/skins/shell/desktop.d.ts +2 -0
  97. package/dist/skins/shell/embedded.d.ts +2 -0
  98. package/dist/skins/shell/mobile.d.ts +2 -0
  99. package/dist/tailwind.d.ts +1 -0
  100. package/dist/tailwind.js +13 -0
  101. package/dist/types.d.ts +15 -0
  102. package/dist/useShiki-DPOJfneq.js +30 -0
  103. package/dist/utils.d.ts +10 -0
  104. package/package.json +37 -12
  105. package/src/lumora.css +32 -0
  106. package/src/components/LuAlert.vue +0 -33
  107. package/src/components/LuAvatar.vue +0 -22
  108. package/src/components/LuBadge.vue +0 -15
  109. package/src/components/LuBreadcrumb.vue +0 -63
  110. package/src/components/LuButton.vue +0 -58
  111. package/src/components/LuCard.vue +0 -27
  112. package/src/components/LuCheckbox.vue +0 -94
  113. package/src/components/LuCodeBlock.vue +0 -168
  114. package/src/components/LuCollapsible.vue +0 -34
  115. package/src/components/LuDivider.vue +0 -18
  116. package/src/components/LuForm.types.ts +0 -24
  117. package/src/components/LuForm.vue +0 -121
  118. package/src/components/LuIcon.vue +0 -39
  119. package/src/components/LuInput.vue +0 -82
  120. package/src/components/LuLink.vue +0 -47
  121. package/src/components/LuMenu.vue +0 -86
  122. package/src/components/LuMenuItem.vue +0 -37
  123. package/src/components/LuModal.vue +0 -115
  124. package/src/components/LuPageHeader.vue +0 -24
  125. package/src/components/LuPagination.vue +0 -118
  126. package/src/components/LuProgressBar.vue +0 -21
  127. package/src/components/LuRadio.vue +0 -55
  128. package/src/components/LuRadioGroup.types.ts +0 -10
  129. package/src/components/LuRadioGroup.vue +0 -66
  130. package/src/components/LuSelect.vue +0 -67
  131. package/src/components/LuSkeleton.vue +0 -15
  132. package/src/components/LuSpinner.vue +0 -36
  133. package/src/components/LuSwitch.vue +0 -76
  134. package/src/components/LuTab.vue +0 -26
  135. package/src/components/LuTabList.vue +0 -15
  136. package/src/components/LuTabPanel.vue +0 -19
  137. package/src/components/LuTable.vue +0 -15
  138. package/src/components/LuTableBody.vue +0 -15
  139. package/src/components/LuTableCell.vue +0 -15
  140. package/src/components/LuTableHead.vue +0 -15
  141. package/src/components/LuTableHeadCell.vue +0 -15
  142. package/src/components/LuTableRow.vue +0 -15
  143. package/src/components/LuTabs.vue +0 -30
  144. package/src/components/LuTag.vue +0 -35
  145. package/src/components/LuText.vue +0 -18
  146. package/src/components/LuTextarea.vue +0 -62
  147. package/src/components/LuThemeSelect.vue +0 -26
  148. package/src/components/LuThemeSwitch.vue +0 -22
  149. package/src/components/LuToggleButton.vue +0 -35
  150. package/src/components/LuToggleGroup.vue +0 -27
  151. package/src/components/LuTooltip.vue +0 -36
  152. package/src/components/__tests__/LuForm.test.ts +0 -206
  153. package/src/composables/useRail.ts +0 -24
  154. package/src/composables/useSplit.ts +0 -17
  155. package/src/composables/useTheme.ts +0 -36
  156. package/src/context.ts +0 -39
  157. package/src/layout/LuDock.vue +0 -56
  158. package/src/layout/LuDockItem.vue +0 -20
  159. package/src/layout/LuFill.vue +0 -27
  160. package/src/layout/LuFixed.vue +0 -27
  161. package/src/layout/LuGrid.vue +0 -45
  162. package/src/layout/LuOverlay.vue +0 -17
  163. package/src/layout/LuScroll.vue +0 -19
  164. package/src/layout/LuSplit.vue +0 -23
  165. package/src/layout/LuSplitPane.vue +0 -32
  166. package/src/layout/LuSplitResizer.vue +0 -19
  167. package/src/layout/LuStack.vue +0 -29
  168. package/src/plugin.ts +0 -28
  169. package/src/shell/desktop/LuDesktopRailBar.vue +0 -23
  170. package/src/shell/desktop/LuDesktopRailItem.vue +0 -23
  171. package/src/shell/desktop/LuDesktopShell.vue +0 -25
  172. package/src/shell/desktop/LuDesktopSidebar.vue +0 -36
  173. package/src/shell/desktop/LuDesktopStatusBar.vue +0 -15
  174. package/src/shell/desktop/LuDesktopTopBar.vue +0 -15
  175. package/src/shell/embedded/LuEmbeddedShell.vue +0 -20
  176. package/src/shell/embedded/LuEmbeddedStatusBar.vue +0 -16
  177. package/src/shell/embedded/LuEmbeddedTopBar.vue +0 -17
  178. package/src/shell/mobile/LuMobileHeader.vue +0 -17
  179. package/src/shell/mobile/LuMobileNavBar.vue +0 -15
  180. package/src/shell/mobile/LuMobileShell.vue +0 -21
  181. package/src/skins/default.ts +0 -426
  182. package/src/tailwind.ts +0 -25
  183. package/src/types.ts +0 -18
  184. package/src/utils.ts +0 -95
  185. package/tsconfig.json +0 -10
  186. /package/{src/components/index.ts → dist/components/index.d.ts} +0 -0
  187. /package/{src/skins/index.ts → dist/skins/index.d.ts} +0 -0
@@ -0,0 +1,2 @@
1
+ import type { SkinMap } from "../types";
2
+ export declare const layoutSkin: SkinMap;
@@ -0,0 +1,2 @@
1
+ import type { SkinMap } from "../../types";
2
+ export declare const desktopSkin: SkinMap;
@@ -0,0 +1,2 @@
1
+ import type { SkinMap } from "../../types";
2
+ export declare const embeddedSkin: SkinMap;
@@ -0,0 +1,2 @@
1
+ import type { SkinMap } from "../../types";
2
+ export declare const mobileSkin: SkinMap;
@@ -0,0 +1 @@
1
+ export declare function getLumoraSourceDir(importerUrl?: string): string;
@@ -0,0 +1,13 @@
1
+ import { createRequire as o } from "node:module";
2
+ import t from "node:path";
3
+ function m(r) {
4
+ try {
5
+ const e = o(r ?? import.meta.url);
6
+ return t.dirname(e.resolve("@astrake/lumora-ui/package.json"));
7
+ } catch {
8
+ return "./node_modules/@astrake/lumora-ui";
9
+ }
10
+ }
11
+ export {
12
+ m as getLumoraSourceDir
13
+ };
@@ -0,0 +1,15 @@
1
+ import type { Component, Ref, ComputedRef } from "vue";
2
+ export type SkinMap = {
3
+ [componentName: string]: {
4
+ default?: string;
5
+ [variant: string]: string | undefined;
6
+ };
7
+ };
8
+ export type IconResolver = (name: string, size?: number) => Component | null;
9
+ export interface LumoraUIConfig {
10
+ target?: "mobile" | "desktop" | "embedded";
11
+ skin?: SkinMap | Ref<SkinMap> | ComputedRef<SkinMap>;
12
+ locale?: string;
13
+ a11y?: boolean;
14
+ icons?: IconResolver;
15
+ }
@@ -0,0 +1,30 @@
1
+ import { ref as o, computed as i } from "vue";
2
+ import { createHighlighter as l } from "shiki";
3
+ const t = o("system"), n = o(!1);
4
+ if (typeof window < "u") {
5
+ const r = window.matchMedia("(prefers-color-scheme: dark)");
6
+ n.value = r.matches, r.addEventListener("change", (s) => {
7
+ n.value = s.matches;
8
+ });
9
+ }
10
+ const u = i(() => t.value === "system" ? n.value ? "dark" : "light" : t.value);
11
+ function c() {
12
+ return {
13
+ mode: t,
14
+ resolved: u,
15
+ setMode: (s) => {
16
+ t.value = s;
17
+ }
18
+ };
19
+ }
20
+ let e = null, a = null;
21
+ async function d() {
22
+ return e || (a || (a = l({
23
+ themes: ["one-dark-pro"],
24
+ langs: ["bash", "vue", "ts", "html", "css", "json"]
25
+ })), e = await a, e);
26
+ }
27
+ export {
28
+ d as g,
29
+ c as u
30
+ };
@@ -0,0 +1,10 @@
1
+ import { type ClassValue } from "clsx";
2
+ import type { SkinMap } from "./types";
3
+ /**
4
+ * Merges Tailwind classes intelligently
5
+ */
6
+ export declare function cn(...inputs: ClassValue[]): string;
7
+ /**
8
+ * Extends a base skin with a user skin, intelligently merging Tailwind classes
9
+ */
10
+ export declare function extendSkin(baseSkin: SkinMap, userSkin: SkinMap): SkinMap;
package/package.json CHANGED
@@ -1,19 +1,43 @@
1
1
  {
2
2
  "name": "@astrake/lumora-ui",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Headless Vue 3 component framework for three surface targets — Mobile, Desktop, and Embedded — with a unified --lu-* design token system.",
5
5
  "author": "Anuvab Chakraborty (https://github.com/madlybong)",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
8
11
  "exports": {
9
- ".": "./src/index.ts",
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
+ },
10
16
  "./style": "./src/lumora.css",
11
- "./tailwind": "./src/tailwind.ts",
12
- "./layout": "./src/layout/index.ts",
13
- "./shell": "./src/shell/index.ts",
14
- "./components": "./src/components/index.ts",
15
- "./composables": "./src/composables/index.ts",
16
- "./skins": "./src/skins/index.ts"
17
+ "./tailwind": {
18
+ "types": "./dist/tailwind.d.ts",
19
+ "import": "./dist/tailwind.js"
20
+ },
21
+ "./layout": {
22
+ "types": "./dist/layout/index.d.ts",
23
+ "import": "./dist/layout/index.js"
24
+ },
25
+ "./shell": {
26
+ "types": "./dist/shell/index.d.ts",
27
+ "import": "./dist/shell/index.js"
28
+ },
29
+ "./components": {
30
+ "types": "./dist/components/index.d.ts",
31
+ "import": "./dist/components/index.js"
32
+ },
33
+ "./composables": {
34
+ "types": "./dist/composables/index.d.ts",
35
+ "import": "./dist/composables/index.js"
36
+ },
37
+ "./skins": {
38
+ "types": "./dist/skins/index.d.ts",
39
+ "import": "./dist/skins/index.js"
40
+ }
17
41
  },
18
42
  "keywords": [
19
43
  "vue",
@@ -46,15 +70,16 @@
46
70
  "registry": "https://registry.npmjs.org/"
47
71
  },
48
72
  "files": [
49
- "src",
50
- "tsconfig.json",
73
+ "dist",
74
+ "src/lumora.css",
51
75
  "README.md",
52
76
  "CHANGELOG.md"
53
77
  ],
54
78
  "scripts": {
55
- "prepack": "bun -e \"await Bun.write('README.md', await Bun.file('../../README.md').text()); await Bun.write('CHANGELOG.md', await Bun.file('../../CHANGELOG.md').text())\"",
79
+ "prepack": "bun run build && bun -e \"await Bun.write('README.md', await Bun.file('../../README.md').text()); await Bun.write('CHANGELOG.md', await Bun.file('../../CHANGELOG.md').text())\"",
56
80
  "postpack": "bun -e \"import { unlinkSync } from 'fs'; try { unlinkSync('README.md') } catch(e){} try { unlinkSync('CHANGELOG.md') } catch(e){}\"",
57
- "build": "bun run ../../tools/build.ts",
81
+ "build:types": "bun -e \"import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true })\" && bun run vue-tsc -p tsconfig.build.json",
82
+ "build": "bun -e \"import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true })\" && bun run vue-tsc -p tsconfig.build.json && bun run ../../node_modules/vite/bin/vite.js build -c vite.config.ts",
58
83
  "check": "vue-tsc -p ./tsconfig.json"
59
84
  },
60
85
  "peerDependencies": {
package/src/lumora.css CHANGED
@@ -14,3 +14,35 @@
14
14
 
15
15
  /* Example: Webkit Scrollbar overrides can go here */
16
16
 
17
+ .lu-collapsible-enter-active,
18
+ .lu-collapsible-leave-active {
19
+ display: grid;
20
+ transition: grid-template-rows 200ms ease;
21
+ }
22
+ .lu-collapsible-enter-from,
23
+ .lu-collapsible-leave-to {
24
+ grid-template-rows: 0fr;
25
+ }
26
+ .lu-collapsible-enter-to,
27
+ .lu-collapsible-leave-from {
28
+ grid-template-rows: 1fr;
29
+ }
30
+
31
+ :root {
32
+ --lu-ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
33
+ }
34
+
35
+ @keyframes lu-fade-in {
36
+ from {
37
+ opacity: 0;
38
+ transform: scale(0.97) translateY(-3px);
39
+ }
40
+ to {
41
+ opacity: 1;
42
+ transform: scale(1) translateY(0);
43
+ }
44
+ }
45
+
46
+ .lu-fade-in {
47
+ animation: lu-fade-in 130ms var(--lu-ease-spring) forwards;
48
+ }
@@ -1,33 +0,0 @@
1
- <template>
2
- <div :class="resolvedSkin" role="alert">
3
- <div v-if="$slots.icon || icon" :class="resolvedIconWrapperSkin">
4
- <slot name="icon">
5
- <LuIcon v-if="icon" :name="icon" />
6
- </slot>
7
- </div>
8
- <div :class="resolvedContentSkin">
9
- <slot />
10
- </div>
11
- <div v-if="$slots.action" :class="resolvedActionSkin">
12
- <slot name="action" />
13
- </div>
14
- </div>
15
- </template>
16
-
17
- <script setup lang="ts">
18
- import { computed } from "vue";
19
- import { useLumoraConfig } from "../context";
20
- import LuIcon from "./LuIcon.vue";
21
-
22
- const props = defineProps<{
23
- variant?: string;
24
- icon?: string;
25
- }>();
26
-
27
- const { resolveSkin } = useLumoraConfig();
28
-
29
- const resolvedSkin = computed(() => resolveSkin("LuAlert", props.variant));
30
- const resolvedIconWrapperSkin = computed(() => resolveSkin("LuAlertIcon", props.variant));
31
- const resolvedContentSkin = computed(() => resolveSkin("LuAlertContent", props.variant));
32
- const resolvedActionSkin = computed(() => resolveSkin("LuAlertAction", props.variant));
33
- </script>
@@ -1,22 +0,0 @@
1
- <template>
2
- <div v-bind="$attrs" :class="containerSkin" :data-size="size">
3
- <img v-if="src && !hasError" :src="src" :alt="alt" :class="imageSkin" @error="hasError = true" />
4
- <div v-else :class="fallbackSkin">
5
- <slot>{{ fallback }}</slot>
6
- </div>
7
- </div>
8
- </template>
9
-
10
- <script setup lang="ts">
11
- import { computed, ref } from "vue";
12
- import { useLumoraConfig } from "../context";
13
-
14
- const props = defineProps<{ variant?: string; src?: string; fallback?: string; alt?: string; size?: string }>();
15
-
16
- const hasError = ref(false);
17
-
18
- const { resolveSkin } = useLumoraConfig();
19
- const containerSkin = computed(() => resolveSkin("LuAvatar", props.variant));
20
- const imageSkin = computed(() => resolveSkin("LuAvatarImage", props.variant));
21
- const fallbackSkin = computed(() => resolveSkin("LuAvatarFallback", props.variant));
22
- </script>
@@ -1,15 +0,0 @@
1
- <template>
2
- <component :is="as || 'span'" v-bind="$attrs" :class="resolvedSkin">
3
- <slot />
4
- </component>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- import { computed } from "vue";
9
- import { useLumoraConfig } from "../context";
10
-
11
- const props = defineProps<{ variant?: string; as?: string }>();
12
-
13
- const { resolveSkin } = useLumoraConfig();
14
- const resolvedSkin = computed(() => resolveSkin("LuBadge", props.variant));
15
- </script>
@@ -1,63 +0,0 @@
1
- <template>
2
- <nav aria-label="breadcrumb">
3
- <ol :class="resolvedSkin">
4
- <li v-for="(item, index) in items" :key="index" :class="resolvedItemSkin">
5
- <LuLink
6
- v-if="item.href || item.to"
7
- :href="item.href"
8
- :to="item.to"
9
- :variant="item.current ? 'nav-active' : 'nav'"
10
- :aria-current="item.current ? 'page' : undefined"
11
- :class="resolvedLinkSkin"
12
- >
13
- <LuIcon v-if="item.icon" :name="item.icon" class="mr-2 h-4 w-4" />
14
- {{ item.label }}
15
- </LuLink>
16
- <span
17
- v-else
18
- :class="resolvedPageSkin"
19
- :aria-current="item.current ? 'page' : undefined"
20
- >
21
- <LuIcon v-if="item.icon" :name="item.icon" class="mr-2 h-4 w-4" />
22
- {{ item.label }}
23
- </span>
24
- <LuIcon
25
- v-if="index < items.length - 1"
26
- :name="separatorIcon"
27
- :class="resolvedSeparatorSkin"
28
- />
29
- </li>
30
- </ol>
31
- </nav>
32
- </template>
33
-
34
- <script setup lang="ts">
35
- import { computed } from "vue";
36
- import { useLumoraConfig } from "../context";
37
- import LuLink from "./LuLink.vue";
38
- import LuIcon from "./LuIcon.vue";
39
-
40
- export interface LuBreadcrumbItem {
41
- label: string;
42
- href?: string;
43
- to?: any;
44
- current?: boolean;
45
- icon?: string;
46
- }
47
-
48
- const props = withDefaults(defineProps<{
49
- items: LuBreadcrumbItem[];
50
- variant?: string;
51
- separatorIcon?: string;
52
- }>(), {
53
- separatorIcon: 'chevron-right'
54
- });
55
-
56
- const { resolveSkin } = useLumoraConfig();
57
-
58
- const resolvedSkin = computed(() => resolveSkin("LuBreadcrumb", props.variant));
59
- const resolvedItemSkin = computed(() => resolveSkin("LuBreadcrumbItem", props.variant));
60
- const resolvedLinkSkin = computed(() => resolveSkin("LuBreadcrumbLink", props.variant));
61
- const resolvedPageSkin = computed(() => resolveSkin("LuBreadcrumbPage", props.variant));
62
- const resolvedSeparatorSkin = computed(() => resolveSkin("LuBreadcrumbSeparator", props.variant));
63
- </script>
@@ -1,58 +0,0 @@
1
- <template>
2
- <component
3
- :is="componentType"
4
- v-bind="bindingProps"
5
- :class="resolvedSkin"
6
- @click="emit('click', $event)"
7
- >
8
- <slot />
9
- </component>
10
- </template>
11
-
12
- <script setup lang="ts">
13
- import { computed, resolveComponent, useAttrs } from "vue";
14
- import { useLumoraConfig } from "../context";
15
-
16
- const props = defineProps<{
17
- type?: "button" | "submit" | "reset";
18
- disabled?: boolean;
19
- variant?: string;
20
- as?: string;
21
- to?: any;
22
- href?: string;
23
- }>();
24
-
25
- const emit = defineEmits<{
26
- (e: "click", event: MouseEvent): void;
27
- }>();
28
-
29
- const componentType = computed(() => {
30
- if (props.as) return props.as;
31
- if (props.to) {
32
- const routerLink = resolveComponent("RouterLink");
33
- return typeof routerLink === 'string' ? 'a' : routerLink;
34
- }
35
- if (props.href) return "a";
36
- return "button";
37
- });
38
-
39
- const bindingProps = computed(() => {
40
- const p: any = { ...props, ...useAttrs() };
41
- delete p.variant;
42
- delete p.as;
43
-
44
- if (componentType.value !== 'button') {
45
- delete p.type;
46
- }
47
- if (props.disabled && componentType.value !== 'button') {
48
- // Buttons can be natively disabled, but links cannot easily.
49
- // However, if disabled is true, we keep it so CSS can style it.
50
- // To prevent click navigation on disabled links, we would need to handle the click event.
51
- // For now, we pass it down so styling works.
52
- }
53
- return p;
54
- });
55
-
56
- const { resolveSkin } = useLumoraConfig();
57
- const resolvedSkin = computed(() => resolveSkin("LuButton", props.variant));
58
- </script>
@@ -1,27 +0,0 @@
1
- <template>
2
- <component :is="as" v-bind="$attrs" :class="resolvedSkin">
3
- <slot />
4
- </component>
5
- </template>
6
-
7
- <script setup lang="ts">
8
- import { computed } from "vue";
9
- import { useLumoraConfig } from "../context";
10
- import { resolveLayoutProps, cn } from "../utils";
11
-
12
- const props = withDefaults(defineProps<{
13
- variant?: string;
14
- as?: string;
15
- padding?: string | number;
16
- width?: string;
17
- height?: string;
18
- }>(), {
19
- as: "div"
20
- });
21
-
22
- const { resolveSkin } = useLumoraConfig();
23
- const resolvedSkin = computed(() => cn(
24
- resolveSkin("LuCard", props.variant),
25
- resolveLayoutProps(props)
26
- ));
27
- </script>
@@ -1,94 +0,0 @@
1
- <template>
2
- <div :class="resolvedContainerSkin">
3
- <input
4
- type="checkbox"
5
- v-bind="$attrs"
6
- :class="resolvedSkin"
7
- :checked="modelValue"
8
- :name="name"
9
- :disabled="formContext?.disabled.value"
10
- @change="onChange"
11
- @blur="onBlur"
12
- />
13
- <label v-if="$slots.default || label" :class="resolvedLabelSkin" @click.prevent="toggle">
14
- <slot>{{ label }}</slot>
15
- </label>
16
- </div>
17
- </template>
18
-
19
- <script setup lang="ts">
20
- import { computed, inject, onMounted, onUnmounted, ref, watch } from "vue";
21
- import { useLumoraConfig } from "../context";
22
- import { LuFormContextKey } from "./LuForm.types";
23
-
24
- const props = defineProps<{
25
- modelValue?: boolean;
26
- variant?: string;
27
- name?: string;
28
- label?: string;
29
- error?: string | null;
30
- }>();
31
-
32
- const emit = defineEmits<{
33
- (e: "update:modelValue", value: boolean): void;
34
- (e: "change", value: boolean): void;
35
- (e: "blur"): void;
36
- }>();
37
-
38
- const { resolveSkin } = useLumoraConfig();
39
- const resolvedContainerSkin = computed(() => resolveSkin("LuCheckboxContainer", props.variant));
40
- const resolvedSkin = computed(() => resolveSkin("LuCheckbox", props.variant));
41
- const resolvedLabelSkin = computed(() => resolveSkin("LuCheckboxLabel", props.variant));
42
-
43
- const formContext = inject(LuFormContextKey, null);
44
- const internalValue = ref<boolean>(!!props.modelValue);
45
-
46
- watch(() => props.modelValue, (newVal) => {
47
- internalValue.value = !!newVal;
48
- });
49
-
50
- const onChange = (event: Event) => {
51
- const target = event.target as HTMLInputElement;
52
- const value = target.checked;
53
- internalValue.value = value;
54
- emit("update:modelValue", value);
55
- emit("change", value);
56
-
57
- if (props.name && formContext && (formContext.validateOn.value === "blur" || formContext.validateOn.value === "both")) {
58
- // trigger validation handled by parent
59
- }
60
- };
61
-
62
- const toggle = () => {
63
- if (formContext?.disabled.value || ("disabled" in props && (props as any).disabled !== false)) return;
64
- const newValue = !internalValue.value;
65
- internalValue.value = newValue;
66
- emit("update:modelValue", newValue);
67
- emit("change", newValue);
68
-
69
- if (props.name && formContext && (formContext.validateOn.value === "blur" || formContext.validateOn.value === "both")) {
70
- // trigger validation handled by parent
71
- }
72
- };
73
-
74
- const onBlur = () => {
75
- if (props.name && formContext && (formContext.validateOn.value === "blur" || formContext.validateOn.value === "both")) {
76
- // trigger validation handled by parent
77
- }
78
- emit("blur");
79
- };
80
-
81
- onMounted(() => {
82
- if (!props.name || !formContext) return;
83
- formContext.register({
84
- name: props.name,
85
- getValue: () => internalValue.value,
86
- setValue: (v) => { internalValue.value = !!v; },
87
- setError: (_msg) => {},
88
- });
89
- });
90
-
91
- onUnmounted(() => {
92
- if (props.name && formContext) formContext.unregister(props.name);
93
- });
94
- </script>