@openedx/paragon 23.1.0 → 23.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.css +4 -4
- package/dist/core.css.map +1 -1
- package/dist/hooks/useArrowKeyNavigation.d.ts +10 -0
- package/dist/hooks/useArrowKeyNavigation.js +8 -11
- package/dist/hooks/useArrowKeyNavigation.js.map +1 -1
- package/dist/hooks/useIndexOfLastVisibleChild.d.ts +12 -0
- package/dist/hooks/useIndexOfLastVisibleChild.js +16 -15
- package/dist/hooks/useIndexOfLastVisibleChild.js.map +1 -1
- package/dist/hooks/useIsVisible.d.ts +3 -0
- package/dist/hooks/useIsVisible.js +1 -1
- package/dist/hooks/useIsVisible.js.map +1 -1
- package/dist/hooks/useToggle.d.ts +12 -0
- package/dist/hooks/useToggle.js +7 -18
- package/dist/hooks/useToggle.js.map +1 -1
- package/dist/hooks/useWindowSize.d.ts +6 -0
- package/dist/hooks/useWindowSize.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -5
- package/dist/light.css +4 -4
- package/dist/light.css.map +1 -1
- package/package.json +1 -1
- package/src/hooks/tests/{useIndexOfLastVisibleChild.test.jsx → useIndexOfLastVisibleChild.test.tsx} +2 -2
- package/src/hooks/tests/{useToggle.test.jsx → useToggle.test.tsx} +2 -1
- package/src/hooks/{useArrowKeyNavigation.jsx → useArrowKeyNavigation.tsx} +37 -13
- package/src/hooks/{useIndexOfLastVisibleChild.jsx → useIndexOfLastVisibleChild.tsx} +18 -16
- package/src/hooks/{useIsVisible.jsx → useIsVisible.tsx} +6 -3
- package/src/hooks/useToggle.tsx +38 -0
- package/src/hooks/{useWindowSize.jsx → useWindowSize.tsx} +7 -2
- package/src/index.d.ts +5 -5
- package/src/index.js +5 -5
- package/styles/css/core/custom-media-breakpoints.css +2 -2
- package/styles/css/core/variables.css +2 -2
- package/styles/css/themes/light/utility-classes.css +2 -2
- package/styles/css/themes/light/variables.css +2 -2
- package/tokens/style-dictionary.js +2 -2
- package/src/hooks/useToggle.jsx +0 -37
- /package/src/hooks/tests/{useWindowSize.test.jsx → useWindowSize.test.tsx} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ArrowKeyNavProps {
|
|
3
|
+
/** e.g. 'a,button,input' */
|
|
4
|
+
selectors?: string;
|
|
5
|
+
ignoredKeys?: string[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A React hook to enable arrow key navigation on a component.
|
|
9
|
+
*/
|
|
10
|
+
export default function useArrowKeyNavigation(props?: ArrowKeyNavProps): import("react").MutableRefObject<HTMLElement | undefined>;
|
|
@@ -5,11 +5,6 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { useRef, useEffect } from 'react';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A React hook to enable arrow key navigation on a component.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
8
|
function handleEnter(_ref) {
|
|
14
9
|
var event = _ref.event,
|
|
15
10
|
currentIndex = _ref.currentIndex,
|
|
@@ -48,7 +43,6 @@ function handleArrowKey(_ref2) {
|
|
|
48
43
|
(_nextElement = nextElement) === null || _nextElement === void 0 ? void 0 : _nextElement.focus();
|
|
49
44
|
event.preventDefault();
|
|
50
45
|
}
|
|
51
|
-
|
|
52
46
|
/**
|
|
53
47
|
* Implement arrow key navigation for the given parentNode
|
|
54
48
|
*/
|
|
@@ -86,7 +80,7 @@ function handleEvents(_ref3) {
|
|
|
86
80
|
var currentIndex = Array.from(availableElements).findIndex(function (availableElement) {
|
|
87
81
|
return availableElement === activeElement;
|
|
88
82
|
});
|
|
89
|
-
if (key === 'Enter') {
|
|
83
|
+
if (key === 'Enter' && activeElement) {
|
|
90
84
|
handleEnter({
|
|
91
85
|
event: event,
|
|
92
86
|
currentIndex: currentIndex,
|
|
@@ -99,10 +93,13 @@ function handleEvents(_ref3) {
|
|
|
99
93
|
availableElements: availableElements
|
|
100
94
|
});
|
|
101
95
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
/**
|
|
97
|
+
* A React hook to enable arrow key navigation on a component.
|
|
98
|
+
*/
|
|
99
|
+
export default function useArrowKeyNavigation() {
|
|
100
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
101
|
+
var selectors = props.selectors,
|
|
102
|
+
ignoredKeys = props.ignoredKeys;
|
|
106
103
|
var parentNode = useRef();
|
|
107
104
|
useEffect(function () {
|
|
108
105
|
var eventHandler = function eventHandler(event) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useArrowKeyNavigation.js","names":["useRef","useEffect","handleEnter","_ref","event","currentIndex","activeElement","click","preventDefault","handleArrowKey","_ref2","_nextElement","availableElements","focus","nextElement","key","length","_availableElements","_slicedToArray","handleEvents","_ref3","_ref3$ignoredKeys","ignoredKeys","parentNode","_ref3$selectors","selectors","includes","_document","document","contains","querySelectorAll","Array","from","findIndex","availableElement","useArrowKeyNavigation","props","
|
|
1
|
+
{"version":3,"file":"useArrowKeyNavigation.js","names":["useRef","useEffect","handleEnter","_ref","event","currentIndex","activeElement","click","preventDefault","handleArrowKey","_ref2","_nextElement","availableElements","focus","nextElement","key","length","_availableElements","_slicedToArray","handleEvents","_ref3","_ref3$ignoredKeys","ignoredKeys","parentNode","_ref3$selectors","selectors","includes","_document","document","contains","querySelectorAll","Array","from","findIndex","availableElement","useArrowKeyNavigation","props","arguments","undefined","eventHandler","current","addEventListener","removeEventListener"],"sources":["../../src/hooks/useArrowKeyNavigation.tsx"],"sourcesContent":["import { useRef, useEffect } from 'react';\n\ninterface HandleEnterArgs {\n event: KeyboardEvent;\n currentIndex: number;\n activeElement: HTMLElement;\n}\n\nfunction handleEnter({ event, currentIndex, activeElement }: HandleEnterArgs) {\n if (currentIndex === -1) { return; }\n activeElement.click();\n event.preventDefault();\n}\n\ninterface HandleArrowKeyArgs {\n event: KeyboardEvent;\n currentIndex: number;\n availableElements: NodeListOf<HTMLElement>;\n}\n\nfunction handleArrowKey({ event, currentIndex, availableElements }: HandleArrowKeyArgs) {\n // If the focus isn't in the container, focus on the first thing\n if (currentIndex === -1) { availableElements[0].focus(); }\n\n // Move the focus up or down. Wrap around ends of list.\n let nextElement;\n\n if (event.key === 'ArrowDown' || event.key === 'ArrowRight') {\n nextElement = availableElements[(currentIndex + 1) % availableElements.length];\n }\n if (event.key === 'ArrowUp' || event.key === 'ArrowLeft') {\n nextElement = currentIndex - 1 < 0\n ? availableElements[currentIndex - 1 + availableElements.length]\n : availableElements[currentIndex - 1];\n }\n if (event.key === 'End') {\n nextElement = availableElements[availableElements.length - 1];\n }\n if (event.key === 'Home') {\n [nextElement] = availableElements;\n }\n\n nextElement?.focus();\n event.preventDefault();\n}\n\ninterface HandleEventsArgs {\n event: KeyboardEvent;\n ignoredKeys?: string[];\n parentNode: HTMLElement | undefined;\n selectors?: string;\n}\n\n/**\n * Implement arrow key navigation for the given parentNode\n */\nfunction handleEvents({\n event,\n ignoredKeys = [],\n parentNode,\n selectors = 'a,button,input',\n}: HandleEventsArgs) {\n if (!parentNode) { return; }\n\n const { key } = event;\n\n if (!['ArrowUp', 'ArrowDown', 'ArrowRight', 'ArrowLeft', 'Enter', 'Home', 'End'].includes(key)\n || ignoredKeys.includes(key)) {\n return;\n }\n\n const { activeElement } = document;\n\n // If we're not inside the container, don't do anything\n if (!parentNode.contains(activeElement)) { return; }\n\n // Get the list of elements we're allowed to scroll through\n const availableElements = parentNode.querySelectorAll<HTMLElement>(selectors);\n\n // No elements are available to loop through.\n if (!availableElements.length) { return; }\n\n // Which index is currently selected\n const currentIndex = Array.from(availableElements).findIndex(\n (availableElement) => availableElement === activeElement,\n );\n\n if (key === 'Enter' && activeElement) {\n handleEnter({ event, currentIndex, activeElement: activeElement as HTMLElement });\n }\n handleArrowKey({ event, currentIndex, availableElements });\n}\n\nexport interface ArrowKeyNavProps {\n /** e.g. 'a,button,input' */\n selectors?: string;\n ignoredKeys?: string[];\n}\n\n/**\n * A React hook to enable arrow key navigation on a component.\n */\nexport default function useArrowKeyNavigation(props: ArrowKeyNavProps = {}) {\n const { selectors, ignoredKeys } = props;\n const parentNode = useRef<HTMLElement>();\n\n useEffect(() => {\n const eventHandler = (event: KeyboardEvent) => {\n handleEvents({\n event, ignoredKeys, parentNode: parentNode.current, selectors,\n });\n };\n\n document.addEventListener('keydown', eventHandler);\n\n return () => document.removeEventListener('keydown', eventHandler);\n }, [ignoredKeys, selectors]);\n\n return parentNode;\n}\n"],"mappings":";;;;;;AAAA,SAASA,MAAM,EAAEC,SAAS,QAAQ,OAAO;AAQzC,SAASC,WAAWA,CAAAC,IAAA,EAA0D;EAAA,IAAvDC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,YAAY,GAAAF,IAAA,CAAZE,YAAY;IAAEC,aAAa,GAAAH,IAAA,CAAbG,aAAa;EACvD,IAAID,YAAY,KAAK,CAAC,CAAC,EAAE;IAAE;EAAQ;EACnCC,aAAa,CAACC,KAAK,CAAC,CAAC;EACrBH,KAAK,CAACI,cAAc,CAAC,CAAC;AACxB;AAQA,SAASC,cAAcA,CAAAC,KAAA,EAAiE;EAAA,IAAAC,YAAA;EAAA,IAA9DP,KAAK,GAAAM,KAAA,CAALN,KAAK;IAAEC,YAA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qBAAqBA,CAAA,EAA+B;EAAA,IAA9BC,KAAuB,GAAAC,SAAA,CAAArB,MAAA,QAAAqB,SAAA,QAAAC,SAAA,GAAAD,SAAA,MAAG,CAAC,CAAC;EACxE,IAAQZ,SAAS,GAAkBW,KAAK,CAAhCX,SAAS;IAAEH,WAAW,GAAKc,KAAK,CAArBd,WAAW;EAC9B,IAAMC,UAAU,GAAGvB,MAAM,CAAc,CAAC;EAExCC,SAAS,CAAC,YAAM;IACd,IAAMsC,YAAY,GAAG,SAAfA,YAAYA,CAAInC,KAAoB,EAAK;MAC7Ce,YAAY,CAAC;QACXf,KAAK,EAALA,KAAK;QAAEkB,WAAW,EAAXA,WAAW;QAAEC,UAAU,EAAEA,UAAU,CAACiB,OAAO;QAAEf,SAAS,EAATA;MACtD,CAAC,CAAC;IACJ,CAAC;IAEDG,QAAQ,CAACa,gBAAgB,CAAC,SAAS,EAAEF,YAAY,CAAC;IAElD,OAAO;MAAA,OAAMX,QAAQ,CAACc,mBAAmB,CAAC,SAAS,EAAEH,YAAY,CAAC;IAAA;EACpE,CAAC,EAAE,CAACjB,WAAW,EAAEG,SAAS,CAAC,CAAC;EAE5B,OAAOF,UAAU;AACnB","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This hook will find the index of the last child of a containing element
|
|
3
|
+
* that fits within its bounding rectangle. This is done by summing the widths
|
|
4
|
+
* of the children until they exceed the width of the container.
|
|
5
|
+
*
|
|
6
|
+
* The hook returns the index of the last visible child.
|
|
7
|
+
*
|
|
8
|
+
* @param containerElementRef - container element
|
|
9
|
+
* @param overflowElementRef - overflow element
|
|
10
|
+
*/
|
|
11
|
+
declare const useIndexOfLastVisibleChild: (containerElementRef: HTMLElement | null, overflowElementRef: HTMLElement | null) => number;
|
|
12
|
+
export default useIndexOfLastVisibleChild;
|
|
@@ -11,10 +11,10 @@ import { useLayoutEffect, useState } from 'react';
|
|
|
11
11
|
* that fits within its bounding rectangle. This is done by summing the widths
|
|
12
12
|
* of the children until they exceed the width of the container.
|
|
13
13
|
*
|
|
14
|
-
* @param {Element} containerElementRef - container element
|
|
15
|
-
* @param {Element} overflowElementRef - overflow element
|
|
16
|
-
*
|
|
17
14
|
* The hook returns the index of the last visible child.
|
|
15
|
+
*
|
|
16
|
+
* @param containerElementRef - container element
|
|
17
|
+
* @param overflowElementRef - overflow element
|
|
18
18
|
*/
|
|
19
19
|
var useIndexOfLastVisibleChild = function useIndexOfLastVisibleChild(containerElementRef, overflowElementRef) {
|
|
20
20
|
var _useState = useState(-1),
|
|
@@ -22,7 +22,11 @@ var useIndexOfLastVisibleChild = function useIndexOfLastVisibleChild(containerEl
|
|
|
22
22
|
indexOfLastVisibleChild = _useState2[0],
|
|
23
23
|
setIndexOfLastVisibleChild = _useState2[1];
|
|
24
24
|
useLayoutEffect(function () {
|
|
25
|
+
if (!containerElementRef) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
25
28
|
function updateLastVisibleChildIndex() {
|
|
29
|
+
var _overflowElementRef$g;
|
|
26
30
|
// Get array of child nodes from NodeList form
|
|
27
31
|
var childNodesArr = Array.prototype.slice.call(containerElementRef.children);
|
|
28
32
|
var _childNodesArr$filter = childNodesArr
|
|
@@ -42,23 +46,20 @@ var useIndexOfLastVisibleChild = function useIndexOfLastVisibleChild(containerEl
|
|
|
42
46
|
// sometimes we'll show a dropdown with one item in it when it would fit,
|
|
43
47
|
// but allowing this case dramatically simplifies the calculations we need
|
|
44
48
|
// to do above.
|
|
45
|
-
sumWidth: overflowElementRef ? overflowElementRef.getBoundingClientRect().width : 0,
|
|
49
|
+
sumWidth: (_overflowElementRef$g = overflowElementRef === null || overflowElementRef === void 0 ? void 0 : overflowElementRef.getBoundingClientRect().width) !== null && _overflowElementRef$g !== void 0 ? _overflowElementRef$g : 0,
|
|
46
50
|
nextIndexOfLastVisibleChild: -1
|
|
47
51
|
}),
|
|
48
52
|
nextIndexOfLastVisibleChild = _childNodesArr$filter.nextIndexOfLastVisibleChild;
|
|
49
53
|
setIndexOfLastVisibleChild(nextIndexOfLastVisibleChild);
|
|
50
54
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
return undefined;
|
|
55
|
+
updateLastVisibleChildIndex();
|
|
56
|
+
var resizeObserver = new ResizeObserver(function () {
|
|
57
|
+
return updateLastVisibleChildIndex();
|
|
58
|
+
});
|
|
59
|
+
resizeObserver.observe(containerElementRef);
|
|
60
|
+
return function () {
|
|
61
|
+
return resizeObserver.disconnect();
|
|
62
|
+
};
|
|
62
63
|
}, [containerElementRef, overflowElementRef]);
|
|
63
64
|
return indexOfLastVisibleChild;
|
|
64
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIndexOfLastVisibleChild.js","names":["useLayoutEffect","useState","useIndexOfLastVisibleChild","containerElementRef","overflowElementRef","_useState","_useState2","_slicedToArray","indexOfLastVisibleChild","setIndexOfLastVisibleChild","updateLastVisibleChildIndex","childNodesArr","Array","prototype","slice","call","children","_childNodesArr$filter","filter","childNode","reduce","acc","index","sumWidth","getBoundingClientRect","width","nextIndexOfLastVisibleChild","resizeObserver","ResizeObserver","observe","disconnect"
|
|
1
|
+
{"version":3,"file":"useIndexOfLastVisibleChild.js","names":["useLayoutEffect","useState","useIndexOfLastVisibleChild","containerElementRef","overflowElementRef","_useState","_useState2","_slicedToArray","indexOfLastVisibleChild","setIndexOfLastVisibleChild","undefined","updateLastVisibleChildIndex","_overflowElementRef$g","childNodesArr","Array","prototype","slice","call","children","_childNodesArr$filter","filter","childNode","reduce","acc","index","sumWidth","getBoundingClientRect","width","nextIndexOfLastVisibleChild","resizeObserver","ResizeObserver","observe","disconnect"],"sources":["../../src/hooks/useIndexOfLastVisibleChild.tsx"],"sourcesContent":["import { useLayoutEffect, useState } from 'react';\n\n/**\n * This hook will find the index of the last child of a containing element\n * that fits within its bounding rectangle. This is done by summing the widths\n * of the children until they exceed the width of the container.\n *\n * The hook returns the index of the last visible child.\n *\n * @param containerElementRef - container element\n * @param overflowElementRef - overflow element\n */\nconst useIndexOfLastVisibleChild = (\n containerElementRef: HTMLElement | null,\n overflowElementRef: HTMLElement | null,\n): number => {\n const [indexOfLastVisibleChild, setIndexOfLastVisibleChild] = useState(-1);\n\n useLayoutEffect(() => {\n if (!containerElementRef) {\n return undefined;\n }\n\n function updateLastVisibleChildIndex() {\n // Get array of child nodes from NodeList form\n const childNodesArr = Array.prototype.slice.call(containerElementRef!.children);\n const { nextIndexOfLastVisibleChild } = childNodesArr\n // filter out the overflow element\n .filter(childNode => childNode !== overflowElementRef)\n // sum the widths to find the last visible element's index\n .reduce((acc, childNode, index) => {\n acc.sumWidth += childNode.getBoundingClientRect().width;\n if (acc.sumWidth <= containerElementRef!.getBoundingClientRect().width) {\n acc.nextIndexOfLastVisibleChild = index;\n }\n return acc;\n }, {\n // Include the overflow element's width to begin with. Doing this means\n // sometimes we'll show a dropdown with one item in it when it would fit,\n // but allowing this case dramatically simplifies the calculations we need\n // to do above.\n sumWidth: overflowElementRef?.getBoundingClientRect().width ?? 0,\n nextIndexOfLastVisibleChild: -1,\n });\n\n setIndexOfLastVisibleChild(nextIndexOfLastVisibleChild);\n }\n\n updateLastVisibleChildIndex();\n\n const resizeObserver = new ResizeObserver(() => updateLastVisibleChildIndex());\n resizeObserver.observe(containerElementRef);\n return () => resizeObserver.disconnect();\n }, [containerElementRef, overflowElementRef]);\n\n return indexOfLastVisibleChild;\n};\n\nexport default useIndexOfLastVisibleChild;\n"],"mappings":";;;;;;AAAA,SAASA,eAAe,EAAEC,QAAQ,QAAQ,OAAO;;AAEjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA0BA,CAC9BC,mBAAuC,EACvCC,kBAAsC,EAC3B;EACX,I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C,cAAc,CAAC;MAAA,OAAMnB,2BAA2B,CAAC,CAAC;IAAA,EAAC;IAC9EkB,cAAc,CAACE,OAAO,CAAC5B,mBAAmB,CAAC;IAC3C,OAAO;MAAA,OAAM0B,cAAc,CAACG,UAAU,CAAC,CAAC;IAAA;EAC1C,CAAC,EAAE,CAAC7B,mBAAmB,EAAEC,kBAAkB,CAAC,CAAC;EAE7C,OAAOI,uBAAuB;AAChC,CAAC;AAED,eAAeN,0BAA0B","ignoreList":[]}
|
|
@@ -7,7 +7,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
7
7
|
import { useRef, useState, useEffect } from 'react';
|
|
8
8
|
var useIsVisible = function useIsVisible() {
|
|
9
9
|
var defaultIsVisible = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
10
|
-
var sentinelRef = useRef();
|
|
10
|
+
var sentinelRef = useRef(null);
|
|
11
11
|
var _useState = useState(defaultIsVisible),
|
|
12
12
|
_useState2 = _slicedToArray(_useState, 2),
|
|
13
13
|
isVisible = _useState2[0],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsVisible.js","names":["useRef","useState","useEffect","useIsVisible","defaultIsVisible","arguments","length","undefined","sentinelRef","_useState","_useState2","_slicedToArray","isVisible","setIsVisible","current","observer","IntersectionObserver","entries","forEach","_ref","isIntersecting","observe","disconnect","e","isReferenceError","ReferenceError"],"sources":["../../src/hooks/useIsVisible.
|
|
1
|
+
{"version":3,"file":"useIsVisible.js","names":["useRef","useState","useEffect","useIsVisible","defaultIsVisible","arguments","length","undefined","sentinelRef","_useState","_useState2","_slicedToArray","isVisible","setIsVisible","current","observer","IntersectionObserver","entries","forEach","_ref","isIntersecting","observe","disconnect","e","isReferenceError","ReferenceError"],"sources":["../../src/hooks/useIsVisible.tsx"],"sourcesContent":["import React, { useRef, useState, useEffect } from 'react';\n\nconst useIsVisible = (defaultIsVisible = true): [\n isVisible: boolean,\n sentinelRef: React.MutableRefObject<HTMLElement | null>,\n] => {\n const sentinelRef = useRef<HTMLElement | null>(null);\n const [isVisible, setIsVisible] = useState(defaultIsVisible);\n\n useEffect(() => {\n try {\n if (sentinelRef.current) {\n const observer = new IntersectionObserver((entries) => {\n entries.forEach(({ isIntersecting }) => {\n setIsVisible(isIntersecting);\n });\n }, {});\n observer.observe(sentinelRef.current);\n return () => {\n observer.disconnect();\n };\n }\n } catch (e) {\n const isReferenceError = e instanceof ReferenceError;\n if (!isReferenceError) {\n throw e;\n }\n // Do nothing if an intersection observer can't be created.\n }\n return () => {};\n }, []);\n\n return [isVisible, sentinelRef];\n};\n\nexport default useIsVisible;\n"],"mappings":";;;;;;AAAA,SAAgBA,MAAM,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAE1D,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAA,EAGb;EAAA,IAHiBC,gBAAgB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EAI3C,IAAMG,WAAW,GAAGR,MAAM,CAAqB,IAAI,CAAC;EACpD,IAAAS,SAAA,GAAkCR,QAAQ,CAACG,gBAAgB,CAAC;IAAAM,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAArDG,SAAS,GAAAF,UAAA;IAAEG,YAAY,GAAAH,UAAA;EAE9BR,SAAS,CAAC,YAAM;IACd,IAAI;MACF,IAAIM,WAAW,CAACM,OAAO,EAAE;QACvB,IAAMC,QAAQ,GAAG,IAAIC,oBAAoB,CAAC,UAACC,OAAO,EAAK;UACrDA,OAAO,CAACC,OAAO,CAAC,UAAAC,IAAA,EAAwB;YAAA,IAArBC,cAAc,GAAAD,IAAA,CAAdC,cAAc;YAC/BP,YAAY,CAACO,cAAc,CAAC;UAC9B,CAAC,CAAC;QACJ,CAAC,EAAE,CAAC,CAAC,CAAC;QACNL,QAAQ,CAACM,OAAO,CAACb,WAAW,CAACM,OAAO,CAAC;QACrC,OAAO,YAAM;UACXC,QAAQ,CAACO,UAAU,CAAC,CAAC;QACvB,CAAC;MACH;IACF,CAAC,CAAC,OAAOC,CAAC,EAAE;MACV,IAAMC,gBAAgB,GAAGD,CAAC,YAAYE,cAAc;MACpD,IAAI,CAACD,gBAAgB,EAAE;QACrB,MAAMD,CAAC;MACT;MACA;IACF;IACA,OAAO,YAAM,CAAC,CAAC;EACjB,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO,CAACX,SAAS,EAAEJ,WAAW,CAAC;AACjC,CAAC;AAED,eAAeL,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Toggler = [
|
|
2
|
+
isOn: boolean,
|
|
3
|
+
setOn: () => void,
|
|
4
|
+
setOff: () => void,
|
|
5
|
+
toggle: () => void
|
|
6
|
+
];
|
|
7
|
+
export interface ToggleHandlers {
|
|
8
|
+
handleToggleOn?: () => void;
|
|
9
|
+
handleToggleOff?: () => void;
|
|
10
|
+
handleToggle?: (newStatus: boolean) => void;
|
|
11
|
+
}
|
|
12
|
+
export default function useToggle(defaultIsOn?: boolean, handlers?: ToggleHandlers): Toggler;
|
package/dist/hooks/useToggle.js
CHANGED
|
@@ -5,36 +5,25 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { useState, useCallback } from 'react';
|
|
8
|
-
export default function useToggle(
|
|
8
|
+
export default function useToggle() {
|
|
9
|
+
var defaultIsOn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
9
10
|
var handlers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
10
11
|
var handleToggleOn = handlers.handleToggleOn,
|
|
11
12
|
handleToggleOff = handlers.handleToggleOff,
|
|
12
13
|
handleToggle = handlers.handleToggle;
|
|
13
|
-
var _useState = useState(defaultIsOn
|
|
14
|
+
var _useState = useState(defaultIsOn),
|
|
14
15
|
_useState2 = _slicedToArray(_useState, 2),
|
|
15
16
|
isOn = _useState2[0],
|
|
16
17
|
setIsOn = _useState2[1];
|
|
17
18
|
var setOn = useCallback(function () {
|
|
18
19
|
setIsOn(true);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
handleToggleOn();
|
|
22
|
-
}
|
|
23
|
-
// istanbul ignore else
|
|
24
|
-
if (handleToggle) {
|
|
25
|
-
handleToggle(true);
|
|
26
|
-
}
|
|
20
|
+
handleToggleOn === null || handleToggleOn === void 0 ? void 0 : handleToggleOn();
|
|
21
|
+
handleToggle === null || handleToggle === void 0 ? void 0 : handleToggle(true);
|
|
27
22
|
}, [handleToggleOn, handleToggle]);
|
|
28
23
|
var setOff = useCallback(function () {
|
|
29
24
|
setIsOn(false);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
handleToggleOff();
|
|
33
|
-
}
|
|
34
|
-
// istanbul ignore else
|
|
35
|
-
if (handleToggle) {
|
|
36
|
-
handleToggle(false);
|
|
37
|
-
}
|
|
25
|
+
handleToggleOff === null || handleToggleOff === void 0 ? void 0 : handleToggleOff();
|
|
26
|
+
handleToggle === null || handleToggle === void 0 ? void 0 : handleToggle(false);
|
|
38
27
|
}, [handleToggleOff, handleToggle]);
|
|
39
28
|
var toggle = useCallback(function () {
|
|
40
29
|
var doToggle = isOn ? setOff : setOn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToggle.js","names":["useState","useCallback","useToggle","defaultIsOn","
|
|
1
|
+
{"version":3,"file":"useToggle.js","names":["useState","useCallback","useToggle","defaultIsOn","arguments","length","undefined","handlers","handleToggleOn","handleToggleOff","handleToggle","_useState","_useState2","_slicedToArray","isOn","setIsOn","setOn","setOff","toggle","doToggle"],"sources":["../../src/hooks/useToggle.tsx"],"sourcesContent":["import { useState, useCallback } from 'react';\n\nexport type Toggler = [\n isOn: boolean,\n setOn: () => void,\n setOff: () => void,\n toggle: () => void,\n];\n\nexport interface ToggleHandlers {\n handleToggleOn?: () => void;\n handleToggleOff?: () => void;\n handleToggle?: (newStatus: boolean) => void;\n}\n\nexport default function useToggle(defaultIsOn = false, handlers: ToggleHandlers = {}): Toggler {\n const { handleToggleOn, handleToggleOff, handleToggle } = handlers;\n const [isOn, setIsOn] = useState(defaultIsOn);\n\n const setOn = useCallback(() => {\n setIsOn(true);\n handleToggleOn?.();\n handleToggle?.(true);\n }, [handleToggleOn, handleToggle]);\n\n const setOff = useCallback(() => {\n setIsOn(false);\n handleToggleOff?.();\n handleToggle?.(false);\n }, [handleToggleOff, handleToggle]);\n\n const toggle = useCallback(() => {\n const doToggle = isOn ? setOff : setOn;\n doToggle();\n }, [isOn, setOn, setOff]);\n\n return [isOn, setOn, setOff, toggle];\n}\n"],"mappings":";;;;;;AAAA,SAASA,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AAe7C,eAAe,SAASC,SAASA,CAAA,EAA8D;EAAA,IAA7DC,WAAW,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAAA,IAAEG,QAAwB,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAClF,IAAQI,cAAc,GAAoCD,QAAQ,CAA1DC,cAAc;IAAEC,eAAe,GAAmBF,QAAQ,CAA1CE,eAAe;IAAEC,YAAY,GAAKH,QAAQ,CAAzBG,YAAY;EACrD,IAAAC,SAAA,GAAwBX,QAAQ,CAACG,WAAW,CAAC;IAAAS,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAAtCG,IAAI,GAAAF,UAAA;IAAEG,OAAO,GAAAH,UAAA;EAEpB,IAAMI,KAAK,GAAGf,WAAW,CAAC,YAAM;IAC9Bc,OAAO,CAAC,IAAI,CAAC;IACbP,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAG,CAAC;IAClBE,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAG,IAAI,CAAC;EACtB,CAAC,EAAE,CAACF,cAAc,EAAEE,YAAY,CAAC,CAAC;EAElC,IAAMO,MAAM,GAAGhB,WAAW,CAAC,YAAM;IAC/Bc,OAAO,CAAC,KAAK,CAAC;IACdN,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAG,CAAC;IACnBC,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAG,KAAK,CAAC;EACvB,CAAC,EAAE,CAACD,eAAe,EAAEC,YAAY,CAAC,CAAC;EAEnC,IAAMQ,MAAM,GAAGjB,WAAW,CAAC,YAAM;IAC/B,IAAMkB,QAAQ,GAAGL,IAAI,GAAGG,MAAM,GAAGD,KAAK;IACtCG,QAAQ,CAAC,CAAC;EACZ,CAAC,EAAE,CAACL,IAAI,EAAEE,KAAK,EAAEC,MAAM,CAAC,CAAC;EAEzB,OAAO,CAACH,IAAI,EAAEE,KAAK,EAAEC,MAAM,EAAEC,MAAM,CAAC;AACtC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWindowSize.js","names":["useState","useLayoutEffect","useWindowSize","_useState","width","undefined","height","_useState2","_slicedToArray","windowSize","setWindowSize","handleResize","global","innerWidth","innerHeight","addEventListener","removeEventListener"],"sources":["../../src/hooks/useWindowSize.
|
|
1
|
+
{"version":3,"file":"useWindowSize.js","names":["useState","useLayoutEffect","useWindowSize","_useState","width","undefined","height","_useState2","_slicedToArray","windowSize","setWindowSize","handleResize","global","innerWidth","innerHeight","addEventListener","removeEventListener"],"sources":["../../src/hooks/useWindowSize.tsx"],"sourcesContent":["import { useState, useLayoutEffect } from 'react';\n\nexport interface WindowSizeData {\n width: number | undefined;\n height: number | undefined;\n}\n\nfunction useWindowSize(): WindowSizeData {\n // Initialize state with undefined width/height so server and client renders match\n // Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/\n const [windowSize, setWindowSize] = useState<WindowSizeData>({\n width: undefined,\n height: undefined,\n });\n\n useLayoutEffect(() => {\n // Handler to call on window resize\n function handleResize() {\n // Set window width/height to state\n setWindowSize({\n width: global.innerWidth,\n height: global.innerHeight,\n });\n }\n\n // Add event listener\n global.addEventListener('resize', handleResize);\n\n // Call handler right away so state gets updated with initial window size\n handleResize();\n\n // Remove event listener on cleanup\n return () => global.removeEventListener('resize', handleResize);\n }, []); // Empty array ensures that effect is only run on mount\n\n return windowSize;\n}\n\nexport default useWindowSize;\n"],"mappings":";;;;;;AAAA,SAASA,QAAQ,EAAEC,eAAe,QAAQ,OAAO;AAOjD,SAASC,aAAaA,CAAA,EAAmB;EACvC;EACA;EACA,IAAAC,SAAA,GAAoCH,QAAQ,CAAiB;MAC3DI,KAAK,EAAEC,SAAS;MAChBC,MAAM,EAAED;IACV,CAAC,CAAC;IAAAE,UAAA,GAAAC,cAAA,CAAAL,SAAA;IAHKM,UAAU,GAAAF,UAAA;IAAEG,aAAa,GAAAH,UAAA;EAKhCN,eAAe,CAAC,YAAM;IACpB;IACA,SAASU,YAAYA,CAAA,EAAG;MACtB;MACAD,aAAa,CAAC;QACZN,KAAK,EAAEQ,MAAM,CAACC,UAAU;QACxBP,MAAM,EAAEM,MAAM,CAACE;MACjB,CAAC,CAAC;IACJ;;IAEA;IACAF,MAAM,CAACG,gBAAgB,CAAC,QAAQ,EAAEJ,YAAY,CAAC;;IAE/C;IACAA,YAAY,CAAC,CAAC;;IAEd;IACA,OAAO;MAAA,OAAMC,MAAM,CAACI,mBAAmB,CAAC,QAAQ,EAAEL,YAAY,CAAC;IAAA;EACjE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;;EAER,OAAOF,UAAU;AACnB;AAEA,eAAeP,aAAa","ignoreList":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,11 @@ export { default as ModalLayer } from './Modal/ModalLayer';
|
|
|
18
18
|
export { default as Overlay, OverlayTrigger } from './Overlay';
|
|
19
19
|
export { default as Portal } from './Modal/Portal';
|
|
20
20
|
export { default as Tooltip } from './Tooltip';
|
|
21
|
+
export { default as useWindowSize, type WindowSizeData } from './hooks/useWindowSize';
|
|
22
|
+
export { default as useToggle, type Toggler, type ToggleHandlers } from './hooks/useToggle';
|
|
23
|
+
export { default as useArrowKeyNavigation, type ArrowKeyNavProps } from './hooks/useArrowKeyNavigation';
|
|
24
|
+
export { default as useIndexOfLastVisibleChild } from './hooks/useIndexOfLastVisibleChild';
|
|
25
|
+
export { default as useIsVisible } from './hooks/useIsVisible';
|
|
21
26
|
|
|
22
27
|
// // // // // // // // // // // // // // // // // // // // // // // // // // //
|
|
23
28
|
// Things that don't have types
|
|
@@ -187,11 +192,6 @@ export const Sticky: any; // from './Sticky';
|
|
|
187
192
|
export const SelectableBox: any; // from './SelectableBox';
|
|
188
193
|
export const breakpoints: any; // from './utils/breakpoints';
|
|
189
194
|
export const Variant: any; // from './utils/constants';
|
|
190
|
-
export const useWindowSize: any; // from './hooks/useWindowSize';
|
|
191
|
-
export const useToggle: any; // from './hooks/useToggle';
|
|
192
|
-
export const useArrowKeyNavigation: any; // from './hooks/useArrowKeyNavigation';
|
|
193
|
-
export const useIndexOfLastVisibleChild: any; // from './hooks/useIndexOfLastVisibleChild';
|
|
194
|
-
export const useIsVisible: any; // from './hooks/useIsVisible';
|
|
195
195
|
export const
|
|
196
196
|
OverflowScrollContext: any,
|
|
197
197
|
OverflowScroll: any,
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,11 @@ export { default as ModalLayer } from './Modal/ModalLayer';
|
|
|
18
18
|
export { default as Overlay, OverlayTrigger } from './Overlay';
|
|
19
19
|
export { default as Portal } from './Modal/Portal';
|
|
20
20
|
export { default as Tooltip } from './Tooltip';
|
|
21
|
+
export { default as useWindowSize } from './hooks/useWindowSize';
|
|
22
|
+
export { default as useToggle } from './hooks/useToggle';
|
|
23
|
+
export { default as useArrowKeyNavigation } from './hooks/useArrowKeyNavigation';
|
|
24
|
+
export { default as useIndexOfLastVisibleChild } from './hooks/useIndexOfLastVisibleChild';
|
|
25
|
+
export { default as useIsVisible } from './hooks/useIsVisible';
|
|
21
26
|
|
|
22
27
|
// // // // // // // // // // // // // // // // // // // // // // // // // // //
|
|
23
28
|
// Things that don't have types
|
|
@@ -159,11 +164,6 @@ export { default as Sticky } from './Sticky';
|
|
|
159
164
|
export { default as SelectableBox } from './SelectableBox';
|
|
160
165
|
export { default as breakpoints } from './utils/breakpoints';
|
|
161
166
|
export { default as Variant } from './utils/constants';
|
|
162
|
-
export { default as useWindowSize } from './hooks/useWindowSize';
|
|
163
|
-
export { default as useToggle } from './hooks/useToggle';
|
|
164
|
-
export { default as useArrowKeyNavigation } from './hooks/useArrowKeyNavigation';
|
|
165
|
-
export { default as useIndexOfLastVisibleChild } from './hooks/useIndexOfLastVisibleChild';
|
|
166
|
-
export { default as useIsVisible } from './hooks/useIsVisible';
|
|
167
167
|
export {
|
|
168
168
|
OverflowScrollContext,
|
|
169
169
|
OverflowScroll,
|
package/dist/light.css
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Do not edit directly, this file was auto-generated.
|
|
3
|
-
* See <
|
|
2
|
+
* Do not edit directly, this file was auto-generated.
|
|
3
|
+
* See <PARAGON_ROOT>/tokens/README.md for more details.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
:root {
|
|
@@ -2365,8 +2365,8 @@
|
|
|
2365
2365
|
}
|
|
2366
2366
|
|
|
2367
2367
|
/**
|
|
2368
|
-
* Do not edit directly, this file was auto-generated.
|
|
2369
|
-
* See <
|
|
2368
|
+
* Do not edit directly, this file was auto-generated.
|
|
2369
|
+
* See <PARAGON_ROOT>/tokens/README.md for more details.
|
|
2370
2370
|
*/
|
|
2371
2371
|
|
|
2372
2372
|
.bg-accent-a {
|