@bjj/nuxt-layer-shadcn-ui 0.10.2 → 0.11.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 (41) hide show
  1. package/app/components/shadcn/stepper/Stepper.vue +27 -0
  2. package/app/components/shadcn/stepper/StepperDescription.vue +19 -0
  3. package/app/components/shadcn/stepper/StepperIndicator.vue +32 -0
  4. package/app/components/shadcn/stepper/StepperItem.vue +23 -0
  5. package/app/components/shadcn/stepper/StepperSeparator.vue +27 -0
  6. package/app/components/shadcn/stepper/StepperTitle.vue +19 -0
  7. package/app/components/shadcn/stepper/StepperTrigger.vue +22 -0
  8. package/app/components/shadcn/stepper/index.ts +7 -0
  9. package/app/components/ui/AsyncDataTable/index.stories.ts +0 -2
  10. package/app/components/ui/AsyncDataTable/index.vue +2 -8
  11. package/app/components/ui/AsyncDataTable/types.ts +4 -6
  12. package/app/components/ui/DataTable/index.stories.ts +2 -2
  13. package/app/components/ui/DataTable/index.vue +20 -1
  14. package/app/components/ui/StaticDataTable/en.json +3 -0
  15. package/app/components/ui/StaticDataTable/index.stories.ts +231 -0
  16. package/app/components/ui/StaticDataTable/index.vue +249 -0
  17. package/app/components/ui/StaticDataTable/types.ts +35 -0
  18. package/app/components/ui/Steps/index.stories.ts +219 -0
  19. package/app/components/ui/Steps/index.vue +129 -0
  20. package/app/components/ui/Steps/types.ts +34 -0
  21. package/app/components/ui/Upload/index.vue +1 -1
  22. package/i18n/messages/ar.json +3 -0
  23. package/i18n/messages/de.json +3 -0
  24. package/i18n/messages/en.json +3 -0
  25. package/i18n/messages/es.json +3 -0
  26. package/i18n/messages/fr.json +3 -0
  27. package/i18n/messages/hi.json +3 -0
  28. package/i18n/messages/id.json +3 -0
  29. package/i18n/messages/it.json +3 -0
  30. package/i18n/messages/ja.json +3 -0
  31. package/i18n/messages/ko.json +3 -0
  32. package/i18n/messages/nl.json +3 -0
  33. package/i18n/messages/pl.json +3 -0
  34. package/i18n/messages/pt.json +3 -0
  35. package/i18n/messages/ru.json +3 -0
  36. package/i18n/messages/th.json +3 -0
  37. package/i18n/messages/tr.json +3 -0
  38. package/i18n/messages/vi.json +3 -0
  39. package/i18n/messages/zh-CN.json +3 -0
  40. package/i18n/messages/zh-TW.json +3 -0
  41. package/package.json +2 -2
