diff --git a/apps/atomic-ui-js-site/src/app/components/x-toggleclassonscroll/page.module.scss b/apps/atomic-ui-js-site/src/app/components/x-toggleonscroll/page.module.scss similarity index 100% rename from apps/atomic-ui-js-site/src/app/components/x-toggleclassonscroll/page.module.scss rename to apps/atomic-ui-js-site/src/app/components/x-toggleonscroll/page.module.scss diff --git a/apps/atomic-ui-js-site/src/app/components/x-toggleclassonscroll/page.tsx b/apps/atomic-ui-js-site/src/app/components/x-toggleonscroll/page.tsx similarity index 98% rename from apps/atomic-ui-js-site/src/app/components/x-toggleclassonscroll/page.tsx rename to apps/atomic-ui-js-site/src/app/components/x-toggleonscroll/page.tsx index 96358e1..037763a 100644 --- a/apps/atomic-ui-js-site/src/app/components/x-toggleclassonscroll/page.tsx +++ b/apps/atomic-ui-js-site/src/app/components/x-toggleonscroll/page.tsx @@ -1,16 +1,19 @@ -import XToggleClassOnScrollComponent from 'atomic-ui-js-next/x-toggleclassonscroll'; +import XToggleClassOnScrollComponent from 'atomic-ui-js-next/x-toggleonscroll'; import XRippleComponent from 'atomic-ui-js-next/x-ripple'; import styles from './page.module.scss'; -const triggerThresholds = Array(10).fill(null, 0, 10).map((_, i) => i * 0.1); +// const triggerThresholds = Array(10).fill(null, 0, 10).map((_, i) => i * 0.1); -interface LipsumArticleProps extends IntersectionObserverInit { +interface LipsumArticleProps /*extends IntersectionObserverInit*/ { anchorTarget?: string; className?: string; classNameToToggle?: string; scrollableParent?: string; title?: string; triggerTarget?: string; + root?: Element | Document | null; + rootMargin?: string; + threshold?: number | number[]; } const lipsumArticle = ({ diff --git a/apps/atomic-ui-js-site/src/data/generated/navigation-items.ts b/apps/atomic-ui-js-site/src/data/generated/navigation-items.ts index 4dafd7f..67e1f10 100644 --- a/apps/atomic-ui-js-site/src/data/generated/navigation-items.ts +++ b/apps/atomic-ui-js-site/src/data/generated/navigation-items.ts @@ -77,8 +77,8 @@ export const navigationItems: NavItem[] = [{ }, { 'label': 'X-toggleclassonscroll', - 'uri': '/components/x-toggleclassonscroll/', - 'alias': 'x-toggleclassonscroll' + 'uri': '/components/x-toggleonscroll/', + 'alias': 'x-toggleonscroll' } ] }, diff --git a/apps/atomic-ui-js-site/tsconfig.json b/apps/atomic-ui-js-site/tsconfig.json index c06b905..73745c1 100644 --- a/apps/atomic-ui-js-site/tsconfig.json +++ b/apps/atomic-ui-js-site/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../base.tsconfig.json", + "extends": "../../tsconfig.json", "module": "esnext", "compilerOptions": { "target": "es5", diff --git a/packages/atomic-ui-js-next/x-toggleclassonscroll/index.js b/packages/atomic-ui-js-next/x-toggleonscroll/index.js similarity index 80% rename from packages/atomic-ui-js-next/x-toggleclassonscroll/index.js rename to packages/atomic-ui-js-next/x-toggleonscroll/index.js index dba25d5..6f120cf 100644 --- a/packages/atomic-ui-js-next/x-toggleclassonscroll/index.js +++ b/packages/atomic-ui-js-next/x-toggleonscroll/index.js @@ -1,6 +1,6 @@ import lazy from 'next/dynamic'; -const XToggleClassOnScrollComponent = lazy(() => import('atomic-ui-js-react/x-toggleclassonscroll'), { +const XToggleClassOnScrollComponent = lazy(() => import('atomic-ui-js-react/x-toggleonscroll'), { ssr: false }); diff --git a/packages/atomic-ui-js-react/index.js b/packages/atomic-ui-js-react/index.js index c614faf..d77bd8a 100644 --- a/packages/atomic-ui-js-react/index.js +++ b/packages/atomic-ui-js-react/index.js @@ -1,3 +1,3 @@ export * from './x-field/index.js'; export * from './x-ripple/index.js'; -export * from './x-toggleclassonscroll/index.js'; +export * from './x-toggleonscroll/index.js'; diff --git a/packages/atomic-ui-js-react/tsconfig.json b/packages/atomic-ui-js-react/tsconfig.json index 6f3ea46..89b0b6f 100644 --- a/packages/atomic-ui-js-react/tsconfig.json +++ b/packages/atomic-ui-js-react/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../base.tsconfig.json", + "extends": "../../tsconfig.json", "compilerOptions": { "types": [ "atomic-ui-js" diff --git a/packages/atomic-ui-js-react/x-toggleclassonscroll/README.md b/packages/atomic-ui-js-react/x-toggleonscroll/README.md similarity index 100% rename from packages/atomic-ui-js-react/x-toggleclassonscroll/README.md rename to packages/atomic-ui-js-react/x-toggleonscroll/README.md diff --git a/packages/atomic-ui-js-react/x-toggleclassonscroll/index.js b/packages/atomic-ui-js-react/x-toggleonscroll/index.js similarity index 93% rename from packages/atomic-ui-js-react/x-toggleclassonscroll/index.js rename to packages/atomic-ui-js-react/x-toggleonscroll/index.js index 5ce4521..4df3a16 100644 --- a/packages/atomic-ui-js-react/x-toggleclassonscroll/index.js +++ b/packages/atomic-ui-js-react/x-toggleonscroll/index.js @@ -2,7 +2,7 @@ import React from 'react'; import {createComponent} from '@lit-labs/react'; -import {XToggleClassOnScrollElement} from 'atomic-ui-js/x-toggleclassonscroll/index.js'; +import {XToggleClassOnScrollElement} from 'atomic-ui-js/x-toggleonscroll/index.js'; const XToggleClassOnScrollComponent = createComponent({ tagName: XToggleClassOnScrollElement.localName, diff --git a/packages/atomic-ui-js/css/modules/index.css b/packages/atomic-ui-js/css/modules/index.css index 02f44cc..3e5aa12 100644 --- a/packages/atomic-ui-js/css/modules/index.css +++ b/packages/atomic-ui-js/css/modules/index.css @@ -18,4 +18,4 @@ @import url("form.css"); @import url("menu.css"); @import url("table.css"); -@import url("../../x-toggleclassonscroll/index.css"); +@import url("../../x-toggleonscroll/index.css"); diff --git a/packages/atomic-ui-js/tsconfig.json b/packages/atomic-ui-js/tsconfig.json index 418d520..41f98c3 100644 --- a/packages/atomic-ui-js/tsconfig.json +++ b/packages/atomic-ui-js/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../base.tsconfig.json", + "extends": "../../tsconfig.json", "compilerOptions": { "esModuleInterop": true, "lib": [ diff --git a/packages/atomic-ui-js/x-toggleclassonscroll/README.md b/packages/atomic-ui-js/x-toggleclassonscroll/README.md deleted file mode 100644 index 1232a48..0000000 --- a/packages/atomic-ui-js/x-toggleclassonscroll/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# x-toggleclassonscroll - -Toggles a classname on an element (itself by default) when ever target 'trigger' element is scrolled in, and/or out, from the 'container' element (default element used by `IntersectionObserver` (body/html element), by default). - -## Design - -### Basic Use Case Example - -In this example component should toggle `.some-css-class`, on itself. whenever the `header` element scrolls in/out of the ('default') scrollpane view (chosen by browser's hueristics (via `IntersectionObserver` instance)). - -```html - - -
Lorem Ipsum ...
- -...
- - -Lorem Ipsum ...
+ +...
+ + +