Skip to content

Commit 8826add

Browse files
committed
chore: wip
1 parent 1da070e commit 8826add

File tree

13 files changed

+571
-151
lines changed

13 files changed

+571
-151
lines changed

docs/guide/components/combobox.md

Lines changed: 136 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1-
<Hero
2-
title="stacks/combobox"
3-
description="An opinionated combobox component for Stacks"
4-
link="https://github.com/stacksjs/stacks/tree/main/storage/framework/core/components/combobox"
5-
/>
1+
# Combobox
2+
3+
A modern, accessible combobox component for Vue applications.
4+
5+
<ComboboxDemo />
6+
7+
## Features
8+
9+
- 🎯 Fully accessible (WAI-ARIA compliant)
10+
- 🌐 Keyboard navigation support
11+
- 🎨 Customizable styling
12+
- 🔄 Dynamic filtering
13+
- 📱 Mobile-friendly
14+
- 🎯 TypeScript support
15+
616
<br>
717

8-
# Install
18+
## Install
919

1020
::: code-group
1121

@@ -30,32 +40,34 @@ yarn add @stacksjs/combobox
3040
```
3141

3242
:::
33-
3443
<br>
3544

36-
# Usage
37-
38-
`Comboboxes` are built using the `Combobox`, `ComboboxInput`, `ComboboxOptions`, `ComboboxOption` and `ComboboxLabel` components.
39-
40-
The `ComboboxInput` will automatically open/close the `ComboboxOptions` when searching.
45+
## Usage
4146

42-
You are completely in charge of how you filter the results, whether it be with a fuzzy search library client-side or by making server-side requests to an API. In this example we will keep the logic simple for demo purposes.
47+
The combobox component is composed of several sub-components that work together to create a fully functional and accessible combobox:
4348

4449
```vue
45-
<script lang="ts" setup>
46-
import { Combobox, ComboboxInput, ComboboxOptions, ComboboxOption } from '@stacksjs/combobox'
50+
<script setup>
51+
import { ref } from 'vue'
52+
import {
53+
Combobox,
54+
ComboboxInput,
55+
ComboboxButton,
56+
ComboboxOptions,
57+
ComboboxOption
58+
} from '@stacksjs/combobox'
59+
60+
const selected = ref(null)
61+
const query = ref('')
4762
</script>
4863
4964
<template>
50-
<Combobox v-model="selectedPerson">
65+
<Combobox v-model="selected">
5166
<ComboboxInput @change="query = $event.target.value" />
67+
<ComboboxButton />
5268
<ComboboxOptions>
53-
<ComboboxOption
54-
v-for="person in filteredPeople"
55-
:key="person"
56-
:value="person"
57-
>
58-
{{ person }}
69+
<ComboboxOption v-for="item in items" :key="item.id" :value="item">
70+
{{ item.name }}
5971
</ComboboxOption>
6072
</ComboboxOptions>
6173
</Combobox>
@@ -64,8 +76,108 @@ You are completely in charge of how you filter the results, whether it be with a
6476

6577
<br>
6678

67-
# Demo
79+
## API Reference
6880

69-
<ComboboxDemo />
81+
### Combobox
82+
83+
The root component that wraps all combobox elements.
84+
85+
#### Props
86+
87+
- `v-model` - The selected value(s)
88+
- `disabled` - (boolean) Whether the combobox is disabled
89+
- `as` - (string) The element to render as (default: 'template')
90+
91+
### ComboboxInput
92+
93+
The input element of the combobox.
94+
95+
#### Props
96+
97+
- `displayValue` - (Function) Function to format the display value
98+
- `placeholder` - (string) Input placeholder text
99+
100+
#### Events
101+
102+
- `@change` - Emitted when the input value changes
103+
- `@focus` - Emitted when the input receives focus
104+
- `@blur` - Emitted when the input loses focus
105+
106+
### ComboboxButton
107+
108+
The button that toggles the combobox options.
109+
110+
#### Props
111+
112+
- `as` - (string) The element to render as (default: 'button')
113+
114+
### ComboboxOptions
115+
116+
The container for the list of options.
117+
118+
#### Props
119+
120+
- `as` - (string) The element to render as (default: 'ul')
121+
- `static` - (boolean) Whether the options should always be rendered
122+
- `hold` - (boolean) Whether to maintain the options in the DOM when hidden
123+
124+
### ComboboxOption
125+
126+
Individual option items within the combobox.
127+
128+
#### Props
129+
130+
- `value` - The value associated with the option
131+
- `disabled` - (boolean) Whether the option is disabled
132+
- `as` - (string) The element to render as (default: 'li')
133+
134+
#### Slot Props
135+
136+
The ComboboxOption component exposes the following slot props:
137+
138+
- `active` - (boolean) Whether the option is currently active (focused)
139+
- `selected` - (boolean) Whether the option is currently selected
140+
- `disabled` - (boolean) Whether the option is disabled
141+
142+
## Styling
143+
144+
The combobox components can be styled using standard CSS classes. Each component accepts standard HTML attributes including `class` and `style`.
145+
146+
For dynamic styling based on state, use the slot props provided by ComboboxOption:
147+
148+
```vue
149+
<ComboboxOption v-slot="{ active, selected }">
150+
<li :class="{
151+
'bg-blue-500 text-white': active,
152+
'bg-white text-black': !active,
153+
'font-bold': selected
154+
}">
155+
{{ option.name }}
156+
</li>
157+
</ComboboxOption>
158+
```
159+
160+
## Accessibility
161+
162+
The combobox component follows WAI-ARIA guidelines and includes the following features:
163+
164+
- Full keyboard navigation support
165+
- ARIA attributes automatically managed
166+
- Screen reader announcements for selection changes
167+
- Focus management
168+
169+
## TypeScript Support
170+
171+
The combobox component includes full TypeScript support. You can specify the type of your items:
172+
173+
```ts
174+
interface Item {
175+
id: number
176+
name: string
177+
}
178+
179+
const selected = ref<Item | null>(null)
180+
const items = ref<Item[]>([])
181+
```
70182

