numori-ui 0.1.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 (130) hide show
  1. package/LICENSE +651 -0
  2. package/README.md +466 -0
  3. package/dist/components/Alert.js +137 -0
  4. package/dist/components/Alert.js.map +1 -0
  5. package/dist/components/Avatar.js +133 -0
  6. package/dist/components/Avatar.js.map +1 -0
  7. package/dist/components/Badge.js +93 -0
  8. package/dist/components/Badge.js.map +1 -0
  9. package/dist/components/Button.js +428 -0
  10. package/dist/components/Button.js.map +1 -0
  11. package/dist/components/ButtonsGroup.js +153 -0
  12. package/dist/components/ButtonsGroup.js.map +1 -0
  13. package/dist/components/Checkbox.js +93 -0
  14. package/dist/components/Checkbox.js.map +1 -0
  15. package/dist/components/Divider.js +79 -0
  16. package/dist/components/Divider.js.map +1 -0
  17. package/dist/components/Dropdown.js +166 -0
  18. package/dist/components/Dropdown.js.map +1 -0
  19. package/dist/components/DropdownItem.js +106 -0
  20. package/dist/components/DropdownItem.js.map +1 -0
  21. package/dist/components/DropdownRow.js +41 -0
  22. package/dist/components/DropdownRow.js.map +1 -0
  23. package/dist/components/DropdownSubmenu.js +142 -0
  24. package/dist/components/DropdownSubmenu.js.map +1 -0
  25. package/dist/components/FileInput.js +122 -0
  26. package/dist/components/FileInput.js.map +1 -0
  27. package/dist/components/FormField.js +112 -0
  28. package/dist/components/FormField.js.map +1 -0
  29. package/dist/components/Input.js +603 -0
  30. package/dist/components/Input.js.map +1 -0
  31. package/dist/components/Kbd.js +35 -0
  32. package/dist/components/Kbd.js.map +1 -0
  33. package/dist/components/ListMenu.js +143 -0
  34. package/dist/components/ListMenu.js.map +1 -0
  35. package/dist/components/ListMenuItem.js +189 -0
  36. package/dist/components/ListMenuItem.js.map +1 -0
  37. package/dist/components/Modal.js +206 -0
  38. package/dist/components/Modal.js.map +1 -0
  39. package/dist/components/Numpad.js +123 -0
  40. package/dist/components/Numpad.js.map +1 -0
  41. package/dist/components/Popup.js +170 -0
  42. package/dist/components/Popup.js.map +1 -0
  43. package/dist/components/ProgressBar.js +118 -0
  44. package/dist/components/ProgressBar.js.map +1 -0
  45. package/dist/components/Prompt.js +201 -0
  46. package/dist/components/Prompt.js.map +1 -0
  47. package/dist/components/Radio.js +81 -0
  48. package/dist/components/Radio.js.map +1 -0
  49. package/dist/components/Select.js +441 -0
  50. package/dist/components/Select.js.map +1 -0
  51. package/dist/components/Slider.js +116 -0
  52. package/dist/components/Slider.js.map +1 -0
  53. package/dist/components/Stepper.js +65 -0
  54. package/dist/components/Stepper.js.map +1 -0
  55. package/dist/components/Toggle.js +133 -0
  56. package/dist/components/Toggle.js.map +1 -0
  57. package/dist/components/Tooltip.js +120 -0
  58. package/dist/components/Tooltip.js.map +1 -0
  59. package/dist/components/index.js +81 -0
  60. package/dist/components/index.js.map +1 -0
  61. package/dist/composables/onClickOutside.js +51 -0
  62. package/dist/composables/onClickOutside.js.map +1 -0
  63. package/dist/composables/useBackButton.js +98 -0
  64. package/dist/composables/useBackButton.js.map +1 -0
  65. package/dist/composables/useEventListener.js +63 -0
  66. package/dist/composables/useEventListener.js.map +1 -0
  67. package/dist/icons/Icon.js +120 -0
  68. package/dist/icons/Icon.js.map +1 -0
  69. package/dist/icons/mdi.js +69 -0
  70. package/dist/icons/mdi.js.map +1 -0
  71. package/dist/icons/registry.js +63 -0
  72. package/dist/icons/registry.js.map +1 -0
  73. package/dist/icons/resolver.js +49 -0
  74. package/dist/icons/resolver.js.map +1 -0
  75. package/dist/index.d.ts +108 -0
  76. package/dist/index.js +157 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/manifest.js +89 -0
  79. package/dist/manifest.js.map +1 -0
  80. package/dist/numori-ui.css +184 -0
  81. package/dist/nuxt.d.ts +35 -0
  82. package/dist/nuxt.mjs +243 -0
  83. package/dist/nuxt.mjs.map +1 -0
  84. package/dist/vite.d.ts +29 -0
  85. package/dist/vite.mjs +187 -0
  86. package/dist/vite.mjs.map +1 -0
  87. package/package.json +138 -0
  88. package/src/components/Alert.vue +127 -0
  89. package/src/components/Avatar.vue +100 -0
  90. package/src/components/Badge.vue +77 -0
  91. package/src/components/Button.vue +419 -0
  92. package/src/components/ButtonsGroup.vue +140 -0
  93. package/src/components/Checkbox.vue +81 -0
  94. package/src/components/Divider.vue +64 -0
  95. package/src/components/Dropdown.vue +150 -0
  96. package/src/components/DropdownItem.vue +78 -0
  97. package/src/components/DropdownRow.vue +37 -0
  98. package/src/components/DropdownSubmenu.vue +127 -0
  99. package/src/components/FileInput.vue +107 -0
  100. package/src/components/FormField.vue +86 -0
  101. package/src/components/Input.vue +619 -0
  102. package/src/components/Kbd.vue +30 -0
  103. package/src/components/ListMenu.vue +127 -0
  104. package/src/components/ListMenuItem.vue +171 -0
  105. package/src/components/Modal.vue +209 -0
  106. package/src/components/Numpad.vue +118 -0
  107. package/src/components/Popup.vue +156 -0
  108. package/src/components/ProgressBar.vue +107 -0
  109. package/src/components/Prompt.vue +161 -0
  110. package/src/components/Radio.vue +50 -0
  111. package/src/components/Select.vue +470 -0
  112. package/src/components/Slider.vue +93 -0
  113. package/src/components/Stepper.vue +53 -0
  114. package/src/components/Toggle.vue +125 -0
  115. package/src/components/Tooltip.vue +113 -0
  116. package/src/components/index.js +109 -0
  117. package/src/composables/onClickOutside.js +61 -0
  118. package/src/composables/useBackButton.js +98 -0
  119. package/src/composables/useEventListener.js +65 -0
  120. package/src/icons/Icon.vue +139 -0
  121. package/src/icons/mdi.js +67 -0
  122. package/src/icons/registry.js +64 -0
  123. package/src/icons/resolver.js +48 -0
  124. package/src/index.js +167 -0
  125. package/src/manifest.js +86 -0
  126. package/src/nuxt.js +315 -0
  127. package/src/style.css +20 -0
  128. package/src/tailwind.css +18 -0
  129. package/src/theme.css +172 -0
  130. package/src/vite.js +235 -0
