@luscii-healthtech/web-ui 42.3.0 → 42.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/index.development.js +49 -11
- 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/VerticalMenu/VerticalMenu.d.ts +1 -1
- package/dist/stories/VerticalMenu.stories.d.ts +1 -1
- package/dist/web-ui-tailwind.css +28 -2
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -5241,6 +5241,7 @@ const Summary = (_a) => {
|
|
|
5241
5241
|
DetailsDisclosure.Summary = Summary;
|
|
5242
5242
|
Summary.OpenIndicator = OpenIndicator;
|
|
5243
5243
|
|
|
5244
|
+
const DEFAULT_TEXT_CLASS_NAME = "ui:text-[#162130]";
|
|
5244
5245
|
const context$1 = React.createContext({
|
|
5245
5246
|
variant: "primary"
|
|
5246
5247
|
});
|
|
@@ -5251,7 +5252,9 @@ const VerticalMenu = (props) => {
|
|
|
5251
5252
|
const shouldShowCollapseButton = localization && Boolean(onCollapseButtonClick);
|
|
5252
5253
|
const hasHeaderContent = title || shouldShowCollapseButton;
|
|
5253
5254
|
const contextValue = React.useMemo(() => ({ variant }), [variant]);
|
|
5254
|
-
return jsxRuntime.jsx(context$1.Provider, { value: contextValue, children: jsxRuntime.jsxs(Stack, Object.assign({ as: "div", px: "xxs", py: "m", align: "normal", className: classNames__default.default("ui:max-w-full
|
|
5255
|
+
return jsxRuntime.jsx(context$1.Provider, { value: contextValue, children: jsxRuntime.jsxs(Stack, Object.assign({ as: "div", px: "xxs", py: "m", align: "normal", className: classNames__default.default("ui:max-w-full", {
|
|
5256
|
+
[DEFAULT_TEXT_CLASS_NAME]: isCollapsed
|
|
5257
|
+
}, className) }, rest, { children: [header && jsxRuntime.jsx("div", { children: header }), jsxRuntime.jsxs(Stack, { axis: "x", gap: "xxs", p: hasHeaderContent ? "m" : void 0, align: "start", justify: "between", width: "full", children: [title && jsxRuntime.jsx(Box, { children: jsxRuntime.jsx(Text, { variant: "lg-strong", children: title }) }), shouldShowCollapseButton && jsxRuntime.jsx(
|
|
5255
5258
|
Box,
|
|
5256
5259
|
{
|
|
5257
5260
|
/**
|
|
@@ -5276,7 +5279,7 @@ const VerticalMenu = (props) => {
|
|
|
5276
5279
|
children: jsxRuntime.jsx(SidebarIcon, {})
|
|
5277
5280
|
}) })
|
|
5278
5281
|
}
|
|
5279
|
-
)] }), isPrimaryVariant && hasHeaderContent && jsxRuntime.jsx(VerticalMenu.Divider, {}), jsxRuntime.jsx("
|
|
5282
|
+
)] }), isPrimaryVariant && hasHeaderContent && jsxRuntime.jsx(VerticalMenu.Divider, {}), jsxRuntime.jsx(Stack, { width: "full", gap: isCollapsed ? "xxs" : void 0, children: props.children }), jsxRuntime.jsx("div", { className: "ui:mt-auto", children: footer })] })) });
|
|
5280
5283
|
};
|
|
5281
5284
|
VerticalMenu.Divider = MenuDivider;
|
|
5282
5285
|
VerticalMenu.Item = MenuItem;
|
|
@@ -5288,19 +5291,36 @@ VerticalMenu.ItemGroup = MenuItemGroup;
|
|
|
5288
5291
|
VerticalMenu.SectionTitle = SectionTitle;
|
|
5289
5292
|
function MenuItemText(props) {
|
|
5290
5293
|
const { variant: menuVariant } = React.useContext(context$1);
|
|
5291
|
-
|
|
5294
|
+
const isCollapsed = menuVariant === "primary-collapsed";
|
|
5295
|
+
const shouldTruncate = isCollapsed || Boolean(props.truncate);
|
|
5296
|
+
const getMenuVariant = () => {
|
|
5297
|
+
switch (menuVariant) {
|
|
5298
|
+
case "primary":
|
|
5299
|
+
return "base";
|
|
5300
|
+
case "primary-collapsed":
|
|
5301
|
+
return "sm";
|
|
5302
|
+
default:
|
|
5303
|
+
return props.variant;
|
|
5304
|
+
}
|
|
5305
|
+
};
|
|
5306
|
+
return jsxRuntime.jsx(Text, Object.assign({ as: "span", color: "current", variant: getMenuVariant(), truncate: shouldTruncate }, props, { className: classNames__default.default({
|
|
5307
|
+
"ui:sm:leading-[16px]": isCollapsed,
|
|
5308
|
+
"ui:sm:leading-[24px]": !isCollapsed
|
|
5309
|
+
}, {
|
|
5310
|
+
"ui:max-w-18": isCollapsed
|
|
5311
|
+
}, props.className) }));
|
|
5292
5312
|
}
|
|
5293
5313
|
const useGetClassName = () => {
|
|
5294
5314
|
const { variant } = React.useContext(context$1);
|
|
5295
5315
|
return React.useCallback(
|
|
5296
5316
|
// eslint-disable-next-line consistent-return
|
|
5297
5317
|
({ isActive = false, classNameProp = "" } = {}) => {
|
|
5298
|
-
const base = "ui:block ui:w-full ui:
|
|
5318
|
+
const base = "ui:block ui:w-full ui:radius-xxs ui:text-current";
|
|
5299
5319
|
switch (variant) {
|
|
5300
5320
|
case "primary":
|
|
5301
|
-
case "primary-collapsed":
|
|
5302
5321
|
return classNames__default.default(
|
|
5303
5322
|
base,
|
|
5323
|
+
"ui:py-xs",
|
|
5304
5324
|
"ui:px-m",
|
|
5305
5325
|
// Transitions
|
|
5306
5326
|
"ui:transition-[color,background,transform]",
|
|
@@ -5312,8 +5332,26 @@ const useGetClassName = () => {
|
|
|
5312
5332
|
},
|
|
5313
5333
|
classNameProp
|
|
5314
5334
|
);
|
|
5335
|
+
case "primary-collapsed":
|
|
5336
|
+
return classNames__default.default(
|
|
5337
|
+
base,
|
|
5338
|
+
"ui:py-xxs",
|
|
5339
|
+
"ui:px-xxxxs",
|
|
5340
|
+
// Transitions
|
|
5341
|
+
"ui:transition-[color,background,transform]",
|
|
5342
|
+
// States
|
|
5343
|
+
"ui:hover:bg-primary-background ui:active:scale-[0.98]",
|
|
5344
|
+
{
|
|
5345
|
+
"ui:bg-transparent ui:text-on-surface": !isActive,
|
|
5346
|
+
"ui:bg-primary-background-active ui:text-primary": isActive,
|
|
5347
|
+
// Style the icon inside the menu item
|
|
5348
|
+
"ui:[&_.menu-icon]:text-[#3a4657]": !isActive,
|
|
5349
|
+
"ui:hover:[&_.menu-icon]:text-[#162130]": true
|
|
5350
|
+
},
|
|
5351
|
+
classNameProp
|
|
5352
|
+
);
|
|
5315
5353
|
case "secondary":
|
|
5316
|
-
return classNames__default.default(base, "ui:hover:text-primary ui:focus:text-primary ui:active:scale-[0.98]", {
|
|
5354
|
+
return classNames__default.default(base, "ui:py-xs", "ui:hover:text-primary ui:focus:text-primary ui:active:scale-[0.98]", {
|
|
5317
5355
|
["ui:[&_span]:font-bold"]: isActive
|
|
5318
5356
|
}, classNameProp);
|
|
5319
5357
|
}
|
|
@@ -5341,12 +5379,12 @@ function MenuItemLayout(props) {
|
|
|
5341
5379
|
return jsxRuntime.jsx("div", { children });
|
|
5342
5380
|
}
|
|
5343
5381
|
const itemIsTextOrNumber = typeof text === "string" || typeof text === "number";
|
|
5344
|
-
return jsxRuntime.jsxs(
|
|
5382
|
+
return jsxRuntime.jsxs(Stack, { axis: isCollapsed ? "y" : "x", align: isCollapsed ? "center" : "start", gap: isCollapsed ? "xxxxs" : "xxs", className: classNames__default.default("ui:relative", className), children: [icon && /**
|
|
5345
5383
|
* If the item is a text or number, we can to add an aria-label to the icon
|
|
5346
5384
|
* so that it can be read by screen readers. If the item is not a text or
|
|
5347
5385
|
* number, there's not much we can do and accessibility is up to the consumer.
|
|
5348
5386
|
*/
|
|
5349
|
-
jsxRuntime.jsx("span", { "aria-label": itemIsTextOrNumber ? String(text) : void 0, children: icon }), text &&
|
|
5387
|
+
jsxRuntime.jsx("span", { className: "menu-icon", "aria-label": itemIsTextOrNumber ? String(text) : void 0, children: icon }), text && jsxRuntime.jsx(MenuItemText, { children: text }), aside && !isCollapsed && jsxRuntime.jsx("span", { className: "ui:ml-auto", children: aside }), notificationBubbleText && !isCollapsed && jsxRuntime.jsx("span", { className: "ui:ml-auto", children: jsxRuntime.jsx(MenuItemNotificationBubble, { children: notificationBubbleText }) }), notificationBubbleText && isCollapsed && jsxRuntime.jsx("span", { "aria-label": notificationBubbleText, className: "ui:absolute ui:right-[16px] ui:top-[-4px] ui:h-[8px] ui:w-[8px] ui:rounded-full ui:bg-red-500" })] });
|
|
5350
5388
|
}
|
|
5351
5389
|
function MenuItemPadding(props) {
|
|
5352
5390
|
const { variant } = React.useContext(context$1);
|
|
@@ -5369,7 +5407,7 @@ function MenuItemNotificationBubble(props) {
|
|
|
5369
5407
|
), children: jsxRuntime.jsx(Text, { color: "white", as: "span", className: "ui:align-text-bottom", children: props.children }) });
|
|
5370
5408
|
}
|
|
5371
5409
|
function MenuDivider(props) {
|
|
5372
|
-
return jsxRuntime.jsx(Box, { my: "xxs", children: jsxRuntime.jsx(Divider, Object.assign({ className: "ui:border-neutral-border-high-contrast ui:last:border-b-1" }, props)) });
|
|
5410
|
+
return jsxRuntime.jsx(Box, { width: "full", my: "xxs", children: jsxRuntime.jsx(Divider, Object.assign({ className: "ui:border-neutral-border-high-contrast ui:last:border-b-1 ui:w-full" }, props)) });
|
|
5373
5411
|
}
|
|
5374
5412
|
function MenuItemGroupOpenIndicator({ isOpen }) {
|
|
5375
5413
|
return jsxRuntime.jsx(Text, { color: "on-surface", as: "span", children: jsxRuntime.jsx(ChevronDownIcon, { className: classNames__default.default("ui:shrink-0 ui:transition-transform", {
|
|
@@ -5377,8 +5415,8 @@ function MenuItemGroupOpenIndicator({ isOpen }) {
|
|
|
5377
5415
|
}) }) });
|
|
5378
5416
|
}
|
|
5379
5417
|
function MenuItemGroup(_a) {
|
|
5380
|
-
var { title, children } = _a, rest = __rest(_a, ["title", "children"]);
|
|
5381
|
-
return jsxRuntime.jsxs(DetailsDisclosure, Object.assign({}, rest, { children: [jsxRuntime.jsx(DetailsDisclosure.Summary, { hoverBackgroundColor: void 0, pl: void 0, omitOpenIndicator: true, children: jsxRuntime.jsx(MenuItemLayout, { children: jsxRuntime.jsx(MenuItemPadding, { children: jsxRuntime.jsxs(Stack, { axis: "x", align: "center", justify: "between", children: [jsxRuntime.jsx(MenuItemText, { children: title }), jsxRuntime.jsx(DetailsDisclosure.Summary.OpenIndicator, { component: MenuItemGroupOpenIndicator })] }) }) }) }), jsxRuntime.jsx(MenuItemPadding, { paddingX: true, paddingY: false, children })] }));
|
|
5418
|
+
var { title, children, className } = _a, rest = __rest(_a, ["title", "children", "className"]);
|
|
5419
|
+
return jsxRuntime.jsxs(DetailsDisclosure, Object.assign({ className: classNames__default.default("ui:w-full", className) }, rest, { children: [jsxRuntime.jsx(DetailsDisclosure.Summary, { hoverBackgroundColor: void 0, pl: void 0, omitOpenIndicator: true, children: jsxRuntime.jsx(MenuItemLayout, { children: jsxRuntime.jsx(MenuItemPadding, { children: jsxRuntime.jsxs(Stack, { axis: "x", align: "center", justify: "between", children: [jsxRuntime.jsx(MenuItemText, { children: title }), jsxRuntime.jsx(DetailsDisclosure.Summary.OpenIndicator, { component: MenuItemGroupOpenIndicator })] }) }) }) }), jsxRuntime.jsx(MenuItemPadding, { paddingX: true, paddingY: false, children })] }));
|
|
5382
5420
|
}
|
|
5383
5421
|
function SectionTitle(props) {
|
|
5384
5422
|
return jsxRuntime.jsx(MenuItemPadding, { children: jsxRuntime.jsx(Text, { variant: "strong", children: props.children }) });
|