@altafusion/fugue-ui 0.0.0-stage → 0.3.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.
@@ -0,0 +1,66 @@
1
+ <script setup lang="ts">
2
+ import type { FugueHeaderVisualStyle } from '../lib/fugue-header-visual-style'
3
+ import type { FugueNavItem } from './fugue-app-header-types'
4
+ import { isLandingHeaderStyle } from '../lib/fugue-header-visual-style'
5
+ import FugueAppHeaderDefault from './FugueAppHeaderDefault.vue'
6
+ import FugueAppHeaderLanding from './FugueAppHeaderLanding.vue'
7
+
8
+ export type { FugueHeaderVisualStyle } from '../lib/fugue-header-visual-style'
9
+ export type { FugueNavItem } from './fugue-app-header-types'
10
+
11
+ const {
12
+ visualStyle = 'default',
13
+ title,
14
+ navItems = [],
15
+ activeNavId,
16
+ showColorMode = true,
17
+ homeTo = '/',
18
+ } = defineProps<{
19
+ visualStyle?: FugueHeaderVisualStyle
20
+ title?: string
21
+ navItems?: FugueNavItem[]
22
+ activeNavId?: string
23
+ showColorMode?: boolean
24
+ homeTo?: string
25
+ }>()
26
+
27
+ const styleComponent = computed(() =>
28
+ isLandingHeaderStyle(visualStyle)
29
+ ? FugueAppHeaderLanding
30
+ : FugueAppHeaderDefault,
31
+ )
32
+
33
+ const childProps = computed(() => {
34
+ const base = {
35
+ title,
36
+ navItems,
37
+ activeNavId,
38
+ showColorMode,
39
+ homeTo,
40
+ }
41
+ if (isLandingHeaderStyle(visualStyle)) {
42
+ return {
43
+ ...base,
44
+ visualStyle: visualStyle as 'landing-fixed' | 'landing-static',
45
+ }
46
+ }
47
+ return base
48
+ })
49
+ </script>
50
+
51
+ <template>
52
+ <component
53
+ :is="styleComponent"
54
+ v-bind="childProps"
55
+ >
56
+ <template
57
+ v-for="(_, name) in $slots"
58
+ #[name]="slotData"
59
+ >
60
+ <slot
61
+ :name="name"
62
+ v-bind="slotData ?? {}"
63
+ />
64
+ </template>
65
+ </component>
66
+ </template>
@@ -0,0 +1,74 @@
1
+ <script setup lang="ts">
2
+ import type { FugueNavItem } from './fugue-app-header-types'
3
+
4
+ const {
5
+ title,
6
+ navItems = [],
7
+ activeNavId,
8
+ showColorMode = true,
9
+ homeTo = '/',
10
+ } = defineProps<{
11
+ title?: string
12
+ navItems?: FugueNavItem[]
13
+ activeNavId?: string
14
+ showColorMode?: boolean
15
+ homeTo?: string
16
+ }>()
17
+ </script>
18
+
19
+ <template>
20
+ <UHeader>
21
+ <template #left>
22
+ <slot name="left">
23
+ <NuxtLink
24
+ :to="homeTo"
25
+ class="flex items-center gap-2 text-highlighted"
26
+ >
27
+ <slot name="logo" />
28
+ <span
29
+ v-if="title"
30
+ class="font-semibold"
31
+ >
32
+ {{ title }}
33
+ </span>
34
+ </NuxtLink>
35
+ </slot>
36
+ </template>
37
+
38
+ <template #right>
39
+ <div class="flex items-center gap-0.5">
40
+ <slot name="nav">
41
+ <UButton
42
+ v-for="item in navItems"
43
+ :key="item.id ?? item.to"
44
+ :label="item.label"
45
+ :to="item.to"
46
+ :icon="item.icon"
47
+ variant="ghost"
48
+ color="neutral"
49
+ size="sm"
50
+ class="hidden px-1.5 sm:inline-flex"
51
+ :class="{ 'font-semibold text-highlighted': activeNavId === item.id }"
52
+ />
53
+ </slot>
54
+
55
+ <slot name="actions" />
56
+
57
+ <UColorModeButton
58
+ v-if="showColorMode"
59
+ class="px-1.5"
60
+ />
61
+
62
+ <slot name="right" />
63
+ </div>
64
+ </template>
65
+
66
+ <!-- Mobile menu (the hamburger drawer). Only passed through when a parent provides it. -->
67
+ <template
68
+ v-if="$slots.body"
69
+ #body
70
+ >
71
+ <slot name="body" />
72
+ </template>
73
+ </UHeader>
74
+ </template>
@@ -0,0 +1,85 @@
1
+ <script setup lang="ts">
2
+ import type { FugueNavItem } from './fugue-app-header-types'
3
+
4
+ const {
5
+ visualStyle,
6
+ navItems = [],
7
+ showColorMode = true,
8
+ homeTo = '/',
9
+ } = defineProps<{
10
+ visualStyle: 'landing-fixed' | 'landing-static'
11
+ navItems?: FugueNavItem[]
12
+ showColorMode?: boolean
13
+ homeTo?: string
14
+ }>()
15
+
16
+ const { navOpen, scrolled, closeNav, toggleNav } = useFugueAppHeaderChrome()
17
+
18
+ const isFixed = computed(() => visualStyle === 'landing-fixed')
19
+ </script>
20
+
21
+ <template>
22
+ <header
23
+ class="landing-header"
24
+ :class="[
25
+ isFixed ? 'landing-header--fixed' : 'landing-header--static',
26
+ scrolled ? 'landing-header--scrolled' : '',
27
+ ]"
28
+ >
29
+ <div class="landing-header__bar">
30
+ <NuxtLink
31
+ :to="homeTo"
32
+ class="landing-header__home"
33
+ @click="closeNav"
34
+ >
35
+ <slot name="logo" />
36
+ </NuxtLink>
37
+
38
+ <nav>
39
+ <button
40
+ type="button"
41
+ class="landing-header__menu-btn"
42
+ :aria-expanded="navOpen"
43
+ aria-controls="landing-nav"
44
+ @click="toggleNav"
45
+ >
46
+ <UIcon
47
+ :name="navOpen ? 'i-lucide-x' : 'i-lucide-menu'"
48
+ class="landing-header__menu-icon"
49
+ aria-hidden="true"
50
+ />
51
+ <span class="sr-only">{{ navOpen ? 'Close menu' : 'Open menu' }}</span>
52
+ </button>
53
+
54
+ <ul
55
+ id="landing-nav"
56
+ class="landing-header__nav"
57
+ :class="navOpen ? 'landing-header__nav--open' : ''"
58
+ >
59
+ <li
60
+ v-for="item in navItems"
61
+ :key="item.id ?? item.to"
62
+ >
63
+ <a
64
+ :href="item.to"
65
+ class="landing-header__link"
66
+ @click="closeNav"
67
+ >
68
+ {{ item.label }}
69
+ </a>
70
+ </li>
71
+ <li class="landing-header__actions">
72
+ <slot name="actions" />
73
+ <UColorModeButton
74
+ v-if="showColorMode"
75
+ class="px-1.5"
76
+ />
77
+ <div class="landing-header__right">
78
+ <slot name="right" />
79
+ </div>
80
+ </li>
81
+ </ul>
82
+ </nav>
83
+ </div>
84
+ </header>
85
+ </template>
@@ -0,0 +1,55 @@
1
+ <script setup lang="ts">
2
+ import type { HTMLAttributes } from 'vue'
3
+
4
+ type PresenceOrbTone = 'success' | 'info' | 'warning' | 'error' | 'neutral'
5
+ type PresenceOrbSize = 'sm' | 'md'
6
+
7
+ /**
8
+ * Generic animated status dot — domain-free presence indicator.
9
+ * Pair with visible text; this element is decorative (`aria-hidden`).
10
+ */
11
+ const {
12
+ tone = 'neutral',
13
+ pulse = false,
14
+ size = 'md',
15
+ class: className,
16
+ } = defineProps<{
17
+ tone?: PresenceOrbTone
18
+ pulse?: boolean
19
+ size?: PresenceOrbSize
20
+ class?: HTMLAttributes['class']
21
+ }>()
22
+
23
+ /** Dot fills use `bg-current`, so tone is a text token — `bg-muted` and friends are surfaces, too pale for a dot. */
24
+ const TONE_TEXT_CLASS: Record<PresenceOrbTone, string> = {
25
+ success: 'text-success',
26
+ info: 'text-info',
27
+ warning: 'text-warning',
28
+ error: 'text-error',
29
+ neutral: 'text-dimmed',
30
+ }
31
+
32
+ const SIZE_CLASS: Record<PresenceOrbSize, string> = {
33
+ sm: 'size-2',
34
+ md: 'size-2.5',
35
+ }
36
+
37
+ const toneClass = computed(() => TONE_TEXT_CLASS[tone])
38
+ const sizeClass = computed(() => SIZE_CLASS[size])
39
+ </script>
40
+
41
+ <template>
42
+ <span
43
+ class="relative inline-flex shrink-0"
44
+ :class="[sizeClass, toneClass, className]"
45
+ aria-hidden="true"
46
+ >
47
+ <span
48
+ v-if="pulse"
49
+ class="absolute inline-flex h-full w-full animate-ping motion-reduce:animate-none rounded-full bg-current opacity-60"
50
+ />
51
+ <span
52
+ class="relative inline-flex h-full w-full rounded-full bg-current"
53
+ />
54
+ </span>
55
+ </template>
@@ -0,0 +1,65 @@
1
+ <script setup lang="ts">
2
+ import type { HTMLAttributes } from 'vue'
3
+ import type { TileGroupSectionUi, TileGroupSectionVariant } from './tileGroupSection.shared'
4
+ import { mergeTileGroupSectionUi } from './tileGroupSection.shared'
5
+
6
+ export type { TileGroupSectionUi, TileGroupSectionVariant }
7
+
8
+ type TileGroupSectionHeading = 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
9
+
10
+ const props = withDefaults(defineProps<{
11
+ title: string
12
+ /** Heading element for the section title (defaults to h3). */
13
+ as?: TileGroupSectionHeading
14
+ /** Helper under the title (e.g. input note). */
15
+ note?: string
16
+ /**
17
+ * When true → "Required" badge; when false → "Optional" badge;
18
+ * when omitted/undefined → no badge.
19
+ */
20
+ required?: boolean
21
+ /** Title styling preset — `field` for main labels, `category` for nested group headings. */
22
+ variant?: TileGroupSectionVariant
23
+ class?: HTMLAttributes['class']
24
+ ui?: TileGroupSectionUi
25
+ }>(), {
26
+ as: 'h3',
27
+ variant: 'field',
28
+ })
29
+
30
+ const mergedUi = computed(() => mergeTileGroupSectionUi(props.variant, props.ui))
31
+ </script>
32
+
33
+ <template>
34
+ <div class="space-y-2" :class="[mergedUi.root, props.class]">
35
+ <div class="flex flex-wrap items-start gap-2">
36
+ <component
37
+ :is="props.as"
38
+ :class="mergedUi.title"
39
+ >
40
+ {{ props.title }}
41
+ </component>
42
+ <span
43
+ v-if="props.required === true"
44
+ class="text-xs font-normal"
45
+ :class="mergedUi.required"
46
+ >
47
+ (Required)
48
+ </span>
49
+ <span
50
+ v-else-if="props.required === false"
51
+ class="text-xs font-normal"
52
+ :class="mergedUi.optional"
53
+ >
54
+ (Optional)
55
+ </span>
56
+ </div>
57
+ <p
58
+ v-if="props.note"
59
+ :class="mergedUi.note"
60
+ >
61
+ {{ props.note }}
62
+ </p>
63
+ <slot />
64
+ </div>
65
+ </template>
@@ -0,0 +1,37 @@
1
+ <script setup lang="ts">
2
+ /**
3
+ * Lightbulb hint on a tile title. Opens on hover/focus via {@link UTooltip}.
4
+ * Stops pointer events so the parent radio/checkbox does not change selection.
5
+ */
6
+ const { text, label } = defineProps<{
7
+ text: string
8
+ /** Used for the trigger aria-label. */
9
+ label?: string
10
+ }>()
11
+ </script>
12
+
13
+ <template>
14
+ <span
15
+ class="flex shrink-0 items-center leading-none"
16
+ @pointerdown.stop
17
+ >
18
+ <UTooltip
19
+ :text="text"
20
+ :delay-duration="0"
21
+ :content="{ side: 'bottom' }"
22
+ >
23
+ <button
24
+ type="button"
25
+ class="inline-flex size-4 shrink-0 items-center justify-center leading-none text-muted hover:text-default"
26
+ :aria-label="label ? `More about ${label}` : 'More information'"
27
+ @click.stop
28
+ >
29
+ <UIcon
30
+ name="i-lucide-lightbulb"
31
+ class="size-3.5"
32
+ aria-hidden="true"
33
+ />
34
+ </button>
35
+ </UTooltip>
36
+ </span>
37
+ </template>
@@ -0,0 +1,174 @@
1
+ <script setup lang="ts" generic="T extends RadioGroupItem[], VK extends GetItemKeys<T> = 'value'">
2
+ import type { GetItemKeys, GetModelValue, RadioGroupItem } from '@nuxt/ui'
3
+ import type { TileSelectorProps } from './tileSelector.shared'
4
+ import {
5
+ applyHiddenIndicatorUi,
6
+ hasTileExtras,
7
+ mergeTileUi,
8
+ normalizeTileItems,
9
+ resolveNuxtTileVariant,
10
+ resolveTileDescription,
11
+ resolveTileLabel,
12
+ resolveTileLabelItem,
13
+ splitTileUi,
14
+ usesInlineTileLabel,
15
+ } from './tileSelector.shared'
16
+ import TileSelectorLabel from './TileSelectorLabel.vue'
17
+
18
+ /**
19
+ * Single-select tile picker on {@link URadioGroup}.
20
+ *
21
+ * Our `variant` picks {@link TILE_VARIANT_UI}; Nuxt gets {@link resolveNuxtTileVariant}
22
+ * (`list` for pill/row/feature, `card` otherwise).
23
+ *
24
+ * Cross-variant layout fixes (indicator hidden is the default):
25
+ * - Collapse Nuxt's sized indicator `container` via {@link HIDDEN_INDICATOR_GROUP_UI}
26
+ * - Descriptions render via {@link TileSelectorLabel} from item `description` /
27
+ * `descriptionKey`; empty `#description` suppresses Nuxt's default fallback
28
+ */
29
+ const props = withDefaults(defineProps<TileSelectorProps<T, VK>>(), {
30
+ variant: 'card',
31
+ color: 'primary',
32
+ size: 'md',
33
+ indicator: 'hidden',
34
+ bare: false,
35
+ })
36
+
37
+ defineSlots<{
38
+ legend?: () => unknown
39
+ label?: (_slotProps: { item: RadioGroupItem & { id: string }, modelValue?: unknown }) => unknown
40
+ }>()
41
+
42
+ const model = defineModel<GetModelValue<T, VK, false>>()
43
+
44
+ const mergedUi = computed(() => mergeTileUi(props.variant ?? 'card', props.ui))
45
+ const splitUi = computed(() => splitTileUi(mergedUi.value))
46
+ const labelUi = computed(() => splitUi.value.labelUi)
47
+
48
+ const groupUi = computed(() => {
49
+ const base = splitUi.value.groupUi
50
+ return props.indicator === 'hidden'
51
+ ? applyHiddenIndicatorUi(base)
52
+ : base
53
+ })
54
+
55
+ const visibleItems = computed(() =>
56
+ props.items
57
+ ? normalizeTileItems(props.items)
58
+ : undefined,
59
+ )
60
+
61
+ const nuxtVariant = computed(() => resolveNuxtTileVariant(props.variant))
62
+ </script>
63
+
64
+ <template>
65
+ <UFormField
66
+ v-if="!bare"
67
+ :error="error"
68
+ :required="required"
69
+ :name="name"
70
+ :class="props.class"
71
+ >
72
+ <URadioGroup
73
+ v-model="model"
74
+ :name="name"
75
+ :legend="legend"
76
+ :items="visibleItems"
77
+ :default-value="defaultValue"
78
+ :required="required"
79
+ :disabled="disabled"
80
+ :loop="loop"
81
+ :color="color"
82
+ :size="size"
83
+ :orientation="orientation"
84
+ :value-key="valueKey"
85
+ :label-key="labelKey"
86
+ :description-key="descriptionKey"
87
+ :indicator="indicator"
88
+ :highlight="highlight"
89
+ :variant="nuxtVariant"
90
+ :ui="groupUi"
91
+ >
92
+ <template v-if="$slots.legend" #legend>
93
+ <slot name="legend" />
94
+ </template>
95
+
96
+ <template #label="slotProps">
97
+ <slot name="label" v-bind="slotProps">
98
+ <TileSelectorLabel
99
+ v-if="usesInlineTileLabel(variant)"
100
+ :layout="variant === 'feature' ? 'feature' : 'row'"
101
+ :item="resolveTileLabelItem(slotProps.item, labelKey)"
102
+ :description="resolveTileDescription(slotProps.item, descriptionKey)"
103
+ :ui="labelUi"
104
+ />
105
+ <TileSelectorLabel
106
+ v-else-if="hasTileExtras(slotProps.item) || resolveTileDescription(slotProps.item, descriptionKey)"
107
+ :item="resolveTileLabelItem(slotProps.item, labelKey)"
108
+ :description="resolveTileDescription(slotProps.item, descriptionKey)"
109
+ />
110
+ <span
111
+ v-else
112
+ class="font-medium text-default"
113
+ >
114
+ {{ resolveTileLabel(slotProps.item, labelKey) }}
115
+ </span>
116
+ </slot>
117
+ </template>
118
+
119
+ <template #description />
120
+ </URadioGroup>
121
+ </UFormField>
122
+
123
+ <URadioGroup
124
+ v-else
125
+ v-model="model"
126
+ :class="props.class"
127
+ :name="name"
128
+ :legend="legend"
129
+ :items="visibleItems"
130
+ :default-value="defaultValue"
131
+ :required="required"
132
+ :disabled="disabled"
133
+ :loop="loop"
134
+ :color="color"
135
+ :size="size"
136
+ :orientation="orientation"
137
+ :value-key="valueKey"
138
+ :label-key="labelKey"
139
+ :description-key="descriptionKey"
140
+ :indicator="indicator"
141
+ :highlight="highlight"
142
+ :variant="nuxtVariant"
143
+ :ui="groupUi"
144
+ >
145
+ <template v-if="$slots.legend" #legend>
146
+ <slot name="legend" />
147
+ </template>
148
+
149
+ <template #label="slotProps">
150
+ <slot name="label" v-bind="slotProps">
151
+ <TileSelectorLabel
152
+ v-if="usesInlineTileLabel(variant)"
153
+ :layout="variant === 'feature' ? 'feature' : 'row'"
154
+ :item="resolveTileLabelItem(slotProps.item, labelKey)"
155
+ :description="resolveTileDescription(slotProps.item, descriptionKey)"
156
+ :ui="labelUi"
157
+ />
158
+ <TileSelectorLabel
159
+ v-else-if="hasTileExtras(slotProps.item) || resolveTileDescription(slotProps.item, descriptionKey)"
160
+ :item="resolveTileLabelItem(slotProps.item, labelKey)"
161
+ :description="resolveTileDescription(slotProps.item, descriptionKey)"
162
+ />
163
+ <span
164
+ v-else
165
+ class="font-medium text-default"
166
+ >
167
+ {{ resolveTileLabel(slotProps.item, labelKey) }}
168
+ </span>
169
+ </slot>
170
+ </template>
171
+
172
+ <template #description />
173
+ </URadioGroup>
174
+ </template>
@@ -0,0 +1,110 @@
1
+ <script setup lang="ts">
2
+ import type { TileLabelItem, TileLabelUi } from './tileSelector.shared'
3
+ import TileHintTooltip from './TileHintTooltip.vue'
4
+ import { resolveTileIconClass, tileIconStyle, tileSemanticTextClass } from './tileSelector.shared'
5
+
6
+ /**
7
+ * Tile title chrome for the RadioGroup/CheckboxGroup `#label` slot.
8
+ *
9
+ * Nuxt's `card` variant wraps that slot in a `<p>`. Only **phrasing** content is
10
+ * valid inside `<p>` — a `<div>` makes the browser close the `<p>` early, leaving
11
+ * an empty paragraph (extra vertical gap) and hoisting the real label out.
12
+ * Use `<span>` + display utilities everywhere in this tree.
13
+ */
14
+ withDefaults(defineProps<{
15
+ item: TileLabelItem
16
+ layout?: 'stacked' | 'row' | 'feature'
17
+ description?: string
18
+ /** Required for `row` / `feature` — from {@link mergeTileUi} via {@link splitTileUi}. */
19
+ ui?: TileLabelUi
20
+ }>(), {
21
+ layout: 'stacked',
22
+ })
23
+ </script>
24
+
25
+ <template>
26
+ <span
27
+ v-if="layout === 'row' || layout === 'feature'"
28
+ :class="ui?.itemRoot"
29
+ >
30
+ <span
31
+ v-if="item.icon || item.imageSrc"
32
+ :class="ui?.itemLeading"
33
+ >
34
+ <UIcon
35
+ v-if="item.icon"
36
+ mode="svg"
37
+ :name="item.icon"
38
+ :class="resolveTileIconClass('row', item.iconClass)"
39
+ :style="tileIconStyle()"
40
+ aria-hidden="true"
41
+ />
42
+ <img
43
+ v-else-if="item.imageSrc"
44
+ :src="item.imageSrc"
45
+ alt=""
46
+ class="size-10 object-contain"
47
+ >
48
+ </span>
49
+ <span class="min-w-0 flex-1 flex flex-col gap-1">
50
+ <span class="flex items-center gap-x-1">
51
+ <span :class="ui?.itemLabel">
52
+ {{ item.label }}
53
+ </span>
54
+ <TileHintTooltip
55
+ v-if="item.tooltip"
56
+ :text="item.tooltip"
57
+ :label="item.label"
58
+ />
59
+ </span>
60
+ <span
61
+ v-if="item.hint"
62
+ :class="[ui?.itemHint, tileSemanticTextClass(item.hint.color)]"
63
+ >
64
+ {{ item.hint.text }}
65
+ </span>
66
+ <span
67
+ v-if="description"
68
+ :class="ui?.itemDescription"
69
+ >
70
+ {{ description }}
71
+ </span>
72
+ </span>
73
+ </span>
74
+
75
+ <span
76
+ v-else
77
+ class="flex w-full flex-col items-center text-center"
78
+ >
79
+ <span class="flex items-center justify-center gap-x-1 leading-none">
80
+ <UIcon
81
+ v-if="item.icon"
82
+ mode="svg"
83
+ :name="item.icon"
84
+ :class="resolveTileIconClass('stacked', item.iconClass)"
85
+ :style="tileIconStyle()"
86
+ aria-hidden="true"
87
+ />
88
+ <img
89
+ v-else-if="item.imageSrc"
90
+ :src="item.imageSrc"
91
+ alt=""
92
+ class="size-6 object-cover"
93
+ >
94
+ <span class="text-sm font-medium leading-none">
95
+ {{ item.label }}
96
+ </span>
97
+ <TileHintTooltip
98
+ v-if="item.tooltip"
99
+ :text="item.tooltip"
100
+ :label="item.label"
101
+ />
102
+ </span>
103
+ <span
104
+ v-if="description"
105
+ class="mt-2 text-sm text-muted"
106
+ >
107
+ {{ description }}
108
+ </span>
109
+ </span>
110
+ </template>