@solid-aria/overlays
Advanced tools
Comparing version 0.0.5 to 0.1.0
@@ -10,2 +10,3 @@ 'use strict'; | ||
var utils$1 = require('@solid-aria/utils'); | ||
var platform = require('@solid-primitives/platform'); | ||
var visuallyHidden = require('@solid-aria/visually-hidden'); | ||
@@ -282,5 +283,8 @@ | ||
const modalProps = solidJs.createMemo(() => ({ | ||
"data-ismodal": !(props !== null && props !== void 0 && props.isDisabled) | ||
})); | ||
const modalProps = { | ||
get "data-ismodal"() { | ||
return !(props !== null && props !== void 0 && props.isDisabled); | ||
} | ||
}; | ||
solidJs.createEffect(() => { | ||
@@ -412,9 +416,8 @@ var _context$parent; | ||
const overlayProps = solidJs.createMemo(() => ({ | ||
onKeyDown, | ||
...focusWithinProps() | ||
})); | ||
const underlayProps = solidJs.createMemo(() => ({ | ||
const overlayProps = solidJs.mergeProps({ | ||
onKeyDown | ||
}, focusWithinProps); | ||
const underlayProps = { | ||
onPointerDown: onPointerDownUnderlay | ||
})); | ||
}; | ||
return { | ||
@@ -500,26 +503,34 @@ overlayProps, | ||
*/ | ||
function createOverlayTrigger(props) { | ||
function createOverlayTrigger(props, state = createOverlayTriggerState(props)) { | ||
const overlayId = utils$1.createId(); | ||
const state = createOverlayTriggerState(props); // Aria 1.1 supports multiple values for aria-haspopup other than just menus. | ||
// https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup | ||
// However, we only add it for menus for now because screen readers often | ||
// announce it as a menu even for other values. | ||
const triggerProps = { | ||
// Aria 1.1 supports multiple values for aria-haspopup other than just menus. | ||
// https://www.w3.org/TR/wai-aria-1.1/#aria-haspopup | ||
// However, we only add it for menus for now because screen readers often | ||
// announce it as a menu even for other values. | ||
get "aria-haspopup"() { | ||
switch (utils.access(props.type)) { | ||
case "menu": | ||
return true; | ||
const ariaHasPopup = solidJs.createMemo(() => { | ||
if (props.type === "menu") { | ||
return true; | ||
case "listbox": | ||
return "listbox"; | ||
default: | ||
return; | ||
} | ||
}, | ||
get "aria-expanded"() { | ||
return state.isOpen(); | ||
}, | ||
get "aria-controls"() { | ||
return state.isOpen() ? overlayId : undefined; | ||
} | ||
if (props.type === "listbox") { | ||
return "listbox"; | ||
} | ||
}); | ||
const triggerProps = solidJs.createMemo(() => ({ | ||
"aria-haspopup": ariaHasPopup(), | ||
"aria-expanded": state.isOpen(), | ||
"aria-controls": state.isOpen() ? overlayId : undefined | ||
})); | ||
const overlayProps = solidJs.createMemo(() => ({ | ||
}; | ||
const overlayProps = { | ||
id: overlayId | ||
})); | ||
}; | ||
return { | ||
@@ -563,3 +574,3 @@ triggerProps, | ||
if (utils$1.isIOS()) { | ||
if (platform.isIOS) { | ||
solidJs.onCleanup(preventScrollMobileSafari()); | ||
@@ -566,0 +577,0 @@ } else { |
{ | ||
"name": "@solid-aria/overlays", | ||
"version": "0.0.5", | ||
"version": "0.1.0", | ||
"private": false, | ||
@@ -42,14 +42,23 @@ "description": "Primitives for building accessible overlay components such as dialogs, popovers, and menus.", | ||
], | ||
"scripts": { | ||
"build": "rollup -c", | ||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist", | ||
"dev": "vite serve dev --host", | ||
"test": "jest --passWithNoTests", | ||
"test:watch": "jest --watch --passWithNoTests", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"@solid-aria/button": "^0.0.6", | ||
"@solid-aria/i18n": "^0.0.7", | ||
"@solid-aria/interactions": "^0.0.7", | ||
"@solid-aria/types": "^0.0.5", | ||
"@solid-aria/utils": "^0.0.6", | ||
"@solid-aria/visually-hidden": "^0.0.7" | ||
"@solid-aria/button": "workspace:^", | ||
"@solid-aria/i18n": "workspace:^", | ||
"@solid-aria/interactions": "workspace:^", | ||
"@solid-aria/types": "workspace:^", | ||
"@solid-aria/utils": "workspace:^", | ||
"@solid-aria/visually-hidden": "workspace:^", | ||
"@solid-primitives/platform": "^0.0.100" | ||
}, | ||
"peerDependencies": { | ||
"@solid-primitives/props": "^2.1.2", | ||
"@solid-primitives/props": "^2.1.4", | ||
"@solid-primitives/utils": "^2.0.1", | ||
"solid-js": "^1.4.3" | ||
"solid-js": "^1.4.4" | ||
}, | ||
@@ -64,11 +73,3 @@ "publishConfig": { | ||
"category": "" | ||
}, | ||
"scripts": { | ||
"build": "rollup -c", | ||
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist", | ||
"dev": "vite serve dev --host", | ||
"test": "jest --passWithNoTests", | ||
"test:watch": "jest --watch --passWithNoTests", | ||
"typecheck": "tsc --noEmit" | ||
} | ||
} | ||
} |
@@ -128,5 +128,3 @@ <p> | ||
const rootProps = createMemo(() => { | ||
return combineProps(overlayProps(), dialogProps(), modalProps(), others); | ||
}); | ||
const rootProps = combineProps(overlayProps, dialogProps, modalProps, others); | ||
@@ -136,3 +134,3 @@ return ( | ||
<div | ||
{...rootProps()} | ||
{...rootProps} | ||
ref={mergeRefs(el => (ref = el), local.ref)} | ||
@@ -176,3 +174,3 @@ style={{ | ||
<> | ||
<button {...buttonProps()} {...triggerProps()} ref={triggerRef}> | ||
<button {...buttonProps} {...triggerProps} ref={triggerRef}> | ||
Open Popover | ||
@@ -183,3 +181,3 @@ </button> | ||
<Popover | ||
{...overlayProps()} | ||
{...overlayProps} | ||
ref={overlayRef} | ||
@@ -186,0 +184,0 @@ title="Popover title" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
1
100
41403
10
4
691
230
1
+ Added@solid-primitives/platform@0.0.100(transitive)
- Removed@solid-aria/button@0.0.6(transitive)
- Removed@solid-aria/focus@0.0.9(transitive)
- Removed@solid-aria/i18n@0.0.7(transitive)
- Removed@solid-aria/interactions@0.0.7(transitive)
- Removed@solid-aria/toggle@0.0.10(transitive)
- Removed@solid-aria/types@0.0.5(transitive)
- Removed@solid-aria/utils@0.0.6(transitive)
- Removed@solid-aria/visually-hidden@0.0.7(transitive)
Updated@solid-aria/i18n@workspace:^