@ant-design/x
Version:
Craft AI-driven interfaces effortlessly
122 lines (121 loc) • 3.46 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.prepareComponentToken = exports.default = void 0;
var _cssinjsUtils = require("@ant-design/cssinjs-utils");
var _genStyleUtils = require("../../theme/genStyleUtils");
const genFolderStyle = token => {
const {
componentCls,
antCls
} = token;
return {
[componentCls]: {
height: '100%',
width: '100%',
background: token.colorBgDirectory,
[`${antCls}-tree-node-content-wrapper`]: {
display: 'flex'
},
[`${antCls}-tree-node-content-wrapper-open,${antCls}-tree-node-content-wrapper-close`]: {
display: 'flex'
},
[`${antCls}-tree-node-content-wrapper-normal`]: {
display: 'flex'
},
[`${antCls}-tree-list`]: {
paddingInline: token.padding,
paddingBlock: token.paddingXS
},
[`${antCls}-tree-switcher`]: {
width: '10px',
'&:before': {
width: '10px',
height: '10px'
}
},
[`${antCls}-tree-node-content-wrapper`]: {
paddingInline: 0
},
[`${componentCls}-container`]: {
height: '100%'
},
[`${componentCls}-directory-tree`]: {
height: '100%',
display: 'flex',
flexDirection: 'column'
},
[`${componentCls}-directory-tree-title`]: {
width: '100%',
display: 'flex',
alignItems: 'center'
},
[`${componentCls}-directory-tree-content`]: {
width: '100%',
background: 'transparent',
height: '100%',
borderRadius: 'unset',
display: 'flex',
overflow: 'auto'
},
[`&${componentCls}-rtl`]: {
direction: 'rtl'
}
}
};
};
const genFilePreviewStyle = token => {
const {
componentCls
} = token;
return {
[componentCls]: {
[`${componentCls}-preview`]: {
width: '100%',
background: token.colorBgContainer,
flex: 1,
height: '100%',
display: 'flex',
flexDirection: 'column'
},
[`${componentCls}-preview-title`]: {
background: token.colorBgContainer,
paddingInline: token.padding,
paddingBlock: token.paddingXS,
borderBottom: `1px solid ${token.colorBorderSecondary}`
},
[`${componentCls}-preview-content`]: {
overflow: 'auto',
flex: 1,
background: token.colorBgContainer,
paddingInline: token.padding,
paddingBlock: token.paddingXS
},
[`${componentCls}-preview-loading-container`]: {
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
marginBlockStart: token.calc(token.marginLG).mul(3).equal()
},
[`${componentCls}-preview-empty-container`]: {
marginBlockStart: token.calc(token.marginLG).mul(3).equal()
},
[`${componentCls}-directory-tree-item-title`]: {
display: 'flex',
whiteSpace: 'nowrap',
paddingInlineEnd: token.padding
}
}
};
};
const prepareComponentToken = token => {
return {
colorBgDirectory: token.colorFillTertiary
};
};
exports.prepareComponentToken = prepareComponentToken;
var _default = exports.default = (0, _genStyleUtils.genStyleHooks)('Folder', token => {
const compToken = (0, _cssinjsUtils.mergeToken)(token, {});
return [genFolderStyle(compToken), genFilePreviewStyle(compToken)];
}, prepareComponentToken);