mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-18 14:08:06 +01:00
Compare commits
107 Commits
release/re
...
v3.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c368c8ab8 | ||
|
|
c5796c4f82 | ||
|
|
204953b780 | ||
|
|
2e4c3082a1 | ||
|
|
f2fd778c0a | ||
|
|
d79da9d7b6 | ||
|
|
a4429eee09 | ||
|
|
0905b2b3d5 | ||
|
|
c7fba2e0eb | ||
|
|
4167f04205 | ||
|
|
276268d311 | ||
|
|
717e35f098 | ||
|
|
459a0410ab | ||
|
|
b9adc83e78 | ||
|
|
d7a4d029b7 | ||
|
|
3c8d6cd01d | ||
|
|
67da90a2f6 | ||
|
|
894e8a61b6 | ||
|
|
1b6ab271ea | ||
|
|
0dc4678c68 | ||
|
|
e86dc79e51 | ||
|
|
35997377a6 | ||
|
|
12303a87be | ||
|
|
f84ccddcd6 | ||
|
|
869c0708bd | ||
|
|
c63d2f380a | ||
|
|
92632e969e | ||
|
|
f6d7994a55 | ||
|
|
f738f68f76 | ||
|
|
17d6803329 | ||
|
|
732a67aa88 | ||
|
|
bdf129fc38 | ||
|
|
d140acc608 | ||
|
|
cc20a26f07 | ||
|
|
983c6382d1 | ||
|
|
37eabc89bd | ||
|
|
a57844e416 | ||
|
|
2be60cddfe | ||
|
|
09b4699aea | ||
|
|
46c2987ebf | ||
|
|
f244d15b96 | ||
|
|
aaa60c0798 | ||
|
|
5467d71cc2 | ||
|
|
941a54e5e3 | ||
|
|
655f98ffed | ||
|
|
999a0f8467 | ||
|
|
2739939c46 | ||
|
|
2a241c87c3 | ||
|
|
e6e510b848 | ||
|
|
a655da1394 | ||
|
|
3a71256d59 | ||
|
|
404359a6ca | ||
|
|
1e4e9c4708 | ||
|
|
6f07f6bd6e | ||
|
|
4c1093bde4 | ||
|
|
7d51a9e479 | ||
|
|
04bdbcfc6e | ||
|
|
58aa296425 | ||
|
|
d3df3bb929 | ||
|
|
4863775e17 | ||
|
|
7551a85ad2 | ||
|
|
c2bcb8e264 | ||
|
|
88124b85c5 | ||
|
|
9f539c9545 | ||
|
|
41d4ffe5b5 | ||
|
|
d8a0bbe710 | ||
|
|
06e5689da8 | ||
|
|
67d19f582a | ||
|
|
650bc40253 | ||
|
|
2f0f317a12 | ||
|
|
d2a26939ad | ||
|
|
b7a8146898 | ||
|
|
e81464a43e | ||
|
|
4b3d2a7b00 | ||
|
|
6f6fa6ae4a | ||
|
|
c7bb6d4c4b | ||
|
|
c23f85fe33 | ||
|
|
591d59fe89 | ||
|
|
caa3bf9c7e | ||
|
|
2731011bb7 | ||
|
|
aebf0b3dca | ||
|
|
6651987dc6 | ||
|
|
61aabd72e4 | ||
|
|
8dfdd63ce3 | ||
|
|
e6369a6746 | ||
|
|
a4f3f6d531 | ||
|
|
c5bdec0f64 | ||
|
|
87a7828931 | ||
|
|
501468960b | ||
|
|
13cd6be679 | ||
|
|
e421ea57ec | ||
|
|
799d7ae422 | ||
|
|
be9b1f659a | ||
|
|
39e29fccf1 | ||
|
|
195773ec7d | ||
|
|
d7710795df | ||
|
|
53f8b34bef | ||
|
|
df83ab355e | ||
|
|
e5df026993 | ||
|
|
6131871a0d | ||
|
|
9543bce787 | ||
|
|
5e345a8a73 | ||
|
|
8acf3c51db | ||
|
|
f3b8b17dc5 | ||
|
|
bc0a296f9d | ||
|
|
ac4c1946ec | ||
|
|
82b5f322eb |
4
.github/ISSUE_TEMPLATE/bug-report-v3.yml
vendored
4
.github/ISSUE_TEMPLATE/bug-report-v3.yml
vendored
@@ -5,7 +5,7 @@ body:
|
|||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
Before reporting a bug, please make sure that you have read through our [v3 documentation](https://ui.nuxt.com/) and existing [issues](https://github.com/nuxt/ui/issues?q=is%3Aissue%20is%3Aopen%20sort%3Aupdated-desc%20label%3Av3).
|
Before reporting a bug, please make sure that you have read through our [documentation](https://ui.nuxt.com/) and existing [issues](https://github.com/nuxt/ui/issues?q=is%3Aissue%20is%3Aopen%20sort%3Aupdated-desc%20label%3Av3).
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: env
|
id: env
|
||||||
attributes:
|
attributes:
|
||||||
@@ -44,7 +44,7 @@ body:
|
|||||||
id: reproduction
|
id: reproduction
|
||||||
attributes:
|
attributes:
|
||||||
label: Reproduction
|
label: Reproduction
|
||||||
description: Please provide a reproduction link using the Nuxt template https://codesandbox.io/p/devbox/nuxt-ui3-n3sxks or the Vue template https://codesandbox.io/p/devbox/nuxt-ui3-vue-4h5gqn. A minimal [reproduction is required](https://antfu.me/posts/why-reproductions-are-required) unless you are absolutely sure that the issue is obvious and the provided information is enough to understand the problem. If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "needs reproduction" label. If no reproduction is provided we might close it.
|
description: Please provide a reproduction link using the Nuxt template https://codesandbox.io/p/devbox/nuxt-ui3-n3sxks or the Vue template https://codesandbox.io/p/devbox/nuxt-ui3-vue-4h5gqn. A minimal [reproduction is required](https://antfu.me/posts/why-reproductions-are-required) unless you are absolutely sure that the issue is obvious and the provided information is enough to understand the problem. If a report is vague (e.g. just a generic error message) and has no reproduction, it will receive a "needs reproduction" label. If no reproduction is provided, it will be closed automatically after a while.
|
||||||
placeholder: https://github.com/my/reproduction
|
placeholder: https://github.com/my/reproduction
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ body:
|
|||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
Before requesting a feature, please make sure that you have read through our [v3 documentation](https://ui.nuxt.com/) and existing [issues](https://github.com/nuxt/ui/issues?q=is%3Aissue%20is%3Aopen%20sort%3Aupdated-desc%20label%3Av3).
|
Before requesting a feature, please make sure that you have read through our [documentation](https://ui.nuxt.com/) and existing [issues](https://github.com/nuxt/ui/issues?q=is%3Aissue%20is%3Aopen%20sort%3Aupdated-desc%20label%3Av3).
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
2
.github/ISSUE_TEMPLATE/question-v3.yml
vendored
2
.github/ISSUE_TEMPLATE/question-v3.yml
vendored
@@ -5,7 +5,7 @@ body:
|
|||||||
- type: markdown
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
value: |
|
value: |
|
||||||
Before asking a question, please make sure that you have read through our [v3 documentation](https://ui.nuxt.com/) and existing [issues](https://github.com/nuxt/ui/issues?q=is%3Aissue%20is%3Aopen%20sort%3Aupdated-desc%20label%3Av3).
|
Before asking a question, please make sure that you have read through our [documentation](https://ui.nuxt.com/) and existing [issues](https://github.com/nuxt/ui/issues?q=is%3Aissue%20is%3Aopen%20sort%3Aupdated-desc%20label%3Av3).
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
attributes:
|
attributes:
|
||||||
|
|||||||
30
.github/reproduire/needs-reproduction.md
vendored
Normal file
30
.github/reproduire/needs-reproduction.md
vendored
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
Would you be able to provide a [reproduction](https://nuxt.com/docs/community/reporting-bugs/#create-a-minimal-reproduction)? 🙏
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>More info</summary>
|
||||||
|
|
||||||
|
### Why do I need to provide a reproduction?
|
||||||
|
|
||||||
|
Reproductions make it possible for us to triage and fix issues quickly with a relatively small team. It helps us discover the source of the problem, and also can reveal assumptions you or we might be making.
|
||||||
|
|
||||||
|
### What will happen?
|
||||||
|
|
||||||
|
If you've provided a reproduction, we'll remove the label and try to reproduce the issue. If we can, we'll mark it as a bug and prioritise it based on its severity and how many people we think it might affect.
|
||||||
|
|
||||||
|
If `needs reproduction` labeled issues don't receive any substantial activity (e.g., new comments featuring a reproduction link), they will be closed automatically after a while. That's not because we don't care! At any point, feel free to comment with a reproduction and we'll reopen it.
|
||||||
|
|
||||||
|
### How can I create a reproduction?
|
||||||
|
|
||||||
|
We have templates to create a minimal reproduction:
|
||||||
|
|
||||||
|
* **Nuxt**: https://codesandbox.io/p/devbox/nuxt-ui3-n3sxks
|
||||||
|
* **Vue**: https://codesandbox.io/p/devbox/nuxt-ui3-vue-4h5gqn
|
||||||
|
|
||||||
|
Please ensure that the reproduction is as **minimal** as possible. See more details [in our guide](https://nuxt.com/docs/community/reporting-bugs/#create-a-minimal-reproduction).
|
||||||
|
|
||||||
|
You might also find these other articles interesting and/or helpful:
|
||||||
|
|
||||||
|
- [The Importance of Reproductions](https://antfu.me/posts/why-reproductions-are-required)
|
||||||
|
- [How to Generate a Minimal, Complete, and Verifiable Example](https://stackoverflow.com/help/mcve)
|
||||||
|
|
||||||
|
</details>
|
||||||
47
.github/workflows/module.yml
vendored
47
.github/workflows/module.yml
vendored
@@ -69,6 +69,53 @@ jobs:
|
|||||||
if: matrix.os == 'ubuntu-latest'
|
if: matrix.os == 'ubuntu-latest'
|
||||||
run: pnpx pkg-pr-new publish --compact --no-template --pnpm
|
run: pnpx pkg-pr-new publish --compact --no-template --pnpm
|
||||||
|
|
||||||
|
playground:
|
||||||
|
needs: build
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: ./playground
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: read
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest] # macos-latest, windows-latest
|
||||||
|
node: [22]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Store commit SHA
|
||||||
|
run: |
|
||||||
|
echo "COMMIT_SHA=$(echo ${{ github.workflow_sha }} | cut -c1-7)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
|
||||||
|
- name: Install node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
cache: pnpm
|
||||||
|
|
||||||
|
- name: Install latest nuxt/ui
|
||||||
|
run: pnpm install https://pkg.pr.new/@nuxt/ui@${{ env.COMMIT_SHA }} --lockfile-only
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install --ignore-workspace
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: pnpm nuxi prepare
|
||||||
|
|
||||||
|
- name: Typecheck
|
||||||
|
run: pnpm run typecheck
|
||||||
|
|
||||||
starter-nuxt:
|
starter-nuxt:
|
||||||
needs: build
|
needs: build
|
||||||
|
|
||||||
|
|||||||
17
.github/workflows/reproduire.yml
vendored
Normal file
17
.github/workflows/reproduire.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
name: reproduire
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [labeled]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
reproduire:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
- uses: Hebilicious/reproduire@4b686ae9cbb72dad60f001d278b6e3b2ce40a9ac # v0.0.9-mp
|
||||||
|
with:
|
||||||
|
label: needs reproduction
|
||||||
63
CHANGELOG.md
63
CHANGELOG.md
@@ -1,5 +1,68 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [3.1.2](https://github.com/nuxt/ui/compare/v3.1.1...v3.1.2) (2025-05-15)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **Badge:** add `square` prop ([#4008](https://github.com/nuxt/ui/issues/4008)) ([894e8a6](https://github.com/nuxt/ui/commit/894e8a61b6fea3618fc863bd77678385e9d021c2))
|
||||||
|
* **CheckboxGroup:** add `table` variant ([#3997](https://github.com/nuxt/ui/issues/3997)) ([1b6ab27](https://github.com/nuxt/ui/commit/1b6ab271ea3875a7c77ffe9367c7c341083dd53c))
|
||||||
|
* **components:** add `ui` field in items ([#4060](https://github.com/nuxt/ui/issues/4060)) ([b9adc83](https://github.com/nuxt/ui/commit/b9adc83e787db02507e6e7bb1aabc684eccc197b))
|
||||||
|
* **InputNumber:** add `increment-disabled` / `decrement-disabled` props ([#4141](https://github.com/nuxt/ui/issues/4141)) ([c7fba2e](https://github.com/nuxt/ui/commit/c7fba2e0ebfb7153f3bfb727165d653bbd3dbe54))
|
||||||
|
* **locale:** add Slovenian language ([#4140](https://github.com/nuxt/ui/issues/4140)) ([e86dc79](https://github.com/nuxt/ui/commit/e86dc79e51b2773a77ada5f12d4f0964fbc83354))
|
||||||
|
* **NavigationMenu:** add `collapsible` field in items ([2be60cd](https://github.com/nuxt/ui/commit/2be60cddfe10fd1e2466900fd53e21ee0c877227)), closes [#3353](https://github.com/nuxt/ui/issues/3353) [#3911](https://github.com/nuxt/ui/issues/3911)
|
||||||
|
* **NavigationMenu:** handle `tooltip` in items ([46c2987](https://github.com/nuxt/ui/commit/46c2987ebfd30b2b071a96a745b7270e852e96de)), closes [#4050](https://github.com/nuxt/ui/issues/4050)
|
||||||
|
* **Slider:** handle `tooltip` around thumbs ([d140acc](https://github.com/nuxt/ui/commit/d140acc608c6ae11c0a0531fe443588776ea7807)), closes [#1469](https://github.com/nuxt/ui/issues/1469)
|
||||||
|
* **Toast:** add `progress` prop to hide progress bar ([#4125](https://github.com/nuxt/ui/issues/4125)) ([92632e9](https://github.com/nuxt/ui/commit/92632e969eaa11521a166e50e346753929b7f523))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Badge/Button:** handle zero value in label correctly ([#4108](https://github.com/nuxt/ui/issues/4108)) ([f244d15](https://github.com/nuxt/ui/commit/f244d15b96d97cd8ba34ba9c18f23965e17e3cef))
|
||||||
|
* **ButtonGroup:** add `z-index` on focused element ([204953b](https://github.com/nuxt/ui/commit/204953b780bde08dbfde230fc8887674449227b7))
|
||||||
|
* **Calendar:** wrong color for today date with `neutral` color ([7d51a9e](https://github.com/nuxt/ui/commit/7d51a9e479cb6105ea37759c5cd67ff9f7702c49)), closes [#4084](https://github.com/nuxt/ui/issues/4084) [#3629](https://github.com/nuxt/ui/issues/3629)
|
||||||
|
* **Checkbox/RadioGroup:** render correct element without `variant` ([f2fd778](https://github.com/nuxt/ui/commit/f2fd778c0a604f2d65aec9f3fe2d54b6d4e8c3a2)), closes [#3998](https://github.com/nuxt/ui/issues/3998)
|
||||||
|
* **CheckboxGroup:** relative `UCheckbox` import ([7551a85](https://github.com/nuxt/ui/commit/7551a85ad2d92b59e2909396affb862403d5b27a)), closes [#4090](https://github.com/nuxt/ui/issues/4090)
|
||||||
|
* **ColorPicker:** make thumb touch draggable ([#4101](https://github.com/nuxt/ui/issues/4101)) ([cc20a26](https://github.com/nuxt/ui/commit/cc20a26f07268d19119ab4c7c254033143bb63f4))
|
||||||
|
* **components:** `class` should have priority over `ui` prop ([e6e510b](https://github.com/nuxt/ui/commit/e6e510b848d995a286a51d50a120d67483e11232))
|
||||||
|
* **FormField:** block form field injection after use ([#4150](https://github.com/nuxt/ui/issues/4150)) ([d79da9d](https://github.com/nuxt/ui/commit/d79da9d7b60c9972af64acd8e6eef4ae7d6bc3eb))
|
||||||
|
* **FormField:** use `div` for `error` and `help` slots ([459a041](https://github.com/nuxt/ui/commit/459a0410ab729fde60865e84632b36903465f57e))
|
||||||
|
* **inertia:** link always render as anchor tag ([#3989](https://github.com/nuxt/ui/issues/3989)) ([e81464a](https://github.com/nuxt/ui/commit/e81464a43ede4e63ce3dc92429bbfef48614f731))
|
||||||
|
* **inertia:** make `useAppConfig` reactive ([12303a8](https://github.com/nuxt/ui/commit/12303a87be62dae84ef774e3a9795deb0ac90cc7))
|
||||||
|
* **Input/Textarea:** handle generic types ([3c8d6cd](https://github.com/nuxt/ui/commit/3c8d6cd01dfafed5844c376f52adbdda0c814420)), closes [nuxt/ui-pro#887](https://github.com/nuxt/ui-pro/issues/887)
|
||||||
|
* **InputNumber:** handle inside button group ([2e4c308](https://github.com/nuxt/ui/commit/2e4c3082a1e66fa597086dc3431fec37fa29ef62)), closes [#4155](https://github.com/nuxt/ui/issues/4155)
|
||||||
|
* **Link:** consistent behavior between nuxt, vue and inertia ([#4134](https://github.com/nuxt/ui/issues/4134)) ([67da90a](https://github.com/nuxt/ui/commit/67da90a2f638124f640c4271d3376c5ff3fab6a1))
|
||||||
|
* **module:** configure `@nuxt/fonts` with default weights ([276268d](https://github.com/nuxt/ui/commit/276268d311f57715cec47bc600a0ccc3d3885682))
|
||||||
|
* **NavigationMenu:** arrow position conflict ([#4137](https://github.com/nuxt/ui/issues/4137)) ([0dc4678](https://github.com/nuxt/ui/commit/0dc4678c68e4b500be49c38336dc75b73843e38d))
|
||||||
|
* **Select:** support more primitive types in `value` field ([#4105](https://github.com/nuxt/ui/issues/4105)) ([09b4699](https://github.com/nuxt/ui/commit/09b4699aeadaa195ea081509f8e237bb2c346238))
|
||||||
|
* **Slider:** handle generic types ([d7a4d02](https://github.com/nuxt/ui/commit/d7a4d029b77d2dfa0b8efcd2755d482fa5e31fd3))
|
||||||
|
* **Stepper:** use `div` tag for `title` & `description` ([a57844e](https://github.com/nuxt/ui/commit/a57844e41676c13ed1af861424961b88cee7b4da)), closes [#4096](https://github.com/nuxt/ui/issues/4096)
|
||||||
|
* **Tabs:** prevent trigger truncate without parent width ([06e5689](https://github.com/nuxt/ui/commit/06e5689da80b36205d0548d5d6b58510938e4a6e)), closes [#4056](https://github.com/nuxt/ui/issues/4056)
|
||||||
|
* **Tabs:** set `focus:outline-none` with `link` variant ([999a0f8](https://github.com/nuxt/ui/commit/999a0f84671fad20fa3dc50c6774af2e0200b32e))
|
||||||
|
* **templates:** dont write unused variants in theme files ([d3df3bb](https://github.com/nuxt/ui/commit/d3df3bb929fe6732f27b182d1664213884a662ec))
|
||||||
|
* **Toaster:** allow `base` slot override ([c63d2f3](https://github.com/nuxt/ui/commit/c63d2f380aac16f1d1e812516df3dca7fa7c8034))
|
||||||
|
* **vue:** make `useAppConfig` reactive ([869c070](https://github.com/nuxt/ui/commit/869c0708bd351c7be44e5e430c348b19dd316db9)), closes [#3952](https://github.com/nuxt/ui/issues/3952)
|
||||||
|
|
||||||
|
## [3.1.1](https://github.com/nuxt/ui/compare/v3.1.0...v3.1.1) (2025-05-02)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **useOverlay:** add `closeAll` method ([#3984](https://github.com/nuxt/ui/issues/3984)) ([ac4c194](https://github.com/nuxt/ui/commit/ac4c1946ec399aec59b4bce9d538e3ff67868abf))
|
||||||
|
* **useOverlay:** add `isOpen` method to check overlay state ([#4041](https://github.com/nuxt/ui/issues/4041)) ([a4f3f6d](https://github.com/nuxt/ui/commit/a4f3f6d531f9c0281f99085a6688d296f8f13f2f))
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **Calendar:** add `place-items-center` to grid row ([#4034](https://github.com/nuxt/ui/issues/4034)) ([8dfdd63](https://github.com/nuxt/ui/commit/8dfdd63ce3b3a0e904f7c013c774cf9aaf46b240))
|
||||||
|
* **defineShortcuts:** bring back `meta` to `ctrl` convert on non macos platforms ([f3b8b17](https://github.com/nuxt/ui/commit/f3b8b17dc5f43936ef7ffb11c1ed7f9a5f94d0bb)), closes [#3869](https://github.com/nuxt/ui/issues/3869) [#3318](https://github.com/nuxt/ui/issues/3318)
|
||||||
|
* **module:** support `nuxt-nightly` ([#3996](https://github.com/nuxt/ui/issues/3996)) ([bc0a296](https://github.com/nuxt/ui/commit/bc0a296f9d68ca72cd991b11cd3489b63c7b13db))
|
||||||
|
* **NavigationMenu:** remove `sm:w-auto` from content slot ([aebf0b3](https://github.com/nuxt/ui/commit/aebf0b3dca50c51c093cb6abf16c4fd995fc1b39)), closes [#3987](https://github.com/nuxt/ui/issues/3987)
|
||||||
|
* **RadioGroup:** improve items `value` field type ([#3995](https://github.com/nuxt/ui/issues/3995)) ([195773e](https://github.com/nuxt/ui/commit/195773ec7dac12ccc3a0a67867751e8ca634cc04))
|
||||||
|
* **templates:** put back args to watch in dev ([#4033](https://github.com/nuxt/ui/issues/4033)) ([c5bdec0](https://github.com/nuxt/ui/commit/c5bdec0f64963ef602975270a09a1ee795cdacf9))
|
||||||
|
* **theme:** add missing `border-bg` / `divide-bg` utilities ([82b5f32](https://github.com/nuxt/ui/commit/82b5f322ebd8a08e63588122bd4ef567dcb8ba8c))
|
||||||
|
* **theme:** add missing `ring-offset-*` utilities ([#3992](https://github.com/nuxt/ui/issues/3992)) ([e5df026](https://github.com/nuxt/ui/commit/e5df0269935be59df759fe0e1378acb2b0d9014a))
|
||||||
|
* **theme:** define default shades for named tailwindcss colors ([8acf3c5](https://github.com/nuxt/ui/commit/8acf3c51db6c2f9443d04be6ba7d9f062c5cf8ab)), closes [#3977](https://github.com/nuxt/ui/issues/3977)
|
||||||
|
* **theme:** improve app config types for `ui` object ([591d59f](https://github.com/nuxt/ui/commit/591d59fe89f1d9bf016c121bf9160f73fe0a290d)), closes [#3579](https://github.com/nuxt/ui/issues/3579)
|
||||||
|
* **theme:** use `[@theme](https://github.com/theme) inline` to properly reference css variables ([6131871](https://github.com/nuxt/ui/commit/6131871a0d124c5942d60dc5dff20981e8542e51)), closes [#4018](https://github.com/nuxt/ui/issues/4018)
|
||||||
|
* **useOverlay:** improve types and docs ([#4012](https://github.com/nuxt/ui/issues/4012)) ([39e29fc](https://github.com/nuxt/ui/commit/39e29fccf1840c723a13237d65002501b2829b70))
|
||||||
|
|
||||||
## [3.1.0](https://github.com/nuxt/ui/compare/v3.0.2...v3.1.0) (2025-04-24)
|
## [3.1.0](https://github.com/nuxt/ui/compare/v3.0.2...v3.1.0) (2025-04-24)
|
||||||
|
|
||||||
### ⚠ BREAKING CHANGES
|
### ⚠ BREAKING CHANGES
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export default defineBuildConfig({
|
|||||||
delimiters: ['', ''],
|
delimiters: ['', ''],
|
||||||
values: {
|
values: {
|
||||||
// Used in development to import directly from theme
|
// Used in development to import directly from theme
|
||||||
'const isUiDev = true': 'const isUiDev = false'
|
'process.argv.includes(\'--uiDev\')': 'false'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.${camelName}
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
||||||
<slot />
|
<slot />
|
||||||
</Primitive>
|
</Primitive>
|
||||||
</template>
|
</template>
|
||||||
@@ -109,7 +109,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.${camelName}
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<${upperName}Root v-bind="rootProps" :class="ui.root({ class: [props.class, props.ui?.root] })" />
|
<${upperName}Root v-bind="rootProps" :class="ui.root({ class: [props.ui?.root, props.class] })" />
|
||||||
</template>
|
</template>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ provide('navigation', mappedNavigation)
|
|||||||
<NuxtLoadingIndicator color="var(--ui-primary)" :height="2" />
|
<NuxtLoadingIndicator color="var(--ui-primary)" :height="2" />
|
||||||
|
|
||||||
<template v-if="!route.path.startsWith('/examples')">
|
<template v-if="!route.path.startsWith('/examples')">
|
||||||
<Banner />
|
<!-- <Banner /> -->
|
||||||
|
|
||||||
<Header :links="links" />
|
<Header :links="links" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ watch(framework, () => {
|
|||||||
color="neutral"
|
color="neutral"
|
||||||
:ui="{
|
:ui="{
|
||||||
indicator: 'bg-default',
|
indicator: 'bg-default',
|
||||||
trigger: 'px-1 data-[state=active]:text-highlighted'
|
trigger: 'px-1 data-[state=active]:text-highlighted w-full'
|
||||||
}"
|
}"
|
||||||
size="xs"
|
size="xs"
|
||||||
@update:model-value="(framework = $event as string)"
|
@update:model-value="(framework = $event as string)"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ watch(module, () => {
|
|||||||
color="neutral"
|
color="neutral"
|
||||||
:ui="{
|
:ui="{
|
||||||
indicator: 'bg-default',
|
indicator: 'bg-default',
|
||||||
trigger: 'px-1 data-[state=active]:text-highlighted'
|
trigger: 'px-1 data-[state=active]:text-highlighted w-full'
|
||||||
}"
|
}"
|
||||||
size="xs"
|
size="xs"
|
||||||
@update:model-value="(module = $event as string)"
|
@update:model-value="(module = $event as string)"
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const schemaProps = computed(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<ProseCollapsible v-if="schemaProps?.length" class="mt-1">
|
<ProseCollapsible v-if="schemaProps?.length" class="mt-1 mb-0">
|
||||||
<ProseUl>
|
<ProseUl>
|
||||||
<ProseLi v-for="schemaProp in schemaProps" :key="schemaProp.name">
|
<ProseLi v-for="schemaProp in schemaProps" :key="schemaProp.name">
|
||||||
<HighlightInlineType :type="`${schemaProp.name}${schemaProp.required === false ? '?' : ''}: ${schemaProp.type}`" />
|
<HighlightInlineType :type="`${schemaProp.name}${schemaProp.required === false ? '?' : ''}: ${schemaProp.type}`" />
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ function getEmojiFlag(locale: string): string {
|
|||||||
km: 'kh', // Khmer -> Cambodia
|
km: 'kh', // Khmer -> Cambodia
|
||||||
ko: 'kr', // Korean -> South Korea
|
ko: 'kr', // Korean -> South Korea
|
||||||
nb: 'no', // Norwegian Bokmål -> Norway
|
nb: 'no', // Norwegian Bokmål -> Norway
|
||||||
|
sl: 'si', // Slovenian -> Slovenia
|
||||||
sv: 'se', // Swedish -> Sweden
|
sv: 'se', // Swedish -> Sweden
|
||||||
uk: 'ua', // Ukrainian -> Ukraine
|
uk: 'ua', // Ukrainian -> Ukraine
|
||||||
ur: 'pk', // Urdu -> Pakistan
|
ur: 'pk', // Urdu -> Pakistan
|
||||||
|
|||||||
@@ -17,9 +17,12 @@ function onClickPrev() {
|
|||||||
function onClickNext() {
|
function onClickNext() {
|
||||||
activeIndex.value++
|
activeIndex.value++
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSelect(index: number) {
|
function onSelect(index: number) {
|
||||||
activeIndex.value = index
|
activeIndex.value = index
|
||||||
|
}
|
||||||
|
|
||||||
|
function select(index: number) {
|
||||||
|
activeIndex.value = index
|
||||||
|
|
||||||
carousel.value?.emblaApi?.scrollTo(index)
|
carousel.value?.emblaApi?.scrollTo(index)
|
||||||
}
|
}
|
||||||
@@ -35,6 +38,7 @@ function onSelect(index: number) {
|
|||||||
:prev="{ onClick: onClickPrev }"
|
:prev="{ onClick: onClickPrev }"
|
||||||
:next="{ onClick: onClickNext }"
|
:next="{ onClick: onClickNext }"
|
||||||
class="w-full max-w-xs mx-auto"
|
class="w-full max-w-xs mx-auto"
|
||||||
|
@select="onSelect"
|
||||||
>
|
>
|
||||||
<img :src="item" width="320" height="320" class="rounded-lg">
|
<img :src="item" width="320" height="320" class="rounded-lg">
|
||||||
</UCarousel>
|
</UCarousel>
|
||||||
@@ -45,7 +49,7 @@ function onSelect(index: number) {
|
|||||||
:key="index"
|
:key="index"
|
||||||
class="size-11 opacity-25 hover:opacity-100 transition-opacity"
|
class="size-11 opacity-25 hover:opacity-100 transition-opacity"
|
||||||
:class="{ 'opacity-100': activeIndex === index }"
|
:class="{ 'opacity-100': activeIndex === index }"
|
||||||
@click="onSelect(index)"
|
@click="select(index)"
|
||||||
>
|
>
|
||||||
<img :src="item" width="44" height="44" class="rounded-lg">
|
<img :src="item" width="44" height="44" class="rounded-lg">
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { refDebounced } from '@vueuse/core'
|
||||||
|
|
||||||
const searchTerm = ref('')
|
const searchTerm = ref('')
|
||||||
const searchTermDebounced = refDebounced(searchTerm, 200)
|
const searchTermDebounced = refDebounced(searchTerm, 200)
|
||||||
|
|
||||||
const { data: users, status } = await useFetch('https://jsonplaceholder.typicode.com/users', {
|
const { data: users, status } = await useFetch('https://jsonplaceholder.typicode.com/users', {
|
||||||
key: 'command-palette-users',
|
|
||||||
params: { q: searchTermDebounced },
|
params: { q: searchTermDebounced },
|
||||||
transform: (data: { id: number, name: string, email: string }[]) => {
|
transform: (data: { id: number, name: string, email: string }[]) => {
|
||||||
return data?.map(user => ({ id: user.id, label: user.name, suffix: user.email, avatar: { src: `https://i.pravatar.cc/120?img=${user.id}` } })) || []
|
return data?.map(user => ({ id: user.id, label: user.name, suffix: user.email, avatar: { src: `https://i.pravatar.cc/120?img=${user.id}` } })) || []
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { refDebounced } from '@vueuse/core'
|
||||||
import type { AvatarProps } from '@nuxt/ui'
|
import type { AvatarProps } from '@nuxt/ui'
|
||||||
|
|
||||||
const searchTerm = ref('')
|
const searchTerm = ref('')
|
||||||
const searchTermDebounced = refDebounced(searchTerm, 200)
|
const searchTermDebounced = refDebounced(searchTerm, 200)
|
||||||
|
|
||||||
const { data: users, status } = await useFetch('https://jsonplaceholder.typicode.com/users', {
|
const { data: users, status } = await useFetch('https://jsonplaceholder.typicode.com/users', {
|
||||||
key: 'typicode-users',
|
|
||||||
params: { q: searchTermDebounced },
|
params: { q: searchTermDebounced },
|
||||||
transform: (data: { id: number, name: string }[]) => {
|
transform: (data: { id: number, name: string }[]) => {
|
||||||
return data?.map(user => ({
|
return data?.map(user => ({
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ const modal = overlay.create(LazyModalExample, {
|
|||||||
})
|
})
|
||||||
|
|
||||||
async function open() {
|
async function open() {
|
||||||
const shouldIncrement = await modal.open()
|
const instance = modal.open()
|
||||||
|
|
||||||
|
const shouldIncrement = await instance.result
|
||||||
|
|
||||||
if (shouldIncrement) {
|
if (shouldIncrement) {
|
||||||
count.value++
|
count.value++
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ const items = [
|
|||||||
class="w-full justify-center"
|
class="w-full justify-center"
|
||||||
:ui="{
|
:ui="{
|
||||||
viewport: 'sm:w-(--reka-navigation-menu-viewport-width)',
|
viewport: 'sm:w-(--reka-navigation-menu-viewport-width)',
|
||||||
|
content: 'sm:w-auto',
|
||||||
childList: 'sm:w-96',
|
childList: 'sm:w-96',
|
||||||
childLinkDescription: 'text-balance line-clamp-2'
|
childLinkDescription: 'text-balance line-clamp-2'
|
||||||
}"
|
}"
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { refDebounced } from '@vueuse/core'
|
||||||
import type { AvatarProps } from '@nuxt/ui'
|
import type { AvatarProps } from '@nuxt/ui'
|
||||||
|
|
||||||
const searchTerm = ref('')
|
const searchTerm = ref('')
|
||||||
const searchTermDebounced = refDebounced(searchTerm, 200)
|
const searchTermDebounced = refDebounced(searchTerm, 200)
|
||||||
|
|
||||||
const { data: users, status } = await useFetch('https://jsonplaceholder.typicode.com/users', {
|
const { data: users, status } = await useFetch('https://jsonplaceholder.typicode.com/users', {
|
||||||
key: 'typicode-users',
|
|
||||||
params: { q: searchTermDebounced },
|
params: { q: searchTermDebounced },
|
||||||
transform: (data: { id: number, name: string }[]) => {
|
transform: (data: { id: number, name: string }[]) => {
|
||||||
return data?.map(user => ({
|
return data?.map(user => ({
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ const slideover = overlay.create(LazySlideoverExample, {
|
|||||||
})
|
})
|
||||||
|
|
||||||
async function open() {
|
async function open() {
|
||||||
const shouldIncrement = await slideover.open()
|
const instance = slideover.open()
|
||||||
|
|
||||||
|
const shouldIncrement = await instance.result
|
||||||
|
|
||||||
if (shouldIncrement) {
|
if (shouldIncrement) {
|
||||||
count.value++
|
count.value++
|
||||||
|
|||||||
@@ -0,0 +1,203 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { h, resolveComponent } from 'vue'
|
||||||
|
import type { TableColumn } from '@nuxt/ui'
|
||||||
|
import { getGroupedRowModel, type GroupingOptions } from '@tanstack/vue-table'
|
||||||
|
|
||||||
|
const UBadge = resolveComponent('UBadge')
|
||||||
|
|
||||||
|
type Account = {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type PaymentStatus = 'paid' | 'failed' | 'refunded'
|
||||||
|
|
||||||
|
type Payment = {
|
||||||
|
id: string
|
||||||
|
date: string
|
||||||
|
status: PaymentStatus
|
||||||
|
email: string
|
||||||
|
amount: number
|
||||||
|
account: Account
|
||||||
|
}
|
||||||
|
|
||||||
|
const getColorByStatus = (status: PaymentStatus) => {
|
||||||
|
return {
|
||||||
|
paid: 'success',
|
||||||
|
failed: 'error',
|
||||||
|
refunded: 'neutral'
|
||||||
|
}[status]
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = ref<Payment[]>([
|
||||||
|
{
|
||||||
|
id: '4600',
|
||||||
|
date: '2024-03-11T15:30:00',
|
||||||
|
status: 'paid',
|
||||||
|
email: 'james.anderson@example.com',
|
||||||
|
amount: 594,
|
||||||
|
account: {
|
||||||
|
id: '1',
|
||||||
|
name: 'Account 1'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '4599',
|
||||||
|
date: '2024-03-11T10:10:00',
|
||||||
|
status: 'failed',
|
||||||
|
email: 'mia.white@example.com',
|
||||||
|
amount: 276,
|
||||||
|
account: {
|
||||||
|
id: '2',
|
||||||
|
name: 'Account 2'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '4598',
|
||||||
|
date: '2024-03-11T08:50:00',
|
||||||
|
status: 'refunded',
|
||||||
|
email: 'william.brown@example.com',
|
||||||
|
amount: 315,
|
||||||
|
account: {
|
||||||
|
id: '1',
|
||||||
|
name: 'Account 1'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '4597',
|
||||||
|
date: '2024-03-10T19:45:00',
|
||||||
|
status: 'paid',
|
||||||
|
email: 'emma.davis@example.com',
|
||||||
|
amount: 529,
|
||||||
|
account: {
|
||||||
|
id: '2',
|
||||||
|
name: 'Account 2'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: '4596',
|
||||||
|
date: '2024-03-10T15:55:00',
|
||||||
|
status: 'paid',
|
||||||
|
email: 'ethan.harris@example.com',
|
||||||
|
amount: 639,
|
||||||
|
account: {
|
||||||
|
id: '1',
|
||||||
|
name: 'Account 1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
const columns: TableColumn<Payment>[] = [
|
||||||
|
{
|
||||||
|
id: 'title',
|
||||||
|
header: 'Item'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'account_id',
|
||||||
|
accessorKey: 'account.id'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'id',
|
||||||
|
header: '#',
|
||||||
|
cell: ({ row }) =>
|
||||||
|
row.getIsGrouped()
|
||||||
|
? `${row.getValue('id')} records`
|
||||||
|
: `#${row.getValue('id')}`,
|
||||||
|
aggregationFn: 'count'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'date',
|
||||||
|
header: 'Date',
|
||||||
|
cell: ({ row }) => {
|
||||||
|
return new Date(row.getValue('date')).toLocaleString('en-US', {
|
||||||
|
day: 'numeric',
|
||||||
|
month: 'short',
|
||||||
|
hour: '2-digit',
|
||||||
|
minute: '2-digit',
|
||||||
|
hour12: false
|
||||||
|
})
|
||||||
|
},
|
||||||
|
aggregationFn: 'max'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'status',
|
||||||
|
header: 'Status'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'email',
|
||||||
|
header: 'Email',
|
||||||
|
meta: {
|
||||||
|
class: {
|
||||||
|
td: 'w-full'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cell: ({ row }) =>
|
||||||
|
row.getIsGrouped()
|
||||||
|
? `${row.getValue('email')} customers`
|
||||||
|
: row.getValue('email'),
|
||||||
|
aggregationFn: 'uniqueCount'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
accessorKey: 'amount',
|
||||||
|
header: () => h('div', { class: 'text-right' }, 'Amount'),
|
||||||
|
cell: ({ row }) => {
|
||||||
|
const amount = Number.parseFloat(row.getValue('amount'))
|
||||||
|
|
||||||
|
const formatted = new Intl.NumberFormat('en-US', {
|
||||||
|
style: 'currency',
|
||||||
|
currency: 'EUR'
|
||||||
|
}).format(amount)
|
||||||
|
|
||||||
|
return h('div', { class: 'text-right font-medium' }, formatted)
|
||||||
|
},
|
||||||
|
aggregationFn: 'sum'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
const grouping_options = ref<GroupingOptions>({
|
||||||
|
groupedColumnMode: 'remove',
|
||||||
|
getGroupedRowModel: getGroupedRowModel()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<UTable
|
||||||
|
:data="data"
|
||||||
|
:columns="columns"
|
||||||
|
:grouping="['account_id', 'status']"
|
||||||
|
:grouping-options="grouping_options"
|
||||||
|
:ui="{
|
||||||
|
root: 'min-w-full',
|
||||||
|
td: 'empty:p-0' // helps with the colspaned row added for expand slot
|
||||||
|
}"
|
||||||
|
>
|
||||||
|
<template #title-cell="{ row }">
|
||||||
|
<div v-if="row.getIsGrouped()" class="flex items-center">
|
||||||
|
<span
|
||||||
|
class="inline-block"
|
||||||
|
:style="{ width: `calc(${row.depth} * 1rem)` }"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<UButton
|
||||||
|
variant="outline"
|
||||||
|
color="neutral"
|
||||||
|
class="mr-2"
|
||||||
|
size="xs"
|
||||||
|
:icon="row.getIsExpanded() ? 'i-lucide-minus' : 'i-lucide-plus'"
|
||||||
|
@click="row.toggleExpanded()"
|
||||||
|
/>
|
||||||
|
<strong v-if="row.groupingColumnId === 'account_id'">{{
|
||||||
|
row.original.account.name
|
||||||
|
}}</strong>
|
||||||
|
<UBadge
|
||||||
|
v-else-if="row.groupingColumnId === 'status'"
|
||||||
|
:color="getColorByStatus(row.original.status)"
|
||||||
|
class="capitalize"
|
||||||
|
variant="subtle"
|
||||||
|
>
|
||||||
|
{{ row.original.status }}
|
||||||
|
</UBadge>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</UTable>
|
||||||
|
</template>
|
||||||
@@ -26,7 +26,7 @@ const state = reactive({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UTabs :items="items" variant="link" class="gap-4 w-full" :ui="{ trigger: 'flex-1' }">
|
<UTabs :items="items" variant="link" class="gap-4 w-full" :ui="{ trigger: 'grow' }">
|
||||||
<template #account="{ item }">
|
<template #account="{ item }">
|
||||||
<p class="text-muted mb-4">
|
<p class="text-muted mb-4">
|
||||||
{{ item.description }}
|
{{ item.description }}
|
||||||
|
|||||||
@@ -1,22 +1,32 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { TabsItem } from '@nuxt/ui'
|
import type { TabsItem } from '@nuxt/ui'
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
const items: TabsItem[] = [
|
const items: TabsItem[] = [
|
||||||
{
|
{
|
||||||
label: 'Account'
|
label: 'Account',
|
||||||
|
value: 'account'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Password'
|
label: 'Password',
|
||||||
|
value: 'password'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
const active = ref('0')
|
const active = computed({
|
||||||
|
get() {
|
||||||
// Note: This is for demonstration purposes only. Don't do this at home.
|
return (route.query.tab as string) || 'account'
|
||||||
onMounted(() => {
|
},
|
||||||
setInterval(() => {
|
set(tab) {
|
||||||
active.value = String((Number(active.value) + 1) % items.length)
|
// Hash is specified here to prevent the page from scrolling to the top
|
||||||
}, 2000)
|
router.push({
|
||||||
|
path: '/components/tabs',
|
||||||
|
query: { tab },
|
||||||
|
hash: '#control-active-item'
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export function useLinks() {
|
|||||||
label: 'Raycast Extension',
|
label: 'Raycast Extension',
|
||||||
description: 'Access Nuxt UI components without leaving your editor.',
|
description: 'Access Nuxt UI components without leaving your editor.',
|
||||||
icon: 'i-simple-icons-raycast',
|
icon: 'i-simple-icons-raycast',
|
||||||
to: 'https://www.raycast.com/HugoRCD/nuxt-ui',
|
to: 'https://www.raycast.com/HugoRCD/nuxt',
|
||||||
target: '_blank'
|
target: '_blank'
|
||||||
}, {
|
}, {
|
||||||
label: 'Figma to Code',
|
label: 'Figma to Code',
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ provide('navigation', mappedNavigation)
|
|||||||
<UApp>
|
<UApp>
|
||||||
<NuxtLoadingIndicator color="#FFF" />
|
<NuxtLoadingIndicator color="#FFF" />
|
||||||
|
|
||||||
<Banner />
|
<!-- <Banner /> -->
|
||||||
|
|
||||||
<Header :links="links" />
|
<Header :links="links" />
|
||||||
|
|
||||||
|
|||||||
@@ -65,13 +65,17 @@ if (!import.meta.prerender) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const type = page.value?.path.includes('components') ? 'Vue Component ' : page.value?.path.includes('composables') ? 'Vue Composable ' : ''
|
const title = page.value?.navigation?.title ? page.value.navigation.title : page.value?.title
|
||||||
|
const prefix = page.value?.path.includes('components') || page.value?.path.includes('composables') ? 'Vue ' : ''
|
||||||
|
const suffix = page.value?.path.includes('components') ? 'Component ' : page.value?.path.includes('composables') ? 'Composable ' : ''
|
||||||
|
const description = page.value?.description
|
||||||
|
|
||||||
useSeoMeta({
|
useSeoMeta({
|
||||||
titleTemplate: `%s ${type}- Nuxt UI ${page.value.module === 'ui-pro' ? 'Pro' : ''} ${page.value.framework === 'vue' ? ' for Vue' : ''}`,
|
titleTemplate: `${prefix}%s ${suffix}- Nuxt UI ${page.value?.module === 'ui-pro' ? 'Pro' : ''} ${page.value?.framework === 'vue' ? ' for Vue' : ''}`,
|
||||||
title: page.value.navigation?.title ? page.value.navigation.title : page.value.title,
|
title,
|
||||||
ogTitle: `${page.value.navigation?.title ? page.value.navigation.title : page.value.title} ${type}- Nuxt UI ${page.value.module === 'ui-pro' ? 'Pro' : ''} ${page.value.framework === 'vue' ? ' for Vue' : ''}`,
|
ogTitle: `${prefix}${title} ${suffix}- Nuxt UI ${page.value?.module === 'ui-pro' ? 'Pro' : ''} ${page.value?.framework === 'vue' ? ' for Vue' : ''}`,
|
||||||
description: page.value.description,
|
description,
|
||||||
ogDescription: page.value.description
|
ogDescription: description
|
||||||
})
|
})
|
||||||
|
|
||||||
if (route.path.startsWith('/components')) {
|
if (route.path.startsWith('/components')) {
|
||||||
|
|||||||
@@ -1,8 +1,20 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
const colorMode = useColorMode()
|
||||||
|
const appConfig = useAppConfig()
|
||||||
|
|
||||||
const name = route.params.slug?.[0]
|
const name = route.params.slug?.[0]
|
||||||
|
|
||||||
|
if (route.query.theme) {
|
||||||
|
colorMode.preference = route.query.theme === 'light' ? 'light' : 'dark'
|
||||||
|
}
|
||||||
|
if (route.query.neutral) {
|
||||||
|
appConfig.ui.colors.neutral = route.query.neutral as string
|
||||||
|
}
|
||||||
|
if (route.query.primary) {
|
||||||
|
appConfig.ui.colors.primary = route.query.primary as string
|
||||||
|
}
|
||||||
|
|
||||||
const width = computed(() => route.query.width && Number.parseInt(route.query.width as string) > 0 ? `${Number.parseInt(route.query.width as string) - 2}px` : '864px')
|
const width = computed(() => route.query.width && Number.parseInt(route.query.width as string) > 0 ? `${Number.parseInt(route.query.width as string) - 2}px` : '864px')
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -24,32 +24,41 @@ onMounted(async () => {
|
|||||||
const nuxtWordPosition = document.querySelector('#nuxt')?.getBoundingClientRect()
|
const nuxtWordPosition = document.querySelector('#nuxt')?.getBoundingClientRect()
|
||||||
const initialScrollX = window.scrollX
|
const initialScrollX = window.scrollX
|
||||||
const initialScrollY = window.scrollY
|
const initialScrollY = window.scrollY
|
||||||
if (figmaWordPosition && nuxtWordPosition) {
|
|
||||||
animate('#cursor1', { left: Math.round(Math.random() * window.outerWidth), top: Math.round(Math.random() * window.outerHeight) }, { duration: 0.1 })
|
|
||||||
.then(() => animate('#cursor1', { opacity: 1 }, { duration: 0.3 }))
|
|
||||||
.then(() => {
|
|
||||||
return animate('#cursor1', {
|
|
||||||
left: Math.round(figmaWordPosition.left + initialScrollX + figmaWordPosition.width / 2),
|
|
||||||
top: Math.round(figmaWordPosition.top + initialScrollY - figmaWordPosition.height / 4)
|
|
||||||
}, { duration: 1.5, delay: 0.2, ease: 'easeInOut' })
|
|
||||||
})
|
|
||||||
.then(() => animate('#cursor1', { scale: 0.8 }, { duration: 0.1, ease: 'easeOut' }))
|
|
||||||
.then(() => animate('#cursor1', { scale: 1 }, { duration: 0.1, ease: 'easeOut' }))
|
|
||||||
.then(() => animate('#figma', { color: 'var(--ui-info)' }, { duration: 0.3, ease: 'easeOut' }))
|
|
||||||
.then(() => animate('#cursor1', { left: Math.round(figmaWordPosition.left + initialScrollX + figmaWordPosition.width), top: Math.round(figmaWordPosition.top + initialScrollY) }, { duration: 0.6, ease: 'easeInOut' }))
|
|
||||||
|
|
||||||
animate('#cursor2', { left: Math.round(Math.random() * window.outerWidth), top: Math.round(Math.random() * window.outerHeight) }, { duration: 0.1, delay: 0.6 })
|
if (figmaWordPosition && nuxtWordPosition) {
|
||||||
.then(() => animate('#cursor2', { opacity: 1 }, { duration: 0.3 }))
|
const cursor1Sequence = async () => {
|
||||||
.then(() => {
|
await animate('#cursor1', { left: Math.round(Math.random() * window.outerWidth), top: Math.round(Math.random() * window.outerHeight) }, { duration: 0.1 }).finished
|
||||||
return animate('#cursor2', {
|
await animate('#cursor1', { opacity: 1 }, { duration: 0.3 }).finished
|
||||||
left: Math.round(nuxtWordPosition.left + initialScrollX + nuxtWordPosition.width / 2),
|
await animate('#cursor1', {
|
||||||
top: Math.round(nuxtWordPosition.top + initialScrollY - nuxtWordPosition.height / 4)
|
left: Math.round(figmaWordPosition.left + initialScrollX + figmaWordPosition.width / 2),
|
||||||
}, { duration: 1.5, delay: 0.2, ease: 'easeInOut' })
|
top: Math.round(figmaWordPosition.top + initialScrollY - figmaWordPosition.height / 4)
|
||||||
})
|
}, { duration: 1.5, delay: 0.2, ease: 'easeInOut' }).finished
|
||||||
.then(() => animate('#cursor2', { scale: 0.8 }, { duration: 0.1, ease: 'easeOut' }))
|
await animate('#cursor1', { scale: 0.8 }, { duration: 0.1, ease: 'easeOut' }).finished
|
||||||
.then(() => animate('#cursor2', { scale: 1 }, { duration: 0.1, ease: 'easeOut' }))
|
await animate('#cursor1', { scale: 1 }, { duration: 0.1, ease: 'easeOut' }).finished
|
||||||
.then(() => animate('#nuxt', { color: 'var(--ui-success)' }, { duration: 0.3, ease: 'easeOut' }))
|
await animate('#figma', { color: 'var(--ui-info)' }, { duration: 0.3, ease: 'easeOut' }).finished
|
||||||
.then(() => animate('#cursor2', { left: Math.round(nuxtWordPosition.left + initialScrollX + nuxtWordPosition.width), top: Math.round(nuxtWordPosition.top + initialScrollY) }, { duration: 0.6, ease: 'easeInOut' }))
|
await animate('#cursor1', {
|
||||||
|
left: Math.round(figmaWordPosition.left + initialScrollX + figmaWordPosition.width),
|
||||||
|
top: Math.round(figmaWordPosition.top + initialScrollY)
|
||||||
|
}, { duration: 0.6, ease: 'easeInOut' }).finished
|
||||||
|
}
|
||||||
|
|
||||||
|
const cursor2Sequence = async () => {
|
||||||
|
await animate('#cursor2', { left: Math.round(Math.random() * window.outerWidth), top: Math.round(Math.random() * window.outerHeight) }, { duration: 0.1, delay: 0.6 }).finished
|
||||||
|
await animate('#cursor2', { opacity: 1 }, { duration: 0.3 }).finished
|
||||||
|
await animate('#cursor2', {
|
||||||
|
left: Math.round(nuxtWordPosition.left + initialScrollX + nuxtWordPosition.width / 2),
|
||||||
|
top: Math.round(nuxtWordPosition.top + initialScrollY - nuxtWordPosition.height / 4)
|
||||||
|
}, { duration: 1.5, delay: 0.2, ease: 'easeInOut' }).finished
|
||||||
|
await animate('#cursor2', { scale: 0.8 }, { duration: 0.1, ease: 'easeOut' }).finished
|
||||||
|
await animate('#cursor2', { scale: 1 }, { duration: 0.1, ease: 'easeOut' }).finished
|
||||||
|
await animate('#nuxt', { color: 'var(--ui-success)' }, { duration: 0.3, ease: 'easeOut' }).finished
|
||||||
|
await animate('#cursor2', {
|
||||||
|
left: Math.round(nuxtWordPosition.left + initialScrollX + nuxtWordPosition.width),
|
||||||
|
top: Math.round(nuxtWordPosition.top + initialScrollY)
|
||||||
|
}, { duration: 0.6, ease: 'easeInOut' }).finished
|
||||||
|
}
|
||||||
|
|
||||||
|
await Promise.all([cursor1Sequence(), cursor2Sequence()])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ useIntersectionObserver(contributorsRef, ([entry]) => {
|
|||||||
<li>
|
<li>
|
||||||
<NuxtLink to="https://github.com/nuxt/ui/graphs/contributors" target="_blank" class="min-w-0">
|
<NuxtLink to="https://github.com/nuxt/ui/graphs/contributors" target="_blank" class="min-w-0">
|
||||||
<p class="text-4xl font-semibold text-highlighted truncate">
|
<p class="text-4xl font-semibold text-highlighted truncate">
|
||||||
175+
|
200+
|
||||||
</p>
|
</p>
|
||||||
<p class="text-muted text-sm truncate">Contributors</p>
|
<p class="text-muted text-sm truncate">Contributors</p>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
|
|||||||
@@ -16,6 +16,32 @@ links:
|
|||||||
variant: outline
|
variant: outline
|
||||||
trailingIcon: i-lucide-arrow-right
|
trailingIcon: i-lucide-arrow-right
|
||||||
templates:
|
templates:
|
||||||
|
- title: 'Portfolio'
|
||||||
|
description: "A sleek, modern portfolio template to showcase your work, skills, blog posts, speaking engagements, and provide contact information. Which can customized easily from the `content/` directory."
|
||||||
|
icon: i-lucide-user
|
||||||
|
thumbnail:
|
||||||
|
dark: https://assets.hub.nuxt.com/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL3BvcnRmb2xpby10ZW1wbGF0ZS5udXh0LmRldiIsImlhdCI6MTc0NTkzNDczMX0.XDWnQoyVy3XVtKQD6PLQ8RFUwr4yr1QnVwPxRrjCrro.jpg?theme=dark
|
||||||
|
light: https://assets.hub.nuxt.com/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL3BvcnRmb2xpby10ZW1wbGF0ZS5udXh0LmRldiIsImlhdCI6MTc0NTkzNDczMX0.XDWnQoyVy3XVtKQD6PLQ8RFUwr4yr1QnVwPxRrjCrro.jpg?theme=light
|
||||||
|
features:
|
||||||
|
- title: Sections for Projects, Blog, Speaking & About
|
||||||
|
icon: i-lucide-layout-list
|
||||||
|
- title: Easily editable content via Markdown & YAML
|
||||||
|
icon: i-simple-icons-markdown
|
||||||
|
- title: Fully responsive design
|
||||||
|
icon: i-lucide-smartphone
|
||||||
|
links:
|
||||||
|
- label: Preview
|
||||||
|
to: https://portfolio-template.nuxt.dev
|
||||||
|
target: _blank
|
||||||
|
leadingIcon: i-logos-nuxt-icon
|
||||||
|
trailingIcon: i-lucide-arrow-up-right
|
||||||
|
color: neutral
|
||||||
|
- label: Nuxt Template
|
||||||
|
to: https://github.com/nuxt-ui-pro/portfolio
|
||||||
|
target: _blank
|
||||||
|
icon: i-simple-icons-github
|
||||||
|
color: neutral
|
||||||
|
variant: outline
|
||||||
- title: 'Chat'
|
- title: 'Chat'
|
||||||
description: "An AI chatbot template designed to help you build your own chatbot with Nuxt UI Pro components and deployed on [NuxtHub](https://hub.nuxt.com)."
|
description: "An AI chatbot template designed to help you build your own chatbot with Nuxt UI Pro components and deployed on [NuxtHub](https://hub.nuxt.com)."
|
||||||
icon: i-lucide-message-circle
|
icon: i-lucide-message-circle
|
||||||
|
|||||||
@@ -48,13 +48,14 @@ const icons = {
|
|||||||
</UPageHero>
|
</UPageHero>
|
||||||
|
|
||||||
<UPageSection :ui="{ container: '!pt-0' }">
|
<UPageSection :ui="{ container: '!pt-0' }">
|
||||||
<UPageGrid class="xl:grid-cols-4">
|
<UPageGrid class="xl:grid-cols-5">
|
||||||
<UPageCard
|
<UPageCard
|
||||||
v-for="(user, index) in module?.team"
|
v-for="(user, index) in module?.team"
|
||||||
:key="index"
|
:key="index"
|
||||||
:title="user.name"
|
:title="user.name"
|
||||||
:description="[user.pronouns, user.location].filter(Boolean).join(' ・ ')"
|
:description="[user.pronouns, user.location].filter(Boolean).join(' ・ ')"
|
||||||
:ui="{
|
:ui="{
|
||||||
|
wrapper: 'items-center',
|
||||||
container: 'gap-y-4 lg:p-8',
|
container: 'gap-y-4 lg:p-8',
|
||||||
leading: 'flex justify-center',
|
leading: 'flex justify-center',
|
||||||
title: 'text-center',
|
title: 'text-center',
|
||||||
@@ -123,6 +124,7 @@ const icons = {
|
|||||||
:key="contributor.username"
|
:key="contributor.username"
|
||||||
:title="contributor.username"
|
:title="contributor.username"
|
||||||
:ui="{
|
:ui="{
|
||||||
|
wrapper: 'items-center',
|
||||||
container: 'gap-y-2',
|
container: 'gap-y-2',
|
||||||
leading: 'flex justify-center',
|
leading: 'flex justify-center',
|
||||||
title: 'text-center',
|
title: 'text-center',
|
||||||
|
|||||||
@@ -504,7 +504,7 @@ const count = ref(0)
|
|||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
Closing a modal is now done through the `close` event. The `modal.open` method now returns a promise that resolves to the result of the modal whenever the modal is close:
|
Closing a modal is now done through the `close` event. The `modal.open` method now returns an instance that can be used to await for the result of the modal whenever the modal is closed:
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -523,10 +523,12 @@ import { ModalExampleComponent } from '#components'
|
|||||||
- })
|
- })
|
||||||
- }
|
- }
|
||||||
+ async function openModal() {
|
+ async function openModal() {
|
||||||
+ const result = await modal.open(ModalExampleComponent, {
|
+ const instance = modal.open(ModalExampleComponent, {
|
||||||
+ count: count.value
|
+ count: count.value
|
||||||
+ })
|
+ })
|
||||||
+
|
+
|
||||||
|
+ const result = await instance.result
|
||||||
|
+
|
||||||
+ if (result) {
|
+ if (result) {
|
||||||
+ toast.add({ title: 'Success!' })
|
+ toast.add({ title: 'Success!' })
|
||||||
+ }
|
+ }
|
||||||
|
|||||||
@@ -229,6 +229,10 @@ export default defineConfig({
|
|||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
::caution
|
||||||
|
When configuring your theme colors, you must use either color names from the [default Tailwind palette](https://tailwindcss.com/docs/colors) (like 'blue', 'green', etc.) or reference custom colors that you've previously defined in your [CSS file](#theme).
|
||||||
|
::
|
||||||
|
|
||||||
### Extend colors
|
### Extend colors
|
||||||
|
|
||||||
::framework-only
|
::framework-only
|
||||||
@@ -727,15 +731,22 @@ This is how the `@theme` is generated for each design token:
|
|||||||
--border-color-muted: var(--ui-border-muted);
|
--border-color-muted: var(--ui-border-muted);
|
||||||
--border-color-accented: var(--ui-border-accented);
|
--border-color-accented: var(--ui-border-accented);
|
||||||
--border-color-inverted: var(--ui-border-inverted);
|
--border-color-inverted: var(--ui-border-inverted);
|
||||||
|
--border-color-bg: var(--ui-bg);
|
||||||
--ring-color-default: var(--ui-border);
|
--ring-color-default: var(--ui-border);
|
||||||
--ring-color-muted: var(--ui-border-muted);
|
--ring-color-muted: var(--ui-border-muted);
|
||||||
--ring-color-accented: var(--ui-border-accented);
|
--ring-color-accented: var(--ui-border-accented);
|
||||||
--ring-color-inverted: var(--ui-border-inverted);
|
--ring-color-inverted: var(--ui-border-inverted);
|
||||||
--ring-color-bg: var(--ui-bg);
|
--ring-color-bg: var(--ui-bg);
|
||||||
|
--ring-offset-color-default: var(--ui-border);
|
||||||
|
--ring-offset-color-muted: var(--ui-border-muted);
|
||||||
|
--ring-offset-color-accented: var(--ui-border-accented);
|
||||||
|
--ring-offset-color-inverted: var(--ui-border-inverted);
|
||||||
|
--ring-offset-color-bg: var(--ui-bg);
|
||||||
--divide-color-default: var(--ui-border);
|
--divide-color-default: var(--ui-border);
|
||||||
--divide-color-muted: var(--ui-border-muted);
|
--divide-color-muted: var(--ui-border-muted);
|
||||||
--divide-color-accented: var(--ui-border-accented);
|
--divide-color-accented: var(--ui-border-accented);
|
||||||
--divide-color-inverted: var(--ui-border-inverted);
|
--divide-color-inverted: var(--ui-border-inverted);
|
||||||
|
--divide-color-bg: var(--ui-bg);
|
||||||
--outline-color-default: var(--ui-border);
|
--outline-color-default: var(--ui-border);
|
||||||
--outline-color-inverted: var(--ui-border-inverted);
|
--outline-color-inverted: var(--ui-border-inverted);
|
||||||
--stroke-color-default: var(--ui-border);
|
--stroke-color-default: var(--ui-border);
|
||||||
@@ -966,7 +977,7 @@ export default {
|
|||||||
|
|
||||||
```vue [src/runtime/components/Card.vue]
|
```vue [src/runtime/components/Card.vue]
|
||||||
<template>
|
<template>
|
||||||
<div :class="ui.root({ class: [props.class, props.ui?.root] })">
|
<div :class="ui.root({ class: [props.ui?.root, props.class] })">
|
||||||
<div :class="ui.header({ class: props.ui?.header })">
|
<div :class="ui.header({ class: props.ui?.header })">
|
||||||
<slot name="header" />
|
<slot name="header" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Here's an overview of the key directories and files in the Nuxt UI project struc
|
|||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
|
|
||||||
The documentation lives in the `docs` folder as a Nuxt app using `@nuxt/content` v3 to generate pages from Markdown files. See the [Content v3 Docs](https://content3.nuxt.dev/docs/getting-started) for details on how it works. Here's a breakdown of its structure:
|
The documentation lives in the `docs` folder as a Nuxt app using `@nuxt/content` v3 to generate pages from Markdown files. See the [Nuxt Content documentation](https://content.nuxt.com/docs/getting-started) for details on how it works. Here's a breakdown of its structure:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
├── app/
|
├── app/
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ defineShortcuts({
|
|||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- Shortcuts are automatically adjusted for non-macOS platforms, converting `meta` to `ctrl`.
|
||||||
- The composable uses VueUse's [`useEventListener`](https://vueuse.org/core/useEventListener/) to handle keydown events.
|
- The composable uses VueUse's [`useEventListener`](https://vueuse.org/core/useEventListener/) to handle keydown events.
|
||||||
- For a complete list of available shortcut keys, refer to the [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values) API documentation. Note that the key should be written in lowercase.
|
- For a complete list of available shortcut keys, refer to the [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values) API documentation. Note that the key should be written in lowercase.
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ Shortcuts are defined using the following format:
|
|||||||
|
|
||||||
#### Modifiers
|
#### Modifiers
|
||||||
|
|
||||||
- `meta`: Represents `⌘ Command` on macOS and `⊞ Windows` on Windows
|
- `meta`: Represents `⌘ Command` on macOS and `Ctrl` on other platforms
|
||||||
- `ctrl`: Represents `Ctrl` on all platforms
|
- `ctrl`: Represents `Ctrl` on all platforms
|
||||||
- `shift`: Used for alphabetic keys when Shift is required
|
- `shift`: Used for alphabetic keys when Shift is required
|
||||||
|
|
||||||
|
|||||||
@@ -22,14 +22,14 @@ async function openModal() {
|
|||||||
- The `useOverlay` composable is created using `createSharedComposable`, ensuring that the same overlay state is shared across your entire application.
|
- The `useOverlay` composable is created using `createSharedComposable`, ensuring that the same overlay state is shared across your entire application.
|
||||||
|
|
||||||
::note
|
::note
|
||||||
In order to return a value from the overlay, the `overlay.open()` can be awaited. In order for this to work, however, the **overlay component must emit a `close` event**. See example below for details.
|
In order to return a value from the overlay, the `overlay.open().instance.result` can be awaited. In order for this to work, however, the **overlay component must emit a `close` event**. See example below for details.
|
||||||
::
|
::
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
### `create(component: T, options: OverlayOptions): OverlayInstance`
|
### `create(component: T, options: OverlayOptions): OverlayInstance`
|
||||||
|
|
||||||
Creates an overlay, and returns its instance
|
Creates an overlay, and returns a factory instance
|
||||||
|
|
||||||
- Parameters:
|
- Parameters:
|
||||||
- `component`: The overlay component
|
- `component`: The overlay component
|
||||||
@@ -38,7 +38,7 @@ Creates an overlay, and returns its instance
|
|||||||
- `props?: ComponentProps`: An optional object of props to pass to the rendered component.
|
- `props?: ComponentProps`: An optional object of props to pass to the rendered component.
|
||||||
- `destroyOnClose?: boolean` Removes the overlay from memory when closed `default: false`
|
- `destroyOnClose?: boolean` Removes the overlay from memory when closed `default: false`
|
||||||
|
|
||||||
### `open(id: symbol, props?: ComponentProps<T>): Promise<any>`
|
### `open(id: symbol, props?: ComponentProps<T>): OpenedOverlay<T>`
|
||||||
|
|
||||||
Opens the overlay using its `id`
|
Opens the overlay using its `id`
|
||||||
|
|
||||||
@@ -62,10 +62,17 @@ Update an overlay using its `id`
|
|||||||
- `id`: The identifier of the overlay
|
- `id`: The identifier of the overlay
|
||||||
- `props`: An object of props to update on the rendered component.
|
- `props`: An object of props to update on the rendered component.
|
||||||
|
|
||||||
### `unmount(id: symbol): void`
|
### `unMount(id: symbol): void`
|
||||||
|
|
||||||
Removes the overlay from the DOM using its `id`
|
Removes the overlay from the DOM using its `id`
|
||||||
|
|
||||||
|
- Parameters:
|
||||||
|
- `id`: The identifier of the overlay
|
||||||
|
|
||||||
|
### `isOpen(id: symbol): boolean`
|
||||||
|
|
||||||
|
Checks if an overlay its open using its `id`
|
||||||
|
|
||||||
- Parameters:
|
- Parameters:
|
||||||
- `id`: The identifier of the overlay
|
- `id`: The identifier of the overlay
|
||||||
|
|
||||||
@@ -75,7 +82,7 @@ In-memory list of overlays that were created
|
|||||||
|
|
||||||
## Overlay Instance API
|
## Overlay Instance API
|
||||||
|
|
||||||
### `open(props?: ComponentProps<T>): Promise<any>`
|
### `open(props?: ComponentProps<T>): Promise<OpenedOverlay<T>>`
|
||||||
|
|
||||||
Opens the overlay
|
Opens the overlay
|
||||||
|
|
||||||
@@ -138,7 +145,7 @@ const overlay = useOverlay()
|
|||||||
|
|
||||||
// Create with default props
|
// Create with default props
|
||||||
const modalA = overlay.create(ModalA, { title: 'Welcome' })
|
const modalA = overlay.create(ModalA, { title: 'Welcome' })
|
||||||
const modalB = overlay.create(modalB)
|
const modalB = overlay.create(ModalB)
|
||||||
|
|
||||||
const slideoverA = overlay.create(SlideoverA)
|
const slideoverA = overlay.create(SlideoverA)
|
||||||
|
|
||||||
@@ -149,7 +156,9 @@ const openModalA = () => {
|
|||||||
|
|
||||||
const openModalB = async () => {
|
const openModalB = async () => {
|
||||||
// Open modalB, and wait for its result
|
// Open modalB, and wait for its result
|
||||||
const input = await modalB.open()
|
const modalBInstance = modalB.open()
|
||||||
|
|
||||||
|
const input = await modalBInstance.result
|
||||||
|
|
||||||
// Pass the result from modalB to the slideover, and open it.
|
// Pass the result from modalB to the slideover, and open it.
|
||||||
slideoverA.open({ input })
|
slideoverA.open({ input })
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ Use the `items` prop as an array of objects with the following properties:
|
|||||||
- `value?: string`{lang="ts-type"}
|
- `value?: string`{lang="ts-type"}
|
||||||
- `disabled?: boolean`{lang="ts-type"}
|
- `disabled?: boolean`{lang="ts-type"}
|
||||||
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { item?: ClassNameValue, header?: ClassNameValue, trigger?: ClassNameValue, leadingIcon?: ClassNameValue, label?: ClassNameValue, trailingIcon?: ClassNameValue, content?: ClassNameValue, body?: ClassNameValue }`{lang="ts-type"}
|
||||||
|
|
||||||
::component-code
|
::component-code
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -16,8 +16,9 @@ Use the `items` prop as an array of objects with the following properties:
|
|||||||
- `label?: string`{lang="ts-type"}
|
- `label?: string`{lang="ts-type"}
|
||||||
- `icon?: string`{lang="ts-type"}
|
- `icon?: string`{lang="ts-type"}
|
||||||
- `avatar?: AvatarProps`{lang="ts-type"}
|
- `avatar?: AvatarProps`{lang="ts-type"}
|
||||||
- `class?: any`{lang="ts-type"}
|
|
||||||
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { item?: ClassNameValue, link?: ClassNameValue, linkLeadingIcon?: ClassNameValue, linkLeadingAvatar?: ClassNameValue, linkLabel?: ClassNameValue, separator?: ClassNameValue, separatorIcon?: ClassNameValue }`{lang="ts-type"}
|
||||||
|
|
||||||
You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc.
|
You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc.
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ class: 'p-8'
|
|||||||
---
|
---
|
||||||
::
|
::
|
||||||
|
|
||||||
|
You can also pass an array of objects with the following properties:
|
||||||
|
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { item?: ClassNameValue }`{lang="ts-type"}
|
||||||
|
|
||||||
You can control how many items are visible by using the [`basis`](https://tailwindcss.com/docs/flex-basis) / [`width`](https://tailwindcss.com/docs/width) utility classes on the `item`:
|
You can control how many items are visible by using the [`basis`](https://tailwindcss.com/docs/flex-basis) / [`width`](https://tailwindcss.com/docs/width) utility classes on the `item`:
|
||||||
|
|
||||||
::component-example
|
::component-example
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ You can also pass an array of objects with the following properties:
|
|||||||
- `description?: string`{lang="ts-type"}
|
- `description?: string`{lang="ts-type"}
|
||||||
- [`value?: string`{lang="ts-type"}](#value-key)
|
- [`value?: string`{lang="ts-type"}](#value-key)
|
||||||
- `disabled?: boolean`{lang="ts-type"}
|
- `disabled?: boolean`{lang="ts-type"}
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { item?: ClassNameValue, container?: ClassNameValue, base?: ClassNameValue, 'indicator'?: ClassNameValue, icon?: ClassNameValue, wrapper?: ClassNameValue, label?: ClassNameValue, description?: ClassNameValue }`{lang="ts-type"}
|
||||||
|
|
||||||
::component-code
|
::component-code
|
||||||
---
|
---
|
||||||
@@ -199,6 +201,7 @@ items:
|
|||||||
variant:
|
variant:
|
||||||
- list
|
- list
|
||||||
- card
|
- card
|
||||||
|
- table
|
||||||
props:
|
props:
|
||||||
color: 'primary'
|
color: 'primary'
|
||||||
variant: 'card'
|
variant: 'card'
|
||||||
@@ -229,6 +232,7 @@ items:
|
|||||||
variant:
|
variant:
|
||||||
- list
|
- list
|
||||||
- card
|
- card
|
||||||
|
- table
|
||||||
props:
|
props:
|
||||||
size: 'xl'
|
size: 'xl'
|
||||||
variant: 'list'
|
variant: 'list'
|
||||||
@@ -259,6 +263,7 @@ items:
|
|||||||
variant:
|
variant:
|
||||||
- list
|
- list
|
||||||
- card
|
- card
|
||||||
|
- table
|
||||||
props:
|
props:
|
||||||
orientation: 'horizontal'
|
orientation: 'horizontal'
|
||||||
variant: 'list'
|
variant: 'list'
|
||||||
@@ -293,6 +298,7 @@ items:
|
|||||||
variant:
|
variant:
|
||||||
- list
|
- list
|
||||||
- card
|
- card
|
||||||
|
- table
|
||||||
props:
|
props:
|
||||||
indicator: 'end'
|
indicator: 'end'
|
||||||
variant: 'card'
|
variant: 'card'
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ links:
|
|||||||
icon: i-custom-fuse-js
|
icon: i-custom-fuse-js
|
||||||
to: https://fusejs.io/
|
to: https://fusejs.io/
|
||||||
target: _blank
|
target: _blank
|
||||||
- label: Combobox
|
- label: Listbox
|
||||||
icon: i-custom-reka-ui
|
icon: i-custom-reka-ui
|
||||||
to: https://reka-ui.com/docs/components/combobox
|
to: https://reka-ui.com/docs/components/listbox
|
||||||
- label: GitHub
|
- label: GitHub
|
||||||
icon: i-simple-icons-github
|
icon: i-simple-icons-github
|
||||||
to: https://github.com/nuxt/ui/tree/v3/src/runtime/components/CommandPalette.vue
|
to: https://github.com/nuxt/ui/tree/v3/src/runtime/components/CommandPalette.vue
|
||||||
@@ -53,6 +53,8 @@ Each group contains an `items` array of objects that define the commands. Each i
|
|||||||
- `disabled?: boolean`{lang="ts-type"}
|
- `disabled?: boolean`{lang="ts-type"}
|
||||||
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
||||||
- `onSelect?(e?: Event): void`{lang="ts-type"}
|
- `onSelect?(e?: Event): void`{lang="ts-type"}
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { item?: ClassNameValue, itemLeadingIcon?: ClassNameValue, itemLeadingAvatarSize?: ClassNameValue, itemLeadingAvatar?: ClassNameValue, itemLeadingChipSize?: ClassNameValue, itemLeadingChip?: ClassNameValue, itemLabel?: ClassNameValue, itemLabelPrefix?: ClassNameValue, itemLabelBase?: ClassNameValue, itemLabelSuffix?: ClassNameValue, itemTrailing?: ClassNameValue, itemTrailingKbds?: ClassNameValue, itemTrailingKbdsSize?: ClassNameValue, itemTrailingHighlightedIcon?: ClassNameValue, itemTrailingIcon?: ClassNameValue,}`{lang="ts-type"}
|
||||||
|
|
||||||
You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc.
|
You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc.
|
||||||
|
|
||||||
|
|||||||
@@ -28,11 +28,12 @@ Use the `items` prop as an array of objects with the following properties:
|
|||||||
- [`color?: "error" | "primary" | "secondary" | "success" | "info" | "warning" | "neutral"`{lang="ts-type"}](#with-color-items)
|
- [`color?: "error" | "primary" | "secondary" | "success" | "info" | "warning" | "neutral"`{lang="ts-type"}](#with-color-items)
|
||||||
- [`checked?: boolean`{lang="ts-type"}](#with-checkbox-items)
|
- [`checked?: boolean`{lang="ts-type"}](#with-checkbox-items)
|
||||||
- `disabled?: boolean`{lang="ts-type"}
|
- `disabled?: boolean`{lang="ts-type"}
|
||||||
- `class?: any`{lang="ts-type"}
|
|
||||||
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
||||||
- `onSelect?(e: Event): void`{lang="ts-type"}
|
- `onSelect?(e: Event): void`{lang="ts-type"}
|
||||||
- [`onUpdateChecked?(checked: boolean): void`{lang="ts-type"}](#with-checkbox-items)
|
- [`onUpdateChecked?(checked: boolean): void`{lang="ts-type"}](#with-checkbox-items)
|
||||||
- `children?: ContextMenuItem[] | ContextMenuItem[][]`{lang="ts-type"}
|
- `children?: ContextMenuItem[] | ContextMenuItem[][]`{lang="ts-type"}
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { item?: ClassNameValue, label?: ClassNameValue, separator?: ClassNameValue, itemLeadingIcon?: ClassNameValue, itemLeadingAvatarSize?: ClassNameValue, itemLeadingAvatar?: ClassNameValue, itemLabel?: ClassNameValue, itemLabelExternalIcon?: ClassNameValue, itemTrailing?: ClassNameValue, itemTrailingIcon?: ClassNameValue, itemTrailingKbds?: ClassNameValue, itemTrailingKbdsSize?: ClassNameValue }`{lang="ts-type"}
|
||||||
|
|
||||||
You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc.
|
You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc.
|
||||||
|
|
||||||
|
|||||||
@@ -28,11 +28,12 @@ Use the `items` prop as an array of objects with the following properties:
|
|||||||
- [`color?: "error" | "primary" | "secondary" | "success" | "info" | "warning" | "neutral"`{lang="ts-type"}](#with-color-items)
|
- [`color?: "error" | "primary" | "secondary" | "success" | "info" | "warning" | "neutral"`{lang="ts-type"}](#with-color-items)
|
||||||
- [`checked?: boolean`{lang="ts-type"}](#with-checkbox-items)
|
- [`checked?: boolean`{lang="ts-type"}](#with-checkbox-items)
|
||||||
- `disabled?: boolean`{lang="ts-type"}
|
- `disabled?: boolean`{lang="ts-type"}
|
||||||
- `class?: any`{lang="ts-type"}
|
|
||||||
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
||||||
- `onSelect?(e: Event): void`{lang="ts-type"}
|
- `onSelect?(e: Event): void`{lang="ts-type"}
|
||||||
- [`onUpdateChecked?(checked: boolean): void`{lang="ts-type"}](#with-checkbox-items)
|
- [`onUpdateChecked?(checked: boolean): void`{lang="ts-type"}](#with-checkbox-items)
|
||||||
- `children?: DropdownMenuItem[] | DropdownMenuItem[][]`{lang="ts-type"}
|
- `children?: DropdownMenuItem[] | DropdownMenuItem[][]`{lang="ts-type"}
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { item?: ClassNameValue, label?: ClassNameValue, separator?: ClassNameValue, itemLeadingIcon?: ClassNameValue, itemLeadingAvatarSize?: ClassNameValue, itemLeadingAvatar?: ClassNameValue, itemLabel?: ClassNameValue, itemLabelExternalIcon?: ClassNameValue, itemTrailing?: ClassNameValue, itemTrailingIcon?: ClassNameValue, itemTrailingKbds?: ClassNameValue, itemTrailingKbdsSize?: ClassNameValue }`{lang="ts-type"}
|
||||||
|
|
||||||
You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc.
|
You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc.
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ slots:
|
|||||||
The label `for` attribute and the form control are associated with a unique `id` if not provided.
|
The label `for` attribute and the form control are associated with a unique `id` if not provided.
|
||||||
::
|
::
|
||||||
|
|
||||||
When using the `required` prop, an asterisk is be added next to the label.
|
When using the `required` prop, an asterisk is added next to the label.
|
||||||
|
|
||||||
::component-code
|
::component-code
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ It requires two props:
|
|||||||
**No validation library is included** by default, ensure you **install the one you need**.
|
**No validation library is included** by default, ensure you **install the one you need**.
|
||||||
::
|
::
|
||||||
|
|
||||||
::tabs
|
::tabs{class="gap-0"}
|
||||||
::component-example{label="Valibot"}
|
::component-example{label="Valibot"}
|
||||||
---
|
---
|
||||||
name: 'form-example-valibot'
|
name: 'form-example-valibot'
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ You can also pass an array of objects with the following properties:
|
|||||||
- [`chip?: ChipProps`{lang="ts-type"}](#with-chip-in-items)
|
- [`chip?: ChipProps`{lang="ts-type"}](#with-chip-in-items)
|
||||||
- `disabled?: boolean`{lang="ts-type"}
|
- `disabled?: boolean`{lang="ts-type"}
|
||||||
- `onSelect?(e: Event): void`{lang="ts-type"}
|
- `onSelect?(e: Event): void`{lang="ts-type"}
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { tagsItem?: ClassNameValue, tagsItemText?: ClassNameValue, tagsItemDelete?: ClassNameValue, tagsItemDeleteIcon?: ClassNameValue, label?: ClassNameValue, separator?: ClassNameValue, item?: ClassNameValue, itemLeadingIcon?: ClassNameValue, itemLeadingAvatarSize?: ClassNameValue, itemLeadingAvatar?: ClassNameValue, itemLeadingChip?: ClassNameValue, itemLeadingChipSize?: ClassNameValue, itemLabel?: ClassNameValue, itemTrailing?: ClassNameValue, itemTrailingIcon?: ClassNameValue }`{lang="ts-type"}
|
||||||
|
|
||||||
::component-code
|
::component-code
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ title: InputNumber
|
|||||||
description: Input numerical values with a customizable range.
|
description: Input numerical values with a customizable range.
|
||||||
category: form
|
category: form
|
||||||
links:
|
links:
|
||||||
- label: Number Field
|
- label: NumberField
|
||||||
icon: i-custom-reka-ui
|
icon: i-custom-reka-ui
|
||||||
to: https://www.reka-ui.com/components/input-number
|
to: https://www.reka-ui.com/docs/components/number-field
|
||||||
- label: GitHub
|
- label: GitHub
|
||||||
icon: i-simple-icons-github
|
icon: i-simple-icons-github
|
||||||
to: https://github.com/nuxt/ui/tree/v3/src/runtime/components/InputNumber.vue
|
to: https://github.com/nuxt/ui/tree/v3/src/runtime/components/InputNumber.vue
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
---
|
---
|
||||||
title: Keyboard Key
|
title: Kbd
|
||||||
description: A kbd element to display a keyboard key.
|
description: A kbd element to display a keyboard key.
|
||||||
category: element
|
category: element
|
||||||
links:
|
links:
|
||||||
- label: GitHub
|
- label: GitHub
|
||||||
icon: i-simple-icons-github
|
icon: i-simple-icons-github
|
||||||
to: https://github.com/nuxt/ui/tree/v3/src/runtime/components/Kbd.vue
|
to: https://github.com/nuxt/ui/tree/v3/src/runtime/components/Kbd.vue
|
||||||
navigation:
|
|
||||||
title: Kbd
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@@ -32,7 +30,7 @@ props:
|
|||||||
---
|
---
|
||||||
::
|
::
|
||||||
|
|
||||||
You can pass special keys to the `value` prop that goes through the [`useKbd`](https://github.com/nuxt/ui/blob/v3/src/runtime/composables/useKbd.ts) composable. For example, the `meta` key displays as `⌘` on macOS and `⊞` on other platforms.
|
You can pass special keys to the `value` prop that goes through the [`useKbd`](https://github.com/nuxt/ui/blob/v3/src/runtime/composables/useKbd.ts) composable. For example, the `meta` key displays as `⌘` on macOS and `Ctrl` on other platforms.
|
||||||
|
|
||||||
::component-code
|
::component-code
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -21,14 +21,19 @@ Use the `items` prop as an array of objects with the following properties:
|
|||||||
- `icon?: string`{lang="ts-type"}
|
- `icon?: string`{lang="ts-type"}
|
||||||
- `avatar?: AvatarProps`{lang="ts-type"}
|
- `avatar?: AvatarProps`{lang="ts-type"}
|
||||||
- `badge?: string | number | BadgeProps`{lang="ts-type"}
|
- `badge?: string | number | BadgeProps`{lang="ts-type"}
|
||||||
|
- `tooltip?: TooltipProps`{lang="ts-type"} :badge{label="Soon"}
|
||||||
- `trailingIcon?: string`{lang="ts-type"}
|
- `trailingIcon?: string`{lang="ts-type"}
|
||||||
- `type?: 'label' | 'link'`{lang="ts-type"}
|
- `type?: 'label' | 'link'`{lang="ts-type"}
|
||||||
|
- `collapsible?: boolean`{lang="ts-type"} :badge{label="Soon"}
|
||||||
|
- `defaultOpen?: boolean`{lang="ts-type"}
|
||||||
|
- `open?: boolean`{lang="ts-type"}
|
||||||
- `value?: string`{lang="ts-type"}
|
- `value?: string`{lang="ts-type"}
|
||||||
- `disabled?: boolean`{lang="ts-type"}
|
- `disabled?: boolean`{lang="ts-type"}
|
||||||
- `class?: any`{lang="ts-type"}
|
|
||||||
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
||||||
- `onSelect?(e: Event): void`{lang="ts-type"}
|
- `onSelect?(e: Event): void`{lang="ts-type"}
|
||||||
- `children?: NavigationMenuChildItem[]`{lang="ts-type"}
|
- `children?: NavigationMenuChildItem[]`{lang="ts-type"}
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { linkLeadingAvatarSize?: ClassNameValue, linkLeadingAvatar?: ClassNameValue, linkLeadingIcon?: ClassNameValue, linkLabel?: ClassNameValue, linkLabelExternalIcon?: ClassNameValue, linkTrailing?: ClassNameValue, linkTrailingBadgeSize?: ClassNameValue, linkTrailingBadge?: ClassNameValue, linkTrailingIcon?: ClassNameValue, label?: ClassNameValue, link?: ClassNameValue, content?: ClassNameValue, childList?: ClassNameValue, childItem?: ClassNameValue, childLink?: ClassNameValue, childLinkIcon?: ClassNameValue, childLinkWrapper?: ClassNameValue, childLinkLabel?: ClassNameValue, childLinkLabelExternalIcon?: ClassNameValue, childLinkDescription?: ClassNameValue }`{lang="ts-type"}
|
||||||
|
|
||||||
You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc.
|
You can pass any property from the [Link](/components/link#props) component such as `to`, `target`, etc.
|
||||||
|
|
||||||
@@ -130,8 +135,8 @@ Each item can take a `children` array of objects with the following properties t
|
|||||||
- `label: string`
|
- `label: string`
|
||||||
- `description?: string`
|
- `description?: string`
|
||||||
- `icon?: string`
|
- `icon?: string`
|
||||||
- `class?: any`
|
|
||||||
- `onSelect?(e: Event): void`
|
- `onSelect?(e: Event): void`
|
||||||
|
- `class?: any`
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
@@ -237,6 +242,108 @@ props:
|
|||||||
Groups will be spaced when orientation is `horizontal` and separated when orientation is `vertical`.
|
Groups will be spaced when orientation is `horizontal` and separated when orientation is `vertical`.
|
||||||
::
|
::
|
||||||
|
|
||||||
|
### Collapsed
|
||||||
|
|
||||||
|
Use the `collapsed` prop to collapse the NavigationMenu, this can be useful in a sidebar for example.
|
||||||
|
|
||||||
|
::component-code
|
||||||
|
---
|
||||||
|
collapse: true
|
||||||
|
ignore:
|
||||||
|
- items
|
||||||
|
- orientation
|
||||||
|
- class
|
||||||
|
external:
|
||||||
|
- items
|
||||||
|
externalTypes:
|
||||||
|
- NavigationMenuItem[][]
|
||||||
|
props:
|
||||||
|
collapsed: true
|
||||||
|
orientation: 'vertical'
|
||||||
|
items:
|
||||||
|
- - label: Links
|
||||||
|
type: 'label'
|
||||||
|
- label: Guide
|
||||||
|
icon: i-lucide-book-open
|
||||||
|
children:
|
||||||
|
- label: Introduction
|
||||||
|
description: Fully styled and customizable components for Nuxt.
|
||||||
|
icon: i-lucide-house
|
||||||
|
- label: Installation
|
||||||
|
description: Learn how to install and configure Nuxt UI in your application.
|
||||||
|
icon: i-lucide-cloud-download
|
||||||
|
- label: 'Icons'
|
||||||
|
icon: 'i-lucide-smile'
|
||||||
|
description: 'You have nothing to do, @nuxt/icon will handle it automatically.'
|
||||||
|
- label: 'Colors'
|
||||||
|
icon: 'i-lucide-swatch-book'
|
||||||
|
description: 'Choose a primary and a neutral color from your Tailwind CSS theme.'
|
||||||
|
- label: 'Theme'
|
||||||
|
icon: 'i-lucide-cog'
|
||||||
|
description: 'You can customize components by using the `class` / `ui` props or in your app.config.ts.'
|
||||||
|
- label: Composables
|
||||||
|
icon: i-lucide-database
|
||||||
|
collapsible: false
|
||||||
|
open: false
|
||||||
|
children:
|
||||||
|
- label: defineShortcuts
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Define shortcuts for your application.
|
||||||
|
to: /composables/define-shortcuts
|
||||||
|
- label: useOverlay
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Display a modal/slideover within your application.
|
||||||
|
to: /composables/use-overlay
|
||||||
|
- label: useToast
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Display a toast within your application.
|
||||||
|
to: /composables/use-toast
|
||||||
|
- label: Components
|
||||||
|
icon: i-lucide-box
|
||||||
|
collapsible: false
|
||||||
|
open: false
|
||||||
|
to: /components
|
||||||
|
active: true
|
||||||
|
children:
|
||||||
|
- label: Link
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Use NuxtLink with superpowers.
|
||||||
|
to: /components/link
|
||||||
|
- label: Modal
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Display a modal within your application.
|
||||||
|
to: /components/modal
|
||||||
|
- label: NavigationMenu
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Display a list of links.
|
||||||
|
to: /components/navigation-menu
|
||||||
|
- label: Pagination
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Display a list of pages.
|
||||||
|
to: /components/pagination
|
||||||
|
- label: Popover
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Display a non-modal dialog that floats around a trigger element.
|
||||||
|
to: /components/popover
|
||||||
|
- label: Progress
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Show a horizontal bar to indicate task progression.
|
||||||
|
to: /components/progress
|
||||||
|
- - label: GitHub
|
||||||
|
icon: i-simple-icons-github
|
||||||
|
badge: 3.8k
|
||||||
|
to: https://github.com/nuxt/ui
|
||||||
|
target: _blank
|
||||||
|
- label: Help
|
||||||
|
icon: i-lucide-circle-help
|
||||||
|
disabled: true
|
||||||
|
---
|
||||||
|
::
|
||||||
|
|
||||||
|
::tip
|
||||||
|
You can set the `collapsible: false` property on items with children to prevent them from being collapsible. This allows the item to act as a regular link while still displaying its children in a submenu.
|
||||||
|
::
|
||||||
|
|
||||||
### Highlight
|
### Highlight
|
||||||
|
|
||||||
Use the `highlight` prop to display a highlighted border for the active item.
|
Use the `highlight` prop to display a highlighted border for the active item.
|
||||||
@@ -778,6 +885,126 @@ You can inspect the DOM to see each item's content being rendered.
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
### With tooltips in items :badge{label="Soon" class="align-text-top"}
|
||||||
|
|
||||||
|
You can use the `tooltip` property to display a [Tooltip](/components/tooltip) around an item. This can be useful when the menu is collapsed.
|
||||||
|
|
||||||
|
::component-code
|
||||||
|
---
|
||||||
|
collapse: true
|
||||||
|
ignore:
|
||||||
|
- items
|
||||||
|
- orientation
|
||||||
|
- class
|
||||||
|
external:
|
||||||
|
- items
|
||||||
|
externalTypes:
|
||||||
|
- NavigationMenuItem[][]
|
||||||
|
props:
|
||||||
|
collapsed: true
|
||||||
|
orientation: 'vertical'
|
||||||
|
items:
|
||||||
|
- - label: Links
|
||||||
|
type: 'label'
|
||||||
|
- label: Guide
|
||||||
|
icon: i-lucide-book-open
|
||||||
|
tooltip:
|
||||||
|
text: 'Guide'
|
||||||
|
children:
|
||||||
|
- label: Introduction
|
||||||
|
description: Fully styled and customizable components for Nuxt.
|
||||||
|
icon: i-lucide-house
|
||||||
|
tooltip:
|
||||||
|
text: 'Introduction'
|
||||||
|
- label: Installation
|
||||||
|
description: Learn how to install and configure Nuxt UI in your application.
|
||||||
|
icon: i-lucide-cloud-download
|
||||||
|
tooltip:
|
||||||
|
text: 'Installation'
|
||||||
|
- label: 'Icons'
|
||||||
|
icon: 'i-lucide-smile'
|
||||||
|
description: 'You have nothing to do, @nuxt/icon will handle it automatically.'
|
||||||
|
tooltip:
|
||||||
|
text: 'Icons'
|
||||||
|
- label: 'Colors'
|
||||||
|
icon: 'i-lucide-swatch-book'
|
||||||
|
description: 'Choose a primary and a neutral color from your Tailwind CSS theme.'
|
||||||
|
tooltip:
|
||||||
|
text: 'Colors'
|
||||||
|
- label: 'Theme'
|
||||||
|
icon: 'i-lucide-cog'
|
||||||
|
description: 'You can customize components by using the `class` / `ui` props or in your app.config.ts.'
|
||||||
|
tooltip:
|
||||||
|
text: 'Theme'
|
||||||
|
- label: Composables
|
||||||
|
icon: i-lucide-database
|
||||||
|
tooltip:
|
||||||
|
text: 'Composables'
|
||||||
|
collapsible: false
|
||||||
|
open: false
|
||||||
|
children:
|
||||||
|
- label: defineShortcuts
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Define shortcuts for your application.
|
||||||
|
to: /composables/define-shortcuts
|
||||||
|
- label: useOverlay
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Display a modal/slideover within your application.
|
||||||
|
to: /composables/use-overlay
|
||||||
|
- label: useToast
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Display a toast within your application.
|
||||||
|
to: /composables/use-toast
|
||||||
|
- label: Components
|
||||||
|
icon: i-lucide-box
|
||||||
|
tooltip:
|
||||||
|
text: 'Components'
|
||||||
|
to: /components
|
||||||
|
active: true
|
||||||
|
collapsible: false
|
||||||
|
open: false
|
||||||
|
children:
|
||||||
|
- label: Link
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Use NuxtLink with superpowers.
|
||||||
|
to: /components/link
|
||||||
|
- label: Modal
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Display a modal within your application.
|
||||||
|
to: /components/modal
|
||||||
|
- label: NavigationMenu
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Display a list of links.
|
||||||
|
to: /components/navigation-menu
|
||||||
|
- label: Pagination
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Display a list of pages.
|
||||||
|
to: /components/pagination
|
||||||
|
- label: Popover
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Display a non-modal dialog that floats around a trigger element.
|
||||||
|
to: /components/popover
|
||||||
|
- label: Progress
|
||||||
|
icon: i-lucide-file-text
|
||||||
|
description: Show a horizontal bar to indicate task progression.
|
||||||
|
to: /components/progress
|
||||||
|
- - label: GitHub
|
||||||
|
icon: i-simple-icons-github
|
||||||
|
badge: 3.8k
|
||||||
|
to: https://github.com/nuxt/ui
|
||||||
|
target: _blank
|
||||||
|
tooltip:
|
||||||
|
text: 'GitHub'
|
||||||
|
kbds:
|
||||||
|
- 3.8k
|
||||||
|
- label: Help
|
||||||
|
icon: i-lucide-circle-help
|
||||||
|
disabled: true
|
||||||
|
tooltip:
|
||||||
|
text: 'Help'
|
||||||
|
---
|
||||||
|
::
|
||||||
|
|
||||||
### Control active item
|
### Control active item
|
||||||
|
|
||||||
You can control the active item by using the `default-value` prop or the `v-model` directive with the index of the item.
|
You can control the active item by using the `default-value` prop or the `v-model` directive with the index of the item.
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ title: PinInput
|
|||||||
description: An input element to enter a pin.
|
description: An input element to enter a pin.
|
||||||
category: form
|
category: form
|
||||||
links:
|
links:
|
||||||
|
- label: PinInput
|
||||||
|
icon: i-custom-reka-ui
|
||||||
|
to: https://reka-ui.com/docs/components/pin-input
|
||||||
- label: GitHub
|
- label: GitHub
|
||||||
icon: i-simple-icons-github
|
icon: i-simple-icons-github
|
||||||
to: https://github.com/nuxt/ui/tree/v3/src/runtime/components/PinInput.vue
|
to: https://github.com/nuxt/ui/tree/v3/src/runtime/components/PinInput.vue
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ You can also pass an array of objects with the following properties:
|
|||||||
- `description?: string`{lang="ts-type"}
|
- `description?: string`{lang="ts-type"}
|
||||||
- [`value?: string`{lang="ts-type"}](#value-key)
|
- [`value?: string`{lang="ts-type"}](#value-key)
|
||||||
- `disabled?: boolean`{lang="ts-type"}
|
- `disabled?: boolean`{lang="ts-type"}
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { item?: ClassNameValue, container?: ClassNameValue, base?: ClassNameValue, 'indicator'?: ClassNameValue, wrapper?: ClassNameValue, label?: ClassNameValue, description?: ClassNameValue }`{lang="ts-type"}
|
||||||
|
|
||||||
::component-code
|
::component-code
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ You can also pass an array of objects with the following properties:
|
|||||||
- [`chip?: ChipProps`{lang="ts-type"}](#with-chip-in-items)
|
- [`chip?: ChipProps`{lang="ts-type"}](#with-chip-in-items)
|
||||||
- `disabled?: boolean`{lang="ts-type"}
|
- `disabled?: boolean`{lang="ts-type"}
|
||||||
- `onSelect?(e: Event): void`{lang="ts-type"}
|
- `onSelect?(e: Event): void`{lang="ts-type"}
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { label?: ClassNameValue, separator?: ClassNameValue, item?: ClassNameValue, itemLeadingIcon?: ClassNameValue, itemLeadingAvatarSize?: ClassNameValue, itemLeadingAvatar?: ClassNameValue, itemLeadingChipSize?: ClassNameValue, itemLeadingChip?: ClassNameValue, itemLabel?: ClassNameValue, itemTrailing?: ClassNameValue, itemTrailingIcon?: ClassNameValue }`{lang="ts-type"}
|
||||||
|
|
||||||
::component-code
|
::component-code
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ You can also pass an array of objects with the following properties:
|
|||||||
- [`avatar?: AvatarProps`{lang="ts-type"}](#with-avatar-in-items)
|
- [`avatar?: AvatarProps`{lang="ts-type"}](#with-avatar-in-items)
|
||||||
- [`chip?: ChipProps`{lang="ts-type"}](#with-chip-in-items)
|
- [`chip?: ChipProps`{lang="ts-type"}](#with-chip-in-items)
|
||||||
- `disabled?: boolean`{lang="ts-type"}
|
- `disabled?: boolean`{lang="ts-type"}
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { label?: ClassNameValue, separator?: ClassNameValue, item?: ClassNameValue, itemLeadingIcon?: ClassNameValue, itemLeadingAvatarSize?: ClassNameValue, itemLeadingAvatar?: ClassNameValue, itemLeadingChipSize?: ClassNameValue, itemLeadingChip?: ClassNameValue, itemLabel?: ClassNameValue, itemTrailing?: ClassNameValue, itemTrailingIcon?: ClassNameValue }`{lang="ts-type"}
|
||||||
|
|
||||||
::component-code
|
::component-code
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -136,6 +136,21 @@ props:
|
|||||||
---
|
---
|
||||||
::
|
::
|
||||||
|
|
||||||
|
### Tooltip :badge{label="Soon" class="align-text-top"}
|
||||||
|
|
||||||
|
Use the `tooltip` prop to display a [Tooltip](/components/tooltip) around the Slider thumbs with the current value. You can set it to `true` for default behavior or pass an object to customize it with any property from the [Tooltip](/components/tooltip#props) component.
|
||||||
|
|
||||||
|
::component-code
|
||||||
|
---
|
||||||
|
ignore:
|
||||||
|
- defaultValue
|
||||||
|
- tooltip
|
||||||
|
props:
|
||||||
|
defaultValue: 50
|
||||||
|
tooltip: true
|
||||||
|
---
|
||||||
|
::
|
||||||
|
|
||||||
### Disabled
|
### Disabled
|
||||||
|
|
||||||
Use the `disabled` prop to disable the Slider.
|
Use the `disabled` prop to disable the Slider.
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ Use the `items` prop as an array of objects with the following properties:
|
|||||||
- `value?: string | number`{lang="ts-type"}
|
- `value?: string | number`{lang="ts-type"}
|
||||||
- `disabled?: boolean`{lang="ts-type"}
|
- `disabled?: boolean`{lang="ts-type"}
|
||||||
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { item?: ClassNameValue, container?: ClassNameValue, trigger?: ClassNameValue, indicator?: ClassNameValue, icon?: ClassNameValue, separator?: ClassNameValue, wrapper?: ClassNameValue, title?: ClassNameValue, description?: ClassNameValue }`{lang="ts-type"}
|
||||||
|
|
||||||
::component-code
|
::component-code
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ props:
|
|||||||
---
|
---
|
||||||
::
|
::
|
||||||
|
|
||||||
When using the `required` prop, an asterisk is be added next to the label.
|
When using the `required` prop, an asterisk is added next to the label.
|
||||||
|
|
||||||
::component-code
|
::component-code
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -260,6 +260,30 @@ You can use the `expanded` prop to control the expandable state of the rows (can
|
|||||||
You could also add this action to the [`DropdownMenu`](/components/dropdown-menu) component inside the `actions` column.
|
You could also add this action to the [`DropdownMenu`](/components/dropdown-menu) component inside the `actions` column.
|
||||||
::
|
::
|
||||||
|
|
||||||
|
### With grouped rows
|
||||||
|
|
||||||
|
You can group rows based on a given column value and show/hide sub rows via some button added to the cell using the TanStack Table [Grouping APIs](https://tanstack.com/table/latest/docs/api/features/grouping).
|
||||||
|
|
||||||
|
#### Important parts:
|
||||||
|
|
||||||
|
* Add prop `grouping` to `UTable` component with an array of column ids you want to group by.
|
||||||
|
* Add prop `grouping-options` to `UTable`. It must include `getGroupedRowModel`, you can import it from `@tanstack/vue-table` or implement your own.
|
||||||
|
* Expand rows via `row.toggleExpanded()` method on any cell of the row. Keep in mind, it also toggles `#expanded` slot.
|
||||||
|
* Use `aggregateFn` on column definition to define how to aggregate the rows.
|
||||||
|
* `agregatedCell` renderer on column definition only works if there is no `cell` renderer.
|
||||||
|
|
||||||
|
::component-example
|
||||||
|
---
|
||||||
|
prettier: true
|
||||||
|
collapse: true
|
||||||
|
name: 'table-grouped-rows-example'
|
||||||
|
highlights:
|
||||||
|
- 159
|
||||||
|
- 169
|
||||||
|
class: '!p-0'
|
||||||
|
---
|
||||||
|
::
|
||||||
|
|
||||||
### With row selection
|
### With row selection
|
||||||
|
|
||||||
You can add a new column that renders a [Checkbox](/components/checkbox) component inside the `header` and `cell` to select rows using the TanStack Table [Row Selection APIs](https://tanstack.com/table/latest/docs/api/features/row-selection).
|
You can add a new column that renders a [Checkbox](/components/checkbox) component inside the `header` and `cell` to select rows using the TanStack Table [Row Selection APIs](https://tanstack.com/table/latest/docs/api/features/row-selection).
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ Use the `items` prop as an array of objects with the following properties:
|
|||||||
- `value?: string | number`{lang="ts-type"}
|
- `value?: string | number`{lang="ts-type"}
|
||||||
- `disabled?: boolean`{lang="ts-type"}
|
- `disabled?: boolean`{lang="ts-type"}
|
||||||
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
- [`slot?: string`{lang="ts-type"}](#with-custom-slot)
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { trigger?: ClassNameValue, leadingIcon?: ClassNameValue, leadingAvatar?: ClassNameValue, label?: ClassNameValue, content?: ClassNameValue }`{lang="ts-type"}
|
||||||
|
|
||||||
::component-code
|
::component-code
|
||||||
---
|
---
|
||||||
@@ -210,10 +212,6 @@ You can control the active item by using the `default-value` prop or the `v-mode
|
|||||||
|
|
||||||
:component-example{name="tabs-model-value-example"}
|
:component-example{name="tabs-model-value-example"}
|
||||||
|
|
||||||
::tip
|
|
||||||
You can also pass the `value` of one of the items if provided.
|
|
||||||
::
|
|
||||||
|
|
||||||
### With content slot
|
### With content slot
|
||||||
|
|
||||||
Use the `#content` slot to customize the content of each item.
|
Use the `#content` slot to customize the content of each item.
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ name: 'toast-example'
|
|||||||
:toaster-position-example
|
:toaster-position-example
|
||||||
::
|
::
|
||||||
|
|
||||||
::note{to="https://github.com/nuxt/ui/blob/v3/docs/app/app.vue#L77"}
|
::note{to="https://github.com/nuxt/ui/blob/v3/docs/app/app.config.ts#L3"}
|
||||||
In this example, we use the `AppConfig` to configure the `position` prop of the `Toaster` component globally.
|
In this example, we use the `AppConfig` to configure the `position` prop of the `Toaster` component globally.
|
||||||
::
|
::
|
||||||
|
|
||||||
@@ -206,7 +206,7 @@ name: 'toast-example'
|
|||||||
:toaster-duration-example
|
:toaster-duration-example
|
||||||
::
|
::
|
||||||
|
|
||||||
::note{to="https://github.com/nuxt/ui/blob/v3/docs/app/app.vue#L77"}
|
::note{to="https://github.com/nuxt/ui/blob/v3/docs/app/app.config.ts#L5"}
|
||||||
In this example, we use the `AppConfig` to configure the `duration` prop of the `Toaster` component globally.
|
In this example, we use the `AppConfig` to configure the `duration` prop of the `Toaster` component globally.
|
||||||
::
|
::
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ name: 'toast-example'
|
|||||||
:toaster-expand-example
|
:toaster-expand-example
|
||||||
::
|
::
|
||||||
|
|
||||||
::note{to="https://github.com/nuxt/ui/blob/v3/docs/app/app.vue#L77"}
|
::note{to="https://github.com/nuxt/ui/blob/v3/docs/app/app.config.ts#L4"}
|
||||||
In this example, we use the `AppConfig` to configure the `expand` prop of the `Toaster` component globally.
|
In this example, we use the `AppConfig` to configure the `expand` prop of the `Toaster` component globally.
|
||||||
::
|
::
|
||||||
|
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ Use the `items` prop as an array of objects with the following properties:
|
|||||||
- `children?: TreeItem[]`{lang="ts-type"}
|
- `children?: TreeItem[]`{lang="ts-type"}
|
||||||
- `onToggle?(e: Event): void`{lang="ts-type"}
|
- `onToggle?(e: Event): void`{lang="ts-type"}
|
||||||
- `onSelect?(e?: Event): void`{lang="ts-type"}
|
- `onSelect?(e?: Event): void`{lang="ts-type"}
|
||||||
|
- `class?: any`{lang="ts-type"}
|
||||||
|
- `ui?: { item?: ClassNameValue, itemWithChildren?: ClassNameValue, link?: ClassNameValue, linkLeadingIcon?: ClassNameValue, linkLabel?: ClassNameValue, linkTrailing?: ClassNameValue, linkTrailingIcon?: ClassNameValue, listWithChildren?: ClassNameValue }`{lang="ts-type"}
|
||||||
|
|
||||||
::note
|
::note
|
||||||
A unique identifier is required for each item. The component will use the `value` prop as identifier, falling back to `label` if `value` is not provided. One of these must be provided for the component to work properly.
|
A unique identifier is required for each item. The component will use the `value` prop as identifier, falling back to `label` if `value` is not provided. One of these must be provided for the component to work properly.
|
||||||
|
|||||||
@@ -3,40 +3,40 @@
|
|||||||
"name": "@nuxt/ui-docs",
|
"name": "@nuxt/ui-docs",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ai-sdk/vue": "^1.2.8",
|
"@ai-sdk/vue": "^1.2.12",
|
||||||
"@iconify-json/logos": "^1.2.4",
|
"@iconify-json/logos": "^1.2.4",
|
||||||
"@iconify-json/lucide": "^1.2.38",
|
"@iconify-json/lucide": "^1.2.43",
|
||||||
"@iconify-json/simple-icons": "^1.2.33",
|
"@iconify-json/simple-icons": "^1.2.34",
|
||||||
"@iconify-json/vscode-icons": "^1.2.19",
|
"@iconify-json/vscode-icons": "^1.2.21",
|
||||||
"@nuxt/content": "^3.5.1",
|
"@nuxt/content": "^3.5.1",
|
||||||
"@nuxt/image": "^1.10.0",
|
"@nuxt/image": "^1.10.0",
|
||||||
"@nuxt/ui": "latest",
|
"@nuxt/ui": "latest",
|
||||||
"@nuxt/ui-pro": "^3.1.0",
|
"@nuxt/ui-pro": "https://pkg.pr.new/@nuxt/ui-pro@a30de4d",
|
||||||
"@nuxthub/core": "^0.8.25",
|
"@nuxthub/core": "^0.8.27",
|
||||||
"@nuxtjs/plausible": "^1.2.0",
|
"@nuxtjs/plausible": "^1.2.0",
|
||||||
"@octokit/rest": "^21.1.1",
|
"@octokit/rest": "^21.1.1",
|
||||||
"@rollup/plugin-yaml": "^4.1.2",
|
"@rollup/plugin-yaml": "^4.1.2",
|
||||||
"@vueuse/integrations": "^13.1.0",
|
"@vueuse/integrations": "^13.2.0",
|
||||||
"@vueuse/nuxt": "^13.1.0",
|
"@vueuse/nuxt": "^13.2.0",
|
||||||
"ai": "^4.3.9",
|
"ai": "^4.3.15",
|
||||||
"capture-website": "^4.2.0",
|
"capture-website": "^4.2.0",
|
||||||
"joi": "^17.13.3",
|
"joi": "^17.13.3",
|
||||||
"motion-v": "^0.13.1",
|
"motion-v": "^1.0.2",
|
||||||
"nuxt": "^3.16.2",
|
"nuxt": "^3.17.3",
|
||||||
"nuxt-component-meta": "^0.11.0",
|
"nuxt-component-meta": "^0.11.0",
|
||||||
"nuxt-llms": "^0.1.2",
|
"nuxt-llms": "^0.1.2",
|
||||||
"nuxt-og-image": "^5.1.2",
|
"nuxt-og-image": "^5.1.3",
|
||||||
"prettier": "^3.5.3",
|
"prettier": "^3.5.3",
|
||||||
"shiki-transformer-color-highlight": "^1.0.0",
|
"shiki-transformer-color-highlight": "^1.0.0",
|
||||||
"sortablejs": "^1.15.6",
|
"sortablejs": "^1.15.6",
|
||||||
"superstruct": "^2.0.2",
|
"superstruct": "^2.0.2",
|
||||||
"ufo": "^1.6.1",
|
"ufo": "^1.6.1",
|
||||||
"valibot": "^1.0.0",
|
"valibot": "^1.1.0",
|
||||||
"workers-ai-provider": "^0.3.0",
|
"workers-ai-provider": "^0.4.1",
|
||||||
"yup": "^1.6.1",
|
"yup": "^1.6.1",
|
||||||
"zod": "^3.24.3"
|
"zod": "^3.24.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"wrangler": "^4.13.0"
|
"wrangler": "^4.15.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,11 +46,33 @@ const parseBoolean = (value?: string): boolean => value === 'true'
|
|||||||
|
|
||||||
function getComponentMeta(componentName: string) {
|
function getComponentMeta(componentName: string) {
|
||||||
const pascalCaseName = componentName.charAt(0).toUpperCase() + componentName.slice(1)
|
const pascalCaseName = componentName.charAt(0).toUpperCase() + componentName.slice(1)
|
||||||
const metaComponentName = `U${pascalCaseName}`
|
|
||||||
|
const strategies = [
|
||||||
|
`U${pascalCaseName}`,
|
||||||
|
`Prose${pascalCaseName}`,
|
||||||
|
pascalCaseName
|
||||||
|
]
|
||||||
|
|
||||||
|
let componentMeta: any
|
||||||
|
let finalMetaComponentName: string = pascalCaseName
|
||||||
|
|
||||||
|
for (const nameToTry of strategies) {
|
||||||
|
finalMetaComponentName = nameToTry
|
||||||
|
const metaAttempt = (meta as Record<string, any>)[nameToTry]?.meta
|
||||||
|
if (metaAttempt) {
|
||||||
|
componentMeta = metaAttempt
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!componentMeta) {
|
||||||
|
console.warn(`[getComponentMeta] Metadata not found for ${pascalCaseName} using strategies: U, Prose, or no prefix. Last tried: ${finalMetaComponentName}`)
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
pascalCaseName,
|
pascalCaseName,
|
||||||
metaComponentName,
|
metaComponentName: finalMetaComponentName,
|
||||||
componentMeta: (meta as Record<string, any>)[metaComponentName]?.meta
|
componentMeta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,6 +190,7 @@ function emitItemHandler(event: any): string {
|
|||||||
const generateThemeConfig = ({ pro, prose, componentName }: ThemeConfig) => {
|
const generateThemeConfig = ({ pro, prose, componentName }: ThemeConfig) => {
|
||||||
const computedTheme = pro ? (prose ? themePro.prose : themePro) : theme
|
const computedTheme = pro ? (prose ? themePro.prose : themePro) : theme
|
||||||
const componentTheme = computedTheme[componentName as keyof typeof computedTheme]
|
const componentTheme = computedTheme[componentName as keyof typeof computedTheme]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
[pro ? 'uiPro' : 'ui']: prose
|
[pro ? 'uiPro' : 'ui']: prose
|
||||||
? { prose: { [componentName]: componentTheme } }
|
? { prose: { [componentName]: componentTheme } }
|
||||||
@@ -284,10 +307,14 @@ export default defineNitroPlugin((nitroApp) => {
|
|||||||
const componentName = camelCase(doc.title)
|
const componentName = camelCase(doc.title)
|
||||||
|
|
||||||
visitAndReplace(doc, 'component-theme', (node) => {
|
visitAndReplace(doc, 'component-theme', (node) => {
|
||||||
const attributes = node[1] as ComponentAttributes
|
const attributes = node[1] as Record<string, string>
|
||||||
|
const mdcSpecificName = attributes?.slug
|
||||||
|
|
||||||
|
const finalComponentName = mdcSpecificName ? camelCase(mdcSpecificName) : componentName
|
||||||
|
|
||||||
const pro = parseBoolean(attributes[':pro'])
|
const pro = parseBoolean(attributes[':pro'])
|
||||||
const prose = parseBoolean(attributes[':prose'])
|
const prose = parseBoolean(attributes[':prose'])
|
||||||
const appConfig = generateThemeConfig({ pro, prose, componentName })
|
const appConfig = generateThemeConfig({ pro, prose, componentName: finalComponentName })
|
||||||
|
|
||||||
replaceNodeWithPre(
|
replaceNodeWithPre(
|
||||||
node,
|
node,
|
||||||
@@ -322,14 +349,23 @@ export default defineNitroPlugin((nitroApp) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
visitAndReplace(doc, 'component-props', (node) => {
|
visitAndReplace(doc, 'component-props', (node) => {
|
||||||
const { pascalCaseName, componentMeta } = getComponentMeta(componentName)
|
const attributes = node[1] as Record<string, string>
|
||||||
|
const mdcSpecificName = attributes?.name
|
||||||
|
const isProse = parseBoolean(attributes[':prose'])
|
||||||
|
|
||||||
|
const finalComponentName = mdcSpecificName ? camelCase(mdcSpecificName) : componentName
|
||||||
|
|
||||||
|
const { pascalCaseName, componentMeta } = getComponentMeta(finalComponentName)
|
||||||
|
|
||||||
if (!componentMeta?.props) return
|
if (!componentMeta?.props) return
|
||||||
|
|
||||||
|
const interfaceName = isProse ? `Prose${pascalCaseName}Props` : `${pascalCaseName}Props`
|
||||||
|
|
||||||
const interfaceCode = generateTSInterface(
|
const interfaceCode = generateTSInterface(
|
||||||
`${pascalCaseName}Props`,
|
interfaceName,
|
||||||
Object.values(componentMeta.props),
|
Object.values(componentMeta.props),
|
||||||
propItemHandler,
|
propItemHandler,
|
||||||
`Props for the ${pascalCaseName} component`
|
`Props for the ${isProse ? 'Prose' : ''}${pascalCaseName} component`
|
||||||
)
|
)
|
||||||
replaceNodeWithPre(node, 'ts', interfaceCode)
|
replaceNodeWithPre(node, 'ts', interfaceCode)
|
||||||
})
|
})
|
||||||
|
|||||||
55
package.json
55
package.json
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@nuxt/ui",
|
"name": "@nuxt/ui",
|
||||||
"description": "A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.",
|
"description": "A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.",
|
||||||
"version": "3.1.0",
|
"version": "3.1.2",
|
||||||
"packageManager": "pnpm@10.9.0",
|
"packageManager": "pnpm@10.11.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/nuxt/ui.git"
|
"url": "git+https://github.com/nuxt/ui.git"
|
||||||
@@ -96,12 +96,12 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "nuxt-module-build build",
|
"build": "nuxt-module-build build",
|
||||||
"prepack": "pnpm build",
|
"prepack": "pnpm build",
|
||||||
"dev": "nuxi dev playground",
|
"dev": "nuxi dev playground --uiDev",
|
||||||
"dev:build": "nuxi build playground",
|
"dev:build": "nuxi build playground",
|
||||||
"dev:vue": "vite playground-vue",
|
"dev:vue": "vite playground-vue -- --uiDev",
|
||||||
"dev:vue:build": "vite build playground-vue",
|
"dev:vue:build": "vite build playground-vue",
|
||||||
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground && nuxi prepare docs && vite build playground-vue",
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground && nuxi prepare docs && vite build playground-vue",
|
||||||
"docs": "nuxi dev docs",
|
"docs": "nuxi dev docs --uiDev",
|
||||||
"docs:build": "nuxi build docs",
|
"docs:build": "nuxi build docs",
|
||||||
"docs:prepare": "nuxt-component-meta docs",
|
"docs:prepare": "nuxt-component-meta docs",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
@@ -115,18 +115,18 @@
|
|||||||
"@iconify/vue": "^4.3.0",
|
"@iconify/vue": "^4.3.0",
|
||||||
"@internationalized/date": "^3.8.0",
|
"@internationalized/date": "^3.8.0",
|
||||||
"@internationalized/number": "^3.6.1",
|
"@internationalized/number": "^3.6.1",
|
||||||
"@nuxt/fonts": "^0.11.1",
|
"@nuxt/fonts": "^0.11.4",
|
||||||
"@nuxt/icon": "^1.12.0",
|
"@nuxt/icon": "^1.12.0",
|
||||||
"@nuxt/kit": "^3.16.2",
|
"@nuxt/kit": "^3.17.3",
|
||||||
"@nuxt/schema": "^3.16.2",
|
"@nuxt/schema": "^3.17.3",
|
||||||
"@nuxtjs/color-mode": "^3.5.2",
|
"@nuxtjs/color-mode": "^3.5.2",
|
||||||
"@standard-schema/spec": "^1.0.0",
|
"@standard-schema/spec": "^1.0.0",
|
||||||
"@tailwindcss/postcss": "^4.1.4",
|
"@tailwindcss/postcss": "^4.1.6",
|
||||||
"@tailwindcss/vite": "^4.1.4",
|
"@tailwindcss/vite": "^4.1.6",
|
||||||
"@tanstack/vue-table": "^8.21.3",
|
"@tanstack/vue-table": "^8.21.3",
|
||||||
"@unhead/vue": "^2.0.8",
|
"@unhead/vue": "^2.0.8",
|
||||||
"@vueuse/core": "^13.1.0",
|
"@vueuse/core": "^13.2.0",
|
||||||
"@vueuse/integrations": "^13.1.0",
|
"@vueuse/integrations": "^13.2.0",
|
||||||
"colortranslator": "^4.1.0",
|
"colortranslator": "^4.1.0",
|
||||||
"consola": "^3.4.2",
|
"consola": "^3.4.2",
|
||||||
"defu": "^6.1.4",
|
"defu": "^6.1.4",
|
||||||
@@ -144,30 +144,31 @@
|
|||||||
"mlly": "^1.7.4",
|
"mlly": "^1.7.4",
|
||||||
"ohash": "^2.0.11",
|
"ohash": "^2.0.11",
|
||||||
"pathe": "^2.0.3",
|
"pathe": "^2.0.3",
|
||||||
"reka-ui": "^2.2.0",
|
"reka-ui": "^2.2.1",
|
||||||
"scule": "^1.3.0",
|
"scule": "^1.3.0",
|
||||||
"tailwind-variants": "^1.0.0",
|
"tailwind-variants": "^1.0.0",
|
||||||
"tailwindcss": "^4.1.4",
|
"tailwindcss": "^4.1.6",
|
||||||
"tinyglobby": "^0.2.13",
|
"tinyglobby": "^0.2.13",
|
||||||
"unplugin": "^2.3.2",
|
"unplugin": "^2.3.4",
|
||||||
"unplugin-auto-import": "^19.1.2",
|
"unplugin-auto-import": "^19.2.0",
|
||||||
"unplugin-vue-components": "^28.5.0",
|
"unplugin-vue-components": "^28.5.0",
|
||||||
"vaul-vue": "^0.4.1"
|
"vaul-vue": "^0.4.1",
|
||||||
|
"vue-component-type-helpers": "^2.2.10"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nuxt/eslint-config": "^1.3.0",
|
"@nuxt/eslint-config": "^1.3.1",
|
||||||
"@nuxt/module-builder": "^1.0.1",
|
"@nuxt/module-builder": "^1.0.1",
|
||||||
"@nuxt/test-utils": "^3.17.2",
|
"@nuxt/test-utils": "^3.18.0",
|
||||||
"@release-it/conventional-changelog": "^10.0.1",
|
"@release-it/conventional-changelog": "^10.0.1",
|
||||||
"@vue/test-utils": "^2.4.6",
|
"@vue/test-utils": "^2.4.6",
|
||||||
"embla-carousel": "^8.6.0",
|
"embla-carousel": "^8.6.0",
|
||||||
"eslint": "^9.25.1",
|
"eslint": "^9.26.0",
|
||||||
"happy-dom": "^17.4.4",
|
"happy-dom": "^17.4.7",
|
||||||
"nuxt": "^3.16.2",
|
"nuxt": "^3.17.3",
|
||||||
"release-it": "^19.0.1",
|
"release-it": "^19.0.2",
|
||||||
"vitest": "^3.1.2",
|
"vitest": "^3.1.3",
|
||||||
"vitest-environment-nuxt": "^1.0.1",
|
"vitest-environment-nuxt": "^1.0.1",
|
||||||
"vue-tsc": "^2.2.0"
|
"vue-tsc": "^2.2.10"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@inertiajs/vue3": "^2.0.7",
|
"@inertiajs/vue3": "^2.0.7",
|
||||||
@@ -207,8 +208,8 @@
|
|||||||
"chokidar": "3.6.0",
|
"chokidar": "3.6.0",
|
||||||
"debug": "4.3.7",
|
"debug": "4.3.7",
|
||||||
"rollup": "4.34.9",
|
"rollup": "4.34.9",
|
||||||
"unplugin": "^2.3.2",
|
"unimport": "4.1.1",
|
||||||
"vue-tsc": "2.2.0"
|
"unplugin": "^2.3.4"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"onlyBuiltDependencies": [
|
"onlyBuiltDependencies": [
|
||||||
|
|||||||
@@ -4,6 +4,8 @@
|
|||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
|
<link rel="icon" type="image/svg+xml" href="/logo.svg" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||||
|
<link href="https://fonts.bunny.net/css?family=public-sans:400,500,600,700" rel="stylesheet" />
|
||||||
<title>Nuxt UI - Vue Playground</title>
|
<title>Nuxt UI - Vue Playground</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -11,14 +11,14 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxt/ui": "latest",
|
"@nuxt/ui": "latest",
|
||||||
"vue": "^3.5.13",
|
"vue": "^3.5.14",
|
||||||
"vue-router": "^4.5.0",
|
"vue-router": "^4.5.1",
|
||||||
"zod": "^3.24.3"
|
"zod": "^3.24.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^5.2.3",
|
"@vitejs/plugin-vue": "^5.2.4",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"vite": "^6.3.3",
|
"vite": "^6.3.5",
|
||||||
"vue-tsc": "^2.2.0"
|
"vue-tsc": "^2.2.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
import ui from '@nuxt/ui/vite'
|
||||||
import ui from '../src/vite'
|
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
server: {
|
|
||||||
fs: {
|
|
||||||
allow: ['..']
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
ui({
|
ui({
|
||||||
|
|||||||
@@ -36,14 +36,27 @@ const variants = Object.keys(theme.variants.variant) as Array<keyof typeof theme
|
|||||||
color="neutral"
|
color="neutral"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2 ms-[-56px]">
|
<div class="flex items-center gap-2 ms-[-90px]">
|
||||||
<UBadge v-for="size in sizes" :key="size" label="Badge" :size="size" />
|
<UBadge v-for="size in sizes" :key="size" label="Badge" :size="size" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2 ms-[-86px]">
|
<div class="flex items-center gap-2 ms-[-122px]">
|
||||||
<UBadge v-for="size in sizes" :key="size" icon="i-lucide-rocket" label="Badge" :size="size" />
|
<UBadge v-for="size in sizes" :key="size" icon="i-lucide-rocket" label="Badge" :size="size" />
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2 ms-[-86px]">
|
<div class="flex items-center gap-2 ms-[-130px]">
|
||||||
<UBadge v-for="size in sizes" :key="size" :avatar="{ src: 'https://github.com/benjamincanac.png' }" label="Badge" :size="size" />
|
<UBadge v-for="size in sizes" :key="size" :avatar="{ src: 'https://github.com/benjamincanac.png' }" label="Badge" :size="size" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex items-center gap-2 ms-[-52px]">
|
||||||
|
<UBadge v-for="size in sizes" :key="size" icon="i-lucide-rocket" :size="size" />
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2 ms-[-60px]">
|
||||||
|
<UBadge
|
||||||
|
v-for="size in sizes"
|
||||||
|
:key="size"
|
||||||
|
:avatar="{ src: 'https://github.com/benjamincanac.png' }"
|
||||||
|
:size="size"
|
||||||
|
color="neutral"
|
||||||
|
variant="outline"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -28,7 +28,12 @@ const bind = computed(() => ({
|
|||||||
dots: dots.value
|
dots: dots.value
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const items = Array.from({ length: 6 }).map((_, index) => index)
|
const items = Array.from({ length: 6 }).map((_, index) => ({
|
||||||
|
id: index,
|
||||||
|
title: `Item ${index + 1}`,
|
||||||
|
description: `Description for item ${index + 1}`,
|
||||||
|
src: `https://picsum.photos/640/640?v=${index}`
|
||||||
|
}))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -60,23 +65,23 @@ const items = Array.from({ length: 6 }).map((_, index) => index)
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template v-if="classNames">
|
<template v-if="classNames">
|
||||||
<UCarousel v-slot="{ index }" v-bind="bind" :items="items" :ui="{ item: 'basis-[70%] transition-opacity ease-in-out [&:not(.is-snapped)]:opacity-10', container: 'h-[352px]' }" class="w-full max-w-xl mx-auto">
|
<UCarousel v-slot="{ item }" v-bind="bind" :items="items" :ui="{ item: 'basis-[70%] transition-opacity ease-in-out [&:not(.is-snapped)]:opacity-10', container: 'h-[352px]' }" class="w-full max-w-xl mx-auto">
|
||||||
<img :src="`https://picsum.photos/600/350?v=${index}`" class="rounded-lg">
|
<img :src="item.src" class="rounded-lg">
|
||||||
</UCarousel>
|
</UCarousel>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="autoHeight">
|
<template v-else-if="autoHeight">
|
||||||
<UCarousel v-slot="{ index }" v-bind="bind" :items="items" :ui="{ container: 'transition-[height] duration-200' }" class="w-full max-w-md mx-auto">
|
<UCarousel v-slot="{ item }" v-bind="bind" :items="items" :ui="{ container: 'transition-[height] duration-200' }" class="w-full max-w-md mx-auto">
|
||||||
<img :src="`https://picsum.photos/600/${index % 2 === 0 ? 350 : 450}?v=${index}`" :class="index % 2 === 0 ? 'h-[350px]' : 'h-[450px]'" class="rounded-lg">
|
<img :src="item.src" class="rounded-lg">
|
||||||
</UCarousel>
|
</UCarousel>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<UCarousel v-slot="{ index }" v-bind="bind" :items="items" class="w-[320px] mx-auto" :ui="{ container: 'h-[336px]' }">
|
<UCarousel v-slot="{ item }" v-bind="bind" :items="items" class="w-[320px] mx-auto" :ui="{ container: 'h-[336px]' }">
|
||||||
<img :src="`https://picsum.photos/640/640?v=${index}`" class="rounded-lg">
|
<img :src="item.src" class="rounded-lg">
|
||||||
</UCarousel>
|
</UCarousel>
|
||||||
|
|
||||||
<template v-if="orientation === 'horizontal'">
|
<template v-if="orientation === 'horizontal'">
|
||||||
<UCarousel v-slot="{ index }" v-bind="bind" :items="items" :ui="{ item: 'basis-1/3' }" class="w-full max-w-xs mx-auto">
|
<UCarousel v-slot="{ item }" v-bind="bind" :items="items" :ui="{ item: 'basis-1/3' }" class="w-full max-w-xs mx-auto">
|
||||||
<img :src="`https://picsum.photos/320/320?v=${index}`" class="rounded-lg">
|
<img :src="item.src" class="rounded-lg">
|
||||||
</UCarousel>
|
</UCarousel>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import themeCheckbox from '#build/ui/checkbox'
|
|
||||||
import theme from '#build/ui/checkbox-group'
|
import theme from '#build/ui/checkbox-group'
|
||||||
|
|
||||||
const sizes = Object.keys(theme.variants.size) as Array<keyof typeof theme.variants.size>
|
const sizes = Object.keys(theme.variants.size) as Array<keyof typeof theme.variants.size>
|
||||||
const variants = Object.keys(themeCheckbox.variants.variant)
|
const variants = Object.keys(theme.variants.variant)
|
||||||
const variant = ref('list' as const)
|
const variant = ref('list' as const)
|
||||||
|
|
||||||
const literalOptions = [
|
const literalOptions = [
|
||||||
|
|||||||
@@ -1,3 +1,40 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { ShortcutsConfig } from '@nuxt/ui/composables/defineShortcuts.js'
|
||||||
|
|
||||||
|
const logs = ref<string[]>([])
|
||||||
|
const shortcutsState = ref({
|
||||||
|
'a': {
|
||||||
|
label: 'A',
|
||||||
|
disabled: false,
|
||||||
|
usingInput: false
|
||||||
|
},
|
||||||
|
'shift_i': {
|
||||||
|
label: 'Shift+I',
|
||||||
|
disabled: false,
|
||||||
|
usingInput: false
|
||||||
|
},
|
||||||
|
'g-i': {
|
||||||
|
label: 'G->I',
|
||||||
|
disabled: false,
|
||||||
|
usingInput: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const shortcuts = computed(() => {
|
||||||
|
return Object.entries(shortcutsState.value).reduce<ShortcutsConfig>((acc, [key, { label, disabled, usingInput }]) => {
|
||||||
|
if (disabled) {
|
||||||
|
return acc
|
||||||
|
}
|
||||||
|
acc[key] = {
|
||||||
|
handler: () => { logs.value.unshift(`"${label}" triggered`) },
|
||||||
|
usingInput
|
||||||
|
}
|
||||||
|
return acc
|
||||||
|
}, {})
|
||||||
|
})
|
||||||
|
defineShortcuts(shortcuts)
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="w-full flex flex-col gap-4">
|
<div class="w-full flex flex-col gap-4">
|
||||||
<UCard class="flex-1">
|
<UCard class="flex-1">
|
||||||
@@ -43,38 +80,3 @@
|
|||||||
</UCard>
|
</UCard>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
const logs = ref<string[]>([])
|
|
||||||
const shortcutsState = ref({
|
|
||||||
'a': {
|
|
||||||
label: 'A',
|
|
||||||
disabled: false,
|
|
||||||
usingInput: false
|
|
||||||
},
|
|
||||||
'shift_i': {
|
|
||||||
label: 'Shift+I',
|
|
||||||
disabled: false,
|
|
||||||
usingInput: false
|
|
||||||
},
|
|
||||||
'g-i': {
|
|
||||||
label: 'G->I',
|
|
||||||
disabled: false,
|
|
||||||
usingInput: false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const shortcuts = computed(() => {
|
|
||||||
return Object.entries(shortcutsState.value).reduce<ShortcutsConfig>((acc, [key, { label, disabled, usingInput }]) => {
|
|
||||||
if (disabled) {
|
|
||||||
return acc
|
|
||||||
}
|
|
||||||
acc[key] = {
|
|
||||||
handler: () => { logs.value.unshift(`"${label}" triggered`) },
|
|
||||||
usingInput
|
|
||||||
}
|
|
||||||
return acc
|
|
||||||
}, {})
|
|
||||||
})
|
|
||||||
defineShortcuts(shortcuts)
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
modules: [
|
modules: [
|
||||||
'../src/module',
|
'@nuxt/ui',
|
||||||
'@nuxthub/core'
|
'@nuxthub/core'
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,22 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "nuxi dev",
|
"dev": "nuxi dev",
|
||||||
"build": "nuxi build",
|
"build": "nuxi build",
|
||||||
"generate": "nuxi generate"
|
"generate": "nuxi generate",
|
||||||
|
"typecheck": "nuxt typecheck"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@iconify-json/lucide": "^1.2.38",
|
"@iconify-json/lucide": "^1.2.43",
|
||||||
"@iconify-json/simple-icons": "^1.2.33",
|
"@iconify-json/simple-icons": "^1.2.34",
|
||||||
"@nuxt/ui": "latest",
|
"@nuxt/ui": "latest",
|
||||||
"@nuxthub/core": "^0.8.25",
|
"@nuxthub/core": "^0.8.27",
|
||||||
"nuxt": "^3.16.2",
|
"nuxt": "^3.17.3",
|
||||||
"zod": "^3.24.3"
|
"zod": "^3.24.4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.8.3",
|
||||||
|
"vue-tsc": "^2.2.10"
|
||||||
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"unimport": "4.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5970
pnpm-lock.yaml
generated
5970
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -5,9 +5,6 @@
|
|||||||
"lockFileMaintenance": {
|
"lockFileMaintenance": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
"ignoreDeps": [
|
|
||||||
"vue-tsc"
|
|
||||||
],
|
|
||||||
"baseBranches": ["v2", "v3"],
|
"baseBranches": ["v2", "v3"],
|
||||||
"packageRules": [{
|
"packageRules": [{
|
||||||
"matchBaseBranches": ["v3"],
|
"matchBaseBranches": ["v3"],
|
||||||
@@ -19,6 +16,11 @@
|
|||||||
"@tailwindcss/postcss",
|
"@tailwindcss/postcss",
|
||||||
"@tailwindcss/vite"
|
"@tailwindcss/vite"
|
||||||
]
|
]
|
||||||
|
}, {
|
||||||
|
"groupName": "reka-ui",
|
||||||
|
"matchPackageNames": [
|
||||||
|
"reka-ui"
|
||||||
|
]
|
||||||
}, {
|
}, {
|
||||||
"matchDepTypes": ["peerDependencies"],
|
"matchDepTypes": ["peerDependencies"],
|
||||||
"enabled": false
|
"enabled": false
|
||||||
|
|||||||
@@ -91,12 +91,21 @@ export default defineNuxtModule<ModuleOptions>({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await registerModule('@nuxt/icon', 'icon', { cssLayer: 'components' })
|
await registerModule('@nuxt/icon', 'icon', {
|
||||||
|
cssLayer: 'components'
|
||||||
|
})
|
||||||
if (options.fonts) {
|
if (options.fonts) {
|
||||||
await registerModule('@nuxt/fonts', 'fonts', { experimental: { processCSSVariables: true } })
|
await registerModule('@nuxt/fonts', 'fonts', {
|
||||||
|
defaults: {
|
||||||
|
weights: [400, 500, 600, 700]
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
if (options.colorMode) {
|
if (options.colorMode) {
|
||||||
await registerModule('@nuxtjs/color-mode', 'colorMode', { classSuffix: '', disableTransition: true })
|
await registerModule('@nuxtjs/color-mode', 'colorMode', {
|
||||||
|
classSuffix: '',
|
||||||
|
disableTransition: true
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
addPlugin({ src: resolve('./runtime/plugins/colors') })
|
addPlugin({ src: resolve('./runtime/plugins/colors') })
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ export interface AccordionItem {
|
|||||||
/** A unique value for the accordion item. Defaults to the index. */
|
/** A unique value for the accordion item. Defaults to the index. */
|
||||||
value?: string
|
value?: string
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
|
class?: any
|
||||||
|
ui?: Pick<Accordion['slots'], 'item' | 'header' | 'trigger' | 'leadingIcon' | 'label' | 'trailingIcon' | 'content' | 'body'>
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,34 +91,34 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.accordion ||
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AccordionRoot v-bind="rootProps" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
<AccordionRoot v-bind="rootProps" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
||||||
<AccordionItem
|
<AccordionItem
|
||||||
v-for="(item, index) in props.items"
|
v-for="(item, index) in props.items"
|
||||||
v-slot="{ open }"
|
v-slot="{ open }"
|
||||||
:key="index"
|
:key="index"
|
||||||
:value="item.value || String(index)"
|
:value="item.value || String(index)"
|
||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
:class="ui.item({ class: props.ui?.item })"
|
:class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class] })"
|
||||||
>
|
>
|
||||||
<AccordionHeader as="div" :class="ui.header({ class: props.ui?.header })">
|
<AccordionHeader as="div" :class="ui.header({ class: [props.ui?.header, item.ui?.header] })">
|
||||||
<AccordionTrigger :class="ui.trigger({ class: props.ui?.trigger, disabled: item.disabled })">
|
<AccordionTrigger :class="ui.trigger({ class: [props.ui?.trigger, item.ui?.trigger], disabled: item.disabled })">
|
||||||
<slot name="leading" :item="item" :index="index" :open="open">
|
<slot name="leading" :item="item" :index="index" :open="open">
|
||||||
<UIcon v-if="item.icon" :name="item.icon" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
<UIcon v-if="item.icon" :name="item.icon" :class="ui.leadingIcon({ class: [props.ui?.leadingIcon, item?.ui?.leadingIcon] })" />
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
<span v-if="get(item, props.labelKey as string) || !!slots.default" :class="ui.label({ class: props.ui?.label })">
|
<span v-if="get(item, props.labelKey as string) || !!slots.default" :class="ui.label({ class: [props.ui?.label, item.ui?.label] })">
|
||||||
<slot :item="item" :index="index" :open="open">{{ get(item, props.labelKey as string) }}</slot>
|
<slot :item="item" :index="index" :open="open">{{ get(item, props.labelKey as string) }}</slot>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<slot name="trailing" :item="item" :index="index" :open="open">
|
<slot name="trailing" :item="item" :index="index" :open="open">
|
||||||
<UIcon :name="item.trailingIcon || trailingIcon || appConfig.ui.icons.chevronDown" :class="ui.trailingIcon({ class: props.ui?.trailingIcon })" />
|
<UIcon :name="item.trailingIcon || trailingIcon || appConfig.ui.icons.chevronDown" :class="ui.trailingIcon({ class: [props.ui?.trailingIcon, item.ui?.trailingIcon] })" />
|
||||||
</slot>
|
</slot>
|
||||||
</AccordionTrigger>
|
</AccordionTrigger>
|
||||||
</AccordionHeader>
|
</AccordionHeader>
|
||||||
|
|
||||||
<AccordionContent v-if="item.content || !!slots.content || (item.slot && !!slots[item.slot as keyof AccordionSlots<T>]) || !!slots.body || (item.slot && !!slots[`${item.slot}-body` as keyof AccordionSlots<T>])" :class="ui.content({ class: props.ui?.content })">
|
<AccordionContent v-if="item.content || !!slots.content || (item.slot && !!slots[item.slot as keyof AccordionSlots<T>]) || !!slots.body || (item.slot && !!slots[`${item.slot}-body` as keyof AccordionSlots<T>])" :class="ui.content({ class: [props.ui?.content, item.ui?.content] })">
|
||||||
<slot :name="((item.slot || 'content') as keyof AccordionSlots<T>)" :item="(item as Extract<T, { slot: string; }>)" :index="index" :open="open">
|
<slot :name="((item.slot || 'content') as keyof AccordionSlots<T>)" :item="(item as Extract<T, { slot: string; }>)" :index="index" :open="open">
|
||||||
<div :class="ui.body({ class: props.ui?.body })">
|
<div :class="ui.body({ class: [props.ui?.body, item.ui?.body] })">
|
||||||
<slot :name="((item.slot ? `${item.slot}-body`: 'body') as keyof AccordionSlots<T>)" :item="(item as Extract<T, { slot: string; }>)" :index="index" :open="open">
|
<slot :name="((item.slot ? `${item.slot}-body`: 'body') as keyof AccordionSlots<T>)" :item="(item as Extract<T, { slot: string; }>)" :index="index" :open="open">
|
||||||
{{ item.content }}
|
{{ item.content }}
|
||||||
</slot>
|
</slot>
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.alert || {})
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Primitive :as="as" :data-orientation="orientation" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
<Primitive :as="as" :data-orientation="orientation" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
||||||
<slot name="leading">
|
<slot name="leading">
|
||||||
<UAvatar v-if="avatar" :size="((props.ui?.avatarSize || ui.avatarSize()) as AvatarProps['size'])" v-bind="avatar" :class="ui.avatar({ class: props.ui?.avatar })" />
|
<UAvatar v-if="avatar" :size="((props.ui?.avatarSize || ui.avatarSize()) as AvatarProps['size'])" v-bind="avatar" :class="ui.avatar({ class: props.ui?.avatar })" />
|
||||||
<UIcon v-else-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
|
<UIcon v-else-if="icon" :name="icon" :class="ui.icon({ class: props.ui?.icon })" />
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ function onError() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })" :style="props.style">
|
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })" :style="props.style">
|
||||||
<component
|
<component
|
||||||
:is="ImageComponent"
|
:is="ImageComponent"
|
||||||
v-if="src && !error"
|
v-if="src && !error"
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ provide(avatarGroupInjectionKey, computed(() => ({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
||||||
<UAvatar v-if="hiddenCount > 0" :text="`+${hiddenCount}`" :class="ui.base({ class: props.ui?.base })" />
|
<UAvatar v-if="hiddenCount > 0" :text="`+${hiddenCount}`" :class="ui.base({ class: props.ui?.base })" />
|
||||||
<component :is="avatar" v-for="(avatar, count) in visibleAvatars" :key="count" :class="ui.base({ class: props.ui?.base })" />
|
<component :is="avatar" v-for="(avatar, count) in visibleAvatars" :key="count" :class="ui.base({ class: props.ui?.base })" />
|
||||||
</Primitive>
|
</Primitive>
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ export interface BadgeProps extends Omit<UseComponentIconsProps, 'loading' | 'lo
|
|||||||
* @defaultValue 'md'
|
* @defaultValue 'md'
|
||||||
*/
|
*/
|
||||||
size?: Badge['variants']['size']
|
size?: Badge['variants']['size']
|
||||||
|
/** Render the badge with equal padding on all sides. */
|
||||||
|
square?: boolean
|
||||||
class?: any
|
class?: any
|
||||||
ui?: Badge['slots']
|
ui?: Badge['slots']
|
||||||
}
|
}
|
||||||
@@ -50,7 +52,7 @@ import UAvatar from './Avatar.vue'
|
|||||||
const props = withDefaults(defineProps<BadgeProps>(), {
|
const props = withDefaults(defineProps<BadgeProps>(), {
|
||||||
as: 'span'
|
as: 'span'
|
||||||
})
|
})
|
||||||
defineSlots<BadgeSlots>()
|
const slots = defineSlots<BadgeSlots>()
|
||||||
|
|
||||||
const appConfig = useAppConfig() as Badge['AppConfig']
|
const appConfig = useAppConfig() as Badge['AppConfig']
|
||||||
const { orientation, size: buttonGroupSize } = useButtonGroup<BadgeProps>(props)
|
const { orientation, size: buttonGroupSize } = useButtonGroup<BadgeProps>(props)
|
||||||
@@ -60,19 +62,20 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.badge || {})
|
|||||||
color: props.color,
|
color: props.color,
|
||||||
variant: props.variant,
|
variant: props.variant,
|
||||||
size: buttonGroupSize.value || props.size,
|
size: buttonGroupSize.value || props.size,
|
||||||
|
square: props.square || (!slots.default && !props.label),
|
||||||
buttonGroup: orientation.value
|
buttonGroup: orientation.value
|
||||||
}))
|
}))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Primitive :as="as" :class="ui.base({ class: [props.class, props.ui?.base] })">
|
<Primitive :as="as" :class="ui.base({ class: [props.ui?.base, props.class] })">
|
||||||
<slot name="leading">
|
<slot name="leading">
|
||||||
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
<UIcon v-if="isLeading && leadingIconName" :name="leadingIconName" :class="ui.leadingIcon({ class: props.ui?.leadingIcon })" />
|
||||||
<UAvatar v-else-if="!!avatar" :size="((props.ui?.leadingAvatarSize || ui.leadingAvatarSize()) as AvatarProps['size'])" v-bind="avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
|
<UAvatar v-else-if="!!avatar" :size="((props.ui?.leadingAvatarSize || ui.leadingAvatarSize()) as AvatarProps['size'])" v-bind="avatar" :class="ui.leadingAvatar({ class: props.ui?.leadingAvatar })" />
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
<slot>
|
<slot>
|
||||||
<span v-if="label" :class="ui.label({ class: props.ui?.label })">
|
<span v-if="label !== undefined && label !== null" :class="ui.label({ class: props.ui?.label })">
|
||||||
{{ label }}
|
{{ label }}
|
||||||
</span>
|
</span>
|
||||||
</slot>
|
</slot>
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ export interface BreadcrumbItem extends Omit<LinkProps, 'raw' | 'custom'> {
|
|||||||
icon?: string
|
icon?: string
|
||||||
avatar?: AvatarProps
|
avatar?: AvatarProps
|
||||||
slot?: string
|
slot?: string
|
||||||
|
class?: any
|
||||||
|
ui?: Pick<Breadcrumb['slots'], 'item' | 'link' | 'linkLeadingIcon' | 'linkLeadingAvatar' | 'linkLabel' | 'separator' | 'separatorIcon'>
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,19 +83,19 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.breadcrumb |
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Primitive :as="as" aria-label="breadcrumb" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
<Primitive :as="as" aria-label="breadcrumb" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
||||||
<ol :class="ui.list({ class: props.ui?.list })">
|
<ol :class="ui.list({ class: props.ui?.list })">
|
||||||
<template v-for="(item, index) in items" :key="index">
|
<template v-for="(item, index) in items" :key="index">
|
||||||
<li :class="ui.item({ class: props.ui?.item })">
|
<li :class="ui.item({ class: [props.ui?.item, item.ui?.item] })">
|
||||||
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
||||||
<ULinkBase v-bind="slotProps" as="span" :aria-current="active && (index === items!.length - 1) ? 'page' : undefined" :class="ui.link({ class: [props.ui?.link, item.class], active: index === items!.length - 1, disabled: !!item.disabled, to: !!item.to })">
|
<ULinkBase v-bind="slotProps" as="span" :aria-current="active && (index === items!.length - 1) ? 'page' : undefined" :class="ui.link({ class: [props.ui?.link, item.ui?.link, item.class], active: index === items!.length - 1, disabled: !!item.disabled, to: !!item.to })">
|
||||||
<slot :name="((item.slot || 'item') as keyof BreadcrumbSlots<T>)" :item="item" :index="index">
|
<slot :name="((item.slot || 'item') as keyof BreadcrumbSlots<T>)" :item="item" :index="index">
|
||||||
<slot :name="((item.slot ? `${item.slot}-leading`: 'item-leading') as keyof BreadcrumbSlots<T>)" :item="item" :active="index === items!.length - 1" :index="index">
|
<slot :name="((item.slot ? `${item.slot}-leading`: 'item-leading') as keyof BreadcrumbSlots<T>)" :item="item" :active="index === items!.length - 1" :index="index">
|
||||||
<UIcon v-if="item.icon" :name="item.icon" :class="ui.linkLeadingIcon({ class: props.ui?.linkLeadingIcon, active: index === items!.length - 1 })" />
|
<UIcon v-if="item.icon" :name="item.icon" :class="ui.linkLeadingIcon({ class: [props.ui?.linkLeadingIcon, item.ui?.linkLeadingIcon], active: index === items!.length - 1 })" />
|
||||||
<UAvatar v-else-if="item.avatar" :size="((props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.linkLeadingAvatar({ class: props.ui?.linkLeadingAvatar, active: index === items!.length - 1 })" />
|
<UAvatar v-else-if="item.avatar" :size="((props.ui?.linkLeadingAvatarSize || ui.linkLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.linkLeadingAvatar({ class: [props.ui?.linkLeadingAvatar, item.ui?.linkLeadingAvatar], active: index === items!.length - 1 })" />
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
<span v-if="get(item, props.labelKey as string) || !!slots[(item.slot ? `${item.slot}-label`: 'item-label') as keyof BreadcrumbSlots<T>]" :class="ui.linkLabel({ class: props.ui?.linkLabel })">
|
<span v-if="get(item, props.labelKey as string) || !!slots[(item.slot ? `${item.slot}-label`: 'item-label') as keyof BreadcrumbSlots<T>]" :class="ui.linkLabel({ class: [props.ui?.linkLabel, item.ui?.linkLabel] })">
|
||||||
<slot :name="((item.slot ? `${item.slot}-label`: 'item-label') as keyof BreadcrumbSlots<T>)" :item="item" :active="index === items!.length - 1" :index="index">
|
<slot :name="((item.slot ? `${item.slot}-label`: 'item-label') as keyof BreadcrumbSlots<T>)" :item="item" :active="index === items!.length - 1" :index="index">
|
||||||
{{ get(item, props.labelKey as string) }}
|
{{ get(item, props.labelKey as string) }}
|
||||||
</slot>
|
</slot>
|
||||||
@@ -105,9 +107,9 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.breadcrumb |
|
|||||||
</ULink>
|
</ULink>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li v-if="index < items!.length - 1" role="presentation" aria-hidden="true" :class="ui.separator({ class: props.ui?.separator })">
|
<li v-if="index < items!.length - 1" role="presentation" aria-hidden="true" :class="ui.separator({ class: [props.ui?.separator, item.ui?.separator] })">
|
||||||
<slot name="separator">
|
<slot name="separator">
|
||||||
<UIcon :name="separatorIcon" :class="ui.separatorIcon({ class: props.ui?.separatorIcon })" />
|
<UIcon :name="separatorIcon" :class="ui.separatorIcon({ class: [props.ui?.separatorIcon, item.ui?.separatorIcon] })" />
|
||||||
</slot>
|
</slot>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { AppConfig } from '@nuxt/schema'
|
import type { AppConfig } from '@nuxt/schema'
|
||||||
import theme from '#build/ui/button'
|
import theme from '#build/ui/button'
|
||||||
import type { LinkProps } from './Link.vue'
|
|
||||||
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
||||||
import type { AvatarProps } from '../types'
|
import type { LinkProps, AvatarProps } from '../types'
|
||||||
import type { ComponentConfig } from '../types/utils'
|
import type { ComponentConfig } from '../types/utils'
|
||||||
|
|
||||||
type Button = ComponentConfig<typeof theme, AppConfig, 'button'>
|
type Button = ComponentConfig<typeof theme, AppConfig, 'button'>
|
||||||
@@ -123,14 +122,13 @@ const ui = computed(() => tv({
|
|||||||
v-slot="{ active, ...slotProps }"
|
v-slot="{ active, ...slotProps }"
|
||||||
:type="type"
|
:type="type"
|
||||||
:disabled="disabled || isLoading"
|
:disabled="disabled || isLoading"
|
||||||
:class="ui.base({ class: [props.class, props.ui?.base] })"
|
|
||||||
v-bind="omit(linkProps, ['type', 'disabled', 'onClick'])"
|
v-bind="omit(linkProps, ['type', 'disabled', 'onClick'])"
|
||||||
custom
|
custom
|
||||||
>
|
>
|
||||||
<ULinkBase
|
<ULinkBase
|
||||||
v-bind="slotProps"
|
v-bind="slotProps"
|
||||||
:class="ui.base({
|
:class="ui.base({
|
||||||
class: [props.class, props.ui?.base],
|
class: [props.ui?.base, props.class],
|
||||||
active,
|
active,
|
||||||
...(active && activeVariant ? { variant: activeVariant } : {}),
|
...(active && activeVariant ? { variant: activeVariant } : {}),
|
||||||
...(active && activeColor ? { color: activeColor } : {})
|
...(active && activeColor ? { color: activeColor } : {})
|
||||||
@@ -143,7 +141,7 @@ const ui = computed(() => tv({
|
|||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
<slot>
|
<slot>
|
||||||
<span v-if="label" :class="ui.label({ class: props.ui?.label, active })">
|
<span v-if="label !== undefined && label !== null" :class="ui.label({ class: props.ui?.label, active })">
|
||||||
{{ label }}
|
{{ label }}
|
||||||
</span>
|
</span>
|
||||||
</slot>
|
</slot>
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ const Calendar = computed(() => props.range ? RangeCalendar : SingleCalendar)
|
|||||||
:default-value="defaultValue"
|
:default-value="defaultValue"
|
||||||
:locale="locale"
|
:locale="locale"
|
||||||
:dir="dir"
|
:dir="dir"
|
||||||
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
||||||
>
|
>
|
||||||
<Calendar.Header :class="ui.header({ class: props.ui?.header })">
|
<Calendar.Header :class="ui.header({ class: props.ui?.header })">
|
||||||
<Calendar.Prev v-if="props.yearControls" :prev-page="(date: DateValue) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
|
<Calendar.Prev v-if="props.yearControls" :prev-page="(date: DateValue) => paginateYear(date, -1)" :aria-label="t('calendar.prevYear')" as-child>
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.card || {})
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
||||||
<div v-if="!!slots.header" :class="ui.header({ class: props.ui?.header })">
|
<div v-if="!!slots.header" :class="ui.header({ class: props.ui?.header })">
|
||||||
<slot name="header" />
|
<slot name="header" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,7 +15,13 @@ import type { ComponentConfig } from '../types/utils'
|
|||||||
|
|
||||||
type Carousel = ComponentConfig<typeof theme, AppConfig, 'carousel'>
|
type Carousel = ComponentConfig<typeof theme, AppConfig, 'carousel'>
|
||||||
|
|
||||||
export type CarouselItem = AcceptableValue
|
interface _CarouselItem {
|
||||||
|
class?: any
|
||||||
|
ui?: Pick<Carousel['slots'], 'item'>
|
||||||
|
[key: string]: any
|
||||||
|
}
|
||||||
|
|
||||||
|
export type CarouselItem = _CarouselItem | AcceptableValue
|
||||||
|
|
||||||
export interface CarouselProps<T extends CarouselItem = CarouselItem> extends Omit<EmblaOptionsType, 'axis' | 'container' | 'slides' | 'direction'> {
|
export interface CarouselProps<T extends CarouselItem = CarouselItem> extends Omit<EmblaOptionsType, 'axis' | 'container' | 'slides' | 'direction'> {
|
||||||
/**
|
/**
|
||||||
@@ -254,6 +260,10 @@ function onSelect(api: EmblaCarouselType) {
|
|||||||
emits('select', selectedIndex.value)
|
emits('select', selectedIndex.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isCarouselItem(item: CarouselItem): item is _CarouselItem {
|
||||||
|
return typeof item === 'object' && item !== null
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (!emblaApi.value) {
|
if (!emblaApi.value) {
|
||||||
return
|
return
|
||||||
@@ -278,7 +288,7 @@ defineExpose({
|
|||||||
role="region"
|
role="region"
|
||||||
aria-roledescription="carousel"
|
aria-roledescription="carousel"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
||||||
@keydown="onKeyDown"
|
@keydown="onKeyDown"
|
||||||
>
|
>
|
||||||
<div ref="emblaRef" :class="ui.viewport({ class: props.ui?.viewport })">
|
<div ref="emblaRef" :class="ui.viewport({ class: props.ui?.viewport })">
|
||||||
@@ -288,7 +298,7 @@ defineExpose({
|
|||||||
:key="index"
|
:key="index"
|
||||||
role="group"
|
role="group"
|
||||||
aria-roledescription="slide"
|
aria-roledescription="slide"
|
||||||
:class="ui.item({ class: props.ui?.item })"
|
:class="ui.item({ class: [props.ui?.item, isCarouselItem(item) && item.ui?.item, isCarouselItem(item) && item.class] })"
|
||||||
>
|
>
|
||||||
<slot :item="item" :index="index" />
|
<slot :item="item" :index="index" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ function onUpdate(value: any) {
|
|||||||
|
|
||||||
<!-- eslint-disable vue/no-template-shadow -->
|
<!-- eslint-disable vue/no-template-shadow -->
|
||||||
<template>
|
<template>
|
||||||
<Primitive :as="variant === 'list' ? as : Label" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
<Primitive :as="(!variant || variant === 'list') ? as : Label" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
||||||
<div :class="ui.container({ class: props.ui?.container })">
|
<div :class="ui.container({ class: props.ui?.container })">
|
||||||
<CheckboxRoot
|
<CheckboxRoot
|
||||||
:id="id"
|
:id="id"
|
||||||
@@ -122,7 +122,7 @@ function onUpdate(value: any) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="(label || !!slots.label) || (description || !!slots.description)" :class="ui.wrapper({ class: props.ui?.wrapper })">
|
<div v-if="(label || !!slots.label) || (description || !!slots.description)" :class="ui.wrapper({ class: props.ui?.wrapper })">
|
||||||
<component :is="variant === 'list' ? Label : 'p'" v-if="label || !!slots.label" :for="id" :class="ui.label({ class: props.ui?.label })">
|
<component :is="(!variant || variant === 'list') ? Label : 'p'" v-if="label || !!slots.label" :for="id" :class="ui.label({ class: props.ui?.label })">
|
||||||
<slot name="label" :label="label">
|
<slot name="label" :label="label">
|
||||||
{{ label }}
|
{{ label }}
|
||||||
</slot>
|
</slot>
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ export type CheckboxGroupItem = {
|
|||||||
description?: string
|
description?: string
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
value?: string
|
value?: string
|
||||||
|
class?: any
|
||||||
|
ui?: Pick<CheckboxGroup['slots'], 'item'> & Omit<Required<CheckboxProps>['ui'], 'root'>
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
} | CheckboxGroupValue
|
} | CheckboxGroupValue
|
||||||
|
|
||||||
export interface CheckboxGroupProps<T extends CheckboxGroupItem = CheckboxGroupItem> extends Pick<CheckboxGroupRootProps, 'defaultValue' | 'disabled' | 'loop' | 'modelValue' | 'name' | 'required'>, Pick<CheckboxProps, 'color' | 'variant' | 'indicator' | 'icon'> {
|
export interface CheckboxGroupProps<T extends CheckboxGroupItem = CheckboxGroupItem> extends Pick<CheckboxGroupRootProps, 'defaultValue' | 'disabled' | 'loop' | 'modelValue' | 'name' | 'required'>, Pick<CheckboxProps, 'color' | 'indicator' | 'icon'> {
|
||||||
/**
|
/**
|
||||||
* The element or component this component should render as.
|
* The element or component this component should render as.
|
||||||
* @defaultValue 'div'
|
* @defaultValue 'div'
|
||||||
@@ -44,6 +46,10 @@ export interface CheckboxGroupProps<T extends CheckboxGroupItem = CheckboxGroupI
|
|||||||
* @defaultValue 'md'
|
* @defaultValue 'md'
|
||||||
*/
|
*/
|
||||||
size?: CheckboxGroup['variants']['size']
|
size?: CheckboxGroup['variants']['size']
|
||||||
|
/**
|
||||||
|
* @defaultValue 'list'
|
||||||
|
*/
|
||||||
|
variant?: CheckboxGroup['variants']['variant']
|
||||||
/**
|
/**
|
||||||
* The orientation the checkbox buttons are laid out.
|
* The orientation the checkbox buttons are laid out.
|
||||||
* @defaultValue 'vertical'
|
* @defaultValue 'vertical'
|
||||||
@@ -74,6 +80,7 @@ import { useAppConfig } from '#imports'
|
|||||||
import { useFormField } from '../composables/useFormField'
|
import { useFormField } from '../composables/useFormField'
|
||||||
import { get, omit } from '../utils'
|
import { get, omit } from '../utils'
|
||||||
import { tv } from '../utils/tv'
|
import { tv } from '../utils/tv'
|
||||||
|
import UCheckbox from './Checkbox.vue'
|
||||||
|
|
||||||
const props = withDefaults(defineProps<CheckboxGroupProps<T>>(), {
|
const props = withDefaults(defineProps<CheckboxGroupProps<T>>(), {
|
||||||
valueKey: 'value',
|
valueKey: 'value',
|
||||||
@@ -96,7 +103,9 @@ const id = _id.value ?? useId()
|
|||||||
const ui = computed(() => tv({ extend: theme, ...(appConfig.ui?.checkboxGroup || {}) })({
|
const ui = computed(() => tv({ extend: theme, ...(appConfig.ui?.checkboxGroup || {}) })({
|
||||||
size: size.value,
|
size: size.value,
|
||||||
required: props.required,
|
required: props.required,
|
||||||
orientation: props.orientation
|
orientation: props.orientation,
|
||||||
|
color: props.color,
|
||||||
|
variant: props.variant
|
||||||
}))
|
}))
|
||||||
|
|
||||||
function normalizeItem(item: any) {
|
function normalizeItem(item: any) {
|
||||||
@@ -152,7 +161,7 @@ function onUpdate(value: any) {
|
|||||||
v-bind="rootProps"
|
v-bind="rootProps"
|
||||||
:name="name"
|
:name="name"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
||||||
@update:model-value="onUpdate"
|
@update:model-value="onUpdate"
|
||||||
>
|
>
|
||||||
<fieldset :class="ui.fieldset({ class: props.ui?.fieldset })" v-bind="ariaAttrs">
|
<fieldset :class="ui.fieldset({ class: props.ui?.fieldset })" v-bind="ariaAttrs">
|
||||||
@@ -170,8 +179,8 @@ function onUpdate(value: any) {
|
|||||||
:size="size"
|
:size="size"
|
||||||
:name="name"
|
:name="name"
|
||||||
:disabled="item.disabled || disabled"
|
:disabled="item.disabled || disabled"
|
||||||
:ui="props.ui ? omit(props.ui, ['root']) : undefined"
|
:ui="{ ...(props.ui ? omit(props.ui, ['root']) : undefined), ...(item.ui || {}) }"
|
||||||
:class="ui.item({ class: props.ui?.item })"
|
:class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class] })"
|
||||||
>
|
>
|
||||||
<template v-for="(_, name) in proxySlots" #[name]>
|
<template v-for="(_, name) in proxySlots" #[name]>
|
||||||
<slot :name="(name as keyof CheckboxGroupSlots<T>)" :item="item" />
|
<slot :name="(name as keyof CheckboxGroupSlots<T>)" :item="item" />
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.chip || {})
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
||||||
<Slot v-bind="$attrs">
|
<Slot v-bind="$attrs">
|
||||||
<slot />
|
<slot />
|
||||||
</Slot>
|
</Slot>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.collapsible
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CollapsibleRoot v-slot="{ open }" v-bind="rootProps" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
<CollapsibleRoot v-slot="{ open }" v-bind="rootProps" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
||||||
<CollapsibleTrigger v-if="!!slots.default" as-child>
|
<CollapsibleTrigger v-if="!!slots.default" as-child>
|
||||||
<slot :open="open" />
|
<slot :open="open" />
|
||||||
</CollapsibleTrigger>
|
</CollapsibleTrigger>
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ const trackThumbStyle = computed(() => ({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })" :data-disabled="disabled ? true : undefined">
|
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })" :data-disabled="disabled ? true : undefined">
|
||||||
<div :class="ui.picker({ class: props.ui?.picker })">
|
<div :class="ui.picker({ class: props.ui?.picker })">
|
||||||
<div
|
<div
|
||||||
ref="selectorRef"
|
ref="selectorRef"
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ export interface CommandPaletteItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
|
|||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
slot?: string
|
slot?: string
|
||||||
onSelect?(e?: Event): void
|
onSelect?(e?: Event): void
|
||||||
|
class?: any
|
||||||
|
ui?: Pick<CommandPalette['slots'], 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemLabel' | 'itemLabelPrefix' | 'itemLabelBase' | 'itemLabelSuffix' | 'itemTrailing' | 'itemTrailingKbds' | 'itemTrailingKbdsSize' | 'itemTrailingHighlightedIcon' | 'itemTrailingIcon'>
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,7 +251,7 @@ const groups = computed(() => {
|
|||||||
|
|
||||||
<!-- eslint-disable vue/no-v-html -->
|
<!-- eslint-disable vue/no-v-html -->
|
||||||
<template>
|
<template>
|
||||||
<ListboxRoot v-bind="rootProps" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
<ListboxRoot v-bind="rootProps" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
||||||
<ListboxFilter v-model="searchTerm" as-child>
|
<ListboxFilter v-model="searchTerm" as-child>
|
||||||
<UInput
|
<UInput
|
||||||
:placeholder="placeholder || t('commandPalette.placeholder')"
|
:placeholder="placeholder || t('commandPalette.placeholder')"
|
||||||
@@ -293,42 +295,42 @@ const groups = computed(() => {
|
|||||||
@select="item.onSelect"
|
@select="item.onSelect"
|
||||||
>
|
>
|
||||||
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item)" custom>
|
||||||
<ULinkBase v-bind="slotProps" :class="ui.item({ class: props.ui?.item, active: active || item.active })">
|
<ULinkBase v-bind="slotProps" :class="ui.item({ class: [props.ui?.item, item.ui?.item, item.class], active: active || item.active })">
|
||||||
<slot :name="((item.slot || group.slot || 'item') as keyof CommandPaletteSlots<G, T>)" :item="(item as any)" :index="index">
|
<slot :name="((item.slot || group.slot || 'item') as keyof CommandPaletteSlots<G, T>)" :item="(item as any)" :index="index">
|
||||||
<slot :name="((item.slot ? `${item.slot}-leading` : group.slot ? `${group.slot}-leading` : `item-leading`) as keyof CommandPaletteSlots<G, T>)" :item="(item as any)" :index="index">
|
<slot :name="((item.slot ? `${item.slot}-leading` : group.slot ? `${group.slot}-leading` : `item-leading`) as keyof CommandPaletteSlots<G, T>)" :item="(item as any)" :index="index">
|
||||||
<UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: props.ui?.itemLeadingIcon, loading: true })" />
|
<UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: [props.ui?.itemLeadingIcon, item.ui?.itemLeadingIcon], loading: true })" />
|
||||||
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: props.ui?.itemLeadingIcon, active: active || item.active })" />
|
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: [props.ui?.itemLeadingIcon, item.ui?.itemLeadingIcon], active: active || item.active })" />
|
||||||
<UAvatar v-else-if="item.avatar" :size="((props.ui?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: props.ui?.itemLeadingAvatar, active: active || item.active })" />
|
<UAvatar v-else-if="item.avatar" :size="((item.ui?.itemLeadingAvatarSize || props.ui?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: [props.ui?.itemLeadingAvatar, item.ui?.itemLeadingAvatar], active: active || item.active })" />
|
||||||
<UChip
|
<UChip
|
||||||
v-else-if="item.chip"
|
v-else-if="item.chip"
|
||||||
:size="((props.ui?.itemLeadingChipSize || ui.itemLeadingChipSize()) as ChipProps['size'])"
|
:size="((item.ui?.itemLeadingChipSize || props.ui?.itemLeadingChipSize || ui.itemLeadingChipSize()) as ChipProps['size'])"
|
||||||
inset
|
inset
|
||||||
standalone
|
standalone
|
||||||
v-bind="item.chip"
|
v-bind="item.chip"
|
||||||
:class="ui.itemLeadingChip({ class: props.ui?.itemLeadingChip, active: active || item.active })"
|
:class="ui.itemLeadingChip({ class: [props.ui?.itemLeadingChip, item.ui?.itemLeadingChip], active: active || item.active })"
|
||||||
/>
|
/>
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
<span v-if="item.labelHtml || get(item, props.labelKey as string) || !!slots[(item.slot ? `${item.slot}-label` : group.slot ? `${group.slot}-label` : `item-label`) as keyof CommandPaletteSlots<G, T>]" :class="ui.itemLabel({ class: props.ui?.itemLabel, active: active || item.active })">
|
<span v-if="item.labelHtml || get(item, props.labelKey as string) || !!slots[(item.slot ? `${item.slot}-label` : group.slot ? `${group.slot}-label` : `item-label`) as keyof CommandPaletteSlots<G, T>]" :class="ui.itemLabel({ class: [props.ui?.itemLabel, item.ui?.itemLabel], active: active || item.active })">
|
||||||
<slot :name="((item.slot ? `${item.slot}-label` : group.slot ? `${group.slot}-label` : `item-label`) as keyof CommandPaletteSlots<G, T>)" :item="(item as any)" :index="index">
|
<slot :name="((item.slot ? `${item.slot}-label` : group.slot ? `${group.slot}-label` : `item-label`) as keyof CommandPaletteSlots<G, T>)" :item="(item as any)" :index="index">
|
||||||
<span v-if="item.prefix" :class="ui.itemLabelPrefix({ class: props.ui?.itemLabelPrefix })">{{ item.prefix }}</span>
|
<span v-if="item.prefix" :class="ui.itemLabelPrefix({ class: [props.ui?.itemLabelPrefix, item.ui?.itemLabelPrefix] })">{{ item.prefix }}</span>
|
||||||
|
|
||||||
<span :class="ui.itemLabelBase({ class: props.ui?.itemLabelBase, active: active || item.active })" v-html="item.labelHtml || get(item, props.labelKey as string)" />
|
<span :class="ui.itemLabelBase({ class: [props.ui?.itemLabelBase, item.ui?.itemLabelBase], active: active || item.active })" v-html="item.labelHtml || get(item, props.labelKey as string)" />
|
||||||
|
|
||||||
<span :class="ui.itemLabelSuffix({ class: props.ui?.itemLabelSuffix, active: active || item.active })" v-html="item.suffixHtml || item.suffix" />
|
<span :class="ui.itemLabelSuffix({ class: [props.ui?.itemLabelSuffix, item.ui?.itemLabelSuffix], active: active || item.active })" v-html="item.suffixHtml || item.suffix" />
|
||||||
</slot>
|
</slot>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span :class="ui.itemTrailing({ class: props.ui?.itemTrailing })">
|
<span :class="ui.itemTrailing({ class: [props.ui?.itemTrailing, item.ui?.itemTrailing] })">
|
||||||
<slot :name="((item.slot ? `${item.slot}-trailing` : group.slot ? `${group.slot}-trailing` : `item-trailing`) as keyof CommandPaletteSlots<G, T>)" :item="(item as any)" :index="index">
|
<slot :name="((item.slot ? `${item.slot}-trailing` : group.slot ? `${group.slot}-trailing` : `item-trailing`) as keyof CommandPaletteSlots<G, T>)" :item="(item as any)" :index="index">
|
||||||
<span v-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: props.ui?.itemTrailingKbds })">
|
<span v-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: [props.ui?.itemTrailingKbds, item.ui?.itemTrailingKbds] })">
|
||||||
<UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="((props.ui?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()) as KbdProps['size'])" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
<UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="((item.ui?.itemTrailingKbdsSize || props.ui?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()) as KbdProps['size'])" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
||||||
</span>
|
</span>
|
||||||
<UIcon v-else-if="group.highlightedIcon" :name="group.highlightedIcon" :class="ui.itemTrailingHighlightedIcon({ class: props.ui?.itemTrailingHighlightedIcon })" />
|
<UIcon v-else-if="group.highlightedIcon" :name="group.highlightedIcon" :class="ui.itemTrailingHighlightedIcon({ class: [props.ui?.itemTrailingHighlightedIcon, item.ui?.itemTrailingHighlightedIcon] })" />
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
<ListboxItemIndicator as-child>
|
<ListboxItemIndicator as-child>
|
||||||
<UIcon :name="selectedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: props.ui?.itemTrailingIcon })" />
|
<UIcon :name="selectedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: [props.ui?.itemTrailingIcon, item.ui?.itemTrailingIcon] })" />
|
||||||
</ListboxItemIndicator>
|
</ListboxItemIndicator>
|
||||||
</span>
|
</span>
|
||||||
</slot>
|
</slot>
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ export interface ContextMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'custo
|
|||||||
children?: ArrayOrNested<ContextMenuItem>
|
children?: ArrayOrNested<ContextMenuItem>
|
||||||
onSelect?(e: Event): void
|
onSelect?(e: Event): void
|
||||||
onUpdateChecked?(checked: boolean): void
|
onUpdateChecked?(checked: boolean): void
|
||||||
|
class?: any
|
||||||
|
ui?: Pick<ContextMenu['slots'], 'item' | 'label' | 'separator' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLabel' | 'itemLabelExternalIcon' | 'itemTrailing' | 'itemTrailingIcon' | 'itemTrailingKbds' | 'itemTrailingKbdsSize'>
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,29 +77,29 @@ const groups = computed<ContextMenuItem[][]>(() =>
|
|||||||
<DefineItemTemplate v-slot="{ item, active, index }">
|
<DefineItemTemplate v-slot="{ item, active, index }">
|
||||||
<slot :name="((item.slot || 'item') as keyof ContextMenuSlots<T>)" :item="item" :index="index">
|
<slot :name="((item.slot || 'item') as keyof ContextMenuSlots<T>)" :item="item" :index="index">
|
||||||
<slot :name="((item.slot ? `${item.slot}-leading`: 'item-leading') as keyof ContextMenuSlots<T>)" :item="item" :active="active" :index="index">
|
<slot :name="((item.slot ? `${item.slot}-leading`: 'item-leading') as keyof ContextMenuSlots<T>)" :item="item" :active="active" :index="index">
|
||||||
<UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, color: item?.color, loading: true })" />
|
<UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: [uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item?.color, loading: true })" />
|
||||||
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, color: item?.color, active })" />
|
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: [uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item?.color, active })" />
|
||||||
<UAvatar v-else-if="item.avatar" :size="((props.uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: uiOverride?.itemLeadingAvatar, active })" />
|
<UAvatar v-else-if="item.avatar" :size="((item.ui?.itemLeadingAvatarSize || props.uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: [uiOverride?.itemLeadingAvatar, item.ui?.itemLeadingAvatar], active })" />
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
<span v-if="get(item, props.labelKey as string) || !!slots[(item.slot ? `${item.slot}-label`: 'item-label') as keyof ContextMenuSlots<T>]" :class="ui.itemLabel({ class: uiOverride?.itemLabel, active })">
|
<span v-if="get(item, props.labelKey as string) || !!slots[(item.slot ? `${item.slot}-label`: 'item-label') as keyof ContextMenuSlots<T>]" :class="ui.itemLabel({ class: [uiOverride?.itemLabel, item.ui?.itemLabel], active })">
|
||||||
<slot :name="((item.slot ? `${item.slot}-label`: 'item-label') as keyof ContextMenuSlots<T>)" :item="item" :active="active" :index="index">
|
<slot :name="((item.slot ? `${item.slot}-label`: 'item-label') as keyof ContextMenuSlots<T>)" :item="item" :active="active" :index="index">
|
||||||
{{ get(item, props.labelKey as string) }}
|
{{ get(item, props.labelKey as string) }}
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
<UIcon v-if="item.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.itemLabelExternalIcon({ class: uiOverride?.itemLabelExternalIcon, color: item?.color, active })" />
|
<UIcon v-if="item.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.itemLabelExternalIcon({ class: [uiOverride?.itemLabelExternalIcon, item.ui?.itemLabelExternalIcon], color: item?.color, active })" />
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span :class="ui.itemTrailing({ class: uiOverride?.itemTrailing })">
|
<span :class="ui.itemTrailing({ class: [uiOverride?.itemTrailing, item.ui?.itemTrailing] })">
|
||||||
<slot :name="((item.slot ? `${item.slot}-trailing`: 'item-trailing') as keyof ContextMenuSlots<T>)" :item="item" :active="active" :index="index">
|
<slot :name="((item.slot ? `${item.slot}-trailing`: 'item-trailing') as keyof ContextMenuSlots<T>)" :item="item" :active="active" :index="index">
|
||||||
<UIcon v-if="item.children?.length" :name="childrenIcon" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, color: item?.color, active })" />
|
<UIcon v-if="item.children?.length" :name="childrenIcon" :class="ui.itemTrailingIcon({ class: [uiOverride?.itemTrailingIcon, item.ui?.itemTrailingIcon], color: item?.color, active })" />
|
||||||
<span v-else-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: uiOverride?.itemTrailingKbds })">
|
<span v-else-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: [uiOverride?.itemTrailingKbds, item.ui?.itemTrailingKbds] })">
|
||||||
<UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="((props.uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()) as KbdProps['size'])" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
<UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="((item.ui?.itemTrailingKbdsSize || props.uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()) as KbdProps['size'])" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
||||||
</span>
|
</span>
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
<ContextMenu.ItemIndicator as-child>
|
<ContextMenu.ItemIndicator as-child>
|
||||||
<UIcon :name="checkedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, color: item?.color })" />
|
<UIcon :name="checkedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: [uiOverride?.itemTrailingIcon, item.ui?.itemTrailingIcon], color: item?.color })" />
|
||||||
</ContextMenu.ItemIndicator>
|
</ContextMenu.ItemIndicator>
|
||||||
</span>
|
</span>
|
||||||
</slot>
|
</slot>
|
||||||
@@ -111,17 +111,17 @@ const groups = computed<ContextMenuItem[][]>(() =>
|
|||||||
|
|
||||||
<ContextMenu.Group v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="ui.group({ class: uiOverride?.group })">
|
<ContextMenu.Group v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="ui.group({ class: uiOverride?.group })">
|
||||||
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
||||||
<ContextMenu.Label v-if="item.type === 'label'" :class="ui.label({ class: uiOverride?.label })">
|
<ContextMenu.Label v-if="item.type === 'label'" :class="ui.label({ class: [uiOverride?.label, item.ui?.label, item.class] })">
|
||||||
<ReuseItemTemplate :item="item" :index="index" />
|
<ReuseItemTemplate :item="item" :index="index" />
|
||||||
</ContextMenu.Label>
|
</ContextMenu.Label>
|
||||||
<ContextMenu.Separator v-else-if="item.type === 'separator'" :class="ui.separator({ class: uiOverride?.separator })" />
|
<ContextMenu.Separator v-else-if="item.type === 'separator'" :class="ui.separator({ class: [uiOverride?.separator, item.ui?.separator, item.class] })" />
|
||||||
<ContextMenu.Sub v-else-if="item?.children?.length" :open="item.open" :default-open="item.defaultOpen">
|
<ContextMenu.Sub v-else-if="item?.children?.length" :open="item.open" :default-open="item.defaultOpen">
|
||||||
<ContextMenu.SubTrigger
|
<ContextMenu.SubTrigger
|
||||||
as="button"
|
as="button"
|
||||||
type="button"
|
type="button"
|
||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
:text-value="get(item, props.labelKey as string)"
|
:text-value="get(item, props.labelKey as string)"
|
||||||
:class="ui.item({ class: uiOverride?.item, color: item?.color })"
|
:class="ui.item({ class: [uiOverride?.item, item.ui?.item, item.class], color: item?.color })"
|
||||||
>
|
>
|
||||||
<ReuseItemTemplate :item="item" :index="index" />
|
<ReuseItemTemplate :item="item" :index="index" />
|
||||||
</ContextMenu.SubTrigger>
|
</ContextMenu.SubTrigger>
|
||||||
@@ -150,7 +150,7 @@ const groups = computed<ContextMenuItem[][]>(() =>
|
|||||||
:model-value="item.checked"
|
:model-value="item.checked"
|
||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
:text-value="get(item, props.labelKey as string)"
|
:text-value="get(item, props.labelKey as string)"
|
||||||
:class="ui.item({ class: [uiOverride?.item, item.class], color: item?.color })"
|
:class="ui.item({ class: [uiOverride?.item, item.ui?.item, item.class], color: item?.color })"
|
||||||
@update:model-value="item.onUpdateChecked"
|
@update:model-value="item.onUpdateChecked"
|
||||||
@select="item.onSelect"
|
@select="item.onSelect"
|
||||||
>
|
>
|
||||||
@@ -164,7 +164,7 @@ const groups = computed<ContextMenuItem[][]>(() =>
|
|||||||
@select="item.onSelect"
|
@select="item.onSelect"
|
||||||
>
|
>
|
||||||
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item as Omit<ContextMenuItem, 'type'>)" custom>
|
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item as Omit<ContextMenuItem, 'type'>)" custom>
|
||||||
<ULinkBase v-bind="slotProps" :class="ui.item({ class: [uiOverride?.item, item.class], active, color: item?.color })">
|
<ULinkBase v-bind="slotProps" :class="ui.item({ class: [uiOverride?.item, item.ui?.item, item.class], active, color: item?.color })">
|
||||||
<ReuseItemTemplate :item="item" :active="active" :index="index" />
|
<ReuseItemTemplate :item="item" :active="active" :index="index" />
|
||||||
</ULinkBase>
|
</ULinkBase>
|
||||||
</ULink>
|
</ULink>
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ export interface DropdownMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cust
|
|||||||
children?: ArrayOrNested<DropdownMenuItem>
|
children?: ArrayOrNested<DropdownMenuItem>
|
||||||
onSelect?(e: Event): void
|
onSelect?(e: Event): void
|
||||||
onUpdateChecked?(checked: boolean): void
|
onUpdateChecked?(checked: boolean): void
|
||||||
|
class?: any
|
||||||
|
ui?: Pick<DropdownMenu['slots'], 'item' | 'label' | 'separator' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLabel' | 'itemLabelExternalIcon' | 'itemTrailing' | 'itemTrailingIcon' | 'itemTrailingKbds' | 'itemTrailingKbdsSize'>
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,29 +83,29 @@ const groups = computed<DropdownMenuItem[][]>(() =>
|
|||||||
<DefineItemTemplate v-slot="{ item, active, index }">
|
<DefineItemTemplate v-slot="{ item, active, index }">
|
||||||
<slot :name="((item.slot || 'item') as keyof DropdownMenuContentSlots<T>)" :item="(item as Extract<NestedItem<T>, { slot: string; }>)" :index="index">
|
<slot :name="((item.slot || 'item') as keyof DropdownMenuContentSlots<T>)" :item="(item as Extract<NestedItem<T>, { slot: string; }>)" :index="index">
|
||||||
<slot :name="((item.slot ? `${item.slot}-leading`: 'item-leading') as keyof DropdownMenuContentSlots<T>)" :item="(item as Extract<NestedItem<T>, { slot: string; }>)" :active="active" :index="index">
|
<slot :name="((item.slot ? `${item.slot}-leading`: 'item-leading') as keyof DropdownMenuContentSlots<T>)" :item="(item as Extract<NestedItem<T>, { slot: string; }>)" :active="active" :index="index">
|
||||||
<UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, color: item?.color, loading: true })" />
|
<UIcon v-if="item.loading" :name="loadingIcon || appConfig.ui.icons.loading" :class="ui.itemLeadingIcon({ class: [uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item?.color, loading: true })" />
|
||||||
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: uiOverride?.itemLeadingIcon, color: item?.color, active })" />
|
<UIcon v-else-if="item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: [uiOverride?.itemLeadingIcon, item.ui?.itemLeadingIcon], color: item?.color, active })" />
|
||||||
<UAvatar v-else-if="item.avatar" :size="((props.uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: uiOverride?.itemLeadingAvatar, active })" />
|
<UAvatar v-else-if="item.avatar" :size="((item.ui?.itemLeadingAvatarSize || props.uiOverride?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: [uiOverride?.itemLeadingAvatar, item.ui?.itemLeadingAvatar], active })" />
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
<span v-if="get(item, props.labelKey as string) || !!slots[(item.slot ? `${item.slot}-label`: 'item-label') as keyof DropdownMenuContentSlots<T>]" :class="ui.itemLabel({ class: uiOverride?.itemLabel, active })">
|
<span v-if="get(item, props.labelKey as string) || !!slots[(item.slot ? `${item.slot}-label`: 'item-label') as keyof DropdownMenuContentSlots<T>]" :class="ui.itemLabel({ class: [uiOverride?.itemLabel, item.ui?.itemLabel], active })">
|
||||||
<slot :name="((item.slot ? `${item.slot}-label`: 'item-label') as keyof DropdownMenuContentSlots<T>)" :item="(item as Extract<NestedItem<T>, { slot: string; }>)" :active="active" :index="index">
|
<slot :name="((item.slot ? `${item.slot}-label`: 'item-label') as keyof DropdownMenuContentSlots<T>)" :item="(item as Extract<NestedItem<T>, { slot: string; }>)" :active="active" :index="index">
|
||||||
{{ get(item, props.labelKey as string) }}
|
{{ get(item, props.labelKey as string) }}
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
<UIcon v-if="item.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.itemLabelExternalIcon({ class: uiOverride?.itemLabelExternalIcon, color: item?.color, active })" />
|
<UIcon v-if="item.target === '_blank' && externalIcon !== false" :name="typeof externalIcon === 'string' ? externalIcon : appConfig.ui.icons.external" :class="ui.itemLabelExternalIcon({ class: [uiOverride?.itemLabelExternalIcon, item.ui?.itemLabelExternalIcon], color: item?.color, active })" />
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span :class="ui.itemTrailing({ class: uiOverride?.itemTrailing })">
|
<span :class="ui.itemTrailing({ class: [uiOverride?.itemTrailing, item.ui?.itemTrailing] })">
|
||||||
<slot :name="((item.slot ? `${item.slot}-trailing`: 'item-trailing') as keyof DropdownMenuContentSlots<T>)" :item="(item as Extract<NestedItem<T>, { slot: string; }>)" :active="active" :index="index">
|
<slot :name="((item.slot ? `${item.slot}-trailing`: 'item-trailing') as keyof DropdownMenuContentSlots<T>)" :item="(item as Extract<NestedItem<T>, { slot: string; }>)" :active="active" :index="index">
|
||||||
<UIcon v-if="item.children?.length" :name="childrenIcon" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, color: item?.color, active })" />
|
<UIcon v-if="item.children?.length" :name="childrenIcon" :class="ui.itemTrailingIcon({ class: [uiOverride?.itemTrailingIcon, item.ui?.itemTrailingIcon], color: item?.color, active })" />
|
||||||
<span v-else-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: uiOverride?.itemTrailingKbds })">
|
<span v-else-if="item.kbds?.length" :class="ui.itemTrailingKbds({ class: [uiOverride?.itemTrailingKbds, item.ui?.itemTrailingKbds] })">
|
||||||
<UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="((props.uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()) as KbdProps['size'])" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
<UKbd v-for="(kbd, kbdIndex) in item.kbds" :key="kbdIndex" :size="((item.ui?.itemTrailingKbdsSize || props.uiOverride?.itemTrailingKbdsSize || ui.itemTrailingKbdsSize()) as KbdProps['size'])" v-bind="typeof kbd === 'string' ? { value: kbd } : kbd" />
|
||||||
</span>
|
</span>
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
<DropdownMenu.ItemIndicator as-child>
|
<DropdownMenu.ItemIndicator as-child>
|
||||||
<UIcon :name="checkedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: uiOverride?.itemTrailingIcon, color: item?.color })" />
|
<UIcon :name="checkedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: [uiOverride?.itemTrailingIcon, item.ui?.itemTrailingIcon], color: item?.color })" />
|
||||||
</DropdownMenu.ItemIndicator>
|
</DropdownMenu.ItemIndicator>
|
||||||
</span>
|
</span>
|
||||||
</slot>
|
</slot>
|
||||||
@@ -117,17 +117,17 @@ const groups = computed<DropdownMenuItem[][]>(() =>
|
|||||||
|
|
||||||
<DropdownMenu.Group v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="ui.group({ class: uiOverride?.group })">
|
<DropdownMenu.Group v-for="(group, groupIndex) in groups" :key="`group-${groupIndex}`" :class="ui.group({ class: uiOverride?.group })">
|
||||||
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
||||||
<DropdownMenu.Label v-if="item.type === 'label'" :class="ui.label({ class: uiOverride?.label })">
|
<DropdownMenu.Label v-if="item.type === 'label'" :class="ui.label({ class: [uiOverride?.label, item.ui?.label, item.class] })">
|
||||||
<ReuseItemTemplate :item="item" :index="index" />
|
<ReuseItemTemplate :item="item" :index="index" />
|
||||||
</DropdownMenu.Label>
|
</DropdownMenu.Label>
|
||||||
<DropdownMenu.Separator v-else-if="item.type === 'separator'" :class="ui.separator({ class: uiOverride?.separator })" />
|
<DropdownMenu.Separator v-else-if="item.type === 'separator'" :class="ui.separator({ class: [uiOverride?.separator, item.ui?.separator, item.class] })" />
|
||||||
<DropdownMenu.Sub v-else-if="item?.children?.length" :open="item.open" :default-open="item.defaultOpen">
|
<DropdownMenu.Sub v-else-if="item?.children?.length" :open="item.open" :default-open="item.defaultOpen">
|
||||||
<DropdownMenu.SubTrigger
|
<DropdownMenu.SubTrigger
|
||||||
as="button"
|
as="button"
|
||||||
type="button"
|
type="button"
|
||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
:text-value="get(item, props.labelKey as string)"
|
:text-value="get(item, props.labelKey as string)"
|
||||||
:class="ui.item({ class: uiOverride?.item, color: item?.color })"
|
:class="ui.item({ class: [uiOverride?.item, item.ui?.item, item.class], color: item?.color })"
|
||||||
>
|
>
|
||||||
<ReuseItemTemplate :item="item" :index="index" />
|
<ReuseItemTemplate :item="item" :index="index" />
|
||||||
</DropdownMenu.SubTrigger>
|
</DropdownMenu.SubTrigger>
|
||||||
@@ -158,7 +158,7 @@ const groups = computed<DropdownMenuItem[][]>(() =>
|
|||||||
:model-value="item.checked"
|
:model-value="item.checked"
|
||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
:text-value="get(item, props.labelKey as string)"
|
:text-value="get(item, props.labelKey as string)"
|
||||||
:class="ui.item({ class: [uiOverride?.item, item.class], color: item?.color })"
|
:class="ui.item({ class: [uiOverride?.item, item.ui?.item, item.class], color: item?.color })"
|
||||||
@update:model-value="item.onUpdateChecked"
|
@update:model-value="item.onUpdateChecked"
|
||||||
@select="item.onSelect"
|
@select="item.onSelect"
|
||||||
>
|
>
|
||||||
@@ -172,7 +172,7 @@ const groups = computed<DropdownMenuItem[][]>(() =>
|
|||||||
@select="item.onSelect"
|
@select="item.onSelect"
|
||||||
>
|
>
|
||||||
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item as Omit<DropdownMenuItem, 'type'>)" custom>
|
<ULink v-slot="{ active, ...slotProps }" v-bind="pickLinkProps(item as Omit<DropdownMenuItem, 'type'>)" custom>
|
||||||
<ULinkBase v-bind="slotProps" :class="ui.item({ class: [uiOverride?.item, item.class], color: item?.color, active })">
|
<ULinkBase v-bind="slotProps" :class="ui.item({ class: [uiOverride?.item, item.ui?.item, item.class], color: item?.color, active })">
|
||||||
<ReuseItemTemplate :item="item" :active="active" :index="index" />
|
<ReuseItemTemplate :item="item" :active="active" :index="index" />
|
||||||
</ULinkBase>
|
</ULinkBase>
|
||||||
</ULink>
|
</ULink>
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ provide(formFieldInjectionKey, computed(() => ({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
||||||
<div :class="ui.wrapper({ class: props.ui?.wrapper })">
|
<div :class="ui.wrapper({ class: props.ui?.wrapper })">
|
||||||
<div v-if="label || !!slots.label" :class="ui.labelWrapper({ class: props.ui?.labelWrapper })">
|
<div v-if="label || !!slots.label" :class="ui.labelWrapper({ class: props.ui?.labelWrapper })">
|
||||||
<Label :for="id" :class="ui.label({ class: props.ui?.label })">
|
<Label :for="id" :class="ui.label({ class: props.ui?.label })">
|
||||||
@@ -115,16 +115,16 @@ provide(formFieldInjectionKey, computed(() => ({
|
|||||||
<div :class="[(label || !!slots.label || description || !!slots.description) && ui.container({ class: props.ui?.container })]">
|
<div :class="[(label || !!slots.label || description || !!slots.description) && ui.container({ class: props.ui?.container })]">
|
||||||
<slot :error="error" />
|
<slot :error="error" />
|
||||||
|
|
||||||
<p v-if="(typeof error === 'string' && error) || !!slots.error" :id="`${ariaId}-error`" :class="ui.error({ class: props.ui?.error })">
|
<div v-if="(typeof error === 'string' && error) || !!slots.error" :id="`${ariaId}-error`" :class="ui.error({ class: props.ui?.error })">
|
||||||
<slot name="error" :error="error">
|
<slot name="error" :error="error">
|
||||||
{{ error }}
|
{{ error }}
|
||||||
</slot>
|
</slot>
|
||||||
</p>
|
</div>
|
||||||
<p v-else-if="help || !!slots.help" :class="ui.help({ class: props.ui?.help })">
|
<div v-else-if="help || !!slots.help" :class="ui.help({ class: props.ui?.help })">
|
||||||
<slot name="help" :help="help">
|
<slot name="help" :help="help">
|
||||||
{{ help }}
|
{{ help }}
|
||||||
</slot>
|
</slot>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Primitive>
|
</Primitive>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import type { AppConfig } from '@nuxt/schema'
|
|||||||
import theme from '#build/ui/input'
|
import theme from '#build/ui/input'
|
||||||
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
||||||
import type { AvatarProps } from '../types'
|
import type { AvatarProps } from '../types'
|
||||||
import type { ComponentConfig } from '../types/utils'
|
import type { AcceptableValue, ComponentConfig } from '../types/utils'
|
||||||
|
|
||||||
type Input = ComponentConfig<typeof theme, AppConfig, 'input'>
|
type Input = ComponentConfig<typeof theme, AppConfig, 'input'>
|
||||||
|
|
||||||
@@ -42,8 +42,8 @@ export interface InputProps extends UseComponentIconsProps {
|
|||||||
ui?: Input['slots']
|
ui?: Input['slots']
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface InputEmits {
|
export interface InputEmits<T extends AcceptableValue = AcceptableValue> {
|
||||||
(e: 'update:modelValue', payload: string | number): void
|
(e: 'update:modelValue', payload: T): void
|
||||||
(e: 'blur', event: FocusEvent): void
|
(e: 'blur', event: FocusEvent): void
|
||||||
(e: 'change', event: Event): void
|
(e: 'change', event: Event): void
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,7 @@ export interface InputSlots {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts" generic="T extends AcceptableValue">
|
||||||
import { ref, computed, onMounted } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import { Primitive } from 'reka-ui'
|
import { Primitive } from 'reka-ui'
|
||||||
import { useAppConfig } from '#imports'
|
import { useAppConfig } from '#imports'
|
||||||
@@ -74,12 +74,13 @@ const props = withDefaults(defineProps<InputProps>(), {
|
|||||||
autocomplete: 'off',
|
autocomplete: 'off',
|
||||||
autofocusDelay: 0
|
autofocusDelay: 0
|
||||||
})
|
})
|
||||||
const emits = defineEmits<InputEmits>()
|
const emits = defineEmits<InputEmits<T>>()
|
||||||
const slots = defineSlots<InputSlots>()
|
const slots = defineSlots<InputSlots>()
|
||||||
|
|
||||||
const [modelValue, modelModifiers] = defineModel<string | number | null>()
|
const [modelValue, modelModifiers] = defineModel<T>()
|
||||||
|
|
||||||
const appConfig = useAppConfig() as Input['AppConfig']
|
const appConfig = useAppConfig() as Input['AppConfig']
|
||||||
|
|
||||||
const { emitFormBlur, emitFormInput, emitFormChange, size: formGroupSize, color, id, name, highlight, disabled, emitFormFocus, ariaAttrs } = useFormField<InputProps>(props, { deferInputValidation: true })
|
const { emitFormBlur, emitFormInput, emitFormChange, size: formGroupSize, color, id, name, highlight, disabled, emitFormFocus, ariaAttrs } = useFormField<InputProps>(props, { deferInputValidation: true })
|
||||||
const { orientation, size: buttonGroupSize } = useButtonGroup<InputProps>(props)
|
const { orientation, size: buttonGroupSize } = useButtonGroup<InputProps>(props)
|
||||||
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props)
|
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props)
|
||||||
@@ -114,7 +115,7 @@ function updateInput(value: string | null) {
|
|||||||
value ||= null
|
value ||= null
|
||||||
}
|
}
|
||||||
|
|
||||||
modelValue.value = value
|
modelValue.value = value as T
|
||||||
emitFormInput()
|
emitFormInput()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +164,7 @@ defineExpose({
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Primitive :as="as" :class="ui.root({ class: [props.class, props.ui?.root] })">
|
<Primitive :as="as" :class="ui.root({ class: [props.ui?.root, props.class] })">
|
||||||
<input
|
<input
|
||||||
:id="id"
|
:id="id"
|
||||||
ref="inputRef"
|
ref="inputRef"
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ interface _InputMenuItem {
|
|||||||
type?: 'label' | 'separator' | 'item'
|
type?: 'label' | 'separator' | 'item'
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
onSelect?(e?: Event): void
|
onSelect?(e?: Event): void
|
||||||
|
class?: any
|
||||||
|
ui?: Pick<InputMenu['slots'], 'tagsItem' | 'tagsItemText' | 'tagsItemDelete' | 'tagsItemDeleteIcon' | 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemLabel' | 'itemTrailing' | 'itemTrailingIcon'>
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
export type InputMenuItem = _InputMenuItem | AcceptableValue | boolean
|
export type InputMenuItem = _InputMenuItem | AcceptableValue | boolean
|
||||||
@@ -406,7 +408,7 @@ defineExpose({
|
|||||||
v-bind="rootProps"
|
v-bind="rootProps"
|
||||||
:name="name"
|
:name="name"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
||||||
:as-child="!!multiple"
|
:as-child="!!multiple"
|
||||||
ignore-filter
|
ignore-filter
|
||||||
@update:model-value="onUpdate"
|
@update:model-value="onUpdate"
|
||||||
@@ -426,16 +428,16 @@ defineExpose({
|
|||||||
@focus="onFocus"
|
@focus="onFocus"
|
||||||
@remove-tag="onRemoveTag"
|
@remove-tag="onRemoveTag"
|
||||||
>
|
>
|
||||||
<TagsInputItem v-for="(item, index) in tags" :key="index" :value="item" :class="ui.tagsItem({ class: props.ui?.tagsItem })">
|
<TagsInputItem v-for="(item, index) in tags" :key="index" :value="item" :class="ui.tagsItem({ class: [props.ui?.tagsItem, isInputItem(item) && item.ui?.tagsItem] })">
|
||||||
<TagsInputItemText :class="ui.tagsItemText({ class: props.ui?.tagsItemText })">
|
<TagsInputItemText :class="ui.tagsItemText({ class: [props.ui?.tagsItemText, isInputItem(item) && item.ui?.tagsItemText] })">
|
||||||
<slot name="tags-item-text" :item="(item as NestedItem<T>)" :index="index">
|
<slot name="tags-item-text" :item="(item as NestedItem<T>)" :index="index">
|
||||||
{{ displayValue(item as T) }}
|
{{ displayValue(item as T) }}
|
||||||
</slot>
|
</slot>
|
||||||
</TagsInputItemText>
|
</TagsInputItemText>
|
||||||
|
|
||||||
<TagsInputItemDelete :class="ui.tagsItemDelete({ class: props.ui?.tagsItemDelete })" :disabled="disabled">
|
<TagsInputItemDelete :class="ui.tagsItemDelete({ class: [props.ui?.tagsItemDelete, isInputItem(item) && item.ui?.tagsItemDelete] })" :disabled="disabled">
|
||||||
<slot name="tags-item-delete" :item="(item as NestedItem<T>)" :index="index">
|
<slot name="tags-item-delete" :item="(item as NestedItem<T>)" :index="index">
|
||||||
<UIcon :name="deleteIcon || appConfig.ui.icons.close" :class="ui.tagsItemDeleteIcon({ class: props.ui?.tagsItemDeleteIcon })" />
|
<UIcon :name="deleteIcon || appConfig.ui.icons.close" :class="ui.tagsItemDeleteIcon({ class: [props.ui?.tagsItemDeleteIcon, isInputItem(item) && item.ui?.tagsItemDeleteIcon] })" />
|
||||||
</slot>
|
</slot>
|
||||||
</TagsInputItemDelete>
|
</TagsInputItemDelete>
|
||||||
</TagsInputItem>
|
</TagsInputItem>
|
||||||
@@ -493,44 +495,44 @@ defineExpose({
|
|||||||
|
|
||||||
<ComboboxGroup v-for="(group, groupIndex) in filteredGroups" :key="`group-${groupIndex}`" :class="ui.group({ class: props.ui?.group })">
|
<ComboboxGroup v-for="(group, groupIndex) in filteredGroups" :key="`group-${groupIndex}`" :class="ui.group({ class: props.ui?.group })">
|
||||||
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
<template v-for="(item, index) in group" :key="`group-${groupIndex}-${index}`">
|
||||||
<ComboboxLabel v-if="isInputItem(item) && item.type === 'label'" :class="ui.label({ class: props.ui?.label })">
|
<ComboboxLabel v-if="isInputItem(item) && item.type === 'label'" :class="ui.label({ class: [props.ui?.label, item.ui?.label, item.class] })">
|
||||||
{{ get(item, props.labelKey as string) }}
|
{{ get(item, props.labelKey as string) }}
|
||||||
</ComboboxLabel>
|
</ComboboxLabel>
|
||||||
|
|
||||||
<ComboboxSeparator v-else-if="isInputItem(item) && item.type === 'separator'" :class="ui.separator({ class: props.ui?.separator })" />
|
<ComboboxSeparator v-else-if="isInputItem(item) && item.type === 'separator'" :class="ui.separator({ class: [props.ui?.separator, item.ui?.separator, item.class] })" />
|
||||||
|
|
||||||
<ComboboxItem
|
<ComboboxItem
|
||||||
v-else
|
v-else
|
||||||
:class="ui.item({ class: props.ui?.item })"
|
:class="ui.item({ class: [props.ui?.item, isInputItem(item) && item.ui?.item, isInputItem(item) && item.class] })"
|
||||||
:disabled="isInputItem(item) && item.disabled"
|
:disabled="isInputItem(item) && item.disabled"
|
||||||
:value="props.valueKey && isInputItem(item) ? get(item, props.valueKey as string) : item"
|
:value="props.valueKey && isInputItem(item) ? get(item, props.valueKey as string) : item"
|
||||||
@select="onSelect($event, item)"
|
@select="onSelect($event, item)"
|
||||||
>
|
>
|
||||||
<slot name="item" :item="(item as NestedItem<T>)" :index="index">
|
<slot name="item" :item="(item as NestedItem<T>)" :index="index">
|
||||||
<slot name="item-leading" :item="(item as NestedItem<T>)" :index="index">
|
<slot name="item-leading" :item="(item as NestedItem<T>)" :index="index">
|
||||||
<UIcon v-if="isInputItem(item) && item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: props.ui?.itemLeadingIcon })" />
|
<UIcon v-if="isInputItem(item) && item.icon" :name="item.icon" :class="ui.itemLeadingIcon({ class: [props.ui?.itemLeadingIcon, item.ui?.itemLeadingIcon] })" />
|
||||||
<UAvatar v-else-if="isInputItem(item) && item.avatar" :size="((props.ui?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: props.ui?.itemLeadingAvatar })" />
|
<UAvatar v-else-if="isInputItem(item) && item.avatar" :size="((item.ui?.itemLeadingAvatarSize || props.ui?.itemLeadingAvatarSize || ui.itemLeadingAvatarSize()) as AvatarProps['size'])" v-bind="item.avatar" :class="ui.itemLeadingAvatar({ class: [props.ui?.itemLeadingAvatar, item.ui?.itemLeadingAvatar] })" />
|
||||||
<UChip
|
<UChip
|
||||||
v-else-if="isInputItem(item) && item.chip"
|
v-else-if="isInputItem(item) && item.chip"
|
||||||
:size="((props.ui?.itemLeadingChipSize || ui.itemLeadingChipSize()) as ChipProps['size'])"
|
:size="((item.ui?.itemLeadingChipSize || props.ui?.itemLeadingChipSize || ui.itemLeadingChipSize()) as ChipProps['size'])"
|
||||||
inset
|
inset
|
||||||
standalone
|
standalone
|
||||||
v-bind="item.chip"
|
v-bind="item.chip"
|
||||||
:class="ui.itemLeadingChip({ class: props.ui?.itemLeadingChip })"
|
:class="ui.itemLeadingChip({ class: [props.ui?.itemLeadingChip, item.ui?.itemLeadingChip] })"
|
||||||
/>
|
/>
|
||||||
</slot>
|
</slot>
|
||||||
|
|
||||||
<span :class="ui.itemLabel({ class: props.ui?.itemLabel })">
|
<span :class="ui.itemLabel({ class: [props.ui?.itemLabel, isInputItem(item) && item.ui?.itemLabel] })">
|
||||||
<slot name="item-label" :item="(item as NestedItem<T>)" :index="index">
|
<slot name="item-label" :item="(item as NestedItem<T>)" :index="index">
|
||||||
{{ isInputItem(item) ? get(item, props.labelKey as string) : item }}
|
{{ isInputItem(item) ? get(item, props.labelKey as string) : item }}
|
||||||
</slot>
|
</slot>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span :class="ui.itemTrailing({ class: props.ui?.itemTrailing })">
|
<span :class="ui.itemTrailing({ class: [props.ui?.itemTrailing, isInputItem(item) && item.ui?.itemTrailing] })">
|
||||||
<slot name="item-trailing" :item="(item as NestedItem<T>)" :index="index" />
|
<slot name="item-trailing" :item="(item as NestedItem<T>)" :index="index" />
|
||||||
|
|
||||||
<ComboboxItemIndicator as-child>
|
<ComboboxItemIndicator as-child>
|
||||||
<UIcon :name="selectedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: props.ui?.itemTrailingIcon })" />
|
<UIcon :name="selectedIcon || appConfig.ui.icons.check" :class="ui.itemTrailingIcon({ class: [props.ui?.itemTrailingIcon, isInputItem(item) && item.ui?.itemTrailingIcon] })" />
|
||||||
</ComboboxItemIndicator>
|
</ComboboxItemIndicator>
|
||||||
</span>
|
</span>
|
||||||
</slot>
|
</slot>
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue
|
|||||||
* @IconifyIcon
|
* @IconifyIcon
|
||||||
*/
|
*/
|
||||||
incrementIcon?: string
|
incrementIcon?: string
|
||||||
|
/** Disable the increment button. */
|
||||||
|
incrementDisabled?: boolean
|
||||||
/**
|
/**
|
||||||
* Configure the decrement button. The `color` and `size` are inherited.
|
* Configure the decrement button. The `color` and `size` are inherited.
|
||||||
* @defaultValue { variant: 'link' }
|
* @defaultValue { variant: 'link' }
|
||||||
@@ -47,6 +49,8 @@ export interface InputNumberProps extends Pick<NumberFieldRootProps, 'modelValue
|
|||||||
* @IconifyIcon
|
* @IconifyIcon
|
||||||
*/
|
*/
|
||||||
decrementIcon?: string
|
decrementIcon?: string
|
||||||
|
/** Disable the decrement button. */
|
||||||
|
decrementDisabled?: boolean
|
||||||
autofocus?: boolean
|
autofocus?: boolean
|
||||||
autofocusDelay?: number
|
autofocusDelay?: number
|
||||||
/**
|
/**
|
||||||
@@ -75,6 +79,7 @@ import { onMounted, ref, computed } from 'vue'
|
|||||||
import { NumberFieldRoot, NumberFieldInput, NumberFieldDecrement, NumberFieldIncrement, useForwardPropsEmits } from 'reka-ui'
|
import { NumberFieldRoot, NumberFieldInput, NumberFieldDecrement, NumberFieldIncrement, useForwardPropsEmits } from 'reka-ui'
|
||||||
import { reactivePick } from '@vueuse/core'
|
import { reactivePick } from '@vueuse/core'
|
||||||
import { useAppConfig } from '#imports'
|
import { useAppConfig } from '#imports'
|
||||||
|
import { useButtonGroup } from '../composables/useButtonGroup'
|
||||||
import { useFormField } from '../composables/useFormField'
|
import { useFormField } from '../composables/useFormField'
|
||||||
import { useLocale } from '../composables/useLocale'
|
import { useLocale } from '../composables/useLocale'
|
||||||
import { tv } from '../utils/tv'
|
import { tv } from '../utils/tv'
|
||||||
@@ -83,26 +88,31 @@ import UButton from './Button.vue'
|
|||||||
defineOptions({ inheritAttrs: false })
|
defineOptions({ inheritAttrs: false })
|
||||||
|
|
||||||
const props = withDefaults(defineProps<InputNumberProps>(), {
|
const props = withDefaults(defineProps<InputNumberProps>(), {
|
||||||
orientation: 'horizontal'
|
orientation: 'horizontal',
|
||||||
|
disabledIncrement: false,
|
||||||
|
disabledDecrement: false
|
||||||
})
|
})
|
||||||
const emits = defineEmits<InputNumberEmits>()
|
const emits = defineEmits<InputNumberEmits>()
|
||||||
defineSlots<InputNumberSlots>()
|
defineSlots<InputNumberSlots>()
|
||||||
|
|
||||||
|
const { t, code: codeLocale } = useLocale()
|
||||||
const appConfig = useAppConfig() as InputNumber['AppConfig']
|
const appConfig = useAppConfig() as InputNumber['AppConfig']
|
||||||
|
|
||||||
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'min', 'max', 'step', 'stepSnapping', 'formatOptions', 'disableWheelChange'), emits)
|
const rootProps = useForwardPropsEmits(reactivePick(props, 'as', 'modelValue', 'defaultValue', 'min', 'max', 'step', 'stepSnapping', 'formatOptions', 'disableWheelChange'), emits)
|
||||||
|
|
||||||
const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size, name, highlight, disabled, ariaAttrs } = useFormField<InputNumberProps>(props)
|
const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, id, color, size: formGroupSize, name, highlight, disabled, ariaAttrs } = useFormField<InputNumberProps>(props)
|
||||||
|
const { orientation, size: buttonGroupSize } = useButtonGroup<InputNumberProps>(props)
|
||||||
|
|
||||||
const { t, code: codeLocale } = useLocale()
|
|
||||||
const locale = computed(() => props.locale || codeLocale.value)
|
const locale = computed(() => props.locale || codeLocale.value)
|
||||||
|
const inputSize = computed(() => buttonGroupSize.value || formGroupSize.value)
|
||||||
|
|
||||||
const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.inputNumber || {}) })({
|
const ui = computed(() => tv({ extend: tv(theme), ...(appConfig.ui?.inputNumber || {}) })({
|
||||||
color: color.value,
|
color: color.value,
|
||||||
variant: props.variant,
|
variant: props.variant,
|
||||||
size: size.value,
|
size: inputSize.value,
|
||||||
highlight: highlight.value,
|
highlight: highlight.value,
|
||||||
orientation: props.orientation
|
orientation: props.orientation,
|
||||||
|
buttonGroup: orientation.value
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const incrementIcon = computed(() => props.incrementIcon || (props.orientation === 'horizontal' ? appConfig.ui.icons.plus : appConfig.ui.icons.chevronUp))
|
const incrementIcon = computed(() => props.incrementIcon || (props.orientation === 'horizontal' ? appConfig.ui.icons.plus : appConfig.ui.icons.chevronUp))
|
||||||
@@ -145,7 +155,7 @@ defineExpose({
|
|||||||
<NumberFieldRoot
|
<NumberFieldRoot
|
||||||
v-bind="rootProps"
|
v-bind="rootProps"
|
||||||
:id="id"
|
:id="id"
|
||||||
:class="ui.root({ class: [props.class, props.ui?.root] })"
|
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
||||||
:name="name"
|
:name="name"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
:locale="locale"
|
:locale="locale"
|
||||||
@@ -162,7 +172,7 @@ defineExpose({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div :class="ui.increment({ class: props.ui?.increment })">
|
<div :class="ui.increment({ class: props.ui?.increment })">
|
||||||
<NumberFieldIncrement as-child :disabled="disabled">
|
<NumberFieldIncrement as-child :disabled="disabled || incrementDisabled">
|
||||||
<slot name="increment">
|
<slot name="increment">
|
||||||
<UButton
|
<UButton
|
||||||
:icon="incrementIcon"
|
:icon="incrementIcon"
|
||||||
@@ -177,7 +187,7 @@ defineExpose({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div :class="ui.decrement({ class: props.ui?.decrement })">
|
<div :class="ui.decrement({ class: props.ui?.decrement })">
|
||||||
<NumberFieldDecrement as-child :disabled="disabled">
|
<NumberFieldDecrement as-child :disabled="disabled || decrementDisabled">
|
||||||
<slot name="decrement">
|
<slot name="decrement">
|
||||||
<UButton
|
<UButton
|
||||||
:icon="decrementIcon"
|
:icon="decrementIcon"
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user