@ternarytech-io/gears-ui 0.4.0 → 0.6.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/README.md CHANGED
@@ -101,14 +101,14 @@ add a page, add an entry to `preview/registry.ts` and a folder of examples.
101
101
 
102
102
  | Group | Components |
103
103
  | --- | --- |
104
- | Elements | `TButton`, `TBadge`, `TAvatar`, `TAlert`, `TCard`, `TIcon`, `TTooltip`, `TEmpty`, `TSpinner`, `TSkeleton`, `TProgress`, `TSeparator` |
104
+ | Elements | `TButton`, `TButtonGroup` (joined buttons, across or down; a tooltip each; `click` names the button), `TBadge`, `TAvatar`, `TAlert`, `TCard`, `TIcon`, `TTooltip`, `TEmpty`, `TSpinner`, `TSkeleton`, `TProgress`, `TSeparator` (a label at the start, center or end; color, style, thickness) |
105
105
  | Forms | `TFormField`, `TInput`, `TInputNumber`, `TTextarea`, `TSelect`, `TSelectMenu`, `TInputTags`, `TCheckbox`, `TSwitch`, `TRadioGroup` (list, cards or tiles with a picture), `TFieldGroup`, `TFileUpload`, `TImageUpload` (one image, checked for shape and size), `TIconPicker` (any Tabler icon, by name, with a search; the list is generated by `npm run icons`), `TRating` (stars, hearts or circles; no library), `TListBox` (always shown; one or several; a search), `TCheckboxTree` (parents check their children; partly checked; folding), `TCodeEditor` |
