@luscii-healthtech/web-ui 40.6.3 → 40.6.5
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/index.development.js +52 -50
- package/dist/index.development.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/components/Input/Input.d.ts +2 -0
- package/dist/src/components/Input/LabeledInput.d.ts +1 -0
- package/dist/src/components/Input/StyledInput.d.ts +2 -0
- package/dist/src/components/InputSelect/InputSelect.d.ts +16 -1
- package/dist/src/components/InputSelect/InputSelect.utils.d.ts +8 -2
- package/dist/src/components/InputSelect/InputSelectInput.d.ts +10 -1
- package/dist/src/components/InputSelect/InputSelectSelect.d.ts +1 -0
- package/dist/src/components/Select/LabeledSelect.d.ts +1 -0
- package/dist/src/components/Select/StyledSelect.d.ts +2 -0
- package/dist/src/system/Sizes.d.ts +8 -0
- package/dist/src/utils/prefixKeys.d.ts +13 -0
- package/dist/stories/Input.stories.d.ts +1 -0
- package/dist/stories/InputSelect.stories.d.ts +12 -1
- package/dist/stories/LabeledInput.stories.d.ts +1 -0
- package/dist/stories/StyledSelect.stories.d.ts +17 -0
- package/dist/web-ui-tailwind.css +6 -0
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1620,16 +1620,24 @@ const calculateResponsiveWidthClasses = (size) => {
|
|
|
1620
1620
|
};
|
|
1621
1621
|
|
|
1622
1622
|
const StyledInput = React__namespace.default.forwardRef((_a, ref) => {
|
|
1623
|
-
var { suffix, prefix, className, width = "full", icon, isError, isClearIconVisible, onClickClearField } = _a, attributes = __rest(_a, ["suffix", "prefix", "className", "width", "icon", "isError", "isClearIconVisible", "onClickClearField"]);
|
|
1623
|
+
var { suffix, prefix, className, width = "full", height = "lg", icon, isError, isClearIconVisible, onClickClearField } = _a, attributes = __rest(_a, ["suffix", "prefix", "className", "width", "height", "icon", "isError", "isClearIconVisible", "onClickClearField"]);
|
|
1624
1624
|
const hasPrefix = !!prefix;
|
|
1625
1625
|
const hasSuffix = !!suffix;
|
|
1626
1626
|
const hasNoExtraContent = !hasPrefix && !hasSuffix;
|
|
1627
|
-
|
|
1627
|
+
const heightClasses = {
|
|
1628
|
+
md: "ui:h-form-md",
|
|
1629
|
+
lg: "ui:h-form-lg"
|
|
1630
|
+
};
|
|
1631
|
+
const prefixSuffixPaddingClasses = {
|
|
1632
|
+
md: "ui:py-2 ui:px-3",
|
|
1633
|
+
lg: "ui:p-3"
|
|
1634
|
+
};
|
|
1635
|
+
return jsxRuntime.jsxs(FlexRow, { spacing: "none", "data-test-id": "input-component-container", stretch: false, children: [jsxRuntime.jsx("span", { className: classNames__default.default(heightClasses[height], prefixSuffixPaddingClasses[height], "ui:border-b ui:border-t ui:border-solid ui:border-input-border", {
|
|
1628
1636
|
"ui:hidden": hasNoExtraContent,
|
|
1629
1637
|
"ui:order-1": hasSuffix,
|
|
1630
1638
|
"ui:rounded-l ui:border-l": hasPrefix,
|
|
1631
1639
|
"ui:rounded-r ui:border-r": hasSuffix
|
|
1632
|
-
}, "ui:flex ui:flex-col ui:items-center
|
|
1640
|
+
}, "ui:flex ui:flex-col ui:items-center", "ui:text-sm", "ui:text-slate-500", "ui:bg-main-background"), children: suffix || prefix }), jsxRuntime.jsxs("div", { className: classNames__default.default("ui:relative", {
|
|
1633
1641
|
"ui:flex ui:grow": width === "full"
|
|
1634
1642
|
}), children: [icon && jsxRuntime.jsx("div", { className: classNames__default.default("ui:absolute ui:left-4 ui:top-1/2", {
|
|
1635
1643
|
"ui:grow": width === "full"
|
|
@@ -1646,7 +1654,7 @@ const StyledInput = React__namespace.default.forwardRef((_a, ref) => {
|
|
|
1646
1654
|
"ui:focus:border-primary": !isError,
|
|
1647
1655
|
"ui:focus:outline-primary": !isError,
|
|
1648
1656
|
"ui:bg-white": !attributes.disabled
|
|
1649
|
-
},
|
|
1657
|
+
}, heightClasses[height], "ui:p-2", "ui:border", "ui:text-base ui:sm:text-sm", "ui:placeholder-slate-500", "ui:border-solid", "ui:transition-colors", "ui:duration-300", {
|
|
1650
1658
|
"ui:z-10": hasSuffix || hasPrefix,
|
|
1651
1659
|
// to make sure the ui:outline is displayed completely
|
|
1652
1660
|
"ui:rounded": hasNoExtraContent,
|
|
@@ -1663,7 +1671,7 @@ const StyledInput = React__namespace.default.forwardRef((_a, ref) => {
|
|
|
1663
1671
|
});
|
|
1664
1672
|
|
|
1665
1673
|
const Input = React__namespace.default.forwardRef((_a, ref) => {
|
|
1666
|
-
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"]);
|
|
1674
|
+
var { withSuffix = "", withPrefix = "", clearable = false, isDisabled = false, name, value = "", onChange, asFormField, maxLength, height = "lg" } = _a, otherProps = __rest(_a, ["withSuffix", "withPrefix", "clearable", "isDisabled", "name", "value", "onChange", "asFormField", "maxLength", "height"]);
|
|
1667
1675
|
const [innerValue, setInnerValue] = React.useState(value);
|
|
1668
1676
|
React.useEffect(() => {
|
|
1669
1677
|
setInnerValue(value);
|
|
@@ -1695,7 +1703,7 @@ const Input = React__namespace.default.forwardRef((_a, ref) => {
|
|
|
1695
1703
|
});
|
|
1696
1704
|
};
|
|
1697
1705
|
const isClearIconVisible = clearable && !!innerValue;
|
|
1698
|
-
return jsxRuntime.jsx(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));
|
|
1706
|
+
return jsxRuntime.jsx(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, height }, otherProps));
|
|
1699
1707
|
});
|
|
1700
1708
|
|
|
1701
1709
|
const SearchInput = React__namespace.default.forwardRef((props, ref) => {
|
|
@@ -4378,51 +4386,43 @@ var css_248z$3 = ".styled-select {\n appearance: none;\n}\n.styled-select::pick
|
|
|
4378
4386
|
styleInject(css_248z$3);
|
|
4379
4387
|
|
|
4380
4388
|
const StyledSelect = React__namespace.default.forwardRef((_a, ref) => {
|
|
4381
|
-
var { children, suffix, prefix, className, width = "full", isError } = _a, attributes = __rest(_a, ["children", "suffix", "prefix", "className", "width", "isError"]);
|
|
4389
|
+
var { children, suffix, prefix, className, width = "full", height = "lg", isError } = _a, attributes = __rest(_a, ["children", "suffix", "prefix", "className", "width", "height", "isError"]);
|
|
4382
4390
|
const hasPrefix = !!prefix;
|
|
4383
4391
|
const hasSuffix = !!suffix;
|
|
4384
4392
|
const hasNoExtraContent = !hasPrefix && !hasSuffix;
|
|
4385
|
-
|
|
4393
|
+
const heightClasses = {
|
|
4394
|
+
md: "ui:h-form-md",
|
|
4395
|
+
lg: "ui:h-form-lg"
|
|
4396
|
+
};
|
|
4397
|
+
const paddingClasses = {
|
|
4398
|
+
md: "ui:px-3 py-2 ui:pr-10",
|
|
4399
|
+
// pr-10 to account for the chevron icon
|
|
4400
|
+
lg: "ui:p-3 ui:pr-10"
|
|
4401
|
+
};
|
|
4402
|
+
return jsxRuntime.jsxs(FlexRow, { spacing: "none", "data-test-id": "input-component-container", stretch: false, children: [jsxRuntime.jsx("span", { className: classNames__default.default(heightClasses[height], "ui:border-b ui:border-t ui:border-solid ui:border-input-border", {
|
|
4386
4403
|
"ui:hidden": hasNoExtraContent,
|
|
4387
4404
|
"ui:order-1": hasSuffix,
|
|
4388
4405
|
"ui:rounded-l ui:border-l": hasPrefix,
|
|
4389
4406
|
"ui:rounded-r ui:border-r": hasSuffix
|
|
4390
4407
|
}, "ui:flex ui:flex-col ui:items-center ui:p-3", "ui:text-sm", "ui:text-slate-500", "ui:bg-main-background"), children: suffix || prefix }), jsxRuntime.jsxs("div", { className: classNames__default.default("ui:relative", {
|
|
4391
4408
|
"ui:flex ui:grow": width === "full"
|
|
4392
|
-
}), children: [jsxRuntime.jsx("select", Object.assign({ ref, className: classNames__default.default(
|
|
4393
|
-
"
|
|
4394
|
-
"ui:
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
"ui:
|
|
4408
|
-
|
|
4409
|
-
// pr-10 to account for the chevron icon
|
|
4410
|
-
"ui:border",
|
|
4411
|
-
"ui:text-base ui:sm:text-sm",
|
|
4412
|
-
"ui:placeholder-slate-500",
|
|
4413
|
-
"ui:border-solid",
|
|
4414
|
-
"ui:transition-colors",
|
|
4415
|
-
"ui:duration-300",
|
|
4416
|
-
{
|
|
4417
|
-
"ui:rounded": hasNoExtraContent,
|
|
4418
|
-
"ui:rounded-l": hasSuffix,
|
|
4419
|
-
"ui:rounded-r": hasPrefix,
|
|
4420
|
-
"ui:order-2": hasPrefix,
|
|
4421
|
-
"ui:order-1": hasSuffix
|
|
4422
|
-
},
|
|
4423
|
-
"ui:shadow-default",
|
|
4424
|
-
className
|
|
4425
|
-
) }, attributes, { children })), jsxRuntime.jsx("div", { className: "ui:pointer-events-none ui:absolute ui:right-0 ui:top-1/2 ui:z-20", style: {
|
|
4409
|
+
}), children: [jsxRuntime.jsx("select", Object.assign({ ref, className: classNames__default.default("styled-select", "ui:block ui:min-w-[4rem]", calculateResponsiveWidthClasses(width), {
|
|
4410
|
+
"ui:bg-slate-50 ui:text-slate-400": attributes.disabled,
|
|
4411
|
+
"ui:text-slate-800": !attributes.disabled,
|
|
4412
|
+
"ui:border-input-border": !attributes.disabled && !isError,
|
|
4413
|
+
"ui:hover:border-input-border-dark": !attributes.disabled,
|
|
4414
|
+
"ui:border-red-700": isError,
|
|
4415
|
+
"ui:focus:outline-negative": isError,
|
|
4416
|
+
"ui:focus:border-primary": !isError,
|
|
4417
|
+
"ui:focus:outline-primary": !isError,
|
|
4418
|
+
"ui:bg-white": !attributes.disabled
|
|
4419
|
+
}, heightClasses[height], paddingClasses[height], "ui:border", "ui:text-base ui:sm:text-sm", "ui:placeholder-slate-500", "ui:border-solid", "ui:transition-colors", "ui:duration-300", {
|
|
4420
|
+
"ui:rounded": hasNoExtraContent,
|
|
4421
|
+
"ui:rounded-l": hasSuffix,
|
|
4422
|
+
"ui:rounded-r": hasPrefix,
|
|
4423
|
+
"ui:order-2": hasPrefix,
|
|
4424
|
+
"ui:order-1": hasSuffix
|
|
4425
|
+
}, "ui:shadow-default", className) }, attributes, { children })), jsxRuntime.jsx("div", { className: "ui:pointer-events-none ui:absolute ui:right-0 ui:top-1/2 ui:z-20", style: {
|
|
4426
4426
|
transform: "translateY(-50%)"
|
|
4427
4427
|
}, children: jsxRuntime.jsx(ChevronDownIcon, { className: classNames__default.default("ui:mr-3 ui:h-6 ui:w-6 ui:text-slate-300") }) })] })] });
|
|
4428
4428
|
});
|
|
@@ -5864,7 +5864,7 @@ PageWithCenteredContentLayout.Header = Header;
|
|
|
5864
5864
|
PageWithCenteredContentLayout.Main = Main;
|
|
5865
5865
|
|
|
5866
5866
|
const InputSelectInput = React__namespace.default.forwardRef((props, ref) => {
|
|
5867
|
-
return jsxRuntime.jsx(
|
|
5867
|
+
return jsxRuntime.jsx(StyledInput, Object.assign({ ref }, props));
|
|
5868
5868
|
});
|
|
5869
5869
|
InputSelectInput.displayName = "InputSelect.Input";
|
|
5870
5870
|
|
|
@@ -5873,15 +5873,17 @@ const InputSelectSelect = React__namespace.default.forwardRef((props, ref) => {
|
|
|
5873
5873
|
});
|
|
5874
5874
|
InputSelectSelect.displayName = "InputSelect.Select";
|
|
5875
5875
|
|
|
5876
|
-
const createStyledSelectChild = (child,
|
|
5876
|
+
const createStyledSelectChild = (child, options) => {
|
|
5877
|
+
const { isFirstChild, height } = options;
|
|
5877
5878
|
const isDisabled = child.props.disabled;
|
|
5878
5879
|
const isError = child.props.isError;
|
|
5879
5880
|
const zIndexClass = isDisabled ? "ui:relative" : isError ? "ui:relative ui:z-[2] ui:hover:z-[3] ui:focus:z-[4]" : "ui:relative ui:z-0 ui:hover:z-[3] ui:focus:z-[4]";
|
|
5880
5881
|
const borderRadiusClass = isFirstChild ? "ui:rounded-r-none ui:focus:rounded-r-none" : "ui:rounded-l-none ui:focus:rounded-l-none";
|
|
5881
5882
|
const marginClass = isFirstChild ? "" : "ui:-ml-px";
|
|
5882
|
-
return React__namespace.default.cloneElement(child, Object.assign(Object.assign({}, child.props), { className: classNames__default.default(child.props.className, zIndexClass, marginClass, borderRadiusClass), style: Object.assign({ backgroundColor: "var(--ui-color-background)", color: "var(--ui-color-on-surface-variant)" }, child.props.style) }));
|
|
5883
|
+
return React__namespace.default.cloneElement(child, Object.assign(Object.assign({}, child.props), { className: classNames__default.default(child.props.className, zIndexClass, marginClass, borderRadiusClass), height, style: Object.assign({ backgroundColor: "var(--ui-color-background)", color: "var(--ui-color-on-surface-variant)" }, child.props.style) }));
|
|
5883
5884
|
};
|
|
5884
|
-
const createStyledInputChild = (child,
|
|
5885
|
+
const createStyledInputChild = (child, options) => {
|
|
5886
|
+
const { isFirstChild, height } = options;
|
|
5885
5887
|
const isFullWidth = child.props.width === "full";
|
|
5886
5888
|
const hasExplicitWidth = child.props.width !== void 0;
|
|
5887
5889
|
const isDisabled = child.props.isDisabled;
|
|
@@ -5889,7 +5891,7 @@ const createStyledInputChild = (child, isFirstChild) => {
|
|
|
5889
5891
|
const zIndexClass = isDisabled ? "ui:relative" : isError ? "ui:relative ui:z-[2] ui:hover:z-[3] ui:focus:z-[4]" : isFirstChild ? "ui:relative ui:z-[1] ui:focus:z-[4]" : "ui:relative ui:z-0 ui:focus:z-[4]";
|
|
5890
5892
|
const borderRadiusClass = isFirstChild ? "ui:rounded-r-none ui:focus:rounded-r-none" : "ui:rounded-l-none ui:focus:rounded-l-none";
|
|
5891
5893
|
const marginClass = hasExplicitWidth ? "" : isFirstChild ? "ui:-mr-px" : "ui:-ml-px";
|
|
5892
|
-
const styledInput = React__namespace.default.cloneElement(child, Object.assign(Object.assign({}, child.props), { className: classNames__default.default(child.props.className, zIndexClass, borderRadiusClass, marginClass) }));
|
|
5894
|
+
const styledInput = React__namespace.default.cloneElement(child, Object.assign(Object.assign({}, child.props), { className: classNames__default.default(child.props.className, zIndexClass, borderRadiusClass, marginClass), height }));
|
|
5893
5895
|
if (isFullWidth) {
|
|
5894
5896
|
return jsxRuntime.jsx("div", { className: "ui:flex-1", children: styledInput });
|
|
5895
5897
|
}
|
|
@@ -5897,7 +5899,7 @@ const createStyledInputChild = (child, isFirstChild) => {
|
|
|
5897
5899
|
};
|
|
5898
5900
|
|
|
5899
5901
|
const InputSelect = React__namespace.default.forwardRef((props, ref) => {
|
|
5900
|
-
const { className, children } = props;
|
|
5902
|
+
const { className, children, height = "lg" } = props;
|
|
5901
5903
|
const childrenArray = React__namespace.default.Children.toArray(children);
|
|
5902
5904
|
if (childrenArray.length !== 2) {
|
|
5903
5905
|
console.error("InputSelect requires exactly 2 children: InputSelect.Input and InputSelect.Select");
|
|
@@ -5917,9 +5919,9 @@ const InputSelect = React__namespace.default.forwardRef((props, ref) => {
|
|
|
5917
5919
|
const isSelectChild = child.type === InputSelectSelect;
|
|
5918
5920
|
const isInputChild = child.type === InputSelectInput;
|
|
5919
5921
|
if (isSelectChild) {
|
|
5920
|
-
return createStyledSelectChild(child, isFirstChild);
|
|
5922
|
+
return createStyledSelectChild(child, { isFirstChild, height });
|
|
5921
5923
|
} else if (isInputChild) {
|
|
5922
|
-
return createStyledInputChild(child, isFirstChild);
|
|
5924
|
+
return createStyledInputChild(child, { isFirstChild, height });
|
|
5923
5925
|
}
|
|
5924
5926
|
return child;
|
|
5925
5927
|
});
|