@@ -0,0 +1,249 @@
1
+ <script setup lang="ts" generic="TData extends Record<string, any>">
2
+ import type { StaticDataTableProps, StaticDataTableSortMethod } from './types'
3
+
4
+ interface StaticDataTablePagination {
5
+ page: number
6
+ size: number
7
+ }
8
+
9
+ const props = withDefaults(defineProps<StaticDataTableProps<TData>>(), {
10
+ data: () => [],
11
+ columns: () => [],
12
+ sortMethod: undefined,
13
+ showTopToolbar: undefined,
14
+ showBottomToolbar: true,
15
+ pageSizeOptions: () => [ 10, 20, 50, 100 ],
16
+ showPagination: true,
17
+ selectable: false,
18
+ clickable: false,
19
+ batchActions: () => [],
20
+ selection: () => [],
21
+ })
22
+
23
+ const emit = defineEmits<{
24
+ 'update:selection': [value: TData[]]
25
+ 'rowClick': [row: TData, index: number, event: MouseEvent]
26
+ }>()
27
+
28
+ const T = useTranslations('components.ui.StaticDataTable')
29
+ const { isMobile } = useDevice()
30
+
31
+ // -- Selection --
32
+
33
+ const selectionValue = computed(() => props.selection ?? [])
34
+
35
+ function onSelectionChange (value: TData | TData[] | null) {
36
+ emit('update:selection', Array.isArray(value) ? value : value ? [ value ] : [])
37
+ }
38
+
39
+ // -- Internal state --
40
+
41
+ const pagination = ref<StaticDataTablePagination>({
42
+ page: 1,
43
+ size: props.pageSizeOptions[0] || 10,
44
+ })
45
+
46
+ const sortState = ref<{ sortBy: string | null, sortOrder: 1 | -1 | null }>({
47
+ sortBy: null,
48
+ sortOrder: null,
49
+ })
50
+
51
+ // -- Sorting + pagination --
52
+
53
+ const defaultSort: StaticDataTableSortMethod<TData> = (items, sortBy, sortOrder) => {
54
+ return [ ...items ].sort((a, b) => {
55
+ const av = a[sortBy]
56
+ const bv = b[sortBy]
57
+ if (av == null && bv == null) return 0
58
+ if (av == null) return 1
59
+ if (bv == null) return -1
60
+ if (typeof av === 'number' && typeof bv === 'number') {
61
+ return (av - bv) * sortOrder
62
+ }
63
+ return String(av).localeCompare(String(bv)) * sortOrder
64
+ })
65
+ }
66
+
67
+ const sortedData = computed<TData[]>(() => {
68
+ const { sortBy, sortOrder } = sortState.value
69
+ if (!sortBy || !sortOrder) return props.data
70
+ const sortFn = props.sortMethod ?? defaultSort
71
+ return sortFn(props.data, sortBy, sortOrder)
72
+ })
73
+
74
+ const totalCount = computed(() => sortedData.value.length)
75
+
76
+ const tableData = computed<TData[]>(() => {
77
+ if (!props.showPagination) return sortedData.value
78
+ const start = (pagination.value.page - 1) * pagination.value.size
79
+ return sortedData.value.slice(start, start + pagination.value.size)
80
+ })
81
+
82
+ // Reset to page 1 when the underlying data shape or sort changes so the
83
+ // pagination state stays consistent with what's actually shown.
84
+ watch(
85
+ [ () => props.data, () => sortState.value.sortBy, () => sortState.value.sortOrder ],
86
+ () => {
87
+ pagination.value.page = 1
88
+ },
89
+ )
90
+
91
+ // -- Toolbar / batch actions --
92
+
93
+ const showSelectionColumn = computed(() => props.selectable || props.batchActions.length > 0)
94
+ const selectedCount = computed(() => props.selection?.length ?? 0)
95
+ const hasBatchActions = computed(() => props.batchActions.length > 0)
96
+ const batchActionsDisabled = computed(() => selectedCount.value === 0)
97
+
98
+ const hasPaginationData = computed(() => totalCount.value > 0)
99
+
100
+ const shouldShowTopToolbar = computed(() => {
101
+ if (props.showTopToolbar !== undefined) return props.showTopToolbar
102
+ return pagination.value.size >= 50
103
+ })
104
+
105
+ const shouldShowBottomToolbar = computed(() => props.showBottomToolbar)
106
+
107
+ const batchMenuItems = computed<DropdownItem[]>(() =>
108
+ props.batchActions.map(item => {
109
+ if (item.type === 'separator' || item.type === 'label') {
110
+ return item
111
+ }
112
+ const { action, disabled, ...rest } = item
113
+ return {
114
+ ...rest,
115
+ disabled: disabled || batchActionsDisabled.value,
116
+ command: () => action?.(props.selection ?? []),
117
+ }
118
+ }),
119
+ )
120
+
121
+ // -- Event handlers --
122
+
123
+ function onPageChange (newPage: number) {
124
+ if (newPage === pagination.value.page) return
125
+ pagination.value.page = newPage
126
+ }
127
+
128
+ function onPageSizeChange (newSize: number) {
129
+ if (newSize === pagination.value.size) return
130
+ pagination.value.size = newSize
131
+ pagination.value.page = 1
132
+ }
133
+
134
+ function onSortByUpdate (value: string | null) {
135
+ sortState.value.sortBy = value
136
+ }
137
+
138
+ function onSortOrderUpdate (value: number | null) {
139
+ sortState.value.sortOrder = value as 1 | -1 | null
140
+ }
141
+ </script>
142
+
143
+ <template>
144
+ <div>
145
+ <!-- Top toolbar -->
146
+ <div
147
+ v-if="shouldShowTopToolbar && (!!$slots.toolbar || hasBatchActions || (showPagination && hasPaginationData))"
148
+ class="mb-4 gap-4 flex flex-wrap items-center justify-between"
149
+ >
150
+ <div class="gap-2 flex items-center">
151
+ <Dropdown
152
+ v-if="hasBatchActions"
153
+ :menus="batchMenuItems"
154
+ trigger="click"
155
+ >
156
+ <Button
157
+ :variant="batchActionsDisabled ? 'outline' : 'default'"
158
+ :size="isMobile ? 'sm' : 'default'"
159
+ :disabled="batchActionsDisabled"
160
+ >
161
+ {{ T('actions') }} ({{ selectedCount }})
162
+ <Icon
163
+ name="chevron-down"
164
+ class="size-4"
165
+ />
166
+ </Button>
167
+ </Dropdown>
168
+ <slot name="toolbar" />
169
+ </div>
170
+
171
+ <Pagination
172
+ v-if="showPagination"
173
+ :page="pagination.page"
174
+ :total="totalCount"
175
+ :pageSize="pagination.size"
176
+ :pageSizeOptions="pageSizeOptions"
177
+ :simple="isMobile"
178
+ :size="isMobile ? 'sm' : 'default'"
179
+ @update:page="onPageChange"
180
+ @update:pageSize="onPageSizeChange"
181
+ />
182
+ </div>
183
+
184
+ <!-- DataTable -->
185
+ <DataTable
186
+ :selection="selectionValue"
187
+ :data="tableData"
188
+ :columns="columns"
189
+ :selectionMode="showSelectionColumn ? 'multiple' : undefined"
190
+ :clickable="clickable"
191
+ :sortBy="sortState.sortBy"
192
+ :sortOrder="sortState.sortOrder"
193
+ @update:selection="onSelectionChange"
194
+ @update:sortBy="onSortByUpdate"
195
+ @update:sortOrder="onSortOrderUpdate"
196
+ @rowClick="(row: TData, index: number, event: MouseEvent) => emit('rowClick', row, index, event)"
197
+ >
198
+ <template
199
+ v-for="name in Object.keys($slots).filter(n => n !== 'toolbar')"
200
+ :key="name"
201
+ #[name]="slotData"
202
+ >
203
+ <slot
204
+ :name="name"
205
+ v-bind="slotData ?? {}"
206
+ />
207
+ </template>
208
+ </DataTable>
209
+
210
+ <!-- Bottom toolbar -->
211
+ <div
212
+ v-if="shouldShowBottomToolbar && (!!$slots.toolbar || hasBatchActions || (showPagination && hasPaginationData))"
213
+ class="mt-4 gap-4 flex flex-wrap items-center justify-between"
214
+ >
215
+ <div class="gap-2 flex items-center">
216
+ <Dropdown
217
+ v-if="hasBatchActions"
218
+ :menus="batchMenuItems"
219
+ trigger="click"
220
+ >
221
+ <Button
222
+ :variant="batchActionsDisabled ? 'outline' : 'default'"
223
+ :size="isMobile ? 'sm' : 'default'"
224
+ :disabled="batchActionsDisabled"
225
+ >
226
+ {{ T('actions') }} ({{ selectedCount }})
227
+ <Icon
228
+ name="chevron-down"
229
+ class="size-4"
230
+ />
231
+ </Button>
232
+ </Dropdown>
233
+ <slot name="toolbar" />
234
+ </div>
235
+
236
+ <Pagination
237
+ v-if="showPagination"
238
+ :page="pagination.page"
239
+ :total="totalCount"
240
+ :pageSize="pagination.size"
241
+ :pageSizeOptions="pageSizeOptions"
242
+ :simple="isMobile"
243
+ :size="isMobile ? 'sm' : 'default'"
244
+ @update:page="onPageChange"
245
+ @update:pageSize="onPageSizeChange"
246
+ />
247
+ </div>
248
+ </div>
249
+ </template>
@@ -0,0 +1,35 @@
1
+ import type { DataTableColumn } from '../DataTable/types'
2
+ import type { DropdownActionItem, DropdownLabelItem, DropdownSeparatorItem } from '../Dropdown/types'
3
+
4
+ export type StaticDataTableBatchAction<T = Record<string, any>>
5
+ = | (Omit<DropdownActionItem, 'command'> & { action?: (selectedItems: T[]) => void })
6
+ | DropdownSeparatorItem
7
+ | DropdownLabelItem
8
+
9
+ export type StaticDataTableSortMethod<T = Record<string, any>>
10
+ = (items: T[], sortBy: string, sortOrder: 1 | -1) => T[]
11
+
12
+ export interface StaticDataTableProps<T = Record<string, any>> {
13
+ /** Static data array. Pre-filter externally before passing in. */
14
+ data?: T[]
15
+ /** Column definitions */
16
+ columns?: DataTableColumn[]
17
+ /** Custom sort implementation. Receives the data and the current sort state; should return sorted items. Defaults to a generic comparator on `row[sortBy]`. */
18
+ sortMethod?: StaticDataTableSortMethod<T>
19
+ /** Whether to show top toolbar (undefined = auto when page size >= 50) */
20
+ showTopToolbar?: boolean
21
+ /** Whether to show bottom toolbar (default: true) */
22
+ showBottomToolbar?: boolean
23
+ /** Available page size options */
24
+ pageSizeOptions?: number[]
25
+ /** Whether to show pagination controls (default: true) */
26
+ showPagination?: boolean
27
+ /** Whether rows are selectable */
28
+ selectable?: boolean
29
+ /** Whether rows are clickable (shows pointer cursor and pairs with `@rowClick`) */
30
+ clickable?: boolean
31
+ /** Batch action definitions for selected rows */
32
+ batchActions?: StaticDataTableBatchAction<T>[]
33
+ /** Selected rows (v-model:selection) */
34
+ selection?: T[]
35
+ }
@@ -0,0 +1,219 @@
1
+ import type { Meta, StoryObj } from '@storybook/vue3'
2
+ import type { StepsItem } from './types'
3
+ import { useArgsModel } from '#storybook/argsModel'
4
+ import Steps from './index.vue'
5
+
6
+ const orientations = [ 'horizontal', 'vertical' ] as const
7
+
8
+ const basicItems: StepsItem[] = [
9
+ { title: 'Account', description: 'Create your account' },
10
+ { title: 'Profile', description: 'Fill in your profile' },
11
+ { title: 'Confirm', description: 'Review and submit' },
12
+ ]
13
+
14
+ const iconItems: StepsItem[] = [
15
+ { title: 'Account', description: 'Create your account', icon: 'user-plus' },
16
+ { title: 'Payment', description: 'Add a payment method', icon: 'credit-card' },
17
+ { title: 'Done', description: 'You are all set', icon: 'flag' },
18
+ ]
19
+
20
+ const disabledItems: StepsItem[] = [
21
+ { title: 'Account', description: 'Create your account' },
22
+ { title: 'Profile', description: 'Fill in your profile' },
23
+ { title: 'Review', description: 'disabled: true', disabled: true },
24
+ { title: 'Done', description: 'You are all set' },
25
+ ]
26
+
27
+ const completedItems: StepsItem[] = [
28
+ { title: 'Cart', description: 'Items added' },
29
+ { title: 'Shipping', description: 'In progress' },
30
+ { title: 'Payment', description: 'completed: true', completed: true },
31
+ { title: 'Done', description: 'Order complete' },
32
+ ]
33
+
34
+ const titleOnlyItems: StepsItem[] = [
35
+ { title: 'Step 1' },
36
+ { title: 'Step 2' },
37
+ { title: 'Step 3' },
38
+ ]
39
+
40
+ const customSlotItems: StepsItem[] = [
41
+ { title: 'Account', description: 'Create your account', icon: 'user-plus' },
42
+ { title: 'Payment', description: 'Add a payment method', icon: 'credit-card' },
43
+ { title: 'Confirm', description: 'Review and submit', icon: 'flag' },
44
+ ]
45
+
46
+ const meta = {
47
+ title: 'UI/Steps',
48
+ component: Steps,
49
+ argTypes: {
50
+ items: { control: 'object' },
51
+ modelValue: { control: 'number' },
52
+ defaultValue: { control: 'number' },
53
+ orientation: { control: 'inline-radio', options: orientations },
54
+ linear: { control: 'boolean' },
55
+ },
56
+ args: {
57
+ items: basicItems,
58
+ modelValue: 2,
59
+ defaultValue: undefined,
60
+ orientation: 'horizontal',
61
+ linear: false,
62
+ },
63
+ render: args => {
64
+ const onUpdate = useArgsModel()
65
+ return {
66
+ components: { Steps },
67
+ setup: () => ({ args, onUpdate }),
68
+ template: `
69
+ <Steps v-bind="args" @update:modelValue="onUpdate" />
70
+ `,
71
+ }
72
+ },
73
+ } satisfies Meta<typeof Steps>
74
+
75
+ export default meta
76
+ type Story = StoryObj<typeof meta>
77
+
78
+ const noControls = { controls: { disable: true }} satisfies Story['parameters']
79
+
80
+ export const Default: Story = {}
81
+
82
+ export const TitleOnly: Story = {
83
+ parameters: noControls,
84
+ args: {
85
+ items: titleOnlyItems,
86
+ modelValue: 2,
87
+ },
88
+ }
89
+
90
+ export const WithIcons: Story = {
91
+ parameters: noControls,
92
+ args: {
93
+ items: iconItems,
94
+ modelValue: 2,
95
+ },
96
+ }
97
+
98
+ export const Vertical: Story = {
99
+ parameters: noControls,
100
+ args: {
101
+ items: iconItems,
102
+ modelValue: 2,
103
+ orientation: 'vertical',
104
+ },
105
+ }
106
+
107
+ export const WithDisabledItem: Story = {
108
+ parameters: noControls,
109
+ args: {
110
+ items: disabledItems,
111
+ modelValue: 2,
112
+ },
113
+ }
114
+
115
+ export const WithCompletedFlag: Story = {
116
+ parameters: noControls,
117
+ args: {
118
+ items: completedItems,
119
+ modelValue: 2,
120
+ },
121
+ }
122
+
123
+ export const Linear: Story = {
124
+ parameters: {
125
+ ...noControls,
126
+ docs: {
127
+ source: {
128
+ code: `
129
+ <template>
130
+ <div class="flex flex-col gap-8">
131
+ <div>
132
+ <p class="mb-3 text-sm text-muted-foreground">
133
+ <code>linear: false</code> — click any step to jump there freely.
134
+ </p>
135
+ <Steps :items="items" v-model="freeStep" :linear="false" />
136
+ </div>
137
+ <div>
138
+ <p class="mb-3 text-sm text-muted-foreground">
139
+ <code>linear: true</code> — only the next adjacent step is reachable; skipping ahead is blocked.
140
+ </p>
141
+ <Steps :items="items" v-model="linearStep" linear />
142
+ </div>
143
+ </div>
144
+ </template>
145
+ `.trim(),
146
+ },
147
+ },
148
+ },
149
+ render: () => ({
150
+ components: { Steps },
151
+ setup () {
152
+ const freeStep = ref(1)
153
+ const linearStep = ref(1)
154
+ return { freeStep, linearStep, items: basicItems }
155
+ },
156
+ template: `
157
+ <div class="flex flex-col gap-8">
158
+ <div>
159
+ <p class="mb-3 text-sm text-muted-foreground">
160
+ <code>linear: false</code> — click any step to jump there freely.
161
+ </p>
162
+ <Steps :items="items" v-model="freeStep" :linear="false" />
163
+ </div>
164
+ <div>
165
+ <p class="mb-3 text-sm text-muted-foreground">
166
+ <code>linear: true</code> — only the next adjacent step is reachable; skipping ahead is blocked.
167
+ </p>
168
+ <Steps :items="items" v-model="linearStep" linear />
169
+ </div>
170
+ </div>
171
+ `,
172
+ }),
173
+ }
174
+
175
+ export const CustomSlots: Story = {
176
+ parameters: {
177
+ ...noControls,
178
+ docs: {
179
+ source: {
180
+ code: `
181
+ <template>
182
+ <Steps :items="items" :modelValue="2">
183
+ <template #title="{ item, step, state }">
184
+ <span class="flex items-center gap-1">
185
+ <span class="font-mono text-xs text-muted-foreground">#{{ step }}</span>
186
+ <span :class="state === 'active' ? 'text-primary' : ''">{{ item.title }}</span>
187
+ </span>
188
+ </template>
189
+ <template #description="{ item, state }">
190
+ <span :class="state === 'completed' ? 'text-accent-foreground' : 'text-muted-foreground'">
191
+ {{ state === 'completed' ? 'Done — ' : '' }}{{ item.description }}
192
+ </span>
193
+ </template>
194
+ </Steps>
195
+ </template>
196
+ `.trim(),
197
+ },
198
+ },
199
+ },
200
+ render: () => ({
201
+ components: { Steps },
202
+ setup: () => ({ items: customSlotItems }),
203
+ template: `
204
+ <Steps :items="items" :modelValue="2">
205
+ <template #title="{ item, step, state }">
206
+ <span class="flex items-center gap-1">
207
+ <span class="font-mono text-xs text-muted-foreground">#{{ step }}</span>
208
+ <span :class="state === 'active' ? 'text-primary' : ''">{{ item.title }}</span>
209
+ </span>
210
+ </template>
211
+ <template #description="{ item, state }">
212
+ <span :class="state === 'completed' ? 'text-accent-foreground' : 'text-muted-foreground'">
213
+ {{ state === 'completed' ? 'Done — ' : '' }}{{ item.description }}
214
+ </span>
215
+ </template>
216
+ </Steps>
217
+ `,
218
+ }),
219
+ }
@@ -0,0 +1,129 @@
1
+ <script setup lang="ts">
2
+ import {
3
+ Stepper,
4
+ StepperDescription,
5
+ StepperIndicator,
6
+ StepperItem,
7
+ StepperSeparator,
8
+ StepperTitle,
9
+ StepperTrigger,
10
+ } from '../../shadcn/stepper'
11
+ import type { StepsItem, StepsProps, StepsState } from './types'
12
+
13
+ const props = withDefaults(defineProps<StepsProps>(), {
14
+ items: () => [],
15
+ modelValue: undefined,
16
+ defaultValue: 1,
17
+ orientation: 'horizontal',
18
+ linear: false,
19
+ class: undefined,
20
+ })
21
+
22
+ const emit = defineEmits<{
23
+ 'update:modelValue': [value: number | undefined]
24
+ }>()
25
+
26
+ defineSlots<{
27
+ title?: (props: { item: StepsItem, step: number, state: StepsState }) => unknown
28
+ description?: (props: { item: StepsItem, step: number, state: StepsState }) => unknown
29
+ }>()
30
+
31
+ const isVertical = computed(() => props.orientation === 'vertical')
32
+
33
+ const itemList = computed<StepsItem[]>(() => props.items ?? [])
34
+
35
+ const rootClass = computed(() => cn(
36
+ 'flex w-full',
37
+ isVertical.value ? 'gap-6 flex-col' : 'gap-2 items-start',
38
+ props.class,
39
+ ))
40
+
41
+ const itemClass = (item: StepsItem) => cn(
42
+ 'group relative flex',
43
+ isVertical.value
44
+ ? 'gap-4 w-full items-start'
45
+ : 'min-w-0 flex-1 flex-col items-center justify-center',
46
+ item.class,
47
+ )
48
+
49
+ const separatorClass = computed(() => isVertical.value
50
+ ? 'absolute left-5 top-10 block h-[calc(100%-1rem)] w-0.5 shrink-0 -translate-x-1/2 rounded-full'
51
+ : 'absolute top-5 right-[calc(-50%+12px)] left-[calc(50%+20px)] block h-0.5 shrink-0 -translate-y-1/2 rounded-full')
52
+
53
+ const triggerClass = computed(() => isVertical.value ? 'shrink-0' : '')
54
+
55
+ const contentClass = computed(() => isVertical.value
56
+ ? 'flex flex-col gap-0.5'
57
+ : 'flex flex-col items-center gap-0.5 text-center')
58
+ </script>
59
+
60
+ <template>
61
+ <Stepper
62
+ :modelValue="modelValue"
63
+ :defaultValue="defaultValue"
64
+ :orientation="orientation"
65
+ :linear="linear"
66
+ :class="rootClass"
67
+ @update:modelValue="value => emit('update:modelValue', value)"
68
+ >
69
+ <StepperItem
70
+ v-for="(item, index) in itemList"
71
+ v-slot="{ state }"
72
+ :key="index"
73
+ :step="index + 1"
74
+ :disabled="item.disabled"
75
+ :completed="item.completed"
76
+ :class="itemClass(item)"
77
+ >
78
+ <StepperSeparator
79
+ v-if="index !== itemList.length - 1"
80
+ :class="separatorClass"
81
+ />
82
+ <StepperTrigger :class="triggerClass">
83
+ <StepperIndicator class="bg-muted/60 relative z-10">
84
+ <Icon
85
+ v-if="state === 'completed' && !item.icon"
86
+ name="check"
87
+ class="size-4"
88
+ />
89
+ <Icon
90
+ v-else-if="item.icon"
91
+ :name="item.icon"
92
+ class="size-4"
93
+ />
94
+ <span v-else>
95
+ {{ index + 1 }}
96
+ </span>
97
+ </StepperIndicator>
98
+ </StepperTrigger>
99
+ <div
100
+ v-if="item.title || item.description || $slots.title || $slots.description"
101
+ :class="contentClass"
102
+ >
103
+ <StepperTitle
104
+ v-if="item.title || $slots.title"
105
+ class="text-sm font-semibold"
106
+ >
107
+ <slot
108
+ name="title"
109
+ :item="item"
110
+ :step="index + 1"
111
+ :state="(state as StepsState)"
112
+ >
113
+ {{ item.title }}
114
+ </slot>
115
+ </StepperTitle>
116
+ <StepperDescription v-if="item.description || $slots.description">
117
+ <slot
118
+ name="description"
119
+ :item="item"
120
+ :step="index + 1"
121
+ :state="(state as StepsState)"
122
+ >
123
+ {{ item.description }}
124
+ </slot>
125
+ </StepperDescription>
126
+ </div>
127
+ </StepperItem>
128
+ </Stepper>
129
+ </template>
@@ -0,0 +1,34 @@
1
+ import type { Component } from 'vue'
2
+
3
+ /** Render state of a single step. */
4
+ export type StepsState = 'completed' | 'active' | 'inactive'
5
+
6
+ export interface StepsItem {
7
+ /** Title text shown next to the indicator. */
8
+ title?: string
9
+ /** Description text shown below the title. */
10
+ description?: string
11
+ /** Icon name (lucide kebab-case) or a Vue component rendered inside the indicator. */
12
+ icon?: string | Component
13
+ /** When true, the step is non-interactive and visually muted. */
14
+ disabled?: boolean
15
+ /** Force the step into the completed state regardless of the active step. */
16
+ completed?: boolean
17
+ /** Extra class merged onto the step item element. */
18
+ class?: ClassValue
19
+ }
20
+
21
+ export interface StepsProps {
22
+ /** Step items to display. */
23
+ items?: StepsItem[]
24
+ /** Active step (1-based). Use with `v-model` to control the value. */
25
+ modelValue?: number
26
+ /** Initial active step when uncontrolled. */
27
+ defaultValue?: number
28
+ /** Layout direction. */
29
+ orientation?: 'horizontal' | 'vertical'
30
+ /** Whether the steps must be completed in order. */
31
+ linear?: boolean
32
+ /** Extra class merged onto the stepper root. */
33
+ class?: ClassValue
34
+ }
@@ -119,8 +119,8 @@ const hintLines = computed(() => {
119
119
  if (!allowMany.value) lines.push(T('hint.single'))
120
120
  else if (props.maxCount) lines.push(T('hint.max', { max: props.maxCount }))
121
121
  else lines.push(T('hint.multiple'))
122
- if (acceptLabel.value) lines.push(T('hint.accept', { types: acceptLabel.value }))
123
122
  if (maxSizeLabel.value) lines.push(T('hint.maxSize', { size: maxSizeLabel.value }))
123
+ if (acceptLabel.value) lines.push(T('hint.accept', { types: acceptLabel.value }))
124
124
  return lines
125
125
  })
126
126
 
@@ -78,6 +78,9 @@
78
78
  "placeholder": "يرجى اختيار",
79
79
  "searchPlaceholder": "البحث..."
80
80
  },
81
+ "StaticDataTable": {
82
+ "actions": "الإجراءات"
83
+ },
81
84
  "Upload": {
82
85
  "drag": {
83
86
  "title": "انقر أو اسحب الملف إلى هذه المنطقة للتحميل",
@@ -78,6 +78,9 @@
78
78
  "placeholder": "Bitte wählen",
79
79
  "searchPlaceholder": "Suchen..."
80
80
  },
81
+ "StaticDataTable": {
82
+ "actions": "Aktionen"
83
+ },
81
84
  "Upload": {
82
85
  "drag": {
83
86
  "title": "Klicken oder ziehen Sie eine Datei in diesen Bereich, um sie hochzuladen",