@luscii-healthtech/web-ui 40.5.0 → 40.6.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/index.development.js +105 -19
- 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/InputSelect/InputSelect.d.ts +22 -0
- package/dist/src/components/InputSelect/InputSelect.utils.d.ts +3 -0
- package/dist/src/components/InputSelect/InputSelectInput.d.ts +2 -0
- package/dist/src/components/InputSelect/InputSelectSelect.d.ts +8 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/stories/InputSelect.stories.d.ts +23 -0
- package/dist/web-ui-tailwind.css +51 -2
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -2993,7 +2993,7 @@ const FlyOutMenuContent = React__namespace.forwardRef((_a, ref) => {
|
|
|
2993
2993
|
} = _a, props = __rest(_a, ["className", "sideOffset", "align", "container"]);
|
|
2994
2994
|
return jsxRuntime.jsx(FlyOutMenuPrimitive__namespace.Portal, { container, children: jsxRuntime.jsx(FlyOutMenuPrimitive__namespace.Content, Object.assign({ onClick: (event) => {
|
|
2995
2995
|
event.stopPropagation();
|
|
2996
|
-
}, ref, align, sideOffset, className: cn("ui:z-50 ui:min-w-[8rem] ui:max-w-[
|
|
2996
|
+
}, ref, align, sideOffset, className: cn("ui:z-50 ui:min-w-[8rem] ui:max-w-[55ch] ui:overflow-hidden ui:border ui:border-color-border ui:bg-white ui:shadow-large ui:radius-m", "ui:data-[state=open]:animate-in ui:data-[state=closed]:animate-out ui:data-[state=closed]:fade-out-0 ui:data-[state=open]:fade-in-0 ui:data-[state=closed]:zoom-out-95 ui:data-[state=open]:zoom-in-95 ui:data-[side=bottom]:slide-in-from-top-2 ui:data-[side=left]:slide-in-from-right-2 ui:data-[side=right]:slide-in-from-left-2 ui:data-[side=top]:slide-in-from-bottom-2", className) }, props)) });
|
|
2997
2997
|
});
|
|
2998
2998
|
FlyOutMenuContent.displayName = FlyOutMenuPrimitive__namespace.Content.displayName;
|
|
2999
2999
|
const FlyOutMenuItem = React__namespace.forwardRef((_a, ref) => {
|
|
@@ -4389,25 +4389,42 @@ const StyledSelect = React__namespace.default.forwardRef((_a, ref) => {
|
|
|
4389
4389
|
"ui:rounded-r ui:border-r": hasSuffix
|
|
4390
4390
|
}, "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
4391
|
"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
|
-
|
|
4392
|
+
}), children: [jsxRuntime.jsx("select", Object.assign({ ref, className: classNames__default.default(
|
|
4393
|
+
"styled-select",
|
|
4394
|
+
"ui:block ui:min-w-[4rem]",
|
|
4395
|
+
calculateResponsiveWidthClasses(width),
|
|
4396
|
+
{
|
|
4397
|
+
"ui:bg-slate-50 ui:text-slate-400": attributes.disabled,
|
|
4398
|
+
"ui:text-slate-800": !attributes.disabled,
|
|
4399
|
+
"ui:border-input-border": !attributes.disabled && !isError,
|
|
4400
|
+
"ui:hover:border-input-border-dark": !attributes.disabled,
|
|
4401
|
+
"ui:border-red-700": isError,
|
|
4402
|
+
"ui:focus:outline-negative": isError,
|
|
4403
|
+
"ui:focus:border-primary": !isError,
|
|
4404
|
+
"ui:focus:outline-primary": !isError,
|
|
4405
|
+
"ui:bg-white": !attributes.disabled
|
|
4406
|
+
},
|
|
4407
|
+
"ui:h-11",
|
|
4408
|
+
"ui:p-2 ui:pr-10",
|
|
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
4426
|
transform: "translateY(-50%)"
|
|
4410
|
-
}, children: jsxRuntime.jsx(ChevronDownIcon, { className: classNames__default.default("ui:mr-3 ui:h-6 ui:w-6 ui:
|
|
4427
|
+
}, children: jsxRuntime.jsx(ChevronDownIcon, { className: classNames__default.default("ui:mr-3 ui:h-6 ui:w-6 ui:text-slate-300") }) })] })] });
|
|
4411
4428
|
});
|
|
4412
4429
|
|
|
4413
4430
|
const LabeledSelect = React__namespace.default.forwardRef((props, ref) => {
|
|
@@ -5841,6 +5858,74 @@ PageWithCenteredContentLayout.displayName = "PageWithCenteredContentLayout";
|
|
|
5841
5858
|
PageWithCenteredContentLayout.Header = Header;
|
|
5842
5859
|
PageWithCenteredContentLayout.Main = Main;
|
|
5843
5860
|
|
|
5861
|
+
const InputSelectInput = React__namespace.default.forwardRef((props, ref) => {
|
|
5862
|
+
return jsxRuntime.jsx(Input, Object.assign({ ref }, props));
|
|
5863
|
+
});
|
|
5864
|
+
InputSelectInput.displayName = "InputSelect.Input";
|
|
5865
|
+
|
|
5866
|
+
const InputSelectSelect = React__namespace.default.forwardRef((props, ref) => {
|
|
5867
|
+
return jsxRuntime.jsx(StyledSelect, Object.assign({ ref }, props));
|
|
5868
|
+
});
|
|
5869
|
+
InputSelectSelect.displayName = "InputSelect.Select";
|
|
5870
|
+
|
|
5871
|
+
const createStyledSelectChild = (child, isFirstChild) => {
|
|
5872
|
+
const isDisabled = child.props.disabled;
|
|
5873
|
+
const isError = child.props.isError;
|
|
5874
|
+
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]";
|
|
5875
|
+
const borderRadiusClass = isFirstChild ? "ui:rounded-r-none ui:focus:rounded-r-none" : "ui:rounded-l-none ui:focus:rounded-l-none";
|
|
5876
|
+
const marginClass = isFirstChild ? "" : "ui:-ml-px";
|
|
5877
|
+
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) }));
|
|
5878
|
+
};
|
|
5879
|
+
const createStyledInputChild = (child, isFirstChild) => {
|
|
5880
|
+
const isFullWidth = child.props.width === "full";
|
|
5881
|
+
const hasExplicitWidth = child.props.width !== void 0;
|
|
5882
|
+
const isDisabled = child.props.isDisabled;
|
|
5883
|
+
const isError = child.props.isError;
|
|
5884
|
+
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]";
|
|
5885
|
+
const borderRadiusClass = isFirstChild ? "ui:rounded-r-none ui:focus:rounded-r-none" : "ui:rounded-l-none ui:focus:rounded-l-none";
|
|
5886
|
+
const marginClass = hasExplicitWidth ? "" : isFirstChild ? "ui:-mr-px" : "ui:-ml-px";
|
|
5887
|
+
const styledInput = React__namespace.default.cloneElement(child, Object.assign(Object.assign({}, child.props), { className: classNames__default.default(child.props.className, zIndexClass, borderRadiusClass, marginClass) }));
|
|
5888
|
+
if (isFullWidth) {
|
|
5889
|
+
return jsxRuntime.jsx("div", { className: "ui:flex-1", children: styledInput });
|
|
5890
|
+
}
|
|
5891
|
+
return styledInput;
|
|
5892
|
+
};
|
|
5893
|
+
|
|
5894
|
+
const InputSelect = React__namespace.default.forwardRef((props, ref) => {
|
|
5895
|
+
const { className, children } = props;
|
|
5896
|
+
const childrenArray = React__namespace.default.Children.toArray(children);
|
|
5897
|
+
if (childrenArray.length !== 2) {
|
|
5898
|
+
console.error("InputSelect requires exactly 2 children: InputSelect.Input and InputSelect.Select");
|
|
5899
|
+
return null;
|
|
5900
|
+
}
|
|
5901
|
+
const inputChild = childrenArray.find((child) => React__namespace.default.isValidElement(child) && child.type === InputSelectInput);
|
|
5902
|
+
const selectChild = childrenArray.find((child) => React__namespace.default.isValidElement(child) && child.type === InputSelectSelect);
|
|
5903
|
+
if (!inputChild || !selectChild) {
|
|
5904
|
+
console.error("InputSelect requires exactly one InputSelect.Input and one InputSelect.Select");
|
|
5905
|
+
return null;
|
|
5906
|
+
}
|
|
5907
|
+
const styledChildren = childrenArray.map((child, index) => {
|
|
5908
|
+
if (!React__namespace.default.isValidElement(child)) {
|
|
5909
|
+
return child;
|
|
5910
|
+
}
|
|
5911
|
+
const isFirstChild = index === 0;
|
|
5912
|
+
const isSelectChild = child.type === InputSelectSelect;
|
|
5913
|
+
const isInputChild = child.type === InputSelectInput;
|
|
5914
|
+
if (isSelectChild) {
|
|
5915
|
+
return createStyledSelectChild(child, isFirstChild);
|
|
5916
|
+
} else if (isInputChild) {
|
|
5917
|
+
return createStyledInputChild(child, isFirstChild);
|
|
5918
|
+
}
|
|
5919
|
+
return child;
|
|
5920
|
+
});
|
|
5921
|
+
return jsxRuntime.jsx(Stack, { ref, axis: "x", className, children: styledChildren });
|
|
5922
|
+
});
|
|
5923
|
+
InputSelect.displayName = "InputSelect";
|
|
5924
|
+
const InputSelectWithSubComponents = Object.assign(InputSelect, {
|
|
5925
|
+
Input: InputSelectInput,
|
|
5926
|
+
Select: InputSelectSelect
|
|
5927
|
+
});
|
|
5928
|
+
|
|
5844
5929
|
Object.defineProperty(exports, "Toaster", {
|
|
5845
5930
|
enumerable: true,
|
|
5846
5931
|
get: function () { return sonner.Toaster; }
|
|
@@ -5973,6 +6058,7 @@ exports.ImageLibraryIcon = ImageLibraryIcon;
|
|
|
5973
6058
|
exports.InfoField = InfoField;
|
|
5974
6059
|
exports.InfoIcon = InfoIcon;
|
|
5975
6060
|
exports.Input = Input;
|
|
6061
|
+
exports.InputSelect = InputSelectWithSubComponents;
|
|
5976
6062
|
exports.LabelText = LabelText;
|
|
5977
6063
|
exports.LabeledDatePicker = LabeledDatePicker;
|
|
5978
6064
|
exports.LabeledInput = LabeledInput;
|