Skip to content

Commit

Permalink
fix(ariakit): 🩹 fix new props for disclosure in core & ui
Browse files Browse the repository at this point in the history
  • Loading branch information
navin-moorthy committed Jul 25, 2022
1 parent 367492e commit 7f434e3
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 70 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@
]
},
"dependencies": {
"@adaptui/react": "^1.0.0-alpha.7",
"@react-aria/live-announcer": "^3.1.0",
"@adaptui/react": "1.0.0-alpha.9",
"@react-aria/live-announcer": "3.1.0",
"ariakit": "2.0.0-next.36",
"ariakit-utils": "0.17.0-next.23",
"tailwind-merge": "^1.3.0"
"tailwind-merge": "1.5.1"
},
"devDependencies": {
"@babel/cli": "7.18.9",
Expand Down Expand Up @@ -134,7 +134,7 @@
"@testing-library/user-event": "14.3.0",
"@types/jest": "28.1.6",
"@types/jest-axe": "3.5.4",
"@types/node": "18.0.1",
"@types/node": "18.6.1",
"@types/react": "18.0.15",
"@types/react-dom": "18.0.6",
"@types/testing-library__jest-dom": "5.14.5",
Expand Down
1 change: 1 addition & 0 deletions src/show-more/ShowMoreButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const useShowMoreButton = createHook<ShowMoreButtonOptions>(
spinner,
...props,
});
console.log("%cstate", "color: #e5de73", state);
props = useDisclosure({ state, ...props });
props = useBox(props);

Expand Down
12 changes: 6 additions & 6 deletions src/show-more/ShowMoreProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ const componentMap = {
};

export const useShowMoreProps = ({
visible,
defaultVisible,
setVisible,
defaultOpen,
open,
setOpen,
animated,
button,
children,
...props
}: ShowMoreProps): ShowMorePropsReturn => {
const state = useDisclosureState({
visible,
defaultVisible,
setVisible,
defaultOpen,
open,
setOpen,
animated,
});
const uiState = useShowMoreUIState({ state, button });
Expand Down
2 changes: 1 addition & 1 deletion src/show-more/ShowMoreUIState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const useShowMoreUIState = ({
state,
button,
}: ShowMoreUIStateProps): ShowMoreUIState => {
button = button || !state.visible ? "Show more" : "Show less";
button = button || !state.open ? "Show more" : "Show less";

return { button };
};
Expand Down
10 changes: 5 additions & 5 deletions src/tooltip/TooltipAnchor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ export const useTooltipAnchor = createHook<TooltipAnchorOptions>(
}) => {
if (!state) return props;

const { visible, hide, show } = state;
const { open, hide, show } = state;
const [isMobile] = useMediaQuery("(max-width: 640px)");
const [hasMouseLeft, setHasMouseLeft] = React.useState(false);
const wasDragging = usePrevious(isDragging);

React.useEffect(() => {
if (isMobile) {
if (!isDragging && wasDragging && visible) hide();
if (!isDragging && wasDragging && open) hide();
} else {
if (hasMouseLeft && !isDragging && wasDragging && visible) hide();
if (hasMouseLeft && !isDragging && wasDragging && open) hide();
}

if (isDragging && !visible) show();
}, [hide, wasDragging, isDragging, hasMouseLeft, visible, isMobile, show]);
if (isDragging && !open) show();
}, [hide, wasDragging, isDragging, hasMouseLeft, open, isMobile, show]);

const onMouseEnterProp = props.onMouseEnter;