71183
Still have questions relating this component’s usage? Contact us and we will help you out. In the meantime, if you are curious about the [`<CommandPalette />`](./command-palette.md) component read more on the next page.

docs/guide/components/notification.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,32 @@
44
link="https://github.com/stacksjs/stacks/tree/main/storage/framework/core/components/notification"
55
/>
66
<br>
7+
8+
# Install
9+
10+
::: code-group
11+
12+
```sh [npm]
13+
npm install @stacksjs/notification
14+
```
15+
16+
```sh [bun]
17+
bun install @stacksjs/notification
18+
# bun add @stacksjs/notification
19+
# bun i @stacksjs/notification
20+
```
21+
22+
```sh [pnpm]
23+
pnpm add @stacksjs/notification
24+
# pnpm i @stacksjs/notification
25+
```
26+
27+
```sh [yarn]
28+
yarn add @stacksjs/notification
29+
# yarn i -d @stacksjs/notification
30+
```
31+
32+
:::
33+
<br>
34+
35+
# Usage
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"name": "@stacksjs/drawer",
3+
"type": "module",
4+
"version": "0.69.5",
5+
"description": "A modern dropdown component.",
6+
"author": "Chris Breuer",
7+
"contributors": [
8+
"Chris Breuer <chris@stacksjs.org>"
9+
],
10+
"license": "MIT",
11+
"funding": "https://github.com/sponsors/chrisbbreuer",
12+
"homepage": "https://github.com/stacksjs/stacks/tree/main/storage/framework/core/components/dropdown#readme",
13+
"repository": {
14+
"type": "git",
15+
"url": "git+https://github.com/stacksjs/stacks.git",
16+
"directory": "./storage/framework/core/components/dropdown"
17+
},
18+
"bugs": {
19+
"url": "https://github.com/stacksjs/stacks/issues"
20+
},
21+
"keywords": [
22+
"dropdowns",
23+
"components",
24+
"library",
25+
"stacks"
26+
],
27+
"sideEffects": [
28+
"**/*.css"
29+
],
30+
"exports": {
31+
".": {
32+
"types": "./dist/index.d.ts",
33+
"import": "./dist/index.js"
34+
}
35+
},
36+
"files": [
37+
"README.md",
38+
"dist",
39+
"src"
40+
],
41+
"scripts": {
42+
"dev": "echo 'build'",
43+
"build": "echo 'build'",
44+
"build:demo": "echo 'build'",
45+
"build:types": "echo 'build'",
46+
"preview": "echo 'preview'",
47+
"prepublishOnly": "echo 'prepublish'"
48+
},
49+
"dependencies": {
50+
"@stacksjs/ui": "workspace:*",
51+
"highlight.js": "^11.11.1"
52+
},
53+
"devDependencies": {
54+
"@iconify-json/hugeicons": "^1.2.3",
55+
"@microsoft/api-extractor": "^7.51.1",
56+
"@stacksjs/alias": "workspace:*",
57+
"@stacksjs/development": "workspace:*",
58+
"@vue/tsconfig": "^0.7.0",
59+
"unocss": "66.0.0",
60+
"unplugin-icons": "^22.1.0"
61+
}
62+
}

0 commit comments

Comments
 (0)