@cleartrip/ct-design-shimmer 2.0.0 → 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/Shimmer.d.ts +1 -2
- package/dist/Shimmer.d.ts.map +1 -1
- package/dist/Shimmer.native.d.ts +4 -0
- package/dist/Shimmer.native.d.ts.map +1 -0
- package/dist/ct-design-shimmer.browser.cjs.js +4 -1
- package/dist/ct-design-shimmer.browser.cjs.js.map +1 -1
- package/dist/ct-design-shimmer.browser.esm.js +4 -1
- package/dist/ct-design-shimmer.browser.esm.js.map +1 -1
- package/dist/ct-design-shimmer.cjs.js +39 -36
- package/dist/ct-design-shimmer.cjs.js.map +1 -1
- package/dist/ct-design-shimmer.esm.js +40 -33
- package/dist/ct-design-shimmer.esm.js.map +1 -1
- package/dist/ct-design-shimmer.umd.js +44 -84
- package/dist/ct-design-shimmer.umd.js.map +1 -1
- package/dist/index.native.d.ts +3 -0
- package/dist/index.native.d.ts.map +1 -0
- package/dist/style.d.ts +12 -2
- package/dist/style.d.ts.map +1 -1
- package/dist/type.d.ts +12 -11
- package/dist/type.d.ts.map +1 -1
- package/package.json +33 -7
- package/src/Shimmer.native.tsx +123 -0
- package/src/Shimmer.tsx +71 -0
- package/src/index.native.ts +2 -0
- package/src/index.ts +2 -0
- package/src/style.ts +44 -0
- package/src/type.ts +72 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Shimmer
|
|
2
|
+
|
|
3
|
+
A loading placeholder component with shimmer animation effect.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @cleartrip/ct-design-shimmer
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @cleartrip/ct-design-shimmer
|
|
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 { Shimmer } from '@cleartrip/ct-design-shimmer';
|
|
36
|
+
|
|
37
|
+
function Example() {
|
|
38
|
+
return (
|
|
39
|
+
<Shimmer>
|
|
40
|
+
{/* Basic usage */}
|
|
41
|
+
</Shimmer>
|
|
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 { Shimmer } from 'yagami/core/components';
|
|
62
|
+
+ import { Shimmer } from '@cleartrip/ct-design-shimmer';
|
|
63
|
+
```
|
package/dist/Shimmer.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { ShimmerProps } from './type';
|
|
3
|
-
declare const Shimmer:
|
|
2
|
+
declare const Shimmer: import("react").MemoExoticComponent<({ width, height, shape, borderRadius, styleConfig }: ShimmerProps) => import("react/jsx-runtime").JSX.Element>;
|
|
4
3
|
export default Shimmer;
|
|
5
4
|
//# sourceMappingURL=Shimmer.d.ts.map
|
package/dist/Shimmer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Shimmer.d.ts","sourceRoot":"","sources":["../packages/components/Shimmer/src/Shimmer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Shimmer.d.ts","sourceRoot":"","sources":["../packages/components/Shimmer/src/Shimmer.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAqCtC,QAAA,MAAM,OAAO,4FAA2E,YAAY,6CAuBlG,CAAC;AAIH,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ShimmerProps } from './type';
|
|
2
|
+
declare const Shimmer: import("react").MemoExoticComponent<({ width, height, shape, borderRadius, styleConfig, variant }: ShimmerProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
export default Shimmer;
|
|
4
|
+
//# sourceMappingURL=Shimmer.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shimmer.native.d.ts","sourceRoot":"","sources":["../packages/components/Shimmer/src/Shimmer.native.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AA0CtC,QAAA,MAAM,OAAO,qGAC8E,YAAY,6CAgEtG,CAAC;AAIF,eAAe,OAAO,CAAC"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var e=require("react/jsx-runtime"),r=require("react"),i=require("@cleartrip/ct-design-container"),t=require("@cleartrip/ct-design-style-manager"),n=require("@emotion/css");const o=n.keyframes`
|
|
2
|
+
0% { background-position: 200% 0; }
|
|
3
|
+
100% { background-position: -200% 0; }
|
|
4
|
+
`,a=t.makeStyles(e=>({shimmerWrapper:{backgroundColor:e.color.shimmer.disabledLight||"#efefef",overflow:"hidden",width:"100%",height:"100%"}}));function s(e,r,i){return"circle"===e?"number"==typeof r?r/2:300:i}const c=r.memo(({width:r,height:n,shape:c="rect",borderRadius:d=8,styleConfig:u})=>{const l=t.useStyles(()=>({container:{width:null!=r?r:"100%",height:null!=n?n:"100%",borderRadius:s(c,n,d),background:"linear-gradient(to right, #e0e0e0 0%, #ffffff 50%, #e0e0e0 100%)",minWidth:400,backgroundSize:"150% 100%",animation:`${o} 1.5s infinite linear`}}),[r,n,c,d]);return e.jsx(i.Container,{styleConfig:{root:[a.shimmerWrapper,l.container,...(null==u?void 0:u.root)||[]]}})});c.displayName="Shimmer",exports.Shimmer=c;
|
|
2
5
|
//# sourceMappingURL=ct-design-shimmer.browser.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-shimmer.browser.cjs.js","sources":["../packages/components/Shimmer/src/style.ts","../packages/components/Shimmer/src/Shimmer.tsx"],"sourcesContent":[null,null],"names":["
|
|
1
|
+
{"version":3,"file":"ct-design-shimmer.browser.cjs.js","sources":["../packages/components/Shimmer/src/style.ts","../packages/components/Shimmer/src/Shimmer.tsx"],"sourcesContent":[null,null],"names":["shimmerKeyframes","keyframes","shimmerWrapperStyles","makeStyles","theme","shimmerWrapper","backgroundColor","color","shimmer","disabledLight","overflow","width","height","resolveBorderRadius","shape","borderRadius","Shimmer","memo","styleConfig","dynamicStyles","useStyles","container","background","minWidth","backgroundSize","animation","_jsx","jsx","Container","root","displayName"],"mappings":"yLASO,MAQMA,EAAmBC,EAASA,SAAA;;;EAiB5BC,EAAuBC,EAAAA,WAAYC,IAAW,CACzDC,eAAgB,CACdC,gBAAiBF,EAAMG,MAAMC,QAAQC,eAAiB,UACtDC,SAAU,SACVC,MAAO,OACPC,OAAQ,WCtBZ,SAASC,EACPC,EACAF,EACAG,GAEA,MAAc,WAAVD,EACuB,iBAAXF,EAAsBA,EAAS,EDdb,ICgB3BG,CACT,CAiBM,MAAAC,EAAUC,EAAIA,KAAC,EAAGN,QAAOC,SAAQE,QAAQ,OAAQC,eAAe,EAAGG,kBACvE,MAAMC,EAAgBC,EAAAA,UACpB,KAAO,CACLC,UAAW,CACTV,MAAOA,QAAAA,EAAS,OAChBC,OAAQA,QAAAA,EAAU,OAClBG,aAAcF,EAAoBC,EAAOF,EAAQG,GACjDO,WDxBuB,mECyBvBC,SAAU,IACVC,eAAgB,YAChBC,UAAW,GAAGzB,4BAGlB,CAACW,EAAOC,EAAQE,EAAOC,IAGzB,OACEW,EAAAC,IAACC,YAAS,CACRV,YAAa,CACXW,KAAM,CAAC3B,EAAqBG,eAAgBc,EAAcE,cAAeH,aAAA,EAAAA,EAAaW,OAAQ,SAMtGb,EAAQc,YAAc"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{memo as e}from"react";import{Container as i}from"@cleartrip/ct-design-container";import{makeStyles as o,useStyles as t}from"@cleartrip/ct-design-style-manager";import{keyframes as n}from"@emotion/css";const a=n`
|
|
2
|
+
0% { background-position: 200% 0; }
|
|
3
|
+
100% { background-position: -200% 0; }
|
|
4
|
+
`,m=o(r=>({shimmerWrapper:{backgroundColor:r.color.shimmer.disabledLight||"#efefef",overflow:"hidden",width:"100%",height:"100%"}}));function c(r,e,i){return"circle"===r?"number"==typeof e?e/2:300:i}const d=e(({width:e,height:o,shape:n="rect",borderRadius:d=8,styleConfig:s})=>{const f=t(()=>({container:{width:null!=e?e:"100%",height:null!=o?o:"100%",borderRadius:c(n,o,d),background:"linear-gradient(to right, #e0e0e0 0%, #ffffff 50%, #e0e0e0 100%)",minWidth:400,backgroundSize:"150% 100%",animation:`${a} 1.5s infinite linear`}}),[e,o,n,d]);return r(i,{styleConfig:{root:[m.shimmerWrapper,f.container,...(null==s?void 0:s.root)||[]]}})});d.displayName="Shimmer";export{d as Shimmer};
|
|
2
5
|
//# sourceMappingURL=ct-design-shimmer.browser.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-shimmer.browser.esm.js","sources":["../packages/components/Shimmer/src/style.ts","../packages/components/Shimmer/src/Shimmer.tsx"],"sourcesContent":[null,null],"names":["
|
|
1
|
+
{"version":3,"file":"ct-design-shimmer.browser.esm.js","sources":["../packages/components/Shimmer/src/style.ts","../packages/components/Shimmer/src/Shimmer.tsx"],"sourcesContent":[null,null],"names":["shimmerKeyframes","keyframes","shimmerWrapperStyles","makeStyles","theme","shimmerWrapper","backgroundColor","color","shimmer","disabledLight","overflow","width","height","resolveBorderRadius","shape","borderRadius","Shimmer","memo","styleConfig","dynamicStyles","useStyles","container","background","minWidth","backgroundSize","animation","_jsx","Container","root","displayName"],"mappings":"wPASO,MAQMA,EAAmBC,CAAS;;;EAiB5BC,EAAuBC,EAAYC,IAAW,CACzDC,eAAgB,CACdC,gBAAiBF,EAAMG,MAAMC,QAAQC,eAAiB,UACtDC,SAAU,SACVC,MAAO,OACPC,OAAQ,WCtBZ,SAASC,EACPC,EACAF,EACAG,GAEA,MAAc,WAAVD,EACuB,iBAAXF,EAAsBA,EAAS,EDdb,ICgB3BG,CACT,CAiBM,MAAAC,EAAUC,EAAK,EAAGN,QAAOC,SAAQE,QAAQ,OAAQC,eAAe,EAAGG,kBACvE,MAAMC,EAAgBC,EACpB,KAAO,CACLC,UAAW,CACTV,MAAOA,QAAAA,EAAS,OAChBC,OAAQA,QAAAA,EAAU,OAClBG,aAAcF,EAAoBC,EAAOF,EAAQG,GACjDO,WDxBuB,mECyBvBC,SAAU,IACVC,eAAgB,YAChBC,UAAW,GAAGzB,4BAGlB,CAACW,EAAOC,EAAQE,EAAOC,IAGzB,OACEW,EAACC,EAAS,CACRT,YAAa,CACXU,KAAM,CAAC1B,EAAqBG,eAAgBc,EAAcE,cAAeH,aAAA,EAAAA,EAAaU,OAAQ,SAMtGZ,EAAQa,YAAc"}
|
|
@@ -1,46 +1,49 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var tslib = require('tslib');
|
|
4
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var ctDesignContainer = require('@cleartrip/ct-design-container');
|
|
6
|
+
var ctDesignStyleManager = require('@cleartrip/ct-design-style-manager');
|
|
7
|
+
var css = require('@emotion/css');
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
const MaxBorderRadiusValue = 300;
|
|
10
|
+
const shimmerKeyframes = css.keyframes `
|
|
11
|
+
0% { background-position: 200% 0; }
|
|
12
|
+
100% { background-position: -200% 0; }
|
|
13
|
+
`;
|
|
14
|
+
const shimmerGradient = 'linear-gradient(to right, #e0e0e0 0%, #ffffff 50%, #e0e0e0 100%)';
|
|
15
|
+
const shimmerWrapperStyles = ctDesignStyleManager.makeStyles((theme) => ({
|
|
16
|
+
shimmerWrapper: {
|
|
17
|
+
backgroundColor: theme.color.shimmer.disabledLight || '#efefef',
|
|
18
|
+
overflow: 'hidden',
|
|
19
|
+
width: '100%',
|
|
20
|
+
height: '100%',
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
8
23
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var theme = _a.theme;
|
|
14
|
-
return theme.color.shimmer.disabledLight;
|
|
15
|
-
}, function (_a) {
|
|
16
|
-
var height = _a.height;
|
|
17
|
-
return height;
|
|
18
|
-
}, function (_a) {
|
|
19
|
-
var width = _a.width;
|
|
20
|
-
return width;
|
|
21
|
-
}, function (_a) {
|
|
22
|
-
var borderRadius = _a.borderRadius;
|
|
24
|
+
function resolveBorderRadius(shape, height, borderRadius) {
|
|
25
|
+
if (shape === 'circle') {
|
|
26
|
+
return typeof height === 'number' ? height / 2 : MaxBorderRadiusValue;
|
|
27
|
+
}
|
|
23
28
|
return borderRadius;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
}
|
|
30
|
+
const Shimmer = react.memo(({ width, height, shape = 'rect', borderRadius = 8, styleConfig }) => {
|
|
31
|
+
const dynamicStyles = ctDesignStyleManager.useStyles(() => ({
|
|
32
|
+
container: {
|
|
33
|
+
width: width !== null && width !== void 0 ? width : '100%',
|
|
34
|
+
height: height !== null && height !== void 0 ? height : '100%',
|
|
35
|
+
borderRadius: resolveBorderRadius(shape, height, borderRadius),
|
|
36
|
+
background: shimmerGradient,
|
|
37
|
+
minWidth: 400,
|
|
38
|
+
backgroundSize: '150% 100%',
|
|
39
|
+
animation: `${shimmerKeyframes} 1.5s infinite linear`,
|
|
40
|
+
},
|
|
41
|
+
}), [width, height, shape, borderRadius]);
|
|
42
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: {
|
|
43
|
+
root: [shimmerWrapperStyles.shimmerWrapper, dynamicStyles.container, ...((styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) || [])],
|
|
44
|
+
} }));
|
|
36
45
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
var Shimmer = function (_a) {
|
|
40
|
-
var _b, _c;
|
|
41
|
-
var height = _a.height, width = _a.width, _d = _a.borderRadius, borderRadius = _d === void 0 ? 0 : _d, _e = _a.children, children = _e === void 0 ? null : _e, _f = _a.styleConfig, styleConfig = _f === void 0 ? {} : _f;
|
|
42
|
-
return (jsxRuntime.jsx(StyledShimmer, tslib.__assign({ height: height, width: width, borderRadius: borderRadius, className: (_b = styleConfig.shimmerWrapper) === null || _b === void 0 ? void 0 : _b.className, css: (_c = styleConfig.shimmerWrapper) === null || _c === void 0 ? void 0 : _c.css }, { children: children })));
|
|
43
|
-
};
|
|
46
|
+
Shimmer.displayName = 'Shimmer';
|
|
44
47
|
|
|
45
48
|
exports.Shimmer = Shimmer;
|
|
46
49
|
//# sourceMappingURL=ct-design-shimmer.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-shimmer.cjs.js","sources":["../packages/components/Shimmer/src/style.ts","../packages/components/Shimmer/src/Shimmer.tsx"],"sourcesContent":[null,null],"names":["keyframes","
|
|
1
|
+
{"version":3,"file":"ct-design-shimmer.cjs.js","sources":["../packages/components/Shimmer/src/style.ts","../packages/components/Shimmer/src/Shimmer.tsx"],"sourcesContent":[null,null],"names":["keyframes","makeStyles","memo","useStyles","_jsx","Container"],"mappings":";;;;;;;;AASO,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAQjC,MAAM,gBAAgB,GAAGA,aAAS,CAAA,CAAA;;;CAGxC,CAAC;AAMK,MAAM,eAAe,GAAG,kEAAkE,CAAC;AAQ3F,MAAM,oBAAoB,GAAGC,+BAAU,CAAC,CAAC,KAAK,MAAM;AACzD,IAAA,cAAc,EAAE;QACd,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,IAAI,SAAS;AAC/D,QAAA,QAAQ,EAAE,QAAiB;AAC3B,QAAA,KAAK,EAAE,MAAe;AACtB,QAAA,MAAM,EAAE,MAAe;AACxB,KAAA;AACF,CAAA,CAAC,CAAC;;ACxBH,SAAS,mBAAmB,CAC1B,KAAwB,EACxB,MAAmC,EACnC,YAAoB,EAAA;AAEpB,IAAA,IAAI,KAAK,KAAK,QAAQ,EAAE;AACtB,QAAA,OAAO,OAAO,MAAM,KAAK,QAAQ,GAAG,MAAM,GAAG,CAAC,GAAG,oBAAoB,CAAC;KACvE;AACD,IAAA,OAAO,YAAY,CAAC;AACtB,CAAC;AAiBK,MAAA,OAAO,GAAGC,UAAI,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,YAAY,GAAG,CAAC,EAAE,WAAW,EAAgB,KAAI;AACtG,IAAA,MAAM,aAAa,GAAGC,8BAAS,CAC7B,OAAO;AACL,QAAA,SAAS,EAAE;AACT,YAAA,KAAK,EAAE,KAAK,KAAA,IAAA,IAAL,KAAK,KAAL,KAAA,CAAA,GAAA,KAAK,GAAI,MAAM;AACtB,YAAA,MAAM,EAAE,MAAM,KAAA,IAAA,IAAN,MAAM,KAAN,KAAA,CAAA,GAAA,MAAM,GAAI,MAAM;YACxB,YAAY,EAAE,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC;AAC9D,YAAA,UAAU,EAAE,eAAe;AAC3B,YAAA,QAAQ,EAAE,GAAG;AACb,YAAA,cAAc,EAAE,WAAW;YAC3B,SAAS,EAAE,CAAG,EAAA,gBAAgB,CAAuB,qBAAA,CAAA;AACtD,SAAA;KACF,CAAC,EACF,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,CACrC,CAAC;AAEF,IAAA,QACEC,cAAA,CAACC,2BAAS,EAAA,EACR,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,oBAAoB,CAAC,cAAc,EAAE,aAAa,CAAC,SAAS,EAAE,IAAI,CAAA,WAAW,KAAX,IAAA,IAAA,WAAW,KAAX,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,WAAW,CAAE,IAAI,KAAI,EAAE,CAAC,CAAC;AACnG,SAAA,EAAA,CACD,EACF;AACJ,CAAC,EAAE;AAEH,OAAO,CAAC,WAAW,GAAG,SAAS;;;;"}
|
|
@@ -1,40 +1,47 @@
|
|
|
1
|
-
import { __makeTemplateObject, __assign } from 'tslib';
|
|
2
1
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { Container } from '@cleartrip/ct-design-container';
|
|
4
|
+
import { makeStyles, useStyles } from '@cleartrip/ct-design-style-manager';
|
|
5
|
+
import { keyframes } from '@emotion/css';
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
7
|
+
const MaxBorderRadiusValue = 300;
|
|
8
|
+
const shimmerKeyframes = keyframes `
|
|
9
|
+
0% { background-position: 200% 0; }
|
|
10
|
+
100% { background-position: -200% 0; }
|
|
11
|
+
`;
|
|
12
|
+
const shimmerGradient = 'linear-gradient(to right, #e0e0e0 0%, #ffffff 50%, #e0e0e0 100%)';
|
|
13
|
+
const shimmerWrapperStyles = makeStyles((theme) => ({
|
|
14
|
+
shimmerWrapper: {
|
|
15
|
+
backgroundColor: theme.color.shimmer.disabledLight || '#efefef',
|
|
16
|
+
overflow: 'hidden',
|
|
17
|
+
width: '100%',
|
|
18
|
+
height: '100%',
|
|
19
|
+
},
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
function resolveBorderRadius(shape, height, borderRadius) {
|
|
23
|
+
if (shape === 'circle') {
|
|
24
|
+
return typeof height === 'number' ? height / 2 : MaxBorderRadiusValue;
|
|
25
|
+
}
|
|
17
26
|
return borderRadius;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
}
|
|
28
|
+
const Shimmer = memo(({ width, height, shape = 'rect', borderRadius = 8, styleConfig }) => {
|
|
29
|
+
const dynamicStyles = useStyles(() => ({
|
|
30
|
+
container: {
|
|
31
|
+
width: width !== null && width !== void 0 ? width : '100%',
|
|
32
|
+
height: height !== null && height !== void 0 ? height : '100%',
|
|
33
|
+
borderRadius: resolveBorderRadius(shape, height, borderRadius),
|
|
34
|
+
background: shimmerGradient,
|
|
35
|
+
minWidth: 400,
|
|
36
|
+
backgroundSize: '150% 100%',
|
|
37
|
+
animation: `${shimmerKeyframes} 1.5s infinite linear`,
|
|
38
|
+
},
|
|
39
|
+
}), [width, height, shape, borderRadius]);
|
|
40
|
+
return (jsx(Container, { styleConfig: {
|
|
41
|
+
root: [shimmerWrapperStyles.shimmerWrapper, dynamicStyles.container, ...((styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) || [])],
|
|
42
|
+
} }));
|
|
30
43
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var Shimmer = function (_a) {
|
|
34
|
-
var _b, _c;
|
|
35
|
-
var height = _a.height, width = _a.width, _d = _a.borderRadius, borderRadius = _d === void 0 ? 0 : _d, _e = _a.children, children = _e === void 0 ? null : _e, _f = _a.styleConfig, styleConfig = _f === void 0 ? {} : _f;
|
|
36
|
-
return (jsx(StyledShimmer, __assign({ height: height, width: width, borderRadius: borderRadius, className: (_b = styleConfig.shimmerWrapper) === null || _b === void 0 ? void 0 : _b.className, css: (_c = styleConfig.shimmerWrapper) === null || _c === void 0 ? void 0 : _c.css }, { children: children })));
|
|
37
|
-
};
|
|
44
|
+
Shimmer.displayName = 'Shimmer';
|
|
38
45
|
|
|
39
46
|
export { Shimmer };
|
|
40
47
|
//# sourceMappingURL=ct-design-shimmer.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-shimmer.esm.js","sources":["../packages/components/Shimmer/src/style.ts","../packages/components/Shimmer/src/Shimmer.tsx"],"sourcesContent":[null,null],"names":["
|
|
1
|
+
{"version":3,"file":"ct-design-shimmer.esm.js","sources":["../packages/components/Shimmer/src/style.ts","../packages/components/Shimmer/src/Shimmer.tsx"],"sourcesContent":[null,null],"names":["_jsx"],"mappings":";;;;;;AASO,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAQjC,MAAM,gBAAgB,GAAG,SAAS,CAAA,CAAA;;;CAGxC,CAAC;AAMK,MAAM,eAAe,GAAG,kEAAkE,CAAC;AAQ3F,MAAM,oBAAoB,GAAG,UAAU,CAAC,CAAC,KAAK,MAAM;AACzD,IAAA,cAAc,EAAE;QACd,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,IAAI,SAAS;AAC/D,QAAA,QAAQ,EAAE,QAAiB;AAC3B,QAAA,KAAK,EAAE,MAAe;AACtB,QAAA,MAAM,EAAE,MAAe;AACxB,KAAA;AACF,CAAA,CAAC,CAAC;;ACxBH,SAAS,mBAAmB,CAC1B,KAAwB,EACxB,MAAmC,EACnC,YAAoB,EAAA;AAEpB,IAAA,IAAI,KAAK,KAAK,QAAQ,EAAE;AACtB,QAAA,OAAO,OAAO,MAAM,KAAK,QAAQ,GAAG,MAAM,GAAG,CAAC,GAAG,oBAAoB,CAAC;KACvE;AACD,IAAA,OAAO,YAAY,CAAC;AACtB,CAAC;AAiBK,MAAA,OAAO,GAAG,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,YAAY,GAAG,CAAC,EAAE,WAAW,EAAgB,KAAI;AACtG,IAAA,MAAM,aAAa,GAAG,SAAS,CAC7B,OAAO;AACL,QAAA,SAAS,EAAE;AACT,YAAA,KAAK,EAAE,KAAK,KAAA,IAAA,IAAL,KAAK,KAAL,KAAA,CAAA,GAAA,KAAK,GAAI,MAAM;AACtB,YAAA,MAAM,EAAE,MAAM,KAAA,IAAA,IAAN,MAAM,KAAN,KAAA,CAAA,GAAA,MAAM,GAAI,MAAM;YACxB,YAAY,EAAE,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC;AAC9D,YAAA,UAAU,EAAE,eAAe;AAC3B,YAAA,QAAQ,EAAE,GAAG;AACb,YAAA,cAAc,EAAE,WAAW;YAC3B,SAAS,EAAE,CAAG,EAAA,gBAAgB,CAAuB,qBAAA,CAAA;AACtD,SAAA;KACF,CAAC,EACF,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,CACrC,CAAC;AAEF,IAAA,QACEA,GAAA,CAAC,SAAS,EAAA,EACR,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,oBAAoB,CAAC,cAAc,EAAE,aAAa,CAAC,SAAS,EAAE,IAAI,CAAA,WAAW,KAAX,IAAA,IAAA,WAAW,KAAX,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,WAAW,CAAE,IAAI,KAAI,EAAE,CAAC,CAAC;AACnG,SAAA,EAAA,CACD,EACF;AACJ,CAAC,EAAE;AAEH,OAAO,CAAC,WAAW,GAAG,SAAS;;;;"}
|
|
@@ -1,89 +1,49 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})(this, (function (exports, jsxRuntime,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
26
|
-
|
|
27
|
-
var __assign = function () {
|
|
28
|
-
__assign = Object.assign || function __assign(t) {
|
|
29
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
30
|
-
s = arguments[i];
|
|
31
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
32
|
-
}
|
|
33
|
-
return t;
|
|
34
|
-
};
|
|
35
|
-
return __assign.apply(this, arguments);
|
|
36
|
-
};
|
|
37
|
-
function __makeTemplateObject(cooked, raw) {
|
|
38
|
-
if (Object.defineProperty) {
|
|
39
|
-
Object.defineProperty(cooked, "raw", {
|
|
40
|
-
value: raw
|
|
41
|
-
});
|
|
42
|
-
} else {
|
|
43
|
-
cooked.raw = raw;
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@cleartrip/ct-design-container'), require('@cleartrip/ct-design-style-manager'), require('@emotion/css')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@cleartrip/ct-design-container', '@cleartrip/ct-design-style-manager', '@emotion/css'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemShimmer = {}, global.jsxRuntime, global.React, global.ctDesignContainer, global.ctDesignStyleManager, global.css));
|
|
5
|
+
})(this, (function (exports, jsxRuntime, react, ctDesignContainer, ctDesignStyleManager, css) { 'use strict';
|
|
6
|
+
|
|
7
|
+
const MaxBorderRadiusValue = 300;
|
|
8
|
+
const shimmerKeyframes = css.keyframes `
|
|
9
|
+
0% { background-position: 200% 0; }
|
|
10
|
+
100% { background-position: -200% 0; }
|
|
11
|
+
`;
|
|
12
|
+
const shimmerGradient = 'linear-gradient(to right, #e0e0e0 0%, #ffffff 50%, #e0e0e0 100%)';
|
|
13
|
+
const shimmerWrapperStyles = ctDesignStyleManager.makeStyles((theme) => ({
|
|
14
|
+
shimmerWrapper: {
|
|
15
|
+
backgroundColor: theme.color.shimmer.disabledLight || '#efefef',
|
|
16
|
+
overflow: 'hidden',
|
|
17
|
+
width: '100%',
|
|
18
|
+
height: '100%',
|
|
19
|
+
},
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
function resolveBorderRadius(shape, height, borderRadius) {
|
|
23
|
+
if (shape === 'circle') {
|
|
24
|
+
return typeof height === 'number' ? height / 2 : MaxBorderRadiusValue;
|
|
44
25
|
}
|
|
45
|
-
return
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
var theme = _a.theme;
|
|
67
|
-
return theme.color.shimmer.disabledLight;
|
|
68
|
-
}, function (_a) {
|
|
69
|
-
var theme = _a.theme;
|
|
70
|
-
return theme.color.shimmer.disabledDark;
|
|
71
|
-
}, function (_a) {
|
|
72
|
-
var theme = _a.theme;
|
|
73
|
-
return theme.color.shimmer.disabledLight;
|
|
74
|
-
}, function (_a) {
|
|
75
|
-
var css = _a.css;
|
|
76
|
-
return css && styled.css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\t", "\n "], ["\n\t", "\n "])), css);
|
|
77
|
-
});
|
|
78
|
-
var templateObject_1, templateObject_2, templateObject_3;
|
|
79
|
-
|
|
80
|
-
var Shimmer = function (_a) {
|
|
81
|
-
var _b, _c;
|
|
82
|
-
var height = _a.height, width = _a.width, _d = _a.borderRadius, borderRadius = _d === void 0 ? 0 : _d, _e = _a.children, children = _e === void 0 ? null : _e, _f = _a.styleConfig, styleConfig = _f === void 0 ? {} : _f;
|
|
83
|
-
return (jsxRuntime.jsx(StyledShimmer, __assign({ height: height, width: width, borderRadius: borderRadius, className: (_b = styleConfig.shimmerWrapper) === null || _b === void 0 ? void 0 : _b.className, css: (_c = styleConfig.shimmerWrapper) === null || _c === void 0 ? void 0 : _c.css }, { children: children })));
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
exports.Shimmer = Shimmer;
|
|
26
|
+
return borderRadius;
|
|
27
|
+
}
|
|
28
|
+
const Shimmer = react.memo(({ width, height, shape = 'rect', borderRadius = 8, styleConfig }) => {
|
|
29
|
+
const dynamicStyles = ctDesignStyleManager.useStyles(() => ({
|
|
30
|
+
container: {
|
|
31
|
+
width: width !== null && width !== void 0 ? width : '100%',
|
|
32
|
+
height: height !== null && height !== void 0 ? height : '100%',
|
|
33
|
+
borderRadius: resolveBorderRadius(shape, height, borderRadius),
|
|
34
|
+
background: shimmerGradient,
|
|
35
|
+
minWidth: 400,
|
|
36
|
+
backgroundSize: '150% 100%',
|
|
37
|
+
animation: `${shimmerKeyframes} 1.5s infinite linear`,
|
|
38
|
+
},
|
|
39
|
+
}), [width, height, shape, borderRadius]);
|
|
40
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: {
|
|
41
|
+
root: [shimmerWrapperStyles.shimmerWrapper, dynamicStyles.container, ...((styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) || [])],
|
|
42
|
+
} }));
|
|
43
|
+
});
|
|
44
|
+
Shimmer.displayName = 'Shimmer';
|
|
45
|
+
|
|
46
|
+
exports.Shimmer = Shimmer;
|
|
87
47
|
|
|
88
48
|
}));
|
|
89
49
|
//# sourceMappingURL=ct-design-shimmer.umd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-shimmer.umd.js","sources":["../../../../node_modules/.pnpm/@rollup+plugin-typescript@9.0.2_rollup@3.29.4_tslib@2.6.3_typescript@4.9.5/node_modules/tslib/tslib.es6.js","../packages/components/Shimmer/src/style.ts","../packages/components/Shimmer/src/Shimmer.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n function next() {\r\n while (env.stack.length) {\r\n var rec = env.stack.pop();\r\n try {\r\n var result = rec.dispose && rec.dispose.call(rec.value);\r\n if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n};\r\n",null,null],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","__makeTemplateObject","cooked","raw","defineProperty","value","SuppressedError","error","suppressed","message","e","Error","name","keyframes","styled","CSS","_jsx"],"mappings":"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","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"ct-design-shimmer.umd.js","sources":["../packages/components/Shimmer/src/style.ts","../packages/components/Shimmer/src/Shimmer.tsx"],"sourcesContent":[null,null],"names":["keyframes","makeStyles","memo","useStyles","_jsx","Container"],"mappings":";;;;;;EASO,MAAM,oBAAoB,GAAG,GAAG,CAAC;EAQjC,MAAM,gBAAgB,GAAGA,aAAS,CAAA,CAAA;;;CAGxC,CAAC;EAMK,MAAM,eAAe,GAAG,kEAAkE,CAAC;EAQ3F,MAAM,oBAAoB,GAAGC,+BAAU,CAAC,CAAC,KAAK,MAAM;EACzD,IAAA,cAAc,EAAE;UACd,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,IAAI,SAAS;EAC/D,QAAA,QAAQ,EAAE,QAAiB;EAC3B,QAAA,KAAK,EAAE,MAAe;EACtB,QAAA,MAAM,EAAE,MAAe;EACxB,KAAA;EACF,CAAA,CAAC,CAAC;;ECxBH,SAAS,mBAAmB,CAC1B,KAAwB,EACxB,MAAmC,EACnC,YAAoB,EAAA;EAEpB,IAAA,IAAI,KAAK,KAAK,QAAQ,EAAE;EACtB,QAAA,OAAO,OAAO,MAAM,KAAK,QAAQ,GAAG,MAAM,GAAG,CAAC,GAAG,oBAAoB,CAAC;OACvE;EACD,IAAA,OAAO,YAAY,CAAC;EACtB,CAAC;AAiBK,QAAA,OAAO,GAAGC,UAAI,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,YAAY,GAAG,CAAC,EAAE,WAAW,EAAgB,KAAI;EACtG,IAAA,MAAM,aAAa,GAAGC,8BAAS,CAC7B,OAAO;EACL,QAAA,SAAS,EAAE;EACT,YAAA,KAAK,EAAE,KAAK,KAAA,IAAA,IAAL,KAAK,KAAL,KAAA,CAAA,GAAA,KAAK,GAAI,MAAM;EACtB,YAAA,MAAM,EAAE,MAAM,KAAA,IAAA,IAAN,MAAM,KAAN,KAAA,CAAA,GAAA,MAAM,GAAI,MAAM;cACxB,YAAY,EAAE,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC;EAC9D,YAAA,UAAU,EAAE,eAAe;EAC3B,YAAA,QAAQ,EAAE,GAAG;EACb,YAAA,cAAc,EAAE,WAAW;cAC3B,SAAS,EAAE,CAAG,EAAA,gBAAgB,CAAuB,qBAAA,CAAA;EACtD,SAAA;OACF,CAAC,EACF,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,CAAC,CACrC,CAAC;EAEF,IAAA,QACEC,cAAA,CAACC,2BAAS,EAAA,EACR,WAAW,EAAE;cACX,IAAI,EAAE,CAAC,oBAAoB,CAAC,cAAc,EAAE,aAAa,CAAC,SAAS,EAAE,IAAI,CAAA,WAAW,KAAX,IAAA,IAAA,WAAW,KAAX,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,WAAW,CAAE,IAAI,KAAI,EAAE,CAAC,CAAC;EACnG,SAAA,EAAA,CACD,EACF;EACJ,CAAC,EAAE;EAEH,OAAO,CAAC,WAAW,GAAG,SAAS;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.native.d.ts","sourceRoot":"","sources":["../packages/components/Shimmer/src/index.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACtD,cAAc,QAAQ,CAAC"}
|
package/dist/style.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
1
|
+
export declare const MaxBorderRadiusValue = 300;
|
|
2
|
+
export declare const shimmerKeyframes: string;
|
|
3
|
+
export declare const shimmerGradient = "linear-gradient(to right, #e0e0e0 0%, #ffffff 50%, #e0e0e0 100%)";
|
|
4
|
+
export declare const shimmerWrapperStyles: {
|
|
5
|
+
shimmerWrapper: {
|
|
6
|
+
backgroundColor: string;
|
|
7
|
+
overflow: "hidden";
|
|
8
|
+
width: "100%";
|
|
9
|
+
height: "100%";
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default shimmerWrapperStyles;
|
|
3
13
|
//# sourceMappingURL=style.d.ts.map
|
package/dist/style.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../packages/components/Shimmer/src/style.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../packages/components/Shimmer/src/style.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAQxC,eAAO,MAAM,gBAAgB,QAG5B,CAAC;AAMF,eAAO,MAAM,eAAe,qEAAqE,CAAC;AAQlG,eAAO,MAAM,oBAAoB;;;;;;;CAO9B,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
|
package/dist/type.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { Styles } from '@cleartrip/ct-design-types';
|
|
2
|
+
export type ShimmerShape = 'rect' | 'circle';
|
|
3
|
+
export type ShimmerVariant = 'default' | 'animated';
|
|
4
|
+
export interface IShimmerStyleConfig {
|
|
5
|
+
root?: Styles[];
|
|
6
|
+
}
|
|
4
7
|
export interface ShimmerProps {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
styleConfig?:
|
|
11
|
-
shimmerWrapper?: BaseStyleConfigProps;
|
|
12
|
-
};
|
|
8
|
+
width?: Styles['width'];
|
|
9
|
+
height?: number;
|
|
10
|
+
shape?: ShimmerShape;
|
|
11
|
+
borderRadius?: number;
|
|
12
|
+
variant?: ShimmerVariant;
|
|
13
|
+
styleConfig?: IShimmerStyleConfig;
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=type.d.ts.map
|
package/dist/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../packages/components/Shimmer/src/type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../packages/components/Shimmer/src/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAOzD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,CAAC;AAO7C,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,CAAC;AAOpD,MAAM,WAAW,mBAAmB;IAMlC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAOD,MAAM,WAAW,YAAY;IAO3B,KAAK,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAKxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAOhB,KAAK,CAAC,EAAE,YAAY,CAAC;IAKrB,YAAY,CAAC,EAAE,MAAM,CAAC;IAMtB,OAAO,CAAC,EAAE,cAAc,CAAC;IAKzB,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC"}
|
package/package.json
CHANGED
|
@@ -1,29 +1,54 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleartrip/ct-design-shimmer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-SNAPSHOT-test.0",
|
|
4
4
|
"description": "Shimmer component",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
|
-
"main": "dist/ct-design-shimmer.cjs.js",
|
|
6
|
+
"main": "./dist/ct-design-shimmer.cjs.js",
|
|
7
7
|
"jsnext:main": "dist/ct-design-shimmer.esm.js",
|
|
8
8
|
"module": "dist/ct-design-shimmer.esm.js",
|
|
9
|
+
"react-native": "src/index.native.ts",
|
|
9
10
|
"sideEffects": false,
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/ct-design-shimmer.d.ts",
|
|
14
|
+
"import": "./dist/ct-design-shimmer.esm.js",
|
|
15
|
+
"default": "./dist/ct-design-shimmer.cjs.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
10
18
|
"browser": {
|
|
11
19
|
"./dist/ct-design-shimmer.esm.js": "./dist/ct-design-shimmer.browser.esm.js",
|
|
12
20
|
"./dist/ct-design-shimmer.cjs.js": "./dist/ct-design-shimmer.browser.cjs.js"
|
|
13
21
|
},
|
|
14
22
|
"files": [
|
|
15
|
-
"dist"
|
|
23
|
+
"dist",
|
|
24
|
+
"src"
|
|
16
25
|
],
|
|
17
26
|
"dependencies": {
|
|
18
|
-
"@
|
|
27
|
+
"@emotion/css": "11.13.4",
|
|
28
|
+
"@cleartrip/ct-design-container": "4.0.0-SNAPSHOT-test.0",
|
|
29
|
+
"@cleartrip/ct-design-style-manager": "4.0.0-SNAPSHOT-test.0",
|
|
30
|
+
"@cleartrip/ct-design-theme": "4.0.0-SNAPSHOT-test.0"
|
|
19
31
|
},
|
|
20
32
|
"devDependencies": {
|
|
21
|
-
"@cleartrip/ct-design-
|
|
33
|
+
"@cleartrip/ct-design-types": "4.0.0-SNAPSHOT-test.0"
|
|
22
34
|
},
|
|
23
35
|
"peerDependencies": {
|
|
24
36
|
"react": ">=16.8.0",
|
|
25
37
|
"react-dom": ">=16.8.0",
|
|
26
|
-
"
|
|
38
|
+
"react-native": ">=0.78.0",
|
|
39
|
+
"react-native-reanimated": ">=3.0.0",
|
|
40
|
+
"react-native-linear-gradient": ">=2.8.0"
|
|
41
|
+
},
|
|
42
|
+
"peerDependenciesMeta": {
|
|
43
|
+
"react-native": {
|
|
44
|
+
"optional": true
|
|
45
|
+
},
|
|
46
|
+
"react-native-reanimated": {
|
|
47
|
+
"optional": true
|
|
48
|
+
},
|
|
49
|
+
"react-native-linear-gradient": {
|
|
50
|
+
"optional": true
|
|
51
|
+
}
|
|
27
52
|
},
|
|
28
53
|
"publishConfig": {
|
|
29
54
|
"access": "public"
|
|
@@ -34,6 +59,7 @@
|
|
|
34
59
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
35
60
|
"watch-package": "rollup -c -w",
|
|
36
61
|
"build-package": "rollup -c",
|
|
37
|
-
"build-package:clean": "rm -rf dist && rollup -c"
|
|
62
|
+
"build-package:clean": "rm -rf dist && rollup -c",
|
|
63
|
+
"publish-package:local": "yalc publish"
|
|
38
64
|
}
|
|
39
65
|
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { memo, useCallback, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Dimensions } from 'react-native';
|
|
4
|
+
import Animated, { useAnimatedStyle, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated';
|
|
5
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
6
|
+
|
|
7
|
+
import { Container } from '@cleartrip/ct-design-container';
|
|
8
|
+
import { useStyles } from '@cleartrip/ct-design-style-manager';
|
|
9
|
+
import { useTheme } from '@cleartrip/ct-design-theme';
|
|
10
|
+
|
|
11
|
+
import shimmerWrapperStyles from './style';
|
|
12
|
+
import { ShimmerProps } from './type';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The animated gradient is rendered wider than the host (1.5x the
|
|
16
|
+
* caller-supplied width) so the translateX sweep can enter from off-
|
|
17
|
+
* screen and exit cleanly without revealing the wrapper background.
|
|
18
|
+
*/
|
|
19
|
+
const SHIMMER_WIDTH_MULTIPLIER = 1.5;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Fallback radius applied when `shape='circle'` and the caller didn't
|
|
23
|
+
* provide a numeric height to halve. Large enough to full-round any
|
|
24
|
+
* realistic shimmer footprint. Mirrors the aldenui constant.
|
|
25
|
+
*/
|
|
26
|
+
const MAX_BORDER_RADIUS = 300;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Duration of a single gradient sweep, in milliseconds. Matches the
|
|
30
|
+
* aldenui timing (1.5s) so web and native animations feel identical.
|
|
31
|
+
*/
|
|
32
|
+
const SHIMMER_DURATION_MS = 1500;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Native implementation of `Shimmer`.
|
|
36
|
+
*
|
|
37
|
+
* Migrated from aldenui (`core/components/components/Shimmer`) per
|
|
38
|
+
* Migration.MD:
|
|
39
|
+
* - Keeps the reanimated driver (UI-thread `translateX` sweep) and
|
|
40
|
+
* `react-native-linear-gradient` renderer bit-for-bit from yagami,
|
|
41
|
+
* so the visual matches the original implementation.
|
|
42
|
+
* - Static wrapper styles (`overflow: hidden` + seed background)
|
|
43
|
+
* come from the shared `shimmerWrapperStyles` slot in `style.ts`;
|
|
44
|
+
* dynamic dimensions are built via `useStyles` and composed into
|
|
45
|
+
* Container's `styleConfig.root`.
|
|
46
|
+
* - `variant='default'` skips the animated transform entirely (empty
|
|
47
|
+
* style array on the wrapping `Animated.View`) so callers can opt
|
|
48
|
+
* out of motion for reduced-motion / static-screenshot scenarios.
|
|
49
|
+
*
|
|
50
|
+
* `react-native-linear-gradient` is declared as an optional peer
|
|
51
|
+
* dependency — web-only consumers won't pull it in, and RN consumers
|
|
52
|
+
* install it alongside `react-native-reanimated`.
|
|
53
|
+
*/
|
|
54
|
+
const Shimmer = memo(
|
|
55
|
+
({ width, height, shape = 'rect', borderRadius = 8, styleConfig, variant = 'animated' }: ShimmerProps) => {
|
|
56
|
+
const screenWidth = Dimensions.get('window')?.width;
|
|
57
|
+
const shimmerPosition = useSharedValue(-screenWidth);
|
|
58
|
+
const theme = useTheme();
|
|
59
|
+
|
|
60
|
+
// Drives the repeating translateX sweep. Restarting on mount / reset
|
|
61
|
+
// on unmount avoids a visual jump if the component remounts during
|
|
62
|
+
// an active animation cycle.
|
|
63
|
+
const handleAnimationSetup = useCallback(() => {
|
|
64
|
+
shimmerPosition.value = withRepeat(withTiming(screenWidth, { duration: SHIMMER_DURATION_MS }), -1, false);
|
|
65
|
+
}, [screenWidth, shimmerPosition]);
|
|
66
|
+
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
handleAnimationSetup();
|
|
69
|
+
return () => {
|
|
70
|
+
// Park the driver off-screen when we tear down so the next
|
|
71
|
+
// mount starts from a clean left-edge position.
|
|
72
|
+
shimmerPosition.value = -screenWidth;
|
|
73
|
+
};
|
|
74
|
+
}, [handleAnimationSetup, shimmerPosition, screenWidth]);
|
|
75
|
+
|
|
76
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
77
|
+
transform: [{ translateX: shimmerPosition.value }],
|
|
78
|
+
}));
|
|
79
|
+
|
|
80
|
+
const containerStyles = useStyles(() => {
|
|
81
|
+
const borderRadiusValue =
|
|
82
|
+
shape === 'circle' ? (typeof height === 'number' ? height / 2 : MAX_BORDER_RADIUS) : borderRadius;
|
|
83
|
+
|
|
84
|
+
// On native, numeric width is widened by SHIMMER_WIDTH_MULTIPLIER
|
|
85
|
+
// so the gradient has room to slide. String widths (e.g. '100%')
|
|
86
|
+
// are passed through verbatim; non-numeric values get `'100%'`.
|
|
87
|
+
const _width = typeof width === 'number' ? width * SHIMMER_WIDTH_MULTIPLIER : undefined;
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
container: {
|
|
91
|
+
borderRadius: borderRadiusValue,
|
|
92
|
+
width: _width ?? '100%',
|
|
93
|
+
height: height ?? '100%',
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}, [shape, borderRadius, height, width]);
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<Container
|
|
100
|
+
styleConfig={{
|
|
101
|
+
root: [shimmerWrapperStyles.shimmerWrapper, containerStyles.container, ...(styleConfig?.root || [])],
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
<Animated.View style={variant === 'animated' ? [animatedStyle] : []}>
|
|
105
|
+
<LinearGradient
|
|
106
|
+
colors={[
|
|
107
|
+
theme.color.shimmer.disabledLight,
|
|
108
|
+
theme.color.shimmer.disabledDark,
|
|
109
|
+
theme.color.shimmer.disabledLight,
|
|
110
|
+
]}
|
|
111
|
+
start={{ x: 0.25, y: 0.75 }}
|
|
112
|
+
end={{ x: 1, y: 0.5 }}
|
|
113
|
+
style={containerStyles.container}
|
|
114
|
+
/>
|
|
115
|
+
</Animated.View>
|
|
116
|
+
</Container>
|
|
117
|
+
);
|
|
118
|
+
},
|
|
119
|
+
);
|
|
120
|
+
|
|
121
|
+
Shimmer.displayName = 'Shimmer';
|
|
122
|
+
|
|
123
|
+
export default Shimmer;
|
package/src/Shimmer.tsx
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Container } from '@cleartrip/ct-design-container';
|
|
4
|
+
import { useStyles } from '@cleartrip/ct-design-style-manager';
|
|
5
|
+
|
|
6
|
+
import shimmerWrapperStyles, { MaxBorderRadiusValue, shimmerGradient, shimmerKeyframes } from './style';
|
|
7
|
+
import { ShimmerProps } from './type';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Resolves the border-radius applied to the wrapper based on `shape`.
|
|
11
|
+
*
|
|
12
|
+
* `circle` tries to produce a true circle/pill using `height / 2` when
|
|
13
|
+
* the caller supplied a numeric height; for string heights (e.g.
|
|
14
|
+
* `'40px'`) arithmetic would yield `NaN`, so we fall back to
|
|
15
|
+
* `MaxBorderRadiusValue` which is large enough to full-round any
|
|
16
|
+
* realistic shimmer. `rect` applies `borderRadius` directly.
|
|
17
|
+
*/
|
|
18
|
+
function resolveBorderRadius(
|
|
19
|
+
shape: 'rect' | 'circle',
|
|
20
|
+
height: number | string | undefined,
|
|
21
|
+
borderRadius: number,
|
|
22
|
+
): number {
|
|
23
|
+
if (shape === 'circle') {
|
|
24
|
+
return typeof height === 'number' ? height / 2 : MaxBorderRadiusValue;
|
|
25
|
+
}
|
|
26
|
+
return borderRadius;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Web implementation of `Shimmer`.
|
|
31
|
+
*
|
|
32
|
+
* Migrated from aldenui (`core/components/components/Shimmer`) per
|
|
33
|
+
* Migration.MD:
|
|
34
|
+
* - Drop the previous `@emotion/styled` `StyledShimmer` in favour of
|
|
35
|
+
* Container + composed `styleConfig.root` slots.
|
|
36
|
+
* - Static wrapper styles (seed background, overflow) live in
|
|
37
|
+
* `style.ts`; the animated gradient + keyframe reference is
|
|
38
|
+
* embedded into the dynamic style object built by `useStyles` so
|
|
39
|
+
* emotion caches the `@keyframes` declaration once per page and
|
|
40
|
+
* the Container's internal `useWebMergeStyles` handles the rest.
|
|
41
|
+
* - Dynamic slot holds width/height/borderRadius + animation so
|
|
42
|
+
* memoisation follows the input deps.
|
|
43
|
+
*/
|
|
44
|
+
const Shimmer = memo(({ width, height, shape = 'rect', borderRadius = 8, styleConfig }: ShimmerProps) => {
|
|
45
|
+
const dynamicStyles = useStyles(
|
|
46
|
+
() => ({
|
|
47
|
+
container: {
|
|
48
|
+
width: width ?? '100%',
|
|
49
|
+
height: height ?? '100%',
|
|
50
|
+
borderRadius: resolveBorderRadius(shape, height, borderRadius),
|
|
51
|
+
background: shimmerGradient,
|
|
52
|
+
minWidth: 400,
|
|
53
|
+
backgroundSize: '150% 100%',
|
|
54
|
+
animation: `${shimmerKeyframes} 1.5s infinite linear`,
|
|
55
|
+
},
|
|
56
|
+
}),
|
|
57
|
+
[width, height, shape, borderRadius],
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<Container
|
|
62
|
+
styleConfig={{
|
|
63
|
+
root: [shimmerWrapperStyles.shimmerWrapper, dynamicStyles.container, ...(styleConfig?.root || [])],
|
|
64
|
+
}}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
Shimmer.displayName = 'Shimmer';
|
|
70
|
+
|
|
71
|
+
export default Shimmer;
|
package/src/index.ts
ADDED
package/src/style.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { keyframes } from '@emotion/css';
|
|
2
|
+
|
|
3
|
+
import { makeStyles } from '@cleartrip/ct-design-style-manager';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* If `height` isn't supplied and `shape='circle'`, this is the fallback
|
|
7
|
+
* border-radius we clamp to — large enough to produce a full pill on
|
|
8
|
+
* any realistic shimmer footprint. Mirrors the aldenui constant.
|
|
9
|
+
*/
|
|
10
|
+
export const MaxBorderRadiusValue = 300;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Sliding-highlight keyframe. Drives the gradient across the wrapper
|
|
14
|
+
* from right to left (200% → -200%) so the bright band passes over the
|
|
15
|
+
* element once per cycle. Emotion caches the declaration per unique
|
|
16
|
+
* definition so repeated renders share a single `@keyframes` block.
|
|
17
|
+
*/
|
|
18
|
+
export const shimmerKeyframes = keyframes`
|
|
19
|
+
0% { background-position: 200% 0; }
|
|
20
|
+
100% { background-position: -200% 0; }
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Linear-gradient background string reused between the web wrapper and
|
|
25
|
+
* any animated overlay variant. Matches the aldenui palette.
|
|
26
|
+
*/
|
|
27
|
+
export const shimmerGradient = 'linear-gradient(to right, #e0e0e0 0%, #ffffff 50%, #e0e0e0 100%)';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Static wrapper styles shared by web and native. On web, seeds the
|
|
31
|
+
* animated gradient + keyframe sweep. On native, only the seed
|
|
32
|
+
* background / `overflow: hidden` slot is applied (the sliding gradient
|
|
33
|
+
* is rendered via `react-native-linear-gradient` + reanimated).
|
|
34
|
+
*/
|
|
35
|
+
export const shimmerWrapperStyles = makeStyles((theme) => ({
|
|
36
|
+
shimmerWrapper: {
|
|
37
|
+
backgroundColor: theme.color.shimmer.disabledLight || '#efefef',
|
|
38
|
+
overflow: 'hidden' as const,
|
|
39
|
+
width: '100%' as const,
|
|
40
|
+
height: '100%' as const,
|
|
41
|
+
},
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
export default shimmerWrapperStyles;
|
package/src/type.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Styles } from '@cleartrip/ct-design-types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Geometry hint for the shimmer's rounded corners. `rect` uses the
|
|
5
|
+
* `borderRadius` prop verbatim; `circle` forces a pill / full-round
|
|
6
|
+
* radius (half of `height` if provided, else `MaxBorderRadiusValue`).
|
|
7
|
+
*/
|
|
8
|
+
export type ShimmerShape = 'rect' | 'circle';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Whether the native implementation should animate the gradient slide.
|
|
12
|
+
* On web we always animate via keyframes; on native `default` renders a
|
|
13
|
+
* static gradient with no reanimated driver attached.
|
|
14
|
+
*/
|
|
15
|
+
export type ShimmerVariant = 'default' | 'animated';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `styleConfig` shape for `Shimmer`. Only the outer wrapper is exposed
|
|
19
|
+
* as a slot — callers typically just need to tweak margins, positioning
|
|
20
|
+
* or layer on an override background.
|
|
21
|
+
*/
|
|
22
|
+
export interface IShimmerStyleConfig {
|
|
23
|
+
/**
|
|
24
|
+
* Styles appended to the outer shimmer wrapper. Applied after the
|
|
25
|
+
* built-in static + dynamic slots so callers can override the shipped
|
|
26
|
+
* defaults.
|
|
27
|
+
*/
|
|
28
|
+
root?: Styles[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Props for the `Shimmer` component. Mirrors the aldenui (yagami)
|
|
33
|
+
* contract so consumers migrating from `@aldenui/components/...`
|
|
34
|
+
* retain the same call sites.
|
|
35
|
+
*/
|
|
36
|
+
export interface ShimmerProps {
|
|
37
|
+
/**
|
|
38
|
+
* Explicit width. Numbers are treated as CSS pixels on web and as
|
|
39
|
+
* layout units on native. Strings (e.g. `'100%'`, `'12rem'`) are
|
|
40
|
+
* passed through on web; on native, non-numeric strings fall back
|
|
41
|
+
* to `'100%'`.
|
|
42
|
+
*/
|
|
43
|
+
width?: Styles['width'];
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Explicit height. Same number/string semantics as `width`.
|
|
47
|
+
*/
|
|
48
|
+
height?: number;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Rounded-corner preset. `rect` applies `borderRadius` directly;
|
|
52
|
+
* `circle` forces a full pill / circle using `height / 2` when
|
|
53
|
+
* available or `MaxBorderRadiusValue` otherwise.
|
|
54
|
+
*/
|
|
55
|
+
shape?: ShimmerShape;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Corner radius in pixels for `shape='rect'`. Defaults to `8`.
|
|
59
|
+
*/
|
|
60
|
+
borderRadius?: number;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Gates the gradient sliding animation on native. Defaults to
|
|
64
|
+
* `'animated'`. Web always animates via a keyframe sweep.
|
|
65
|
+
*/
|
|
66
|
+
variant?: ShimmerVariant;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* `styleConfig` slots for fine-grained style overrides.
|
|
70
|
+
*/
|
|
71
|
+
styleConfig?: IShimmerStyleConfig;
|
|
72
|
+
}
|