Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-aria/landmark

Package Overview
Dependencies
Maintainers
2
Versions
518
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-aria/landmark - npm Package Compare versions

Comparing version 3.0.0-nightly.3359 to 3.0.0-nightly.3362

8

dist/types.d.ts

@@ -1,3 +0,3 @@

import { AriaLabelingProps } from "@react-types/shared";
import { HTMLAttributes, MutableRefObject } from "react";
import { AriaLabelingProps, DOMAttributes, FocusableElement } from "@react-types/shared";
import { MutableRefObject } from "react";
export type AriaLandmarkRole = 'main' | 'region' | 'search' | 'navigation' | 'form' | 'banner' | 'contentinfo' | 'complementary';

@@ -8,3 +8,3 @@ export interface AriaLandmarkProps extends AriaLabelingProps {

interface LandmarkAria {
landmarkProps: HTMLAttributes<HTMLElement>;
landmarkProps: DOMAttributes;
}

@@ -16,4 +16,4 @@ /**

*/
export function useLandmark(props: AriaLandmarkProps, ref: MutableRefObject<HTMLElement>): LandmarkAria;
export function useLandmark(props: AriaLandmarkProps, ref: MutableRefObject<FocusableElement>): LandmarkAria;
//# sourceMappingURL=types.d.ts.map
{
"name": "@react-aria/landmark",
"version": "3.0.0-nightly.3359+da520fcc1",
"version": "3.0.0-nightly.3362+d667676bd",
"description": "Spectrum UI components in React",

@@ -21,5 +21,5 @@ "license": "Apache-2.0",

"@babel/runtime": "^7.6.2",
"@react-aria/focus": "3.0.0-nightly.1659+da520fcc1",
"@react-aria/utils": "3.0.0-nightly.1659+da520fcc1",
"@react-types/shared": "3.0.0-nightly.1659+da520fcc1"
"@react-aria/focus": "3.0.0-nightly.1662+d667676bd",
"@react-aria/utils": "3.0.0-nightly.1662+d667676bd",
"@react-types/shared": "3.0.0-nightly.1662+d667676bd"
},

@@ -32,3 +32,3 @@ "peerDependencies": {

},
"gitHead": "da520fcc159ddc694fd7bdf19cbc485c2e0c6e4b"
"gitHead": "d667676bd59eeb00eb087597579315841c352077"
}

@@ -13,4 +13,4 @@ /*

import {AriaLabelingProps} from '@react-types/shared';
import {HTMLAttributes, MutableRefObject, useCallback, useEffect, useState} from 'react';
import {AriaLabelingProps, DOMAttributes, FocusableElement} from '@react-types/shared';
import {MutableRefObject, useCallback, useEffect, useState} from 'react';
import {useLayoutEffect} from '@react-aria/utils';

@@ -25,10 +25,10 @@

interface LandmarkAria {
landmarkProps: HTMLAttributes<HTMLElement>
landmarkProps: DOMAttributes
}
type Landmark = {
ref: MutableRefObject<HTMLElement>,
ref: MutableRefObject<Element>,
role: AriaLandmarkRole,
label?: string,
lastFocused?: HTMLElement,
lastFocused?: FocusableElement,
focus: () => void,

@@ -71,3 +71,3 @@ blur: () => void

private focusLandmark(landmark: HTMLElement) {
private focusLandmark(landmark: Element) {
this.landmarks.find(l => l.ref.current === landmark)?.focus();

@@ -135,3 +135,3 @@ }

public removeLandmark(ref: MutableRefObject<HTMLElement>) {
public removeLandmark(ref: MutableRefObject<Element>) {
this.landmarks = this.landmarks.filter(landmark => landmark.ref !== ref);

@@ -176,3 +176,3 @@ if (this.landmarks.length === 0) {

*/
private closestLandmark(element: HTMLElement) {
private closestLandmark(element: Element) {
let landmarkMap = new Map(this.landmarks.map(l => [l.ref.current, l]));

@@ -192,3 +192,3 @@ let currentElement = element;

*/
public getNextLandmark(element: HTMLElement, {backward}: {backward?: boolean }) {
public getNextLandmark(element: Element, {backward}: {backward?: boolean }) {
if (this.landmarks.length === 0) {

@@ -225,3 +225,3 @@ return undefined;

let backward = e.shiftKey;
let nextLandmark = this.getNextLandmark(e.target as HTMLElement, {backward});
let nextLandmark = this.getNextLandmark(e.target as Element, {backward});

@@ -263,7 +263,7 @@ // If no landmarks, return

public focusinHandler(e: FocusEvent) {
let currentLandmark = this.closestLandmark(e.target as HTMLElement);
let currentLandmark = this.closestLandmark(e.target as Element);
if (currentLandmark && currentLandmark.ref.current !== e.target) {
this.updateLandmark({ref: currentLandmark.ref, lastFocused: e.target as HTMLElement});
this.updateLandmark({ref: currentLandmark.ref, lastFocused: e.target as FocusableElement});
}
let previousFocusedElement = e.relatedTarget as HTMLElement;
let previousFocusedElement = e.relatedTarget as Element;
if (previousFocusedElement) {

@@ -281,3 +281,3 @@ let closestPreviousLandmark = this.closestLandmark(previousFocusedElement);

public focusoutHandler(e: FocusEvent) {
let previousFocusedElement = e.target as HTMLElement;
let previousFocusedElement = e.target as Element;
let nextFocusedElement = e.relatedTarget;

@@ -300,3 +300,3 @@ // the === document seems to be a jest thing for focus to go there on generic blur event such as landmark.blur();

*/
export function useLandmark(props: AriaLandmarkProps, ref: MutableRefObject<HTMLElement>): LandmarkAria {
export function useLandmark(props: AriaLandmarkProps, ref: MutableRefObject<FocusableElement>): LandmarkAria {
const {

@@ -303,0 +303,0 @@ role,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc