@stacksjs/components 0.2.92 → 0.2.94
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/dist/{Sidebar-yb115a2w.stx → Sidebar-4hn7vw4n.stx} +18 -0
- package/dist/index.js +5 -5
- package/package.json +5 -6
- package/src/components/CodeBlock.stx +0 -54
- package/src/components/Footer.stx +0 -66
- package/src/components/Hero.stx +0 -25
- package/src/components/Installation.stx +0 -37
- package/src/components/index.ts +0 -4
- package/src/composables/index.ts +0 -4
- package/src/composables/useCopyCode.ts +0 -73
- package/src/composables/useDarkMode.ts +0 -100
- package/src/composables/useSEO.ts +0 -230
- package/src/composables/utilities/index.ts +0 -7
- package/src/composables/utilities/useClickOutside.ts +0 -72
- package/src/composables/utilities/useFocusTrap.ts +0 -159
- package/src/composables/utilities/useKeyboard.ts +0 -124
- package/src/composables/utilities/useLocalStorage.ts +0 -132
- package/src/composables/utilities/useMediaQuery.ts +0 -118
- package/src/index.ts +0 -99
- package/src/stx.d.ts +0 -4
- package/src/ui/accordion/Accordion.stx +0 -146
- package/src/ui/accordion/AccordionItem.stx +0 -37
- package/src/ui/accordion/index.ts +0 -47
- package/src/ui/audio/Audio.stx +0 -50
- package/src/ui/audio/README.md +0 -41
- package/src/ui/audio/index.ts +0 -13
- package/src/ui/auth/Login.stx +0 -161
- package/src/ui/auth/README.md +0 -142
- package/src/ui/auth/Signup.stx +0 -159
- package/src/ui/auth/TwoFactorChallenge.stx +0 -111
- package/src/ui/auth/index.ts +0 -32
- package/src/ui/avatar/Avatar.stx +0 -77
- package/src/ui/avatar/index.ts +0 -12
- package/src/ui/badge/Badge.stx +0 -62
- package/src/ui/badge/index.ts +0 -10
- package/src/ui/breadcrumb/Breadcrumb.stx +0 -79
- package/src/ui/breadcrumb/index.ts +0 -15
- package/src/ui/button/Button.stx +0 -74
- package/src/ui/button/README.md +0 -80
- package/src/ui/button/index.ts +0 -85
- package/src/ui/calendar/Calendar.stx +0 -189
- package/src/ui/calendar/README.md +0 -254
- package/src/ui/calendar/index.ts +0 -14
- package/src/ui/card/Card.stx +0 -68
- package/src/ui/card/index.ts +0 -13
- package/src/ui/checkbox/Checkbox.stx +0 -86
- package/src/ui/checkbox/index.ts +0 -16
- package/src/ui/combobox/Combobox.stx +0 -96
- package/src/ui/combobox/ComboboxButton.stx +0 -25
- package/src/ui/combobox/ComboboxInput.stx +0 -32
- package/src/ui/combobox/ComboboxOption.stx +0 -49
- package/src/ui/combobox/ComboboxOptions.stx +0 -16
- package/src/ui/combobox/README.md +0 -150
- package/src/ui/combobox/index.ts +0 -40
- package/src/ui/command-palette/CommandPalette.stx +0 -81
- package/src/ui/command-palette/CommandPaletteItem.stx +0 -27
- package/src/ui/command-palette/README.md +0 -42
- package/src/ui/command-palette/index.ts +0 -15
- package/src/ui/dialog/Dialog.stx +0 -41
- package/src/ui/dialog/DialogBackdrop.stx +0 -9
- package/src/ui/dialog/DialogDescription.stx +0 -11
- package/src/ui/dialog/DialogPanel.stx +0 -16
- package/src/ui/dialog/DialogTitle.stx +0 -11
- package/src/ui/dialog/README.md +0 -121
- package/src/ui/dialog/index.ts +0 -32
- package/src/ui/drawer/Drawer.stx +0 -120
- package/src/ui/drawer/README.md +0 -90
- package/src/ui/drawer/index.ts +0 -9
- package/src/ui/dropdown/Dropdown.stx +0 -82
- package/src/ui/dropdown/DropdownButton.stx +0 -29
- package/src/ui/dropdown/DropdownItem.stx +0 -35
- package/src/ui/dropdown/DropdownItems.stx +0 -18
- package/src/ui/dropdown/README.md +0 -114
- package/src/ui/dropdown/index.ts +0 -29
- package/src/ui/form/Form.stx +0 -95
- package/src/ui/form/index.ts +0 -67
- package/src/ui/heatmap/Heatmap.stx +0 -294
- package/src/ui/image/Image.stx +0 -165
- package/src/ui/image/README.md +0 -164
- package/src/ui/image/index.ts +0 -22
- package/src/ui/input/EmailInput.stx +0 -30
- package/src/ui/input/NumberInput.stx +0 -126
- package/src/ui/input/PasswordInput.stx +0 -143
- package/src/ui/input/SearchInput.stx +0 -44
- package/src/ui/input/TextInput.stx +0 -132
- package/src/ui/input/index.ts +0 -180
- package/src/ui/listbox/Listbox.stx +0 -101
- package/src/ui/listbox/ListboxButton.stx +0 -28
- package/src/ui/listbox/ListboxLabel.stx +0 -11
- package/src/ui/listbox/ListboxOption.stx +0 -49
- package/src/ui/listbox/ListboxOptions.stx +0 -16
- package/src/ui/listbox/README.md +0 -135
- package/src/ui/listbox/index.ts +0 -39
- package/src/ui/navigator/Navigator.stx +0 -113
- package/src/ui/navigator/README.md +0 -352
- package/src/ui/navigator/index.ts +0 -20
- package/src/ui/notification/Notification.stx +0 -117
- package/src/ui/notification/README.md +0 -114
- package/src/ui/notification/index.ts +0 -12
- package/src/ui/pagination/Pagination.stx +0 -150
- package/src/ui/pagination/index.ts +0 -11
- package/src/ui/payment/Checkout.stx +0 -31
- package/src/ui/payment/DefaultPaymentMethod.stx +0 -62
- package/src/ui/payment/PaymentMethods.stx +0 -104
- package/src/ui/payment/README.md +0 -345
- package/src/ui/payment/SubscriptionCheckout.stx +0 -323
- package/src/ui/payment/index.ts +0 -59
- package/src/ui/popover/Popover.stx +0 -60
- package/src/ui/popover/PopoverButton.stx +0 -29
- package/src/ui/popover/PopoverPanel.stx +0 -23
- package/src/ui/popover/README.md +0 -91
- package/src/ui/popover/index.ts +0 -22
- package/src/ui/portal/Portal.stx +0 -57
- package/src/ui/portal/index.ts +0 -6
- package/src/ui/progress/Progress.stx +0 -131
- package/src/ui/progress/index.ts +0 -12
- package/src/ui/radio/Radio.stx +0 -77
- package/src/ui/radio/index.ts +0 -15
- package/src/ui/radio-group/README.md +0 -139
- package/src/ui/radio-group/RadioGroup.stx +0 -60
- package/src/ui/radio-group/RadioGroupDescription.stx +0 -11
- package/src/ui/radio-group/RadioGroupLabel.stx +0 -11
- package/src/ui/radio-group/RadioGroupOption.stx +0 -58
- package/src/ui/radio-group/index.ts +0 -30
- package/src/ui/select/README.md +0 -180
- package/src/ui/select/Select.stx +0 -82
- package/src/ui/select/index.ts +0 -21
- package/src/ui/sidebar/Sidebar.stx +0 -458
- package/src/ui/sidebar/SidebarFooter.stx +0 -71
- package/src/ui/sidebar/SidebarHeader.stx +0 -103
- package/src/ui/sidebar/SidebarItem.stx +0 -86
- package/src/ui/sidebar/SidebarSection.stx +0 -83
- package/src/ui/sidebar/index.ts +0 -153
- package/src/ui/sidebar/themes.ts +0 -240
- package/src/ui/skeleton/Skeleton.stx +0 -48
- package/src/ui/skeleton/index.ts +0 -11
- package/src/ui/spinner/Spinner.stx +0 -109
- package/src/ui/spinner/index.ts +0 -9
- package/src/ui/stepper/README.md +0 -36
- package/src/ui/stepper/Stepper.stx +0 -17
- package/src/ui/stepper/StepperStep.stx +0 -57
- package/src/ui/stepper/index.ts +0 -19
- package/src/ui/storage/README.md +0 -193
- package/src/ui/storage/index.ts +0 -347
- package/src/ui/switch/README.md +0 -114
- package/src/ui/switch/Switch.stx +0 -72
- package/src/ui/switch/index.ts +0 -10
- package/src/ui/table/README.md +0 -39
- package/src/ui/table/Table.stx +0 -14
- package/src/ui/table/TableBody.stx +0 -10
- package/src/ui/table/TableCell.stx +0 -10
- package/src/ui/table/TableHead.stx +0 -10
- package/src/ui/table/TableHeader.stx +0 -20
- package/src/ui/table/TableRow.stx +0 -11
- package/src/ui/table/index.ts +0 -35
- package/src/ui/tabs/TabPanel.stx +0 -25
- package/src/ui/tabs/Tabs.stx +0 -202
- package/src/ui/tabs/index.ts +0 -50
- package/src/ui/teleport/Teleport.stx +0 -65
- package/src/ui/teleport/index.ts +0 -7
- package/src/ui/textarea/Textarea.stx +0 -108
- package/src/ui/textarea/index.ts +0 -20
- package/src/ui/tooltip/Tooltip.stx +0 -71
- package/src/ui/tooltip/index.ts +0 -10
- package/src/ui/transition/README.md +0 -30
- package/src/ui/transition/Transition.stx +0 -102
- package/src/ui/transition/index.ts +0 -25
- package/src/ui/video/README.md +0 -47
- package/src/ui/video/Video.stx +0 -45
- package/src/ui/video/index.ts +0 -16
- package/src/ui/virtual-list/VirtualList.stx +0 -67
- package/src/ui/virtual-list/index.ts +0 -10
- package/src/ui/virtual-table/VirtualTable.stx +0 -103
- package/src/ui/virtual-table/index.ts +0 -21
- package/src/utils/PROP_VALIDATION.md +0 -458
- package/src/utils/THEME_SYSTEM.md +0 -702
- package/src/utils/accessibility.ts +0 -841
- package/src/utils/animation/easing.ts +0 -368
- package/src/utils/animation/helpers.ts +0 -223
- package/src/utils/animation/index.ts +0 -5
- package/src/utils/animation/keyframes.ts +0 -230
- package/src/utils/error-handling.ts +0 -475
- package/src/utils/highlighter.ts +0 -93
- package/src/utils/i18n.ts +0 -634
- package/src/utils/keep-alive.ts +0 -819
- package/src/utils/lazy-loading.ts +0 -530
- package/src/utils/prop-validation.ts +0 -478
- package/src/utils/theme.ts +0 -626
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
# Navigator Component
|
|
2
|
-
|
|
3
|
-
A versatile navigation component that supports multiple orientations, variants, and styles. Perfect for main navigation, sidebars, tabs, and more.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- ✅ Multiple variants (default, pills, underline, sidebar)
|
|
8
|
-
- ✅ Horizontal and vertical orientations
|
|
9
|
-
- ✅ Active state handling
|
|
10
|
-
- ✅ Icon support
|
|
11
|
-
- ✅ Badge support
|
|
12
|
-
- ✅ Disabled states
|
|
13
|
-
- ✅ Multiple sizes (sm, md, lg)
|
|
14
|
-
- ✅ Custom navigation handlers
|
|
15
|
-
- ✅ Dark mode support
|
|
16
|
-
- ✅ Accessible with ARIA labels
|
|
17
|
-
- ✅ Keyboard navigation support
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
### Basic Horizontal Navigation
|
|
22
|
-
|
|
23
|
-
```stx
|
|
24
|
-
<script>
|
|
25
|
-
import { Navigator } from '@stacksjs/components'
|
|
26
|
-
|
|
27
|
-
const items = [
|
|
28
|
-
{ id: 'home', label: 'Home', href: '/' },
|
|
29
|
-
{ id: 'about', label: 'About', href: '/about' },
|
|
30
|
-
{ id: 'contact', label: 'Contact', href: '/contact' },
|
|
31
|
-
]
|
|
32
|
-
|
|
33
|
-
let activeItem = 'home'
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<Navigator items={items} active={activeItem} />
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Vertical Sidebar Navigation
|
|
40
|
-
|
|
41
|
-
```stx
|
|
42
|
-
<script>
|
|
43
|
-
import { Navigator } from '@stacksjs/components'
|
|
44
|
-
|
|
45
|
-
const items = [
|
|
46
|
-
{ id: 'dashboard', label: 'Dashboard', href: '/dashboard' },
|
|
47
|
-
{ id: 'projects', label: 'Projects', href: '/projects' },
|
|
48
|
-
{ id: 'team', label: 'Team', href: '/team' },
|
|
49
|
-
{ id: 'settings', label: 'Settings', href: '/settings' },
|
|
50
|
-
]
|
|
51
|
-
</script>
|
|
52
|
-
|
|
53
|
-
<Navigator
|
|
54
|
-
items={items}
|
|
55
|
-
active="dashboard"
|
|
56
|
-
orientation="vertical"
|
|
57
|
-
variant="sidebar"
|
|
58
|
-
/>
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### Pills Navigation
|
|
62
|
-
|
|
63
|
-
```stx
|
|
64
|
-
<script>
|
|
65
|
-
import { Navigator } from '@stacksjs/components'
|
|
66
|
-
|
|
67
|
-
const items = [
|
|
68
|
-
{ id: 'overview', label: 'Overview', href: '/overview' },
|
|
69
|
-
{ id: 'analytics', label: 'Analytics', href: '/analytics' },
|
|
70
|
-
{ id: 'reports', label: 'Reports', href: '/reports' },
|
|
71
|
-
]
|
|
72
|
-
</script>
|
|
73
|
-
|
|
74
|
-
<Navigator
|
|
75
|
-
items={items}
|
|
76
|
-
active="overview"
|
|
77
|
-
variant="pills"
|
|
78
|
-
/>
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Underline Tabs
|
|
82
|
-
|
|
83
|
-
```stx
|
|
84
|
-
<script>
|
|
85
|
-
import { Navigator } from '@stacksjs/components'
|
|
86
|
-
|
|
87
|
-
const tabs = [
|
|
88
|
-
{ id: 'profile', label: 'Profile', href: '#profile' },
|
|
89
|
-
{ id: 'security', label: 'Security', href: '#security' },
|
|
90
|
-
{ id: 'notifications', label: 'Notifications', href: '#notifications' },
|
|
91
|
-
]
|
|
92
|
-
</script>
|
|
93
|
-
|
|
94
|
-
<Navigator
|
|
95
|
-
items={tabs}
|
|
96
|
-
active="profile"
|
|
97
|
-
variant="underline"
|
|
98
|
-
/>
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### With Icons
|
|
102
|
-
|
|
103
|
-
```stx
|
|
104
|
-
<script>
|
|
105
|
-
import { Navigator } from '@stacksjs/components'
|
|
106
|
-
|
|
107
|
-
const items = [
|
|
108
|
-
{
|
|
109
|
-
id: 'home',
|
|
110
|
-
label: 'Home',
|
|
111
|
-
href: '/',
|
|
112
|
-
icon: '<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" /></svg>',
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
id: 'search',
|
|
116
|
-
label: 'Search',
|
|
117
|
-
href: '/search',
|
|
118
|
-
icon: '<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" /></svg>',
|
|
119
|
-
},
|
|
120
|
-
]
|
|
121
|
-
</script>
|
|
122
|
-
|
|
123
|
-
<Navigator items={items} active="home" />
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### With Badges
|
|
127
|
-
|
|
128
|
-
```stx
|
|
129
|
-
<script>
|
|
130
|
-
import { Navigator } from '@stacksjs/components'
|
|
131
|
-
|
|
132
|
-
const items = [
|
|
133
|
-
{ id: 'inbox', label: 'Inbox', href: '/inbox', badge: '12' },
|
|
134
|
-
{ id: 'drafts', label: 'Drafts', href: '/drafts', badge: '3' },
|
|
135
|
-
{ id: 'sent', label: 'Sent', href: '/sent' },
|
|
136
|
-
]
|
|
137
|
-
</script>
|
|
138
|
-
|
|
139
|
-
<Navigator items={items} active="inbox" variant="sidebar" orientation="vertical" />
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
### With Disabled Items
|
|
143
|
-
|
|
144
|
-
```stx
|
|
145
|
-
<script>
|
|
146
|
-
import { Navigator } from '@stacksjs/components'
|
|
147
|
-
|
|
148
|
-
const items = [
|
|
149
|
-
{ id: 'enabled', label: 'Enabled', href: '/enabled' },
|
|
150
|
-
{ id: 'disabled', label: 'Disabled (Coming Soon)', href: '/disabled', disabled: true },
|
|
151
|
-
{ id: 'another', label: 'Another Link', href: '/another' },
|
|
152
|
-
]
|
|
153
|
-
</script>
|
|
154
|
-
|
|
155
|
-
<Navigator items={items} active="enabled" />
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### With Custom Navigation Handler
|
|
159
|
-
|
|
160
|
-
```stx
|
|
161
|
-
<script>
|
|
162
|
-
import { Navigator } from '@stacksjs/components'
|
|
163
|
-
|
|
164
|
-
const items = [
|
|
165
|
-
{ id: 'tab1', label: 'Tab 1' },
|
|
166
|
-
{ id: 'tab2', label: 'Tab 2' },
|
|
167
|
-
{ id: 'tab3', label: 'Tab 3' },
|
|
168
|
-
]
|
|
169
|
-
|
|
170
|
-
let activeTab = 'tab1'
|
|
171
|
-
|
|
172
|
-
function handleNavigate(item) {
|
|
173
|
-
activeTab = item.id
|
|
174
|
-
console.log('Navigated to:', item.label)
|
|
175
|
-
// Custom logic here (e.g., switch content, fetch data, etc.)
|
|
176
|
-
}
|
|
177
|
-
</script>
|
|
178
|
-
|
|
179
|
-
<Navigator
|
|
180
|
-
items={items}
|
|
181
|
-
active={activeTab}
|
|
182
|
-
onNavigate={handleNavigate}
|
|
183
|
-
variant="underline"
|
|
184
|
-
/>
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
## Props
|
|
188
|
-
|
|
189
|
-
| Prop | Type | Default | Description |
|
|
190
|
-
|------|------|---------|-------------|
|
|
191
|
-
| `items` | `NavigatorItem[]` | `[]` | Array of navigation items |
|
|
192
|
-
| `active` | `string` | `''` | ID or href of the currently active item |
|
|
193
|
-
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Layout orientation |
|
|
194
|
-
| `variant` | `'default' \| 'pills' \| 'underline' \| 'sidebar'` | `'default'` | Visual style variant |
|
|
195
|
-
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Size of navigation items |
|
|
196
|
-
| `onNavigate` | `(item: NavigatorItem) => void` | - | Custom navigation handler (prevents default link behavior) |
|
|
197
|
-
| `className` | `string` | `''` | Additional CSS classes |
|
|
198
|
-
|
|
199
|
-
### NavigatorItem Interface
|
|
200
|
-
|
|
201
|
-
```typescript
|
|
202
|
-
interface NavigatorItem {
|
|
203
|
-
id?: string // Unique identifier
|
|
204
|
-
label: string // Display text
|
|
205
|
-
href?: string // Link URL (renders as <a> if provided, <button> otherwise)
|
|
206
|
-
icon?: string // SVG icon HTML
|
|
207
|
-
badge?: string | number // Badge text/number
|
|
208
|
-
disabled?: boolean // Whether the item is disabled
|
|
209
|
-
}
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
## Variants
|
|
213
|
-
|
|
214
|
-
### Default
|
|
215
|
-
Clean, simple navigation with subtle hover effects.
|
|
216
|
-
|
|
217
|
-
### Pills
|
|
218
|
-
Rounded pill-style navigation with filled active state.
|
|
219
|
-
|
|
220
|
-
### Underline
|
|
221
|
-
Tab-style navigation with bottom border indicator.
|
|
222
|
-
|
|
223
|
-
### Sidebar
|
|
224
|
-
Left-bordered navigation optimized for vertical sidebars.
|
|
225
|
-
|
|
226
|
-
## Sizes
|
|
227
|
-
|
|
228
|
-
- **sm**: Compact padding and text
|
|
229
|
-
- **md**: Default comfortable size
|
|
230
|
-
- **lg**: Large padding and text
|
|
231
|
-
|
|
232
|
-
## Examples
|
|
233
|
-
|
|
234
|
-
### App Header Navigation
|
|
235
|
-
|
|
236
|
-
```stx
|
|
237
|
-
<script>
|
|
238
|
-
import { Navigator } from '@stacksjs/components'
|
|
239
|
-
|
|
240
|
-
const mainNav = [
|
|
241
|
-
{ id: 'products', label: 'Products', href: '/products' },
|
|
242
|
-
{ id: 'pricing', label: 'Pricing', href: '/pricing' },
|
|
243
|
-
{ id: 'docs', label: 'Docs', href: '/docs' },
|
|
244
|
-
{ id: 'blog', label: 'Blog', href: '/blog' },
|
|
245
|
-
]
|
|
246
|
-
</script>
|
|
247
|
-
|
|
248
|
-
<header class="bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700">
|
|
249
|
-
<div class="max-w-7xl mx-auto px-4 py-4">
|
|
250
|
-
<Navigator items={mainNav} active="/products" />
|
|
251
|
-
</div>
|
|
252
|
-
</header>
|
|
253
|
-
```
|
|
254
|
-
|
|
255
|
-
### Dashboard Sidebar
|
|
256
|
-
|
|
257
|
-
```stx
|
|
258
|
-
<script>
|
|
259
|
-
import { Navigator } from '@stacksjs/components'
|
|
260
|
-
|
|
261
|
-
const sidebarNav = [
|
|
262
|
-
{
|
|
263
|
-
id: 'dashboard',
|
|
264
|
-
label: 'Dashboard',
|
|
265
|
-
href: '/dashboard',
|
|
266
|
-
icon: '<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" /></svg>',
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
id: 'projects',
|
|
270
|
-
label: 'Projects',
|
|
271
|
-
href: '/projects',
|
|
272
|
-
badge: '5',
|
|
273
|
-
icon: '<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" /></svg>',
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
id: 'team',
|
|
277
|
-
label: 'Team',
|
|
278
|
-
href: '/team',
|
|
279
|
-
icon: '<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" /></svg>',
|
|
280
|
-
},
|
|
281
|
-
]
|
|
282
|
-
</script>
|
|
283
|
-
|
|
284
|
-
<aside class="w-64 bg-white dark:bg-gray-800 border-r border-gray-200 dark:border-gray-700 h-full">
|
|
285
|
-
<Navigator
|
|
286
|
-
items={sidebarNav}
|
|
287
|
-
active="/dashboard"
|
|
288
|
-
orientation="vertical"
|
|
289
|
-
variant="sidebar"
|
|
290
|
-
/>
|
|
291
|
-
</aside>
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
### Settings Tabs
|
|
295
|
-
|
|
296
|
-
```stx
|
|
297
|
-
<script>
|
|
298
|
-
import { Navigator } from '@stacksjs/components'
|
|
299
|
-
|
|
300
|
-
const settingsTabs = [
|
|
301
|
-
{ id: 'general', label: 'General', href: '#general' },
|
|
302
|
-
{ id: 'security', label: 'Security', href: '#security' },
|
|
303
|
-
{ id: 'notifications', label: 'Notifications', href: '#notifications' },
|
|
304
|
-
{ id: 'billing', label: 'Billing', href: '#billing' },
|
|
305
|
-
]
|
|
306
|
-
|
|
307
|
-
let activeTab = 'general'
|
|
308
|
-
</script>
|
|
309
|
-
|
|
310
|
-
<div class="border-b border-gray-200 dark:border-gray-700 mb-6">
|
|
311
|
-
<Navigator
|
|
312
|
-
items={settingsTabs}
|
|
313
|
-
active={activeTab}
|
|
314
|
-
variant="underline"
|
|
315
|
-
/>
|
|
316
|
-
</div>
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
## Styling
|
|
320
|
-
|
|
321
|
-
The navigator uses utility-first CSS classes and supports dark mode. Customize appearance by passing additional classes:
|
|
322
|
-
|
|
323
|
-
```stx
|
|
324
|
-
<Navigator
|
|
325
|
-
className="bg-gray-50 dark:bg-gray-900 rounded-lg p-2"
|
|
326
|
-
items={items}
|
|
327
|
-
active="home"
|
|
328
|
-
/>
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
## Accessibility
|
|
332
|
-
|
|
333
|
-
- Semantic HTML (`<nav>`, `<a>`, `<button>`)
|
|
334
|
-
- ARIA labels for navigation role
|
|
335
|
-
- `aria-current="page"` for active items
|
|
336
|
-
- `aria-disabled` for disabled items
|
|
337
|
-
- Keyboard navigation support
|
|
338
|
-
- Focus indicators
|
|
339
|
-
|
|
340
|
-
## Browser Support
|
|
341
|
-
|
|
342
|
-
Works in all modern browsers that support:
|
|
343
|
-
- CSS Flexbox
|
|
344
|
-
- CSS custom properties
|
|
345
|
-
- ES6+ JavaScript
|
|
346
|
-
|
|
347
|
-
## Related Components
|
|
348
|
-
|
|
349
|
-
- **Breadcrumb**: Hierarchical navigation trail
|
|
350
|
-
- **Tabs**: Content switching interface
|
|
351
|
-
- **Sidebar**: Full sidebar layout with navigation
|
|
352
|
-
- **Menu**: Dropdown menu navigation
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export { default as Navigator } from './Navigator.stx'
|
|
2
|
-
|
|
3
|
-
export interface NavigatorItem {
|
|
4
|
-
id?: string
|
|
5
|
-
label: string
|
|
6
|
-
href?: string
|
|
7
|
-
icon?: string
|
|
8
|
-
badge?: string | number
|
|
9
|
-
disabled?: boolean
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface NavigatorProps {
|
|
13
|
-
items: NavigatorItem[]
|
|
14
|
-
active?: string // ID or href of active item
|
|
15
|
-
orientation?: 'horizontal' | 'vertical'
|
|
16
|
-
variant?: 'default' | 'pills' | 'underline' | 'sidebar'
|
|
17
|
-
size?: 'sm' | 'md' | 'lg'
|
|
18
|
-
onNavigate?: (item: NavigatorItem) => void
|
|
19
|
-
className?: string
|
|
20
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
<script server>
|
|
2
|
-
// Initial defaults captured at render time. The client script wraps these
|
|
3
|
-
// in signals so consumers can mutate them after mount (fetch-then-toast,
|
|
4
|
-
// auto-dismiss, etc.). See stacksjs/stx#1692.
|
|
5
|
-
export const initialShow = $props.show !== false
|
|
6
|
-
export const initialTitle = $props.title || ''
|
|
7
|
-
export const initialMessage = $props.message || ''
|
|
8
|
-
export const initialType = $props.type || 'info'
|
|
9
|
-
export const initialPosition = $props.position || 'top-right'
|
|
10
|
-
export const initialDuration = Number($props.duration ?? 5000)
|
|
11
|
-
export const className = $props.className || ''
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<script client>
|
|
15
|
-
const emit = defineEmits()
|
|
16
|
-
|
|
17
|
-
const isVisible = state({{ initialShow }})
|
|
18
|
-
const title = state({{ initialTitle }})
|
|
19
|
-
const message = state({{ initialMessage }})
|
|
20
|
-
const type = state({{ initialType }})
|
|
21
|
-
const position = state({{ initialPosition }})
|
|
22
|
-
const duration = state({{ initialDuration }})
|
|
23
|
-
|
|
24
|
-
const typeColors = {
|
|
25
|
-
info: 'bg-blue-50 text-blue-900 dark:bg-blue-900 dark:text-blue-100',
|
|
26
|
-
success: 'bg-green-50 text-green-900 dark:bg-green-900 dark:text-green-100',
|
|
27
|
-
warning: 'bg-yellow-50 text-yellow-900 dark:bg-yellow-900 dark:text-yellow-100',
|
|
28
|
-
error: 'bg-red-50 text-red-900 dark:bg-red-900 dark:text-red-100',
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const positions = {
|
|
32
|
-
'top-left': 'top-0 left-0',
|
|
33
|
-
'top-right': 'top-0 right-0',
|
|
34
|
-
'top-center': 'top-0 left-1/2 -translate-x-1/2',
|
|
35
|
-
'bottom-left': 'bottom-0 left-0',
|
|
36
|
-
'bottom-right': 'bottom-0 right-0',
|
|
37
|
-
'bottom-center': 'bottom-0 left-1/2 -translate-x-1/2',
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const baseClasses = 'fixed z-50 m-4 max-w-md w-full pointer-events-auto rounded-lg p-4 shadow-lg ring-1 ring-black ring-opacity-5 transition-all'
|
|
41
|
-
const extraClassName = {{ JSON.stringify(className) }}
|
|
42
|
-
|
|
43
|
-
const notificationClasses = derived(() => {
|
|
44
|
-
const color = typeColors[type()] || typeColors.info
|
|
45
|
-
const pos = positions[position()] || positions['top-right']
|
|
46
|
-
return `${baseClasses} ${color} ${pos} ${extraClassName}`.trim()
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
let autoHideTimer = null
|
|
50
|
-
function clearAutoHide() {
|
|
51
|
-
if (autoHideTimer) {
|
|
52
|
-
clearTimeout(autoHideTimer)
|
|
53
|
-
autoHideTimer = null
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function scheduleAutoHide() {
|
|
57
|
-
clearAutoHide()
|
|
58
|
-
const d = duration()
|
|
59
|
-
if (d > 0 && isVisible()) {
|
|
60
|
-
autoHideTimer = setTimeout(() => close(), d)
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function close() {
|
|
65
|
-
isVisible.set(false)
|
|
66
|
-
clearAutoHide()
|
|
67
|
-
emit('close')
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function open(opts) {
|
|
71
|
-
if (opts && typeof opts === 'object') {
|
|
72
|
-
if (opts.title !== undefined) title.set(opts.title)
|
|
73
|
-
if (opts.message !== undefined) message.set(opts.message)
|
|
74
|
-
if (opts.type !== undefined) type.set(opts.type)
|
|
75
|
-
if (opts.position !== undefined) position.set(opts.position)
|
|
76
|
-
if (opts.duration !== undefined) duration.set(Number(opts.duration))
|
|
77
|
-
}
|
|
78
|
-
isVisible.set(true)
|
|
79
|
-
scheduleAutoHide()
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
onMount(() => {
|
|
83
|
-
if (isVisible()) scheduleAutoHide()
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
defineExpose({
|
|
87
|
-
open,
|
|
88
|
-
close,
|
|
89
|
-
isVisible,
|
|
90
|
-
title,
|
|
91
|
-
message,
|
|
92
|
-
type,
|
|
93
|
-
position,
|
|
94
|
-
duration,
|
|
95
|
-
})
|
|
96
|
-
</script>
|
|
97
|
-
|
|
98
|
-
<div :if="isVisible()" :class="notificationClasses()" role="alert">
|
|
99
|
-
<div class="flex items-start">
|
|
100
|
-
<div class="flex-1">
|
|
101
|
-
<p :if="title()" class="text-sm font-medium" :text="title()"></p>
|
|
102
|
-
<p :if="message()" class="mt-1 text-sm" :class="title() ? 'opacity-90' : ''" :text="message()"></p>
|
|
103
|
-
<slot :if="!title() && !message()" />
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
<button
|
|
107
|
-
type="button"
|
|
108
|
-
@click="close()"
|
|
109
|
-
class="ml-4 inline-flex rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2"
|
|
110
|
-
>
|
|
111
|
-
<span class="sr-only">Close</span>
|
|
112
|
-
<svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
|
113
|
-
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd" />
|
|
114
|
-
</svg>
|
|
115
|
-
</button>
|
|
116
|
-
</div>
|
|
117
|
-
</div>
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
# Notification Component
|
|
2
|
-
|
|
3
|
-
Toast notifications for user feedback and alerts.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
bun add @stacksjs/components
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
```stx
|
|
14
|
-
<script server>
|
|
15
|
-
let showNotification = true
|
|
16
|
-
|
|
17
|
-
function closeNotification() {
|
|
18
|
-
showNotification = false
|
|
19
|
-
}
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<Notification
|
|
23
|
-
:show="showNotification"
|
|
24
|
-
title="Success!"
|
|
25
|
-
message="Your changes have been saved."
|
|
26
|
-
type="success"
|
|
27
|
-
:onClose="closeNotification"
|
|
28
|
-
/>
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Props
|
|
32
|
-
|
|
33
|
-
| Prop | Type | Default | Description |
|
|
34
|
-
|------|------|---------|-------------|
|
|
35
|
-
| `show` | `boolean` | `true` | Whether notification is visible |
|
|
36
|
-
| `title` | `string` | `''` | Notification title |
|
|
37
|
-
| `message` | `string` | `''` | Notification message |
|
|
38
|
-
| `type` | `'info' \| 'success' \| 'warning' \| 'error'` | `'info'` | Notification type |
|
|
39
|
-
| `position` | `'top-left' \| 'top-right' \| 'top-center' \| 'bottom-left' \| 'bottom-right' \| 'bottom-center'` | `'top-right'` | Position on screen |
|
|
40
|
-
| `duration` | `number` | `5000` | Auto-hide duration (0 = no auto-hide) |
|
|
41
|
-
| `onClose` | `() => void` | - | Close handler |
|
|
42
|
-
| `className` | `string` | `''` | Additional CSS classes |
|
|
43
|
-
|
|
44
|
-
## Examples
|
|
45
|
-
|
|
46
|
-
### Types
|
|
47
|
-
|
|
48
|
-
```stx
|
|
49
|
-
<Notification type="info" title="Information" message="This is an info message" />
|
|
50
|
-
|
|
51
|
-
<Notification type="success" title="Success" message="Operation completed" />
|
|
52
|
-
|
|
53
|
-
<Notification type="warning" title="Warning" message="Please be careful" />
|
|
54
|
-
|
|
55
|
-
<Notification type="error" title="Error" message="Something went wrong" />
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Positions
|
|
59
|
-
|
|
60
|
-
```stx
|
|
61
|
-
<Notification position="top-left" title="Top Left" />
|
|
62
|
-
<Notification position="top-center" title="Top Center" />
|
|
63
|
-
<Notification position="bottom-right" title="Bottom Right" />
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### No Auto-Hide
|
|
67
|
-
|
|
68
|
-
```stx
|
|
69
|
-
<Notification
|
|
70
|
-
:duration="0"
|
|
71
|
-
title="Important"
|
|
72
|
-
message="This will not auto-hide"
|
|
73
|
-
/>
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
### Custom Content
|
|
77
|
-
|
|
78
|
-
```stx
|
|
79
|
-
<Notification type="info">
|
|
80
|
-
<div class="flex items-start gap-3">
|
|
81
|
-
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
82
|
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
83
|
-
</svg>
|
|
84
|
-
<div>
|
|
85
|
-
<p class="font-medium">Custom notification</p>
|
|
86
|
-
<p class="mt-1 text-sm">With custom content and layout</p>
|
|
87
|
-
</div>
|
|
88
|
-
</div>
|
|
89
|
-
</Notification>
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### With Actions
|
|
93
|
-
|
|
94
|
-
```stx
|
|
95
|
-
<Notification type="info" title="New message">
|
|
96
|
-
<p>You have a new message from John</p>
|
|
97
|
-
<div class="mt-3 flex gap-2">
|
|
98
|
-
<Button size="sm" variant="primary">View</Button>
|
|
99
|
-
<Button size="sm" variant="ghost">Dismiss</Button>
|
|
100
|
-
</div>
|
|
101
|
-
</Notification>
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
## Features
|
|
105
|
-
|
|
106
|
-
- 4 types (info, success, warning, error)
|
|
107
|
-
- 6 position options
|
|
108
|
-
- Auto-hide with configurable duration
|
|
109
|
-
- Dark mode support
|
|
110
|
-
- Accessible (WAI-ARIA)
|
|
111
|
-
- Close button
|
|
112
|
-
- Custom content support
|
|
113
|
-
- Smooth transitions
|
|
114
|
-
- Customizable styling
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export { default as Notification } from './Notification.stx'
|
|
2
|
-
|
|
3
|
-
export interface NotificationProps {
|
|
4
|
-
show?: boolean
|
|
5
|
-
title?: string
|
|
6
|
-
message?: string
|
|
7
|
-
type?: 'info' | 'success' | 'warning' | 'error'
|
|
8
|
-
position?: 'top-left' | 'top-right' | 'top-center' | 'bottom-left' | 'bottom-right' | 'bottom-center'
|
|
9
|
-
duration?: number
|
|
10
|
-
onClose?: () => void
|
|
11
|
-
className?: string
|
|
12
|
-
}
|