@televet/kibble-ui 1.12.10 → 1.12.11-beta.3chctp9.0
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,9 +1,12 @@
|
|
|
1
1
|
export interface IRatingDotsProps {
|
|
2
2
|
minValue: number;
|
|
3
3
|
maxValue: number;
|
|
4
|
+
minLabel?: string;
|
|
5
|
+
maxLabel?: string;
|
|
6
|
+
centeredLabel?: string;
|
|
4
7
|
isInteractive?: boolean;
|
|
5
8
|
isDisabled?: boolean;
|
|
6
9
|
onClick?: (value: number) => void;
|
|
7
10
|
selected?: number;
|
|
8
11
|
}
|
|
9
|
-
export declare const RatingDots: ({ minValue, maxValue, isDisabled, isInteractive, onClick, selected, }: IRatingDotsProps) => JSX.Element;
|
|
12
|
+
export declare const RatingDots: ({ minValue, maxValue, minLabel, maxLabel, centeredLabel, isDisabled, isInteractive, onClick, selected, }: IRatingDotsProps) => JSX.Element;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ForwardedRef } from 'react';
|
|
2
2
|
import { TextareaProps as CTextareaProps } from '@chakra-ui/react';
|
|
3
3
|
import { WithFormControlProps } from '../FormControl/formControl.component';
|
|
4
4
|
export interface TextareaProps extends WithFormControlProps, CTextareaProps {
|
|
5
|
+
textareaRef?: ForwardedRef<HTMLTextAreaElement>;
|
|
5
6
|
}
|
|
6
|
-
declare const WrappedTextArea: React.
|
|
7
|
+
declare const WrappedTextArea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
7
8
|
export { WrappedTextArea as Textarea };
|
package/build/index.js
CHANGED
|
@@ -3764,12 +3764,12 @@ var CheckboxConfig = {
|
|
|
3764
3764
|
},
|
|
3765
3765
|
};
|
|
3766
3766
|
|
|
3767
|
-
var Textarea = function (props) {
|
|
3768
|
-
props.isFieldInline; var domProps = __rest(props, ["isFieldInline"]);
|
|
3769
|
-
return React__default["default"].createElement(react.Textarea, __assign({ background: colors.background.light }, domProps));
|
|
3770
|
-
};
|
|
3771
|
-
|
|
3772
|
-
|
|
3767
|
+
var Textarea = withFormControl(function (props) {
|
|
3768
|
+
props.isFieldInline; var textareaRef = props.textareaRef, domProps = __rest(props, ["isFieldInline", "textareaRef"]);
|
|
3769
|
+
return React__default["default"].createElement(react.Textarea, __assign({ background: colors.background.light }, domProps, { ref: textareaRef }));
|
|
3770
|
+
});
|
|
3771
|
+
var WrappedTextArea = React.forwardRef(function (props, ref) { return (React__default["default"].createElement(Textarea, __assign({ textareaRef: ref }, props))); });
|
|
3772
|
+
WrappedTextArea.displayName = 'Textarea';
|
|
3773
3773
|
|
|
3774
3774
|
var FormControlConfig = {
|
|
3775
3775
|
baseStyle: {
|
|
@@ -4163,7 +4163,7 @@ var TruncatedText = function (_a) {
|
|
|
4163
4163
|
};
|
|
4164
4164
|
|
|
4165
4165
|
var RatingDots = function (_a) {
|
|
4166
|
-
var minValue = _a.minValue, maxValue = _a.maxValue, isDisabled = _a.isDisabled, isInteractive = _a.isInteractive, onClick = _a.onClick, selected = _a.selected;
|
|
4166
|
+
var minValue = _a.minValue, maxValue = _a.maxValue, minLabel = _a.minLabel, maxLabel = _a.maxLabel, centeredLabel = _a.centeredLabel, isDisabled = _a.isDisabled, isInteractive = _a.isInteractive, onClick = _a.onClick, selected = _a.selected;
|
|
4167
4167
|
var _b = __read(React.useState(), 2), selectedValue = _b[0], setSelectedValue = _b[1];
|
|
4168
4168
|
var roundedMin = React.useMemo(function () { return Math.round(minValue); }, [minValue]);
|
|
4169
4169
|
var roundedMax = React.useMemo(function () { return Math.round(maxValue); }, [maxValue]);
|
|
@@ -4180,10 +4180,10 @@ var RatingDots = function (_a) {
|
|
|
4180
4180
|
}, [selected]);
|
|
4181
4181
|
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
4182
4182
|
React__default["default"].createElement(react.Flex, { my: 4, flexWrap: "wrap", justifyContent: isInteractive ? 'center' : 'flex-start' }, values.map(function (value) { return (React__default["default"].createElement(RatingDot, { key: "composer-rating-dot-".concat(value), number: value, isInteractive: isInteractive, onClick: onClick, isDisabled: isDisabled, selected: selectedValue === value })); })),
|
|
4183
|
-
React__default["default"].createElement(react.Flex, {
|
|
4184
|
-
React__default["default"].createElement(Text, { size: "sm" }, "".concat(roundedMin, " -
|
|
4185
|
-
!isInteractive && React__default["default"].createElement(Text, { size: "sm", pr: 1 }, ","),
|
|
4186
|
-
React__default["default"].createElement(Text, { size: "sm" }, "".concat(roundedMax, " -
|
|
4183
|
+
React__default["default"].createElement(react.Flex, { justifyContent: isInteractive ? (centeredLabel ? 'center' : 'space-between') : 'flex-start' }, centeredLabel ? (React__default["default"].createElement(Text, { colorToken: "subtle", size: "sm" }, centeredLabel)) : (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
4184
|
+
minLabel && React__default["default"].createElement(Text, { colorToken: "subtle", size: "sm" }, "".concat(roundedMin, " - ").concat(minLabel)),
|
|
4185
|
+
!isInteractive && React__default["default"].createElement(Text, { colorToken: "subtle", size: "sm", pr: 1 }, ","),
|
|
4186
|
+
maxLabel && React__default["default"].createElement(Text, { colorToken: "subtle", size: "sm" }, "".concat(roundedMax, " - ").concat(maxLabel)))))));
|
|
4187
4187
|
};
|
|
4188
4188
|
|
|
4189
4189
|
// TODO: Figure out how to document this functionality
|