@technokratos/components-react
Advanced tools
Comparing version
@@ -1829,2 +1829,104 @@ import React__default, { createContext, forwardRef, useContext, Children, isValidElement, cloneElement, useState, useEffect, useMemo, useCallback, useRef, useLayoutEffect, createElement, Fragment } from 'react'; | ||
export { AutocompleteSelect, Button, ButtonGroup, Calendar, Checkbox, CheckboxGroup, ClickAwayListener, DEFAULT_ICONS_PATH, DateInput, DefaultIcons, Error, ErrorsWrapper, FormikAutocompleteSelect, FormikCheckbox, FormikCheckboxGroup, FormikDateInput, FormikFieldWrapper, FormikInlineSelect, FormikInlineTextInput, FormikSelect, FormikTextInput, Hint, Icon, IconContext, IconPathContext, InlineSelect, InlineTextInput, InverseTheme, Label, Loader, Menu, Option, Panel, Select, StatefulSelect, TextInput, cachedRequest, generateMonth, getDayProps, getSize, setSize, symbolToSvg }; | ||
var RadioButtonGroup = function RadioButtonGroup(_a) { | ||
var _b = _a.theme, | ||
theme = _b === void 0 ? 'inline' : _b, | ||
_c = _a.direction, | ||
direction = _c === void 0 ? 'vertical' : _c, | ||
children = _a.children, | ||
onChange = _a.onChange, | ||
error = _a.error, | ||
value = _a.value, | ||
className = _a.className, | ||
_d = _a.disabled, | ||
disabled = _d === void 0 ? false : _d; | ||
var select = function select(radioValue) { | ||
onChange === null || onChange === void 0 ? void 0 : onChange(radioValue); | ||
}; | ||
var isChecked = function isChecked(radioValue) { | ||
return value === radioValue; | ||
}; | ||
var newChildren = Children.map(children, function (child) { | ||
return cloneElement(child, { | ||
key: child.props.value, | ||
onChange: function onChange() { | ||
return select(child.props.value); | ||
}, | ||
value: isChecked(child.props.value), | ||
theme: theme, | ||
direction: direction, | ||
disabled: disabled, | ||
className: className | ||
}); | ||
}); | ||
return React__default.createElement("div", { | ||
className: cn('tk-radio-group', { | ||
'tk-radio-group--inline': theme === 'inline', | ||
'tk-radio-group--filled': theme === 'filled', | ||
'tk-radio-group--vertical': direction === 'vertical', | ||
'tk-radio-group--horizontal': direction === 'horizontal' | ||
}) | ||
}, newChildren, error && React__default.createElement("div", { | ||
className: 'tk-form-field__subscript' | ||
}, React__default.createElement(ErrorsWrapper, { | ||
error: error | ||
}))); | ||
}; | ||
var RadioButton = function RadioButton(_a) { | ||
var onChange = _a.onChange, | ||
disabled = _a.disabled, | ||
reverse = _a.reverse, | ||
theme = _a.theme, | ||
children = _a.children, | ||
className = _a.className, | ||
error = _a.error, | ||
suffix = _a.suffix, | ||
value = _a.value; | ||
var id = useState(randomString('radio-'))[0]; | ||
return React__default.createElement(React__default.Fragment, null, React__default.createElement("div", { | ||
className: cn('tk-radio-button', className, { | ||
'tk-radio-button--reverse': reverse, | ||
'tk-radio-button--not-reverse': !reverse, | ||
'tk-radio-button--checked': value, | ||
'tk-radio-button--disabled': disabled, | ||
'tk-radio-button--inline': theme === 'inline', | ||
'tk-radio-button--filled': theme === 'filled' | ||
}), | ||
tabIndex: -1, | ||
role: 'radio', | ||
"aria-checked": Boolean(value), | ||
"aria-roledescription": 'radio', | ||
"aria-labelledby": children ? id : null, | ||
onClick: function onClick() { | ||
return onChange(!value); | ||
} | ||
}, React__default.createElement("div", { | ||
className: 'tk-radio-button__circle' | ||
}, React__default.createElement("div", { | ||
className: 'tk-radio-button__circle-outer' | ||
}), React__default.createElement("div", { | ||
className: 'tk-radio-button__circle-inner' | ||
})), React__default.createElement("div", { | ||
className: 'tk-radio-button__children' | ||
}, children), suffix && React__default.createElement("div", { | ||
className: 'tk-radio-button__suffix' | ||
}, suffix)), error && React__default.createElement("div", { | ||
className: 'tk-form-field__subscript' | ||
}, React__default.createElement(ErrorsWrapper, { | ||
error: error | ||
}))); | ||
}; | ||
var FormikRadioButton = function FormikRadioButton(props) { | ||
return React__default.createElement(FormikFieldWrapper, __assign({}, props, { | ||
component: RadioButton | ||
}), props.children); | ||
}; | ||
var FormikRadioButtonGroup = function FormikRadioButtonGroup(props) { | ||
return React__default.createElement(FormikFieldWrapper, __assign({}, props, { | ||
component: RadioButtonGroup | ||
}), props.children); | ||
}; | ||
export { AutocompleteSelect, Button, ButtonGroup, Calendar, Checkbox, CheckboxGroup, ClickAwayListener, DEFAULT_ICONS_PATH, DateInput, DefaultIcons, Error, ErrorsWrapper, FormikAutocompleteSelect, FormikCheckbox, FormikCheckboxGroup, FormikDateInput, FormikFieldWrapper, FormikInlineSelect, FormikInlineTextInput, FormikRadioButton, FormikRadioButtonGroup, FormikSelect, FormikTextInput, Hint, Icon, IconContext, IconPathContext, InlineSelect, InlineTextInput, InverseTheme, Label, Loader, Menu, Option, Panel, RadioButton, RadioButtonGroup, Select, StatefulSelect, TextInput, cachedRequest, generateMonth, getDayProps, getSize, setSize, symbolToSvg }; |
@@ -26,1 +26,2 @@ export * from './lib/Button'; | ||
export * from './lib/FormikFieldWrapper'; | ||
export * from './lib/Radio'; |
{ | ||
"name": "@technokratos/components-react", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"dependencies": { | ||
@@ -5,0 +5,0 @@ "@popperjs/core": "^2.4.4", |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
152331
5.42%3912
5.42%0
-100%