Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit a26b8ac

Browse files
Merge branch 'feat/c-skip-nav' of https://github.com/TylerAPfledderer/chakra-ui-vue-next into feat/c-skip-nav
2 parents 43a5193 + a88ded7 commit a26b8ac

File tree

3 files changed

+117
-143
lines changed

3 files changed

+117
-143
lines changed

packages/c-checkbox/package.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616
"default": "./dist/chakra-ui-c-checkbox.esm.js"
1717
}
1818
},
19-
"repository": {
20-
"type": "git",
21-
"url": "git+https://github.com/chakra-ui/chakra-ui-vue-next.git"
22-
},
19+
"repository": "https://github.com/chakra-ui/chakra-ui-vue-next/tree/master/packages/c-checkbox",
2320
"bugs": {
2421
"url": "https://github.com/chakra-ui/chakra-ui-vue-next/issues"
2522
},
@@ -30,16 +27,16 @@
3027
"dependencies": {
3128
"@chakra-ui/c-form-control": "0.0.0-alpha.5",
3229
"@chakra-ui/c-motion": "0.1.0-alpha.9",
33-
"@chakra-ui/utils": "2.0.3",
30+
"@chakra-ui/utils": "^2.0.3",
3431
"@chakra-ui/vue-composables": "0.1.0-alpha.9",
3532
"@chakra-ui/vue-system": "0.1.0-alpha.10",
3633
"@chakra-ui/vue-utils": "0.1.0-alpha.10",
37-
"@vueuse/motion": "1.5.4",
34+
"@vueuse/motion": "^1.5.4",
3835
"@zag-js/checkbox": "0.1.6",
39-
"@zag-js/vue": "0.1.14"
36+
"@zag-js/vue": "^0.1.14"
4037
},
4138
"devDependencies": {
42-
"vue": "^3.1.4"
39+
"vue": "^3.2.37"
4340
},
4441
"peerDependencies": {
4542
"vue": "^3.1.4"

packages/c-skip-nav/src/c-skip-nav.ts

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
/**
2+
* Hey! Welcome to @chakra-ui/vue-next CSkipNav
3+
*
4+
* Component tandem to allow users to skip navigation content
5+
*
6+
* @see Docs https://next.vue.chakra-ui.com/c-skip-nav
7+
* @see Source https://github.com/chakra-ui/chakra-ui-vue-next/blob/master/packages/c-skip-nav/src/c-skip-nav/c-skip-nav.ts
8+
* @see WebAIM https://webaim.org/techniques/skipnav/
9+
*/
10+
11+
import { h, defineComponent } from "vue"
12+
import {
13+
chakra,
14+
ComponentWithProps,
15+
DeepPartial,
16+
HTMLChakraProps,
17+
SystemStyleObject,
18+
useStyleConfig,
19+
} from "@chakra-ui/vue-system"
20+
import { CBox } from "@chakra-ui/vue-next"
21+
22+
const FALLBACK_ID = "chakra-skip-nav"
23+
24+
export interface CSkipNavLinkProps extends HTMLChakraProps<"a"> {}
25+
26+
export const CSkipNavLink: ComponentWithProps<DeepPartial<CSkipNavLinkProps>> =
27+
defineComponent({
28+
name: "CSkipNavLink",
29+
props: {
30+
id: {
31+
type: String,
32+
default: FALLBACK_ID,
33+
},
34+
},
35+
setup(props, { slots, attrs }) {
36+
function getBaseStyles(styles: any): SystemStyleObject {
37+
return {
38+
userSelect: "none",
39+
border: "0",
40+
borderRadius: "md",
41+
fontWeight: "semibold",
42+
height: "1px",
43+
width: "1px",
44+
margin: "-1px",
45+
padding: "0",
46+
outline: "0",
47+
overflow: "hidden",
48+
position: "absolute",
49+
clip: "rect(0 0 0 0)",
50+
...styles,
51+
_focus: {
52+
clip: "auto",
53+
width: "auto",
54+
height: "auto",
55+
boxShadow: "outline",
56+
padding: "1rem",
57+
position: "fixed",
58+
top: "1.5rem",
59+
insetStart: "1.5rem",
60+
...styles["_focusVisible"],
61+
},
62+
}
63+
}
64+
65+
const styles = useStyleConfig("SkipLink", props)
66+
67+
return () => {
68+
return h(
69+
chakra("a", {
70+
__css: {
71+
...getBaseStyles(styles.value),
72+
},
73+
}),
74+
{
75+
...attrs,
76+
href: `#${props.id}`,
77+
},
78+
slots
79+
)
80+
}
81+
},
82+
})
83+
84+
export interface CSkipNavContentProps extends HTMLChakraProps<"div"> {}
85+
86+
export const CSkipNavContent: ComponentWithProps<
87+
DeepPartial<CSkipNavContentProps>
88+
> = defineComponent({
89+
name: "CSkipNavContent",
90+
props: {
91+
id: {
92+
type: String,
93+
default: FALLBACK_ID,
94+
},
95+
},
96+
setup(props, { attrs, slots }) {
97+
return () => {
98+
return h(
99+
chakra(CBox),
100+
{
101+
...attrs,
102+
id: props.id,
103+
tabIndex: "-1",
104+
"data-testid": FALLBACK_ID,
105+
},
106+
slots
107+
)
108+
}
109+
},
110+
})

yarn.lock

Lines changed: 2 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,16 +1028,6 @@
10281028
dependencies:
10291029
"@chakra-ui/theme-tools" "^2.0.2"
10301030

1031-
"@chakra-ui/[email protected]":
1032-
version "0.1.0-alpha.9"
1033-
dependencies:
1034-
"@chakra-ui/styled-system" "^2.2.2"
1035-
"@chakra-ui/utils" "^2.0.3"
1036-
"@chakra-ui/vue-composables" "0.1.0-alpha.9"
1037-
"@chakra-ui/vue-system" "0.1.0-alpha.10"
1038-
"@chakra-ui/vue-utils" "0.1.0-alpha.10"
1039-
"@vueuse/motion" "^1.5.4"
1040-
10411031
"@chakra-ui/styled-system@^2.2.2":
10421032
version "2.2.5"
10431033
resolved "https://registry.yarnpkg.com/@chakra-ui/styled-system/-/styled-system-2.2.5.tgz#d1754d2117f554551b914ef060e81548c6cc9702"
@@ -3856,16 +3846,6 @@
38563846
estree-walker "^2.0.2"
38573847
source-map "^0.6.1"
38583848

3859-
3860-
version "3.2.39"
3861-
resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.2.39.tgz#0d77e635f4bdb918326669155a2dc977c053943e"
3862-
integrity sha512-mf/36OWXqWn0wsC40nwRRGheR/qoID+lZXbIuLnr4/AngM0ov8Xvv8GHunC0rKRIkh60bTqydlqTeBo49rlbqw==
3863-
dependencies:
3864-
"@babel/parser" "^7.16.4"
3865-
"@vue/shared" "3.2.39"
3866-
estree-walker "^2.0.2"
3867-
source-map "^0.6.1"
3868-
38693849
"@vue/[email protected]", "@vue/compiler-dom@^3.0.11":
38703850
version "3.2.37"
38713851
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.2.37.tgz#10d2427a789e7c707c872da9d678c82a0c6582b5"
@@ -3874,14 +3854,6 @@
38743854
"@vue/compiler-core" "3.2.37"
38753855
"@vue/shared" "3.2.37"
38763856

3877-
3878-
version "3.2.39"
3879-
resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.2.39.tgz#bd69d35c1a48fe2cea4ab9e96d2a3a735d146fdf"
3880-
integrity sha512-HMFI25Be1C8vLEEv1hgEO1dWwG9QQ8LTTPmCkblVJY/O3OvWx6r1+zsox5mKPMGvqYEZa6l8j+xgOfUspgo7hw==
3881-
dependencies:
3882-
"@vue/compiler-core" "3.2.39"
3883-
"@vue/shared" "3.2.39"
3884-
38853857
"@vue/[email protected]", "@vue/compiler-sfc@^3.0.11", "@vue/compiler-sfc@^3.2.29", "@vue/compiler-sfc@^3.2.4":
38863858
version "3.2.37"
38873859
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.2.37.tgz#3103af3da2f40286edcd85ea495dcb35bc7f5ff4"
@@ -3898,22 +3870,6 @@
38983870
postcss "^8.1.10"
38993871
source-map "^0.6.1"
39003872

3901-
3902-
version "3.2.39"
3903-
resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.2.39.tgz#8fe29990f672805b7c5a2ecfa5b05e681c862ea2"
3904-
integrity sha512-fqAQgFs1/BxTUZkd0Vakn3teKUt//J3c420BgnYgEOoVdTwYpBTSXCMJ88GOBCylmUBbtquGPli9tVs7LzsWIA==
3905-
dependencies:
3906-
"@babel/parser" "^7.16.4"
3907-
"@vue/compiler-core" "3.2.39"
3908-
"@vue/compiler-dom" "3.2.39"
3909-
"@vue/compiler-ssr" "3.2.39"
3910-
"@vue/reactivity-transform" "3.2.39"
3911-
"@vue/shared" "3.2.39"
3912-
estree-walker "^2.0.2"
3913-
magic-string "^0.25.7"
3914-
postcss "^8.1.10"
3915-
source-map "^0.6.1"
3916-
39173873
39183874
version "3.2.37"
39193875
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.2.37.tgz#4899d19f3a5fafd61524a9d1aee8eb0505313cff"
@@ -3922,14 +3878,6 @@
39223878
"@vue/compiler-dom" "3.2.37"
39233879
"@vue/shared" "3.2.37"
39243880

3925-
3926-
version "3.2.39"
3927-
resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.2.39.tgz#4f3bfb535cb98b764bee45e078700e03ccc60633"
3928-
integrity sha512-EoGCJ6lincKOZGW+0Ky4WOKsSmqL7hp1ZYgen8M7u/mlvvEQUaO9tKKOy7K43M9U2aA3tPv0TuYYQFrEbK2eFQ==
3929-
dependencies:
3930-
"@vue/compiler-dom" "3.2.39"
3931-
"@vue/shared" "3.2.39"
3932-
39333881
"@vue/devtools-api@^6.0.0-beta.19", "@vue/devtools-api@^6.1.4":
39343882
version "6.2.0"
39353883
resolved "https://registry.yarnpkg.com/@vue/devtools-api/-/devtools-api-6.2.0.tgz#e3dc98a0cce8e87292745e2d24c9ee8c274a023b"
@@ -3953,31 +3901,13 @@
39533901
estree-walker "^2.0.2"
39543902
magic-string "^0.25.7"
39553903

3956-
3957-
version "3.2.39"
3958-
resolved "https://registry.yarnpkg.com/@vue/reactivity-transform/-/reactivity-transform-3.2.39.tgz#da6ae6c8fd77791b9ae21976720d116591e1c4aa"
3959-
integrity sha512-HGuWu864zStiWs9wBC6JYOP1E00UjMdDWIG5W+FpUx28hV3uz9ODOKVNm/vdOy/Pvzg8+OcANxAVC85WFBbl3A==
3960-
dependencies:
3961-
"@babel/parser" "^7.16.4"
3962-
"@vue/compiler-core" "3.2.39"
3963-
"@vue/shared" "3.2.39"
3964-
estree-walker "^2.0.2"
3965-
magic-string "^0.25.7"
3966-
39673904
39683905
version "3.2.37"
39693906
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.2.37.tgz#5bc3847ac58828e2b78526e08219e0a1089f8848"
39703907
integrity sha512-/7WRafBOshOc6m3F7plwzPeCu/RCVv9uMpOwa/5PiY1Zz+WLVRWiy0MYKwmg19KBdGtFWsmZ4cD+LOdVPcs52A==
39713908
dependencies:
39723909
"@vue/shared" "3.2.37"
39733910

3974-
3975-
version "3.2.39"
3976-
resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.2.39.tgz#e6e3615fe2288d4232b104640ddabd0729a78c80"
3977-
integrity sha512-vlaYX2a3qMhIZfrw3Mtfd+BuU+TZmvDrPMa+6lpfzS9k/LnGxkSuf0fhkP0rMGfiOHPtyKoU9OJJJFGm92beVQ==
3978-
dependencies:
3979-
"@vue/shared" "3.2.39"
3980-
39813911
39823912
version "3.2.37"
39833913
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.2.37.tgz#7ba7c54bb56e5d70edfc2f05766e1ca8519966e3"
@@ -3986,14 +3916,6 @@
39863916
"@vue/reactivity" "3.2.37"
39873917
"@vue/shared" "3.2.37"
39883918

3989-
3990-
version "3.2.39"
3991-
resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.2.39.tgz#dc1faccab11b3e81197aba33fb30c9447c1d2c84"
3992-
integrity sha512-xKH5XP57JW5JW+8ZG1khBbuLakINTgPuINKL01hStWLTTGFOrM49UfCFXBcFvWmSbci3gmJyLl2EAzCaZWsx8g==
3993-
dependencies:
3994-
"@vue/reactivity" "3.2.39"
3995-
"@vue/shared" "3.2.39"
3996-
39973919
39983920
version "3.2.37"
39993921
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.2.37.tgz#002bdc8228fa63949317756fb1e92cdd3f9f4bbd"
@@ -4003,15 +3925,6 @@
40033925
"@vue/shared" "3.2.37"
40043926
csstype "^2.6.8"
40053927

4006-
4007-
version "3.2.39"
4008-
resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.2.39.tgz#4a8cb132bcef316e8151c5ed07fc7272eb064614"
4009-
integrity sha512-4G9AEJP+sLhsqf5wXcyKVWQKUhI+iWfy0hWQgea+CpaTD7BR0KdQzvoQdZhwCY6B3oleSyNLkLAQwm0ya/wNoA==
4010-
dependencies:
4011-
"@vue/runtime-core" "3.2.39"
4012-
"@vue/shared" "3.2.39"
4013-
csstype "^2.6.8"
4014-
40153928
"@vue/[email protected]", "@vue/server-renderer@^3.0.11", "@vue/server-renderer@^3.0.9", "@vue/server-renderer@^3.2.29":
40163929
version "3.2.37"
40173930
resolved "https://registry.yarnpkg.com/@vue/server-renderer/-/server-renderer-3.2.37.tgz#840a29c8dcc29bddd9b5f5ffa22b95c0e72afdfc"
@@ -4020,24 +3933,11 @@
40203933
"@vue/compiler-ssr" "3.2.37"
40213934
"@vue/shared" "3.2.37"
40223935

4023-
4024-
version "3.2.39"
4025-
resolved "https://registry.yarnpkg.com/@vue/server-renderer/-/server-renderer-3.2.39.tgz#4358292d925233b0d8b54cf0513eaece8b2351c5"
4026-
integrity sha512-1yn9u2YBQWIgytFMjz4f/t0j43awKytTGVptfd3FtBk76t1pd8mxbek0G/DrnjJhd2V7mSTb5qgnxMYt8Z5iSQ==
4027-
dependencies:
4028-
"@vue/compiler-ssr" "3.2.39"
4029-
"@vue/shared" "3.2.39"
4030-
40313936
40323937
version "3.2.37"
40333938
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.2.37.tgz#8e6adc3f2759af52f0e85863dfb0b711ecc5c702"
40343939
integrity sha512-4rSJemR2NQIo9Klm1vabqWjD8rs/ZaJSzMxkMNeJS6lHiUjjUeYFbooN19NgFjztubEKh3WlZUeOLVdbbUWHsw==
40353940

4036-
4037-
version "3.2.39"
4038-
resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.2.39.tgz#302df167559a1a5156da162d8cc6760cef67f8e3"
4039-
integrity sha512-D3dl2ZB9qE6mTuWPk9RlhDeP1dgNRUKC3NJxji74A4yL8M2MwlhLKUC/49WHjrNzSPug58fWx/yFbaTzGAQSBw==
4040-
40413941
"@vue/test-utils@^2.0.0-rc.10", "@vue/test-utils@^2.0.0-rc.18", "@vue/test-utils@^2.0.0-rc.6":
40423942
version "2.0.2"
40433943
resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-2.0.2.tgz#0b5edd683366153d5bc5a91edc62f292118710eb"
@@ -4150,14 +4050,6 @@
41504050
"@vueuse/shared" "4.9.1"
41514051
vue-demi "*"
41524052

4153-
"@vueuse/core@^4.7.0":
4154-
version "4.11.2"
4155-
resolved "https://registry.yarnpkg.com/@vueuse/core/-/core-4.11.2.tgz#d4f54bd38e7c289c6f6357992c02423774cb26d9"
4156-
integrity sha512-4A17XvKXpMR6829EVWvrdSKEeAjTWaiC3+xh51KEtlyCwvWQwZ0xwKDrbMj+e15ANxjHrTw/0bJVaWDfPQt/Pw==
4157-
dependencies:
4158-
"@vueuse/shared" "4.11.2"
4159-
vue-demi "*"
4160-
41614053
"@vueuse/core@^6.0.0":
41624054
version "6.9.2"
41634055
resolved "https://registry.yarnpkg.com/@vueuse/core/-/core-6.9.2.tgz#76b16d01f33cf367dd1a2d7f2e31d106443ceb8a"
@@ -4186,15 +4078,6 @@
41864078
qrcode "^1.4.4"
41874079
universal-cookie "^4.0.4"
41884080

4189-
4190-
version "1.5.4"
4191-
resolved "https://registry.yarnpkg.com/@vueuse/motion/-/motion-1.5.4.tgz#ab5eb0de143a664f217f93ecf059cd6404246536"
4192-
integrity sha512-hSGnVOzzXfp9q9WMDYZImckQCp5BZb6WM1kq+pOZHhLolPt9JqPnK/gImIE/xU27bKZwjE8PeTTcIhCC18xwmQ==
4193-
dependencies:
4194-
"@vueuse/core" "^4.7.0"
4195-
popmotion "^9.3.5"
4196-
vue-demi "0.7.4"
4197-
41984081
"@vueuse/motion@^1.5.4":
41994082
version "1.6.0"
42004083
resolved "https://registry.yarnpkg.com/@vueuse/motion/-/motion-1.6.0.tgz#dff42b4137433da1fd5a8797826f70c105592278"
@@ -4423,7 +4306,7 @@
44234306
dependencies:
44244307
csstype "3.1.0"
44254308

4426-
"@zag-js/vue@0.1.14", "@zag-js/vue@^0.1.14":
4309+
"@zag-js/vue@^0.1.14":
44274310
version "0.1.14"
44284311
resolved "https://registry.yarnpkg.com/@zag-js/vue/-/vue-0.1.14.tgz#970e1b5e1847e55fbb330604d311a5ae066e3b61"
44294312
integrity sha512-t54vB6BxeEYatpxRLk+kXypyLDnoUbwBzMeplZ4gGdAF+0FAJNvhpd9CV/ViykqLXCYUDdi1K8/BYxYdirtFPA==
@@ -14066,7 +13949,7 @@ pnp-webpack-plugin@^1.7.0:
1406613949
dependencies:
1406713950
ts-pnp "^1.1.6"
1406813951

14069-
popmotion@^9.3.5, popmotion@^9.4.0:
13952+
popmotion@^9.4.0:
1407013953
version "9.4.2"
1407113954
resolved "https://registry.yarnpkg.com/popmotion/-/popmotion-9.4.2.tgz#0fccc191b3ecbc3e33af2d0cb9a569a9c49d6105"
1407213955
integrity sha512-j1sSXszfQ6LkqML2NaqAEn1XmwT/TWUe06lXgIUGwomHdVWjM0W6tLay+i1v9zrIMZLBDXslZU9W4RKWhgPPMw==
@@ -17951,11 +17834,6 @@ vue-demi@*:
1795117834
resolved "https://registry.yarnpkg.com/vue-demi/-/vue-demi-0.13.2.tgz#f6081c2feb5b698549729a81683ce029b8da289e"
1795217835
integrity sha512-41ukrclEbMddAyP7PvxMSYqnOSzPV6r7GNnyTSKSCNTaz19GehxmTiXyP9kwHSUv2+Dr6hHqiUiF7L1VAw2KdQ==
1795317836

17954-
17955-
version "0.7.4"
17956-
resolved "https://registry.yarnpkg.com/vue-demi/-/vue-demi-0.7.4.tgz#4c6be525788e1f6b3fd5d4f5f9f2148cf6645979"
17957-
integrity sha512-PT0qzI9Rp8R8eUAsTPXADC+KAZdrMufmbZqEMMqvaiesWyjCpgyuuvS5Su8cvBjK9RevLT/YfFiKWxc8YB9/8g==
17958-
1795917837
vue-eslint-parser@^7.0.0, vue-eslint-parser@^7.10.0:
1796017838
version "7.11.0"
1796117839
resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-7.11.0.tgz#214b5dea961007fcffb2ee65b8912307628d0daf"
@@ -18065,17 +17943,6 @@ vue3-perfect-scrollbar@^1.5.5:
1806517943
perfect-scrollbar "^1.5.5"
1806617944
postcss-import "^12.0.0"
1806717945

18068-
vue@^3.1.4:
18069-
version "3.2.39"
18070-
resolved "https://registry.yarnpkg.com/vue/-/vue-3.2.39.tgz#de071c56c4c32c41cbd54e55f11404295c0dd62d"
18071-
integrity sha512-tRkguhRTw9NmIPXhzk21YFBqXHT2t+6C6wPOgQ50fcFVWnPdetmRqbmySRHznrYjX2E47u0cGlKGcxKZJ38R/g==
18072-
dependencies:
18073-
"@vue/compiler-dom" "3.2.39"
18074-
"@vue/compiler-sfc" "3.2.39"
18075-
"@vue/runtime-dom" "3.2.39"
18076-
"@vue/server-renderer" "3.2.39"
18077-
"@vue/shared" "3.2.39"
18078-
1807917946
vue@^3.2.37:
1808017947
version "3.2.37"
1808117948
resolved "https://registry.yarnpkg.com/vue/-/vue-3.2.37.tgz#da220ccb618d78579d25b06c7c21498ca4e5452e"

0 commit comments

Comments
 (0)