@bjj/nuxt-layer-shadcn-ui 0.10.3 → 0.11.1

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 (42) 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 +2 -2
  10. package/app/components/ui/AsyncDataTable/index.vue +4 -9
  11. package/app/components/ui/AsyncDataTable/types.ts +7 -7
  12. package/app/components/ui/DataTable/index.stories.ts +45 -0
  13. package/app/components/ui/DataTable/index.vue +20 -3
  14. package/app/components/ui/DataTable/types.ts +3 -1
  15. package/app/components/ui/StaticDataTable/en.json +3 -0
  16. package/app/components/ui/StaticDataTable/index.stories.ts +233 -0
  17. package/app/components/ui/StaticDataTable/index.vue +250 -0
  18. package/app/components/ui/StaticDataTable/types.ts +37 -0
  19. package/app/components/ui/Steps/index.stories.ts +219 -0
  20. package/app/components/ui/Steps/index.vue +129 -0
  21. package/app/components/ui/Steps/types.ts +34 -0
  22. package/app/components/ui/Upload/index.vue +1 -1
  23. package/i18n/messages/ar.json +3 -0
  24. package/i18n/messages/de.json +3 -0
  25. package/i18n/messages/en.json +3 -0
  26. package/i18n/messages/es.json +3 -0
  27. package/i18n/messages/fr.json +3 -0
  28. package/i18n/messages/hi.json +3 -0
  29. package/i18n/messages/id.json +3 -0
  30. package/i18n/messages/it.json +3 -0
  31. package/i18n/messages/ja.json +3 -0
  32. package/i18n/messages/ko.json +3 -0
  33. package/i18n/messages/nl.json +3 -0
  34. package/i18n/messages/pl.json +3 -0
  35. package/i18n/messages/pt.json +3 -0
  36. package/i18n/messages/ru.json +3 -0
  37. package/i18n/messages/th.json +3 -0
  38. package/i18n/messages/tr.json +3 -0
  39. package/i18n/messages/vi.json +3 -0
  40. package/i18n/messages/zh-CN.json +3 -0
  41. package/i18n/messages/zh-TW.json +3 -0
  42. package/package.json +2 -2
