@luscii-healthtech/web-ui 21.3.3 → 21.4.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/dist/components/Input/StyledInput.d.ts +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.development.js +55 -47
- package/dist/index.development.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/web-ui-tailwind.css +0 -4
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { AllowedTextInputTypes } from "../Form/form.types";
|
|
3
|
+
import type { IconProps } from "../Icons/types/IconProps.type";
|
|
4
|
+
import type { FormFieldWidth } from "../Form/form.types";
|
|
5
|
+
export declare const StyledInput: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "type"> & {
|
|
6
|
+
type?: AllowedTextInputTypes | undefined;
|
|
7
|
+
suffix?: string | undefined;
|
|
8
|
+
prefix?: string | undefined;
|
|
9
|
+
icon?: "BellIcon" | "BluetoothIcon" | "BrushIcon" | "CalendarDayIcon" | "CalendarMonthIcon" | "CalendarRepeatIcon" | "ChartBarsIcon" | "ChartLineAndBarsIcon" | "ChatBubbleIcon" | "ChatBubbleWithTextIcon" | "CheckIcon" | "ChevronDoubleIcon" | "ChevronDownIcon" | "ChevronLeftIcon" | "ChevronRightIcon" | "ClockIcon" | "CogwheelIcon" | "CopyToClipboardIcon" | "CrossIcon" | "CrossInCircleIcon" | "CrossInFilledCircleIcon" | "DatabaseIcon" | "DragIndicatorIcon" | "EarthIcon" | "EmailIcon" | "EmptyIcon" | "ExclamationMarkIcon" | "ExportIcon" | "EyeClosedIcon" | "EyeOpenIcon" | "FilterIcon" | "FireIcon" | "FirstAidKitIcon" | "FlagIcon" | "ForwardIcon" | "GroupIcon" | "GroupOfThreeIcon" | "HamburgerIcon" | "HandshakeIcon" | "HeartIcon" | "HomeIcon" | "ImageIcon" | "InfoIcon" | "LifebuoyIcon" | "LightBulbIcon" | "LinkIcon" | "LockIcon" | "LogInIcon" | "LogOutIcon" | "MessageWithArrowIcon" | "MoreIcon" | "MouseIcon" | "NoteIcon" | "PageViewIcon" | "PatientIcon" | "PencilIcon" | "PhoneIcon" | "PieChartIcon" | "PinIcon" | "PlusIcon" | "PrinterIcon" | "RobotIcon" | "RocketIcon" | "SearchIcon" | "ShareIcon" | "SmallCircleIcon" | "SmallDiamondIcon" | "SmallSquareIcon" | "StarIcon" | "TrashBinIcon" | "TreeIcon" | "AddIcon" | "AlertsIcon" | "ChartIcon" | "ChatBoxIcon" | "DeleteIcon" | "DragIcon" | "EditIcon" | "EyeIcon" | "EyeIconSlashed" | "GearIcon" | "MessagesIcon" | "NotesIcon" | "PrintIcon" | "SpaceRocketIcon" | "SettingsIcon" | "RightArrowIcon" | "DownArrowIcon" | "LeftArrowIcon" | "WarningIcon" | "ChartLineColoredIcon" | "GearColoredIcon" | "GroupColoredIcon" | "StatusColoredIcon" | React.FC<IconProps> | undefined;
|
|
10
|
+
width?: FormFieldWidth | undefined;
|
|
11
|
+
isError?: boolean | undefined;
|
|
12
|
+
isClearIconVisible?: boolean | undefined;
|
|
13
|
+
onClickClearField?: (() => void) | undefined;
|
|
14
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export { default as Dropdown } from "./components/Dropdown/Dropdown";
|
|
|
32
32
|
export { EmptyListMessage } from "./components/EmptyListMessage/EmptyListMessage";
|
|
33
33
|
export { InfoField } from "./components/InfoField/InfoField";
|
|
34
34
|
export { default as Input } from "./components/Input/Input";
|
|
35
|
+
export { StyledInput } from "./components/Input/StyledInput";
|
|
35
36
|
export { default as Line } from "./components/Line/Line";
|
|
36
37
|
export { Table, type TableProps } from "./components/Table/Table";
|
|
37
38
|
export { type TableFieldConfig, type TableFieldContent, type TableFieldText, type TableFieldAction, } from "./components/Table/Table.types";
|
|
@@ -1510,49 +1510,20 @@ const List = (props) => {
|
|
|
1510
1510
|
var css_248z$g = ".input::-ms-clear {\n display: none;\n}";
|
|
1511
1511
|
styleInject(css_248z$g);
|
|
1512
1512
|
|
|
1513
|
-
const
|
|
1514
|
-
var {
|
|
1515
|
-
const
|
|
1516
|
-
const
|
|
1517
|
-
|
|
1518
|
-
setInnerValue(value);
|
|
1519
|
-
}, [value]);
|
|
1520
|
-
const clearField = () => {
|
|
1521
|
-
setInnerValue("");
|
|
1522
|
-
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
1523
|
-
target: {
|
|
1524
|
-
name: name || "",
|
|
1525
|
-
value: ""
|
|
1526
|
-
},
|
|
1527
|
-
currentTarget: {
|
|
1528
|
-
name: name || "",
|
|
1529
|
-
value: ""
|
|
1530
|
-
}
|
|
1531
|
-
});
|
|
1532
|
-
};
|
|
1533
|
-
const handleChangeEvent = (event) => {
|
|
1534
|
-
setInnerValue(event.currentTarget.value);
|
|
1535
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(asFormField ? event.currentTarget.value : {
|
|
1536
|
-
target: {
|
|
1537
|
-
name: name || "",
|
|
1538
|
-
value: event.currentTarget.value
|
|
1539
|
-
},
|
|
1540
|
-
currentTarget: {
|
|
1541
|
-
name: name || "",
|
|
1542
|
-
value: event.currentTarget.value
|
|
1543
|
-
}
|
|
1544
|
-
});
|
|
1545
|
-
};
|
|
1546
|
-
const isClearIconVisible = clearable && innerValue;
|
|
1513
|
+
const StyledInput = React__namespace.default.forwardRef((_a, ref) => {
|
|
1514
|
+
var { suffix, prefix, className, width = "full", icon, isError, disabled: isDisabled, isClearIconVisible, onClickClearField } = _a, rest = __rest(_a, ["suffix", "prefix", "className", "width", "icon", "isError", "disabled", "isClearIconVisible", "onClickClearField"]);
|
|
1515
|
+
const hasPrefix = !!prefix;
|
|
1516
|
+
const hasSuffix = !!suffix;
|
|
1517
|
+
const hasNoExtraContent = !hasPrefix && !hasSuffix;
|
|
1547
1518
|
return React__namespace.default.createElement(
|
|
1548
1519
|
FlexRow,
|
|
1549
1520
|
{ spacing: "none", "data-test-id": "input-component-container", stretch: false },
|
|
1550
1521
|
React__namespace.default.createElement("span", { className: classNames__default.default("ui-h-11 ui-border-b ui-border-t ui-border-solid ui-border-input-border", {
|
|
1551
1522
|
"ui-hidden": hasNoExtraContent,
|
|
1552
|
-
"ui-order-1":
|
|
1553
|
-
"ui-rounded-l ui-border-l":
|
|
1554
|
-
"ui-rounded-r ui-border-r":
|
|
1555
|
-
}, "ui-flex ui-flex-col ui-items-center ui-p-3", "ui-text-sm", "ui-text-slate-500", "ui-bg-main-background") },
|
|
1523
|
+
"ui-order-1": hasSuffix,
|
|
1524
|
+
"ui-rounded-l ui-border-l": hasPrefix,
|
|
1525
|
+
"ui-rounded-r ui-border-r": hasSuffix
|
|
1526
|
+
}, "ui-flex ui-flex-col ui-items-center ui-p-3", "ui-text-sm", "ui-text-slate-500", "ui-bg-main-background") }, suffix || prefix),
|
|
1556
1527
|
React__namespace.default.createElement(
|
|
1557
1528
|
"div",
|
|
1558
1529
|
{ className: classNames__default.default("ui-relative", {
|
|
@@ -1568,13 +1539,13 @@ const Input = React__namespace.default.forwardRef((_a, ref) => {
|
|
|
1568
1539
|
} },
|
|
1569
1540
|
React__namespace.default.createElement(IconComponentOrKey, { name: icon, className: "ui-h-6 ui-w-6 ui-text-slate-300" })
|
|
1570
1541
|
),
|
|
1571
|
-
React__namespace.default.createElement("input", Object.assign({
|
|
1542
|
+
React__namespace.default.createElement("input", Object.assign({ ref, className: classNames__default.default("input", "ui-block", {
|
|
1572
1543
|
"ui-w-16": width === "sm",
|
|
1573
1544
|
"ui-w-32": width === "md",
|
|
1574
1545
|
"ui-w-56": width === "lg",
|
|
1575
1546
|
"ui-w-80": width === "xl",
|
|
1576
1547
|
"ui-flex-grow": width === "full"
|
|
1577
|
-
}, { "ui-pl-12": icon
|
|
1548
|
+
}, { "ui-pl-12": icon }, {
|
|
1578
1549
|
"ui-bg-slate-50 ui-text-slate-400": isDisabled,
|
|
1579
1550
|
"ui-text-slate-800": !isDisabled,
|
|
1580
1551
|
"ui-border-input-border": !isDisabled && !isError,
|
|
@@ -1585,13 +1556,13 @@ const Input = React__namespace.default.forwardRef((_a, ref) => {
|
|
|
1585
1556
|
"focus:ui-outline-primary": !isError,
|
|
1586
1557
|
"ui-bg-white": !isDisabled
|
|
1587
1558
|
}, "ui-h-11", "ui-p-2", "ui-border", "ui-text-sm", "ui-placeholder-slate-500", "ui-border-solid", "ui-transition-colors", "ui-duration-300", {
|
|
1588
|
-
"ui-z-10":
|
|
1559
|
+
"ui-z-10": hasSuffix || hasPrefix,
|
|
1589
1560
|
"ui-rounded": hasNoExtraContent,
|
|
1590
|
-
"ui-rounded-l":
|
|
1591
|
-
"ui-rounded-r":
|
|
1592
|
-
"ui-order-2":
|
|
1593
|
-
"ui-order-1":
|
|
1594
|
-
}, "ui-shadow-default", className) })),
|
|
1561
|
+
"ui-rounded-l": hasSuffix,
|
|
1562
|
+
"ui-rounded-r": hasPrefix,
|
|
1563
|
+
"ui-order-2": hasPrefix,
|
|
1564
|
+
"ui-order-1": hasSuffix
|
|
1565
|
+
}, "ui-shadow-default", className) }, rest)),
|
|
1595
1566
|
React__namespace.default.createElement(
|
|
1596
1567
|
"div",
|
|
1597
1568
|
{ className: "ui-absolute ui-right-0 ui-top-1/2", style: {
|
|
@@ -1600,12 +1571,48 @@ const Input = React__namespace.default.forwardRef((_a, ref) => {
|
|
|
1600
1571
|
React__namespace.default.createElement(CrossIcon, { className: classNames__default.default("ui-mr-3 ui-h-6 ui-w-6 ui-cursor-pointer ui-text-slate-300", {
|
|
1601
1572
|
"ui-block": isClearIconVisible,
|
|
1602
1573
|
"ui-hidden": !isClearIconVisible
|
|
1603
|
-
}), onClick:
|
|
1574
|
+
}), onClick: onClickClearField })
|
|
1604
1575
|
)
|
|
1605
1576
|
)
|
|
1606
1577
|
);
|
|
1607
1578
|
});
|
|
1608
1579
|
|
|
1580
|
+
const Input = React__namespace.default.forwardRef((_a, ref) => {
|
|
1581
|
+
var { withSuffix = "", withPrefix = "", clearable = false, isDisabled = false, name, value = "", onChange, asFormField, maxLength } = _a, otherProps = __rest(_a, ["withSuffix", "withPrefix", "clearable", "isDisabled", "name", "value", "onChange", "asFormField", "maxLength"]);
|
|
1582
|
+
const [innerValue, setInnerValue] = React.useState(value);
|
|
1583
|
+
React.useEffect(() => {
|
|
1584
|
+
setInnerValue(value);
|
|
1585
|
+
}, [value]);
|
|
1586
|
+
const clearField = () => {
|
|
1587
|
+
setInnerValue("");
|
|
1588
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
1589
|
+
target: {
|
|
1590
|
+
name: name || "",
|
|
1591
|
+
value: ""
|
|
1592
|
+
},
|
|
1593
|
+
currentTarget: {
|
|
1594
|
+
name: name || "",
|
|
1595
|
+
value: ""
|
|
1596
|
+
}
|
|
1597
|
+
});
|
|
1598
|
+
};
|
|
1599
|
+
const handleChangeEvent = (event) => {
|
|
1600
|
+
setInnerValue(event.currentTarget.value);
|
|
1601
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(asFormField ? event.currentTarget.value : {
|
|
1602
|
+
target: {
|
|
1603
|
+
name: name || "",
|
|
1604
|
+
value: event.currentTarget.value
|
|
1605
|
+
},
|
|
1606
|
+
currentTarget: {
|
|
1607
|
+
name: name || "",
|
|
1608
|
+
value: event.currentTarget.value
|
|
1609
|
+
}
|
|
1610
|
+
});
|
|
1611
|
+
};
|
|
1612
|
+
const isClearIconVisible = clearable && !!innerValue;
|
|
1613
|
+
return React__namespace.default.createElement(StyledInput, Object.assign({ "data-test-id": `input-${name}`, name, value: innerValue, onChange: handleChangeEvent, ref, size: maxLength, disabled: isDisabled, isClearIconVisible, onClickClearField: clearField, prefix: withPrefix, suffix: withSuffix }, otherProps));
|
|
1614
|
+
});
|
|
1615
|
+
|
|
1609
1616
|
const SearchInput = React__namespace.default.forwardRef((props, ref) => {
|
|
1610
1617
|
var _a;
|
|
1611
1618
|
return React__namespace.default.createElement(Input, Object.assign({}, props, { icon: "SearchIcon", type: "text", width: (_a = props.width) !== null && _a !== void 0 ? _a : "xl", clearable: true, ref }));
|
|
@@ -6236,6 +6243,7 @@ exports.StarIcon = StarIcon;
|
|
|
6236
6243
|
exports.StatusColoredIcon = StatusColoredIcon;
|
|
6237
6244
|
exports.StatusIndicator = StatusIndicator;
|
|
6238
6245
|
exports.Steps = Steps;
|
|
6246
|
+
exports.StyledInput = StyledInput;
|
|
6239
6247
|
exports.Switcher = Switcher;
|
|
6240
6248
|
exports.TOASTER_TYPE_OPTIONS = TOASTER_TYPE_OPTIONS;
|
|
6241
6249
|
exports.Tabbar = Tabbar;
|