106
106
  | Theme | `TAccentPicker`, `TFontPicker`, `TRadiusPicker`, `TThemeBasePicker` (Tabler's theme settings as pickers), `TNavPositionPicker`, `TDensityPicker`, `TContainerPicker` (layout), `TThemeScope` (applies a `ThemeSettings`' look and density to what's inside it); `themeAccents`, `themeFonts`, `themeBases`, `themeRadii`, `themeNavs`, `themeDensities`, `themeContainers` |
107
- | Overlays | `TModal`, `TSlideover`, `TDropdown`, `TToaster` (with `useToast()`) |
107
+ | Overlays | `TModal`, `TSlideover`, `TDropdown`, `TSplitButton` (a main action and a menu of others), `TToaster` (with `useToast()`: neutral, success, warning, error or a custom `accent` color; a corner or the middle of the top or bottom, per toast or for all; `onClick`, `onClose`), `TLightbox` (images shown large: previous and next, arrow keys, swipes, captions) |
108
108
  | Navigation | `TTabs`, `TPagination`, `TSteps`, `TNav`, `TPanelList`, `TCommandPalette`, `TSearchButton` |
109
- | Data | `TTable` (sorting, `selectable` rows), `TAdvancedTable` (filters by column), `TEditableTable` (editing in place, bulk actions, search, pages, column kinds; client-side or `manual`), `TDataGrid` and `TDataGridItem` (Tabler's datagrid: labels and values for detail panels), `TStatCard` (with a trend and a sparkline), `TSparkline` (Tabler's, no library), `TLogView` |
109
+ | Data | `TTable` (sorting, `selectable` rows), `TAdvancedTable` (filters by column), `TEditableTable` (editing in place, bulk actions, search, pages, column kinds; client-side or `manual`), `TDataGrid` and `TDataGridItem` (Tabler's datagrid: labels and values for detail panels), `TStatCard` (with a trend and a sparkline; `loading`, `clickable`), `TSparkline` (Tabler's, no library), `TLogView` |
110
110
  | Layout | `TAppLayout` (an application's frame, laid out by its theme, with a menu button on small screens), `TScaledFrame` (a whole screen scaled to fit), `TShell`, `TTopbar`, `TPage`, `TSectionLayout`, `TSplitter`, `TAuthLayout`, `TColorModeButton` |
111
- | Plugins | `TAdvancedSelect`, `TChart`, `TCopyButton`, `TColorPicker`, `TDatePicker`, `TDropzone`, `TInputMask`, `TRangeSlider`, `TSortable`, `TSortableTree`, `TVectorMap`, `TRichEditor` |
111
+ | Plugins | `TAdvancedSelect`, `TChart`, `TPdfViewer`, `TCopyButton`, `TColorPicker`, `TDatePicker`, `TDropzone`, `TInputMask`, `TRangeSlider`, `TSortable`, `TSortableTree`, `TTimeInput`, `TVectorMap`, `TRichEditor` |
112
112
 
113
113
  ### Plugins
114
114
 
@@ -121,11 +121,13 @@ Tabler's restyling of them (`tabler-vendors.css`), which must come after.
121
121
  | --- | --- | --- |
122
122
  | `TAdvancedSelect` | Tom Select | One or several (`multiple`, as chips); `create` adds new values; icons and avatars beside labels. Overlaps `TSelectMenu`, which has no dependency. |
123
123
  | `TChart` | Apache ECharts (Apache-2.0) | `line`, `area`, `bar` (across), `column`, `pie`, `donut`; `series` along `categories`, `stacked`, `format`, `point-click`. Colors follow the theme (and a `TThemeScope`), light or dark; `options` (ECharts options) is merged over everything for anything else. SVG by default, `renderer="canvas"` for very many points; it follows its box's size. Only the charts it uses are bundled. Before 0.4.0 it was ApexCharts, whose license no longer suits apps others use. |
124
+ | `TPdfViewer` | PDF.js (Mozilla, Apache-2.0) | A PDF's pages, drawn as they scroll into view; `zoom` (fit width, fit page, a percent), `v-model:page`, a toolbar with download and open in a new tab; `setPage`, `download`. Its worker is loaded with Vite's `?url`. |
124
125
  | `TCopyButton` | Tabler's clipboard | Copies `text`, or the field `target` selects. Needs https or localhost. |
125
126
  | `TColorPicker` | Coloris | `format`, `alpha`, `swatches`, `swatchesOnly`. The field isn't wrapped by Coloris (Vue owns it); the swatch is ours. |
126
127
  | `TDatePicker` | Tabler's date picker, on Vanilla Calendar Pro | `single`, `multiple` or `range`; `inline`; the model is `YYYY-MM-DD`, `format` only changes the display. |
127
128
  | `TDropzone` | Dropzone | With `url`, uploads; without, v-model collects the files. |
128
129
  | `TInputMask` | Tabler's input mask, on IMask | `mask` like "(000) 000-0000"; `unmasked`; `showMask`. |
130
+ | `TTimeInput` | IMask | A time of day, typed or picked from a list at `step` minutes; `hour12`, `seconds`, `min`, `max`. The model is always 24-hour `HH:mm` (`HH:mm:ss`). |
129
131
  | `TRangeSlider` | noUiSlider | A number, or a range with `[from, to]`. |
130
132
  | `TSortable` | Tabler's sortable, on SortableJS | Reorders v-model's array. Lists within one container; dragging between lists isn't wired up yet. |
131
133
  | `TVectorMap` | Tabler's vector map | The world map: `values`, `markers`, `lines`, `legend`, `select` with v-model:selected, `zoom`. |
package/package.json CHANGED
@@ -1,117 +1,122 @@
1
- {
2
- "name": "@ternarytech-io/gears-ui",
3
- "version": "0.4.0",
4
- "type": "module",
5
- "description": "Gears UI: Vue 3 components on Tabler, used by the Gears Studio and the applications it builds.",
6
- "license": "MPL-2.0",
7
- "author": "Ternary Tech",
8
- "homepage": "https://github.com/TernaryTech-io/Gears.UI#readme",
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/TernaryTech-io/Gears.UI.git"
12
- },
13
- "bugs": "https://github.com/TernaryTech-io/Gears.UI/issues",
14
- "keywords": [
15
- "vue",
16
- "vue3",
17
- "tabler",
18
- "components",
19
- "ui",
20
- "gears"
21
- ],
22
- "files": [
23
- "src",
24
- "README.md",
25
- "LICENSE"
26
- ],
27
- "sideEffects": [
28
- "*.css"
29
- ],
30
- "publishConfig": {
31
- "access": "public"
32
- },
33
- "exports": {
34
- ".": "./src/index.ts",
35
- "./plugins": "./src/plugins/index.ts",
36
- "./code-editor": "./src/code-editor.ts",
37
- "./styles.css": "./src/styles/gears.css",
38
- "./plugins.css": "./src/styles/plugins.css",
39
- "./components/*": "./src/components/*"
40
- },
41
- "scripts": {
42
- "dev": "vite",
43
- "build": "vue-tsc --noEmit && vite build",
44
- "typecheck": "vue-tsc --noEmit",
45
- "icons": "node scripts/generate-icons.mjs",
46
- "preview": "vite preview"
47
- },
48
- "peerDependencies": {
49
- "@melloware/coloris": "^0.25.0",
50
- "dropzone": "^6.3.0",
51
- "echarts": "^6.1.0",
52
- "hugerte": "^1.0.0",
53
- "imask": "^7.6.0",
54
- "monaco-editor": "^0.57.0",
55
- "nouislider": "^15.8.0",
56
- "sortablejs": "^1.15.0",
57
- "tom-select": "^2.6.0",
58
- "vanilla-calendar-pro": "^3.3.2",
59
- "vue": "^3.5.0",
60
- "vue-router": "^4.6.0"
61
- },
62
- "dependencies": {
63
- "@tabler/core": "1.7.1",
64
- "@tabler/icons-webfont": "3.49.0"
65
- },
66
- "devDependencies": {
67
- "@melloware/coloris": "0.25.0",
68
- "@types/sortablejs": "1.15.9",
69
- "@vitejs/plugin-vue": "6.0.10",
70
- "dropzone": "6.3.5",
71
- "echarts": "6.1.0",
72
- "hugerte": "1.0.14",
73
- "imask": "7.6.1",
74
- "monaco-editor": "0.57.0",
75
- "nouislider": "15.8.1",
76
- "sortablejs": "1.15.7",
77
- "tom-select": "2.6.2",
78
- "typescript": "5.9.3",
79
- "vanilla-calendar-pro": "3.4.0",
80
- "vite": "7.3.7",
81
- "vue": "3.5.44",
82
- "vue-router": "4.6.4",
83
- "vue-tsc": "3.3.13"
84
- },
85
- "peerDependenciesMeta": {
86
- "monaco-editor": {
87
- "optional": true
88
- },
89
- "tom-select": {
90
- "optional": true
91
- },
92
- "@melloware/coloris": {
93
- "optional": true
94
- },
95
- "vanilla-calendar-pro": {
96
- "optional": true
97
- },
98
- "dropzone": {
99
- "optional": true
100
- },
101
- "echarts": {
102
- "optional": true
103
- },
104
- "imask": {
105
- "optional": true
106
- },
107
- "nouislider": {
108
- "optional": true
109
- },
110
- "sortablejs": {
111
- "optional": true
112
- },
113
- "hugerte": {
114
- "optional": true
115
- }
116
- }
117
- }
1
+ {
2
+ "name": "@ternarytech-io/gears-ui",
3
+ "version": "0.6.0",
4
+ "type": "module",
5
+ "description": "Gears UI: Vue 3 components on Tabler, used by the Gears Studio and the applications it builds.",
6
+ "license": "MPL-2.0",
7
+ "author": "Ternary Tech",
8
+ "homepage": "https://github.com/TernaryTech-io/Gears.UI#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/TernaryTech-io/Gears.UI.git"
12
+ },
13
+ "bugs": "https://github.com/TernaryTech-io/Gears.UI/issues",
14
+ "keywords": [
15
+ "vue",
16
+ "vue3",
17
+ "tabler",
18
+ "components",
19
+ "ui",
20
+ "gears"
21
+ ],
22
+ "files": [
23
+ "src",
24
+ "README.md",
25
+ "LICENSE"
26
+ ],
27
+ "sideEffects": [
28
+ "*.css"
29
+ ],
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "exports": {
34
+ ".": "./src/index.ts",
35
+ "./plugins": "./src/plugins/index.ts",
36
+ "./code-editor": "./src/code-editor.ts",
37
+ "./styles.css": "./src/styles/gears.css",
38
+ "./plugins.css": "./src/styles/plugins.css",
39
+ "./components/*": "./src/components/*"
40
+ },
41
+ "scripts": {
42
+ "dev": "vite",
43
+ "build": "vue-tsc --noEmit && vite build",
44
+ "typecheck": "vue-tsc --noEmit",
45
+ "icons": "node scripts/generate-icons.mjs",
46
+ "preview": "vite preview"
47
+ },
48
+ "peerDependencies": {
49
+ "@melloware/coloris": "^0.25.0",
50
+ "dropzone": "^6.3.0",
51
+ "echarts": "^6.1.0",
52
+ "hugerte": "^1.0.0",
53
+ "imask": "^7.6.0",
54
+ "monaco-editor": "^0.57.0",
55
+ "nouislider": "^15.8.0",
56
+ "pdfjs-dist": "^6.4.0",
57
+ "sortablejs": "^1.15.0",
58
+ "tom-select": "^2.6.0",
59
+ "vanilla-calendar-pro": "^3.3.2",
60
+ "vue": "^3.5.0",
61
+ "vue-router": "^4.6.0"
62
+ },
63
+ "dependencies": {
64
+ "@tabler/core": "1.7.1",
65
+ "@tabler/icons-webfont": "3.49.0"
66
+ },
67
+ "devDependencies": {
68
+ "@melloware/coloris": "0.25.0",
69
+ "@types/sortablejs": "1.15.9",
70
+ "@vitejs/plugin-vue": "6.0.10",
71
+ "dropzone": "6.3.5",
72
+ "echarts": "6.1.0",
73
+ "hugerte": "1.0.14",
74
+ "imask": "7.6.1",
75
+ "monaco-editor": "0.57.0",
76
+ "nouislider": "15.8.1",
77
+ "pdfjs-dist": "6.4.299",
78
+ "sortablejs": "1.15.7",
79
+ "tom-select": "2.6.2",
80
+ "typescript": "5.9.3",
81
+ "vanilla-calendar-pro": "3.4.0",
82
+ "vite": "7.3.7",
83
+ "vue": "3.5.44",
84
+ "vue-router": "4.6.4",
85
+ "vue-tsc": "3.3.13"
86
+ },
87
+ "peerDependenciesMeta": {
88
+ "monaco-editor": {
89
+ "optional": true
90
+ },
91
+ "tom-select": {
92
+ "optional": true
93
+ },
94
+ "@melloware/coloris": {
95
+ "optional": true
96
+ },
97
+ "vanilla-calendar-pro": {
98
+ "optional": true
99
+ },
100
+ "dropzone": {
101
+ "optional": true
102
+ },
103
+ "echarts": {
104
+ "optional": true
105
+ },
106
+ "imask": {
107
+ "optional": true
108
+ },
109
+ "nouislider": {
110
+ "optional": true
111
+ },
112
+ "pdfjs-dist": {
113
+ "optional": true
114
+ },
115
+ "sortablejs": {
116
+ "optional": true
117
+ },
118
+ "hugerte": {
119
+ "optional": true
120
+ }
121
+ }
122
+ }
@@ -0,0 +1,48 @@
1
+ <script setup lang="ts">
2
+ // Buttons joined in a row (or a column, `vertical`), with Tabler's btn-group: each has a label
3
+ // and/or an icon, a tooltip and Disabled; they share a color, style and size. `click` reports the
4
+ // button clicked and its index. To choose one of several, use a segmented TTabs instead.
5
+ import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
6
+ import { Tooltip } from '@tabler/core'
7
+ import TButton from './TButton.vue'
8
+ import type { ButtonGroupItem, Color, Size } from '../types'
9
+
10
+ const props = withDefaults(defineProps<{
11
+ items: ButtonGroupItem[]
12
+ color?: Color
13
+ variant?: 'solid' | 'outline' | 'ghost' | 'soft'
14
+ size?: Size
15
+ vertical?: boolean
16
+ /** Full width: the buttons share it. */
17
+ block?: boolean
18
+ /** The group's name, for screen readers. */
19
+ label?: string
20
+ }>(), { color: 'neutral', variant: 'solid', size: 'md' })
21
+
22
+ const emit = defineEmits<{ click: [item: ButtonGroupItem, index: number, event: MouseEvent] }>()
23
+
24
+ const root = ref<HTMLElement>()
25
+ let tips: Tooltip[] = []
26
+
27
+ // Each button's tooltip is Tabler's, on the button itself, so the group's joined edges stay.
28
+ function tooltips() {
29
+ tips.forEach(t => t.dispose())
30
+ tips = []
31
+ const buttons = [...(root.value?.children ?? [])] as HTMLElement[]
32
+ props.items.forEach((item, i) => {
33
+ const el = buttons[i]
34
+ if (el && item.tooltip) tips.push(new Tooltip(el, { title: item.tooltip, placement: props.vertical ? 'right' : 'top', trigger: 'hover focus', delay: { show: 150, hide: 0 } }))
35
+ })
36
+ }
37
+ onMounted(tooltips)
38
+ watch(() => props.items.map(i => i.tooltip).join('\n') + props.vertical, () => nextTick(tooltips))
39
+ onBeforeUnmount(() => tips.forEach(t => t.dispose()))
40
+ </script>
41
+
42
+ <template>
43
+ <div ref="root" :class="[vertical ? 'btn-group-vertical' : 'btn-group', { 'w-100 d-flex': block }]" role="group" :aria-label="label">
44
+ <TButton v-for="(item, i) in items" :key="item.value ?? i" :label="item.label" :icon="item.icon" :color="item.color ?? color" :variant="variant"
45
+ :size="size" :disabled="item.disabled" :class="{ 'flex-fill': block }" :aria-label="!item.label ? item.tooltip : undefined"
46
+ @click="(event: MouseEvent) => emit('click', item, i, event)" />
47
+ </div>
48
+ </template>
@@ -1,14 +1,13 @@
1
1
  <script setup lang="ts">