@@ -0,0 +1,250 @@
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
+ topToolbarThreshold: 50,
15
+ showBottomToolbar: true,
16
+ pageSizeOptions: () => [ 10, 20, 50, 100 ],
17
+ showPagination: true,
18
+ selectable: false,
19
+ clickable: false,
20
+ batchActions: () => [],
21
+ selection: () => [],
22
+ })
23
+
24
+ const emit = defineEmits<{
25
+ 'update:selection': [value: TData[]]
26
+ 'rowClick': [row: TData, index: number, event: MouseEvent]
27
+ }>()
28
+
29
+ const T = useTranslations('components.ui.StaticDataTable')
30
+ const { isMobile } = useDevice()
31
+
32
+ // -- Selection --
33
+
34
+ const selectionValue = computed(() => props.selection ?? [])
35
+
36
+ function onSelectionChange (value: TData | TData[] | null) {
37
+ emit('update:selection', Array.isArray(value) ? value : value ? [ value ] : [])
38
+ }
39
+
40
+ // -- Internal state --
41
+
42
+ const pagination = ref<StaticDataTablePagination>({
43
+ page: 1,
44
+ size: props.pageSizeOptions[0] || 10,
45
+ })
46
+
47
+ const sortState = ref<{ sortBy: string | null, sortOrder: 1 | -1 | null }>({
48
+ sortBy: null,
49
+ sortOrder: null,
50
+ })
51
+
52
+ // -- Sorting + pagination --
53
+
54
+ const defaultSort: StaticDataTableSortMethod<TData> = (items, sortBy, sortOrder) => {
55
+ return [ ...items ].sort((a, b) => {
56
+ const av = a[sortBy]
57
+ const bv = b[sortBy]
58
+ if (av == null && bv == null) return 0
59
+ if (av == null) return 1
60
+ if (bv == null) return -1
61
+ if (typeof av === 'number' && typeof bv === 'number') {
62
+ return (av - bv) * sortOrder
63
+ }
64
+ return String(av).localeCompare(String(bv)) * sortOrder
65
+ })
66
+ }
67
+
68
+ const sortedData = computed<TData[]>(() => {
69
+ const { sortBy, sortOrder } = sortState.value
70
+ if (!sortBy || !sortOrder) return props.data
71
+ const sortFn = props.sortMethod ?? defaultSort
72
+ return sortFn(props.data, sortBy, sortOrder)
73
+ })
74
+
75
+ const totalCount = computed(() => sortedData.value.length)
76
+
77
+ const tableData = computed<TData[]>(() => {
78
+ if (!props.showPagination) return sortedData.value
79
+ const start = (pagination.value.page - 1) * pagination.value.size
80
+ return sortedData.value.slice(start, start + pagination.value.size)
81
+ })
82
+
83
+ // Reset to page 1 when the underlying data shape or sort changes so the
84
+ // pagination state stays consistent with what's actually shown.
85
+ watch(
86
+ [ () => props.data, () => sortState.value.sortBy, () => sortState.value.sortOrder ],
87
+ () => {
88
+ pagination.value.page = 1
89
+ },
90
+ )
91
+
92
+ // -- Toolbar / batch actions --
93
+
94
+ const showSelectionColumn = computed(() => props.selectable || props.batchActions.length > 0)
95
+ const selectedCount = computed(() => props.selection?.length ?? 0)
96
+ const hasBatchActions = computed(() => props.batchActions.length > 0)
97
+ const batchActionsDisabled = computed(() => selectedCount.value === 0)
98
+
99
+ const hasPaginationData = computed(() => totalCount.value > 0)
100
+
101
+ const shouldShowTopToolbar = computed(() => {
102
+ if (props.showTopToolbar !== undefined) return props.showTopToolbar
103
+ return pagination.value.size >= props.topToolbarThreshold
104
+ })
105
+
106
+ const shouldShowBottomToolbar = computed(() => props.showBottomToolbar)
107
+
108
+ const batchMenuItems = computed<DropdownItem[]>(() =>
109
+ props.batchActions.map(item => {
110
+ if (item.type === 'separator' || item.type === 'label') {
111
+ return item
112
+ }
113
+ const { action, disabled, ...rest } = item
114
+ return {
115
+ ...rest,
116
+ disabled: disabled || batchActionsDisabled.value,
117
+ command: () => action?.(props.selection ?? []),
118
+ }
119
+ }),
120
+ )
121
+
122
+ // -- Event handlers --
123
+
124
+ function onPageChange (newPage: number) {
125
+ if (newPage === pagination.value.page) return
126
+ pagination.value.page = newPage
127
+ }
128
+
129
+ function onPageSizeChange (newSize: number) {
130
+ if (newSize === pagination.value.size) return
131
+ pagination.value.size = newSize
132
+ pagination.value.page = 1
133
+ }
134
+
135
+ function onSortByUpdate (value: string | null) {
136
+ sortState.value.sortBy = value
137
+ }
138
+
139
+ function onSortOrderUpdate (value: number | null) {
140
+ sortState.value.sortOrder = value as 1 | -1 | null
141
+ }
142
+ </script>
143
+
144
+ <template>
145
+ <div>
146
+ <!-- Top toolbar -->
147
+ <div
148
+ v-if="shouldShowTopToolbar && (!!$slots.toolbar || hasBatchActions || (showPagination && hasPaginationData))"
149
+ class="mb-4 gap-4 flex flex-wrap items-center justify-between"
150
+ >
151
+ <div class="gap-2 flex items-center">
152
+ <Dropdown
153
+ v-if="hasBatchActions"
154
+ :menus="batchMenuItems"
155
+ trigger="click"
156
+ >
157
+ <Button
158
+ :variant="batchActionsDisabled ? 'outline' : 'default'"
159
+ :size="isMobile ? 'sm' : 'default'"
160
+ :disabled="batchActionsDisabled"
161
+ >
162
+ {{ T('actions') }} ({{ selectedCount }})
163
+ <Icon
164
+ name="chevron-down"
165
+ class="size-4"
166
+ />
167
+ </Button>
168
+ </Dropdown>
169
+ <slot name="toolbar" />
170
+ </div>
171
+
172
+ <Pagination
173
+ v-if="showPagination"
174
+ :page="pagination.page"
175
+ :total="totalCount"
176
+ :pageSize="pagination.size"
177
+ :pageSizeOptions="pageSizeOptions"
178
+ :simple="isMobile"
179
+ :size="isMobile ? 'sm' : 'default'"
180
+ @update:page="onPageChange"
181
+ @update:pageSize="onPageSizeChange"
182
+ />
183
+ </div>
184
+
185
+ <!-- DataTable -->
186
+ <DataTable
187
+ :selection="selectionValue"
188
+ :data="tableData"
189
+ :columns="columns"
190
+ :selectionMode="showSelectionColumn ? 'multiple' : undefined"
191
+ :clickable="clickable"
192
+ :sortBy="sortState.sortBy"
193
+ :sortOrder="sortState.sortOrder"
194
+ @update:selection="onSelectionChange"
195
+ @update:sortBy="onSortByUpdate"
196
+ @update:sortOrder="onSortOrderUpdate"
197
+ @rowClick="(row: TData, index: number, event: MouseEvent) => emit('rowClick', row, index, event)"
198
+ >
199
+ <template
200
+ v-for="name in Object.keys($slots).filter(n => n !== 'toolbar')"
201
+ :key="name"
202
+ #[name]="slotData"
203
+ >
204
+ <slot
205
+ :name="name"
206
+ v-bind="slotData ?? {}"
207
+ />
208
+ </template>
209
+ </DataTable>
210
+
211
+ <!-- Bottom toolbar -->
212
+ <div
213
+ v-if="shouldShowBottomToolbar && (!!$slots.toolbar || hasBatchActions || (showPagination && hasPaginationData))"
214
+ class="mt-4 gap-4 flex flex-wrap items-center justify-between"
215
+ >
216
+ <div class="gap-2 flex items-center">
217
+ <Dropdown
218
+ v-if="hasBatchActions"
219
+ :menus="batchMenuItems"
220
+ trigger="click"
221
+ >
222
+ <Button
223
+ :variant="batchActionsDisabled ? 'outline' : 'default'"
224
+ :size="isMobile ? 'sm' : 'default'"
225
+ :disabled="batchActionsDisabled"
226
+ >
227
+ {{ T('actions') }} ({{ selectedCount }})
228
+ <Icon
229
+ name="chevron-down"
230
+ class="size-4"
231
+ />
232
+ </Button>
233
+ </Dropdown>
234
+ <slot name="toolbar" />
235
+ </div>
236
+
237
+ <Pagination
238
+ v-if="showPagination"
239
+ :page="pagination.page"
240
+ :total="totalCount"
241
+ :pageSize="pagination.size"
242
+ :pageSizeOptions="pageSizeOptions"
243
+ :simple="isMobile"
244
+ :size="isMobile ? 'sm' : 'default'"
245
+ @update:page="onPageChange"
246
+ @update:pageSize="onPageSizeChange"
247
+ />
248
+ </div>
249
+ </div>
250
+ </template>
@@ -0,0 +1,37 @@
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 >= `topToolbarThreshold`) */
20
+ showTopToolbar?: boolean
21
+ /** Page-size threshold that triggers the top toolbar when `showTopToolbar` is undefined (default: 50) */
22
+ topToolbarThreshold?: number
23
+ /** Whether to show bottom toolbar (default: true) */
24
+ showBottomToolbar?: boolean
25
+ /** Available page size options */
26
+ pageSizeOptions?: number[]
27
+ /** Whether to show pagination controls (default: true) */
28
+ showPagination?: boolean
29
+ /** Whether rows are selectable */
30
+ selectable?: boolean
31
+ /** Whether rows are clickable (shows pointer cursor and pairs with `@rowClick`) */
32
+ clickable?: boolean
33
+ /** Batch action definitions for selected rows */
34
+ batchActions?: StaticDataTableBatchAction<T>[]
35
+ /** Selected rows (v-model:selection) */
36
+ selection?: T[]
37
+ }
@@ -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": "انقر أو اسحب الملف إلى هذه المنطقة للتحميل",