orio-ui 1.3.0 → 1.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.
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.0.0 || ^4.0.0"
6
6
  },
7
- "version": "1.3.0",
7
+ "version": "1.4.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -0,0 +1,89 @@
1
+ <script setup lang="ts">
2
+ import { computed, toRefs, useAttrs, useSlots } from "vue";
3
+
4
+ interface Props {
5
+ icon?: string;
6
+ disabled?: boolean;
7
+ active?: boolean;
8
+ }
9
+
10
+ const props = withDefaults(defineProps<Props>(), {
11
+ active: false,
12
+ });
13
+
14
+ const { disabled, active } = toRefs(props);
15
+
16
+ const attrs = useAttrs();
17
+ const slots = useSlots();
18
+
19
+ const isIconOnly = computed(() => {
20
+ const hasIcon = !!props.icon || !!slots.icon;
21
+ const hasDefault = !!slots.default;
22
+ return hasIcon && !hasDefault;
23
+ });
24
+
25
+ const emit = defineEmits<{
26
+ (e: "click", event: PointerEvent): void;
27
+ }>();
28
+
29
+ function click(event: PointerEvent) {
30
+ if (disabled.value) return;
31
+ emit("click", event);
32
+ }
33
+ </script>
34
+
35
+ <template>
36
+ <orio-control-element>
37
+ <button
38
+ v-bind="attrs"
39
+ :class="{ 'icon-only': isIconOnly, active }"
40
+ :disabled
41
+ :aria-current="active ? 'page' : undefined"
42
+ @click="click"
43
+ >
44
+ <slot name="icon">
45
+ <orio-icon v-if="icon" :name="icon" />
46
+ </slot>
47
+ <slot />
48
+ </button>
49
+ </orio-control-element>
50
+ </template>
51
+
52
+ <style scoped>
53
+ button {
54
+ background-color: transparent;
55
+ color: var(--color-text);
56
+ border: none;
57
+ border-radius: var(--border-radius-md);
58
+ padding: 8px 16px;
59
+ font-size: 1rem;
60
+ line-height: 1.5;
61
+ cursor: pointer;
62
+ display: inline-flex;
63
+ align-items: center;
64
+ gap: 0.5rem;
65
+ user-select: none;
66
+ transition: color 0.2s ease;
67
+ }
68
+ button.icon-only {
69
+ padding: 8px;
70
+ border-radius: 50%;
71
+ aspect-ratio: 1;
72
+ justify-content: center;
73
+ }
74
+ button:hover:not(:disabled) {
75
+ color: var(--color-accent);
76
+ }
77
+ button.active {
78
+ color: var(--color-accent);
79
+ font-weight: 600;
80
+ }
81
+ button:disabled {
82
+ opacity: 0.5;
83
+ cursor: not-allowed;
84
+ }
85
+ button:focus-visible {
86
+ outline: 2px solid var(--color-accent);
87
+ outline-offset: 2px;
88
+ }
89
+ </style>
@@ -1,4 +1,5 @@
1
1
  export { default as Button } from "./components/Button.vue.js";
2
+ export { default as NavButton } from "./components/NavButton.vue.js";
2
3
  export { default as Input } from "./components/Input.vue.js";
3
4
  export { default as Textarea } from "./components/Textarea.vue.js";
4
5
  export { default as CheckBox } from "./components/CheckBox.vue.js";
@@ -1,4 +1,5 @@
1
1
  export { default as Button } from "./components/Button.vue";
2
+ export { default as NavButton } from "./components/NavButton.vue";
2
3
  export { default as Input } from "./components/Input.vue";
3
4
  export { default as Textarea } from "./components/Textarea.vue";
4
5
  export { default as CheckBox } from "./components/CheckBox.vue";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orio-ui",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Modern Nuxt component library with theme support",
5
5
  "type": "module",
6
6
  "main": "./dist/module.mjs",