@innertia-solutions/innertia-nuxt 0.1.27 → 0.1.28
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.
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
/**
|
|
3
|
+
* <App.IconButton> — botón de solo ícono (acciones de fila, toolbars).
|
|
4
|
+
* Uso:
|
|
5
|
+
* <App.IconButton :icon="IconPencil" label="Editar" to="/ruta" />
|
|
6
|
+
* <App.IconButton :icon="IconTrash" label="Eliminar" variant="danger" @click="..." />
|
|
7
|
+
*/
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
icon: { type: [Object, Function], required: true },
|
|
10
|
+
label: { type: String, default: '' }, // title + aria-label
|
|
11
|
+
size: { type: String, default: 'md', validator: (v) => ['sm', 'md'].includes(v) },
|
|
12
|
+
variant: { type: String, default: 'default', validator: (v) => ['default', 'danger', 'primary'].includes(v) },
|
|
13
|
+
to: { type: String, default: '' },
|
|
14
|
+
disabled: { type: Boolean, default: false },
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const boxSize = computed(() => (props.size === 'sm' ? 'size-7' : 'size-8'))
|
|
18
|
+
const iconSize = computed(() => (props.size === 'sm' ? 'size-3.5' : 'size-4'))
|
|
19
|
+
const variantClass = computed(() => ({
|
|
20
|
+
default: 'text-slate-400 hover:text-slate-600 hover:bg-slate-100 dark:hover:bg-slate-800',
|
|
21
|
+
danger: 'text-slate-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-500/10',
|
|
22
|
+
primary: 'text-slate-400 hover:text-primary hover:bg-primary/10',
|
|
23
|
+
}[props.variant] || ''))
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<template>
|
|
27
|
+
<NuxtLink
|
|
28
|
+
v-if="to" :to="to" :title="label || undefined" :aria-label="label || undefined"
|
|
29
|
+
class="inline-flex items-center justify-center rounded-lg transition-colors"
|
|
30
|
+
:class="[boxSize, variantClass]"
|
|
31
|
+
>
|
|
32
|
+
<component :is="icon" :class="iconSize" :stroke-width="1.5" />
|
|
33
|
+
</NuxtLink>
|
|
34
|
+
<button
|
|
35
|
+
v-else type="button" :disabled="disabled" :title="label || undefined" :aria-label="label || undefined"
|
|
36
|
+
class="inline-flex items-center justify-center rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed"
|
|
37
|
+
:class="[boxSize, variantClass]"
|
|
38
|
+
>
|
|
39
|
+
<component :is="icon" :class="iconSize" :stroke-width="1.5" />
|
|
40
|
+
</button>
|
|
41
|
+
</template>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
/**
|
|
3
|
+
* <App.SegmentedControl> — control segmentado / toggle horizontal.
|
|
4
|
+
* Uso:
|
|
5
|
+
* <App.SegmentedControl v-model="view" :options="[{value:'kanban',icon:IconLayoutKanban},{value:'table',icon:IconTable}]" />
|
|
6
|
+
* <App.SegmentedControl v-model="tab" :options="[{value:'a',label:'Regular'},{value:'b',label:'PIE'}]" />
|
|
7
|
+
*/
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
modelValue: { type: [String, Number, Boolean], default: null },
|
|
10
|
+
options: { type: Array, required: true }, // [{ value, label?, icon? }]
|
|
11
|
+
size: { type: String, default: 'sm', validator: (v) => ['sm', 'md'].includes(v) },
|
|
12
|
+
})
|
|
13
|
+
const emit = defineEmits(['update:modelValue'])
|
|
14
|
+
|
|
15
|
+
const pad = computed(() => (props.size === 'md' ? 'px-3.5 py-2 text-sm' : 'px-3 py-1.5 text-sm'))
|
|
16
|
+
const iconSize = computed(() => (props.size === 'md' ? 'size-4' : 'size-4'))
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div class="inline-flex items-center gap-1 rounded-lg bg-muted p-1">
|
|
21
|
+
<button
|
|
22
|
+
v-for="o in options" :key="String(o.value)" type="button"
|
|
23
|
+
@click="emit('update:modelValue', o.value)"
|
|
24
|
+
:title="o.label || undefined"
|
|
25
|
+
class="inline-flex items-center justify-center gap-1.5 rounded-md font-medium transition-colors"
|
|
26
|
+
:class="[pad, modelValue === o.value ? 'bg-card text-foreground shadow-sm' : 'text-muted-foreground hover:text-foreground']"
|
|
27
|
+
>
|
|
28
|
+
<component :is="o.icon" v-if="o.icon" :class="iconSize" :stroke-width="1.5" />
|
|
29
|
+
<span v-if="o.label">{{ o.label }}</span>
|
|
30
|
+
</button>
|
|
31
|
+
</div>
|
|
32
|
+
</template>
|