@aglyn/shared-ui-jsx 1.0.0-beta.225 → 1.0.0-beta.226
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/shared-ui-jsx",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.226",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/shared-data-mdi": "1.0.0-beta.
|
|
29
|
-
"@aglyn/shared-ui-theme": "1.0.0-beta.
|
|
30
|
-
"@aglyn/shared-util-tools": "1.0.0-beta.
|
|
31
|
-
"@aglyn/shared-util-vendor": "1.0.0-beta.
|
|
28
|
+
"@aglyn/shared-data-mdi": "1.0.0-beta.226",
|
|
29
|
+
"@aglyn/shared-ui-theme": "1.0.0-beta.226",
|
|
30
|
+
"@aglyn/shared-util-tools": "1.0.0-beta.226",
|
|
31
|
+
"@aglyn/shared-util-vendor": "1.0.0-beta.226",
|
|
32
32
|
"@mdi/js": "^7.4.47",
|
|
33
33
|
"@swc/helpers": "0.5.23",
|
|
34
34
|
"change-case": "^5.4.4",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import
|
|
17
|
+
import useScrollTrigger from '@mui/material/useScrollTrigger';
|
|
18
18
|
import { type ReactElement } from 'react';
|
|
19
19
|
type UseScrollTriggerOptions = Parameters<typeof useScrollTrigger>[0];
|
|
20
20
|
export type ElevatedRenderProps = {
|
|
@@ -15,7 +15,7 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/ import { _isFnT } from "@aglyn/shared-util-tools";
|
|
18
|
-
import
|
|
18
|
+
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
|
19
19
|
import { cloneElement } from "react";
|
|
20
20
|
export function ScrollReaction(props) {
|
|
21
21
|
const { children, renderProps, threshold, target, withHysteresis, withoutHysteresis } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/components/scroll-reaction.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _isFnT } from '@aglyn/shared-util-tools'\nimport
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx/src/lib/components/scroll-reaction.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { _isFnT } from '@aglyn/shared-util-tools'\nimport useScrollTrigger from '@mui/material/useScrollTrigger'\nimport { cloneElement, type ReactElement } from 'react'\n\ntype UseScrollTriggerOptions = Parameters<typeof useScrollTrigger>[0]\n\nexport type ElevatedRenderProps = {\n activeWithHysteresis: boolean\n activeWithoutHysteresis: boolean\n}\n\nexport type ScrollTriggerOptions = Omit<\n UseScrollTriggerOptions,\n 'disableHysteresis'\n>\n\nexport interface ScrollReactionProps<P = any> extends ScrollTriggerOptions {\n /**\n * If children is a render function then passes local state to parameter.\n * Otherwise will clone child element, passing or calling renderProps\n */\n children: ReactElement<P> | ((state: ElevatedRenderProps) => ReactElement<P>)\n /**\n * Optionally, provide a render props function to contextually change passed\n * props based on the local state provided through the\n */\n renderProps?: Partial<P> | ((state: ElevatedRenderProps) => Partial<P>)\n\n /**\n * Optionally provided to override the options passed to useScrollTrigger for\n * the hook responding to triggers *WITH* hysteresis.\n *\n * __Meaning of Hysteresis__\n * > The meaning of hysteresis is \"lagging.\" Hysteresis is characterized as a\n * > lag of magnetic flux density (B) behind the magnetic field strength (H).\n */\n withHysteresis?: ScrollTriggerOptions\n /**\n * Optionally provided to override the options passed to\n * the`useScrollTrigger` for the hook responding to triggers *WITHOUT*\n * hysteresis.\n *\n * @see {@link withHysteresis} for Hysteresis meaning\n */\n withoutHysteresis?: ScrollTriggerOptions\n}\n\nexport function ScrollReaction<P>(\n props: ScrollReactionProps<P>,\n): ReactElement<P> {\n const {\n children,\n renderProps,\n threshold,\n target,\n withHysteresis,\n withoutHysteresis,\n } = props\n\n const activeWithoutHysteresis = useScrollTrigger({\n disableHysteresis: true,\n threshold,\n target: target ?? undefined,\n ...withoutHysteresis,\n })\n const activeWithHysteresis = useScrollTrigger({\n disableHysteresis: false,\n threshold,\n target: target ?? undefined,\n ...withHysteresis,\n })\n const activity = { activeWithHysteresis, activeWithoutHysteresis }\n\n if (_isFnT(children))\n return (children as (state: ElevatedRenderProps) => ReactElement<P>)(\n activity,\n )\n\n return cloneElement(\n children as ReactElement<P>,\n (_isFnT(renderProps) ? renderProps(activity) : renderProps) as Partial<P>,\n )\n}\n\nScrollReaction.displayName = 'ScrollReaction'\nScrollReaction.aglyn = true\n\nexport default ScrollReaction\n"],"names":["_isFnT","useScrollTrigger","cloneElement","ScrollReaction","props","children","renderProps","threshold","target","withHysteresis","withoutHysteresis","activeWithoutHysteresis","disableHysteresis","undefined","activeWithHysteresis","activity","displayName","aglyn"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,MAAM,QAAQ,2BAA0B;AACjD,OAAOC,sBAAsB,iCAAgC;AAC7D,SAASC,YAAY,QAA2B,QAAO;AA6CvD,OAAO,SAASC,eACdC,KAA6B;IAE7B,MAAM,EACJC,QAAQ,EACRC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,cAAc,EACdC,iBAAiB,EAClB,GAAGN;IAEJ,MAAMO,0BAA0BV,iBAAiB;QAC/CW,mBAAmB;QACnBL;QACAC,MAAM,EAAEA,iBAAAA,SAAUK;OACfH;IAEL,MAAMI,uBAAuBb,iBAAiB;QAC5CW,mBAAmB;QACnBL;QACAC,MAAM,EAAEA,iBAAAA,SAAUK;OACfJ;IAEL,MAAMM,WAAW;QAAED;QAAsBH;IAAwB;IAEjE,IAAIX,OAAOK,WACT,OAAO,AAACA,SACNU;IAGJ,qBAAOb,aACLG,UACCL,OAAOM,eAAeA,YAAYS,YAAYT;AAEnD;AAEAH,eAAea,WAAW,GAAG;AAC7Bb,eAAec,KAAK,GAAG;AAEvB,eAAed,eAAc"}
|