@cleartrip/ct-design-sticky-container 4.0.0-SNAPSHOT-test.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/README.md +63 -0
- package/dist/StickyContainer.d.ts +2 -0
- package/dist/StickyContainer.d.ts.map +1 -0
- package/dist/StickyContainer.native.d.ts +4 -0
- package/dist/StickyContainer.native.d.ts.map +1 -0
- package/dist/ct-design-sticky-container.browser.cjs.js +2 -0
- package/dist/ct-design-sticky-container.browser.cjs.js.map +1 -0
- package/dist/ct-design-sticky-container.browser.esm.js +2 -0
- package/dist/ct-design-sticky-container.browser.esm.js.map +1 -0
- package/dist/ct-design-sticky-container.cjs.js +11 -0
- package/dist/ct-design-sticky-container.cjs.js.map +1 -0
- package/dist/ct-design-sticky-container.esm.js +2 -0
- package/dist/ct-design-sticky-container.esm.js.map +1 -0
- package/dist/ct-design-sticky-container.umd.js +13 -0
- package/dist/ct-design-sticky-container.umd.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/package.json +54 -0
- package/src/StickyContainer.native.tsx +19 -0
- package/src/StickyContainer.tsx +1 -0
- package/src/index.ts +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# StickyContainer
|
|
2
|
+
|
|
3
|
+
A container that can stick to viewport boundaries during scroll.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @cleartrip/ct-design-sticky-container
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @cleartrip/ct-design-sticky-container
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Peer dependencies
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Required for all targets
|
|
19
|
+
npm install react
|
|
20
|
+
|
|
21
|
+
# Web only
|
|
22
|
+
npm install react-dom
|
|
23
|
+
|
|
24
|
+
# React Native only
|
|
25
|
+
npm install react-native
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
### Basic
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { StickyContainer } from '@cleartrip/ct-design-sticky-container';
|
|
36
|
+
|
|
37
|
+
function Example() {
|
|
38
|
+
return (
|
|
39
|
+
<StickyContainer>
|
|
40
|
+
{/* Basic usage */}
|
|
41
|
+
</StickyContainer>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Accessibility
|
|
49
|
+
|
|
50
|
+
- The component follows accessibility best practices
|
|
51
|
+
- Ensure proper ARIA attributes are provided where needed
|
|
52
|
+
- Test with screen readers to ensure usability
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Migration
|
|
57
|
+
|
|
58
|
+
If migrating from a previous version:
|
|
59
|
+
|
|
60
|
+
```diff
|
|
61
|
+
- import { StickyContainer } from 'yagami/core/components';
|
|
62
|
+
+ import { StickyContainer } from '@cleartrip/ct-design-sticky-container';
|
|
63
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickyContainer.d.ts","sourceRoot":"","sources":["../packages/components/StickyContainer/src/StickyContainer.tsx"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StickyContainer.native.d.ts","sourceRoot":"","sources":["../packages/components/StickyContainer/src/StickyContainer.native.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAa,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAmC,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAgB7F,eAAO,MAAM,SAAS,gBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ct-design-sticky-container.browser.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ct-design-sticky-container.browser.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ctDesignContainer = require('@cleartrip/ct-design-container');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, 'StickyContainer', {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return ctDesignContainer.Container; }
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=ct-design-sticky-container.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ct-design-sticky-container.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ct-design-sticky-container.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@cleartrip/ct-design-container')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@cleartrip/ct-design-container'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemStickyContainer = {}, global.ctDesignContainer));
|
|
5
|
+
})(this, (function (exports, ctDesignContainer) { 'use strict';
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, 'StickyContainer', {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return ctDesignContainer.Container; }
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
}));
|
|
13
|
+
//# sourceMappingURL=ct-design-sticky-container.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ct-design-sticky-container.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../packages/components/StickyContainer/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cleartrip/ct-design-sticky-container",
|
|
3
|
+
"version": "4.0.0-SNAPSHOT-test.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"types": "dist/index.d.ts",
|
|
6
|
+
"main": "./dist/ct-design-sticky-container.cjs.js",
|
|
7
|
+
"jsnext:main": "dist/ct-design-sticky-container.esm.js",
|
|
8
|
+
"module": "dist/ct-design-sticky-container.esm.js",
|
|
9
|
+
"react-native": "src/index.ts",
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/ct-design-sticky-container.d.ts",
|
|
14
|
+
"import": "./dist/ct-design-sticky-container.esm.js",
|
|
15
|
+
"default": "./dist/ct-design-sticky-container.cjs.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"browser": {
|
|
19
|
+
"./dist/ct-design-sticky-container.esm.js": "./dist/ct-design-sticky-container.browser.esm.js",
|
|
20
|
+
"./dist/ct-design-sticky-container.cjs.js": "./dist/ct-design-sticky-container.browser.cjs.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"src"
|
|
25
|
+
],
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@cleartrip/ct-design-style-manager": "4.0.0-SNAPSHOT-test.0",
|
|
28
|
+
"@cleartrip/ct-design-common-utils": "4.0.0-SNAPSHOT-test.0",
|
|
29
|
+
"@cleartrip/ct-design-conditional-wrap": "4.0.0-SNAPSHOT-test.0",
|
|
30
|
+
"@cleartrip/ct-design-event-propagation": "4.0.0-SNAPSHOT-test.0",
|
|
31
|
+
"@cleartrip/ct-design-scroll-container": "4.0.0-SNAPSHOT-test.0",
|
|
32
|
+
"@cleartrip/ct-design-container": "4.0.0-SNAPSHOT-test.0",
|
|
33
|
+
"@cleartrip/ct-design-theme": "4.0.0-SNAPSHOT-test.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@emotion/babel-plugin": "^11.12.0",
|
|
37
|
+
"@cleartrip/ct-design-types": "4.0.0-SNAPSHOT-test.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react": ">=16.8.0",
|
|
41
|
+
"react-dom": ">=16.8.0"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"author": "Kanishk Gupta <kanishk.gupta@cleartrip.com>",
|
|
47
|
+
"license": "ISC",
|
|
48
|
+
"scripts": {
|
|
49
|
+
"watch-package": "rollup -c -w",
|
|
50
|
+
"build-package": "rollup -c",
|
|
51
|
+
"build-package:clean": "rm -rf dist && rollup -c",
|
|
52
|
+
"publish-package:local": "yalc publish"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FC, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Container as ContainerComponent, IContainer } from '@cleartrip/ct-design-container';
|
|
4
|
+
import { useParentStickyContext, useStickyContext } from '@cleartrip/ct-design-scroll-container';
|
|
5
|
+
|
|
6
|
+
const StickyContainer: FC<IContainer> = ({ children, ...props }) => {
|
|
7
|
+
const stickyIndex = useStickyContext();
|
|
8
|
+
const [addStickyIndices, removeStickIndices] = useParentStickyContext();
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
addStickyIndices?.(stickyIndex);
|
|
11
|
+
return () => {
|
|
12
|
+
removeStickIndices?.(stickyIndex);
|
|
13
|
+
};
|
|
14
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15
|
+
}, []);
|
|
16
|
+
return <ContainerComponent {...props}>{children}</ContainerComponent>;
|
|
17
|
+
};
|
|
18
|
+
StickyContainer.displayName = 'StickyContainer';
|
|
19
|
+
export const Container = StickyContainer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@cleartrip/ct-design-container';
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Container as StickyContainer } from './StickyContainer';
|