@rokkit/ui 1.0.0-next.98 → 1.0.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 (81) hide show
  1. package/README.md +159 -1
  2. package/package.json +52 -53
  3. package/src/MarkdownRenderer.svelte +106 -0
  4. package/src/components/AlertList.svelte +59 -0
  5. package/src/components/Avatar.svelte +68 -0
  6. package/src/components/Badge.svelte +57 -0
  7. package/src/components/BreadCrumbs.svelte +94 -0
  8. package/src/components/Button.svelte +91 -0
  9. package/src/components/ButtonGroup.svelte +9 -0
  10. package/src/components/Card.svelte +71 -0
  11. package/src/components/Carousel.svelte +169 -0
  12. package/src/components/Code.svelte +189 -0
  13. package/src/components/Connector.svelte +46 -0
  14. package/src/components/Divider.svelte +24 -0
  15. package/src/components/Dropdown.svelte +202 -0
  16. package/src/components/FloatingAction.svelte +367 -0
  17. package/src/components/FloatingNavigation.svelte +256 -0
  18. package/src/components/Grid.svelte +128 -0
  19. package/src/components/ItemContent.svelte +25 -0
  20. package/src/components/LazyTree.svelte +171 -0
  21. package/src/components/List.svelte +224 -0
  22. package/src/components/Menu.svelte +270 -0
  23. package/src/components/Message.svelte +75 -0
  24. package/src/components/MultiSelect.svelte +367 -0
  25. package/src/components/PaletteManager.svelte +360 -0
  26. package/src/components/Pill.svelte +83 -0
  27. package/src/components/ProgressBar.svelte +31 -0
  28. package/src/components/Range.svelte +346 -0
  29. package/src/components/Rating.svelte +115 -0
  30. package/src/components/Reveal.svelte +46 -0
  31. package/src/components/SearchFilter.svelte +88 -0
  32. package/src/components/Select.svelte +424 -0
  33. package/src/components/Shine.svelte +87 -0
  34. package/src/components/Stack.svelte +38 -0
  35. package/src/components/StatusList.svelte +18 -0
  36. package/src/components/Stepper.svelte +174 -0
  37. package/src/components/Swatch.svelte +102 -0
  38. package/src/components/Switch.svelte +71 -0
  39. package/src/components/Table.svelte +245 -0
  40. package/src/components/Tabs.svelte +202 -0
  41. package/src/components/Tilt.svelte +68 -0
  42. package/src/components/Timeline.svelte +61 -0
  43. package/src/components/Toggle.svelte +93 -0
  44. package/src/components/Toolbar.svelte +306 -0
  45. package/src/components/ToolbarGroup.svelte +17 -0
  46. package/src/components/Tooltip.svelte +121 -0
  47. package/src/components/Tree.svelte +143 -0
  48. package/src/components/UploadFileStatus.svelte +102 -0
  49. package/src/components/UploadProgress.svelte +127 -0
  50. package/src/components/UploadTarget.svelte +126 -0
  51. package/src/components/index.ts +48 -0
  52. package/src/index.ts +59 -0
  53. package/src/markdown-plugin.ts +12 -0
  54. package/src/types/button.ts +86 -0
  55. package/src/types/code.ts +46 -0
  56. package/src/types/floating-action.ts +123 -0
  57. package/src/types/floating-navigation.ts +80 -0
  58. package/src/types/index.ts +58 -0
  59. package/src/types/list.ts +200 -0
  60. package/src/types/menu.ts +95 -0
  61. package/src/types/palette.ts +160 -0
  62. package/src/types/range.ts +51 -0
  63. package/src/types/search-filter.ts +67 -0
  64. package/src/types/select.ts +176 -0
  65. package/src/types/switch.ts +68 -0
  66. package/src/types/table.ts +219 -0
  67. package/src/types/tabs.ts +103 -0
  68. package/src/types/timeline.ts +53 -0
  69. package/src/types/toggle.ts +68 -0
  70. package/src/types/toolbar.ts +167 -0
  71. package/src/types/tooltip.ts +21 -0
  72. package/src/types/tree.ts +250 -0
  73. package/src/types/upload-file-status.ts +45 -0
  74. package/src/types/upload-progress.ts +111 -0
  75. package/src/types/upload-target.ts +71 -0
  76. package/src/utils/palette.ts +618 -0
  77. package/src/utils/shiki.ts +114 -0
  78. package/src/utils/upload.js +145 -0
  79. package/LICENSE +0 -21
  80. package/src/index.js +0 -8
  81. package/src/wrappers.js +0 -2
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Toggle Component Types
3
+ *
4
+ * Provides types for the data-driven Toggle component.
5
+ * Field mapping and data access is handled by ProxyItem from @rokkit/states.
6
+ */
7
+
8
+ import type { Snippet } from 'svelte'
9
+ import type { ProxyItem } from '@rokkit/states'
10
+
11
+ // =============================================================================
12
+ // Toggle Item Types
13
+ // =============================================================================
14
+
15
+ /**
16
+ * Generic toggle item - can be any object with mapped fields
17
+ */
18
+ export type ToggleItem = Record<string, unknown>
19
+
20
+ // =============================================================================
21
+ // Snippet Types
22
+ // =============================================================================
23
+
24
+ /**
25
+ * Snippet for rendering a toggle option.
26
+ * The component renders the button wrapper; the snippet renders inner content.
27
+ * Receives the ProxyItem and whether this item is currently selected.
28
+ */
29
+ export type ToggleItemSnippet = Snippet<[ProxyItem, boolean]>
30
+
31
+ // =============================================================================
32
+ // Component Props Types
33
+ // =============================================================================
34
+
35
+ /**
36
+ * Props for the Toggle component
37
+ */
38
+ export interface ToggleProps {
39
+ /** Array of toggle options (strings, numbers, or objects) */
40
+ options?: ToggleItem[]
41
+
42
+ /** Field mapping — overrides BASE_FIELDS defaults (text → 'label', value → 'value', …) */
43
+ fields?: Record<string, string>
44
+
45
+ /** Currently selected value (bindable) */
46
+ value?: unknown
47
+
48
+ /** Called when selection changes */
49
+ onchange?: (value: unknown, item: ToggleItem) => void
50
+
51
+ /** Whether to show text labels alongside icons */
52
+ showLabels?: boolean
53
+
54
+ /** Size variant */
55
+ size?: 'sm' | 'md' | 'lg'
56
+
57
+ /** Whether the entire toggle is disabled */
58
+ disabled?: boolean
59
+
60
+ /** Accessible label for the radiogroup. Default: messages.toggle.label */
61
+ label?: string
62
+
63
+ /** Additional CSS classes */
64
+ class?: string
65
+
66
+ /** Custom snippet for rendering toggle options */
67
+ item?: ToggleItemSnippet
68
+ }
@@ -0,0 +1,167 @@
1
+ /**
2
+ * Toolbar Component Types
3
+ *
4
+ * Provides types for the data-driven Toolbar component.
5
+ * Field mapping and data access is handled by ProxyItem from @rokkit/states.
6
+ */
7
+
8
+ // =============================================================================
9
+ // Field Mapping Types
10
+ // =============================================================================
11
+
12
+ /**
13
+ * Field mapping configuration for toolbar data.
14
+ * Maps custom data field names to the component's expected properties.
15
+ */
16
+ export interface ToolbarFields {
17
+ /** Field for display text/tooltip - default: 'text' */
18
+ text?: string
19
+
20
+ /** Field for the value to emit on click - default: 'value' */
21
+ value?: string
22
+
23
+ /** Field for icon class name - default: 'icon' */
24
+ icon?: string
25
+
26
+ /** Field for disabled state - default: 'disabled' */
27
+ disabled?: string
28
+
29
+ /** Field for active/pressed state - default: 'active' */
30
+ active?: string
31
+
32
+ /** Field for item type (button, toggle, separator, spacer, custom) - default: 'type' */
33
+ type?: string
34
+
35
+ /** Field for custom snippet name - default: 'snippet' */
36
+ snippet?: string
37
+
38
+ /** Field for aria-label override - default: 'label' */
39
+ label?: string
40
+
41
+ /** Field for keyboard shortcut display - default: 'shortcut' */
42
+ shortcut?: string
43
+ }
44
+
45
+ /**
46
+ * Default field mapping values
47
+ */
48
+ export const defaultToolbarFields: Required<ToolbarFields> = {
49
+ text: 'text',
50
+ value: 'value',
51
+ icon: 'icon',
52
+ disabled: 'disabled',
53
+ active: 'active',
54
+ type: 'type',
55
+ snippet: 'snippet',
56
+ label: 'label',
57
+ shortcut: 'shortcut'
58
+ }
59
+
60
+ // =============================================================================
61
+ // Toolbar Item Types
62
+ // =============================================================================
63
+
64
+ /**
65
+ * Generic toolbar item - can be any object with mapped fields
66
+ */
67
+ export type ToolbarItem = Record<string, unknown>
68
+
69
+ /**
70
+ * Built-in toolbar item types
71
+ */
72
+ export type ToolbarItemType = 'button' | 'toggle' | 'separator' | 'spacer' | 'custom'
73
+
74
+ // =============================================================================
75
+ // Snippet Types
76
+ // =============================================================================
77
+
78
+ /**
79
+ * Handlers passed to custom item snippets
80
+ */
81
+ export interface ToolbarItemHandlers {
82
+ /** Call to trigger item action */
83
+ onclick: () => void
84
+ /** Forward keyboard events for accessibility */
85
+ onkeydown: (event: KeyboardEvent) => void
86
+ }
87
+
88
+ /**
89
+ * Snippet type for rendering toolbar items
90
+ */
91
+ export type ToolbarItemSnippet = import('svelte').Snippet<
92
+ [ToolbarItem, ToolbarFields, ToolbarItemHandlers]
93
+ >
94
+
95
+ // =============================================================================
96
+ // Component Props Types
97
+ // =============================================================================
98
+
99
+ /**
100
+ * Props for the Toolbar component
101
+ */
102
+ export interface ToolbarProps {
103
+ /** Array of toolbar items */
104
+ items?: ToolbarItem[]
105
+
106
+ /** Field mapping configuration */
107
+ fields?: ToolbarFields
108
+
109
+ /** Position of toolbar - affects border and sticky positioning */
110
+ position?: 'top' | 'bottom' | 'left' | 'right'
111
+
112
+ /** Size variant */
113
+ size?: 'sm' | 'md' | 'lg'
114
+
115
+ /** Width behaviour: full stretches to container, fit sizes to content */
116
+ width?: 'full' | 'fit'
117
+
118
+ /** Whether toolbar should stick to its position */
119
+ sticky?: boolean
120
+
121
+ /** Compact mode with reduced padding */
122
+ compact?: boolean
123
+
124
+ /** Show dividers between sections */
125
+ showDividers?: boolean
126
+
127
+ /** Whether the entire toolbar is disabled */
128
+ disabled?: boolean
129
+
130
+ /** Called when an item is clicked */
131
+ onclick?: (value: unknown, item: ToolbarItem) => void
132
+
133
+ /** Additional CSS classes */
134
+ class?: string
135
+
136
+ /** Custom snippet for rendering toolbar items */
137
+ item?: ToolbarItemSnippet
138
+
139
+ /** Slot for start section content */
140
+ start?: import('svelte').Snippet
141
+
142
+ /** Slot for center section content */
143
+ center?: import('svelte').Snippet
144
+
145
+ /** Slot for end section content */
146
+ end?: import('svelte').Snippet
147
+
148
+ /** Default slot for children */
149
+ children?: import('svelte').Snippet
150
+ }
151
+
152
+ /**
153
+ * Props for the ToolbarGroup component
154
+ */
155
+ export interface ToolbarGroupProps {
156
+ /** Accessibility label for the group */
157
+ label?: string
158
+
159
+ /** Gap between items in the group */
160
+ gap?: 'none' | 'sm' | 'md' | 'lg'
161
+
162
+ /** Additional CSS classes */
163
+ class?: string
164
+
165
+ /** Group content */
166
+ children?: import('svelte').Snippet
167
+ }
@@ -0,0 +1,21 @@
1
+ import type { Snippet } from 'svelte'
2
+
3
+ export interface TooltipProps {
4
+ /** Tooltip text (alternative: use tooltipContent snippet for rich content) */
5
+ content?: string
6
+
7
+ /** Preferred position — auto-flips when the preferred side overflows the viewport */
8
+ position?: 'top' | 'bottom' | 'left' | 'right'
9
+
10
+ /** Show delay in ms (default: 300) */
11
+ delay?: number
12
+
13
+ /** Additional CSS classes on the root wrapper */
14
+ class?: string
15
+
16
+ /** Trigger element(s) */
17
+ children?: Snippet
18
+
19
+ /** Rich tooltip content — overrides the content string */
20
+ tooltipContent?: Snippet
21
+ }
@@ -0,0 +1,250 @@
1
+ /**
2
+ * Tree Component Types
3
+ *
4
+ * Provides types for the data-driven Tree component.
5
+ * Supports hierarchical data with expand/collapse, tree lines, and custom icons.
6
+ * Field mapping and data access is handled by ProxyItem from @rokkit/states.
7
+ */
8
+
9
+ import type { Snippet } from 'svelte'
10
+ import { DEFAULT_STATE_ICONS } from '@rokkit/core'
11
+
12
+ // =============================================================================
13
+ // Field Mapping Types
14
+ // =============================================================================
15
+
16
+ /**
17
+ * Field mapping configuration for tree data.
18
+ * Extends base field mapping with tree-specific fields.
19
+ */
20
+ export interface TreeFields extends Record<string, string> {
21
+ /** Field for expanded state - default: 'expanded' */
22
+ expanded?: string
23
+
24
+ /** Field for node level/depth - default: 'level' */
25
+ level?: string
26
+ }
27
+
28
+ /**
29
+ * Default field mapping values for tree
30
+ */
31
+ export const defaultTreeFields: Required<Omit<TreeFields, 'fields'>> = {
32
+ text: 'text',
33
+ value: 'value',
34
+ icon: 'icon',
35
+ description: 'description',
36
+ shortcut: 'shortcut',
37
+ label: 'label',
38
+ disabled: 'disabled',
39
+ active: 'active',
40
+ type: 'type',
41
+ children: 'children',
42
+ snippet: 'snippet',
43
+ href: 'href',
44
+ badge: 'badge',
45
+ expanded: 'expanded',
46
+ level: 'level'
47
+ }
48
+
49
+ // =============================================================================
50
+ // Tree Item Types
51
+ // =============================================================================
52
+
53
+ /**
54
+ * Generic tree item - can be any object with mapped fields
55
+ */
56
+ export type TreeItem = Record<string, unknown>
57
+
58
+ // =============================================================================
59
+ // Tree Line/Connector Types
60
+ // =============================================================================
61
+
62
+ /**
63
+ * Types of tree line connectors
64
+ */
65
+ export type TreeLineType = 'child' | 'last' | 'sibling' | 'empty' | 'icon'
66
+
67
+ /**
68
+ * Connector types (without 'icon' which is handled separately)
69
+ */
70
+ export type ConnectorType = 'child' | 'last' | 'sibling' | 'empty'
71
+
72
+ /**
73
+ * Icons configuration for tree expand/collapse states.
74
+ * Keys match the naming convention in @rokkit/core DEFAULT_STATE_ICONS.
75
+ */
76
+ export interface TreeStateIcons {
77
+ /** Icon class for expanded/opened state */
78
+ opened?: string
79
+ /** Icon class for collapsed/closed state */
80
+ closed?: string
81
+ }
82
+
83
+ /**
84
+ * Default state icons — uses semantic names from @rokkit/core
85
+ * that get resolved to actual icon classes via UnoCSS shortcuts.
86
+ */
87
+ export const defaultTreeStateIcons: TreeStateIcons = {
88
+ opened: DEFAULT_STATE_ICONS.node.opened,
89
+ closed: DEFAULT_STATE_ICONS.node.closed
90
+ }
91
+
92
+ // =============================================================================
93
+ // Snippet Types
94
+ // =============================================================================
95
+
96
+ /**
97
+ * Handlers passed to custom item snippets
98
+ */
99
+ export interface TreeItemHandlers {
100
+ /** Call to trigger item selection */
101
+ onclick: () => void
102
+ /** Call to toggle expand/collapse */
103
+ ontoggle: () => void
104
+ /** Forward keyboard events for accessibility */
105
+ onkeydown: (event: KeyboardEvent) => void
106
+ }
107
+
108
+ /**
109
+ * Snippet type for rendering tree nodes.
110
+ * Parameters: item, fields, handlers, isActive, isExpanded, level
111
+ */
112
+ export type TreeItemSnippet = Snippet<
113
+ [TreeItem, TreeFields, TreeItemHandlers, boolean, boolean, number]
114
+ >
115
+
116
+ /**
117
+ * Snippet type for rendering the expand/collapse icon
118
+ * Parameters: isExpanded, hasChildren, icons
119
+ */
120
+ export type TreeToggleSnippet = Snippet<[boolean, boolean, TreeStateIcons]>
121
+
122
+ /**
123
+ * Snippet type for rendering tree line connectors
124
+ * Parameters: lineType
125
+ */
126
+ export type TreeConnectorSnippet = Snippet<[TreeLineType]>
127
+
128
+ // =============================================================================
129
+ // Component Props Types
130
+ // =============================================================================
131
+
132
+ /**
133
+ * Props for the Tree component
134
+ */
135
+ export interface TreeProps {
136
+ /** Array of tree items (hierarchical) */
137
+ items?: TreeItem[]
138
+
139
+ /** Field mapping configuration */
140
+ fields?: TreeFields
141
+
142
+ /** Currently selected value */
143
+ value?: unknown
144
+
145
+ /** Size variant */
146
+ size?: 'sm' | 'md' | 'lg'
147
+
148
+ /** Tree line connector style — 'none' hides lines, 'solid'|'dashed'|'dotted' set the line style */
149
+ lineStyle?: 'none' | 'solid' | 'dashed' | 'dotted'
150
+
151
+ /** Enable multiple item selection (Ctrl+click toggle, Shift+click range) */
152
+ multiselect?: boolean
153
+
154
+ /** Which nodes are expanded (bindable) - keyed by node value */
155
+ expanded?: Record<string, boolean>
156
+
157
+ /** Selected items array (bindable) - populated in multiselect mode */
158
+ selected?: unknown[]
159
+
160
+ /** Expand all nodes by default */
161
+ expandAll?: boolean
162
+
163
+ /** Active item value - Tree looks up item by this value to highlight it */
164
+ active?: unknown
165
+
166
+ /** Icons for expand/collapse states */
167
+ icons?: TreeStateIcons
168
+
169
+ /** Called when an item is selected */
170
+ onselect?: (value: unknown, item: TreeItem) => void
171
+
172
+ /** Called when selected items change in multiselect mode */
173
+ onselectedchange?: (selected: unknown[]) => void
174
+
175
+ /** Called when expanded state changes */
176
+ onexpandedchange?: (expanded: Record<string, boolean>) => void
177
+
178
+ /** Called when a node is toggled */
179
+ ontoggle?: (value: unknown, item: TreeItem, isExpanded: boolean) => void
180
+
181
+ /** Called when expanding a node with unloaded children (children: true). Returns the children array. */
182
+ onloadchildren?: (value: unknown, item: TreeItem) => Promise<TreeItem[]>
183
+
184
+ /** Additional CSS classes */
185
+ class?: string
186
+
187
+ /** Custom snippet for rendering tree items */
188
+ item?: TreeItemSnippet
189
+
190
+ /** Custom snippet for rendering expand/collapse toggle */
191
+ toggle?: TreeToggleSnippet
192
+
193
+ /** Custom snippet for rendering tree line connectors */
194
+ connector?: TreeConnectorSnippet
195
+ }
196
+
197
+ // =============================================================================
198
+ // Helper Functions
199
+ // =============================================================================
200
+
201
+ /**
202
+ * Mapping for calculating next line type based on parent type
203
+ * Based on @rokkit/core connector implementation
204
+ */
205
+ const nextLineType: Record<TreeLineType, TreeLineType> = {
206
+ child: 'sibling',
207
+ last: 'empty',
208
+ sibling: 'sibling',
209
+ empty: 'empty',
210
+ icon: 'empty'
211
+ }
212
+
213
+ /**
214
+ * Constructs an array of line types for tree visualization.
215
+ * This determines what connectors to show at each depth level.
216
+ *
217
+ * Algorithm from @rokkit/core getLineTypes:
218
+ * - For all but the last parent type, convert to continuation type
219
+ * - For the last parent type, use the current node's position
220
+ * - Append 'icon' for nodes with children, 'empty' for leaf nodes
221
+ *
222
+ * @param hasChildren - Whether the node has children
223
+ * @param parentTypes - Line types from parent nodes
224
+ * @param position - Current position type ('child' or 'last')
225
+ * @returns Array of line types for rendering connectors
226
+ */
227
+ export function getLineTypes(
228
+ hasChildren: boolean = false,
229
+ parentTypes: TreeLineType[] = [],
230
+ position: 'child' | 'last' = 'child'
231
+ ): TreeLineType[] {
232
+ const result = parentTypes.reduce<TreeLineType[]>((acc, type, index) => {
233
+ // For all but the last parent type, convert to next type
234
+ // 'child' -> 'sibling' (vertical line continues)
235
+ // 'last' -> 'empty' (no line, branch ended)
236
+ if (index < parentTypes.length - 1) {
237
+ return [...acc, nextLineType[type]]
238
+ }
239
+ // For the last parent type, use the current node's position
240
+ return [...acc, position]
241
+ }, [])
242
+
243
+ // Append icon slot for expandable nodes, empty for leaf nodes
244
+ return result.concat(hasChildren ? 'icon' : 'empty')
245
+ }
246
+
247
+ // Keep old name as alias for backward compatibility
248
+ export const getTreeLineTypes = getLineTypes
249
+
250
+ export { getSnippet } from './menu.js'
@@ -0,0 +1,45 @@
1
+ /**
2
+ * UploadFileStatus Component Types
3
+ *
4
+ * Renders a single file's upload status with progress bar, action buttons
5
+ * (cancel/retry/remove), and file metadata (icon, name, size, status label).
6
+ * Action button visibility driven by cancelWhen/retryWhen/removeWhen arrays.
7
+ */
8
+
9
+ import type { ProxyItem } from '@rokkit/states'
10
+
11
+ // =============================================================================
12
+ // Component Props
13
+ // =============================================================================
14
+
15
+ /**
16
+ * Props for the UploadFileStatus component
17
+ */
18
+ export interface UploadFileStatusProps {
19
+ /** ProxyItem wrapping the file data */
20
+ proxy: ProxyItem
21
+
22
+ /** Status values that show the cancel button */
23
+ cancelWhen?: string[]
24
+
25
+ /** Status values that show the retry button */
26
+ retryWhen?: string[]
27
+
28
+ /** Status values that show the remove button */
29
+ removeWhen?: string[]
30
+
31
+ /** Called when cancel is clicked */
32
+ oncancel?: (proxy: ProxyItem) => void
33
+
34
+ /** Called when retry is clicked */
35
+ onretry?: (proxy: ProxyItem) => void
36
+
37
+ /** Called when remove is clicked */
38
+ onremove?: (proxy: ProxyItem) => void
39
+
40
+ /** Label overrides merged with messages.uploadProgress */
41
+ labels?: Record<string, string>
42
+
43
+ /** Icon class overrides for action buttons (cancel, retry, remove) */
44
+ icons?: Record<string, string>
45
+ }
@@ -0,0 +1,111 @@
1
+ /**
2
+ * UploadProgress Component Types
3
+ *
4
+ * File upload status orchestrator. Thin composition layer that renders
5
+ * a header + List or Grid layout. Default itemContent snippet renders
6
+ * UploadFileStatus for each file. Consumer can override with custom snippet.
7
+ */
8
+
9
+ import type { Snippet } from 'svelte'
10
+ import type { ProxyItem } from '@rokkit/states'
11
+
12
+ // =============================================================================
13
+ // Item Types
14
+ // =============================================================================
15
+
16
+ /**
17
+ * Generic upload file item — any object with mapped fields
18
+ */
19
+ export type UploadItem = Record<string, unknown>
20
+
21
+ // =============================================================================
22
+ // Field Mapping Types
23
+ // =============================================================================
24
+
25
+ /**
26
+ * Field mapping for upload file data.
27
+ * Maps semantic field names to keys in the data objects.
28
+ */
29
+ export interface UploadFields {
30
+ /** Field for display text - default: 'text' */
31
+ label?: string
32
+
33
+ /** Field for unique value - default: 'value' */
34
+ value?: string
35
+
36
+ /** Field for icon class - default: 'icon' */
37
+ icon?: string
38
+
39
+ /** Field for upload status key - default: 'status' */
40
+ status?: string
41
+
42
+ /** Field for progress percentage (0-100) - default: 'progress' */
43
+ progress?: string
44
+
45
+ /** Field for file size in bytes - default: 'size' */
46
+ size?: string
47
+
48
+ /** Field for MIME type - default: 'type' */
49
+ type?: string
50
+
51
+ /** Field for error message - default: 'error' */
52
+ error?: string
53
+ }
54
+
55
+ // =============================================================================
56
+ // Snippet Types
57
+ // =============================================================================
58
+
59
+ /**
60
+ * Snippet for custom per-file rendering inside List/Grid.
61
+ * Receives the ProxyItem wrapping the file data.
62
+ */
63
+ export type UploadItemSnippet = Snippet<[proxy: ProxyItem]>
64
+
65
+ // =============================================================================
66
+ // Component Props
67
+ // =============================================================================
68
+
69
+ /**
70
+ * Props for the UploadProgress component
71
+ */
72
+ export interface UploadProgressProps {
73
+ /** Array of file data objects */
74
+ files?: UploadItem[]
75
+
76
+ /** Field mapping configuration */
77
+ fields?: UploadFields
78
+
79
+ /** Layout mode */
80
+ view?: 'list' | 'grid'
81
+
82
+ /** Status values that show the cancel button */
83
+ cancelWhen?: string[]
84
+
85
+ /** Status values that show the retry button */
86
+ retryWhen?: string[]
87
+
88
+ /** Status values that show the remove button */
89
+ removeWhen?: string[]
90
+
91
+ /** Called when cancel is clicked (receives raw file object) */
92
+ oncancel?: (file: UploadItem) => void
93
+
94
+ /** Called when retry is clicked (receives raw file object) */
95
+ onretry?: (file: UploadItem) => void
96
+
97
+ /** Called when remove is clicked (receives raw file object) */
98
+ onremove?: (file: UploadItem) => void
99
+
100
+ /** Called when clear all is clicked */
101
+ onclear?: () => void
102
+
103
+ /** Label overrides merged with messages.uploadProgress */
104
+ labels?: Record<string, string>
105
+
106
+ /** Additional CSS classes */
107
+ class?: string
108
+
109
+ /** Custom snippet for per-file rendering (overrides default UploadFileStatus) */
110
+ itemContent?: UploadItemSnippet
111
+ }