2
2
  // A menu under a button. Items come in groups (an array of arrays), split by dividers; an item is
3
3
  // a link (`to`, `href`), an action (`onSelect`) or a `label` heading. The slot replaces the button.
4
- import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
5
- import { RouterLink } from 'vue-router'
4
+ import { onBeforeUnmount, onMounted, ref } from 'vue'
6
5
  import { Dropdown } from '@tabler/core'
7
6
  import TButton from './TButton.vue'
8
- import TIcon from './TIcon.vue'
9
- import { toTabler, type Color, type DropdownItem, type Size } from '../types'
7
+ import DropdownItems from './internal/DropdownItems.vue'
8
+ import type { Color, DropdownItem, Size } from '../types'
10
9
 
11
- const props = withDefaults(defineProps<{
10
+ withDefaults(defineProps<{
12
11
  items: DropdownItem[] | DropdownItem[][]
13
12
  align?: 'start' | 'end'
14
13
  label?: string
@@ -24,17 +23,6 @@ const emit = defineEmits<{ 'update:open': [open: boolean] }>()
24
23
  const toggle = ref<HTMLElement>()
25
24
  let dropdown: Dropdown | null = null
26
25
 
27
- const groups = computed(() => (Array.isArray(props.items[0]) ? props.items : [props.items]) as DropdownItem[][])
28
-
29
- function tag(item: DropdownItem) {
30
- return item.to && !item.disabled ? RouterLink : item.href ? 'a' : 'button'
31
- }
32
- function attrs(item: DropdownItem) {
33
- if (item.to && !item.disabled) return { to: item.to }
34
- if (item.href) return { href: item.disabled ? undefined : item.href }
35
- return { type: 'button', disabled: item.disabled }
36
- }
37
-
38
26
  onMounted(() => {
39
27
  // A fixed popper escapes containers that clip (cards, tables, the sidebar).
40
28
  dropdown = new Dropdown(toggle.value!, { popperConfig: (config: object) => ({ ...config, strategy: 'fixed' }) })
@@ -52,25 +40,7 @@ onBeforeUnmount(() => dropdown?.dispose())
52
40
  </slot>
53
41
  </span>
54
42
  <div :class="['dropdown-menu', align === 'end' && 'dropdown-menu-end', menuClass]" role="menu">
55
- <template v-for="(group, g) in groups" :key="g">
56
- <div v-if="g > 0 && group.length" class="dropdown-divider" />
57
- <template v-for="(item, i) in group" :key="`${g}-${i}`">
58
- <div v-if="item.type === 'label'" class="dropdown-header d-block">
59
- <div class="text-body fw-medium text-truncate">{{ item.label }}</div>
60
- <div v-if="item.description" class="text-secondary text-truncate fw-normal">{{ item.description }}</div>
61
- </div>
62
- <component :is="tag(item)" v-else v-bind="attrs(item)" role="menuitem"
63
- :class="['dropdown-item', { disabled: item.disabled }, item.color && `text-${toTabler(item.color)}`]"
64
- @click="item.onSelect?.($event)">
65
- <TIcon v-if="item.icon" :name="item.icon" class="dropdown-item-icon" />
66
- <span class="min-w-0">
67
- <span class="d-block text-truncate">{{ item.label }}</span>
68
- <span v-if="item.description" class="d-block small text-secondary text-truncate">{{ item.description }}</span>
69
- </span>
70
- <TIcon v-if="item.trailingIcon" :name="item.trailingIcon" class="ms-auto ps-2" />
71
- </component>
72
- </template>
73
- </template>
43
+ <DropdownItems :items="items" />
74
44
  </div>
75
45
  </div>
76
46
  </template>
@@ -0,0 +1,101 @@
1
+ <script setup lang="ts">
2
+ // Images shown large over the page, one at a time: v-model is the one shown (its index; null when
3
+ // closed). Previous and next (buttons, the arrow keys, or a swipe), a counter, its caption, and
4
+ // close (the button, Escape, or a click beside the image). Focus moves to it while it's open and
5
+ // back to where it was after.
6
+ import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'
7
+ import TIcon from './TIcon.vue'
8
+
9
+ export interface LightboxImage { src: string; alt?: string; caption?: string }
10
+
11
+ const props = withDefaults(defineProps<{ images: LightboxImage[]; loop?: boolean }>(), { loop: true })
12
+ const index = defineModel<number | null>({ default: null })
13
+
14
+ const open = computed(() => index.value != null && index.value >= 0 && index.value < props.images.length)
15
+ const image = computed(() => (open.value ? props.images[index.value!] : null))
16
+ const many = computed(() => props.images.length > 1)
17
+
18
+ function step(by: 1 | -1) {
19
+ if (index.value == null || !many.value) return
20
+ const next = index.value + by
21
+ index.value = props.loop ? (next + props.images.length) % props.images.length : Math.min(Math.max(next, 0), props.images.length - 1)
22
+ }
23
+ const close = () => { index.value = null }
24
+
25
+ function key(event: KeyboardEvent) {
26
+ if (!open.value) return
27
+ if (event.key === 'Escape') close()
28
+ else if (event.key === 'ArrowRight') step(1)
29
+ else if (event.key === 'ArrowLeft') step(-1)
30
+ else return
31
+ event.preventDefault()
32
+ }
33
+
34
+ // A swipe across moves to the next or previous.
35
+ let startX: number | null = null
36
+ function touchStart(event: TouchEvent) { startX = event.touches[0]?.clientX ?? null }
37
+ function touchEnd(event: TouchEvent) {
38
+ const endX = event.changedTouches[0]?.clientX
39
+ if (startX != null && endX != null && Math.abs(endX - startX) > 50) step(endX < startX ? 1 : -1)
40
+ startX = null
41
+ }
42
+
43
+ const dialog = ref<HTMLElement>()
44
+ let before: Element | null = null
45
+ watch(open, async now => {
46
+ if (now) {
47
+ before = document.activeElement
48
+ document.addEventListener('keydown', key)
49
+ await nextTick()
50
+ dialog.value?.focus()
51
+ } else {
52
+ document.removeEventListener('keydown', key)
53
+ if (before instanceof HTMLElement) before.focus()
54
+ }
55
+ }, { immediate: true })
56
+ onBeforeUnmount(() => document.removeEventListener('keydown', key))
57
+ </script>
58
+
59
+ <template>
60
+ <Teleport to="body">
61
+ <div v-if="open && image" ref="dialog" class="t-lightbox" role="dialog" aria-modal="true" :aria-label="image.alt || image.caption || 'Image'" tabindex="-1"
62
+ @click.self="close" @touchstart.passive="touchStart" @touchend="touchEnd">
63
+ <button type="button" class="t-lightbox-close" aria-label="Close" @click="close"><TIcon name="x" /></button>
64
+ <button v-if="many" type="button" class="t-lightbox-step start" aria-label="Previous image" @click="step(-1)"><TIcon name="chevron-left" /></button>
65
+ <figure class="t-lightbox-figure" @click.self="close">
66
+ <img :key="image.src" :src="image.src" :alt="image.alt ?? ''">
67
+ <figcaption v-if="image.caption || many">
68
+ <span v-if="many" class="t-lightbox-count">{{ index! + 1 }} / {{ images.length }}</span>
69
+ <span v-if="image.caption">{{ image.caption }}</span>
70
+ </figcaption>
71
+ </figure>
72
+ <button v-if="many" type="button" class="t-lightbox-step end" aria-label="Next image" @click="step(1)"><TIcon name="chevron-right" /></button>
73
+ </div>
74
+ </Teleport>
75
+ </template>
76
+
77
+ <style scoped>
78
+ .t-lightbox {
79
+ position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center;
80
+ background: rgba(10, 12, 16, 0.88); outline: none; animation: t-lightbox-in 0.15s ease-out;
81
+ }
82
+ @keyframes t-lightbox-in { from { opacity: 0; } }
83
+ .t-lightbox-figure { margin: 0; max-width: calc(100vw - 8rem); max-height: calc(100vh - 6rem); display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
84
+ .t-lightbox-figure img { max-width: 100%; max-height: calc(100vh - 9rem); object-fit: contain; border-radius: var(--tblr-border-radius); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4); }
85
+ .t-lightbox-figure figcaption { display: flex; gap: 0.75rem; align-items: baseline; color: #e6e7e9; font-size: 0.875rem; text-align: center; }
86
+ .t-lightbox-count { color: #9aa0ac; font-variant-numeric: tabular-nums; }
87
+ .t-lightbox-close, .t-lightbox-step {
88
+ position: absolute; display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%;
89
+ background: rgba(255, 255, 255, 0.1); color: #fff; font-size: 1.25rem; cursor: pointer;
90
+ }
91
+ .t-lightbox-close:hover, .t-lightbox-step:hover { background: rgba(255, 255, 255, 0.2); }
92
+ .t-lightbox-close:focus-visible, .t-lightbox-step:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
93
+ .t-lightbox-close { top: 1rem; right: 1rem; }
94
+ .t-lightbox-step { top: 50%; transform: translateY(-50%); }
95
+ .t-lightbox-step.start { left: 1rem; }
96
+ .t-lightbox-step.end { right: 1rem; }
97
+ @media (max-width: 576px) {
98
+ .t-lightbox-figure { max-width: 100vw; }
99
+ .t-lightbox-step { top: auto; bottom: 1rem; transform: none; }
100
+ }
101
+ </style>