@cleartrip/ct-design-divider 5.32.0-SNAPSHOT-fix-intersection-observer-v2.0 → 5.32.0-SNAPSHOT-native-main.2
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/Divider.d.ts.map +1 -1
- package/dist/Divider.native.d.ts +4 -0
- package/dist/Divider.native.d.ts.map +1 -0
- package/dist/ct-design-divider.browser.cjs.js +1 -1
- package/dist/ct-design-divider.browser.cjs.js.map +1 -1
- package/dist/ct-design-divider.browser.esm.js +1 -1
- package/dist/ct-design-divider.browser.esm.js.map +1 -1
- package/dist/ct-design-divider.cjs.js +52 -59
- package/dist/ct-design-divider.cjs.js.map +1 -1
- package/dist/ct-design-divider.esm.js +52 -59
- package/dist/ct-design-divider.esm.js.map +1 -1
- package/dist/ct-design-divider.umd.js +52 -59
- package/dist/ct-design-divider.umd.js.map +1 -1
- package/dist/type.d.ts +7 -0
- package/dist/type.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/Divider.native.tsx +91 -0
- package/src/Divider.tsx +55 -70
- package/src/type.ts +22 -0
package/dist/Divider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../packages/components/Divider/src/Divider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../packages/components/Divider/src/Divider.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAYvC,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAwDpC,CAAC;AAGF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.native.d.ts","sourceRoot":"","sources":["../packages/components/Divider/src/Divider.native.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AA6BvC,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAuDpC,CAAC;AAGF,eAAe,OAAO,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var i=require("react/jsx-runtime"),e=require("@cleartrip/ct-design-container"),r=require("@cleartrip/ct-design-style-manager");r.makeStyles(()=>({rootHorizontal:{width:"100%"},rootVertical:{height:"100%"}}));const t=({orientation:t="horizontal",dividerColor:o,dividerType:d,dividerWidth:l,dividerLength:n,styleConfig:h,height:a,width:v,borderColor:s,borderStyle:c,type:u,gradientString:g,dividerOpacity:y,css:b})=>{var p,m,C,S,w,f;const x=null!==(p=null!=l?l:a)&&void 0!==p?p:1,W=null!==(m=null!=n?n:v)&&void 0!==m?m:"100%",j=null!==(C=null!=o?o:s)&&void 0!==C?C:"#F3F3F3",k=null!==(w=null!==(S=null!=d?d:c)&&void 0!==S?S:u)&&void 0!==w?w:"solid",q=r.useStyles(i=>{const e=g?{["vertical"===t?"width":"height"]:x,["vertical"===t?"height":"width"]:W,backgroundImage:g}:function({theme:i,orientation:e,dividerColor:r,dividerType:t,dividerWidth:o,dividerLength:d}){const l=r||i.color.border.divider,n="number"==typeof o?`${o}px`:o;return"vertical"===e?{width:n,height:d,borderRightWidth:n,borderRightStyle:t,borderRightColor:l}:{width:d,borderBottomWidth:n,borderBottomStyle:t,borderBottomColor:l}}({theme:i,orientation:t,dividerColor:j,dividerType:k,dividerWidth:x,dividerLength:W});return{root:Object.assign(Object.assign({display:"block",flexShrink:0},e),void 0!==y?{opacity:y}:{})}},[t,x,W,j,k,g,y]);return i.jsx(e.Container,{styleConfig:{root:[q.root,...null!==(f=null==h?void 0:h.root)&&void 0!==f?f:[],...b?[b]:[]]}})};t.displayName="Divider",exports.Divider=t;
|
|
2
2
|
//# sourceMappingURL=ct-design-divider.browser.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-divider.browser.cjs.js","sources":["../packages/components/Divider/src/Divider.tsx"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"ct-design-divider.browser.cjs.js","sources":["../packages/components/Divider/src/style.ts","../packages/components/Divider/src/Divider.tsx"],"sourcesContent":[null,null],"names":["makeStyles","rootHorizontal","width","rootVertical","height","Divider","orientation","dividerColor","dividerType","dividerWidth","dividerLength","styleConfig","borderColor","borderStyle","type","gradientString","dividerOpacity","css","thickness","_a","length","_b","color","_c","lineStyle","_e","_d","dynamicStyles","useStyles","theme","line","backgroundImage","border","divider","widthPx","borderRightWidth","borderRightStyle","borderRightColor","borderBottomWidth","borderBottomStyle","borderBottomColor","getDividerStylesWeb","root","Object","assign","display","flexShrink","undefined","opacity","_jsx","jsx","Container","_f","displayName"],"mappings":"4IAUqBA,EAAAA,WAAW,KAAO,CACrCC,eAAgB,CACdC,MAAO,QAETC,aAAc,CACZC,OAAQ,WCCZ,MAAMC,EAAmC,EACvCC,cAAc,aACdC,eACAC,cACAC,eACAC,gBACAC,cACAP,SACAF,QACAU,cACAC,cACAC,OACAC,iBACAC,iBACAC,0BAEA,MAAMC,EAAsC,QAA1BC,EAAAV,QAAAA,EAAgBL,SAAU,IAAAe,EAAAA,EAAA,EACtCC,EAAmC,QAA1BC,EAAAX,QAAAA,EAAiBR,SAAS,IAAAmB,EAAAA,EAAA,OACnCC,EAAuC,QAA/BC,EAAAhB,QAAAA,EAAgBK,SAAe,IAAAW,EAAAA,EAAA,UACvCC,EAA8C,QAAlCC,EAA0B,QAA1BC,EAAAlB,QAAAA,EAAeK,SAAW,IAAAa,EAAAA,EAAIZ,SAAI,IAAAW,EAAAA,EAAI,QAElDE,EAAgBC,YACnBC,IACC,MAAMC,EAAOf,EACT,CACE,CAAiB,aAAhBT,EAA6B,QAAU,UAAWY,EACnD,CAAiB,aAAhBZ,EAA6B,SAAW,SAAUc,EACnDW,gBAAiBhB,GDVb,UAAoBc,MAClCA,EAAKvB,YACLA,EAAWC,aACXA,EAAYC,YACZA,EAAWC,aACXA,EAAYC,cACZA,IAEA,MAAMY,EAAQf,GAAgBsB,EAAMP,MAAMU,OAAOC,QAC3CC,EAAkC,iBAAjBzB,EAA4B,GAAGA,MAAmBA,EAEzE,MAAoB,aAAhBH,EACK,CACLJ,MAAOgC,EACP9B,OAAQM,EACRyB,iBAAkBD,EAClBE,iBAAkB5B,EAClB6B,iBAAkBf,GAGf,CACLpB,MAAOQ,EACP4B,kBAAmBJ,EACnBK,kBAAmB/B,EACnBgC,kBAAmBlB,EAEvB,CCdUmB,CAAoB,CAClBZ,QACAvB,cACAC,aAAce,EACdd,YAAagB,EACbf,aAAcS,EACdR,cAAeU,IAErB,MAAO,CACLsB,KACEC,OAAAC,OAAAD,OAAAC,OAAA,CAAAC,QAAS,QACTC,WAAY,GACThB,QACoBiB,IAAnB/B,EAA+B,CAAEgC,QAAShC,GAAmB,MAIvE,CAACV,EAAaY,EAAWE,EAAQE,EAAOE,EAAWT,EAAgBC,IAGrE,OACEiC,EAAAC,IAACC,YAAS,CACRxC,YAAa,CACX+B,KAAM,CAACf,EAAce,QAAqC,QAAjBU,EAAAzC,aAAA,EAAAA,EAAa+B,YAAI,IAAAU,EAAAA,EAAI,MAASnC,EAAM,CAACA,GAAiB,QAMvGZ,EAAQgD,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import{Container as r}from"@cleartrip/ct-design-container";import{makeStyles as t,useStyles as o}from"@cleartrip/ct-design-style-manager";t(()=>({rootHorizontal:{width:"100%"},rootVertical:{height:"100%"}}));const e=({orientation:t="horizontal",dividerColor:e,dividerType:d,dividerWidth:l,dividerLength:n,styleConfig:h,height:v,width:a,borderColor:c,borderStyle:g,type:s,gradientString:u,dividerOpacity:m,css:p})=>{var y,b,f,C,w,S;const W=null!==(y=null!=l?l:v)&&void 0!==y?y:1,x=null!==(b=null!=n?n:a)&&void 0!==b?b:"100%",j=null!==(f=null!=e?e:c)&&void 0!==f?f:"#F3F3F3",k=null!==(w=null!==(C=null!=d?d:g)&&void 0!==C?C:s)&&void 0!==w?w:"solid",B=o(i=>{const r=u?{["vertical"===t?"width":"height"]:W,["vertical"===t?"height":"width"]:x,backgroundImage:u}:function({theme:i,orientation:r,dividerColor:t,dividerType:o,dividerWidth:e,dividerLength:d}){const l=t||i.color.border.divider,n="number"==typeof e?`${e}px`:e;return"vertical"===r?{width:n,height:d,borderRightWidth:n,borderRightStyle:o,borderRightColor:l}:{width:d,borderBottomWidth:n,borderBottomStyle:o,borderBottomColor:l}}({theme:i,orientation:t,dividerColor:j,dividerType:k,dividerWidth:W,dividerLength:x});return{root:Object.assign(Object.assign({display:"block",flexShrink:0},r),void 0!==m?{opacity:m}:{})}},[t,W,x,j,k,u,m]);return i(r,{styleConfig:{root:[B.root,...null!==(S=null==h?void 0:h.root)&&void 0!==S?S:[],...p?[p]:[]]}})};e.displayName="Divider";export{e as Divider};
|
|
2
2
|
//# sourceMappingURL=ct-design-divider.browser.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-divider.browser.esm.js","sources":["../packages/components/Divider/src/Divider.tsx"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"ct-design-divider.browser.esm.js","sources":["../packages/components/Divider/src/style.ts","../packages/components/Divider/src/Divider.tsx"],"sourcesContent":[null,null],"names":["makeStyles","rootHorizontal","width","rootVertical","height","Divider","orientation","dividerColor","dividerType","dividerWidth","dividerLength","styleConfig","borderColor","borderStyle","type","gradientString","dividerOpacity","css","thickness","_a","length","_b","color","_c","lineStyle","_e","_d","dynamicStyles","useStyles","theme","line","backgroundImage","border","divider","widthPx","borderRightWidth","borderRightStyle","borderRightColor","borderBottomWidth","borderBottomStyle","borderBottomColor","getDividerStylesWeb","root","Object","assign","display","flexShrink","undefined","opacity","_jsx","Container","_f","displayName"],"mappings":"kLAUqBA,EAAW,KAAO,CACrCC,eAAg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C,QAAShC,GAAmB,MAIvE,CAACV,EAAaY,EAAWE,EAAQE,EAAOE,EAAWT,EAAgBC,IAGrE,OACEiC,EAACC,EAAS,CACRvC,YAAa,CACX+B,KAAM,CAACf,EAAce,QAAqC,QAAjBS,EAAAxC,aAAA,EAAAA,EAAa+B,YAAI,IAAAS,EAAAA,EAAI,MAASlC,EAAM,CAACA,GAAiB,QAMvGZ,EAAQ+C,YAAc"}
|
|
@@ -4,69 +4,62 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var ctDesignContainer = require('@cleartrip/ct-design-container');
|
|
5
5
|
var ctDesignStyleManager = require('@cleartrip/ct-design-style-manager');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
ctDesignStyleManager.makeStyles(() => ({
|
|
8
|
+
rootHorizontal: {
|
|
9
|
+
width: '100%',
|
|
10
|
+
},
|
|
11
|
+
rootVertical: {
|
|
12
|
+
height: '100%',
|
|
13
|
+
},
|
|
14
|
+
}));
|
|
15
|
+
function getDividerStylesWeb({ theme, orientation, dividerColor, dividerType, dividerWidth, dividerLength, }) {
|
|
16
|
+
const color = dividerColor || theme.color.border.divider;
|
|
17
|
+
const widthPx = typeof dividerWidth === 'number' ? `${dividerWidth}px` : dividerWidth;
|
|
18
|
+
if (orientation === 'vertical') {
|
|
19
|
+
return {
|
|
20
|
+
width: widthPx,
|
|
21
|
+
height: dividerLength,
|
|
22
|
+
borderRightWidth: widthPx,
|
|
23
|
+
borderRightStyle: dividerType,
|
|
24
|
+
borderRightColor: color,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
8
27
|
return {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
overflow: 'hidden',
|
|
14
|
-
},
|
|
15
|
-
vertical: {
|
|
16
|
-
margin: -theme.spacing[0.5],
|
|
17
|
-
marginLeft: theme.spacing[0.5],
|
|
18
|
-
width: 1,
|
|
19
|
-
},
|
|
20
|
-
horizontal: {
|
|
21
|
-
margin: -theme.spacing[0.5],
|
|
22
|
-
marginTop: theme.spacing[0.5],
|
|
23
|
-
height: 1,
|
|
24
|
-
},
|
|
25
|
-
flex: {
|
|
26
|
-
flex: 1,
|
|
27
|
-
},
|
|
28
|
-
flexRow: {
|
|
29
|
-
flexDirection: 'row',
|
|
30
|
-
},
|
|
28
|
+
width: dividerLength,
|
|
29
|
+
borderBottomWidth: widthPx,
|
|
30
|
+
borderBottomStyle: dividerType,
|
|
31
|
+
borderBottomColor: color,
|
|
31
32
|
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
height: '100%',
|
|
56
|
-
};
|
|
57
|
-
defaultMaskStyle = {
|
|
58
|
-
borderWidth: dividerWidth,
|
|
59
|
-
borderColor: dividerColor,
|
|
60
|
-
borderStyle: dividerType,
|
|
61
|
-
height: dividerLength,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const Divider = ({ orientation = 'horizontal', dividerColor, dividerType, dividerWidth, dividerLength, styleConfig, height, width, borderColor, borderStyle, type, gradientString, dividerOpacity, css, }) => {
|
|
36
|
+
var _a, _b, _c, _d, _e, _f;
|
|
37
|
+
const thickness = (_a = dividerWidth !== null && dividerWidth !== void 0 ? dividerWidth : height) !== null && _a !== void 0 ? _a : 1;
|
|
38
|
+
const length = (_b = dividerLength !== null && dividerLength !== void 0 ? dividerLength : width) !== null && _b !== void 0 ? _b : '100%';
|
|
39
|
+
const color = (_c = dividerColor !== null && dividerColor !== void 0 ? dividerColor : borderColor) !== null && _c !== void 0 ? _c : '#F3F3F3';
|
|
40
|
+
const lineStyle = (_e = (_d = dividerType !== null && dividerType !== void 0 ? dividerType : borderStyle) !== null && _d !== void 0 ? _d : type) !== null && _e !== void 0 ? _e : 'solid';
|
|
41
|
+
const dynamicStyles = ctDesignStyleManager.useStyles((theme) => {
|
|
42
|
+
const line = gradientString
|
|
43
|
+
? {
|
|
44
|
+
[orientation === 'vertical' ? 'width' : 'height']: thickness,
|
|
45
|
+
[orientation === 'vertical' ? 'height' : 'width']: length,
|
|
46
|
+
backgroundImage: gradientString,
|
|
47
|
+
}
|
|
48
|
+
: getDividerStylesWeb({
|
|
49
|
+
theme,
|
|
50
|
+
orientation,
|
|
51
|
+
dividerColor: color,
|
|
52
|
+
dividerType: lineStyle,
|
|
53
|
+
dividerWidth: thickness,
|
|
54
|
+
dividerLength: length,
|
|
55
|
+
});
|
|
64
56
|
return {
|
|
65
|
-
|
|
66
|
-
defaultMaskStyle,
|
|
57
|
+
root: Object.assign(Object.assign({ display: 'block', flexShrink: 0 }, line), (dividerOpacity !== undefined ? { opacity: dividerOpacity } : {})),
|
|
67
58
|
};
|
|
68
|
-
}, [
|
|
69
|
-
return (jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: {
|
|
59
|
+
}, [orientation, thickness, length, color, lineStyle, gradientString, dividerOpacity]);
|
|
60
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: {
|
|
61
|
+
root: [dynamicStyles.root, ...((_f = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) !== null && _f !== void 0 ? _f : []), ...(css ? [css] : [])],
|
|
62
|
+
} }));
|
|
70
63
|
};
|
|
71
64
|
Divider.displayName = 'Divider';
|
|
72
65
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-divider.cjs.js","sources":["../packages/components/Divider/src/Divider.tsx"],"sourcesContent":[null],"names":["makeStyles","useStyles","_jsx","Container"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"ct-design-divider.cjs.js","sources":["../packages/components/Divider/src/style.ts","../packages/components/Divider/src/Divider.tsx"],"sourcesContent":[null,null],"names":["makeStyles","useStyles","_jsx","Container"],"mappings":";;;;;;AAUqBA,+BAAU,CAAC,OAAO;AACrC,IAAA,cAAc,EAAE;AACd,QAAA,KAAK,EAAE,MAAM;AACd,KAAA;AACD,IAAA,YAAY,EAAE;AACZ,QAAA,MAAM,EAAE,MAAM;AACf,KAAA;AACF,CAAA,CAAC,EAAE;AAgBY,SAAA,mBAAmB,CAAC,EAClC,KAAK,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,GACY,EAAA;IACzB,MAAM,KAAK,GAAG,YAAY,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;AACzD,IAAA,MAAM,OAAO,GAAG,OAAO,YAAY,KAAK,QAAQ,GAAG,CAAA,EAAG,YAAY,CAAI,EAAA,CAAA,GAAG,YAAY,CAAC;AAEtF,IAAA,IAAI,WAAW,KAAK,UAAU,EAAE;QAC9B,OAAO;AACL,YAAA,KAAK,EAAE,OAAO;AACd,YAAA,MAAM,EAAE,aAAa;AACrB,YAAA,gBAAgB,EAAE,OAAO;AACzB,YAAA,gBAAgB,EAAE,WAAW;AAC7B,YAAA,gBAAgB,EAAE,KAAK;SACxB,CAAC;KACH;IACD,OAAO;AACL,QAAA,KAAK,EAAE,aAAa;AACpB,QAAA,iBAAiB,EAAE,OAAO;AAC1B,QAAA,iBAAiB,EAAE,WAAW;AAC9B,QAAA,iBAAiB,EAAE,KAAK;KACzB,CAAC;AACJ;;AC3CA,MAAM,OAAO,GAA4B,CAAC,EACxC,WAAW,GAAG,YAAY,EAC1B,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,EACb,WAAW,EACX,MAAM,EACN,KAAK,EACL,WAAW,EACX,WAAW,EACX,IAAI,EACJ,cAAc,EACd,cAAc,EACd,GAAG,GACJ,KAAI;;AACH,IAAA,MAAM,SAAS,GAAG,CAAA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tB,gBAAA,YAAY,EAAE,SAAS;AACvB,gBAAA,aAAa,EAAE,MAAM;AACtB,aAAA,CAAC,CAAC;QACP,OAAO;AACL,YAAA,IAAI,EACF,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,CAAC,EACV,EAAA,IAAI,CACJ,GAAC,cAAc,KAAK,SAAS,GAAG,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,EACpE;SACF,CAAC;AACJ,KAAC,EACD,CAAC,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,CAAC,CACnF,CAAC;AAEF,IAAA,QACEC,cAAA,CAACC,2BAAS,EAAA,EACR,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,CAAC,aAAa,CAAC,IAAc,EAAE,IAAI,CAAA,EAAA,GAAA,WAAW,KAAX,IAAA,IAAA,WAAW,KAAX,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,WAAW,CAAE,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,EAAE,CAAC,EAAE,IAAI,GAAG,GAAG,CAAC,GAAa,CAAC,GAAG,EAAE,CAAC,CAAC;AACpG,SAAA,EAAA,CACD,EACF;AACJ,EAAE;AAEF,OAAO,CAAC,WAAW,GAAG,SAAS;;;;"}
|
|
@@ -2,69 +2,62 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { Container } from '@cleartrip/ct-design-container';
|
|
3
3
|
import { makeStyles, useStyles } from '@cleartrip/ct-design-style-manager';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
makeStyles(() => ({
|
|
6
|
+
rootHorizontal: {
|
|
7
|
+
width: '100%',
|
|
8
|
+
},
|
|
9
|
+
rootVertical: {
|
|
10
|
+
height: '100%',
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
function getDividerStylesWeb({ theme, orientation, dividerColor, dividerType, dividerWidth, dividerLength, }) {
|
|
14
|
+
const color = dividerColor || theme.color.border.divider;
|
|
15
|
+
const widthPx = typeof dividerWidth === 'number' ? `${dividerWidth}px` : dividerWidth;
|
|
16
|
+
if (orientation === 'vertical') {
|
|
17
|
+
return {
|
|
18
|
+
width: widthPx,
|
|
19
|
+
height: dividerLength,
|
|
20
|
+
borderRightWidth: widthPx,
|
|
21
|
+
borderRightStyle: dividerType,
|
|
22
|
+
borderRightColor: color,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
6
25
|
return {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
overflow: 'hidden',
|
|
12
|
-
},
|
|
13
|
-
vertical: {
|
|
14
|
-
margin: -theme.spacing[0.5],
|
|
15
|
-
marginLeft: theme.spacing[0.5],
|
|
16
|
-
width: 1,
|
|
17
|
-
},
|
|
18
|
-
horizontal: {
|
|
19
|
-
margin: -theme.spacing[0.5],
|
|
20
|
-
marginTop: theme.spacing[0.5],
|
|
21
|
-
height: 1,
|
|
22
|
-
},
|
|
23
|
-
flex: {
|
|
24
|
-
flex: 1,
|
|
25
|
-
},
|
|
26
|
-
flexRow: {
|
|
27
|
-
flexDirection: 'row',
|
|
28
|
-
},
|
|
26
|
+
width: dividerLength,
|
|
27
|
+
borderBottomWidth: widthPx,
|
|
28
|
+
borderBottomStyle: dividerType,
|
|
29
|
+
borderBottomColor: color,
|
|
29
30
|
};
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
height: '100%',
|
|
54
|
-
};
|
|
55
|
-
defaultMaskStyle = {
|
|
56
|
-
borderWidth: dividerWidth,
|
|
57
|
-
borderColor: dividerColor,
|
|
58
|
-
borderStyle: dividerType,
|
|
59
|
-
height: dividerLength,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const Divider = ({ orientation = 'horizontal', dividerColor, dividerType, dividerWidth, dividerLength, styleConfig, height, width, borderColor, borderStyle, type, gradientString, dividerOpacity, css, }) => {
|
|
34
|
+
var _a, _b, _c, _d, _e, _f;
|
|
35
|
+
const thickness = (_a = dividerWidth !== null && dividerWidth !== void 0 ? dividerWidth : height) !== null && _a !== void 0 ? _a : 1;
|
|
36
|
+
const length = (_b = dividerLength !== null && dividerLength !== void 0 ? dividerLength : width) !== null && _b !== void 0 ? _b : '100%';
|
|
37
|
+
const color = (_c = dividerColor !== null && dividerColor !== void 0 ? dividerColor : borderColor) !== null && _c !== void 0 ? _c : '#F3F3F3';
|
|
38
|
+
const lineStyle = (_e = (_d = dividerType !== null && dividerType !== void 0 ? dividerType : borderStyle) !== null && _d !== void 0 ? _d : type) !== null && _e !== void 0 ? _e : 'solid';
|
|
39
|
+
const dynamicStyles = useStyles((theme) => {
|
|
40
|
+
const line = gradientString
|
|
41
|
+
? {
|
|
42
|
+
[orientation === 'vertical' ? 'width' : 'height']: thickness,
|
|
43
|
+
[orientation === 'vertical' ? 'height' : 'width']: length,
|
|
44
|
+
backgroundImage: gradientString,
|
|
45
|
+
}
|
|
46
|
+
: getDividerStylesWeb({
|
|
47
|
+
theme,
|
|
48
|
+
orientation,
|
|
49
|
+
dividerColor: color,
|
|
50
|
+
dividerType: lineStyle,
|
|
51
|
+
dividerWidth: thickness,
|
|
52
|
+
dividerLength: length,
|
|
53
|
+
});
|
|
62
54
|
return {
|
|
63
|
-
|
|
64
|
-
defaultMaskStyle,
|
|
55
|
+
root: Object.assign(Object.assign({ display: 'block', flexShrink: 0 }, line), (dividerOpacity !== undefined ? { opacity: dividerOpacity } : {})),
|
|
65
56
|
};
|
|
66
|
-
}, [
|
|
67
|
-
return (jsx(Container, { styleConfig: {
|
|
57
|
+
}, [orientation, thickness, length, color, lineStyle, gradientString, dividerOpacity]);
|
|
58
|
+
return (jsx(Container, { styleConfig: {
|
|
59
|
+
root: [dynamicStyles.root, ...((_f = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) !== null && _f !== void 0 ? _f : []), ...(css ? [css] : [])],
|
|
60
|
+
} }));
|
|
68
61
|
};
|
|
69
62
|
Divider.displayName = 'Divider';
|
|
70
63
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-divider.esm.js","sources":["../packages/components/Divider/src/Divider.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"ct-design-divider.esm.js","sources":["../packages/components/Divider/src/style.ts","../packages/components/Divider/src/Divider.tsx"],"sourcesContent":[null,null],"names":["_jsx"],"mappings":";;;;AAUqB,UAAU,CAAC,OAAO;AACrC,IAAA,cAAc,EAAE;AACd,QAAA,KAAK,EAAE,MAAM;AACd,KAAA;AACD,IAAA,YAAY,EAAE;AACZ,QAAA,MAAM,EAAE,MAAM;AACf,KAAA;AACF,CAAA,CAAC,EAAE;AAgBY,SAAA,mBAAmB,CAAC,EAClC,KAAK,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,GACY,EAAA;IACzB,MAAM,KAAK,GAAG,YAAY,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;AACzD,IAAA,MAAM,OAAO,GAAG,OAAO,YAAY,KAAK,QAAQ,GAAG,CAAA,EAAG,YAAY,CAAI,EAAA,CAAA,GAAG,YAAY,CAAC;AAEtF,IAAA,IAAI,WAAW,KAAK,UAAU,EAAE;QAC9B,OAAO;AACL,YAAA,KAAK,EAAE,OAAO;AACd,YAAA,MAAM,EAAE,aAAa;AACrB,YAAA,gBA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AAI,EAAE,CAAC,EAAE,IAAI,GAAG,GAAG,CAAC,GAAa,CAAC,GAAG,EAAE,CAAC,CAAC;AACpG,SAAA,EAAA,CACD,EACF;AACJ,EAAE;AAEF,OAAO,CAAC,WAAW,GAAG,SAAS;;;;"}
|
|
@@ -4,69 +4,62 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemDivider = {}, global.jsxRuntime, global.ctDesignContainer, global.ctDesignStyleManager));
|
|
5
5
|
})(this, (function (exports, jsxRuntime, ctDesignContainer, ctDesignStyleManager) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
ctDesignStyleManager.makeStyles(() => ({
|
|
8
|
+
rootHorizontal: {
|
|
9
|
+
width: '100%',
|
|
10
|
+
},
|
|
11
|
+
rootVertical: {
|
|
12
|
+
height: '100%',
|
|
13
|
+
},
|
|
14
|
+
}));
|
|
15
|
+
function getDividerStylesWeb({ theme, orientation, dividerColor, dividerType, dividerWidth, dividerLength, }) {
|
|
16
|
+
const color = dividerColor || theme.color.border.divider;
|
|
17
|
+
const widthPx = typeof dividerWidth === 'number' ? `${dividerWidth}px` : dividerWidth;
|
|
18
|
+
if (orientation === 'vertical') {
|
|
19
|
+
return {
|
|
20
|
+
width: widthPx,
|
|
21
|
+
height: dividerLength,
|
|
22
|
+
borderRightWidth: widthPx,
|
|
23
|
+
borderRightStyle: dividerType,
|
|
24
|
+
borderRightColor: color,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
8
27
|
return {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
overflow: 'hidden',
|
|
14
|
-
},
|
|
15
|
-
vertical: {
|
|
16
|
-
margin: -theme.spacing[0.5],
|
|
17
|
-
marginLeft: theme.spacing[0.5],
|
|
18
|
-
width: 1,
|
|
19
|
-
},
|
|
20
|
-
horizontal: {
|
|
21
|
-
margin: -theme.spacing[0.5],
|
|
22
|
-
marginTop: theme.spacing[0.5],
|
|
23
|
-
height: 1,
|
|
24
|
-
},
|
|
25
|
-
flex: {
|
|
26
|
-
flex: 1,
|
|
27
|
-
},
|
|
28
|
-
flexRow: {
|
|
29
|
-
flexDirection: 'row',
|
|
30
|
-
},
|
|
28
|
+
width: dividerLength,
|
|
29
|
+
borderBottomWidth: widthPx,
|
|
30
|
+
borderBottomStyle: dividerType,
|
|
31
|
+
borderBottomColor: color,
|
|
31
32
|
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
height: '100%',
|
|
56
|
-
};
|
|
57
|
-
defaultMaskStyle = {
|
|
58
|
-
borderWidth: dividerWidth,
|
|
59
|
-
borderColor: dividerColor,
|
|
60
|
-
borderStyle: dividerType,
|
|
61
|
-
height: dividerLength,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const Divider = ({ orientation = 'horizontal', dividerColor, dividerType, dividerWidth, dividerLength, styleConfig, height, width, borderColor, borderStyle, type, gradientString, dividerOpacity, css, }) => {
|
|
36
|
+
var _a, _b, _c, _d, _e, _f;
|
|
37
|
+
const thickness = (_a = dividerWidth !== null && dividerWidth !== void 0 ? dividerWidth : height) !== null && _a !== void 0 ? _a : 1;
|
|
38
|
+
const length = (_b = dividerLength !== null && dividerLength !== void 0 ? dividerLength : width) !== null && _b !== void 0 ? _b : '100%';
|
|
39
|
+
const color = (_c = dividerColor !== null && dividerColor !== void 0 ? dividerColor : borderColor) !== null && _c !== void 0 ? _c : '#F3F3F3';
|
|
40
|
+
const lineStyle = (_e = (_d = dividerType !== null && dividerType !== void 0 ? dividerType : borderStyle) !== null && _d !== void 0 ? _d : type) !== null && _e !== void 0 ? _e : 'solid';
|
|
41
|
+
const dynamicStyles = ctDesignStyleManager.useStyles((theme) => {
|
|
42
|
+
const line = gradientString
|
|
43
|
+
? {
|
|
44
|
+
[orientation === 'vertical' ? 'width' : 'height']: thickness,
|
|
45
|
+
[orientation === 'vertical' ? 'height' : 'width']: length,
|
|
46
|
+
backgroundImage: gradientString,
|
|
47
|
+
}
|
|
48
|
+
: getDividerStylesWeb({
|
|
49
|
+
theme,
|
|
50
|
+
orientation,
|
|
51
|
+
dividerColor: color,
|
|
52
|
+
dividerType: lineStyle,
|
|
53
|
+
dividerWidth: thickness,
|
|
54
|
+
dividerLength: length,
|
|
55
|
+
});
|
|
64
56
|
return {
|
|
65
|
-
|
|
66
|
-
defaultMaskStyle,
|
|
57
|
+
root: Object.assign(Object.assign({ display: 'block', flexShrink: 0 }, line), (dividerOpacity !== undefined ? { opacity: dividerOpacity } : {})),
|
|
67
58
|
};
|
|
68
|
-
}, [
|
|
69
|
-
return (jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: {
|
|
59
|
+
}, [orientation, thickness, length, color, lineStyle, gradientString, dividerOpacity]);
|
|
60
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: {
|
|
61
|
+
root: [dynamicStyles.root, ...((_f = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) !== null && _f !== void 0 ? _f : []), ...(css ? [css] : [])],
|
|
62
|
+
} }));
|
|
70
63
|
};
|
|
71
64
|
Divider.displayName = 'Divider';
|
|
72
65
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-divider.umd.js","sources":["../packages/components/Divider/src/Divider.tsx"],"sourcesContent":[null],"names":["makeStyles","useStyles","_jsx","Container"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"ct-design-divider.umd.js","sources":["../packages/components/Divider/src/style.ts","../packages/components/Divider/src/Divider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aAAa,EAAE,MAAM;IACtB,aAAA,CAAC,CAAC;YACP,OAAO;IACL,YAAA,IAAI,EACF,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,CAAC,EACV,EAAA,IAAI,CACJ,GAAC,cAAc,KAAK,SAAS,GAAG,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,EAAE,EACpE;aACF,CAAC;IACJ,KAAC,EACD,CAAC,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,CAAC,CACnF,CAAC;IAEF,IAAA,QACEC,cAAA,CAACC,2BAAS,EAAA,EACR,WAAW,EAAE;IACX,YAAA,IAAI,EAAE,CAAC,aAAa,CAAC,IAAc,EAAE,IAAI,CAAA,EAAA,GAAA,WAAW,KAAX,IAAA,IAAA,WAAW,KAAX,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,WAAW,CAAE,IAAI,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAI,EAAE,CAAC,EAAE,IAAI,GAAG,GAAG,CAAC,GAAa,CAAC,GAAG,EAAE,CAAC,CAAC;IACpG,SAAA,EAAA,CACD,EACF;IACJ,EAAE;IAEF,OAAO,CAAC,WAAW,GAAG,SAAS;;;;;;;;"}
|
package/dist/type.d.ts
CHANGED
|
@@ -11,6 +11,13 @@ export interface IDividerProps {
|
|
|
11
11
|
dividerWidth?: number;
|
|
12
12
|
dividerLength?: number;
|
|
13
13
|
styleConfig?: IDividerStyleConfig;
|
|
14
|
+
height?: number | string;
|
|
15
|
+
width?: number | string;
|
|
16
|
+
borderColor?: string;
|
|
17
|
+
borderStyle?: DividerLineStyle;
|
|
18
|
+
type?: DividerLineStyle;
|
|
19
|
+
gradientString?: string;
|
|
20
|
+
dividerOpacity?: number;
|
|
14
21
|
}
|
|
15
22
|
export type DividerProps = IDividerProps;
|
|
16
23
|
//# 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/Divider/src/type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../packages/components/Divider/src/type.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAAC;AAC3D,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7D,MAAM,WAAW,mBAAmB;IAElC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAE5B,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAGjC,YAAY,CAAC,EAAE,MAAM,CAAC;IAGtB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAO/B,YAAY,CAAC,EAAE,MAAM,CAAC;IAMtB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAQlC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAExB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAE/B,IAAI,CAAC,EAAE,gBAAgB,CAAC;IAExB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAMD,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleartrip/ct-design-divider",
|
|
3
|
-
"version": "5.32.0-SNAPSHOT-
|
|
3
|
+
"version": "5.32.0-SNAPSHOT-native-main.2",
|
|
4
4
|
"description": "Divider Component",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "./dist/ct-design-divider.cjs.js",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"src"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@cleartrip/ct-design-
|
|
28
|
-
"@cleartrip/ct-design-
|
|
29
|
-
"@cleartrip/ct-design-theme": "5.32.0-SNAPSHOT-
|
|
27
|
+
"@cleartrip/ct-design-style-manager": "5.32.0-SNAPSHOT-native-main.2",
|
|
28
|
+
"@cleartrip/ct-design-container": "5.32.0-SNAPSHOT-native-main.2",
|
|
29
|
+
"@cleartrip/ct-design-theme": "5.32.0-SNAPSHOT-native-main.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@cleartrip/ct-design-types": "5.32.0-SNAPSHOT-
|
|
32
|
+
"@cleartrip/ct-design-types": "5.32.0-SNAPSHOT-native-main.2"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": ">=16.8.0",
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Container } from '@cleartrip/ct-design-container';
|
|
2
|
+
import { makeStyles, useStyles } from '@cleartrip/ct-design-style-manager';
|
|
3
|
+
|
|
4
|
+
import { IDividerProps } from './type';
|
|
5
|
+
|
|
6
|
+
const solidBorderStyles = makeStyles((theme) => {
|
|
7
|
+
return {
|
|
8
|
+
container: {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
justifyContent: 'center',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
overflow: 'hidden',
|
|
13
|
+
},
|
|
14
|
+
vertical: {
|
|
15
|
+
margin: -theme.spacing[0.5],
|
|
16
|
+
marginLeft: theme.spacing[0.5],
|
|
17
|
+
width: 1,
|
|
18
|
+
},
|
|
19
|
+
horizontal: {
|
|
20
|
+
margin: -theme.spacing[0.5],
|
|
21
|
+
marginTop: theme.spacing[0.5],
|
|
22
|
+
height: 1,
|
|
23
|
+
},
|
|
24
|
+
flex: {
|
|
25
|
+
flex: 1,
|
|
26
|
+
},
|
|
27
|
+
flexRow: {
|
|
28
|
+
flexDirection: 'row',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const Divider: React.FC<IDividerProps> = ({
|
|
34
|
+
dividerColor = '#F3F3F3',
|
|
35
|
+
dividerType = 'solid',
|
|
36
|
+
dividerWidth = 1.5,
|
|
37
|
+
orientation = 'horizontal',
|
|
38
|
+
dividerLength = '100%',
|
|
39
|
+
styleConfig,
|
|
40
|
+
}) => {
|
|
41
|
+
const dividerDynamicStyles = useStyles(
|
|
42
|
+
(theme) => {
|
|
43
|
+
let defaultContainerStyle = {};
|
|
44
|
+
let defaultMaskStyle = {};
|
|
45
|
+
|
|
46
|
+
if (orientation === 'horizontal') {
|
|
47
|
+
defaultContainerStyle = {
|
|
48
|
+
height: dividerWidth + 1,
|
|
49
|
+
width: '100%',
|
|
50
|
+
flexDirection: 'row',
|
|
51
|
+
flex: 1,
|
|
52
|
+
};
|
|
53
|
+
defaultMaskStyle = {
|
|
54
|
+
borderWidth: dividerWidth,
|
|
55
|
+
borderColor: dividerColor || theme.color.border.neutral,
|
|
56
|
+
borderStyle: dividerType,
|
|
57
|
+
width: dividerLength,
|
|
58
|
+
};
|
|
59
|
+
} else {
|
|
60
|
+
defaultContainerStyle = {
|
|
61
|
+
width: dividerWidth + 1,
|
|
62
|
+
height: '100%',
|
|
63
|
+
};
|
|
64
|
+
defaultMaskStyle = {
|
|
65
|
+
borderWidth: dividerWidth,
|
|
66
|
+
borderColor: dividerColor,
|
|
67
|
+
borderStyle: dividerType,
|
|
68
|
+
height: dividerLength,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
defaultContainerStyle,
|
|
73
|
+
defaultMaskStyle,
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
[dividerWidth, dividerColor, dividerType, dividerLength],
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<Container
|
|
81
|
+
styleConfig={{ root: [solidBorderStyles.flex, solidBorderStyles.flexRow, ...(styleConfig?.root ?? [])] }}
|
|
82
|
+
>
|
|
83
|
+
<Container styleConfig={{ root: [solidBorderStyles.container, dividerDynamicStyles.defaultContainerStyle] }}>
|
|
84
|
+
<Container styleConfig={{ root: [solidBorderStyles[orientation], dividerDynamicStyles.defaultMaskStyle] }} />
|
|
85
|
+
</Container>
|
|
86
|
+
</Container>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
Divider.displayName = 'Divider';
|
|
91
|
+
export default Divider;
|
package/src/Divider.tsx
CHANGED
|
@@ -1,89 +1,74 @@
|
|
|
1
1
|
import { Container } from '@cleartrip/ct-design-container';
|
|
2
|
-
import {
|
|
2
|
+
import { useStyles } from '@cleartrip/ct-design-style-manager';
|
|
3
|
+
import { Styles } from '@cleartrip/ct-design-types';
|
|
3
4
|
|
|
4
5
|
import { IDividerProps } from './type';
|
|
6
|
+
import { getDividerStylesWeb } from './style';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
margin: -theme.spacing[0.5],
|
|
16
|
-
marginLeft: theme.spacing[0.5],
|
|
17
|
-
width: 1,
|
|
18
|
-
},
|
|
19
|
-
horizontal: {
|
|
20
|
-
margin: -theme.spacing[0.5],
|
|
21
|
-
marginTop: theme.spacing[0.5],
|
|
22
|
-
height: 1,
|
|
23
|
-
},
|
|
24
|
-
flex: {
|
|
25
|
-
flex: 1,
|
|
26
|
-
},
|
|
27
|
-
flexRow: {
|
|
28
|
-
flexDirection: 'row',
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Web `Divider`: a single element with a one-sided border, like the v2
|
|
10
|
+
* styled `div` (`border-bottom: <height> <color> <style>`), via
|
|
11
|
+
* `getDividerStylesWeb`. The native file draws the line with a clipped,
|
|
12
|
+
* fully-bordered mask; on web that leaves at most a sliver of the (light)
|
|
13
|
+
* border visible. The v2 props (`height`, `width`, `borderColor`,
|
|
14
|
+
* `borderStyle`/`type`, `gradientString`, `dividerOpacity`, `css`) are still
|
|
15
|
+
* honoured so migrated call sites keep their look.
|
|
16
|
+
*/
|
|
33
17
|
const Divider: React.FC<IDividerProps> = ({
|
|
34
|
-
dividerColor = '#F3F3F3',
|
|
35
|
-
dividerType = 'solid',
|
|
36
|
-
dividerWidth = 1.5,
|
|
37
18
|
orientation = 'horizontal',
|
|
38
|
-
|
|
19
|
+
dividerColor,
|
|
20
|
+
dividerType,
|
|
21
|
+
dividerWidth,
|
|
22
|
+
dividerLength,
|
|
39
23
|
styleConfig,
|
|
24
|
+
height,
|
|
25
|
+
width,
|
|
26
|
+
borderColor,
|
|
27
|
+
borderStyle,
|
|
28
|
+
type,
|
|
29
|
+
gradientString,
|
|
30
|
+
dividerOpacity,
|
|
31
|
+
css,
|
|
40
32
|
}) => {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
const thickness = dividerWidth ?? height ?? 1;
|
|
34
|
+
const length = dividerLength ?? width ?? '100%';
|
|
35
|
+
const color = dividerColor ?? borderColor ?? '#F3F3F3';
|
|
36
|
+
const lineStyle = dividerType ?? borderStyle ?? type ?? 'solid';
|
|
45
37
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
height: '100%',
|
|
63
|
-
};
|
|
64
|
-
defaultMaskStyle = {
|
|
65
|
-
borderWidth: dividerWidth,
|
|
66
|
-
borderColor: dividerColor,
|
|
67
|
-
borderStyle: dividerType,
|
|
68
|
-
height: dividerLength,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
38
|
+
const dynamicStyles = useStyles(
|
|
39
|
+
(theme) => {
|
|
40
|
+
const line = gradientString
|
|
41
|
+
? {
|
|
42
|
+
[orientation === 'vertical' ? 'width' : 'height']: thickness,
|
|
43
|
+
[orientation === 'vertical' ? 'height' : 'width']: length,
|
|
44
|
+
backgroundImage: gradientString,
|
|
45
|
+
}
|
|
46
|
+
: getDividerStylesWeb({
|
|
47
|
+
theme,
|
|
48
|
+
orientation,
|
|
49
|
+
dividerColor: color,
|
|
50
|
+
dividerType: lineStyle,
|
|
51
|
+
dividerWidth: thickness,
|
|
52
|
+
dividerLength: length,
|
|
53
|
+
});
|
|
71
54
|
return {
|
|
72
|
-
|
|
73
|
-
|
|
55
|
+
root: {
|
|
56
|
+
display: 'block',
|
|
57
|
+
flexShrink: 0,
|
|
58
|
+
...line,
|
|
59
|
+
...(dividerOpacity !== undefined ? { opacity: dividerOpacity } : {}),
|
|
60
|
+
},
|
|
74
61
|
};
|
|
75
62
|
},
|
|
76
|
-
[
|
|
63
|
+
[orientation, thickness, length, color, lineStyle, gradientString, dividerOpacity],
|
|
77
64
|
);
|
|
78
65
|
|
|
79
66
|
return (
|
|
80
67
|
<Container
|
|
81
|
-
styleConfig={{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
</Container>
|
|
86
|
-
</Container>
|
|
68
|
+
styleConfig={{
|
|
69
|
+
root: [dynamicStyles.root as Styles, ...(styleConfig?.root ?? []), ...(css ? [css as Styles] : [])],
|
|
70
|
+
}}
|
|
71
|
+
/>
|
|
87
72
|
);
|
|
88
73
|
};
|
|
89
74
|
|
package/src/type.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
|
|
1
3
|
import type { Styles } from '@cleartrip/ct-design-types';
|
|
2
4
|
|
|
3
5
|
export type DividerOrientation = 'horizontal' | 'vertical';
|
|
@@ -33,6 +35,26 @@ export interface IDividerProps {
|
|
|
33
35
|
|
|
34
36
|
/** Style configuration for the divider container. */
|
|
35
37
|
styleConfig?: IDividerStyleConfig;
|
|
38
|
+
|
|
39
|
+
// ---------------------------------------------------------------------
|
|
40
|
+
// Deprecated v2 (styled-components) props — web only, still honoured so
|
|
41
|
+
// migrated call sites keep their look.
|
|
42
|
+
// ---------------------------------------------------------------------
|
|
43
|
+
|
|
44
|
+
/** @deprecated Use `dividerWidth`. v2: line thickness (e.g. `'1px'`). */
|
|
45
|
+
height?: number | string;
|
|
46
|
+
/** @deprecated Use `dividerLength`. v2: line length (default `'100%'`). */
|
|
47
|
+
width?: number | string;
|
|
48
|
+
/** @deprecated Use `dividerColor`. */
|
|
49
|
+
borderColor?: string;
|
|
50
|
+
/** @deprecated Use `dividerType`. */
|
|
51
|
+
borderStyle?: DividerLineStyle;
|
|
52
|
+
/** @deprecated Use `dividerType`. */
|
|
53
|
+
type?: DividerLineStyle;
|
|
54
|
+
/** @deprecated v2: draws a `height`-tall gradient instead of a border. */
|
|
55
|
+
gradientString?: string;
|
|
56
|
+
/** @deprecated v2: opacity of the line. */
|
|
57
|
+
dividerOpacity?: number;
|
|
36
58
|
}
|
|
37
59
|
|
|
38
60
|
/**
|