@rokkit/ui 1.0.0-next.125 → 1.0.0-next.127
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 +198 -101
- package/package.json +52 -34
- package/src/components/BreadCrumbs.svelte +82 -0
- package/src/components/Button.svelte +87 -0
- package/src/components/ButtonGroup.svelte +18 -0
- package/src/components/Card.svelte +61 -0
- package/src/components/Carousel.svelte +169 -0
- package/src/components/Code.svelte +185 -0
- package/src/components/Connector.svelte +46 -0
- package/src/components/FloatingAction.svelte +331 -0
- package/src/components/FloatingNavigation.svelte +228 -0
- package/src/components/ItemContent.svelte +24 -0
- package/src/components/List.svelte +476 -0
- package/src/components/Menu.svelte +421 -0
- package/src/components/MultiSelect.svelte +521 -0
- package/src/components/PaletteManager.svelte +354 -0
- package/src/components/Pill.svelte +78 -0
- package/src/components/ProgressBar.svelte +31 -0
- package/src/components/Range.svelte +325 -0
- package/src/components/Rating.svelte +91 -0
- package/src/components/Reveal.svelte +58 -0
- package/src/components/SearchFilter.svelte +80 -0
- package/src/components/Select.svelte +585 -0
- package/src/{Shine.svelte → components/Shine.svelte} +29 -21
- package/src/components/Stepper.svelte +169 -0
- package/src/components/Switch.svelte +75 -0
- package/src/components/Table.svelte +243 -0
- package/src/components/Tabs.svelte +268 -0
- package/src/components/Tilt.svelte +68 -0
- package/src/components/Timeline.svelte +61 -0
- package/src/components/Toggle.svelte +157 -0
- package/src/components/Toolbar.svelte +307 -0
- package/src/components/ToolbarGroup.svelte +17 -0
- package/src/components/Tree.svelte +613 -0
- package/src/components/index.ts +33 -0
- package/src/index.ts +41 -0
- package/src/types/button.ts +83 -0
- package/src/types/code.ts +46 -0
- package/src/types/floating-action.ts +118 -0
- package/src/types/floating-navigation.ts +68 -0
- package/src/types/index.ts +53 -0
- package/src/types/item-proxy.ts +358 -0
- package/src/types/list.ts +196 -0
- package/src/types/menu.ts +195 -0
- package/src/types/palette.ts +143 -0
- package/src/types/range.ts +51 -0
- package/src/types/search-filter.ts +67 -0
- package/src/types/select.ts +206 -0
- package/src/types/switch.ts +64 -0
- package/src/types/table.ts +210 -0
- package/src/types/tabs.ts +124 -0
- package/src/types/timeline.ts +51 -0
- package/src/types/toggle.ts +109 -0
- package/src/types/toolbar.ts +164 -0
- package/src/types/tree.ts +259 -0
- package/src/utils/palette.ts +582 -0
- package/src/utils/shiki.ts +122 -0
- package/dist/constants.d.ts +0 -2
- package/dist/index.d.ts +0 -41
- package/dist/lib/fields.d.ts +0 -16
- package/dist/lib/form.d.ts +0 -95
- package/dist/lib/index.d.ts +0 -6
- package/dist/lib/layout.d.ts +0 -7
- package/dist/lib/nested.d.ts +0 -48
- package/dist/lib/schema.d.ts +0 -7
- package/dist/lib/select.d.ts +0 -8
- package/dist/lib/tree.d.ts +0 -9
- package/dist/tree/List.spec.svelte.d.ts +0 -1
- package/dist/tree/Node.spec.svelte.d.ts +0 -1
- package/dist/tree/Root.spec.svelte.d.ts +0 -1
- package/dist/types.d.ts +0 -5
- package/dist/wrappers/index.d.ts +0 -3
- package/src/Accordion.svelte +0 -118
- package/src/BreadCrumbs.svelte +0 -32
- package/src/Button.svelte +0 -57
- package/src/Calendar.svelte +0 -93
- package/src/Card.svelte +0 -45
- package/src/Carousel.svelte +0 -49
- package/src/CheckBox.svelte +0 -56
- package/src/Connector.svelte +0 -40
- package/src/DropDown.svelte +0 -68
- package/src/DropSearch.svelte +0 -37
- package/src/Fillable.svelte +0 -19
- package/src/GraphPaper.svelte +0 -43
- package/src/Icon.svelte +0 -81
- package/src/Item.svelte +0 -25
- package/src/Link.svelte +0 -21
- package/src/List.svelte +0 -89
- package/src/ListBody.svelte +0 -43
- package/src/Message.svelte +0 -11
- package/src/MultiSelect.svelte +0 -48
- package/src/NestedList.svelte +0 -78
- package/src/NestedPaginator.svelte +0 -63
- package/src/Node.svelte +0 -76
- package/src/Overlay.svelte +0 -21
- package/src/PageNavigator.svelte +0 -94
- package/src/PickOne.svelte +0 -60
- package/src/Pill.svelte +0 -41
- package/src/ProgressBar.svelte +0 -21
- package/src/ProgressDots.svelte +0 -53
- package/src/RadioGroup.svelte +0 -52
- package/src/Range.svelte +0 -45
- package/src/RangeMinMax.svelte +0 -124
- package/src/RangeSlider.svelte +0 -79
- package/src/RangeTick.svelte +0 -28
- package/src/Rating.svelte +0 -95
- package/src/ResponsiveGrid.svelte +0 -88
- package/src/Scrollable.svelte +0 -7
- package/src/Select.svelte +0 -114
- package/src/Separator.svelte +0 -1
- package/src/Slider.svelte +0 -14
- package/src/SlidingColumns.svelte +0 -50
- package/src/Stage.svelte +0 -41
- package/src/Stepper.svelte +0 -66
- package/src/Summary.svelte +0 -22
- package/src/Switch.svelte +0 -106
- package/src/TableCell.svelte +0 -51
- package/src/TableHeaderCell.svelte +0 -54
- package/src/Tabs.svelte +0 -176
- package/src/Tilt.svelte +0 -66
- package/src/Toggle.svelte +0 -58
- package/src/ToggleThemeMode.svelte +0 -23
- package/src/Tree.svelte +0 -80
- package/src/TreeTable.svelte +0 -171
- package/src/ValidationReport.svelte +0 -23
- package/src/constants.js +0 -4
- package/src/index.js +0 -48
- package/src/lib/fields.js +0 -118
- package/src/lib/form.js +0 -72
- package/src/lib/index.js +0 -13
- package/src/lib/layout.js +0 -63
- package/src/lib/nested.js +0 -192
- package/src/lib/schema.js +0 -32
- package/src/lib/select.js +0 -38
- package/src/lib/tree.js +0 -22
- package/src/tree/List.spec.svelte.js +0 -84
- package/src/tree/List.svelte +0 -78
- package/src/tree/Node.spec.svelte.js +0 -104
- package/src/tree/Node.svelte +0 -80
- package/src/tree/Root.spec.svelte.js +0 -63
- package/src/tree/Root.svelte +0 -81
- package/src/types.js +0 -9
- package/src/wrappers/Category.svelte +0 -27
- package/src/wrappers/Section.svelte +0 -16
- package/src/wrappers/Wrapper.svelte +0 -12
- package/src/wrappers/index.js +0 -3
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Switch Component Types
|
|
3
|
+
*
|
|
4
|
+
* Provides types for the iOS-style Switch component.
|
|
5
|
+
* Field mapping and data access is handled by ItemProxy.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ItemFields } from './item-proxy.js'
|
|
9
|
+
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Field Mapping Types
|
|
12
|
+
// =============================================================================
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Field mapping configuration for switch option data.
|
|
16
|
+
* Maps custom data field names to the component's expected properties.
|
|
17
|
+
*/
|
|
18
|
+
export type SwitchFields = Pick<ItemFields, 'text' | 'value' | 'icon' | 'disabled' | 'description'>
|
|
19
|
+
|
|
20
|
+
// =============================================================================
|
|
21
|
+
// Switch Item Types
|
|
22
|
+
// =============================================================================
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A switch option — can be any object, primitive, or boolean.
|
|
26
|
+
* Processed through ItemProxy for field resolution.
|
|
27
|
+
*/
|
|
28
|
+
export type SwitchItem = Record<string, unknown> | string | number | boolean
|
|
29
|
+
|
|
30
|
+
// =============================================================================
|
|
31
|
+
// Component Props Types
|
|
32
|
+
// =============================================================================
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Props for the Switch component
|
|
36
|
+
*/
|
|
37
|
+
export interface SwitchProps {
|
|
38
|
+
/**
|
|
39
|
+
* Exactly two options. First = off/unchecked. Second = on/checked.
|
|
40
|
+
* @default [false, true]
|
|
41
|
+
*/
|
|
42
|
+
options?: [SwitchItem, SwitchItem]
|
|
43
|
+
|
|
44
|
+
/** Field mapping configuration */
|
|
45
|
+
fields?: SwitchFields
|
|
46
|
+
|
|
47
|
+
/** Currently selected value */
|
|
48
|
+
value?: unknown
|
|
49
|
+
|
|
50
|
+
/** Called when the switch changes */
|
|
51
|
+
onchange?: (value: unknown, item: SwitchItem) => void
|
|
52
|
+
|
|
53
|
+
/** Whether to show text labels beside the track */
|
|
54
|
+
showLabels?: boolean
|
|
55
|
+
|
|
56
|
+
/** Size variant */
|
|
57
|
+
size?: 'sm' | 'md' | 'lg'
|
|
58
|
+
|
|
59
|
+
/** Whether the switch is disabled */
|
|
60
|
+
disabled?: boolean
|
|
61
|
+
|
|
62
|
+
/** Additional CSS classes */
|
|
63
|
+
class?: string
|
|
64
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table Component Types
|
|
3
|
+
*
|
|
4
|
+
* Provides types for the data-driven Table component.
|
|
5
|
+
* Supports flat tables with sortable columns, row selection, and keyboard navigation.
|
|
6
|
+
* Field mapping and data access is handled by ItemProxy per cell.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { defaultStateIcons } from '@rokkit/core'
|
|
10
|
+
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// Column Types
|
|
13
|
+
// =============================================================================
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Column definition for the Table component.
|
|
17
|
+
* Can be auto-derived from data or provided explicitly.
|
|
18
|
+
*/
|
|
19
|
+
export interface TableColumn {
|
|
20
|
+
/** Data key for this column */
|
|
21
|
+
name: string
|
|
22
|
+
|
|
23
|
+
/** Display header text (defaults to name) */
|
|
24
|
+
label?: string
|
|
25
|
+
|
|
26
|
+
/** Data type (auto-derived: 'string', 'number', etc.) */
|
|
27
|
+
type?: string
|
|
28
|
+
|
|
29
|
+
/** Whether this column is sortable — default: true */
|
|
30
|
+
sortable?: boolean
|
|
31
|
+
|
|
32
|
+
/** Current sort direction */
|
|
33
|
+
sorted?: 'none' | 'ascending' | 'descending'
|
|
34
|
+
|
|
35
|
+
/** CSS width (e.g., '200px', '20%') */
|
|
36
|
+
width?: string
|
|
37
|
+
|
|
38
|
+
/** Text alignment */
|
|
39
|
+
align?: 'left' | 'center' | 'right'
|
|
40
|
+
|
|
41
|
+
/** Field mapping — maps ItemProxy slots to data keys */
|
|
42
|
+
fields?: {
|
|
43
|
+
text?: string
|
|
44
|
+
icon?: string
|
|
45
|
+
badge?: string
|
|
46
|
+
description?: string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Value formatter for display */
|
|
50
|
+
formatter?: (value: unknown, row: Record<string, unknown>) => string
|
|
51
|
+
|
|
52
|
+
/** Icon formatter — transforms icon field value to icon class */
|
|
53
|
+
iconFormatter?: (value: unknown) => string
|
|
54
|
+
|
|
55
|
+
/** Named snippet for custom cell rendering */
|
|
56
|
+
snippet?: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// =============================================================================
|
|
60
|
+
// Sort Types
|
|
61
|
+
// =============================================================================
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Represents the sort state for a single column.
|
|
65
|
+
*/
|
|
66
|
+
export interface SortState {
|
|
67
|
+
/** Column name */
|
|
68
|
+
column: string
|
|
69
|
+
|
|
70
|
+
/** Sort direction */
|
|
71
|
+
direction: 'ascending' | 'descending'
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// =============================================================================
|
|
75
|
+
// Field Mapping Types
|
|
76
|
+
// =============================================================================
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Row-level field mapping configuration.
|
|
80
|
+
*/
|
|
81
|
+
export interface TableFields {
|
|
82
|
+
/** Field for row value used in selection matching — default: 'id' */
|
|
83
|
+
value?: string
|
|
84
|
+
|
|
85
|
+
/** Field for disabled state — default: 'disabled' */
|
|
86
|
+
disabled?: string
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Default row-level field mapping values.
|
|
91
|
+
*/
|
|
92
|
+
export const defaultTableFields: Required<TableFields> = {
|
|
93
|
+
value: 'id',
|
|
94
|
+
disabled: 'disabled'
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// =============================================================================
|
|
98
|
+
// Sort Icons
|
|
99
|
+
// =============================================================================
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Icons for sort state indicators.
|
|
103
|
+
*/
|
|
104
|
+
export interface TableSortIcons {
|
|
105
|
+
/** Icon for unsorted column */
|
|
106
|
+
none?: string
|
|
107
|
+
|
|
108
|
+
/** Icon for ascending sort */
|
|
109
|
+
ascending?: string
|
|
110
|
+
|
|
111
|
+
/** Icon for descending sort */
|
|
112
|
+
descending?: string
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Default sort icons from @rokkit/core state icons.
|
|
117
|
+
*/
|
|
118
|
+
export const defaultTableSortIcons: TableSortIcons = {
|
|
119
|
+
none: defaultStateIcons.sort.none,
|
|
120
|
+
ascending: defaultStateIcons.sort.ascending,
|
|
121
|
+
descending: defaultStateIcons.sort.descending
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// =============================================================================
|
|
125
|
+
// Snippet Types
|
|
126
|
+
// =============================================================================
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Snippet for custom header rendering.
|
|
130
|
+
* Parameters: columns, sortState
|
|
131
|
+
*/
|
|
132
|
+
export type TableHeaderSnippet = import('svelte').Snippet<[TableColumn[], SortState[]]>
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Snippet for custom row rendering.
|
|
136
|
+
* Parameters: row, columns, index, isSelected
|
|
137
|
+
*/
|
|
138
|
+
export type TableRowSnippet = import('svelte').Snippet<
|
|
139
|
+
[Record<string, unknown>, TableColumn[], number, boolean]
|
|
140
|
+
>
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Snippet for custom cell rendering.
|
|
144
|
+
* Parameters: value, column, row
|
|
145
|
+
*/
|
|
146
|
+
export type TableCellSnippet = import('svelte').Snippet<
|
|
147
|
+
[unknown, TableColumn, Record<string, unknown>]
|
|
148
|
+
>
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Snippet for empty state.
|
|
152
|
+
*/
|
|
153
|
+
export type TableEmptySnippet = import('svelte').Snippet<[]>
|
|
154
|
+
|
|
155
|
+
// =============================================================================
|
|
156
|
+
// Component Props
|
|
157
|
+
// =============================================================================
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Props for the Table component.
|
|
161
|
+
*/
|
|
162
|
+
export interface TableProps {
|
|
163
|
+
/** Data array — each object is a row */
|
|
164
|
+
data?: Record<string, unknown>[]
|
|
165
|
+
|
|
166
|
+
/** Column definitions (auto-derived from data if not provided) */
|
|
167
|
+
columns?: TableColumn[]
|
|
168
|
+
|
|
169
|
+
/** Currently selected row value */
|
|
170
|
+
value?: unknown
|
|
171
|
+
|
|
172
|
+
/** Table caption for accessibility */
|
|
173
|
+
caption?: string
|
|
174
|
+
|
|
175
|
+
/** Size variant */
|
|
176
|
+
size?: 'sm' | 'md' | 'lg'
|
|
177
|
+
|
|
178
|
+
/** Enable alternating row colors */
|
|
179
|
+
striped?: boolean
|
|
180
|
+
|
|
181
|
+
/** Whether the entire table is disabled */
|
|
182
|
+
disabled?: boolean
|
|
183
|
+
|
|
184
|
+
/** Row-level field mapping */
|
|
185
|
+
fields?: TableFields
|
|
186
|
+
|
|
187
|
+
/** Called when a row is selected */
|
|
188
|
+
onselect?: (value: unknown, row: Record<string, unknown>) => void
|
|
189
|
+
|
|
190
|
+
/** Called when sort state changes */
|
|
191
|
+
onsort?: (sortState: SortState[]) => void
|
|
192
|
+
|
|
193
|
+
/** Additional CSS classes */
|
|
194
|
+
class?: string
|
|
195
|
+
|
|
196
|
+
/** Sort indicator icons */
|
|
197
|
+
icons?: TableSortIcons
|
|
198
|
+
|
|
199
|
+
/** Custom header snippet */
|
|
200
|
+
header?: TableHeaderSnippet
|
|
201
|
+
|
|
202
|
+
/** Custom row snippet */
|
|
203
|
+
row?: TableRowSnippet
|
|
204
|
+
|
|
205
|
+
/** Custom cell snippet */
|
|
206
|
+
cell?: TableCellSnippet
|
|
207
|
+
|
|
208
|
+
/** Empty state snippet */
|
|
209
|
+
empty?: TableEmptySnippet
|
|
210
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tabs Component Types
|
|
3
|
+
*
|
|
4
|
+
* Provides types for the data-driven Tabs component.
|
|
5
|
+
* Field mapping and data access is handled by ItemProxy.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { ItemFields } from './item-proxy.js'
|
|
9
|
+
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Field Mapping Types
|
|
12
|
+
// =============================================================================
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Field mapping configuration for tabs data.
|
|
16
|
+
* Extends standard item fields with a content field for tab panels.
|
|
17
|
+
*/
|
|
18
|
+
export interface TabsFields extends ItemFields {
|
|
19
|
+
/** Field for tab panel content - default: 'content' */
|
|
20
|
+
content?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// =============================================================================
|
|
24
|
+
// Tabs Item Types
|
|
25
|
+
// =============================================================================
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Generic tab item - can be any object with mapped fields
|
|
29
|
+
*/
|
|
30
|
+
export type TabsItem = Record<string, unknown>
|
|
31
|
+
|
|
32
|
+
// =============================================================================
|
|
33
|
+
// Snippet Types
|
|
34
|
+
// =============================================================================
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Handlers passed to custom tab item snippets
|
|
38
|
+
*/
|
|
39
|
+
export interface TabsItemHandlers {
|
|
40
|
+
/** Call to trigger tab selection */
|
|
41
|
+
onclick: () => void
|
|
42
|
+
/** Forward keyboard events for accessibility */
|
|
43
|
+
onkeydown: (event: KeyboardEvent) => void
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Snippet type for rendering tab triggers (headers).
|
|
48
|
+
*/
|
|
49
|
+
export type TabsItemSnippet = import('svelte').Snippet<
|
|
50
|
+
[TabsItem, TabsFields, TabsItemHandlers, boolean]
|
|
51
|
+
>
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Snippet type for rendering tab panel content.
|
|
55
|
+
*/
|
|
56
|
+
export type TabsPanelSnippet = import('svelte').Snippet<[TabsItem, TabsFields]>
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Snippet type for rendering the empty state.
|
|
60
|
+
*/
|
|
61
|
+
export type TabsEmptySnippet = import('svelte').Snippet<[]>
|
|
62
|
+
|
|
63
|
+
// =============================================================================
|
|
64
|
+
// Component Props Types
|
|
65
|
+
// =============================================================================
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Props for the Tabs component
|
|
69
|
+
*/
|
|
70
|
+
export interface TabsProps {
|
|
71
|
+
/** Array of tab options */
|
|
72
|
+
options?: TabsItem[]
|
|
73
|
+
|
|
74
|
+
/** Field mapping configuration */
|
|
75
|
+
fields?: TabsFields
|
|
76
|
+
|
|
77
|
+
/** Currently selected tab value */
|
|
78
|
+
value?: unknown
|
|
79
|
+
|
|
80
|
+
/** Orientation of the tab list */
|
|
81
|
+
orientation?: 'horizontal' | 'vertical'
|
|
82
|
+
|
|
83
|
+
/** Position of the tab list relative to panels */
|
|
84
|
+
position?: 'before' | 'after'
|
|
85
|
+
|
|
86
|
+
/** Alignment of tabs within the tab list */
|
|
87
|
+
align?: 'start' | 'center' | 'end'
|
|
88
|
+
|
|
89
|
+
/** Accessible name for the tab list */
|
|
90
|
+
name?: string
|
|
91
|
+
|
|
92
|
+
/** Whether tabs can be added/removed */
|
|
93
|
+
editable?: boolean
|
|
94
|
+
|
|
95
|
+
/** Placeholder text when no tab is selected */
|
|
96
|
+
placeholder?: string
|
|
97
|
+
|
|
98
|
+
/** Whether the entire tab component is disabled */
|
|
99
|
+
disabled?: boolean
|
|
100
|
+
|
|
101
|
+
/** Additional CSS classes */
|
|
102
|
+
class?: string
|
|
103
|
+
|
|
104
|
+
/** Called when selection changes */
|
|
105
|
+
onchange?: (value: unknown, item: TabsItem) => void
|
|
106
|
+
|
|
107
|
+
/** Called when a tab is selected */
|
|
108
|
+
onselect?: (value: unknown, item: TabsItem) => void
|
|
109
|
+
|
|
110
|
+
/** Called when a new tab is requested (editable mode) */
|
|
111
|
+
onadd?: () => void
|
|
112
|
+
|
|
113
|
+
/** Called when a tab removal is requested (editable mode) */
|
|
114
|
+
onremove?: (value: unknown) => void
|
|
115
|
+
|
|
116
|
+
/** Custom snippet for rendering tab triggers */
|
|
117
|
+
tabItem?: TabsItemSnippet
|
|
118
|
+
|
|
119
|
+
/** Custom snippet for rendering tab panel content */
|
|
120
|
+
tabPanel?: TabsPanelSnippet
|
|
121
|
+
|
|
122
|
+
/** Custom snippet for rendering the empty state */
|
|
123
|
+
empty?: TabsEmptySnippet
|
|
124
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timeline Component Types
|
|
3
|
+
*
|
|
4
|
+
* View-only vertical steps for instructions, changelogs,
|
|
5
|
+
* or process visualization. No interaction.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Snippet } from 'svelte'
|
|
9
|
+
import type { ItemFields } from './item-proxy.js'
|
|
10
|
+
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// Field Mapping Types
|
|
13
|
+
// =============================================================================
|
|
14
|
+
|
|
15
|
+
export type TimelineFields = Pick<ItemFields, 'text' | 'icon' | 'description'>
|
|
16
|
+
|
|
17
|
+
export const defaultTimelineFields: Required<TimelineFields> = {
|
|
18
|
+
text: 'text',
|
|
19
|
+
icon: 'icon',
|
|
20
|
+
description: 'description'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// =============================================================================
|
|
24
|
+
// Component Props Types
|
|
25
|
+
// =============================================================================
|
|
26
|
+
|
|
27
|
+
export interface TimelineIcons {
|
|
28
|
+
/** Icon class for completed state (default: i-lucide:check) */
|
|
29
|
+
completed?: string
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const defaultTimelineIcons: Required<TimelineIcons> = {
|
|
33
|
+
completed: 'i-lucide:check'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface TimelineProps {
|
|
37
|
+
/** Array of timeline items */
|
|
38
|
+
items?: Record<string, unknown>[]
|
|
39
|
+
|
|
40
|
+
/** Field mapping configuration */
|
|
41
|
+
fields?: TimelineFields
|
|
42
|
+
|
|
43
|
+
/** Custom icons */
|
|
44
|
+
icons?: TimelineIcons
|
|
45
|
+
|
|
46
|
+
/** Additional CSS class */
|
|
47
|
+
class?: string
|
|
48
|
+
|
|
49
|
+
/** Custom content snippet for each item: (item, index) */
|
|
50
|
+
content?: Snippet<[Record<string, unknown>, number]>
|
|
51
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toggle Component Types
|
|
3
|
+
*
|
|
4
|
+
* Provides types for the data-driven Toggle component.
|
|
5
|
+
* Field mapping and data access is handled by ItemProxy.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// Field Mapping Types
|
|
10
|
+
// =============================================================================
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Field mapping configuration for toggle data.
|
|
14
|
+
* Maps custom data field names to the component's expected properties.
|
|
15
|
+
*/
|
|
16
|
+
export interface ToggleFields {
|
|
17
|
+
/** Field for display text - default: 'text' */
|
|
18
|
+
text?: string
|
|
19
|
+
|
|
20
|
+
/** Field for the value to emit on select - 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 tooltip/description text - default: 'description' */
|
|
30
|
+
description?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Default field mapping values
|
|
35
|
+
*/
|
|
36
|
+
export const defaultToggleFields: Required<ToggleFields> = {
|
|
37
|
+
text: 'text',
|
|
38
|
+
value: 'value',
|
|
39
|
+
icon: 'icon',
|
|
40
|
+
disabled: 'disabled',
|
|
41
|
+
description: 'description'
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// =============================================================================
|
|
45
|
+
// Toggle Item Types
|
|
46
|
+
// =============================================================================
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Generic toggle item - can be any object with mapped fields
|
|
50
|
+
*/
|
|
51
|
+
export type ToggleItem = Record<string, unknown>
|
|
52
|
+
|
|
53
|
+
// =============================================================================
|
|
54
|
+
// Snippet Types
|
|
55
|
+
// =============================================================================
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Handlers passed to custom item snippets
|
|
59
|
+
*/
|
|
60
|
+
export interface ToggleItemHandlers {
|
|
61
|
+
/** Call to trigger item selection */
|
|
62
|
+
onclick: () => void
|
|
63
|
+
/** Forward keyboard events for accessibility */
|
|
64
|
+
onkeydown: (event: KeyboardEvent) => void
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Snippet type for rendering toggle items.
|
|
69
|
+
* Fourth parameter is whether the item is currently selected.
|
|
70
|
+
*/
|
|
71
|
+
export type ToggleItemSnippet = import('svelte').Snippet<
|
|
72
|
+
[ToggleItem, ToggleFields, ToggleItemHandlers, boolean]
|
|
73
|
+
>
|
|
74
|
+
|
|
75
|
+
// =============================================================================
|
|
76
|
+
// Component Props Types
|
|
77
|
+
// =============================================================================
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Props for the Toggle component
|
|
81
|
+
*/
|
|
82
|
+
export interface ToggleProps {
|
|
83
|
+
/** Array of toggle options */
|
|
84
|
+
options?: ToggleItem[]
|
|
85
|
+
|
|
86
|
+
/** Field mapping configuration */
|
|
87
|
+
fields?: ToggleFields
|
|
88
|
+
|
|
89
|
+
/** Currently selected value */
|
|
90
|
+
value?: unknown
|
|
91
|
+
|
|
92
|
+
/** Called when selection changes */
|
|
93
|
+
onchange?: (value: unknown, item: ToggleItem) => void
|
|
94
|
+
|
|
95
|
+
/** Whether to show text labels alongside icons */
|
|
96
|
+
showLabels?: boolean
|
|
97
|
+
|
|
98
|
+
/** Size variant */
|
|
99
|
+
size?: 'sm' | 'md' | 'lg'
|
|
100
|
+
|
|
101
|
+
/** Whether the entire toggle is disabled */
|
|
102
|
+
disabled?: boolean
|
|
103
|
+
|
|
104
|
+
/** Additional CSS classes */
|
|
105
|
+
class?: string
|
|
106
|
+
|
|
107
|
+
/** Custom snippet for rendering toggle items */
|
|
108
|
+
item?: ToggleItemSnippet
|
|
109
|
+
}
|