@hitachivantara/uikit-react-core 3.72.1 → 3.74.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/AssetInventory/ListView/ListViewCell/ListViewCell.d.ts +2 -27
- package/dist/AssetInventory/ListView/ListViewRow/ListViewRow.d.ts +2 -27
- package/dist/Banner/Banner.d.ts +3 -2
- package/dist/Banner/Banner.js +2 -2
- package/dist/Banner/Banner.js.map +1 -1
- package/dist/Banner/{BannerWrapper → BannerContent}/ActionContainer/ActionContainer.js +0 -0
- package/dist/Banner/{BannerWrapper → BannerContent}/ActionContainer/ActionContainer.js.map +1 -1
- package/dist/Banner/{BannerWrapper → BannerContent}/ActionContainer/index.js +0 -0
- package/dist/Banner/{BannerWrapper → BannerContent}/ActionContainer/index.js.map +1 -1
- package/dist/Banner/{BannerWrapper → BannerContent}/ActionContainer/styles.js +0 -0
- package/dist/Banner/{BannerWrapper → BannerContent}/ActionContainer/styles.js.map +1 -1
- package/dist/Banner/BannerContent/BannerContent.d.ts +41 -0
- package/dist/Banner/{BannerWrapper/BannerContentWrapper.js → BannerContent/BannerContent.js} +5 -5
- package/dist/Banner/BannerContent/BannerContent.js.map +1 -0
- package/dist/Banner/{BannerWrapper → BannerContent}/MessageContainer/MessageContainer.js +0 -0
- package/dist/Banner/{BannerWrapper → BannerContent}/MessageContainer/MessageContainer.js.map +1 -1
- package/dist/Banner/{BannerWrapper → BannerContent}/MessageContainer/index.js +0 -0
- package/dist/Banner/{BannerWrapper → BannerContent}/MessageContainer/index.js.map +1 -1
- package/dist/Banner/{BannerWrapper → BannerContent}/MessageContainer/styles.js +0 -0
- package/dist/Banner/{BannerWrapper → BannerContent}/MessageContainer/styles.js.map +1 -1
- package/dist/Banner/BannerContent/index.d.ts +2 -0
- package/dist/Banner/{BannerWrapper → BannerContent}/index.js +2 -2
- package/dist/Banner/BannerContent/index.js.map +1 -0
- package/dist/Banner/{BannerWrapper → BannerContent}/styles.js +0 -0
- package/dist/Banner/{BannerWrapper → BannerContent}/styles.js.map +1 -1
- package/dist/Banner/index.d.ts +3 -0
- package/dist/Banner/index.js +2 -2
- package/dist/Banner/index.js.map +1 -1
- package/dist/BaseSwitch/BaseSwitch.d.ts +1 -1
- package/dist/BaseSwitch/BaseSwitch.js +6 -1
- package/dist/BaseSwitch/BaseSwitch.js.map +1 -1
- package/dist/BaseSwitch/styles.js +5 -1
- package/dist/BaseSwitch/styles.js.map +1 -1
- package/dist/ScrollTo/useScrollTo.js +2 -1
- package/dist/ScrollTo/useScrollTo.js.map +1 -1
- package/dist/ScrollTo/utils.js +39 -6
- package/dist/ScrollTo/utils.js.map +1 -1
- package/dist/legacy/AssetInventory/ListView/ListViewCell/ListViewCell.d.ts +2 -27
- package/dist/legacy/AssetInventory/ListView/ListViewRow/ListViewRow.d.ts +2 -27
- package/dist/legacy/Banner/Banner.d.ts +3 -2
- package/dist/legacy/Banner/Banner.js +2 -2
- package/dist/legacy/Banner/Banner.js.map +1 -1
- package/dist/legacy/Banner/{BannerWrapper → BannerContent}/ActionContainer/ActionContainer.js +0 -0
- package/dist/legacy/Banner/{BannerWrapper → BannerContent}/ActionContainer/ActionContainer.js.map +1 -1
- package/dist/legacy/Banner/{BannerWrapper → BannerContent}/ActionContainer/index.js +0 -0
- package/dist/legacy/Banner/{BannerWrapper → BannerContent}/ActionContainer/index.js.map +1 -1
- package/dist/legacy/Banner/{BannerWrapper → BannerContent}/ActionContainer/styles.js +0 -0
- package/dist/legacy/Banner/{BannerWrapper → BannerContent}/ActionContainer/styles.js.map +1 -1
- package/dist/legacy/Banner/BannerContent/BannerContent.d.ts +41 -0
- package/dist/legacy/Banner/{BannerWrapper/BannerContentWrapper.js → BannerContent/BannerContent.js} +5 -5
- package/dist/legacy/Banner/BannerContent/BannerContent.js.map +1 -0
- package/dist/legacy/Banner/{BannerWrapper → BannerContent}/MessageContainer/MessageContainer.js +0 -0
- package/dist/legacy/Banner/{BannerWrapper → BannerContent}/MessageContainer/MessageContainer.js.map +1 -1
- package/dist/legacy/Banner/{BannerWrapper → BannerContent}/MessageContainer/index.js +0 -0
- package/dist/legacy/Banner/{BannerWrapper → BannerContent}/MessageContainer/index.js.map +1 -1
- package/dist/legacy/Banner/{BannerWrapper → BannerContent}/MessageContainer/styles.js +0 -0
- package/dist/legacy/Banner/{BannerWrapper → BannerContent}/MessageContainer/styles.js.map +1 -1
- package/dist/legacy/Banner/BannerContent/index.d.ts +2 -0
- package/dist/legacy/Banner/BannerContent/index.js +2 -0
- package/dist/legacy/Banner/BannerContent/index.js.map +1 -0
- package/dist/legacy/Banner/{BannerWrapper → BannerContent}/styles.js +0 -0
- package/dist/legacy/Banner/{BannerWrapper → BannerContent}/styles.js.map +1 -1
- package/dist/legacy/Banner/index.d.ts +3 -0
- package/dist/legacy/Banner/index.js +1 -1
- package/dist/legacy/Banner/index.js.map +1 -1
- package/dist/legacy/BaseSwitch/BaseSwitch.d.ts +1 -1
- package/dist/legacy/BaseSwitch/BaseSwitch.js +6 -1
- package/dist/legacy/BaseSwitch/BaseSwitch.js.map +1 -1
- package/dist/legacy/BaseSwitch/styles.js +5 -1
- package/dist/legacy/BaseSwitch/styles.js.map +1 -1
- package/dist/legacy/ScrollTo/useScrollTo.js +2 -1
- package/dist/legacy/ScrollTo/useScrollTo.js.map +1 -1
- package/dist/legacy/ScrollTo/utils.js +35 -5
- package/dist/legacy/ScrollTo/utils.js.map +1 -1
- package/dist/modern/AssetInventory/ListView/ListViewCell/ListViewCell.d.ts +2 -27
- package/dist/modern/AssetInventory/ListView/ListViewRow/ListViewRow.d.ts +2 -27
- package/dist/modern/Banner/Banner.d.ts +3 -2
- package/dist/modern/Banner/Banner.js +2 -2
- package/dist/modern/Banner/Banner.js.map +1 -1
- package/dist/modern/Banner/{BannerWrapper → BannerContent}/ActionContainer/ActionContainer.js +0 -0
- package/dist/modern/Banner/{BannerWrapper → BannerContent}/ActionContainer/ActionContainer.js.map +1 -1
- package/dist/modern/Banner/{BannerWrapper → BannerContent}/ActionContainer/index.js +0 -0
- package/dist/modern/Banner/{BannerWrapper → BannerContent}/ActionContainer/index.js.map +1 -1
- package/dist/modern/Banner/{BannerWrapper → BannerContent}/ActionContainer/styles.js +0 -0
- package/dist/modern/Banner/{BannerWrapper → BannerContent}/ActionContainer/styles.js.map +1 -1
- package/dist/modern/Banner/BannerContent/BannerContent.d.ts +41 -0
- package/dist/modern/Banner/{BannerWrapper/BannerContentWrapper.js → BannerContent/BannerContent.js} +5 -5
- package/dist/modern/Banner/BannerContent/BannerContent.js.map +1 -0
- package/dist/modern/Banner/{BannerWrapper → BannerContent}/MessageContainer/MessageContainer.js +0 -0
- package/dist/modern/Banner/{BannerWrapper → BannerContent}/MessageContainer/MessageContainer.js.map +1 -1
- package/dist/modern/Banner/{BannerWrapper → BannerContent}/MessageContainer/index.js +0 -0
- package/dist/modern/Banner/{BannerWrapper → BannerContent}/MessageContainer/index.js.map +1 -1
- package/dist/modern/Banner/{BannerWrapper → BannerContent}/MessageContainer/styles.js +0 -0
- package/dist/modern/Banner/{BannerWrapper → BannerContent}/MessageContainer/styles.js.map +1 -1
- package/dist/modern/Banner/BannerContent/index.d.ts +2 -0
- package/dist/modern/Banner/BannerContent/index.js +2 -0
- package/dist/modern/Banner/BannerContent/index.js.map +1 -0
- package/dist/modern/Banner/{BannerWrapper → BannerContent}/styles.js +0 -0
- package/dist/modern/Banner/{BannerWrapper → BannerContent}/styles.js.map +1 -1
- package/dist/modern/Banner/index.d.ts +3 -0
- package/dist/modern/Banner/index.js +1 -1
- package/dist/modern/Banner/index.js.map +1 -1
- package/dist/modern/BaseSwitch/BaseSwitch.d.ts +1 -1
- package/dist/modern/BaseSwitch/BaseSwitch.js +6 -1
- package/dist/modern/BaseSwitch/BaseSwitch.js.map +1 -1
- package/dist/modern/BaseSwitch/styles.js +5 -1
- package/dist/modern/BaseSwitch/styles.js.map +1 -1
- package/dist/modern/ScrollTo/useScrollTo.js +2 -2
- package/dist/modern/ScrollTo/useScrollTo.js.map +1 -1
- package/dist/modern/ScrollTo/utils.js +32 -6
- package/dist/modern/ScrollTo/utils.js.map +1 -1
- package/package.json +2 -2
- package/dist/Banner/BannerWrapper/BannerContentWrapper.js.map +0 -1
- package/dist/Banner/BannerWrapper/index.js.map +0 -1
- package/dist/legacy/Banner/BannerWrapper/BannerContentWrapper.js.map +0 -1
- package/dist/legacy/Banner/BannerWrapper/index.js +0 -2
- package/dist/legacy/Banner/BannerWrapper/index.js.map +0 -1
- package/dist/modern/Banner/BannerWrapper/BannerContentWrapper.js.map +0 -1
- package/dist/modern/Banner/BannerWrapper/index.js +0 -2
- package/dist/modern/Banner/BannerWrapper/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollTo.js","names":["useScrollTo","selectedIndexProp","scrollElementId","href","offset","options","onChange","RETRY_MAX","useState","selectedIndex","setSelectedIndex","scrollEle","useRef","requestedAnimationFrame","lastContainerScrollTop","selectedIndexRef","useEffect","current","document","getElementById","window","verticalScrollOffset","checkScroll","useCallback","event","requestAnimationFrame","firstVisibleElementIndex","findFirstVisibleElement","newSelectedIndex","length","isScrolledToTheBottom","containerScrollTop","getScrollTop","isScrollingDown","addEventListener","removeEventListener","cancelAnimationFrame","checkRenderedInterval","hashValue","location","hash","split","option","find","o","value","retry","setInterval","ele","scrollElement","clearInterval","setScrollTo","id","index","wrappedOnChange","history","pushState"],"sources":["../../src/ScrollTo/useScrollTo.js"],"sourcesContent":["import { useEffect, useRef, useState, useCallback } from \"react\";\nimport {\n verticalScrollOffset,\n findFirstVisibleElement,\n isScrolledToTheBottom,\n getScrollTop,\n scrollElement,\n} from \"./utils\";\n\nconst useScrollTo = (\n selectedIndexProp = 0,\n scrollElementId,\n href,\n offset = 0,\n options,\n onChange\n) => {\n const RETRY_MAX = 5;\n const [selectedIndex, setSelectedIndex] = useState(selectedIndexProp);\n\n const scrollEle = useRef();\n const requestedAnimationFrame = useRef(0);\n const lastContainerScrollTop = useRef();\n\n // ref to use a often-changing value in useCallback, as recommended in\n // https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback\n const selectedIndexRef = useRef(selectedIndex);\n useEffect(() => {\n selectedIndexRef.current = selectedIndex;\n }, [selectedIndex]);\n\n useEffect(() => {\n scrollEle.current = (scrollElementId && document.getElementById(scrollElementId)) || window;\n lastContainerScrollTop.current = verticalScrollOffset(scrollEle.current);\n }, [scrollElementId]);\n\n const checkScroll = useCallback(\n (event) => {\n if (requestedAnimationFrame.current === 0 && window?.requestAnimationFrame) {\n requestedAnimationFrame.current = window.requestAnimationFrame(() => {\n requestedAnimationFrame.current = 0;\n\n const firstVisibleElementIndex = findFirstVisibleElement(\n scrollEle.current,\n options,\n offset\n );\n\n let newSelectedIndex = firstVisibleElementIndex;\n\n // select the first element when all elements are bellow the container's top\n if (firstVisibleElementIndex < 0) {\n newSelectedIndex = 0;\n }\n\n // if the user has reached the bottom of the container, select the first nav item still visible\n // (usually this selects the last nav item, when it can't reach the top the container)\n // in theory only needed when scrolling down, but no... because of the Safari bouncing behaviour\n if (newSelectedIndex < options.length - 1 && isScrolledToTheBottom(scrollEle.current)) {\n newSelectedIndex += 1;\n }\n\n const containerScrollTop = getScrollTop(scrollEle.current);\n const isScrollingDown = containerScrollTop > lastContainerScrollTop.current;\n lastContainerScrollTop.current = containerScrollTop;\n\n // only update the selected item if the scroll direction is moving away from it\n if (isScrollingDown) {\n if (newSelectedIndex < selectedIndexRef.current) {\n newSelectedIndex = selectedIndexRef.current;\n }\n } else if (newSelectedIndex > selectedIndexRef.current) {\n newSelectedIndex = selectedIndexRef.current;\n }\n\n setSelectedIndex(newSelectedIndex);\n onChange?.(event, newSelectedIndex);\n });\n }\n },\n [offset, options, onChange]\n );\n\n // registers and unregisters the scroll listener\n useEffect(() => {\n if (scrollEle.current) {\n scrollEle.current.addEventListener(\"scroll\", checkScroll, false);\n }\n\n return () => {\n if (scrollEle.current) {\n scrollEle.current.removeEventListener(\"scroll\", checkScroll);\n }\n\n if (requestedAnimationFrame.current !== 0) {\n window.cancelAnimationFrame(requestedAnimationFrame.current);\n requestedAnimationFrame.current = 0;\n }\n };\n }, [checkScroll]);\n\n // waits for the elements to be rendered and scrolls to the one referenced\n // in the URL hash, if any\n useEffect(() => {\n let checkRenderedInterval;\n\n if (href) {\n const hashValue = document.location.hash.split(\"#\")[1] || \"\";\n\n const option = options.find((o) => o.value === hashValue);\n\n if (option) {\n let retry = 0;\n checkRenderedInterval = setInterval(() => {\n const ele = document.getElementById(option.value);\n\n if (ele) {\n scrollElement(ele, scrollEle.current, option.offset || offset);\n clearInterval(checkRenderedInterval);\n } else {\n retry += 1;\n if (retry === RETRY_MAX) {\n clearInterval(checkRenderedInterval);\n }\n }\n }, 1000);\n }\n }\n\n return () => {\n clearInterval(checkRenderedInterval);\n };\n\n // we really want to run this just in the first load\n // in fact this doesn't even belong here, the logic should be external\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const setScrollTo = (event, id, index, wrappedOnChange) => {\n const option = options.find((o) => o.value === id);\n\n if (option) {\n const ele = document.getElementById(id);\n if (ele) {\n scrollElement(ele, scrollEle.current, option.offset || offset);\n }\n\n if (href) {\n window.history.pushState({}, \"\", `#${options[index].value}`);\n }\n\n setSelectedIndex(index);\n wrappedOnChange?.(index);\n\n // Safari scrolls immediately (no smooth scroll support),\n // so this ref value must be updated asap\n selectedIndexRef.current = index;\n }\n };\n\n return [selectedIndex, setScrollTo];\n};\n\nexport default useScrollTo;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAQA,IAAMA,WAAW,GAAG,SAAdA,WAAc,GAOf;EAAA,IANHC,iBAMG,uEANiB,CAMjB;EAAA,IALHC,eAKG;EAAA,IAJHC,IAIG;EAAA,IAHHC,MAGG,uEAHM,CAGN;EAAA,IAFHC,OAEG;EAAA,IADHC,QACG;EACH,IAAMC,SAAS,GAAG,CAAlB;;EACA,gBAA0C,IAAAC,eAAA,EAASP,iBA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AAR,CAAa,UAACC,CAAD;MAAA,OAAOA,CAAC,CAACC,KAAF,KAAYO,EAAnB;IAAA,CAAb,CAAf;;IAEA,IAAIV,MAAJ,EAAY;MACV,IAAMM,GAAG,GAAG9B,QAAQ,CAACC,cAAT,CAAwBiC,EAAxB,CAAZ;;MACA,IAAIJ,GAAJ,EAAS;QACP,IAAAC,oBAAA,EAAcD,GAAd,EAAmBrC,SAAS,CAACM,OAA7B,EAAsCyB,MAAM,CAACtC,MAAP,IAAiBA,MAAvD;MACD;;MAED,IAAID,IAAJ,EAAU;QACRiB,MAAM,CAACmC,OAAP,CAAeC,SAAf,CAAyB,EAAzB,EAA6B,EAA7B,aAAqCnD,OAAO,CAACgD,KAAD,CAAP,CAAeR,KAApD;MACD;;MAEDnC,gBAAgB,CAAC2C,KAAD,CAAhB;MACAC,eAAe,SAAf,IAAAA,eAAe,WAAf,YAAAA,eAAe,CAAGD,KAAH,CAAf,CAXU,CAaV;MACA;;MACAtC,gBAAgB,CAACE,OAAjB,GAA2BoC,KAA3B;IACD;EACF,CApBD;;EAsBA,OAAO,CAAC5C,aAAD,EAAgB0C,WAAhB,CAAP;AACD,CAxJD;;eA0JenD,W"}
|
|
1
|
+
{"version":3,"file":"useScrollTo.js","names":["useScrollTo","selectedIndexProp","scrollElementId","href","offset","options","onChange","direction","RETRY_MAX","useState","selectedIndex","setSelectedIndex","scrollEle","useRef","requestedAnimationFrame","lastContainerScrollTop","selectedIndexRef","useEffect","current","document","getElementById","window","verticalScrollOffset","checkScroll","useCallback","event","requestAnimationFrame","firstVisibleElementIndex","findFirstVisibleElement","newSelectedIndex","length","isScrolledToTheBottom","containerScrollTop","getScrollTop","isScrollingDown","addEventListener","removeEventListener","cancelAnimationFrame","checkRenderedInterval","hashValue","location","hash","split","option","find","o","value","retry","setInterval","ele","scrollElement","clearInterval","setScrollTo","id","index","wrappedOnChange","history","pushState"],"sources":["../../src/ScrollTo/useScrollTo.js"],"sourcesContent":["import { useEffect, useRef, useState, useCallback } from \"react\";\nimport {\n verticalScrollOffset,\n findFirstVisibleElement,\n isScrolledToTheBottom,\n getScrollTop,\n scrollElement,\n} from \"./utils\";\n\nconst useScrollTo = (\n selectedIndexProp = 0,\n scrollElementId,\n href,\n offset = 0,\n options,\n onChange,\n direction = \"column\"\n) => {\n const RETRY_MAX = 5;\n const [selectedIndex, setSelectedIndex] = useState(selectedIndexProp);\n\n const scrollEle = useRef();\n const requestedAnimationFrame = useRef(0);\n const lastContainerScrollTop = useRef();\n\n // ref to use a often-changing value in useCallback, as recommended in\n // https://reactjs.org/docs/hooks-faq.html#how-to-read-an-often-changing-value-from-usecallback\n const selectedIndexRef = useRef(selectedIndex);\n useEffect(() => {\n selectedIndexRef.current = selectedIndex;\n }, [selectedIndex]);\n\n useEffect(() => {\n scrollEle.current = (scrollElementId && document.getElementById(scrollElementId)) || window;\n lastContainerScrollTop.current = verticalScrollOffset(scrollEle.current);\n }, [scrollElementId]);\n\n const checkScroll = useCallback(\n (event) => {\n if (requestedAnimationFrame.current === 0 && window?.requestAnimationFrame) {\n requestedAnimationFrame.current = window.requestAnimationFrame(() => {\n requestedAnimationFrame.current = 0;\n\n const firstVisibleElementIndex = findFirstVisibleElement(\n scrollEle.current,\n options,\n offset\n );\n\n let newSelectedIndex = firstVisibleElementIndex;\n\n // select the first element when all elements are bellow the container's top\n if (firstVisibleElementIndex < 0) {\n newSelectedIndex = 0;\n }\n\n // if the user has reached the bottom of the container, select the first nav item still visible\n // (usually this selects the last nav item, when it can't reach the top the container)\n // in theory only needed when scrolling down, but no... because of the Safari bouncing behaviour\n if (newSelectedIndex < options.length - 1 && isScrolledToTheBottom(scrollEle.current)) {\n newSelectedIndex += 1;\n }\n\n const containerScrollTop = getScrollTop(scrollEle.current);\n const isScrollingDown = containerScrollTop > lastContainerScrollTop.current;\n lastContainerScrollTop.current = containerScrollTop;\n\n // only update the selected item if the scroll direction is moving away from it\n if (isScrollingDown) {\n if (newSelectedIndex < selectedIndexRef.current) {\n newSelectedIndex = selectedIndexRef.current;\n }\n } else if (newSelectedIndex > selectedIndexRef.current) {\n newSelectedIndex = selectedIndexRef.current;\n }\n\n setSelectedIndex(newSelectedIndex);\n onChange?.(event, newSelectedIndex);\n });\n }\n },\n [offset, options, onChange]\n );\n\n // registers and unregisters the scroll listener\n useEffect(() => {\n if (scrollEle.current) {\n scrollEle.current.addEventListener(\"scroll\", checkScroll, false);\n }\n\n return () => {\n if (scrollEle.current) {\n scrollEle.current.removeEventListener(\"scroll\", checkScroll);\n }\n\n if (requestedAnimationFrame.current !== 0) {\n window.cancelAnimationFrame(requestedAnimationFrame.current);\n requestedAnimationFrame.current = 0;\n }\n };\n }, [checkScroll]);\n\n // waits for the elements to be rendered and scrolls to the one referenced\n // in the URL hash, if any\n useEffect(() => {\n let checkRenderedInterval;\n\n if (href) {\n const hashValue = document.location.hash.split(\"#\")[1] || \"\";\n\n const option = options.find((o) => o.value === hashValue);\n\n if (option) {\n let retry = 0;\n checkRenderedInterval = setInterval(() => {\n const ele = document.getElementById(option.value);\n\n if (ele) {\n scrollElement(ele, scrollEle.current, option.offset || offset);\n clearInterval(checkRenderedInterval);\n } else {\n retry += 1;\n if (retry === RETRY_MAX) {\n clearInterval(checkRenderedInterval);\n }\n }\n }, 1000);\n }\n }\n\n return () => {\n clearInterval(checkRenderedInterval);\n };\n\n // we really want to run this just in the first load\n // in fact this doesn't even belong here, the logic should be external\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const setScrollTo = (event, id, index, wrappedOnChange) => {\n const option = options.find((o) => o.value === id);\n\n if (option) {\n const ele = document.getElementById(id);\n if (ele) {\n scrollElement(ele, scrollEle.current, option.offset || offset, direction);\n }\n\n if (href) {\n window.history.pushState({}, \"\", `#${options[index].value}`);\n }\n\n setSelectedIndex(index);\n wrappedOnChange?.(index);\n\n // Safari scrolls immediately (no smooth scroll support),\n // so this ref value must be updated asap\n selectedIndexRef.current = index;\n }\n };\n\n return [selectedIndex, setScrollTo];\n};\n\nex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.verticalScrollOffset = exports.scrollElement = exports.isScrolledToTheBottom = exports.getScrollTop = exports.findFirstVisibleElement = void 0;
|
|
6
|
+
exports.verticalScrollOffset = exports.scrollElement = exports.isScrolledToTheBottom = exports.horizontalScrollOffset = exports.getScrollTop = exports.findFirstVisibleElement = void 0;
|
|
7
7
|
|
|
8
8
|
var getScrollTop = function getScrollTop() {
|
|
9
9
|
var c = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
|
|
@@ -35,13 +35,46 @@ var verticalScrollOffset = function verticalScrollOffset(t) {
|
|
|
35
35
|
|
|
36
36
|
exports.verticalScrollOffset = verticalScrollOffset;
|
|
37
37
|
|
|
38
|
+
var horizontalScrollOffset = function horizontalScrollOffset(t) {
|
|
39
|
+
var c = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window;
|
|
40
|
+
|
|
41
|
+
if (c === window) {
|
|
42
|
+
var _t$getBoundingClientR2;
|
|
43
|
+
|
|
44
|
+
return ((t === null || t === void 0 ? void 0 : (_t$getBoundingClientR2 = t.getBoundingClientRect) === null || _t$getBoundingClientR2 === void 0 ? void 0 : _t$getBoundingClientR2.call(t).left) || 0) + (window.scrollX || window.pageXOffset);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (getComputedStyle(c).position !== "static") {
|
|
48
|
+
return t.offsetLeft;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return t.offsetLeft - c.offsetLeft;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
exports.horizontalScrollOffset = horizontalScrollOffset;
|
|
55
|
+
|
|
38
56
|
var scrollElement = function scrollElement(element, container) {
|
|
39
57
|
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
58
|
+
var direction = arguments.length > 3 ? arguments[3] : undefined;
|
|
59
|
+
|
|
60
|
+
if (direction === "row") {
|
|
61
|
+
var _container$scrollTo;
|
|
62
|
+
|
|
63
|
+
var elemLeft = horizontalScrollOffset(element, container);
|
|
64
|
+
container === null || container === void 0 ? void 0 : (_container$scrollTo = container.scrollTo) === null || _container$scrollTo === void 0 ? void 0 : _container$scrollTo.call(container, {
|
|
65
|
+
left: elemLeft - offset,
|
|
66
|
+
behavior: "smooth"
|
|
67
|
+
});
|
|
68
|
+
} else {
|
|
69
|
+
var _container$scrollTo2;
|
|
70
|
+
|
|
71
|
+
var elemTop = verticalScrollOffset(element, container);
|
|
72
|
+
container === null || container === void 0 ? void 0 : (_container$scrollTo2 = container.scrollTo) === null || _container$scrollTo2 === void 0 ? void 0 : _container$scrollTo2.call(container, {
|
|
73
|
+
top: elemTop - offset,
|
|
74
|
+
behavior: "smooth"
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
45
78
|
element.focus({
|
|
46
79
|
preventScroll: true
|
|
47
80
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["getScrollTop","c","window","scrollY","pageYOffset","document","documentElement","scrollTop","body","verticalScrollOffset","t","getBoundingClientRect","top","getComputedStyle","position","offsetTop","scrollElement","element","container","offset","
|
|
1
|
+
{"version":3,"file":"utils.js","names":["getScrollTop","c","window","scrollY","pageYOffset","document","documentElement","scrollTop","body","verticalScrollOffset","t","getBoundingClientRect","top","getComputedStyle","position","offsetTop","horizontalScrollOffset","left","scrollX","pageXOffset","offsetLeft","scrollElement","element","container","offset","direction","elemLeft","scrollTo","behavior","elemTop","focus","preventScroll","isScrolledToTheBottom","containerScrollTop","scrollHeight","innerHeight","offsetHeight","findFirstVisibleElement","options","boundsTop","i","length","ele","getElementById","value"],"sources":["../../src/ScrollTo/utils.js"],"sourcesContent":["export const getScrollTop = (c = window) => {\n if (c === window) {\n return (\n window.scrollY ||\n window.pageYOffset ||\n (document.documentElement && document.documentElement.scrollTop) ||\n document.body.scrollTop\n );\n }\n\n return c.scrollTop;\n};\n\nexport const verticalScrollOffset = (t, c = window) => {\n if (c === window) {\n return (t?.getBoundingClientRect?.().top || 0) + (window.scrollY || window.pageYOffset);\n }\n if (getComputedStyle(c).position !== \"static\") {\n return t.offsetTop;\n }\n\n return t.offsetTop - c.offsetTop;\n};\n\nexport const horizontalScrollOffset = (t, c = window) => {\n if (c === window) {\n return (t?.getBoundingClientRect?.().left || 0) + (window.scrollX || window.pageXOffset);\n }\n if (getComputedStyle(c).position !== \"static\") {\n return t.offsetLeft;\n }\n\n return t.offsetLeft - c.offsetLeft;\n};\n\nexport const scrollElement = (element, container, offset = 0, direction) => {\n if (direction === \"row\") {\n const elemLeft = horizontalScrollOffset(element, container);\n container?.scrollTo?.({\n left: elemLeft - offset,\n behavior: \"smooth\",\n });\n } else {\n const elemTop = verticalScrollOffset(element, container);\n container?.scrollTo?.({\n top: elemTop - offset,\n behavior: \"smooth\",\n });\n }\n element.focus({ preventScroll: true });\n};\n\nexport const isScrolledToTheBottom = (container) => {\n const containerScrollTop = getScrollTop(container);\n\n if (container === window) {\n // accounting for cases where html/body are set to height:100%\n const scrollHeight =\n (document.documentElement && document.documentElement.scrollHeight) ||\n document.body.scrollHeight;\n\n return containerScrollTop + window.innerHeight >= scrollHeight;\n }\n\n return containerScrollTop + container.offsetHeight >= container.scrollHeight;\n};\n\nexport const findFirstVisibleElement = (container, options, offset) => {\n const boundsTop = verticalScrollOffset(container);\n\n let i = 0;\n // find index of first element whose top is still visible inside the container\n for (; i < options.length; i += 1) {\n const ele = document.getElementById(options[i].value);\n\n if (ele) {\n const elemTop = verticalScrollOffset(ele) - (options[i].offset || offset);\n\n if (elemTop > boundsTop) {\n break;\n }\n }\n }\n\n // return the previous index, the element that last scrolled past the top\n return i - 1;\n};\n"],"mappings":";;;;;;;AAAO,IAAMA,YAAY,GAAG,SAAfA,YAAe,GAAgB;EAAA,IAAfC,CAAe,uEAAXC,MAAW;;EAC1C,IAAID,CAAC,KAAKC,MAAV,EAAkB;IAChB,OACEA,MAAM,CAACC,OAAP,IACAD,MAA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B,GAAG,SAA1BA,uBAA0B,CAACd,SAAD,EAAYe,OAAZ,EAAqBd,MAArB,EAAgC;EACrE,IAAMe,SAAS,GAAG9B,oBAAoB,CAACc,SAAD,CAAtC;EAEA,IAAIiB,CAAC,GAAG,CAAR,CAHqE,CAIrE;;EACA,OAAOA,CAAC,GAAGF,OAAO,CAACG,MAAnB,EAA2BD,CAAC,IAAI,CAAhC,EAAmC;IACjC,IAAME,GAAG,GAAGrC,QAAQ,CAACsC,cAAT,CAAwBL,OAAO,CAACE,CAAD,CAAP,CAAWI,KAAnC,CAAZ;;IAEA,IAAIF,GAAJ,EAAS;MACP,IAAMb,OAAO,GAAGpB,oBAAoB,CAACiC,GAAD,CAApB,IAA6BJ,OAAO,CAACE,CAAD,CAAP,CAAWhB,MAAX,IAAqBA,MAAlD,CAAhB;;MAEA,IAAIK,OAAO,GAAGU,SAAd,EAAyB;QACvB;MACD;IACF;EACF,CAfoE,CAiBrE;;;EACA,OAAOC,CAAC,GAAG,CAAX;AACD,CAnBM"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { StandardProps } from "@material-ui/core";
|
|
3
|
+
import { HvAtmosphereColorKeys, HvSemanticColorKeys } from "../../..";
|
|
3
4
|
|
|
4
5
|
export type HvListViewCellClassKey = "root" | "semanticBar";
|
|
5
6
|
|
|
@@ -17,33 +18,7 @@ export interface HvListViewCellProps
|
|
|
17
18
|
/**
|
|
18
19
|
* The border color of the cell. Must be one of palette semantic colors.
|
|
19
20
|
*/
|
|
20
|
-
semantic?:
|
|
21
|
-
| "sema0"
|
|
22
|
-
| "sema1"
|
|
23
|
-
| "sema2"
|
|
24
|
-
| "sema3"
|
|
25
|
-
| "sema4"
|
|
26
|
-
| "sema5"
|
|
27
|
-
| "sema6"
|
|
28
|
-
| "sema7"
|
|
29
|
-
| "sema8"
|
|
30
|
-
| "sema9"
|
|
31
|
-
| "sema10"
|
|
32
|
-
| "sema11"
|
|
33
|
-
| "sema12"
|
|
34
|
-
| "sema13"
|
|
35
|
-
| "sema14"
|
|
36
|
-
| "sema15"
|
|
37
|
-
| "sema16"
|
|
38
|
-
| "sema17"
|
|
39
|
-
| "sema18"
|
|
40
|
-
| "sema19"
|
|
41
|
-
| "atmo1"
|
|
42
|
-
| "atmo2"
|
|
43
|
-
| "atmo3"
|
|
44
|
-
| "atmo4"
|
|
45
|
-
| "atmo5"
|
|
46
|
-
| "atmo6";
|
|
21
|
+
semantic?: "sema0" | HvSemanticColorKeys | HvAtmosphereColorKeys;
|
|
47
22
|
}
|
|
48
23
|
|
|
49
24
|
export default function HvListViewCell(props: HvListViewCellProps): JSX.Element | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { StandardProps } from "@material-ui/core";
|
|
3
3
|
import { ListViewConfiguration } from "..";
|
|
4
|
-
import { HvCheckBoxProps } from "../../..";
|
|
4
|
+
import { HvAtmosphereColorKeys, HvCheckBoxProps, HvSemanticColorKeys } from "../../..";
|
|
5
5
|
|
|
6
6
|
export type HvListViewRowClassKey = "root";
|
|
7
7
|
|
|
@@ -29,32 +29,7 @@ export interface HvListViewRowProps
|
|
|
29
29
|
/**
|
|
30
30
|
* The border to the right of the checkbox
|
|
31
31
|
*/
|
|
32
|
-
semantic?:
|
|
33
|
-
| "sema1"
|
|
34
|
-
| "sema2"
|
|
35
|
-
| "sema3"
|
|
36
|
-
| "sema4"
|
|
37
|
-
| "sema5"
|
|
38
|
-
| "sema6"
|
|
39
|
-
| "sema7"
|
|
40
|
-
| "sema8"
|
|
41
|
-
| "sema9"
|
|
42
|
-
| "sema10"
|
|
43
|
-
| "sema11"
|
|
44
|
-
| "sema12"
|
|
45
|
-
| "sema13"
|
|
46
|
-
| "sema14"
|
|
47
|
-
| "sema15"
|
|
48
|
-
| "sema16"
|
|
49
|
-
| "sema17"
|
|
50
|
-
| "sema18"
|
|
51
|
-
| "sema19"
|
|
52
|
-
| "atmo1"
|
|
53
|
-
| "atmo2"
|
|
54
|
-
| "atmo3"
|
|
55
|
-
| "atmo4"
|
|
56
|
-
| "atmo5"
|
|
57
|
-
| "atmo6";
|
|
32
|
+
semantic?: HvSemanticColorKeys | HvAtmosphereColorKeys;
|
|
58
33
|
}
|
|
59
34
|
|
|
60
35
|
export default function HvListViewRow(props: HvListViewRowProps): JSX.Element | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { StandardProps, SnackbarProps
|
|
2
|
+
import { StandardProps, SnackbarProps } from "@material-ui/core";
|
|
3
3
|
import { HvActionsGenericCommonProps } from "../ActionsGeneric";
|
|
4
|
+
import { HvBannerContentProps } from "./BannerContent";
|
|
4
5
|
|
|
5
6
|
export type TransitionDirectionProp = "up" | "down" | "left" | "right";
|
|
6
7
|
|
|
@@ -55,7 +56,7 @@ export interface HvBannerProps
|
|
|
55
56
|
/**
|
|
56
57
|
* Props to pass down to the Banner Wrapper.
|
|
57
58
|
*/
|
|
58
|
-
bannerContentProps?:
|
|
59
|
+
bannerContentProps?: Partial<HvBannerContentProps>;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
export default function HvBanner(props: HvBannerProps): JSX.Element | null;
|
|
@@ -6,7 +6,7 @@ import PropTypes, { oneOfType } from "prop-types";
|
|
|
6
6
|
import { Slide, Snackbar, withStyles } from "@material-ui/core";
|
|
7
7
|
import capitalize from "lodash/capitalize";
|
|
8
8
|
import { setId } from "../utils";
|
|
9
|
-
import
|
|
9
|
+
import HvBannerContent from "./BannerContent";
|
|
10
10
|
import styles from "./styles";
|
|
11
11
|
/**
|
|
12
12
|
* A Banner displays an important and succinct message. It can also provide actions for the user to address, or dismiss.
|
|
@@ -70,7 +70,7 @@ var HvBanner = function HvBanner(props) {
|
|
|
70
70
|
TransitionComponent: SlideTransition,
|
|
71
71
|
open: open,
|
|
72
72
|
transitionDuration: transitionDuration
|
|
73
|
-
}, others), /*#__PURE__*/React.createElement(
|
|
73
|
+
}, others), /*#__PURE__*/React.createElement(HvBannerContent, _extends({
|
|
74
74
|
id: setId(id, "content"),
|
|
75
75
|
content: label,
|
|
76
76
|
variant: variant,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","names":["React","useCallback","PropTypes","oneOfType","Slide","Snackbar","withStyles","capitalize","setId","HvBannerContentWrapper","styles","HvBanner","props","id","classes","className","open","onClose","anchorOrigin","variant","transitionDuration","transitionDirection","showIcon","customIcon","actions","actionsCallback","actionsPosition","label","offset","bannerContentProps","others","anchorOriginOffset","anchorOriginTop","top","anchorOriginBottom","bottom","anchorOriginBanner","horizontal","vertical","SlideTransition","properties","root","rootClosed","anchorOriginTopCenter","anchorOriginBottomCenter","propTypes","string","shape","isRequired","bool","func","node","oneOf","arrayOf","icon","disabled","number","instanceOf","Object","name"],"sources":["../../../src/Banner/Banner.js"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport PropTypes, { oneOfType } from \"prop-types\";\nimport { Slide, Snackbar, withStyles } from \"@material-ui/core\";\nimport capitalize from \"lodash/capitalize\";\nimport { setId } from \"../utils\";\nimport HvBannerContentWrapper from \"./BannerWrapper\";\nimport styles from \"./styles\";\n\n/**\n * A Banner displays an important and succinct message. It can also provide actions for the user to address, or dismiss.\n * It requires a user action, for it to be dismissed. Banners should appear at the top of the screen, below a top app bar.\n */\nconst HvBanner = (props) => {\n const {\n id,\n classes,\n className,\n open,\n onClose,\n anchorOrigin = \"top\",\n variant = \"default\",\n transitionDuration = 300,\n transitionDirection = \"down\",\n showIcon = false,\n customIcon,\n actions,\n actionsCallback,\n actionsPosition = \"auto\",\n label,\n offset = 60,\n bannerContentProps,\n ...others\n } = props;\n\n const anchorOriginOffset = {\n anchorOriginTop: {\n top: `${offset || 0}px`,\n },\n anchorOriginBottom: {\n bottom: `${offset || 0}px`,\n },\n };\n\n const anchorOriginBanner = { horizontal: \"center\", vertical: anchorOrigin };\n\n const SlideTransition = useCallback(\n (properties) => <Slide {...properties} direction={transitionDirection} />,\n [transitionDirection]\n );\n\n return (\n <Snackbar\n style={anchorOriginOffset[`anchorOrigin${capitalize(anchorOrigin)}`]}\n className={className}\n id={id}\n classes={{\n root: open ? classes.root : classes.rootClosed,\n anchorOriginTopCenter: classes.anchorOriginTopCenter,\n anchorOriginBottomCenter: classes.anchorOriginBottomCenter,\n }}\n anchorOrigin={anchorOriginBanner}\n TransitionComponent={SlideTransition}\n open={open}\n transitionDuration={transitionDuration}\n {...others}\n >\n <HvBannerContentWrapper\n id={setId(id, \"content\")}\n content={label}\n variant={variant}\n customIcon={customIcon}\n showIcon={showIcon}\n actions={actions}\n actionsCallback={actionsCallback}\n actionsPosition={actionsPosition}\n onClose={onClose}\n {...bannerContentProps}\n />\n </Snackbar>\n );\n};\n\nHvBanner.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * Id to be applied to the root node.\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the component root class when the component is closed.\n */\n rootClosed: PropTypes.string,\n /**\n * Styles applied to the component when define as top.\n */\n anchorOriginTopCenter: PropTypes.string,\n /**\n * Styles applied to the component when define as bottom.\n */\n anchorOriginBottomCenter: PropTypes.string,\n }).isRequired,\n /**\n * If true, Snackbar is open.\n */\n open: PropTypes.bool.isRequired,\n /**\n * Callback fired when the component requests to be closed. Typically onClose is used to set state in the parent component, which is used to control the Snackbar open prop. The reason parameter can optionally be used to control the response to onClose, for example ignoring clickaway.\n */\n onClose: PropTypes.func,\n /**\n * The message to display.\n */\n label: PropTypes.node,\n /**\n * The anchor of the Snackbar.\n */\n anchorOrigin: PropTypes.oneOf([\"top\", \"bottom\"]),\n /**\n * Variant of the snackbar.\n */\n variant: PropTypes.oneOf([\"success\", \"warning\", \"error\", \"info\", \"default\"]),\n /**\n * Custom icon to replace the variant default.\n */\n customIcon: PropTypes.node,\n /**\n * Controls if the associated icon to the variant should be shown.\n */\n showIcon: PropTypes.bool,\n /**\n * Actions to display on the right side.\n */\n actions: oneOfType([\n PropTypes.node,\n PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n icon: PropTypes.func,\n disabled: PropTypes.bool,\n })\n ),\n ]),\n /**\n * The callback function ran when an action is triggered, receiving `action` as param\n */\n actionsCallback: PropTypes.func,\n /**\n * The position property of the header.\n */\n actionsPosition: PropTypes.PropTypes.oneOf([\"auto\", \"inline\", \"bottom-right\"]),\n /**\n * How much the transition animation last in milliseconds, if 0 no animation is played.\n */\n transitionDuration: PropTypes.number,\n /**\n * Direction of slide transition.\n */\n transitionDirection: PropTypes.oneOf([\"up\", \"down\", \"left\", \"right\"]),\n /**\n * Offset from top/bottom of the page, in px. Defaults to 60px.\n */\n offset: PropTypes.number,\n /**\n * Props to pass down to the Banner Wrapper. An object `actionProps` can be included to be passed as others to actions.\n */\n bannerContentProps: PropTypes.instanceOf(Object),\n};\n\nexport default withStyles(styles, { name: \"HvBanner\" })(HvBanner);\n"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,QAAmC,OAAnC;AACA,OAAOC,SAAP,IAAoBC,SAApB,QAAqC,YAArC;AACA,SAASC,KAAT,EAAgBC,QAAhB,EAA0BC,UAA1B,QAA4C,mBAA5C;AACA,OAAOC,UAAP,MAAuB,mBAAvB;AACA,SAASC,KAAT,QAAsB,UAAtB;AACA,OAAOC,sBAAP,MAAmC,iBAAnC;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA;AACA;AACA;AACA;;AACA,IAAMC,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD,EAAW;EAC1B,IACEC,EADF,GAmBID,KAnBJ,CACEC,EADF;EAAA,IAEEC,OAFF,GAmBIF,KAnBJ,CAEEE,OAFF;EAAA,IAGEC,SAHF,GAmBIH,KAnBJ,CAGEG,SAHF;EAAA,IAIEC,IAJF,GAm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EAAmB,cAAnB,CAA1B,CA/EE;;EAgFnB;AACF;AACA;EACEhC,kBAAkB,EAAElB,SAAS,CAACsD,MAnFX;;EAoFnB;AACF;AACA;EACEnC,mBAAmB,EAAEnB,SAAS,CAACkD,KAAV,CAAgB,CAAC,IAAD,EAAO,MAAP,EAAe,MAAf,EAAuB,OAAvB,CAAhB,CAvFF;;EAwFnB;AACF;AACA;EACExB,MAAM,EAAE1B,SAAS,CAACsD,MA3FC;;EA4FnB;AACF;AACA;EACE3B,kBAAkB,EAAE3B,SAAS,CAACuD,UAAV,CAAqBC,MAArB;AA/FD,CAArB;AAkGA,eAAepD,UAAU,CAACI,MAAD,EAAS;EAAEiD,IAAI,EAAE;AAAR,CAAT,CAAV,CAAyChD,QAAzC,CAAf"}
|
|
1
|
+
{"version":3,"file":"Banner.js","names":["React","useCallback","PropTypes","oneOfType","Slide","Snackbar","withStyles","capitalize","setId","HvBannerContent","styles","HvBanner","props","id","classes","className","open","onClose","anchorOrigin","variant","transitionDuration","transitionDirection","showIcon","customIcon","actions","actionsCallback","actionsPosition","label","offset","bannerContentProps","others","anchorOriginOffset","anchorOriginTop","top","anchorOriginBottom","bottom","anchorOriginBanner","horizontal","vertical","SlideTransition","properties","root","rootClosed","anchorOriginTopCenter","anchorOriginBottomCenter","propTypes","string","shape","isRequired","bool","func","node","oneOf","arrayOf","icon","disabled","number","instanceOf","Object","name"],"sources":["../../../src/Banner/Banner.js"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport PropTypes, { oneOfType } from \"prop-types\";\nimport { Slide, Snackbar, withStyles } from \"@material-ui/core\";\nimport capitalize from \"lodash/capitalize\";\nimport { setId } from \"../utils\";\nimport HvBannerContent from \"./BannerContent\";\nimport styles from \"./styles\";\n\n/**\n * A Banner displays an important and succinct message. It can also provide actions for the user to address, or dismiss.\n * It requires a user action, for it to be dismissed. Banners should appear at the top of the screen, below a top app bar.\n */\nconst HvBanner = (props) => {\n const {\n id,\n classes,\n className,\n open,\n onClose,\n anchorOrigin = \"top\",\n variant = \"default\",\n transitionDuration = 300,\n transitionDirection = \"down\",\n showIcon = false,\n customIcon,\n actions,\n actionsCallback,\n actionsPosition = \"auto\",\n label,\n offset = 60,\n bannerContentProps,\n ...others\n } = props;\n\n const anchorOriginOffset = {\n anchorOriginTop: {\n top: `${offset || 0}px`,\n },\n anchorOriginBottom: {\n bottom: `${offset || 0}px`,\n },\n };\n\n const anchorOriginBanner = { horizontal: \"center\", vertical: anchorOrigin };\n\n const SlideTransition = useCallback(\n (properties) => <Slide {...properties} direction={transitionDirection} />,\n [transitionDirection]\n );\n\n return (\n <Snackbar\n style={anchorOriginOffset[`anchorOrigin${capitalize(anchorOrigin)}`]}\n className={className}\n id={id}\n classes={{\n root: open ? classes.root : classes.rootClosed,\n anchorOriginTopCenter: classes.anchorOriginTopCenter,\n anchorOriginBottomCenter: classes.anchorOriginBottomCenter,\n }}\n anchorOrigin={anchorOriginBanner}\n TransitionComponent={SlideTransition}\n open={open}\n transitionDuration={transitionDuration}\n {...others}\n >\n <HvBannerContent\n id={setId(id, \"content\")}\n content={label}\n variant={variant}\n customIcon={customIcon}\n showIcon={showIcon}\n actions={actions}\n actionsCallback={actionsCallback}\n actionsPosition={actionsPosition}\n onClose={onClose}\n {...bannerContentProps}\n />\n </Snackbar>\n );\n};\n\nHvBanner.propTypes = {\n /**\n * Class names to be applied.\n */\n className: PropTypes.string,\n /**\n * Id to be applied to the root node.\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes: PropTypes.shape({\n /**\n * Styles applied to the component root class.\n */\n root: PropTypes.string,\n /**\n * Styles applied to the component root class when the component is closed.\n */\n rootClosed: PropTypes.string,\n /**\n * Styles applied to the component when define as top.\n */\n anchorOriginTopCenter: PropTypes.string,\n /**\n * Styles applied to the component when define as bottom.\n */\n anchorOriginBottomCenter: PropTypes.string,\n }).isRequired,\n /**\n * If true, Snackbar is open.\n */\n open: PropTypes.bool.isRequired,\n /**\n * Callback fired when the component requests to be closed. Typically onClose is used to set state in the parent component, which is used to control the Snackbar open prop. The reason parameter can optionally be used to control the response to onClose, for example ignoring clickaway.\n */\n onClose: PropTypes.func,\n /**\n * The message to display.\n */\n label: PropTypes.node,\n /**\n * The anchor of the Snackbar.\n */\n anchorOrigin: PropTypes.oneOf([\"top\", \"bottom\"]),\n /**\n * Variant of the snackbar.\n */\n variant: PropTypes.oneOf([\"success\", \"warning\", \"error\", \"info\", \"default\"]),\n /**\n * Custom icon to replace the variant default.\n */\n customIcon: PropTypes.node,\n /**\n * Controls if the associated icon to the variant should be shown.\n */\n showIcon: PropTypes.bool,\n /**\n * Actions to display on the right side.\n */\n actions: oneOfType([\n PropTypes.node,\n PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n icon: PropTypes.func,\n disabled: PropTypes.bool,\n })\n ),\n ]),\n /**\n * The callback function ran when an action is triggered, receiving `action` as param\n */\n actionsCallback: PropTypes.func,\n /**\n * The position property of the header.\n */\n actionsPosition: PropTypes.PropTypes.oneOf([\"auto\", \"inline\", \"bottom-right\"]),\n /**\n * How much the transition animation last in milliseconds, if 0 no animation is played.\n */\n transitionDuration: PropTypes.number,\n /**\n * Direction of slide transition.\n */\n transitionDirection: PropTypes.oneOf([\"up\", \"down\", \"left\", \"right\"]),\n /**\n * Offset from top/bottom of the page, in px. Defaults to 60px.\n */\n offset: PropTypes.number,\n /**\n * Props to pass down to the Banner Wrapper. An object `actionProps` can be included to be passed as others to actions.\n */\n bannerContentProps: PropTypes.instanceOf(Object),\n};\n\nexport default withStyles(styles, { name: \"HvBanner\" })(HvBanner);\n"],"mappings":";;;AAAA,OAAOA,KAAP,IAAgBC,WAAhB,QAAmC,OAAnC;AACA,OAAOC,SAAP,IAAoBC,SAApB,QAAqC,YAArC;AACA,SAASC,KAAT,EAAgBC,QAAhB,EAA0BC,UAA1B,QAA4C,mBAA5C;AACA,OAAOC,UAAP,MAAuB,mBAAvB;AACA,SA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drB,KAAK,EAAEzB,SAAS,CAAC4C,MAAV,CAAiBE,UAFV;IAGdM,IAAI,EAAEpD,SAAS,CAACgD,IAHF;IAIdK,QAAQ,EAAErD,SAAS,CAAC+C;EAJN,CAAhB,CADF,CAFiB,CAAD,CA7DC;;EAwEnB;AACF;AACA;EACExB,eAAe,EAAEvB,SAAS,CAACgD,IA3ER;;EA4EnB;AACF;AACA;EACExB,eAAe,EAAExB,SAAS,CAACA,SAAV,CAAoBkD,KAApB,CAA0B,CAAC,MAAD,EAAS,QAAT,EAAmB,cAAnB,CAA1B,CA/EE;;EAgFnB;AACF;AACA;EACEhC,kBAAkB,EAAElB,SAAS,CAACsD,MAnFX;;EAoFnB;AACF;AACA;EACEnC,mBAAmB,EAAEnB,SAAS,CAACkD,KAAV,CAAgB,CAAC,IAAD,EAAO,MAAP,EAAe,MAAf,EAAuB,OAAvB,CAAhB,CAvFF;;EAwFnB;AACF;AACA;EACExB,MAAM,EAAE1B,SAAS,CAACsD,MA3FC;;EA4FnB;AACF;AACA;EACE3B,kBAAkB,EAAE3B,SAAS,CAACuD,UAAV,CAAqBC,MAArB;AA/FD,CAArB;AAkGA,eAAepD,UAAU,CAACI,MAAD,EAAS;EAAEiD,IAAI,EAAE;AAAR,CAAT,CAAV,CAAyChD,QAAzC,CAAf"}
|
package/dist/legacy/Banner/{BannerWrapper → BannerContent}/ActionContainer/ActionContainer.js
RENAMED
|
File without changes
|
package/dist/legacy/Banner/{BannerWrapper → BannerContent}/ActionContainer/ActionContainer.js.map
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionContainer.js","names":["React","PropTypes","oneOfType","withStyles","Close","ActionsGeneric","HvButton","styles","ActionContainer","id","classes","onClose","action","actionCallback","others","actionContainer","closeAction","iconContainer","actionsInnerContainer","propTypes","string","instanceOf","Object","func","node","arrayOf","shape","isRequired","label","icon","disabled","bool","name"],"sources":["../../../../../src/Banner/
|
|
1
|
+
{"version":3,"file":"ActionContainer.js","names":["React","PropTypes","oneOfType","withStyles","Close","ActionsGeneric","HvButton","styles","ActionContainer","id","classes","onClose","action","actionCallback","others","actionContainer","closeAction","iconContainer","actionsInnerContainer","propTypes","string","instanceOf","Object","func","node","arrayOf","shape","isRequired","label","icon","disabled","bool","name"],"sources":["../../../../../src/Banner/BannerContent/ActionContainer/ActionContainer.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes, { oneOfType } from \"prop-types\";\nimport { withStyles } from \"@material-ui/core\";\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport ActionsGeneric from \"../../../ActionsGeneric\";\nimport HvButton from \"../../../Button\";\nimport styles from \"./styles\";\n\nconst ActionContainer = ({ id, classes, onClose, action, actionCallback, ...others }) => {\n return (\n <div className={classes.actionContainer}>\n <HvButton\n icon\n className={classes.closeAction}\n category=\"semantic\"\n aria-label=\"Close\"\n onClick={onClose}\n tabIndex={0}\n {...others}\n >\n <Close iconSize=\"XS\" className={classes.iconContainer} color=\"base2\" />\n </HvButton>\n {action && (\n <div className={classes.actionsInnerContainer}>\n <ActionsGeneric\n id={id}\n category=\"semantic\"\n actions={action}\n actionsCallback={actionCallback}\n />\n </div>\n )}\n </div>\n );\n};\n\nActionContainer.propTypes = {\n /**\n * Identifier.\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied to the button.\n */\n classes: PropTypes.instanceOf(Object),\n /**\n * onClose function.\n */\n onClose: PropTypes.func,\n /**\n * Actions to display.\n */\n action: oneOfType([\n PropTypes.node,\n PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n icon: PropTypes.func,\n disabled: PropTypes.bool,\n })\n ),\n ]),\n /**\n * The callback function ran when an action is triggered, receiving `action` as param\n */\n actionCallback: PropTypes.func,\n};\n\nexport default withStyles(styles, { name: \"HvActionContainer\" })(ActionContainer);\n"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,IAAoBC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EAa1B;AACF;AACA;EACEX,MAAM,EAAEV,SAAS,CAAC,CAChBD,SAAS,CAACuB,IADM,EAEhBvB,SAAS,CAACwB,OAAV,CACExB,SAAS,CAACyB,KAAV,CAAgB;IACdjB,EAAE,EAAER,SAAS,CAACmB,MAAV,CAAiBO,UADP;IAEdC,KAAK,EAAE3B,SAAS,CAACmB,MAAV,CAAiBO,UAFV;IAGdE,IAAI,EAAE5B,SAAS,CAACsB,IAHF;IAIdO,QAAQ,EAAE7B,SAAS,CAAC8B;EAJN,CAAhB,CADF,CAFgB,CAAD,CAhBS;;EA2B1B;AACF;AACA;EACElB,cAAc,EAAEZ,SAAS,CAACsB;AA9BA,CAA5B;AAiCA,eAAepB,UAAU,CAACI,MAAD,EAAS;EAAEyB,IAAI,EAAE;AAAR,CAAT,CAAV,CAAkDxB,eAAlD,CAAf"}
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../../../../src/Banner/
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../../../../src/Banner/BannerContent/ActionContainer/index.js"],"sourcesContent":["export { default } from \"./ActionContainer\";\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,mBAAxB"}
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["fade","outlineStyles","styles","theme","actionContainer","display","flexDirection","height","justifyContent","actionsInnerContainer","marginTop","closeAction","alignSelf","cursor","backgroundColor","hv","palette","base","base1","iconContainer","width"],"sources":["../../../../../src/Banner/
|
|
1
|
+
{"version":3,"file":"styles.js","names":["fade","outlineStyles","styles","theme","actionContainer","display","flexDirection","height","justifyContent","actionsInnerContainer","marginTop","closeAction","alignSelf","cursor","backgroundColor","hv","palette","base","base1","iconContainer","width"],"sources":["../../../../../src/Banner/BannerContent/ActionContainer/styles.js"],"sourcesContent":["import fade from \"../../../utils/hexToRgbA\";\nimport { outlineStyles } from \"../../../Focus/styles\";\n\nconst styles = (theme) => ({\n actionContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n height: \"100%\",\n justifyContent: \"space-between\",\n },\n actionsInnerContainer: {\n flexDirection: \"row\",\n marginTop: \"8px\", // avoid overlap with close button outline focus ring\n },\n closeAction: {\n alignSelf: \"flex-end\",\n cursor: \"pointer\",\n \"&:hover\": {\n backgroundColor: fade(theme.hv.palette.base.base1, 0.3),\n },\n \"&:focus\": {\n ...outlineStyles,\n },\n },\n iconContainer: {\n width: \"32px\",\n height: \"32px\",\n },\n});\n\nexport default styles;\n"],"mappings":";;;;;;;;;;;;;AAAA,OAAOA,IAAP,MAAiB,0BAAjB;AACA,SAASC,aAAT,QAA8B,uBAA9B;;AAEA,IAAMC,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;EAAA,OAAY;IACzBC,eAAe,EAAE;MACfC,OAAO,EAAE,MADM;MAEfC,aAAa,EAAE,QAFA;MAGfC,MAAM,EAAE,MAHO;MAIfC,cAAc,EAAE;IAJD,CADQ;IAOzBC,qBAAqB,EAAE;MACrBH,aAAa,EAAE,KADM;MAErBI,SAAS,EAAE,KAFU,CAEH;;IAFG,CAPE;IAWzBC,WAAW,EAAE;MACXC,SAAS,EAAE,UADA;MAEXC,MAAM,EAAE,SAFG;MAGX,WAAW;QACTC,eAAe,EAAEd,IAAI,CAACG,KAAK,CAACY,EAAN,CAASC,OAAT,CAAiBC,IAAjB,CAAsBC,KAAvB,EAA8B,GAA9B;MADZ,CAHA;MAMX,6BACKjB,aADL;IANW,CAXY;IAqBzBkB,aAAa,EAAE;MACbC,KAAK,EAAE,MADM;MAEbb,MAAM,EAAE;IAFK;EArBU,CAAZ;AAAA,CAAf;;AA2BA,eAAeL,MAAf"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StandardProps, SnackbarContentProps } from "@material-ui/core";
|
|
3
|
+
import {
|
|
4
|
+
ActionsPositionProp,
|
|
5
|
+
HvActionsGenericCommonProps,
|
|
6
|
+
HvButtonProps,
|
|
7
|
+
NotificationsCommonProps,
|
|
8
|
+
SemanticVariantTypes,
|
|
9
|
+
} from "../..";
|
|
10
|
+
|
|
11
|
+
export type HvBannerContentClassKey =
|
|
12
|
+
| "root"
|
|
13
|
+
| "message"
|
|
14
|
+
| "action"
|
|
15
|
+
| "baseVariant"
|
|
16
|
+
| "outContainer"
|
|
17
|
+
| SemanticVariantTypes;
|
|
18
|
+
|
|
19
|
+
export interface HvBannerContentProps
|
|
20
|
+
extends StandardProps<SnackbarContentProps, HvBannerContentClassKey, "variant">,
|
|
21
|
+
HvActionsGenericCommonProps,
|
|
22
|
+
Pick<NotificationsCommonProps, "showIcon" | "customIcon" | "variant"> {
|
|
23
|
+
/**
|
|
24
|
+
* The position property of the header.
|
|
25
|
+
*/
|
|
26
|
+
actionsPosition?: ActionsPositionProp;
|
|
27
|
+
/**
|
|
28
|
+
* The message to display.
|
|
29
|
+
*/
|
|
30
|
+
content?: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* onClose function.
|
|
33
|
+
*/
|
|
34
|
+
onClose?: HvButtonProps["onClick"];
|
|
35
|
+
/**
|
|
36
|
+
* The props to pass down to the Action Container.
|
|
37
|
+
*/
|
|
38
|
+
actionProps?: Record<string, unknown>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default function HvBannerContent(props: HvBannerContentProps): JSX.Element | null;
|
package/dist/legacy/Banner/{BannerWrapper/BannerContentWrapper.js → BannerContent/BannerContent.js}
RENAMED
|
@@ -9,7 +9,7 @@ import iconVariant from "../../utils/iconVariant";
|
|
|
9
9
|
import MessageContainer from "./MessageContainer";
|
|
10
10
|
import ActionContainer from "./ActionContainer";
|
|
11
11
|
import styles from "./styles";
|
|
12
|
-
var
|
|
12
|
+
var HvBannerContent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
13
13
|
var id = props.id,
|
|
14
14
|
classes = props.classes,
|
|
15
15
|
_props$showIcon = props.showIcon,
|
|
@@ -61,7 +61,7 @@ var HvBannerContentWrapper = /*#__PURE__*/React.forwardRef(function (props, ref)
|
|
|
61
61
|
}, actionProps))
|
|
62
62
|
}, others)));
|
|
63
63
|
});
|
|
64
|
-
process.env.NODE_ENV !== "production" ?
|
|
64
|
+
process.env.NODE_ENV !== "production" ? HvBannerContent.propTypes = {
|
|
65
65
|
/**
|
|
66
66
|
* Identifier.
|
|
67
67
|
*/
|
|
@@ -123,6 +123,6 @@ process.env.NODE_ENV !== "production" ? HvBannerContentWrapper.propTypes = {
|
|
|
123
123
|
actionProps: PropTypes.instanceOf(Object)
|
|
124
124
|
} : void 0;
|
|
125
125
|
export default withStyles(styles, {
|
|
126
|
-
name: "
|
|
127
|
-
})(
|
|
128
|
-
//# sourceMappingURL=
|
|
126
|
+
name: "HvBannerContent"
|
|
127
|
+
})(HvBannerContent);
|
|
128
|
+
//# sourceMappingURL=BannerContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BannerContent.js","names":["React","PropTypes","oneOfType","clsx","SnackbarContent","withStyles","iconVariant","MessageContainer","ActionContainer","styles","HvBannerContent","forwardRef","props","ref","id","classes","showIcon","customIcon","variant","onClose","actions","actionsCallback","actionsPosition","content","actionProps","others","icon","effectiveActionsPosition","outContainer","root","message","action","baseVariant","actionsOnMessage","actionsOnMessageCallback","actionCallback","propTypes","string","instanceOf","Object","node","oneOf","bool","func","arrayOf","shape","isRequired","label","disabled","name"],"sources":["../../../../src/Banner/BannerContent/BannerContent.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes, { oneOfType } from \"prop-types\";\nimport clsx from \"clsx\";\nimport { SnackbarContent, withStyles } from \"@material-ui/core\";\nimport iconVariant from \"../../utils/iconVariant\";\nimport MessageContainer from \"./MessageContainer\";\nimport ActionContainer from \"./ActionContainer\";\nimport styles from \"./styles\";\n\nconst HvBannerContent = React.forwardRef((props, ref) => {\n const {\n id,\n classes,\n showIcon = false,\n customIcon,\n variant = \"default\",\n onClose,\n actions,\n actionsCallback,\n actionsPosition = \"auto\",\n content,\n actionProps,\n ...others\n } = props;\n\n const icon = customIcon || (showIcon && iconVariant(variant, \"base2\"));\n\n // default to inline\n // this might try to be more intelligent in the future,\n // taking into account the content length, available space,\n // number of actions, etc..\n const effectiveActionsPosition = actionsPosition === \"auto\" ? \"inline\" : actionsPosition;\n\n return (\n <div className={classes.outContainer}>\n <SnackbarContent\n ref={ref}\n id={id}\n classes={{\n root: classes.root,\n message: classes.message,\n action: classes.action,\n }}\n className={clsx(classes[variant], classes.baseVariant)}\n message={\n <MessageContainer\n id={id}\n icon={icon}\n {...(effectiveActionsPosition === \"inline\" && {\n actionsOnMessage: actions,\n actionsOnMessageCallback: actionsCallback,\n })}\n message={content}\n />\n }\n action={\n <ActionContainer\n id={id}\n onClose={onClose}\n {...(effectiveActionsPosition === \"bottom-right\" && {\n action: actions,\n actionCallback: actionsCallback,\n })}\n {...actionProps}\n />\n }\n {...others}\n />\n </div>\n );\n});\n\nHvBannerContent.propTypes = {\n /**\n * Identifier.\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied to the component.\n */\n classes: PropTypes.instanceOf(Object),\n /**\n * The message to display.\n */\n content: PropTypes.node,\n /**\n * Variant of the snackbar.\n */\n variant: PropTypes.oneOf([\"success\", \"warning\", \"error\", \"info\", \"default\"]),\n /**\n * Controls if the associated icon to the variant should be shown.\n */\n showIcon: PropTypes.bool,\n /**\n * Custom icon to replace the variant default.\n */\n customIcon: PropTypes.node,\n /**\n * onClose function.\n */\n onClose: PropTypes.func,\n /**\n * Actions to display on the right side.\n */\n actions: oneOfType([\n PropTypes.node,\n PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n icon: PropTypes.func,\n disabled: PropTypes.bool,\n })\n ),\n ]),\n /**\n * The callback function ran when an action is triggered, receiving `action` as param\n */\n actionsCallback: PropTypes.func,\n /**\n * The position property of the header.\n */\n actionsPosition: PropTypes.PropTypes.oneOf([\"auto\", \"inline\", \"bottom-right\"]),\n /**\n * The props to pass down to the Action Container.\n */\n actionProps: PropTypes.instanceOf(Object),\n};\n\nexport default withStyles(styles, { name: \"HvBannerContent\" })(HvBannerContent);\n"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,IAAoBC,SAApB,QAAqC,YAArC;AACA,OAAOC,IAAP,MAAiB,MAAjB;AACA,SAASC,eAAT,EAA0BC,UAA1B,QAA4C,mBAA5C;AACA,OAAOC,WAAP,MAAwB,yBAAxB;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AACA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,IAAMC,eAAe,gBAAGV,KAAK,CAACW,UAAN,CAAiB,UAACC,KAAD,EAAQC,GAAR,EAAgB;EACvD,IACEC,EADF,GAaIF,KAbJ,CACEE,EADF;EAAA,IAEEC,OAFF,GAaIH,KAbJ,CAEEG,OAFF;EAAA,sBAaIH,KAbJ,CAGEI,QAHF;EAAA,IAGEA,QAHF,gCAGa,KAHb;EAAA,IAIEC,UAJF,GAaIL,KAbJ,CAIEK,UAJF;EAAA,qBAaIL,KAbJ,CAKEM,OALF;EAAA,IAKEA,OALF,+BAKY,SALZ;EAAA,IAMEC,OANF,GAaIP,KAbJ,CAMEO,OANF;EAAA,IAOEC,OAPF,GAaIR,KAbJ,CAOEQ,OAPF;EAAA,IAQEC,eARF,GAaIT,KAbJ,CAQES,eARF;EAAA,4BAaIT,KAbJ,CASEU,eATF;EAAA,IASEA,eATF,sCASoB,MATpB;EAAA,IAUEC,OAVF,GAaIX,KAbJ,CAUEW,OAVF;EAAA,IAWEC,WAXF,GAaIZ,KAbJ,CAWEY,WAXF;EAAA,IAYKC,MAZL,4BAaIb,KAbJ;;EAeA,IAAMc,IAAI,GAAGT,UAAU,IAAKD,QAAQ,IAAIV,WAAW,CAACY,OAAD,EAAU,OAAV,CAAnD,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,SAAD,EAAY,SAAZ,EAAuB,OAAvB,EAAgC,MAAhC,EAAwC,SAAxC,CAAhB,CAhBiB;;EAiB1B;AACF;AACA;EACEzB,QAAQ,EAAEf,SAAS,CAACyC,IApBM;;EAqB1B;AACF;AACA;EACEzB,UAAU,EAAEhB,SAAS,CAACuC,IAxBI;;EAyB1B;AACF;AACA;EACErB,OAAO,EAAElB,SAAS,CAAC0C,IA5BO;;EA6B1B;AACF;AACA;EACEvB,OAAO,EAAElB,SAAS,CAAC,CACjBD,SAAS,CAACuC,IADO,EAEjBvC,SAAS,CAAC2C,OAAV,CACE3C,SAAS,CAAC4C,KAAV,CAAgB;IACd/B,EAAE,EAAEb,SAAS,CAACoC,MAAV,CAAiBS,UADP;IAEdC,KAAK,EAAE9C,SAAS,CAACoC,MAAV,CAAiBS,UAFV;IAGdpB,IAAI,EAAEzB,SAAS,CAAC0C,IAHF;IAIdK,QAAQ,EAAE/C,SAAS,CAACyC;EAJN,CAAhB,CADF,CAFiB,CAAD,CAhCQ;;EA2C1B;AACF;AACA;EACErB,eAAe,EAAEpB,SAAS,CAAC0C,IA9CD;;EA+C1B;AACF;AACA;EACErB,eAAe,EAAErB,SAAS,CAACA,SAAV,CAAoBwC,KAApB,CAA0B,CAAC,MAAD,EAAS,QAAT,EAAmB,cAAnB,CAA1B,CAlDS;;EAmD1B;AACF;AACA;EACEjB,WAAW,EAAEvB,SAAS,CAACqC,UAAV,CAAqBC,MAArB;AAtDa,CAA5B;AAyDA,eAAelC,UAAU,CAACI,MAAD,EAAS;EAAEwC,IAAI,EAAE;AAAR,CAAT,CAAV,CAAgDvC,eAAhD,CAAf"}
|
package/dist/legacy/Banner/{BannerWrapper → BannerContent}/MessageContainer/MessageContainer.js
RENAMED
|
File without changes
|
package/dist/legacy/Banner/{BannerWrapper → BannerContent}/MessageContainer/MessageContainer.js.map
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageContainer.js","names":["React","PropTypes","oneOfType","withStyles","HvTypography","ActionsGeneric","setId","styles","MessageContainer","id","classes","icon","actionsOnMessage","actionsOnMessageCallback","message","iconContainer","actionMessageContainer","propTypes","string","instanceOf","Object","node","arrayOf","shape","isRequired","label","func","disabled","bool","name"],"sources":["../../../../../src/Banner/
|
|
1
|
+
{"version":3,"file":"MessageContainer.js","names":["React","PropTypes","oneOfType","withStyles","HvTypography","ActionsGeneric","setId","styles","MessageContainer","id","classes","icon","actionsOnMessage","actionsOnMessageCallback","message","iconContainer","actionMessageContainer","propTypes","string","instanceOf","Object","node","arrayOf","shape","isRequired","label","func","disabled","bool","name"],"sources":["../../../../../src/Banner/BannerContent/MessageContainer/MessageContainer.js"],"sourcesContent":["import React from \"react\";\nimport PropTypes, { oneOfType } from \"prop-types\";\nimport { withStyles } from \"@material-ui/core\";\nimport HvTypography from \"../../../Typography\";\nimport ActionsGeneric from \"../../../ActionsGeneric\";\nimport { setId } from \"../../../utils\";\nimport styles from \"./styles\";\n\nconst MessageContainer = ({\n id,\n classes,\n icon,\n actionsOnMessage,\n actionsOnMessageCallback,\n message,\n}) => (\n <>\n {icon && <div className={classes.iconContainer}>{icon}</div>}\n <HvTypography id={setId(id, \"message-text\")} className={classes.message}>\n {message}\n </HvTypography>\n {actionsOnMessage && (\n <div id={setId(id, \"message-actions\")} className={classes.actionMessageContainer}>\n <ActionsGeneric\n id={id}\n category=\"semantic\"\n actions={actionsOnMessage}\n actionsCallback={actionsOnMessageCallback}\n />\n </div>\n )}\n </>\n);\n\nMessageContainer.propTypes = {\n /**\n * Identifier.\n */\n id: PropTypes.string,\n /**\n * A Jss Object used to override or extend the styles applied to the button.\n */\n classes: PropTypes.instanceOf(Object),\n /**\n * Icon to be presented.\n */\n icon: PropTypes.node,\n /**\n * The message to display.\n */\n message: PropTypes.node,\n /**\n * Actions to display on message.\n */\n actionsOnMessage: oneOfType([\n PropTypes.node,\n PropTypes.arrayOf(\n PropTypes.shape({\n id: PropTypes.string.isRequired,\n label: PropTypes.string.isRequired,\n icon: PropTypes.func,\n disabled: PropTypes.bool,\n })\n ),\n ]),\n /**\n * The callback function ran when an action is triggered, receiving `actionsOnMessage` as param\n */\n actionsOnMessageCallback: PropTypes.func,\n};\n\nexport default withStyles(styles, { name: \"HvMessageContainer\" })(MessageContainer);\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,IAAoBC,SAApB,QAAqC,YAArC;AACA,SAASC,UAAT,QAA2B,mBAA3B;AACA,OAAOC,YAAP,MAAyB,qBAAzB;AACA,OAAOC,cAAP,MAA2B,yBAA3B;AACA,SAASC,KAAT,QAAsB,gBAAtB;AACA,OAAOC,MAAP,MAAmB,UAAnB;;AAEA,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB;EAAA,IACvBC,EADuB,QACvBA,EADuB;EAAA,IAEvBC,OAFuB,QAEvBA,OAFuB;EAAA,IAGvBC,IAHuB,QAGvBA,IAHuB;EAAA,IAIvBC,gBAJuB,QAIvBA,gBAJuB;EAAA,IAKvBC,wBALuB,QAKvBA,wBALuB;EAAA,IAMvBC,OANuB,QAMvBA,OANuB;EAAA,oBAQvB,0CACGH,IAAI,iBAAI;IAAK,SAAS,EAAED,OAAO,CAACK;EAAxB,GAAwCJ,IAAxC,CADX,eAEE,oBAAC,YAAD;IAAc,EAAE,EAAEL,KAAK,CAACG,EAAD,EAAK,cAAL,CAAvB;IAA6C,SAAS,EAAEC,OAAO,CAACI;EAAhE,GACGA,OADH,CAFF,EAKGF,gBAAgB,iBACf;IAAK,EAAE,EAAEN,KAAK,CAACG,EAAD,EAAK,iBAAL,CAAd;IAAuC,SAAS,EAAEC,OAAO,CAACM;EAA1D,gBACE,oBAAC,cAAD;IACE,EAAE,EAAEP,EADN;IAEE,QAAQ,EAAC,UAFX;IAGE,OAAO,EAAEG,gBAHX;IAIE,eAAe,EAAEC;EAJnB,EADF,CANJ,CARuB;AAAA,CAAzB;;AA0BA,wCAAAL,gBAAgB,CAACS,SAAjB,GAA6B;EAC3B;AACF;AACA;EACER,EAAE,EAAER,SAAS,CAACiB,MAJa;;EAK3B;AACF;AACA;EACER,OAAO,EAAET,SAAS,CAACkB,UAAV,CAAqBC,MAArB,CARkB;;EAS3B;AACF;AACA;EACET,IAAI,EAAEV,SAAS,CAACoB,IAZW;;EAa3B;AACF;AACA;EACEP,OAAO,EAAEb,SAAS,CAACoB,IAhBQ;;EAiB3B;AACF;AACA;EACET,gBAAgB,EAAEV,SAAS,CAAC,CAC1BD,SAAS,CAACoB,IADgB,EAE1BpB,SAAS,CAACqB,OAAV,CACErB,SAAS,CAACsB,KAAV,CAAgB;IACdd,EAAE,EAAER,SAAS,CAACiB,MAAV,CAAiBM,UADP;IAEdC,KAAK,EAAExB,SAAS,CAACiB,MAAV,CAAiBM,UAFV;IAGdb,IAAI,EAAEV,SAAS,CAACyB,IAHF;IAIdC,QAAQ,EAAE1B,SAAS,CAAC2B;EAJN,CAAhB,CADF,CAF0B,CAAD,CApBA;;EA+B3B;AACF;AACA;EACEf,wBAAwB,EAAEZ,SAAS,CAACyB;AAlCT,CAA7B;AAqCA,eAAevB,UAAU,CAACI,MAAD,EAAS;EAAEsB,IAAI,EAAE;AAAR,CAAT,CAAV,CAAmDrB,gBAAnD,CAAf"}
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../../../../src/Banner/
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../../../../src/Banner/BannerContent/MessageContainer/index.js"],"sourcesContent":["export { default } from \"./MessageContainer\";\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,oBAAxB"}
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["styles","theme","message","color","hv","palette","base","base2","wordBreak","maxWidth","overflow","marginRight","iconContainer","spacing","xs","marginLeft","actionMessageContainer","flex"],"sources":["../../../../../src/Banner/
|
|
1
|
+
{"version":3,"file":"styles.js","names":["styles","theme","message","color","hv","palette","base","base2","wordBreak","maxWidth","overflow","marginRight","iconContainer","spacing","xs","marginLeft","actionMessageContainer","flex"],"sources":["../../../../../src/Banner/BannerContent/MessageContainer/styles.js"],"sourcesContent":["const styles = (theme) => ({\n message: {\n color: theme.hv.palette.base.base2,\n wordBreak: \"break-word\",\n maxWidth: \"700px\",\n overflow: \"hidden\",\n marginRight: 10,\n },\n iconContainer: {\n marginRight: theme.hv.spacing.xs,\n marginLeft: -theme.hv.spacing.xs,\n },\n actionMessageContainer: {\n flex: \"0 0 auto\",\n },\n});\n\nexport default styles;\n"],"mappings":"AAAA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;EAAA,OAAY;IACzBC,OAAO,EAAE;MACPC,KAAK,EAAEF,KAAK,CAACG,EAAN,CAASC,OAAT,CAAiBC,IAAjB,CAAsBC,KADtB;MAEPC,SAAS,EAAE,YAFJ;MAGPC,QAAQ,EAAE,OAHH;MAIPC,QAAQ,EAAE,QAJH;MAKPC,WAAW,EAAE;IALN,CADgB;IAQzBC,aAAa,EAAE;MACbD,WAAW,EAAEV,KAAK,CAACG,EAAN,CAASS,OAAT,CAAiBC,EADjB;MAEbC,UAAU,EAAE,CAACd,KAAK,CAACG,EAAN,CAASS,OAAT,CAAiBC;IAFjB,CARU;IAYzBE,sBAAsB,EAAE;MACtBC,IAAI,EAAE;IADgB;EAZC,CAAZ;AAAA,CAAf;;AAiBA,eAAejB,MAAf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../../../src/Banner/BannerContent/index.js"],"sourcesContent":["export { default } from \"./BannerContent\";\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,iBAAxB"}
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","names":["styles","theme","root","minWidth","position","display","flexWrap","message","alignItems","padding","hvSpacing","paddingLeft","hv","spacing","sm","action","marginRight","flex","placeSelf","baseVariant","success","backgroundColor","palette","semantic","sema8","warning","sema20","error","sema9","default","sema7","outContainer","width"],"sources":["../../../../src/Banner/
|
|
1
|
+
{"version":3,"file":"styles.js","names":["styles","theme","root","minWidth","position","display","flexWrap","message","alignItems","padding","hvSpacing","paddingLeft","hv","spacing","sm","action","marginRight","flex","placeSelf","baseVariant","success","backgroundColor","palette","semantic","sema8","warning","sema20","error","sema9","default","sema7","outContainer","width"],"sources":["../../../../src/Banner/BannerContent/styles.js"],"sourcesContent":["const styles = (theme) => ({\n root: {\n minWidth: \"100%\",\n position: \"relative\",\n display: \"flex\",\n flexWrap: \"nowrap\",\n },\n message: {\n display: \"flex\",\n alignItems: \"center\",\n padding: theme.hvSpacing(\"xs\", 0),\n paddingLeft: theme.hv.spacing.sm,\n },\n action: {\n padding: theme.hvSpacing(\"xs\"),\n marginRight: 0,\n flex: \"0 0 auto\",\n placeSelf: \"stretch\",\n },\n baseVariant: {\n padding: 0,\n },\n success: {\n backgroundColor: theme.hv.palette.semantic.sema8,\n },\n warning: {\n backgroundColor: theme.hv.palette.semantic.sema20,\n },\n error: {\n backgroundColor: theme.hv.palette.semantic.sema9,\n },\n default: {\n backgroundColor: theme.hv.palette.semantic.sema7,\n },\n outContainer: {\n width: \"100%\",\n position: \"relative\",\n },\n});\n\nexport default styles;\n"],"mappings":"AAAA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;EAAA,OAAY;IACzBC,IAAI,EAAE;MACJC,QAAQ,EAAE,MADN;MAEJC,QAAQ,EAAE,UAFN;MAGJC,OAAO,EAAE,MAHL;MAIJC,QAAQ,EAAE;IAJN,CADmB;IAOzBC,OAAO,EAAE;MACPF,OAAO,EAAE,MADF;MAEPG,UAAU,EAAE,QAFL;MAGPC,OAAO,EAAER,KAAK,CAACS,SAAN,CAAgB,IAAhB,EAAsB,CAAtB,CAHF;MAIPC,WAAW,EAAEV,KAAK,CAACW,EAAN,CAASC,OAAT,CAAiBC;IAJvB,CAPgB;IAazBC,MAAM,EAAE;MACNN,OAAO,EAAER,KAAK,CAACS,SAAN,CAAgB,IAAhB,CADH;MAENM,WAAW,EAAE,CAFP;MAGNC,IAAI,EAAE,UAHA;MAINC,SAAS,EAAE;IAJL,CAbiB;IAmBzBC,WAAW,EAAE;MACXV,OAAO,EAAE;IADE,CAnBY;IAsBzBW,OAAO,EAAE;MACPC,eAAe,EAAEpB,KAAK,CAACW,EAAN,CAASU,OAAT,CAAiBC,QAAjB,CAA0BC;IADpC,CAtBgB;IAyBzBC,OAAO,EAAE;MACPJ,eAAe,EAAEpB,KAAK,CAACW,EAAN,CAASU,OAAT,CAAiBC,QAAjB,CAA0BG;IADpC,CAzBgB;IA4BzBC,KAAK,EAAE;MACLN,eAAe,EAAEpB,KAAK,CAACW,EAAN,CAASU,OAAT,CAAiBC,QAAjB,CAA0BK;IADtC,CA5BkB;IA+BzBC,OAAO,EAAE;MACPR,eAAe,EAAEpB,KAAK,CAACW,EAAN,CAASU,OAAT,CAAiBC,QAAjB,CAA0BO;IADpC,CA/BgB;IAkCzBC,YAAY,EAAE;MACZC,KAAK,EAAE,MADK;MAEZ5B,QAAQ,EAAE;IAFE;EAlCW,CAAZ;AAAA,CAAf;;AAwCA,eAAeJ,MAAf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","HvBannerContent"],"sources":["../../../src/Banner/index.js"],"sourcesContent":["export { default } from \"./Banner\";\nexport { default as HvBannerContent } from \"./
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","HvBannerContent"],"sources":["../../../src/Banner/index.js"],"sourcesContent":["export { default } from \"./Banner\";\nexport { default as HvBannerContent } from \"./BannerContent\";\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,UAAxB;AACA,SAASA,OAAO,IAAIC,eAApB,QAA2C,iBAA3C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StandardProps, SwitchProps } from "@material-ui/core";
|
|
2
2
|
|
|
3
|
-
export type HvBaseSwitchClassKey = "root" | "disabled";
|
|
3
|
+
export type HvBaseSwitchClassKey = "root" | "disabled" | "readOnly";
|
|
4
4
|
|
|
5
5
|
export interface HvBaseSwitchProps
|
|
6
6
|
extends StandardProps<SwitchProps, HvBaseSwitchClassKey, "onChange"> {
|
|
@@ -59,7 +59,7 @@ var HvBaseSwitch = function HvBaseSwitch(props) {
|
|
|
59
59
|
return /*#__PURE__*/React.createElement(Switch, _extends({
|
|
60
60
|
id: id,
|
|
61
61
|
name: name,
|
|
62
|
-
className: clsx(className, classes.root, disabled && classes.disabled, focusVisible && classes.focusVisible),
|
|
62
|
+
className: clsx(className, classes.root, disabled && classes.disabled, readOnly && classes.readOnly, focusVisible && classes.focusVisible),
|
|
63
63
|
color: "default",
|
|
64
64
|
disabled: disabled,
|
|
65
65
|
required: required,
|
|
@@ -103,6 +103,11 @@ process.env.NODE_ENV !== "production" ? HvBaseSwitch.propTypes = {
|
|
|
103
103
|
*/
|
|
104
104
|
disabled: PropTypes.string,
|
|
105
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Styles applied to the switch when it is in read only mode.
|
|
108
|
+
*/
|
|
109
|
+
readOnly: PropTypes.string,
|
|
110
|
+
|
|
106
111
|
/**
|
|
107
112
|
* Styles applied to the internal Switch component's root class.
|
|
108
113
|
*/
|