@innovaccer/design-system 2.25.1 → 2.27.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.
- package/CHANGELOG.md +82 -0
- package/css/dist/index.css +33 -1
- package/css/dist/index.css.map +1 -1
- package/css/src/components/avatar.css +1 -1
- package/css/src/components/icon.css +32 -0
- package/dist/.lib/tsconfig.type.tsbuildinfo +238 -66
- package/dist/core/components/atoms/avatar/Avatar.d.ts +4 -1
- package/dist/core/components/atoms/avatar/AvatarProvider.d.ts +10 -0
- package/dist/core/components/atoms/avatar/avatarIcon/AvatarIcon.d.ts +11 -0
- package/dist/core/components/atoms/avatar/avatarIcon/index.d.ts +2 -0
- package/dist/core/components/atoms/avatar/avatarImage/AvatarImage.d.ts +8 -0
- package/dist/core/components/atoms/avatar/avatarImage/index.d.ts +2 -0
- package/dist/core/components/atoms/helpText/HelpText.d.ts +2 -1
- package/dist/core/components/atoms/icon/Icon.d.ts +1 -1
- package/dist/core/components/atoms/popperWrapper/PopperWrapper.d.ts +268 -268
- package/dist/core/components/molecules/tooltip/Tooltip.d.ts +2 -0
- package/dist/core/components/organisms/textField/TextField.d.ts +8 -0
- package/dist/core/components/organisms/textField/TextFieldCommon.d.ts +12 -0
- package/dist/core/components/organisms/textField/TextFieldWithInput.d.ts +14 -0
- package/dist/core/components/organisms/textField/TextFieldWithTextarea.d.ts +11 -0
- package/dist/core/components/organisms/textField/__test__/Textarea.test.d.ts +6 -0
- package/dist/core/components/organisms/textField/index.d.ts +2 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.type.d.ts +1 -0
- package/dist/core/utils/navigationHelper.d.ts +2 -2
- package/dist/index.esm.js +311 -24
- package/dist/index.js +305 -23
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.br +0 -0
- package/dist/index.umd.js.gz +0 -0
- package/package.json +1 -1
|
@@ -4,12 +4,14 @@ declare const tooltipPropsList: readonly ["trigger", "on", "open", "offset", "on
|
|
|
4
4
|
declare type TooltipPopperProps = typeof tooltipPropsList[number];
|
|
5
5
|
export interface TooltipProps extends Omit<PopoverProps, TooltipPopperProps>, BaseProps {
|
|
6
6
|
tooltip: string;
|
|
7
|
+
showTooltip?: boolean;
|
|
7
8
|
children: PopoverProps['trigger'];
|
|
8
9
|
}
|
|
9
10
|
export declare const Tooltip: {
|
|
10
11
|
(props: TooltipProps): JSX.Element;
|
|
11
12
|
defaultProps: Record<string, any> & {
|
|
12
13
|
hoverable: boolean;
|
|
14
|
+
showTooltip: boolean;
|
|
13
15
|
};
|
|
14
16
|
};
|
|
15
17
|
export default Tooltip;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TextFieldTextareaProps } from "./TextFieldWithTextarea";
|
|
2
|
+
import { TextFieldInputProps } from "./TextFieldWithInput";
|
|
3
|
+
export declare type TextFieldProps = TextFieldTextareaProps & TextFieldInputProps;
|
|
4
|
+
export declare const TextField: {
|
|
5
|
+
(props: TextFieldProps): JSX.Element;
|
|
6
|
+
displayName: string;
|
|
7
|
+
};
|
|
8
|
+
export default TextField;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface RenderHelpTextProps {
|
|
3
|
+
helpText: string;
|
|
4
|
+
error?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const RenderHelpText: React.FC<RenderHelpTextProps>;
|
|
7
|
+
interface RenderCounterProps {
|
|
8
|
+
inputText: string;
|
|
9
|
+
max: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const RenderCounter: React.FC<RenderCounterProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InputProps } from "../../../index.type";
|
|
2
|
+
import { BaseProps } from "../../../utils/types";
|
|
3
|
+
export interface TextFieldWithInputProps extends BaseProps {
|
|
4
|
+
label?: string;
|
|
5
|
+
helpText?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare type TextFieldInputProps = TextFieldWithInputProps & InputProps;
|
|
8
|
+
export declare const TextFieldWithInput: {
|
|
9
|
+
(props: TextFieldInputProps): JSX.Element;
|
|
10
|
+
defaultProps: {
|
|
11
|
+
minWidth: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default TextFieldWithInput;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BaseProps } from "../../../utils/types";
|
|
2
|
+
import { TextareaProps } from "../../../index.type";
|
|
3
|
+
export interface TextFieldWithTextareaProps extends BaseProps {
|
|
4
|
+
label?: string;
|
|
5
|
+
withTextarea?: boolean;
|
|
6
|
+
max?: number;
|
|
7
|
+
helpText?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare type TextFieldTextareaProps = TextFieldWithTextareaProps & TextareaProps;
|
|
10
|
+
export declare const TextFieldWithTextarea: (props: TextFieldTextareaProps) => JSX.Element;
|
|
11
|
+
export default TextFieldWithTextarea;
|
package/dist/core/index.d.ts
CHANGED
|
@@ -87,4 +87,5 @@ export { LinkButton } from "./components/atoms/linkButton";
|
|
|
87
87
|
export { ActionCard } from "./components/atoms/actionCard";
|
|
88
88
|
export { SelectionCard } from "./components/atoms/selectionCard";
|
|
89
89
|
export { Listbox } from "./components/organisms/listbox";
|
|
90
|
+
export { TextField } from "./components/organisms/textField";
|
|
90
91
|
export { version } from "../package.json";
|
|
@@ -85,3 +85,4 @@ export { LinkButtonProps } from "./components/atoms/linkButton";
|
|
|
85
85
|
export { ActionCardProps } from "./components/atoms/actionCard";
|
|
86
86
|
export { SelectionCardProps } from "./components/atoms/selectionCard";
|
|
87
87
|
export { ListboxProps, ListboxItemProps } from "./components/organisms/listbox";
|
|
88
|
+
export { TextFieldProps } from "./components/organisms/textField";
|
|
@@ -15,9 +15,9 @@ export declare type ActiveMenu = ({
|
|
|
15
15
|
} | {
|
|
16
16
|
link: string;
|
|
17
17
|
}) & Partial<Menu>;
|
|
18
|
-
export declare const getTextAppearance: (isActive: boolean, disabled?: boolean | undefined) => "
|
|
18
|
+
export declare const getTextAppearance: (isActive: boolean, disabled?: boolean | undefined) => "link" | "default" | "disabled";
|
|
19
19
|
export declare const getIconAppearance: (isActive: boolean, disabled?: boolean | undefined) => "default" | "disabled" | "primary_dark";
|
|
20
|
-
export declare const getPillsAppearance: (isActive: boolean) => "
|
|
20
|
+
export declare const getPillsAppearance: (isActive: boolean) => "secondary" | "primary";
|
|
21
21
|
export declare const getMenu: (menus: Menu[], active: ActiveMenu) => Menu | null;
|
|
22
22
|
export declare const isMenuActive: (menus: Menu[], menu: Menu, active?: ({
|
|
23
23
|
name: string;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* Generated on:
|
|
3
|
+
* Generated on: 1705328657749
|
|
4
4
|
* Package: @innovaccer/design-system
|
|
5
|
-
* Version: v2.
|
|
5
|
+
* Version: v2.27.0
|
|
6
6
|
* License: MIT
|
|
7
7
|
* Docs: https://innovaccer.github.io/design-system
|
|
8
8
|
*/
|
|
@@ -797,7 +797,103 @@ var filterProps = function filterProps(props, propsList, include) {
|
|
|
797
797
|
}, {});
|
|
798
798
|
};
|
|
799
799
|
|
|
800
|
+
var AvatarContext = /*#__PURE__*/React.createContext({
|
|
801
|
+
size: 'regular',
|
|
802
|
+
appearance: 'secondary',
|
|
803
|
+
firstName: '',
|
|
804
|
+
lastName: ''
|
|
805
|
+
});
|
|
806
|
+
var AvatarProvider = AvatarContext.Provider;
|
|
807
|
+
|
|
808
|
+
var appearanceMapper = {
|
|
809
|
+
secondary: 'inverse',
|
|
810
|
+
primary: 'white',
|
|
811
|
+
alert: 'white',
|
|
812
|
+
accent2: 'white',
|
|
813
|
+
accent3: 'white',
|
|
814
|
+
warning: 'warning_darker',
|
|
815
|
+
success: 'success_darker',
|
|
816
|
+
accent1: 'accent1_darker',
|
|
817
|
+
accent4: 'accent4_darker'
|
|
818
|
+
};
|
|
819
|
+
var AvatarIcon = function AvatarIcon(props) {
|
|
820
|
+
var contextProp = React.useContext(AvatarContext);
|
|
821
|
+
var size = contextProp.size,
|
|
822
|
+
appearance = contextProp.appearance;
|
|
823
|
+
var iconSize = size === 'regular' ? 20 : 16;
|
|
824
|
+
var iconAppearance = appearance && appearanceMapper[appearance] || 'inverse';
|
|
825
|
+
return /*#__PURE__*/React.createElement(Icon, _extends$2({}, props, {
|
|
826
|
+
size: iconSize,
|
|
827
|
+
appearance: iconAppearance
|
|
828
|
+
}));
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
var sizeMapper = {
|
|
832
|
+
regular: 32,
|
|
833
|
+
tiny: 24
|
|
834
|
+
};
|
|
835
|
+
var AvatarImage = function AvatarImage(props) {
|
|
836
|
+
var _classNames;
|
|
837
|
+
|
|
838
|
+
var children = props.children,
|
|
839
|
+
src = props.src;
|
|
840
|
+
|
|
841
|
+
var _React$useState = React.useState(false),
|
|
842
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
843
|
+
error = _React$useState2[0],
|
|
844
|
+
setError = _React$useState2[1];
|
|
845
|
+
|
|
846
|
+
var contextProp = React.useContext(AvatarContext);
|
|
847
|
+
var size = contextProp.size,
|
|
848
|
+
appearance = contextProp.appearance,
|
|
849
|
+
firstName = contextProp.firstName,
|
|
850
|
+
lastName = contextProp.lastName;
|
|
851
|
+
var baseProps = extractBaseProps(props);
|
|
852
|
+
var initials = "".concat(firstName ? firstName.trim()[0] : '').concat(lastName ? lastName.trim()[0] : '');
|
|
853
|
+
var imgSize = size && sizeMapper[size];
|
|
854
|
+
var TextClassNames = classnames((_classNames = {}, _defineProperty$1(_classNames, "Avatar-content--".concat(size), size), _defineProperty$1(_classNames, "Avatar-content--".concat(appearance), appearance), _classNames));
|
|
855
|
+
var IconClassNames = classnames(_defineProperty$1({}, "Avatar-content--".concat(appearance), appearance));
|
|
856
|
+
|
|
857
|
+
var onError = function onError() {
|
|
858
|
+
setError(true);
|
|
859
|
+
};
|
|
860
|
+
|
|
861
|
+
if (children) {
|
|
862
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
if (error) {
|
|
866
|
+
if (initials) {
|
|
867
|
+
return /*#__PURE__*/React.createElement(Text, _extends$2({
|
|
868
|
+
weight: "medium",
|
|
869
|
+
appearance: 'white',
|
|
870
|
+
className: TextClassNames
|
|
871
|
+
}, baseProps), initials);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
875
|
+
"data-test": "DesignSystem-Avatar--Icon",
|
|
876
|
+
name: "person",
|
|
877
|
+
size: size === 'regular' ? 20 : 16,
|
|
878
|
+
appearance: "white",
|
|
879
|
+
className: IconClassNames
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
return /*#__PURE__*/React.createElement("img", _extends$2({
|
|
884
|
+
"data-test": "DesignSystem-Image",
|
|
885
|
+
src: src,
|
|
886
|
+
alt: firstName
|
|
887
|
+
}, baseProps, {
|
|
888
|
+
height: imgSize,
|
|
889
|
+
width: imgSize,
|
|
890
|
+
onError: onError
|
|
891
|
+
}));
|
|
892
|
+
};
|
|
893
|
+
|
|
800
894
|
var initialsLength = 2;
|
|
895
|
+
var DefaultAppearance = 'secondary';
|
|
896
|
+
var colors = ['accent4', 'primary', 'accent3', 'alert', 'accent2', 'warning', 'accent1', 'success'];
|
|
801
897
|
var Avatar = function Avatar(props) {
|
|
802
898
|
var _classNames, _classNames2;
|
|
803
899
|
|
|
@@ -810,32 +906,46 @@ var Avatar = function Avatar(props) {
|
|
|
810
906
|
className = props.className,
|
|
811
907
|
appearance = props.appearance;
|
|
812
908
|
var baseProps = extractBaseProps(props);
|
|
813
|
-
var initials = children ? children.trim().slice(0, initialsLength) : "".concat(firstName ? firstName.trim()[0] : '').concat(lastName ? lastName.trim()[0] : '');
|
|
814
|
-
var tooltip = children
|
|
815
|
-
var DefaultAppearance = 'secondary';
|
|
816
|
-
var colors = ['accent4', 'primary', 'accent3', 'alert', 'accent2', 'warning', 'accent1', 'success'];
|
|
909
|
+
var initials = children && typeof children === 'string' ? children.trim().slice(0, initialsLength) : "".concat(firstName ? firstName.trim()[0] : '').concat(lastName ? lastName.trim()[0] : '');
|
|
910
|
+
var tooltip = children && typeof children === 'string' ? children : "".concat(firstName || '', " ").concat(lastName || '') || '';
|
|
817
911
|
var AvatarAppearance = appearance || colors[(initials.charCodeAt(0) + (initials.charCodeAt(1) || 0)) % 8] || DefaultAppearance;
|
|
818
|
-
var
|
|
912
|
+
var AvatarClassNames = classnames((_classNames = {
|
|
819
913
|
Avatar: true
|
|
820
914
|
}, _defineProperty$1(_classNames, "Avatar--".concat(size), size), _defineProperty$1(_classNames, "Avatar--".concat(AvatarAppearance), AvatarAppearance), _defineProperty$1(_classNames, 'Avatar--disabled', !initials || !withTooltip), _classNames), className);
|
|
821
|
-
var
|
|
822
|
-
var
|
|
915
|
+
var TextClassNames = classnames((_classNames2 = {}, _defineProperty$1(_classNames2, "Avatar-content--".concat(size), size), _defineProperty$1(_classNames2, "Avatar-content--".concat(AvatarAppearance), AvatarAppearance), _classNames2));
|
|
916
|
+
var IconClassNames = classnames(_defineProperty$1({}, "Avatar-content--".concat(AvatarAppearance), AvatarAppearance));
|
|
917
|
+
var sharedProp = {
|
|
918
|
+
size: size,
|
|
919
|
+
firstName: firstName,
|
|
920
|
+
lastName: lastName,
|
|
921
|
+
appearance: AvatarAppearance
|
|
922
|
+
};
|
|
823
923
|
|
|
824
924
|
var renderAvatar = function renderAvatar() {
|
|
925
|
+
if (children && typeof children !== 'string') {
|
|
926
|
+
return /*#__PURE__*/React.createElement(AvatarProvider, {
|
|
927
|
+
value: sharedProp
|
|
928
|
+
}, /*#__PURE__*/React.createElement("span", _extends$2({
|
|
929
|
+
"data-test": "DesignSystem-Avatar"
|
|
930
|
+
}, baseProps, {
|
|
931
|
+
className: AvatarClassNames
|
|
932
|
+
}), children));
|
|
933
|
+
}
|
|
934
|
+
|
|
825
935
|
return /*#__PURE__*/React.createElement("span", _extends$2({
|
|
826
936
|
"data-test": "DesignSystem-Avatar"
|
|
827
937
|
}, baseProps, {
|
|
828
|
-
className:
|
|
938
|
+
className: AvatarClassNames
|
|
829
939
|
}), initials && /*#__PURE__*/React.createElement(Text, {
|
|
830
940
|
weight: "medium",
|
|
831
941
|
appearance: 'white',
|
|
832
|
-
className:
|
|
942
|
+
className: TextClassNames
|
|
833
943
|
}, initials), !initials && /*#__PURE__*/React.createElement(Icon, {
|
|
834
944
|
"data-test": "DesignSystem-Avatar--Icon",
|
|
835
945
|
name: "person",
|
|
836
|
-
size: size === 'regular' ?
|
|
946
|
+
size: size === 'regular' ? 20 : 16,
|
|
837
947
|
appearance: 'white',
|
|
838
|
-
className:
|
|
948
|
+
className: IconClassNames
|
|
839
949
|
}));
|
|
840
950
|
};
|
|
841
951
|
|
|
@@ -854,6 +964,8 @@ var Avatar = function Avatar(props) {
|
|
|
854
964
|
return renderTooltip();
|
|
855
965
|
};
|
|
856
966
|
Avatar.displayName = 'Avatar';
|
|
967
|
+
Avatar.Icon = AvatarIcon;
|
|
968
|
+
Avatar.Image = AvatarImage;
|
|
857
969
|
Avatar.defaultProps = {
|
|
858
970
|
tooltipPosition: 'bottom',
|
|
859
971
|
withTooltip: true,
|
|
@@ -7365,7 +7477,6 @@ var EditableDropdown = function EditableDropdown(props) {
|
|
|
7365
7477
|
|
|
7366
7478
|
var onClose = function onClose(selected) {
|
|
7367
7479
|
setEditing(false);
|
|
7368
|
-
setShowComponent(false);
|
|
7369
7480
|
if (onDropdownClose) onDropdownClose(selected);
|
|
7370
7481
|
};
|
|
7371
7482
|
|
|
@@ -13826,7 +13937,7 @@ var PopperWrapper = /*#__PURE__*/function (_React$Component) {
|
|
|
13826
13937
|
|
|
13827
13938
|
|
|
13828
13939
|
var popperAnimationStyles = {
|
|
13829
|
-
animation: open ? "popper-open-".concat(uniqueKey, " 120ms cubic-bezier(0, 0, 0.38, 0.9), popper-fade-in 120ms") : "popper-close-".concat(uniqueKey, " 120ms cubic-bezier(0.2, 0, 1, 0.9)
|
|
13940
|
+
animation: open ? "popper-open-".concat(uniqueKey, " 120ms cubic-bezier(0, 0, 0.38, 0.9), popper-fade-in 120ms") : "popper-close-".concat(uniqueKey, " 120ms cubic-bezier(0.2, 0, 1, 0.9), fadeOut 100ms")
|
|
13830
13941
|
};
|
|
13831
13942
|
childrenStyles = _objectSpread2(_objectSpread2(_objectSpread2({}, childrenStyles), popperAnimationStyles), {}, {
|
|
13832
13943
|
overflow: 'hidden'
|
|
@@ -14562,7 +14673,7 @@ var HorizontalNav = function HorizontalNav(props) {
|
|
|
14562
14673
|
}), list);
|
|
14563
14674
|
};
|
|
14564
14675
|
|
|
14565
|
-
var _excluded$c = ["children", "tooltip"];
|
|
14676
|
+
var _excluded$c = ["children", "tooltip", "showTooltip"];
|
|
14566
14677
|
var tooltipPropsList = ['trigger', 'on', 'open', 'offset', 'onToggle', 'dark', 'customStyle', 'closeOnBackdropClick', 'hideOnReferenceEscape', 'closeOnScroll'];
|
|
14567
14678
|
var positionValue = {
|
|
14568
14679
|
bottom: 'bottom',
|
|
@@ -14577,8 +14688,14 @@ var positionValue = {
|
|
|
14577
14688
|
var Tooltip = function Tooltip(props) {
|
|
14578
14689
|
var children = props.children,
|
|
14579
14690
|
tooltip = props.tooltip,
|
|
14691
|
+
showTooltip = props.showTooltip,
|
|
14580
14692
|
rest = _objectWithoutProperties(props, _excluded$c);
|
|
14581
14693
|
|
|
14694
|
+
if (!showTooltip) {
|
|
14695
|
+
// If showTooltip is false skip the Popover and return the children directly
|
|
14696
|
+
return children;
|
|
14697
|
+
}
|
|
14698
|
+
|
|
14582
14699
|
var tooltipWrapper = /*#__PURE__*/React.createElement("div", {
|
|
14583
14700
|
className: "Tooltip"
|
|
14584
14701
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
@@ -14602,7 +14719,8 @@ var Tooltip = function Tooltip(props) {
|
|
|
14602
14719
|
// }, propsList);
|
|
14603
14720
|
|
|
14604
14721
|
Tooltip.defaultProps = Object.assign({}, filterProps(Popover.defaultProps, tooltipPropsList), {
|
|
14605
|
-
hoverable: false
|
|
14722
|
+
hoverable: false,
|
|
14723
|
+
showTooltip: true
|
|
14606
14724
|
});
|
|
14607
14725
|
|
|
14608
14726
|
var Dialog = function Dialog(props) {
|
|
@@ -22066,21 +22184,26 @@ Divider.defaultProps = {
|
|
|
22066
22184
|
|
|
22067
22185
|
var HelpText = function HelpText(props) {
|
|
22068
22186
|
var error = props.error,
|
|
22069
|
-
message = props.message
|
|
22187
|
+
message = props.message,
|
|
22188
|
+
className = props.className;
|
|
22189
|
+
var baseProps = extractBaseProps(props);
|
|
22190
|
+
var classes = classnames({
|
|
22191
|
+
'mt-3': true
|
|
22192
|
+
}, className);
|
|
22070
22193
|
if (!message) return null;
|
|
22071
22194
|
|
|
22072
22195
|
if (error) {
|
|
22073
22196
|
return /*#__PURE__*/React.createElement(InlineMessage, {
|
|
22074
22197
|
size: "small",
|
|
22075
|
-
className:
|
|
22198
|
+
className: classes,
|
|
22076
22199
|
appearance: "alert",
|
|
22077
22200
|
description: message
|
|
22078
22201
|
});
|
|
22079
22202
|
}
|
|
22080
22203
|
|
|
22081
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
22082
|
-
className:
|
|
22083
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
22204
|
+
return /*#__PURE__*/React.createElement("div", _extends$2({}, baseProps, {
|
|
22205
|
+
className: classes
|
|
22206
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
22084
22207
|
appearance: "subtle",
|
|
22085
22208
|
size: "small",
|
|
22086
22209
|
weight: "medium"
|
|
@@ -23252,6 +23375,170 @@ Listbox.defaultProps = {
|
|
|
23252
23375
|
};
|
|
23253
23376
|
Listbox.Item = ListboxItem;
|
|
23254
23377
|
|
|
23255
|
-
|
|
23378
|
+
// TextFieldCommon.tsx
|
|
23379
|
+
var RenderHelpText = function RenderHelpText(_ref) {
|
|
23380
|
+
var helpText = _ref.helpText,
|
|
23381
|
+
error = _ref.error;
|
|
23382
|
+
return /*#__PURE__*/React__default.createElement(HelpText, {
|
|
23383
|
+
className: "d-flex",
|
|
23384
|
+
message: helpText.trim().length > 0 ? helpText : ' ',
|
|
23385
|
+
error: error ? error : undefined
|
|
23386
|
+
});
|
|
23387
|
+
};
|
|
23388
|
+
var RenderCounter = function RenderCounter(_ref2) {
|
|
23389
|
+
var inputText = _ref2.inputText,
|
|
23390
|
+
max = _ref2.max;
|
|
23391
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
23392
|
+
className: "mt-3 d-flex"
|
|
23393
|
+
}, /*#__PURE__*/React__default.createElement(Text, {
|
|
23394
|
+
appearance: "subtle",
|
|
23395
|
+
className: "pr-2",
|
|
23396
|
+
color: inputText.length > max ? 'alert' : undefined,
|
|
23397
|
+
size: "small",
|
|
23398
|
+
weight: "medium"
|
|
23399
|
+
}, inputText.length), /*#__PURE__*/React__default.createElement(Text, {
|
|
23400
|
+
appearance: "subtle",
|
|
23401
|
+
className: "pr-2",
|
|
23402
|
+
size: "small",
|
|
23403
|
+
weight: "medium"
|
|
23404
|
+
}, "/"), /*#__PURE__*/React__default.createElement(Text, {
|
|
23405
|
+
appearance: "subtle",
|
|
23406
|
+
size: "small",
|
|
23407
|
+
weight: "medium"
|
|
23408
|
+
}, max));
|
|
23409
|
+
};
|
|
23410
|
+
|
|
23411
|
+
var TextFieldWithTextarea = function TextFieldWithTextarea(props) {
|
|
23412
|
+
var label = props.label,
|
|
23413
|
+
_props$rows = props.rows,
|
|
23414
|
+
rows = _props$rows === void 0 ? 3 : _props$rows,
|
|
23415
|
+
_props$resize = props.resize,
|
|
23416
|
+
resize = _props$resize === void 0 ? true : _props$resize,
|
|
23417
|
+
required = props.required,
|
|
23418
|
+
error = props.error,
|
|
23419
|
+
onChange = props.onChange,
|
|
23420
|
+
_props$value = props.value,
|
|
23421
|
+
value = _props$value === void 0 ? '' : _props$value,
|
|
23422
|
+
_props$max = props.max,
|
|
23423
|
+
max = _props$max === void 0 ? 200 : _props$max,
|
|
23424
|
+
_props$helpText = props.helpText,
|
|
23425
|
+
helpText = _props$helpText === void 0 ? ' ' : _props$helpText;
|
|
23426
|
+
var textareaRef = React.useRef(null);
|
|
23427
|
+
|
|
23428
|
+
var _React$useState = React.useState(value),
|
|
23429
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
23430
|
+
inputText = _React$useState2[0],
|
|
23431
|
+
setInputText = _React$useState2[1];
|
|
23432
|
+
|
|
23433
|
+
var _React$useState3 = React.useState(0),
|
|
23434
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
23435
|
+
helptextWidth = _React$useState4[0],
|
|
23436
|
+
setHelptextWidth = _React$useState4[1];
|
|
23437
|
+
|
|
23438
|
+
var onChangeHandler = function onChangeHandler(e) {
|
|
23439
|
+
setInputText(e.target.value);
|
|
23440
|
+
if (onChange) onChange(e);
|
|
23441
|
+
};
|
|
23442
|
+
|
|
23443
|
+
var inputError = error || inputText.length > max;
|
|
23444
|
+
React.useEffect(function () {
|
|
23445
|
+
var textarea = textareaRef.current;
|
|
23446
|
+
|
|
23447
|
+
if (window.ResizeObserver) {
|
|
23448
|
+
var resizeObserver = new window.ResizeObserver(function (entries) {
|
|
23449
|
+
var entry = entries[0];
|
|
23450
|
+
var offsetWidth = entry.target.offsetWidth;
|
|
23451
|
+
setHelptextWidth(offsetWidth);
|
|
23452
|
+
});
|
|
23453
|
+
textarea && resizeObserver.observe(textarea);
|
|
23454
|
+
return function () {
|
|
23455
|
+
resizeObserver.disconnect();
|
|
23456
|
+
};
|
|
23457
|
+
}
|
|
23458
|
+
|
|
23459
|
+
return function () {};
|
|
23460
|
+
}, []);
|
|
23461
|
+
return /*#__PURE__*/React.createElement("div", null, label && /*#__PURE__*/React.createElement(Label, {
|
|
23462
|
+
required: required,
|
|
23463
|
+
withInput: true
|
|
23464
|
+
}, label), /*#__PURE__*/React.createElement(Textarea, _extends$2({}, props, {
|
|
23465
|
+
resize: resize,
|
|
23466
|
+
rows: rows,
|
|
23467
|
+
onChange: onChangeHandler,
|
|
23468
|
+
error: inputError,
|
|
23469
|
+
ref: textareaRef
|
|
23470
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
23471
|
+
className: "d-flex justify-content-between",
|
|
23472
|
+
style: {
|
|
23473
|
+
width: helptextWidth
|
|
23474
|
+
}
|
|
23475
|
+
}, /*#__PURE__*/React.createElement(RenderHelpText, {
|
|
23476
|
+
helpText: helpText,
|
|
23477
|
+
error: inputError
|
|
23478
|
+
}), /*#__PURE__*/React.createElement(RenderCounter, {
|
|
23479
|
+
inputText: inputText,
|
|
23480
|
+
max: max
|
|
23481
|
+
})));
|
|
23482
|
+
};
|
|
23483
|
+
|
|
23484
|
+
var TextFieldWithInput = function TextFieldWithInput(props) {
|
|
23485
|
+
var label = props.label,
|
|
23486
|
+
minWidth = props.minWidth,
|
|
23487
|
+
required = props.required,
|
|
23488
|
+
error = props.error,
|
|
23489
|
+
onChange = props.onChange,
|
|
23490
|
+
_props$value = props.value,
|
|
23491
|
+
value = _props$value === void 0 ? '' : _props$value,
|
|
23492
|
+
_props$max = props.max,
|
|
23493
|
+
max = _props$max === void 0 ? 200 : _props$max,
|
|
23494
|
+
_props$helpText = props.helpText,
|
|
23495
|
+
helpText = _props$helpText === void 0 ? ' ' : _props$helpText;
|
|
23496
|
+
|
|
23497
|
+
var _React$useState = React.useState(value),
|
|
23498
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
23499
|
+
inputText = _React$useState2[0],
|
|
23500
|
+
setInputText = _React$useState2[1];
|
|
23501
|
+
|
|
23502
|
+
var onChangeHandler = function onChangeHandler(event) {
|
|
23503
|
+
setInputText(event.target.value);
|
|
23504
|
+
if (onChange) onChange(event);
|
|
23505
|
+
};
|
|
23506
|
+
|
|
23507
|
+
var inputError = error || inputText.length > max;
|
|
23508
|
+
return /*#__PURE__*/React.createElement("div", null, label && /*#__PURE__*/React.createElement(Label, {
|
|
23509
|
+
required: required,
|
|
23510
|
+
withInput: true
|
|
23511
|
+
}, label), /*#__PURE__*/React.createElement(Input, _extends$2({}, props, {
|
|
23512
|
+
error: inputError,
|
|
23513
|
+
onChange: onChangeHandler
|
|
23514
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
23515
|
+
className: "d-flex justify-content-between",
|
|
23516
|
+
style: {
|
|
23517
|
+
minWidth: minWidth
|
|
23518
|
+
}
|
|
23519
|
+
}, /*#__PURE__*/React.createElement(RenderHelpText, {
|
|
23520
|
+
helpText: helpText,
|
|
23521
|
+
error: inputError
|
|
23522
|
+
}), /*#__PURE__*/React.createElement(RenderCounter, {
|
|
23523
|
+
inputText: inputText,
|
|
23524
|
+
max: max
|
|
23525
|
+
})));
|
|
23526
|
+
};
|
|
23527
|
+
TextFieldWithInput.defaultProps = {
|
|
23528
|
+
minWidth: 256
|
|
23529
|
+
};
|
|
23530
|
+
|
|
23531
|
+
var TextField = function TextField(props) {
|
|
23532
|
+
var withTextarea = props.withTextarea;
|
|
23533
|
+
|
|
23534
|
+
if (withTextarea) {
|
|
23535
|
+
return /*#__PURE__*/React.createElement(TextFieldWithTextarea, props);
|
|
23536
|
+
}
|
|
23537
|
+
|
|
23538
|
+
return /*#__PURE__*/React.createElement(TextFieldWithInput, props);
|
|
23539
|
+
};
|
|
23540
|
+
TextField.displayName = 'TextField';
|
|
23541
|
+
|
|
23542
|
+
var version = "2.27.0";
|
|
23256
23543
|
|
|
23257
|
-
export { ActionCard, Avatar, AvatarGroup, Backdrop, Badge, Breadcrumbs, Button, Calendar, Caption, Card, CardBody, CardFooter, CardHeader, CardSubdued, ChatMessage, Checkbox, Chip, ChipGroup, ChipInput, ChoiceList, Collapsible, Column, DatePicker, DateRangePicker, Dialog, Divider, Dropdown, Dropzone, EditableChipInput, EditableDropdown, EditableInput, EmptyState, FileList, FileUploader, FileUploaderList, FullscreenModal, Grid, GridCell, Heading, HelpText, HorizontalNav, Icon, InlineMessage, Input, X as InputMask, Label, Legend, Link, LinkButton, List, Listbox, Message, MetaList, MetricInput, Modal, ModalBody, ModalDescription, ModalFooter, ModalHeader, MultiSlider, Navigation, OutsideClick, PageHeader, Pagination, Paragraph, Pills, Placeholder, PlaceholderImage, PlaceholderParagraph, Popover, ProgressBar, ProgressRing, Radio, RangeSlider, Row, SelectionCard, Sidesheet, Slider, Spinner, StatusHint, Stepper, Subheading, Switch, Tab, Table, Tabs, TabsWrapper, Text, Textarea, TimePicker, Toast, Tooltip, index as Utils, VerificationCodeInput, VerticalNav, version };
|
|
23544
|
+
export { ActionCard, Avatar, AvatarGroup, Backdrop, Badge, Breadcrumbs, Button, Calendar, Caption, Card, CardBody, CardFooter, CardHeader, CardSubdued, ChatMessage, Checkbox, Chip, ChipGroup, ChipInput, ChoiceList, Collapsible, Column, DatePicker, DateRangePicker, Dialog, Divider, Dropdown, Dropzone, EditableChipInput, EditableDropdown, EditableInput, EmptyState, FileList, FileUploader, FileUploaderList, FullscreenModal, Grid, GridCell, Heading, HelpText, HorizontalNav, Icon, InlineMessage, Input, X as InputMask, Label, Legend, Link, LinkButton, List, Listbox, Message, MetaList, MetricInput, Modal, ModalBody, ModalDescription, ModalFooter, ModalHeader, MultiSlider, Navigation, OutsideClick, PageHeader, Pagination, Paragraph, Pills, Placeholder, PlaceholderImage, PlaceholderParagraph, Popover, ProgressBar, ProgressRing, Radio, RangeSlider, Row, SelectionCard, Sidesheet, Slider, Spinner, StatusHint, Stepper, Subheading, Switch, Tab, Table, Tabs, TabsWrapper, Text, TextField, Textarea, TimePicker, Toast, Tooltip, index as Utils, VerificationCodeInput, VerticalNav, version };
|