@@ -0,0 +1,133 @@
1
+ import _sfc_main$1 from "../icons/Icon.js";
2
+ import { computed, createBlock, createElementBlock, normalizeClass, openBlock } from "vue";
3
+ //#region src/components/Avatar.vue
4
+ var _hoisted_1 = ["src", "alt"];
5
+ var _sfc_main = {
6
+ __name: "Avatar",
7
+ props: {
8
+ /**
9
+ * Image source URL. When empty, the fallback icon is shown.
10
+ * @type {string}
11
+ * @default ''
12
+ */
13
+ src: {
14
+ type: String,
15
+ default: ""
16
+ },
17
+ /**
18
+ * Alt text for the avatar image (accessibility).
19
+ * @type {string}
20
+ * @default 'Avatar'
21
+ */
22
+ alt: {
23
+ type: String,
24
+ default: "Avatar"
25
+ },
26
+ /**
27
+ * Avatar size controlling width, height, and icon dimensions.
28
+ * @type {string}
29
+ * @default 'md'
30
+ * @values 'xs' (24px) | 'sm' (32px) | 'md' (36px) | 'lg' (48px) | 'xl' (64px)
31
+ */
32
+ size: {
33
+ type: String,
34
+ default: "md"
35
+ },
36
+ /**
37
+ * MDI icon name used when no image src is provided.
38
+ * @type {string}
39
+ * @default 'mdi:account'
40
+ */
41
+ fallbackIcon: {
42
+ type: String,
43
+ default: "mdi:account"
44
+ },
45
+ /**
46
+ * Background color theme for the fallback icon state.
47
+ * @type {string}
48
+ * @default 'primary'
49
+ * @values 'primary' | 'gray'
50
+ */
51
+ color: {
52
+ type: String,
53
+ default: "primary"
54
+ },
55
+ /**
56
+ * Show a ring border around the avatar for emphasis.
57
+ * @type {boolean}
58
+ * @default false
59
+ */
60
+ ring: {
61
+ type: Boolean,
62
+ default: false
63
+ }
64
+ },
65
+ setup(__props) {
66
+ /**
67
+ * UiAvatar — Circular avatar component displaying an image or a fallback icon.
68
+ *
69
+ * When a `src` URL is provided, renders a cover-fit image. Otherwise, displays
70
+ * a configurable fallback icon on a colored background. Supports five sizes,
71
+ * two color themes for the fallback state, and an optional ring border.
72
+ *
73
+ * @example Image avatar
74
+ * <UiAvatar src="/img/user.jpg" alt="Jane Doe" size="lg" />
75
+ *
76
+ * @example Fallback icon avatar with ring
77
+ * <UiAvatar size="md" color="primary" ring />
78
+ *
79
+ * @example Small gray avatar with custom icon
80
+ * <UiAvatar size="sm" color="gray" fallback-icon="mdi:account-group" />
81
+ */
82
+ const props = __props;
83
+ const sizeClass = computed(() => {
84
+ const map = {
85
+ xs: "w-6 h-6",
86
+ sm: "w-8 h-8",
87
+ md: "w-9 h-9",
88
+ lg: "w-12 h-12",
89
+ xl: "w-16 h-16"
90
+ };
91
+ return map[props.size] || map.md;
92
+ });
93
+ const iconSizeClass = computed(() => {
94
+ const map = {
95
+ xs: "w-3 h-3",
96
+ sm: "w-4 h-4",
97
+ md: "w-5 h-5",
98
+ lg: "w-6 h-6",
99
+ xl: "w-8 h-8"
100
+ };
101
+ return map[props.size] || map.md;
102
+ });
103
+ const bgClass = computed(() => {
104
+ if (props.src) return "";
105
+ const map = {
106
+ primary: "bg-primary-100 dark:bg-primary-900/30 text-primary-600 dark:text-primary-400",
107
+ gray: "bg-gray-200 dark:bg-gray-700 text-gray-500 dark:text-gray-400"
108
+ };
109
+ return map[props.color] || map.primary;
110
+ });
111
+ const ringClass = computed(() => props.ring ? "ring-2 ring-primary-200 dark:ring-primary-800 shadow-sm" : "");
112
+ return (_ctx, _cache) => {
113
+ return openBlock(), createElementBlock("div", { class: normalizeClass(["rounded-full flex items-center justify-center overflow-hidden shrink-0", [
114
+ sizeClass.value,
115
+ bgClass.value,
116
+ ringClass.value
117
+ ]]) }, [__props.src ? (openBlock(), createElementBlock("img", {
118
+ key: 0,
119
+ src: __props.src,
120
+ alt: __props.alt,
121
+ class: "w-full h-full object-cover"
122
+ }, null, 8, _hoisted_1)) : (openBlock(), createBlock(_sfc_main$1, {
123
+ key: 1,
124
+ name: __props.fallbackIcon,
125
+ class: normalizeClass(iconSizeClass.value)
126
+ }, null, 8, ["name", "class"]))], 2);
127
+ };
128
+ }
129
+ };
130
+ //#endregion
131
+ export { _sfc_main as default };
132
+
133
+ //# sourceMappingURL=Avatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Avatar.js","names":[],"sources":["../../src/components/Avatar.vue"],"sourcesContent":["<template>\n <!-- Circular avatar container with image or fallback icon -->\n <div\n class=\"rounded-full flex items-center justify-center overflow-hidden shrink-0\"\n :class=\"[sizeClass, bgClass, ringClass]\"\n >\n <img v-if=\"src\" :src=\"src\" :alt=\"alt\" class=\"w-full h-full object-cover\" />\n <UiIcon v-else :name=\"fallbackIcon\" :class=\"iconSizeClass\" />\n </div>\n</template>\n\n<script setup>\n/**\n * UiAvatar — Circular avatar component displaying an image or a fallback icon.\n *\n * When a `src` URL is provided, renders a cover-fit image. Otherwise, displays\n * a configurable fallback icon on a colored background. Supports five sizes,\n * two color themes for the fallback state, and an optional ring border.\n *\n * @example Image avatar\n * <UiAvatar src=\"/img/user.jpg\" alt=\"Jane Doe\" size=\"lg\" />\n *\n * @example Fallback icon avatar with ring\n * <UiAvatar size=\"md\" color=\"primary\" ring />\n *\n * @example Small gray avatar with custom icon\n * <UiAvatar size=\"sm\" color=\"gray\" fallback-icon=\"mdi:account-group\" />\n */\nimport { computed } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nconst props = defineProps({\n /**\n * Image source URL. When empty, the fallback icon is shown.\n * @type {string}\n * @default ''\n */\n src: { type: String, default: '' },\n\n /**\n * Alt text for the avatar image (accessibility).\n * @type {string}\n * @default 'Avatar'\n */\n alt: { type: String, default: 'Avatar' },\n\n /**\n * Avatar size controlling width, height, and icon dimensions.\n * @type {string}\n * @default 'md'\n * @values 'xs' (24px) | 'sm' (32px) | 'md' (36px) | 'lg' (48px) | 'xl' (64px)\n */\n size: { type: String, default: 'md' },\n\n /**\n * MDI icon name used when no image src is provided.\n * @type {string}\n * @default 'mdi:account'\n */\n fallbackIcon: { type: String, default: 'mdi:account' },\n\n /**\n * Background color theme for the fallback icon state.\n * @type {string}\n * @default 'primary'\n * @values 'primary' | 'gray'\n */\n color: { type: String, default: 'primary' },\n\n /**\n * Show a ring border around the avatar for emphasis.\n * @type {boolean}\n * @default false\n */\n ring: { type: Boolean, default: false },\n})\n\nconst sizeClass = computed(() => {\n const map = { xs: 'w-6 h-6', sm: 'w-8 h-8', md: 'w-9 h-9', lg: 'w-12 h-12', xl: 'w-16 h-16' }\n return map[props.size] || map.md\n})\n\nconst iconSizeClass = computed(() => {\n const map = { xs: 'w-3 h-3', sm: 'w-4 h-4', md: 'w-5 h-5', lg: 'w-6 h-6', xl: 'w-8 h-8' }\n return map[props.size] || map.md\n})\n\n// Only apply background color when showing the fallback icon (not when an image is loaded)\nconst bgClass = computed(() => {\n if (props.src) return ''\n const map = {\n primary: 'bg-primary-100 dark:bg-primary-900/30 text-primary-600 dark:text-primary-400',\n gray: 'bg-gray-200 dark:bg-gray-700 text-gray-500 dark:text-gray-400',\n }\n return map[props.color] || map.primary\n})\n\nconst ringClass = computed(() =>\n props.ring ? 'ring-2 ring-primary-200 dark:ring-primary-800 shadow-sm' : '',\n)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BA,MAAM,QAAQ;EA8Cd,MAAM,YAAY,eAAe;GAC/B,MAAM,MAAM;IAAE,IAAI;IAAW,IAAI;IAAW,IAAI;IAAW,IAAI;IAAa,IAAI;GAAY;GAC5F,OAAO,IAAI,MAAM,SAAS,IAAI;EAChC,CAAC;EAED,MAAM,gBAAgB,eAAe;GACnC,MAAM,MAAM;IAAE,IAAI;IAAW,IAAI;IAAW,IAAI;IAAW,IAAI;IAAW,IAAI;GAAU;GACxF,OAAO,IAAI,MAAM,SAAS,IAAI;EAChC,CAAC;EAGD,MAAM,UAAU,eAAe;GAC7B,IAAI,MAAM,KAAK,OAAO;GACtB,MAAM,MAAM;IACV,SAAS;IACT,MAAM;GACR;GACA,OAAO,IAAI,MAAM,UAAU,IAAI;EACjC,CAAC;EAED,MAAM,YAAY,eAChB,MAAM,OAAO,4DAA4D,EAC3E;;GAhGE,OAAA,UAAA,GAAA,mBAMM,OAAA,EALJ,OAAK,eAAA,CAAC,0EAAwE;IACrE,UAAA;IAAW,QAAA;IAAS,UAAA;GAAS,CAAA,CAAA,EAAA,GAAA,CAE3B,QAAA,OAAX,UAAA,GAAA,mBAA2E,OAAA;;IAA1D,KAAK,QAAA;IAAM,KAAK,QAAA;IAAK,OAAM;GAC5C,GAAA,MAAA,GAAA,UAAA,MAAA,UAAA,GAAA,YAA6D,aAAA;;IAA7C,MAAM,QAAA;IAAe,OAAK,eAAE,cAAA,KAAa"}
@@ -0,0 +1,93 @@
1
+ import _sfc_main$1 from "../icons/Icon.js";
2
+ import { computed, createBlock, createCommentVNode, createElementBlock, normalizeClass, openBlock, renderSlot } from "vue";
3
+ //#region src/components/Badge.vue
4
+ var _sfc_main = {
5
+ __name: "Badge",
6
+ props: {
7
+ /**
8
+ * Color theme for the badge background and text.
9
+ * @type {string}
10
+ * @default 'primary'
11
+ * @values 'primary' | 'gray' | 'red' | 'green' | 'amber'
12
+ */
13
+ color: {
14
+ type: String,
15
+ default: "primary"
16
+ },
17
+ /**
18
+ * Badge size controlling padding and font size.
19
+ * @type {string}
20
+ * @default 'xs'
21
+ * @values 'xs' | 'sm' | 'md'
22
+ */
23
+ size: {
24
+ type: String,
25
+ default: "xs"
26
+ },
27
+ /**
28
+ * Optional MDI icon name displayed before the slot content.
29
+ * @type {string}
30
+ * @default ''
31
+ */
32
+ icon: {
33
+ type: String,
34
+ default: ""
35
+ }
36
+ },
37
+ setup(__props) {
38
+ /**
39
+ * UiBadge — Inline pill-shaped badge with color themes, sizes, and optional icon.
40
+ *
41
+ * Renders a small rounded-full label suitable for status indicators, tags, or counts.
42
+ * Supports five color themes and three sizes. An optional leading icon is sized
43
+ * proportionally to the badge size.
44
+ *
45
+ * @example Primary badge
46
+ * <UiBadge>New</UiBadge>
47
+ *
48
+ * @example Red badge with icon
49
+ * <UiBadge color="red" icon="mdi:alert-circle">Error</UiBadge>
50
+ *
51
+ * @example Medium green badge
52
+ * <UiBadge color="green" size="md">Active</UiBadge>
53
+ *
54
+ * @slot default — Badge text or content
55
+ */
56
+ const props = __props;
57
+ const classes = computed(() => {
58
+ const base = "inline-flex items-center gap-1 rounded-full font-medium";
59
+ const sizeMap = {
60
+ xs: "px-1.5 py-0.5 text-[10px]",
61
+ sm: "px-2 py-0.5 text-xs",
62
+ md: "px-2.5 py-1 text-xs"
63
+ };
64
+ const colorMap = {
65
+ primary: "bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300",
66
+ gray: "bg-gray-200 dark:bg-gray-700 text-gray-500 dark:text-gray-400",
67
+ red: "bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300",
68
+ green: "bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300",
69
+ amber: "bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300"
70
+ };
71
+ return `${base} ${sizeMap[props.size] || sizeMap.xs} ${colorMap[props.color] || colorMap.primary}`;
72
+ });
73
+ const iconSizeClass = computed(() => {
74
+ const map = {
75
+ xs: "w-3 h-3",
76
+ sm: "w-3.5 h-3.5",
77
+ md: "w-4 h-4"
78
+ };
79
+ return map[props.size] || map.xs;
80
+ });
81
+ return (_ctx, _cache) => {
82
+ return openBlock(), createElementBlock("span", { class: normalizeClass(classes.value) }, [__props.icon ? (openBlock(), createBlock(_sfc_main$1, {
83
+ key: 0,
84
+ name: __props.icon,
85
+ class: normalizeClass([iconSizeClass.value, "shrink-0"])
86
+ }, null, 8, ["name", "class"])) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default")], 2);
87
+ };
88
+ }
89
+ };
90
+ //#endregion
91
+ export { _sfc_main as default };
92
+
93
+ //# sourceMappingURL=Badge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.js","names":[],"sources":["../../src/components/Badge.vue"],"sourcesContent":["<template>\n <!-- Inline pill badge with optional leading icon -->\n <span :class=\"classes\">\n <UiIcon v-if=\"icon\" :name=\"icon\" :class=\"iconSizeClass\" class=\"shrink-0\" />\n <slot />\n </span>\n</template>\n\n<script setup>\n/**\n * UiBadge — Inline pill-shaped badge with color themes, sizes, and optional icon.\n *\n * Renders a small rounded-full label suitable for status indicators, tags, or counts.\n * Supports five color themes and three sizes. An optional leading icon is sized\n * proportionally to the badge size.\n *\n * @example Primary badge\n * <UiBadge>New</UiBadge>\n *\n * @example Red badge with icon\n * <UiBadge color=\"red\" icon=\"mdi:alert-circle\">Error</UiBadge>\n *\n * @example Medium green badge\n * <UiBadge color=\"green\" size=\"md\">Active</UiBadge>\n *\n * @slot default — Badge text or content\n */\nimport { computed } from 'vue'\nimport UiIcon from '../icons/Icon.vue'\nconst props = defineProps({\n /**\n * Color theme for the badge background and text.\n * @type {string}\n * @default 'primary'\n * @values 'primary' | 'gray' | 'red' | 'green' | 'amber'\n */\n color: { type: String, default: 'primary' },\n\n /**\n * Badge size controlling padding and font size.\n * @type {string}\n * @default 'xs'\n * @values 'xs' | 'sm' | 'md'\n */\n size: { type: String, default: 'xs' },\n\n /**\n * Optional MDI icon name displayed before the slot content.\n * @type {string}\n * @default ''\n */\n icon: { type: String, default: '' },\n})\n\nconst classes = computed(() => {\n const base = 'inline-flex items-center gap-1 rounded-full font-medium'\n const sizeMap = {\n xs: 'px-1.5 py-0.5 text-[10px]',\n sm: 'px-2 py-0.5 text-xs',\n md: 'px-2.5 py-1 text-xs',\n }\n const colorMap = {\n primary: 'bg-primary-100 dark:bg-primary-900/30 text-primary-700 dark:text-primary-300',\n gray: 'bg-gray-200 dark:bg-gray-700 text-gray-500 dark:text-gray-400',\n red: 'bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300',\n green: 'bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-300',\n amber: 'bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300',\n }\n return `${base} ${sizeMap[props.size] || sizeMap.xs} ${colorMap[props.color] || colorMap.primary}`\n})\n\n// Icon dimensions scale with badge size for visual balance\nconst iconSizeClass = computed(() => {\n const map = { xs: 'w-3 h-3', sm: 'w-3.5 h-3.5', md: 'w-4 h-4' }\n return map[props.size] || map.xs\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BA,MAAM,QAAQ;EAyBd,MAAM,UAAU,eAAe;GAC7B,MAAM,OAAO;GACb,MAAM,UAAU;IACd,IAAI;IACJ,IAAI;IACJ,IAAI;GACN;GACA,MAAM,WAAW;IACf,SAAS;IACT,MAAM;IACN,KAAK;IACL,OAAO;IACP,OAAO;GACT;GACA,OAAO,GAAG,KAAK,GAAG,QAAQ,MAAM,SAAS,QAAQ,GAAG,GAAG,SAAS,MAAM,UAAU,SAAS;EAC3F,CAAC;EAGD,MAAM,gBAAgB,eAAe;GACnC,MAAM,MAAM;IAAE,IAAI;IAAW,IAAI;IAAe,IAAI;GAAU;GAC9D,OAAO,IAAI,MAAM,SAAS,IAAI;EAChC,CAAC;;GAzEC,OAAA,UAAA,GAAA,mBAGO,QAAA,EAHA,OAAK,eAAE,QAAA,KAAO,EAAA,GAAA,CACL,QAAA,QAAd,UAAA,GAAA,YAA2E,aAAA;;IAAtD,MAAM,QAAA;IAAO,OAAK,eAAA,CAAE,cAAA,OAAqB,UAAU,CAAA;GACxE,GAAA,MAAA,GAAA,CAAA,QAAA,OAAA,CAAA,KAAA,mBAAA,IAAA,IAAA,GAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA"}
@@ -0,0 +1,428 @@
1
+ import _sfc_main$1 from "../icons/Icon.js";
2
+ import { computed, createBlock, mergeProps, normalizeClass, openBlock, renderSlot, resolveDynamicComponent, useAttrs, withCtx } from "vue";
3
+ import { twMerge } from "tailwind-merge";
4
+ //#region src/components/Button.vue
5
+ var _sfc_main = /*@__PURE__*/ Object.assign({ inheritAttrs: false }, {
6
+ __name: "Button",
7
+ props: {
8
+ /**
9
+ * HTML element tag to render.
10
+ * @type {string}
11
+ * @default 'button'
12
+ * @values 'button' | 'a' | 'div' | any valid HTML tag
13
+ */
14
+ tag: {
15
+ type: String,
16
+ default: "button"
17
+ },
18
+ /**
19
+ * Native button `type` attribute (only applied when tag is 'button').
20
+ * @type {string}
21
+ * @default 'button'
22
+ * @values 'button' | 'submit' | 'reset'
23
+ */
24
+ nativeType: {
25
+ type: String,
26
+ default: "button"
27
+ },
28
+ /**
29
+ * Visual variant controlling background, border, and hover styles.
30
+ * - 'solid' — filled background with shadow
31
+ * - 'outline' — transparent with colored border
32
+ * - 'ghost' — transparent, colored on hover
33
+ * - 'dashed' — dashed border, transparent background
34
+ * - 'text' — plain text, underline on hover
35
+ * - 'link' — inline link style, no padding
36
+ * - 'menu-item' — full-width row for dropdown menus
37
+ * - 'list-item' — full-width row for settings lists
38
+ * @type {string}
39
+ * @default 'solid'
40
+ */
41
+ variant: {
42
+ type: String,
43
+ default: "solid"
44
+ },
45
+ /**
46
+ * Color theme key mapped to Tailwind color scales.
47
+ * @type {string}
48
+ * @default 'primary'
49
+ * @values 'primary' | 'gray' | 'red' | 'green' | 'amber' | 'white'
50
+ */
51
+ color: {
52
+ type: String,
53
+ default: "primary"
54
+ },
55
+ /**
56
+ * Button size controlling padding, font size, and gap.
57
+ * @type {string}
58
+ * @default 'md'
59
+ * @values 'xs' | 'sm' | 'md' | 'lg' | 'xl'
60
+ */
61
+ size: {
62
+ type: String,
63
+ default: "md"
64
+ },
65
+ /**
66
+ * Border-radius shape of the button.
67
+ * @type {string}
68
+ * @default 'round'
69
+ * @values 'round' (rounded-lg) | 'pill' (rounded-full) | 'square' (rounded-none) | 'circle' (rounded-full) | 'none'
70
+ */
71
+ shape: {
72
+ type: String,
73
+ default: "round"
74
+ },
75
+ /**
76
+ * Disabled state — visually dims the button and prevents interaction.
77
+ * @type {boolean}
78
+ * @default false
79
+ */
80
+ disabled: {
81
+ type: Boolean,
82
+ default: false
83
+ },
84
+ /**
85
+ * Loading state — replaces slot content with a spinner and disables the button.
86
+ * @type {boolean}
87
+ * @default false
88
+ */
89
+ loading: {
90
+ type: Boolean,
91
+ default: false
92
+ },
93
+ /**
94
+ * Loading visual style.
95
+ * - 'spinner': replaces slot content with a spinner icon (default)
96
+ * - 'icon': keeps slot content visible, exposes `spinning` slot prop for the icon
97
+ * @type {string}
98
+ * @default 'spinner'
99
+ */
100
+ loadingStyle: {
101
+ type: String,
102
+ default: "spinner"
103
+ },
104
+ /**
105
+ * MDI icon name for the loading spinner.
106
+ * @type {string}
107
+ * @default 'mdi:loading'
108
+ */
109
+ spinner: {
110
+ type: String,
111
+ default: "mdi:loading"
112
+ },
113
+ /**
114
+ * Block mode — makes the button full-width (w-full).
115
+ * @type {boolean}
116
+ * @default false
117
+ */
118
+ block: {
119
+ type: Boolean,
120
+ default: false
121
+ },
122
+ /**
123
+ * Icon-only mode — uses equal padding on all sides for a square/circle button.
124
+ * @type {boolean}
125
+ * @default false
126
+ */
127
+ iconOnly: {
128
+ type: Boolean,
129
+ default: false
130
+ },
131
+ /**
132
+ * URL for anchor tags (only applied when tag is 'a').
133
+ * @type {string}
134
+ * @default undefined
135
+ */
136
+ href: {
137
+ type: String,
138
+ default: void 0
139
+ },
140
+ /**
141
+ * Native `title` attribute for hover tooltip.
142
+ * @type {string}
143
+ * @default undefined
144
+ */
145
+ title: {
146
+ type: String,
147
+ default: void 0
148
+ },
149
+ /**
150
+ * Accessible label for screen readers.
151
+ * @type {string}
152
+ * @default undefined
153
+ */
154
+ ariaLabel: {
155
+ type: String,
156
+ default: void 0
157
+ },
158
+ /**
159
+ * ARIA checked state for toggle-style buttons.
160
+ * @type {string | boolean}
161
+ * @default undefined
162
+ */
163
+ ariaChecked: {
164
+ type: [String, Boolean],
165
+ default: void 0
166
+ },
167
+ /**
168
+ * ARIA role override (e.g. 'switch', 'tab').
169
+ * @type {string}
170
+ * @default undefined
171
+ */
172
+ role: {
173
+ type: String,
174
+ default: void 0
175
+ },
176
+ /**
177
+ * Tab index for keyboard navigation order.
178
+ * @type {string | number}
179
+ * @default undefined
180
+ */
181
+ tabindex: {
182
+ type: [String, Number],
183
+ default: void 0
184
+ }
185
+ },
186
+ setup(__props) {
187
+ /**
188
+ * UiButton — Versatile button component with multiple variants, colors, sizes, and shapes.
189
+ *
190
+ * Supports rendering as any HTML element (button, anchor, div), eight visual variants
191
+ * (solid, outline, ghost, dashed, text, link, menu-item, list-item), six color themes,
192
+ * five sizes, and five shape options. Includes loading state with a configurable spinner,
193
+ * icon-only mode, block/full-width layout, and full accessibility attribute support.
194
+ * External Tailwind classes are merged via `tailwind-merge` so they can override internals.
195
+ *
196
+ * @example Basic solid button
197
+ * <UiButton @click="save">Save</UiButton>
198
+ *
199
+ * @example Ghost icon button
200
+ * <UiButton variant="ghost" color="gray" icon-only>
201
+ * <UiIcon name="mdi:close" class="w-5 h-5" />
202
+ * </UiButton>
203
+ *
204
+ * @example Outline danger button with loading
205
+ * <UiButton variant="outline" color="red" :loading="isSaving">Delete</UiButton>
206
+ *
207
+ * @example Menu item in a dropdown
208
+ * <UiButton variant="menu-item" color="red">
209
+ * <UiIcon name="mdi:trash-can-outline" class="w-4 h-4" /> Delete
210
+ * </UiButton>
211
+ *
212
+ * @example Anchor link
213
+ * <UiButton tag="a" variant="link" href="/docs">Read docs</UiButton>
214
+ *
215
+ * @slot default — Button content (label text, icons, or any child elements)
216
+ */
217
+ const props = __props;
218
+ const isButton = computed(() => props.tag === "button");
219
+ const isMenuItem = computed(() => props.variant === "menu-item");
220
+ const isListItem = computed(() => props.variant === "list-item");
221
+ const isInlineVariant = computed(() => isMenuItem.value || isListItem.value);
222
+ const spinnerIcon = computed(() => props.spinner);
223
+ const spinnerSizeClass = computed(() => {
224
+ const map = {
225
+ xs: "w-3 h-3",
226
+ sm: "w-3.5 h-3.5",
227
+ md: "w-4 h-4",
228
+ lg: "w-5 h-5",
229
+ xl: "w-6 h-6"
230
+ };
231
+ return map[props.size] || map.md;
232
+ });
233
+ const sizeClasses = computed(() => {
234
+ if (isMenuItem.value) return "px-3 py-1.5 text-sm gap-2";
235
+ if (isListItem.value) return "px-3.5 py-2.5 text-sm gap-3";
236
+ if (props.iconOnly) {
237
+ const map = {
238
+ xs: "p-1",
239
+ sm: "p-1.5",
240
+ md: "p-2",
241
+ lg: "p-2.5",
242
+ xl: "p-3"
243
+ };
244
+ return map[props.size] || map.md;
245
+ }
246
+ const map = {
247
+ xs: "px-2 py-1 text-xs gap-1",
248
+ sm: "px-2.5 py-1.5 text-xs gap-1.5",
249
+ md: "px-4 py-2 text-sm gap-2",
250
+ lg: "px-5 py-2.5 text-sm gap-2",
251
+ xl: "px-6 py-3 text-base gap-2.5"
252
+ };
253
+ return map[props.size] || map.md;
254
+ });
255
+ const shapeClasses = computed(() => {
256
+ if (isInlineVariant.value) return "";
257
+ const map = {
258
+ round: "rounded-lg",
259
+ pill: "rounded-full",
260
+ square: "rounded-none",
261
+ circle: "rounded-full",
262
+ none: ""
263
+ };
264
+ return map[props.shape] || map.round;
265
+ });
266
+ const colorVariantClasses = computed(() => {
267
+ const v = props.variant;
268
+ const c = props.color;
269
+ if (v === "menu-item") {
270
+ const effectiveColor = c === "primary" ? "gray" : c;
271
+ const map = {
272
+ gray: "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700",
273
+ red: "text-red-600 dark:text-red-400 hover:bg-red-100 dark:hover:bg-red-900/30",
274
+ green: "text-success-600 dark:text-success-400 hover:bg-gray-100 dark:hover:bg-gray-700",
275
+ amber: "text-amber-600 dark:text-amber-400 hover:bg-gray-100 dark:hover:bg-gray-700",
276
+ white: "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"
277
+ };
278
+ return map[effectiveColor] || map.gray;
279
+ }
280
+ if (v === "list-item") {
281
+ const effectiveColor = c === "primary" ? "gray" : c;
282
+ const map = {
283
+ gray: "text-gray-700 dark:text-gray-300 hover:bg-gray-200/70 dark:hover:bg-gray-700/50",
284
+ red: "text-red-600 dark:text-red-400 hover:bg-red-200/50 dark:hover:bg-red-800/30",
285
+ green: "text-success-600 dark:text-success-400 hover:bg-gray-200/70 dark:hover:bg-gray-700/50",
286
+ amber: "text-amber-600 dark:text-amber-400 hover:bg-gray-200/70 dark:hover:bg-gray-700/50",
287
+ white: "text-gray-700 dark:text-gray-300 hover:bg-gray-200/70 dark:hover:bg-gray-700/50"
288
+ };
289
+ return map[effectiveColor] || map.gray;
290
+ }
291
+ if (v === "solid") {
292
+ const map = {
293
+ primary: "bg-primary-600 hover:bg-primary-700 text-white shadow-sm hover:shadow-md",
294
+ gray: "bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300",
295
+ red: "bg-red-600 hover:bg-red-700 text-white shadow-sm hover:shadow-md",
296
+ green: "bg-success-600 hover:bg-success-700 text-white shadow-sm hover:shadow-md",
297
+ amber: "bg-amber-600 hover:bg-amber-700 text-white shadow-sm hover:shadow-md",
298
+ white: "bg-white dark:bg-gray-700 hover:bg-gray-50 dark:hover:bg-gray-600 text-gray-900 dark:text-gray-200 shadow-sm"
299
+ };
300
+ return map[c] || map.primary;
301
+ }
302
+ if (v === "outline") {
303
+ const map = {
304
+ primary: "border border-primary-500 text-primary-600 dark:text-primary-400 bg-transparent hover:bg-primary-50 dark:hover:bg-primary-900/20",
305
+ gray: "border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800",
306
+ red: "border border-red-300 dark:border-red-700 text-red-600 dark:text-red-400 bg-transparent hover:bg-red-50 dark:hover:bg-red-900/20",
307
+ green: "border border-success-300 dark:border-success-700 text-success-600 dark:text-success-400 bg-transparent hover:bg-success-50 dark:hover:bg-success-900/20",
308
+ amber: "border border-amber-300 dark:border-amber-700 text-amber-600 dark:text-amber-400 bg-transparent hover:bg-amber-50 dark:hover:bg-amber-900/20",
309
+ white: "border border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700"
310
+ };
311
+ return map[c] || map.primary;
312
+ }
313
+ if (v === "dashed") {
314
+ const map = {
315
+ primary: "border border-dashed border-primary-400 dark:border-primary-600 text-primary-600 dark:text-primary-400 bg-transparent hover:bg-primary-50 dark:hover:bg-primary-900/20",
316
+ gray: "border border-dashed border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800",
317
+ red: "border border-dashed border-red-300 dark:border-red-700 text-red-600 dark:text-red-400 bg-transparent hover:bg-red-50 dark:hover:bg-red-900/20",
318
+ green: "border border-dashed border-success-300 dark:border-success-700 text-success-600 dark:text-success-400 bg-transparent hover:bg-success-50 dark:hover:bg-success-900/20",
319
+ amber: "border border-dashed border-amber-300 dark:border-amber-700 text-amber-600 dark:text-amber-400 bg-transparent hover:bg-amber-50 dark:hover:bg-amber-900/20",
320
+ white: "border border-dashed border-gray-300 dark:border-gray-600 text-gray-700 dark:text-gray-300 bg-transparent hover:bg-gray-50 dark:hover:bg-gray-700"
321
+ };
322
+ return map[c] || map.primary;
323
+ }
324
+ if (v === "ghost") {
325
+ const map = {
326
+ primary: "text-primary-600 dark:text-primary-400 bg-transparent hover:bg-primary-50 dark:hover:bg-primary-900/20",
327
+ gray: "text-gray-700 dark:text-gray-300 bg-transparent hover:bg-gray-100 dark:hover:bg-gray-800",
328
+ red: "text-red-600 dark:text-red-400 bg-transparent hover:bg-red-50 dark:hover:bg-red-900/20",
329
+ green: "text-success-600 dark:text-success-400 bg-transparent hover:bg-success-50 dark:hover:bg-success-900/20",
330
+ amber: "text-amber-600 dark:text-amber-400 bg-transparent hover:bg-amber-50 dark:hover:bg-amber-900/20",
331
+ white: "text-gray-700 dark:text-gray-300 bg-transparent hover:bg-gray-100 dark:hover:bg-gray-700"
332
+ };
333
+ return map[c] || map.primary;
334
+ }
335
+ if (v === "text") {
336
+ const map = {
337
+ primary: "text-primary-600 dark:text-primary-400 bg-transparent hover:underline",
338
+ gray: "text-gray-600 dark:text-gray-400 bg-transparent hover:underline",
339
+ red: "text-red-600 dark:text-red-400 bg-transparent hover:underline",
340
+ green: "text-success-600 dark:text-success-400 bg-transparent hover:underline",
341
+ amber: "text-amber-600 dark:text-amber-400 bg-transparent hover:underline",
342
+ white: "text-gray-700 dark:text-gray-300 bg-transparent hover:underline"
343
+ };
344
+ return map[c] || map.primary;
345
+ }
346
+ if (v === "link") {
347
+ const map = {
348
+ primary: "text-primary-600 dark:text-primary-400 hover:underline p-0",
349
+ gray: "text-gray-500 dark:text-gray-400 hover:underline p-0",
350
+ red: "text-red-600 dark:text-red-400 hover:underline p-0",
351
+ green: "text-success-600 dark:text-success-400 hover:underline p-0",
352
+ amber: "text-amber-600 dark:text-amber-400 hover:underline p-0",
353
+ white: "text-gray-700 dark:text-gray-300 hover:underline p-0"
354
+ };
355
+ return map[c] || map.primary;
356
+ }
357
+ return "";
358
+ });
359
+ const stateClasses = computed(() => {
360
+ if (props.disabled || props.loading) return "opacity-50 cursor-not-allowed pointer-events-none";
361
+ return "cursor-pointer";
362
+ });
363
+ const attrs = useAttrs();
364
+ const restAttrs = computed(() => {
365
+ const { class: _, ...rest } = attrs;
366
+ return rest;
367
+ });
368
+ const mergedClasses = computed(() => {
369
+ const externalClass = attrs.class || "";
370
+ return twMerge(internalClasses.value, externalClass);
371
+ });
372
+ const internalClasses = computed(() => {
373
+ const base = "inline-flex items-center transition-colors select-none";
374
+ const justify = isInlineVariant.value ? "" : "justify-center";
375
+ const blockClass = props.block || isInlineVariant.value ? "w-full" : "";
376
+ return [
377
+ base,
378
+ justify,
379
+ [
380
+ "ghost",
381
+ "text",
382
+ "link",
383
+ "menu-item",
384
+ "list-item"
385
+ ].includes(props.variant) ? "" : "font-medium",
386
+ sizeClasses.value,
387
+ shapeClasses.value,
388
+ colorVariantClasses.value,
389
+ stateClasses.value,
390
+ blockClass
391
+ ].filter(Boolean).join(" ");
392
+ });
393
+ return (_ctx, _cache) => {
394
+ return openBlock(), createBlock(resolveDynamicComponent(__props.tag), mergeProps({
395
+ type: isButton.value ? __props.nativeType : void 0,
396
+ disabled: isButton.value ? __props.disabled || __props.loading : void 0,
397
+ href: __props.tag === "a" ? __props.href : void 0,
398
+ class: mergedClasses.value,
399
+ title: __props.title,
400
+ "aria-label": __props.ariaLabel,
401
+ "aria-checked": __props.ariaChecked,
402
+ role: __props.role,
403
+ tabindex: __props.tabindex
404
+ }, restAttrs.value), {
405
+ default: withCtx(() => [__props.loading && __props.loadingStyle === "spinner" ? (openBlock(), createBlock(_sfc_main$1, {
406
+ key: 0,
407
+ name: spinnerIcon.value,
408
+ class: normalizeClass(["animate-spin", spinnerSizeClass.value])
409
+ }, null, 8, ["name", "class"])) : renderSlot(_ctx.$slots, "default", { spinning: __props.loading && __props.loadingStyle === "icon" }, void 0, void 0, 1)]),
410
+ _: 3
411
+ }, 16, [
412
+ "type",
413
+ "disabled",
414
+ "href",
415
+ "class",
416
+ "title",
417
+ "aria-label",
418
+ "aria-checked",
419
+ "role",
420
+ "tabindex"
421
+ ]);
422
+ };
423
+ }
424
+ });
425
+ //#endregion
426
+ export { _sfc_main as default };
427
+
428
+ //# sourceMappingURL=Button.js.map