|
|
|
@ -1,31 +1,40 @@
|
|
|
|
|
import React, { memo } from 'react';
|
|
|
|
|
|
|
|
|
|
import { getModule, getModuleByDisplayName } from '@vizality/webpack';
|
|
|
|
|
import { joinClassNames } from '@vizality/util/dom';
|
|
|
|
|
import { toKebabCase } from '@vizality/util/string';
|
|
|
|
|
import { getCaller } from '@vizality/util/file';
|
|
|
|
|
import { motion } from 'framer-motion';
|
|
|
|
|
import React, { memo } from 'react';
|
|
|
|
|
|
|
|
|
|
import { FormItem, FormText, Tooltip, Button, Divider } from '..';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @component
|
|
|
|
|
* @returns {React.MemoExoticComponent<function(): React.ReactElement>}
|
|
|
|
|
*/
|
|
|
|
|
export default memo(props => {
|
|
|
|
|
const { note, children, tooltipText, tooltipPosition, success, color, disabled, onClick, button } = props;
|
|
|
|
|
|
|
|
|
|
const { note, children, tooltipText, tooltipPosition, success, color, disabled, onClick, button, id } = props;
|
|
|
|
|
const Flex = getModuleByDisplayName('Flex');
|
|
|
|
|
const flex = joinClassNames(Flex.Direction.VERTICAL, Flex.Justify.START, Flex.Align.STRETCH, Flex.Wrap.NO_WRAP);
|
|
|
|
|
const { marginBottom20 } = getModule('marginTop20');
|
|
|
|
|
const { description } = getModule('formText', 'description');
|
|
|
|
|
const { marginBottom20 } = getModule('marginTop20');
|
|
|
|
|
const { labelRow, title } = getModule('labelRow');
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<FormItem
|
|
|
|
|
className={joinClassNames('vz-settings-item', 'vz-settings-button-item', flex, marginBottom20)}>
|
|
|
|
|
<div className='vz-settings-button-item-inner'>
|
|
|
|
|
<FormItem className={joinClassNames('vz-settings-item', 'vz-settings-button-item', flex, marginBottom20)}>
|
|
|
|
|
<div
|
|
|
|
|
className='vz-settings-button-item-inner'
|
|
|
|
|
id={id || `setting-button-${toKebabCase(getCaller())}-${children.toString()}`}
|
|
|
|
|
>
|
|
|
|
|
<div className='vz-settings-button-item-info'>
|
|
|
|
|
<div className={labelRow}>
|
|
|
|
|
<label className={title}>
|
|
|
|
|
<motion.label layout='position' className={title}>
|
|
|
|
|
{children}
|
|
|
|
|
</label>
|
|
|
|
|
</motion.label>
|
|
|
|
|
</div>
|
|
|
|
|
<FormText className={description}>
|
|
|
|
|
{note}
|
|
|
|
|
<motion.div layout='position'>
|
|
|
|
|
{note}
|
|
|
|
|
</motion.div>
|
|
|
|
|
</FormText>
|
|
|
|
|
</div>
|
|
|
|
|
<Tooltip
|
|
|
|
|