Expand Down
12 changes: 6 additions & 6 deletions src/tooltip/TooltipProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export const useTooltipProps = ({
suffix,
withArrow,
isDragging,
visible,
defaultVisible,
setVisible,
defaultOpen,
open,
setOpen,
animated = true,
placement,
gutter,
Expand All @@ -53,9 +53,9 @@ export const useTooltipProps = ({
...restProps
}: TooltipProps): TooltipPropsReturn => {
const state = useTooltipState({
visible,
defaultVisible,
setVisible,
defaultOpen,
open,
setOpen,
animated,
placement,
gutter,
Expand Down
74 changes: 26 additions & 48 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# yarn lockfile v1


"@adaptui/react@^1.0.0-alpha.7":
version "1.0.0-alpha.7"
resolved "https://registry.yarnpkg.com/@adaptui/react/-/react-1.0.0-alpha.7.tgz#e5090f26a37d266218975672bd89dfe124d97833"
integrity sha512-cdgdAbLXII+g2CzD80400yt1s0H+g3rWSmJzkUXrSz416duUv+HHxaFT6hejZ1sI1Iv+DY2HkBJm+GlOWN4oVA==
"@adaptui/react@1.0.0-alpha.9":
version "1.0.0-alpha.9"
resolved "https://registry.yarnpkg.com/@adaptui/react/-/react-1.0.0-alpha.9.tgz#aa5f04b52ed6498157aec1b313f498f4a219fd93"
integrity sha512-DJmAHXrjSLJguBDWis8crqehlPetXxB6FzvJdmUehwBBvddDkISycuDa0RdOCVzLSU2yhoY3gPc1kaKmzROlRA==
dependencies:
"@chakra-ui/react-utils" "^2.0.1"
"@chakra-ui/utils" "^2.0.2"
"@chakra-ui/utils" "^2.0.4"
"@internationalized/date" "3.0.0"
"@react-aria/button" "^3.5.1"
"@react-aria/calendar" "3.0.0"
Expand All @@ -22,8 +22,8 @@
"@react-stately/datepicker" "3.0.0"
"@react-stately/numberfield" "^3.1.1"
"@react-stately/slider" "^3.1.1"
ariakit "2.0.0-next.30"
ariakit-utils "0.17.0-next.21"
ariakit "2.0.0-next.36"
ariakit-utils "0.17.0-next.23"
raf "^3.4.1"

"@ampproject/remapping@^2.1.0":
Expand Down Expand Up @@ -1592,6 +1592,16 @@
framesync "5.3.0"
lodash.mergewith "4.6.2"

"@chakra-ui/utils@^2.0.4":
version "2.0.4"
resolved "https://registry.yarnpkg.com/@chakra-ui/utils/-/utils-2.0.4.tgz#dbed9f173edda0eb54947d98754b834729ae22bc"
integrity sha512-pr5qFTrhCja1iQTajOr2WSvb+f4lpnLnnxWOSYOuIv7k8LBEtee4LpTs0jzBBB/vycuo6ppKdXyj7db9xTqZfA==
dependencies:
"@types/lodash.mergewith" "4.6.6"
css-box-model "1.2.1"
framesync "5.3.0"
lodash.mergewith "4.6.2"

"@cnakazawa/watch@^1.0.3":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.4.tgz#f864ae85004d0fcab6f50be9141c4da368d1656a"
Expand Down Expand Up @@ -1897,23 +1907,11 @@
minimatch "^3.1.2"
strip-json-comments "^3.1.1"

"@floating-ui/core@^0.7.3":
version "0.7.3"
resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-0.7.3.tgz#d274116678ffae87f6b60e90f88cc4083eefab86"
integrity sha512-buc8BXHmG9l82+OQXOFU3Kr2XQx9ys01U/Q9HMIrZ300iLc8HLMgh7dcCqgYzAzf4BkoQvDcXf5Y+CuEZ5JBYg==

"@floating-ui/core@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.0.0.tgz#ec1d31f54c72dd0460276e2149e59bd13c0f01f6"
integrity sha512-sm3nW0hHAxTv3gRDdCH8rNVQxijF+qPFo5gAeXCErRjKC7Qc28lIQ3R9Vd7Gw+KgwfA7RhRydDFuGeI0peGq7A==

"@floating-ui/dom@0.5.3":
version "0.5.3"
resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-0.5.3.tgz#ade192cf9a911fc3e95fb614fe281658b654043c"
integrity sha512-vpjWB1uC7rajvgA58uzlJZgtWqrdDQLw+XVA3w63ZTmsWwRmVd0Gl5Dy9VMAViI9cP7hBWaJt23Jy3AVgVYnoQ==
dependencies:
"@floating-ui/core" "^0.7.3"

"@floating-ui/dom@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@floating-ui/dom/-/dom-1.0.0.tgz#66923a56755b6cb7a5958ecf25fe293912672d65"
Expand Down Expand Up @@ -2664,7 +2662,7 @@
"@react-types/label" "^3.6.1"
"@react-types/shared" "^3.13.1"

"@react-aria/live-announcer@^3.1.0":
"@react-aria/live-announcer@3.1.0", "@react-aria/live-announcer@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@react-aria/live-announcer/-/live-announcer-3.1.0.tgz#06cfce35f6a9bcff266ab0ceab97f2fe6e487975"
integrity sha512-YEaGJh1ELho3G9zvUZGOsKsSNEqHsm0fb3Ngvj9z0tjZCXa0867h8YWKuiyTA9BG7WhH8eeJq07WN4nDvYU7fg==
Expand Down Expand Up @@ -4407,10 +4405,10 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.0.0.tgz#67c7b724e1bcdd7a8821ce0d5ee184d3b4dd525a"
integrity sha512-cHlGmko4gWLVI27cGJntjs/Sj8th9aYwplmZFwmmgYQQvL5NUsgVJG7OddLvNfLqYS31KFN0s3qlaD9qCaxACA==

"@types/node@18.0.1":
version "18.0.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.0.1.tgz#e91bd73239b338557a84d1f67f7b9e0f25643870"
integrity sha512-CmR8+Tsy95hhwtZBKJBs0/FFq4XX7sDZHlGGf+0q+BRZfMbOTkzkj0AFAuTyXbObDIoanaBBW0+KEW+m3N16Wg==
"@types/node@18.6.1":
version "18.6.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.6.1.tgz#828e4785ccca13f44e2fb6852ae0ef11e3e20ba5"
integrity sha512-z+2vB6yDt1fNwKOeGbckpmirO+VBDuQqecXkgeIqDlaOtmKn6hPR/viQ8cxCfqLU4fTlvM3+YjM367TukWdxpg==

"@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0":
version "16.11.42"
Expand Down Expand Up @@ -5371,24 +5369,11 @@ aria-query@^5.0.0:
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.0.0.tgz#210c21aaf469613ee8c9a62c7f86525e058db52c"
integrity sha512-V+SM7AbUwJ+EBnB8+DXs0hPZHO0W6pqBcc0dW90OwtVG02PswOu/teuARoLQjdDOH+t9pJgGnW5/Qmouf3gPJg==

ariakit-utils@0.17.0-next.21:
version "0.17.0-next.21"
resolved "https://registry.yarnpkg.com/ariakit-utils/-/ariakit-utils-0.17.0-next.21.tgz#bff902e8bca565c8f0a9946a63d5e24676370025"
integrity sha512-2zVBplN6O92WKDRy3RKafdl+BK0V7HtRpRX179YiWVG4ZTeeTNfj/m23d91SImue514U7PmxEp/DQb+LucQu+g==

ariakit-utils@0.17.0-next.23:
version "0.17.0-next.23"
resolved "https://registry.yarnpkg.com/ariakit-utils/-/ariakit-utils-0.17.0-next.23.tgz#b9c5f638e5cc7a3ddc2e3256f23d42718e3af47b"
integrity sha512-r6a8rvjTBNbdNVWhGm4XL8hTlpIlP0G+yJf3No48kK6QpR1JN9QinLI/wMwWwJnxDYfwnBhkbcROCqF7iT/4ig==

ariakit@2.0.0-next.30:
version "2.0.0-next.30"
resolved "https://registry.yarnpkg.com/ariakit/-/ariakit-2.0.0-next.30.tgz#436eb631f82d04313d8b7b77f106de48b40cf64e"
integrity sha512-12CW6eY6i+3FPjB5ItIxRtet5pfLBML7bbCrrrDKEj1hIrUELvJu7HqFCvhNFTzODgVU8s1xr4rEUigaz/58rA==
dependencies:
"@floating-ui/dom" "0.5.3"
ariakit-utils "0.17.0-next.21"

ariakit@2.0.0-next.36:
version "2.0.0-next.36"
resolved "https://registry.yarnpkg.com/ariakit/-/ariakit-2.0.0-next.36.tgz#74b93cc839cfd9e8350c4cc961b06b8f70f16e14"
Expand Down Expand Up @@ -10375,11 +10360,6 @@ hash.js@^1.0.0, hash.js@^1.0.3:
inherits "^2.0.3"
minimalistic-assert "^1.0.1"

hashlru@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/hashlru/-/hashlru-2.3.0.tgz#5dc15928b3f6961a2056416bb3a4910216fdfb51"
integrity sha512-0cMsjjIC8I+D3M44pOQdsy0OHXGLVz6Z0beRuufhKa0KfaD2wGwAev6jILzXsd3/vpnNQJmWyZtIILqM1N+n5A==

hast-to-hyperscript@^9.0.0:
version "9.0.1"
resolved "https://registry.yarnpkg.com/hast-to-hyperscript/-/hast-to-hyperscript-9.0.1.tgz#9b67fd188e4c81e8ad66f803855334173920218d"
Expand Down Expand Up @@ -17192,12 +17172,10 @@ synchronous-promise@^2.0.15:
resolved "https://registry.yarnpkg.com/synchronous-promise/-/synchronous-promise-2.0.15.tgz#07ca1822b9de0001f5ff73595f3d08c4f720eb8e"
integrity sha512-k8uzYIkIVwmT+TcglpdN50pS2y1BDcUnBPK9iJeGu0Pl1lOI8pD6wtzgw91Pjpe+RxtTncw32tLxs/R0yNL2Mg==

tailwind-merge@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/tailwind-merge/-/tailwind-merge-1.3.0.tgz#fa29557a2e1c6947904143e45884e554f491937d"
integrity sha512-M+DC6DO5eypc3/iOt/oTuqUH68Ip+XCu/Afybg9/ATxUX6KMPk4UGU4z4EMx08BMOBL+iOL93+hx3Jxpb9qNGw==
dependencies:
hashlru "^2.3.0"
tailwind-merge@1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/tailwind-merge/-/tailwind-merge-1.5.1.tgz#fb7d6b724aef702b11fd01fddf1be1d8aeab3d7a"
integrity sha512-lqmJS6+3vsNQY77TMMRBVFbWyMcIAAD/09Vs+IXCt3cza58/O7X5DBbOu+7p6LPhw0efK45LL8kAJ7IORccMag==

tailwindcss@3.1.6:
version "3.1.6"
Expand Down

0 comments on commit 7f434e3

Please sign in to comment.