@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.
@@ -1 +1 @@
1
- {"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../packages/components/Divider/src/Divider.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
+ {"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,4 @@
1
+ import { IDividerProps } from './type';
2
+ declare const Divider: React.FC<IDividerProps>;
3
+ export default Divider;
4
+ //# sourceMappingURL=Divider.native.d.ts.map
@@ -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 e=require("react/jsx-runtime"),r=require("@cleartrip/ct-design-container"),i=require("@cleartrip/ct-design-style-manager");const t=i.makeStyles(e=>({container:{display:"flex",justifyContent:"center",alignItems:"center",overflow:"hidden"},vertical:{margin:-e.spacing[.5],marginLeft:e.spacing[.5],width:1},horizontal:{margin:-e.spacing[.5],marginTop:e.spacing[.5],height:1},flex:{flex:1},flexRow:{flexDirection:"row"}})),o=({dividerColor:o="#F3F3F3",dividerType:n="solid",dividerWidth:l=1.5,orientation:a="horizontal",dividerLength:d="100%",styleConfig:s})=>{var c;const h=i.useStyles(e=>{let r={},i={};return"horizontal"===a?(r={height:l+1,width:"100%",flexDirection:"row",flex:1},i={borderWidth:l,borderColor:o||e.color.border.neutral,borderStyle:n,width:d}):(r={width:l+1,height:"100%"},i={borderWidth:l,borderColor:o,borderStyle:n,height:d}),{defaultContainerStyle:r,defaultMaskStyle:i}},[l,o,n,d]);return e.jsx(r.Container,{styleConfig:{root:[t.flex,t.flexRow,...null!==(c=null==s?void 0:s.root)&&void 0!==c?c:[]]},children:e.jsx(r.Container,{styleConfig:{root:[t.container,h.defaultContainerStyle]},children:e.jsx(r.Container,{styleConfig:{root:[t[a],h.defaultMaskStyle]}})})})};o.displayName="Divider",exports.Divider=o;
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":["solidBorderStyles","makeStyles","theme","container","display","justifyContent","alignItems","overflow","vertical","margin","spacing","marginLeft","width","horizontal","marginTop","height","flex","flexRow","flexDirection","Divider","dividerColor","dividerType","dividerWidth","orientation","dividerLength","styleConfig","dividerDynamicStyles","useStyles","defaultContainerStyle","defaultMaskStyle","borderWidth","borderColor","color","border","neutral","borderStyle","_jsx","Container","root","_a","children","displayName"],"mappings":"4IAKA,MAAMA,EAAoBC,EAAAA,WAAYC,IAC7B,CACLC,UAAW,CACTC,QAAS,OACTC,eAAgB,SAChBC,WAAY,SACZC,SAAU,UAEZC,SAAU,CACRC,QAASP,EAAMQ,QAAQ,IACvBC,WAAYT,EAAMQ,QAAQ,IAC1BE,MAAO,GAETC,WAAY,CACVJ,QAASP,EAAMQ,QAAQ,IACvBI,UAAWZ,EAAMQ,QAAQ,IACzBK,OAAQ,GAEVC,KAAM,CACJA,KAAM,GAERC,QAAS,CACPC,cAAe,UAKfC,EAAmC,EACvCC,eAAe,UACfC,cAAc,QACdC,eAAe,IACfC,cAAc,aACdC,gBAAgB,OAChBC,wBAEA,MAAMC,EAAuBC,YAC1BzB,IACC,IAAI0B,EAAwB,CAAA,EACxBC,EAAmB,CAAA,EA2BvB,MAzBoB,eAAhBN,GACFK,EAAwB,CACtBb,OAAQO,EAAe,EACvBV,MAAO,OACPM,cAAe,MACfF,KAAM,GAERa,EAAmB,CACjBC,YAAaR,EACbS,YAAaX,GAAgBlB,EAAM8B,MAAMC,OAAOC,QAChDC,YAAad,EACbT,MAAOY,KAGTI,EAAwB,CACtBhB,MAAOU,EAAe,EACtBP,OAAQ,QAEVc,EAAmB,CACjBC,YAAaR,EACbS,YAAaX,EACbe,YAAad,EACbN,OAAQS,IAGL,CACLI,wBACAC,qBAGJ,CAACP,EAAcF,EAAcC,EAAaG,IAG5C,OACEY,MAACC,EAAAA,UACC,CAAAZ,YAAa,CAAEa,KAAM,CAACtC,EAAkBgB,KAAMhB,EAAkBiB,WAAkC,UAArBQ,aAAW,EAAXA,EAAaa,YAAQ,IAAAC,EAAAA,EAAA,KAElGC,SAAAJ,MAACC,EAAAA,UAAU,CAAAZ,YAAa,CAAEa,KAAM,CAACtC,EAAkBG,UAAWuB,EAAqBE,wBAAwBY,SACzGJ,EAAAA,IAACC,EAASA,WAACZ,YAAa,CAAEa,KAAM,CAACtC,EAAkBuB,GAAcG,EAAqBG,0BAM9FV,EAAQsB,YAAc"}
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,OA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Y,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 e}from"react/jsx-runtime";import{Container as r}from"@cleartrip/ct-design-container";import{makeStyles as t,useStyles as i}from"@cleartrip/ct-design-style-manager";const o=t(e=>({container:{display:"flex",justifyContent:"center",alignItems:"center",overflow:"hidden"},vertical:{margin:-e.spacing[.5],marginLeft:e.spacing[.5],width:1},horizontal:{margin:-e.spacing[.5],marginTop:e.spacing[.5],height:1},flex:{flex:1},flexRow:{flexDirection:"row"}})),n=({dividerColor:t="#F3F3F3",dividerType:n="solid",dividerWidth:l=1.5,orientation:d="horizontal",dividerLength:a="100%",styleConfig:f})=>{var c;const h=i(e=>{let r={},i={};return"horizontal"===d?(r={height:l+1,width:"100%",flexDirection:"row",flex:1},i={borderWidth:l,borderColor:t||e.color.border.neutral,borderStyle:n,width:a}):(r={width:l+1,height:"100%"},i={borderWidth:l,borderColor:t,borderStyle:n,height:a}),{defaultContainerStyle:r,defaultMaskStyle:i}},[l,t,n,a]);return e(r,{styleConfig:{root:[o.flex,o.flexRow,...null!==(c=null==f?void 0:f.root)&&void 0!==c?c:[]]},children:e(r,{styleConfig:{root:[o.container,h.defaultContainerStyle]},children:e(r,{styleConfig:{root:[o[d],h.defaultMaskStyle]}})})})};n.displayName="Divider";export{n as Divider};
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":["solidBorderStyles","makeStyles","theme","container","display","justifyContent","alignItems","overflow","vertical","margin","spacing","marginLeft","width","horizontal","marginTop","height","flex","flexRow","flexDirection","Divider","dividerColor","dividerType","dividerWidth","orientation","dividerLength","styleConfig","dividerDynamicStyles","useStyles","defaultContainerStyle","defaultMaskStyle","borderWidth","borderColor","color","border","neutral","borderStyle","_jsx","Container","root","_a","children","displayName"],"mappings":"kLAKA,MAAMA,EAAoBC,EAAYC,IAC7B,CACLC,UAAW,CACTC,QAAS,OACTC,eAAgB,SAChBC,WAAY,SACZC,SAAU,UAEZC,SAAU,CACRC,QAASP,EAAMQ,QAAQ,IACvBC,WAAYT,EAAMQ,QAAQ,IAC1BE,MAAO,GAETC,WAAY,CACVJ,QAASP,EAAMQ,QAAQ,IACvBI,UAAWZ,EAAMQ,QAAQ,IACzBK,OAAQ,GAEVC,KAAM,CACJA,KAAM,GAERC,QAAS,CACPC,cAAe,UAKfC,EAAmC,EACvCC,eAAe,UACfC,cAAc,QACdC,eAAe,IACfC,cAAc,aACdC,gBAAgB,OAChBC,wBAEA,MAAMC,EAAuBC,EAC1BzB,IACC,IAAI0B,EAAwB,CAAA,EACxBC,EAAmB,CAAA,EA2BvB,MAzBoB,eAAhBN,GACFK,EAAwB,CACtBb,OAAQO,EAAe,EACvBV,MAAO,OACPM,cAAe,MACfF,KAAM,GAERa,EAAmB,CACjBC,YAAaR,EACbS,YAAaX,GAAgBlB,EAAM8B,MAAMC,OAAOC,QAChDC,YAAad,EACbT,MAAOY,KAGTI,EAAwB,CACtBhB,MAAOU,EAAe,EACtBP,OAAQ,QAEVc,EAAmB,CACjBC,YAAaR,EACbS,YAAaX,EACbe,YAAad,EACbN,OAAQS,IAGL,CACLI,wBACAC,qBAGJ,CAACP,EAAcF,EAAcC,EAAaG,IAG5C,OACEY,EAACC,EACC,CAAAZ,YAAa,CAAEa,KAAM,CAACtC,EAAkBgB,KAAMhB,EAAkBiB,WAAkC,UAArBQ,aAAW,EAAXA,EAAaa,YAAQ,IAAAC,EAAAA,EAAA,KAElGC,SAAAJ,EAACC,EAAU,CAAAZ,YAAa,CAAEa,KAAM,CAACtC,EAAkBG,UAAWuB,EAAqBE,wBAAwBY,SACzGJ,EAACC,GAAUZ,YAAa,CAAEa,KAAM,CAACtC,EAAkBuB,GAAcG,EAAqBG,0BAM9FV,EAAQsB,YAAc"}
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,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,EACnBC,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,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
- const solidBorderStyles = ctDesignStyleManager.makeStyles((theme) => {
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
- container: {
10
- display: 'flex',
11
- justifyContent: 'center',
12
- alignItems: 'center',
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
- const Divider = ({ dividerColor = '#F3F3F3', dividerType = 'solid', dividerWidth = 1.5, orientation = 'horizontal', dividerLength = '100%', styleConfig, }) => {
34
- var _a;
35
- const dividerDynamicStyles = ctDesignStyleManager.useStyles((theme) => {
36
- let defaultContainerStyle = {};
37
- let defaultMaskStyle = {};
38
- if (orientation === 'horizontal') {
39
- defaultContainerStyle = {
40
- height: dividerWidth + 1,
41
- width: '100%',
42
- flexDirection: 'row',
43
- flex: 1,
44
- };
45
- defaultMaskStyle = {
46
- borderWidth: dividerWidth,
47
- borderColor: dividerColor || theme.color.border.neutral,
48
- borderStyle: dividerType,
49
- width: dividerLength,
50
- };
51
- }
52
- else {
53
- defaultContainerStyle = {
54
- width: dividerWidth + 1,
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
- defaultContainerStyle,
66
- defaultMaskStyle,
57
+ root: Object.assign(Object.assign({ display: 'block', flexShrink: 0 }, line), (dividerOpacity !== undefined ? { opacity: dividerOpacity } : {})),
67
58
  };
68
- }, [dividerWidth, dividerColor, dividerType, dividerLength]);
69
- return (jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: { root: [solidBorderStyles.flex, solidBorderStyles.flexRow, ...((_a = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) !== null && _a !== void 0 ? _a : [])] }, children: jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: { root: [solidBorderStyles.container, dividerDynamicStyles.defaultContainerStyle] }, children: jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: { root: [solidBorderStyles[orientation], dividerDynamicStyles.defaultMaskStyle] } }) }) }));
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":";;;;;;AAKA,MAAM,iBAAiB,GAAGA,+BAAU,CAAC,CAAC,KAAK,KAAI;IAC7C,OAAO;AACL,QAAA,SAAS,EAAE;AACT,YAAA,OAAO,EAAE,MAAM;AACf,YAAA,cAAc,EAAE,QAAQ;AACxB,YAAA,UAAU,EAAE,QAAQ;AACpB,YAAA,QAAQ,EAAE,QAAQ;AACnB,SAAA;AACD,QAAA,QAAQ,EAAE;AACR,YAAA,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;AAC3B,YAAA,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;AAC9B,YAAA,KAAK,EAAE,CAAC;AACT,SAAA;AACD,QAAA,UAAU,EAAE;AACV,YAAA,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;AAC3B,YAAA,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;AAC7B,YAAA,MAAM,EAAE,CAAC;AACV,SAAA;AACD,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,CAAC;AACR,SAAA;AACD,QAAA,OAAO,EAAE;AACP,YAAA,aAAa,EAAE,KAAK;AACrB,SAAA;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEG,MAAA,OAAO,GAA4B,CAAC,EACxC,YAAY,GAAG,SAAS,EACxB,WAAW,GAAG,OAAO,EACrB,YAAY,GAAG,GAAG,EAClB,WAAW,GAAG,YAAY,EAC1B,aAAa,GAAG,MAAM,EACtB,WAAW,GACZ,KAAI;;AACH,IAAA,MAAM,oBAAoB,GAAGC,8BAAS,CACpC,CAAC,KAAK,KAAI;QACR,IAAI,qBAAqB,GAAG,EAAE,CAAC;QAC/B,IAAI,gBAAgB,GAAG,EAAE,CAAC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AAC,iBAAiB,CAAC,SAAS,EAAE,oBAAoB,CAAC,qBAAqB,CAAC,EAAE,EAAA,QAAA,EACzGD,cAAC,CAAAC,2BAAS,IAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,oBAAoB,CAAC,gBAAgB,CAAC,EAAE,EAAA,CAAI,EACnG,CAAA,EAAA,CACF,EACZ;AACJ,EAAE;AAEF,OAAO,CAAC,WAAW,GAAG,SAAS;;;;"}
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,EAA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;;"}
@@ -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
- const solidBorderStyles = makeStyles((theme) => {
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
- container: {
8
- display: 'flex',
9
- justifyContent: 'center',
10
- alignItems: 'center',
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
- const Divider = ({ dividerColor = '#F3F3F3', dividerType = 'solid', dividerWidth = 1.5, orientation = 'horizontal', dividerLength = '100%', styleConfig, }) => {
32
- var _a;
33
- const dividerDynamicStyles = useStyles((theme) => {
34
- let defaultContainerStyle = {};
35
- let defaultMaskStyle = {};
36
- if (orientation === 'horizontal') {
37
- defaultContainerStyle = {
38
- height: dividerWidth + 1,
39
- width: '100%',
40
- flexDirection: 'row',
41
- flex: 1,
42
- };
43
- defaultMaskStyle = {
44
- borderWidth: dividerWidth,
45
- borderColor: dividerColor || theme.color.border.neutral,
46
- borderStyle: dividerType,
47
- width: dividerLength,
48
- };
49
- }
50
- else {
51
- defaultContainerStyle = {
52
- width: dividerWidth + 1,
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
- defaultContainerStyle,
64
- defaultMaskStyle,
55
+ root: Object.assign(Object.assign({ display: 'block', flexShrink: 0 }, line), (dividerOpacity !== undefined ? { opacity: dividerOpacity } : {})),
65
56
  };
66
- }, [dividerWidth, dividerColor, dividerType, dividerLength]);
67
- return (jsx(Container, { styleConfig: { root: [solidBorderStyles.flex, solidBorderStyles.flexRow, ...((_a = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) !== null && _a !== void 0 ? _a : [])] }, children: jsx(Container, { styleConfig: { root: [solidBorderStyles.container, dividerDynamicStyles.defaultContainerStyle] }, children: jsx(Container, { styleConfig: { root: [solidBorderStyles[orientation], dividerDynamicStyles.defaultMaskStyle] } }) }) }));
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":";;;;AAKA,MAAM,iBAAiB,GAAG,UAAU,CAAC,CAAC,KAAK,KAAI;IAC7C,OAAO;AACL,QAAA,SAAS,EAAE;AACT,YAAA,OAAO,EAAE,MAAM;AACf,YAAA,cAAc,EAAE,QAAQ;AACxB,YAAA,UAAU,EAAE,QAAQ;AACpB,YAAA,QAAQ,EAAE,QAAQ;AACnB,SAAA;AACD,QAAA,QAAQ,EAAE;AACR,YAAA,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;AAC3B,YAAA,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;AAC9B,YAAA,KAAK,EAAE,CAAC;AACT,SAAA;AACD,QAAA,UAAU,EAAE;AACV,YAAA,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;AAC3B,YAAA,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;AAC7B,YAAA,MAAM,EAAE,CAAC;AACV,SAAA;AACD,QAAA,IAAI,E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AAE,YAAY,EAAE,WAAW,EAAE,aAAa,CAAC,CACzD,CAAC;AAEF,IAAA,QACEA,GAAC,CAAA,SAAS,EACR,EAAA,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,iBAAiB,CAAC,IAAI,EAAE,iBAAiB,CAAC,OAAO,EAAE,IAAI,MAAA,WAAW,KAAA,IAAA,IAAX,WAAW,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAX,WAAW,CAAE,IAAI,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,EAAE,CAAC,CAAC,EAAE,EAExG,QAAA,EAAAA,GAAA,CAAC,SAAS,EAAC,EAAA,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,iBAAiB,CAAC,SAAS,EAAE,oBAAoB,CAAC,qBAAqB,CAAC,EAAE,EAAA,QAAA,EACzGA,GAAC,CAAA,SAAS,IAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,oBAAoB,CAAC,gBAAgB,CAAC,EAAE,EAAA,CAAI,EACnG,CAAA,EAAA,CACF,EACZ;AACJ,EAAE;AAEF,OAAO,CAAC,WAAW,GAAG,SAAS;;;;"}
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,MA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EA,GAAA,CAAC,SAAS,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;;;;"}
@@ -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
- const solidBorderStyles = ctDesignStyleManager.makeStyles((theme) => {
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
- container: {
10
- display: 'flex',
11
- justifyContent: 'center',
12
- alignItems: 'center',
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
- const Divider = ({ dividerColor = '#F3F3F3', dividerType = 'solid', dividerWidth = 1.5, orientation = 'horizontal', dividerLength = '100%', styleConfig, }) => {
34
- var _a;
35
- const dividerDynamicStyles = ctDesignStyleManager.useStyles((theme) => {
36
- let defaultContainerStyle = {};
37
- let defaultMaskStyle = {};
38
- if (orientation === 'horizontal') {
39
- defaultContainerStyle = {
40
- height: dividerWidth + 1,
41
- width: '100%',
42
- flexDirection: 'row',
43
- flex: 1,
44
- };
45
- defaultMaskStyle = {
46
- borderWidth: dividerWidth,
47
- borderColor: dividerColor || theme.color.border.neutral,
48
- borderStyle: dividerType,
49
- width: dividerLength,
50
- };
51
- }
52
- else {
53
- defaultContainerStyle = {
54
- width: dividerWidth + 1,
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
- defaultContainerStyle,
66
- defaultMaskStyle,
57
+ root: Object.assign(Object.assign({ display: 'block', flexShrink: 0 }, line), (dividerOpacity !== undefined ? { opacity: dividerOpacity } : {})),
67
58
  };
68
- }, [dividerWidth, dividerColor, dividerType, dividerLength]);
69
- return (jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: { root: [solidBorderStyles.flex, solidBorderStyles.flexRow, ...((_a = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) !== null && _a !== void 0 ? _a : [])] }, children: jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: { root: [solidBorderStyles.container, dividerDynamicStyles.defaultContainerStyle] }, children: jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: { root: [solidBorderStyles[orientation], dividerDynamicStyles.defaultMaskStyle] } }) }) }));
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","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WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,iBAAiB,CAAC,WAAW,CAAC,EAAE,oBAAoB,CAAC,gBAAgB,CAAC,EAAE,EAAA,CAAI,EACnG,CAAA,EAAA,CACF,EACZ;IACJ,EAAE;IAEF,OAAO,CAAC,WAAW,GAAG,SAAS;;;;;;;;"}
1
+ {"version":3,"file":"ct-design-divider.umd.js","sources":["../packages/components/Divider/src/style.ts","../packages/components/Divider/src/Divider.tsx"],"sourcesContent":[null,null],"names":["makeStyles","useStyles","_jsx","Container"],"mappings":";;;;;;AAUqBA,mCAAU,CAAC,OAAO;IACrC,IAAA,cAAc,EAAE;IACd,QAAA,KAAK,EAAE,MAAM;IACd,KAAA;IACD,IAAA,YAAY,EAAE;IACZ,QAAA,MAAM,EAAE,MAAM;IACf,KAAA;IACF,CAAA,CAAC,EAAE;IAgBY,SAAA,mBAAmB,CAAC,EAClC,KAAK,EACL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,GACY,EAAA;QACzB,MAAM,KAAK,GAAG,YAAY,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;IACzD,IAAA,MAAM,OAAO,GAAG,OAAO,YAAY,KAAK,QAAQ,GAAG,CAAA,EAAG,YAAY,CAAI,EAAA,CAAA,GAAG,YAAY,CAAC;IAEtF,IAAA,IAAI,WAAW,KAAK,UAAU,EAAE;YAC9B,OAAO;IACL,YAAA,KAAK,EAAE,OAAO;IACd,YAAA,MAAM,EAAE,aAAa;IACrB,YAAA,gBAAgB,EAAE,OAAO;IACzB,YAAA,gBAAgB,EAAE,WAAW;IAC7B,YAAA,gBAAgB,EAAE,KAAK;aACxB,CAAC;SACH;QACD,OAAO;IACL,QAAA,KAAK,EAAE,aAAa;IACpB,QAAA,iBAAiB,EAAE,OAAO;IAC1B,QAAA,iBAAiB,EAAE,WAAW;IAC9B,QAAA,iBAAiB,EAAE,KAAK;SACzB,CAAC;IACJ;;AC3CA,UAAM,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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
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../packages/components/Divider/src/type.ts"],"names":[],"mappings":"AAAA,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;CACnC;AAMD,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC"}
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-fix-intersection-observer-v2.0",
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-container": "5.32.0-SNAPSHOT-fix-intersection-observer-v2.0",
28
- "@cleartrip/ct-design-style-manager": "5.31.1-SNAPSHOT-fix-intersection-observer-v2.0",
29
- "@cleartrip/ct-design-theme": "5.32.0-SNAPSHOT-fix-intersection-observer-v2.0"
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-fix-intersection-observer-v2.0"
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 { makeStyles, useStyles } from '@cleartrip/ct-design-style-manager';
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
- 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
-
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
- dividerLength = '100%',
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 dividerDynamicStyles = useStyles(
42
- (theme) => {
43
- let defaultContainerStyle = {};
44
- let defaultMaskStyle = {};
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
- 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
- }
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
- defaultContainerStyle,
73
- defaultMaskStyle,
55
+ root: {
56
+ display: 'block',
57
+ flexShrink: 0,
58
+ ...line,
59
+ ...(dividerOpacity !== undefined ? { opacity: dividerOpacity } : {}),
60
+ },
74
61
  };
75
62
  },
76
- [dividerWidth, dividerColor, dividerType, dividerLength],
63
+ [orientation, thickness, length, color, lineStyle, gradientString, dividerOpacity],
77
64
  );
78
65
 
79
66
  return (
80
67
  <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>
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
  /**