@rokkit/ui 1.0.0-next.124 → 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,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Button Component Types
|
|
3
|
+
*
|
|
4
|
+
* Provides types for the Button and ButtonGroup components.
|
|
5
|
+
* Supports variants, styles, sizes, loading state, link buttons, and custom content.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Snippet } from 'svelte'
|
|
9
|
+
|
|
10
|
+
// =============================================================================
|
|
11
|
+
// Variant & Style Types
|
|
12
|
+
// =============================================================================
|
|
13
|
+
|
|
14
|
+
/** Semantic color variant */
|
|
15
|
+
export type ButtonVariant = 'default' | 'primary' | 'secondary' | 'danger'
|
|
16
|
+
|
|
17
|
+
/** Visual style treatment */
|
|
18
|
+
export type ButtonStyle = 'default' | 'outline' | 'ghost' | 'gradient' | 'link'
|
|
19
|
+
|
|
20
|
+
// =============================================================================
|
|
21
|
+
// Component Props Types
|
|
22
|
+
// =============================================================================
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Props for the Button component
|
|
26
|
+
*/
|
|
27
|
+
export interface ButtonProps {
|
|
28
|
+
/** Semantic color variant */
|
|
29
|
+
variant?: ButtonVariant
|
|
30
|
+
|
|
31
|
+
/** Visual style treatment */
|
|
32
|
+
style?: ButtonStyle
|
|
33
|
+
|
|
34
|
+
/** Size variant */
|
|
35
|
+
size?: 'sm' | 'md' | 'lg'
|
|
36
|
+
|
|
37
|
+
/** HTML button type */
|
|
38
|
+
type?: 'button' | 'submit' | 'reset'
|
|
39
|
+
|
|
40
|
+
/** Button label text */
|
|
41
|
+
label?: string
|
|
42
|
+
|
|
43
|
+
/** Leading icon class */
|
|
44
|
+
icon?: string
|
|
45
|
+
|
|
46
|
+
/** Trailing icon class */
|
|
47
|
+
iconRight?: string
|
|
48
|
+
|
|
49
|
+
/** Navigates as link instead of button */
|
|
50
|
+
href?: string
|
|
51
|
+
|
|
52
|
+
/** Link target (when href is set) */
|
|
53
|
+
target?: string
|
|
54
|
+
|
|
55
|
+
/** Disabled state */
|
|
56
|
+
disabled?: boolean
|
|
57
|
+
|
|
58
|
+
/** Loading state — shows spinner, disables interaction */
|
|
59
|
+
loading?: boolean
|
|
60
|
+
|
|
61
|
+
/** Additional CSS classes */
|
|
62
|
+
class?: string
|
|
63
|
+
|
|
64
|
+
/** Click handler */
|
|
65
|
+
onclick?: (event: MouseEvent) => void
|
|
66
|
+
|
|
67
|
+
/** Custom content snippet */
|
|
68
|
+
children?: Snippet
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Props for the ButtonGroup component
|
|
73
|
+
*/
|
|
74
|
+
export interface ButtonGroupProps {
|
|
75
|
+
/** Size applied to all buttons in the group */
|
|
76
|
+
size?: 'sm' | 'md' | 'lg'
|
|
77
|
+
|
|
78
|
+
/** Additional CSS classes */
|
|
79
|
+
class?: string
|
|
80
|
+
|
|
81
|
+
/** Content snippet (buttons) */
|
|
82
|
+
children?: Snippet
|
|
83
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code component types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { defaultStateIcons } from '@rokkit/core'
|
|
6
|
+
|
|
7
|
+
/** Supported themes for code highlighting */
|
|
8
|
+
export type CodeTheme = 'light' | 'dark'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Icons configuration for code action states.
|
|
12
|
+
* Keys match the naming convention in @rokkit/core defaultStateIcons.
|
|
13
|
+
*/
|
|
14
|
+
export interface CodeStateIcons {
|
|
15
|
+
/** Icon class for copy button */
|
|
16
|
+
copy?: string
|
|
17
|
+
/** Icon class for copy success state */
|
|
18
|
+
copysuccess?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Default state icons — uses semantic names from @rokkit/core
|
|
23
|
+
* that get resolved to actual icon classes via UnoCSS shortcuts.
|
|
24
|
+
*/
|
|
25
|
+
export const defaultCodeStateIcons: CodeStateIcons = {
|
|
26
|
+
copy: defaultStateIcons.action.copy,
|
|
27
|
+
copysuccess: defaultStateIcons.action.copysuccess
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Props for the Code component */
|
|
31
|
+
export interface CodeProps {
|
|
32
|
+
/** The code string to display and highlight */
|
|
33
|
+
code: string
|
|
34
|
+
/** Programming language for syntax highlighting */
|
|
35
|
+
language?: string
|
|
36
|
+
/** Color theme for the code block */
|
|
37
|
+
theme?: CodeTheme
|
|
38
|
+
/** Whether to show line numbers */
|
|
39
|
+
showLineNumbers?: boolean
|
|
40
|
+
/** Whether to show the copy button */
|
|
41
|
+
showCopyButton?: boolean
|
|
42
|
+
/** Icons for copy action states */
|
|
43
|
+
icons?: CodeStateIcons
|
|
44
|
+
/** Additional CSS class */
|
|
45
|
+
class?: string
|
|
46
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
import type { ItemFields } from './item-proxy.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Field mapping for FloatingAction items
|
|
6
|
+
*/
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
8
|
+
export interface FloatingActionFields extends ItemFields {}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Default field mappings
|
|
12
|
+
*/
|
|
13
|
+
export const defaultFloatingActionFields: Required<
|
|
14
|
+
Pick<FloatingActionFields, 'text' | 'value' | 'icon' | 'label' | 'disabled'>
|
|
15
|
+
> = {
|
|
16
|
+
text: 'text',
|
|
17
|
+
value: 'value',
|
|
18
|
+
icon: 'icon',
|
|
19
|
+
label: 'label',
|
|
20
|
+
disabled: 'disabled'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A single action item
|
|
25
|
+
*/
|
|
26
|
+
export type FloatingActionItem = Record<string, unknown>
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Event handlers passed to custom snippets
|
|
30
|
+
*/
|
|
31
|
+
export interface FloatingActionItemHandlers {
|
|
32
|
+
onclick: () => void
|
|
33
|
+
onkeydown: (event: KeyboardEvent) => void
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Custom snippet for rendering an action item
|
|
38
|
+
*/
|
|
39
|
+
export type FloatingActionItemSnippet = Snippet<
|
|
40
|
+
[item: FloatingActionItem, fields: FloatingActionFields, handlers: FloatingActionItemHandlers]
|
|
41
|
+
>
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Position options for the FAB
|
|
45
|
+
*/
|
|
46
|
+
export type FloatingActionPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Expansion direction for action items
|
|
50
|
+
*/
|
|
51
|
+
export type FloatingActionExpand = 'radial' | 'vertical' | 'horizontal'
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Alignment for action items in the menu
|
|
55
|
+
*/
|
|
56
|
+
export type FloatingActionItemAlign = 'start' | 'center' | 'end'
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Props for the FloatingAction component
|
|
60
|
+
*/
|
|
61
|
+
export interface FloatingActionProps {
|
|
62
|
+
/** Array of action items */
|
|
63
|
+
items?: FloatingActionItem[]
|
|
64
|
+
|
|
65
|
+
/** Field mapping configuration */
|
|
66
|
+
fields?: FloatingActionFields
|
|
67
|
+
|
|
68
|
+
/** Icon for the main trigger button */
|
|
69
|
+
icon?: string
|
|
70
|
+
|
|
71
|
+
/** Icon shown when menu is open (defaults to close icon) */
|
|
72
|
+
closeIcon?: string
|
|
73
|
+
|
|
74
|
+
/** Accessible label for the trigger */
|
|
75
|
+
label?: string
|
|
76
|
+
|
|
77
|
+
/** Size variant */
|
|
78
|
+
size?: 'sm' | 'md' | 'lg'
|
|
79
|
+
|
|
80
|
+
/** Position on screen */
|
|
81
|
+
position?: FloatingActionPosition
|
|
82
|
+
|
|
83
|
+
/** How items expand when opened */
|
|
84
|
+
expand?: FloatingActionExpand
|
|
85
|
+
|
|
86
|
+
/** Alignment of items in the menu (start/center/end) */
|
|
87
|
+
itemAlign?: FloatingActionItemAlign
|
|
88
|
+
|
|
89
|
+
/** Disable the FAB */
|
|
90
|
+
disabled?: boolean
|
|
91
|
+
|
|
92
|
+
/** Whether the menu is open (bindable) */
|
|
93
|
+
open?: boolean
|
|
94
|
+
|
|
95
|
+
/** Show backdrop overlay when open */
|
|
96
|
+
backdrop?: boolean
|
|
97
|
+
|
|
98
|
+
/** Position relative to nearest positioned ancestor instead of viewport */
|
|
99
|
+
contained?: boolean
|
|
100
|
+
|
|
101
|
+
/** Called when an action is selected */
|
|
102
|
+
onselect?: (value: unknown, item: FloatingActionItem) => void
|
|
103
|
+
|
|
104
|
+
/** Called when menu opens */
|
|
105
|
+
onopen?: () => void
|
|
106
|
+
|
|
107
|
+
/** Called when menu closes */
|
|
108
|
+
onclose?: () => void
|
|
109
|
+
|
|
110
|
+
/** Additional CSS classes */
|
|
111
|
+
class?: string
|
|
112
|
+
|
|
113
|
+
/** Custom snippet for rendering action items */
|
|
114
|
+
item?: FloatingActionItemSnippet
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Re-export getSnippet for convenience
|
|
118
|
+
export { getSnippet } from './menu.js'
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte'
|
|
2
|
+
import type { ItemFields } from './item-proxy.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Position on the screen edge
|
|
6
|
+
*/
|
|
7
|
+
export type FloatingNavigationPosition = 'left' | 'right' | 'top' | 'bottom'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Size variant
|
|
11
|
+
*/
|
|
12
|
+
export type FloatingNavigationSize = 'sm' | 'md' | 'lg'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A single navigation item
|
|
16
|
+
*/
|
|
17
|
+
export type FloatingNavigationItem = Record<string, unknown>
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Custom snippet for rendering a navigation item
|
|
21
|
+
*/
|
|
22
|
+
export type FloatingNavigationItemSnippet = Snippet<
|
|
23
|
+
[item: FloatingNavigationItem, proxy: { text: string; icon: string; active: boolean }]
|
|
24
|
+
>
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Props for the FloatingNavigation component
|
|
28
|
+
*/
|
|
29
|
+
export interface FloatingNavigationProps {
|
|
30
|
+
/** Navigation items (data-driven) */
|
|
31
|
+
items?: FloatingNavigationItem[]
|
|
32
|
+
|
|
33
|
+
/** Field mapping configuration */
|
|
34
|
+
fields?: Partial<ItemFields>
|
|
35
|
+
|
|
36
|
+
/** Active item value (bindable) */
|
|
37
|
+
value?: unknown
|
|
38
|
+
|
|
39
|
+
/** Screen edge to anchor to */
|
|
40
|
+
position?: FloatingNavigationPosition
|
|
41
|
+
|
|
42
|
+
/** Whether nav is pinned open (bindable) */
|
|
43
|
+
pinned?: boolean
|
|
44
|
+
|
|
45
|
+
/** Auto-track active section via IntersectionObserver */
|
|
46
|
+
observe?: boolean
|
|
47
|
+
|
|
48
|
+
/** IntersectionObserver config */
|
|
49
|
+
observerOptions?: IntersectionObserverInit
|
|
50
|
+
|
|
51
|
+
/** Size variant */
|
|
52
|
+
size?: FloatingNavigationSize
|
|
53
|
+
|
|
54
|
+
/** Accessible label */
|
|
55
|
+
label?: string
|
|
56
|
+
|
|
57
|
+
/** Called when an item is selected */
|
|
58
|
+
onselect?: (value: unknown, item: FloatingNavigationItem) => void
|
|
59
|
+
|
|
60
|
+
/** Called when pin state changes */
|
|
61
|
+
onpinchange?: (pinned: boolean) => void
|
|
62
|
+
|
|
63
|
+
/** Custom snippet for rendering items */
|
|
64
|
+
item?: FloatingNavigationItemSnippet
|
|
65
|
+
|
|
66
|
+
/** Additional CSS classes */
|
|
67
|
+
class?: string
|
|
68
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Button Types
|
|
2
|
+
export * from './button.js'
|
|
3
|
+
|
|
4
|
+
// Code Types
|
|
5
|
+
export * from './code.js'
|
|
6
|
+
|
|
7
|
+
// Menu Types
|
|
8
|
+
export * from './menu.js'
|
|
9
|
+
|
|
10
|
+
// Select Types
|
|
11
|
+
export * from './select.js'
|
|
12
|
+
|
|
13
|
+
// Toolbar Types
|
|
14
|
+
export * from './toolbar.js'
|
|
15
|
+
|
|
16
|
+
// Tabs Types
|
|
17
|
+
export * from './tabs.js'
|
|
18
|
+
|
|
19
|
+
// Toggle Types
|
|
20
|
+
export * from './toggle.js'
|
|
21
|
+
|
|
22
|
+
// Switch Types
|
|
23
|
+
export * from './switch.js'
|
|
24
|
+
|
|
25
|
+
// List Types
|
|
26
|
+
export * from './list.js'
|
|
27
|
+
|
|
28
|
+
// Tree Types
|
|
29
|
+
export * from './tree.js'
|
|
30
|
+
|
|
31
|
+
// Item Proxy
|
|
32
|
+
export * from './item-proxy.js'
|
|
33
|
+
|
|
34
|
+
// Floating Action Types
|
|
35
|
+
export * from './floating-action.js'
|
|
36
|
+
|
|
37
|
+
// Palette Types
|
|
38
|
+
export * from './palette.js'
|
|
39
|
+
|
|
40
|
+
// Table Types
|
|
41
|
+
export * from './table.js'
|
|
42
|
+
|
|
43
|
+
// SearchFilter Types
|
|
44
|
+
export * from './search-filter.js'
|
|
45
|
+
|
|
46
|
+
// Range Types
|
|
47
|
+
export * from './range.js'
|
|
48
|
+
|
|
49
|
+
// Timeline Types
|
|
50
|
+
export * from './timeline.js'
|
|
51
|
+
|
|
52
|
+
// FloatingNavigation Types
|
|
53
|
+
export * from './floating-navigation.js'
|