@looker/components-providers
Advanced tools
Comparing version 0.11.1-canary.0 to 0.12.0
@@ -6,13 +6,8 @@ # Change Log | ||
## [0.11.1-canary.0](https://github.com/looker-open-source/components/compare/v0.10.4...v0.11.1-canary.0) (2021-02-05) | ||
# [0.12.0](https://github.com/looker-open-source/components/compare/v0.11.0...v0.12.0) (2021-02-13) | ||
### Bug Fixes | ||
### Features | ||
- **FocusTrap:** Return focus behavior on nested focus traps ([#1886](https://github.com/looker-open-source/components/issues/1886)) ([78bfd87](https://github.com/looker-open-source/components/commit/78bfd87532c65cf33bc8fc00941387a3249a139e)) | ||
* **components:** nestedMenu on MenuItem ([#1780](https://github.com/looker-open-source/components/issues/1780)) ([7a1fada](https://github.com/looker-open-source/components/commit/7a1fada4523dd0805279baed974dc27836f32207)) | ||
# [0.11.0](https://github.com/looker-open-source/components/compare/v0.10.4...v0.11.0) (2021-02-04) | ||
@@ -19,0 +14,0 @@ |
@@ -19,2 +19,15 @@ "use strict"; | ||
}); | ||
var _types = require("./types"); | ||
Object.keys(_types).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (key in exports && exports[key] === _types[key]) return; | ||
Object.defineProperty(exports, key, { | ||
enumerable: true, | ||
get: function get() { | ||
return _types[key]; | ||
} | ||
}); | ||
}); | ||
//# sourceMappingURL=index.js.map |
@@ -23,3 +23,9 @@ "use strict"; | ||
}) => { | ||
const nodeFocusedBeforeActivation = document.activeElement; | ||
var _options$returnFocusR; | ||
if (options && !options.returnFocusRef.current) { | ||
options.returnFocusRef.current = document.activeElement; | ||
} | ||
const nodeFocusedBeforeActivation = options === null || options === void 0 ? void 0 : (_options$returnFocusR = options.returnFocusRef) === null || _options$returnFocusR === void 0 ? void 0 : _options$returnFocusR.current; | ||
let firstTabbableNode = element; | ||
@@ -26,0 +32,0 @@ let lastTabbableNode = element; |
import React, { FC } from 'react'; | ||
import { TrapStackContextProps } from '../TrapStack'; | ||
export declare const FocusTrapContext: React.Context<TrapStackContextProps>; | ||
import { FocusTrapOptions } from './types'; | ||
export declare const FocusTrapContext: React.Context<TrapStackContextProps<FocusTrapOptions>>; | ||
export declare const FocusTrapProvider: FC; |
export * from './FocusTrapProvider'; | ||
export * from './types'; |
export * from './FocusTrapProvider'; | ||
export * from './types'; | ||
//# sourceMappingURL=index.js.map |
import { Trap } from '../TrapStack/types'; | ||
export declare const activateFocusTrap: ({ element, options, }: Trap<{ | ||
clickOutsideDeactivates?: boolean; | ||
}>) => () => void; | ||
import { FocusTrapOptions } from './types'; | ||
export declare const activateFocusTrap: ({ element, options, }: Trap<FocusTrapOptions>) => () => void; |
@@ -14,5 +14,12 @@ import "core-js/modules/web.timers.js"; | ||
export var activateFocusTrap = function activateFocusTrap(_ref) { | ||
var _options$returnFocusR; | ||
var element = _ref.element, | ||
options = _ref.options; | ||
var nodeFocusedBeforeActivation = document.activeElement; | ||
if (options && !options.returnFocusRef.current) { | ||
options.returnFocusRef.current = document.activeElement; | ||
} | ||
var nodeFocusedBeforeActivation = options === null || options === void 0 ? void 0 : (_options$returnFocusR = options.returnFocusRef) === null || _options$returnFocusR === void 0 ? void 0 : _options$returnFocusR.current; | ||
var firstTabbableNode = element; | ||
@@ -19,0 +26,0 @@ var lastTabbableNode = element; |
import React, { FC } from 'react'; | ||
import { TrapStackContextProps } from '../TrapStack'; | ||
export declare const ScrollLockContext: React.Context<TrapStackContextProps>; | ||
export declare const ScrollLockContext: React.Context<TrapStackContextProps<{}>>; | ||
export declare const ScrollLockProvider: FC; |
@@ -1,7 +0,8 @@ | ||
import { Context, FC } from 'react'; | ||
import { Context, ReactNode } from 'react'; | ||
import { Trap, TrapStackContextProps } from './types'; | ||
export interface TrapStackProviderProps { | ||
activate: (trap: Trap) => () => void; | ||
context: Context<TrapStackContextProps>; | ||
export interface TrapStackProviderProps<O extends {} = {}> { | ||
activate: (trap: Trap<O>) => () => void; | ||
children?: ReactNode; | ||
context: Context<TrapStackContextProps<O>>; | ||
} | ||
export declare const TrapStackProvider: FC<TrapStackProviderProps>; | ||
export declare const TrapStackProvider: <O>({ activate, context, children, }: TrapStackProviderProps<O>) => JSX.Element; |
import { MutableRefObject } from 'react'; | ||
export interface Trap<T extends {} = {}> { | ||
export interface Trap<O extends {} = {}> { | ||
element: HTMLElement; | ||
options?: T; | ||
options?: O; | ||
} | ||
export interface TrapStackContextProps { | ||
export interface TrapStackContextProps<O extends {} = {}> { | ||
activeTrapRef?: MutableRefObject<HTMLElement | null>; | ||
addTrap?: (id: string, trap: Trap) => void; | ||
addTrap?: (id: string, trap: Trap<O>) => void; | ||
disableCurrentTrap?: () => void; | ||
enableCurrentTrap?: () => void; | ||
getTrap?: (id: string) => Trap | null; | ||
getTrap?: (id: string) => Trap<O> | null; | ||
removeTrap?: (id: string) => void; | ||
} | ||
export interface TrapMap { | ||
[key: string]: Trap; | ||
export interface TrapMap<O extends {} = {}> { | ||
[key: string]: Trap<O>; | ||
} |
import { TrapMap } from './types'; | ||
export declare const getActiveTrap: (trapMap: TrapMap) => import("./types").Trap<{}> | null; | ||
export declare const getActiveTrap: <O extends {} = {}>(trapMap: TrapMap<O>) => import("./types").Trap<O> | null; |
MIT License | ||
Copyright (c) 2020 Looker Data Sciences, Inc. | ||
Copyright (c) 2021 Looker Data Sciences, Inc. | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "@looker/components-providers", | ||
"license": "MIT", | ||
"version": "0.11.1-canary.0", | ||
"version": "0.12.0", | ||
"main": "lib/cjs/index.js", | ||
@@ -21,3 +21,3 @@ "module": "lib/index.js", | ||
"dependencies": { | ||
"@looker/design-tokens": "0.11.1-canary.0", | ||
"@looker/design-tokens": "^0.12.0", | ||
"lodash": "^4.17.20", | ||
@@ -27,2 +27,3 @@ "tabbable": "^5.1.4" | ||
"devDependencies": { | ||
"@testing-library/react": "^11.2.5", | ||
"@types/lodash": "^4.14.167", | ||
@@ -40,3 +41,3 @@ "@types/react": "^16.9.56", | ||
}, | ||
"gitHead": "271a132cc79551e7628e5936abfa16182e82321d" | ||
"gitHead": "019d7b40b70d7cddc03872e287a24fb7df27d873" | ||
} |
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
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
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
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
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
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
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
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
143118
78
939
7
+ Added@looker/design-tokens@0.12.0(transitive)
- Removed@looker/design-tokens@0.11.1-canary.0(transitive)