@luscii-healthtech/web-ui 54.7.1 → 55.0.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.
@@ -4284,31 +4284,6 @@ const Breadcrumbs = ({
4284
4284
  return jsxRuntime.jsx("ul", { "data-test-id": "breadcrumbs", className: "ui:flex ui:flex-row ui:flex-wrap ui:items-center", children: (isTruncated ? crumbsAndDivider : crumbs).map((crumbOrDividerProps) => isBreadcrumbDividerProps(crumbOrDividerProps) ? jsxRuntime.jsx(BreadcrumbDividerItem, Object.assign({}, crumbOrDividerProps), `divider-${truncatedCrumbs.map((crumb) => crumb.name).join("-")}`) : jsxRuntime.jsx(BreadcrumbItem, Object.assign({}, crumbOrDividerProps, { render: renderItem }), crumbOrDividerProps.key || crumbOrDividerProps.name)) });
4285
4285
  };
4286
4286
 
4287
- const TabbarItem = ({ title, index, isSelected, onSelect, className, badgeCount = 0, isLoading = false, dataTestId = "" }) => {
4288
- const handleTabClick = () => onSelect === null || onSelect === void 0 ? void 0 : onSelect(index);
4289
- const itemClassName = classNames__default.default("ui:flex ui:items-center ui:py-m", "ui:border-b-2 ui:hover:text-primary", "ui:transition ui:ease-in ui:duration-150", className, {
4290
- "ui:border-b-transparent ui:text-on-surface": !isSelected,
4291
- "ui:border-b-primary ui:text-primary": isSelected
4292
- });
4293
- return jsxRuntime.jsxs("button", { className: itemClassName, onClick: handleTabClick, "data-test-id": dataTestId, role: "tab", "aria-selected": isSelected, children: [typeof title === "string" ? jsxRuntime.jsx(Text, { variant: "strong", color: "current", as: "span", className: "ui:leading-inherit", children: title }) : title, badgeCount > 0 && jsxRuntime.jsx(Badge, { className: "ui:ml-1", children: badgeCount }), isLoading && jsxRuntime.jsx(LoadingIndicator, { asSpinner: true, spinnerColor: "gray", className: "ui:w-6" })] });
4294
- };
4295
-
4296
- const Tabbar = ({ tabs = [], selectedIndex, onSelect, className }) => {
4297
- const [innerSelectedIndex, setInnerSelectedIndex] = React.useState(selectedIndex);
4298
- React.useEffect(() => {
4299
- setInnerSelectedIndex(selectedIndex);
4300
- }, [selectedIndex]);
4301
- const handleOnTabSelect = (index) => {
4302
- setInnerSelectedIndex(index);
4303
- onSelect === null || onSelect === void 0 ? void 0 : onSelect({ index, selectedTab: tabs[index] });
4304
- };
4305
- return jsxRuntime.jsx("div", { className: classNames__default.default("ui:flex ui:w-full ui:gap-xl", className), role: "tablist", children: tabs === null || tabs === void 0 ? void 0 : tabs.map((tabItemProps, index) => {
4306
- var _a;
4307
- const itemProps = Object.assign({ index, onSelect: handleOnTabSelect, isSelected: innerSelectedIndex === index }, tabItemProps);
4308
- return jsxRuntime.jsx(TabbarItem, Object.assign({}, itemProps), (_a = tabItemProps.dataTestId) !== null && _a !== void 0 ? _a : index);
4309
- }) });
4310
- };
4311
-
4312
4287
  const PageTitle = (props) => {
4313
4288
  const { as: Component = "h2", className } = props, rest = __rest(props, ["as", "className"]);
4314
4289
  return jsxRuntime.jsx(Component, Object.assign({}, rest, { className: classNames__default.default(
@@ -4324,19 +4299,37 @@ const PageTitle = (props) => {
4324
4299
  };
4325
4300
 
4326
4301
  const PageHeader = ({ navigation, breadcrumbs, dataTestId, accessories, isPolling, title, contained, className, truncateBreadcrumbsAfter, renderBreadcrumbItem, banner }) => {
4327
- var _a;
4302
+ var _a, _b;
4328
4303
  const withContained = { "ui:max-w-3xl ui:m-auto": contained };
4329
- const hasTabBar = Boolean((_a = navigation === null || navigation === void 0 ? void 0 : navigation.tabs) === null || _a === void 0 ? void 0 : _a.length);
4304
+ const hasTabs = Boolean((_a = navigation === null || navigation === void 0 ? void 0 : navigation.tabs) === null || _a === void 0 ? void 0 : _a.length);
4330
4305
  return jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { "data-test-id": "page-header", className: classNames__default.default("ui:pt-xl", className, {
4331
4306
  /**
4332
4307
  * The tab bar should sit snugly against the bottom of the page header, but
4333
4308
  * this is the only exception. Other than that the page header should have
4334
4309
  * a bottom padding.
4335
4310
  */
4336
- "ui:pb-l": !hasTabBar,
4311
+ "ui:pb-l": !hasTabs,
4337
4312
  "ui:px-xl": !contained,
4338
4313
  "ui:w-full": contained
4339
- }), children: [banner && jsxRuntime.jsx(NotificationBanner, { noBorder: banner.noBorder, color: banner.color, "data-test-id": `page-header-banner-${title}`, className: "ui:mb-m", icon: banner.icon, children: jsxRuntime.jsxs("div", { className: "ui:flex ui:flex-col", children: [banner.title && jsxRuntime.jsx(Text, { color: "current", variant: "strong", children: banner.title }), jsxRuntime.jsx(Text, { color: "current", containsDangerousHtml: banner.text.isHTML, children: banner.text.content })] }) }), jsxRuntime.jsxs("div", { className: classNames__default.default({ "ui:flex ui:flex-col": !contained }), children: [!!(breadcrumbs === null || breadcrumbs === void 0 ? void 0 : breadcrumbs.length) && jsxRuntime.jsx("div", { className: classNames__default.default("ui:mb-m", withContained), children: jsxRuntime.jsx(Breadcrumbs, { crumbs: breadcrumbs, truncateAfter: truncateBreadcrumbsAfter, renderItem: renderBreadcrumbItem }) }), jsxRuntime.jsxs("div", { className: classNames__default.default("ui:flex ui:flex-row ui:items-center ui:justify-between", withContained), children: [jsxRuntime.jsxs("div", { className: "ui:flex ui:flex-row ui:items-center ui:gap-xxs", children: [typeof title === "string" ? jsxRuntime.jsx(PageTitle, { "data-test-id": `${dataTestId}-title`, children: title }) : jsxRuntime.jsx(Box, { width: "full", children: title }), isPolling && jsxRuntime.jsx(LoadingIndicator, { asSpinner: true, className: "page-spinner", spinnerColor: "gray" })] }), accessories && jsxRuntime.jsx("div", { "data-test-id": "page-header-accessories", children: accessories })] })] }), navigation && jsxRuntime.jsx(Tabbar, Object.assign({}, navigation, { className: classNames__default.default(navigation.className, withContained) }))] }), jsxRuntime.jsx(Divider, { version: "v2" })] });
4314
+ }), children: [banner && jsxRuntime.jsx(NotificationBanner, { noBorder: banner.noBorder, color: banner.color, "data-test-id": `page-header-banner-${title}`, className: "ui:mb-m", icon: banner.icon, children: jsxRuntime.jsxs("div", { className: "ui:flex ui:flex-col", children: [banner.title && jsxRuntime.jsx(Text, { color: "current", variant: "strong", children: banner.title }), jsxRuntime.jsx(Text, { color: "current", containsDangerousHtml: banner.text.isHTML, children: banner.text.content })] }) }), jsxRuntime.jsxs("div", { className: classNames__default.default({ "ui:flex ui:flex-col": !contained }), children: [!!(breadcrumbs === null || breadcrumbs === void 0 ? void 0 : breadcrumbs.length) && jsxRuntime.jsx("div", { className: classNames__default.default("ui:mb-m", withContained), children: jsxRuntime.jsx(Breadcrumbs, { crumbs: breadcrumbs, truncateAfter: truncateBreadcrumbsAfter, renderItem: renderBreadcrumbItem }) }), jsxRuntime.jsxs("div", { className: classNames__default.default("ui:flex ui:flex-row ui:items-center ui:justify-between", withContained), children: [jsxRuntime.jsxs("div", { className: "ui:flex ui:flex-row ui:items-center ui:gap-xxs", children: [typeof title === "string" ? jsxRuntime.jsx(PageTitle, { "data-test-id": `${dataTestId}-title`, children: title }) : jsxRuntime.jsx(Box, { width: "full", children: title }), isPolling && jsxRuntime.jsx(LoadingIndicator, { asSpinner: true, className: "page-spinner", spinnerColor: "gray" })] }), accessories && jsxRuntime.jsx("div", { "data-test-id": "page-header-accessories", children: accessories })] })] }), navigation && jsxRuntime.jsx(Tabs.Root, { value: navigation.selectedIndex !== void 0 ? String(navigation.selectedIndex) : "", onValueChange: (value) => {
4315
+ var _a2, _b2;
4316
+ const index = Number(value);
4317
+ const selectedTab = (_a2 = navigation.tabs) === null || _a2 === void 0 ? void 0 : _a2[index];
4318
+ if (selectedTab) {
4319
+ (_b2 = navigation.onSelect) === null || _b2 === void 0 ? void 0 : _b2.call(navigation, { index, selectedTab });
4320
+ }
4321
+ }, children: jsxRuntime.jsx(
4322
+ Tabs.List,
4323
+ {
4324
+ // Keep the page-header tab row left-aligned and full width
4325
+ // (the shared Tabs.List defaults to a centered inline-flex row).
4326
+ className: classNames__default.default("ui:flex ui:w-full ui:justify-start", navigation.className, withContained),
4327
+ children: (_b = navigation.tabs) === null || _b === void 0 ? void 0 : _b.map((tab, index) => {
4328
+ var _a2;
4329
+ return jsxRuntime.jsxs(Tabs.Trigger, { value: String(index), "data-test-id": tab.dataTestId, children: [typeof tab.title === "string" ? jsxRuntime.jsx(Tabs.LabelText, { children: tab.title }) : tab.title, tab.badgeCount !== void 0 && tab.badgeCount > 0 && jsxRuntime.jsx(Badge, { className: "ui:ml-1", children: tab.badgeCount }), tab.isLoading && jsxRuntime.jsx(LoadingIndicator, { asSpinner: true, spinnerColor: "gray", className: "ui:w-6" })] }, (_a2 = tab.dataTestId) !== null && _a2 !== void 0 ? _a2 : index);
4330
+ })
4331
+ }
4332
+ ) })] }), jsxRuntime.jsx(Divider, { version: "v2" })] });
4340
4333
  };
4341
4334
 
4342
4335
  const CRUDPage = ({ submitButtonProps, cancelButtonProps, className, children, isLoading, isSubmitting, dataTestId = "page", title, header, steps, isMobileFriendly, belowHeader, accessory }) => {
@@ -4809,7 +4802,8 @@ const ModalDialog = (_a) => {
4809
4802
  }, "ui:top-0", "ui:bottom-auto", {
4810
4803
  "ui:md:w-80": size === "s",
4811
4804
  "ui:md:w-132": size === "m",
4812
- "ui:md:w-216": size === "l"
4805
+ "ui:md:w-216": size === "l",
4806
+ "ui:md:w-330": size === "xl"
4813
4807
  }, {
4814
4808
  "ui:right-0": variant === "side-modal",
4815
4809
  "ui:left-auto": variant === "side-modal",
@@ -7357,7 +7351,6 @@ exports.SummaryIcon = SummaryIcon;
7357
7351
  exports.Switch = Switch;
7358
7352
  exports.Switcher = Switcher;
7359
7353
  exports.TOASTER_TYPE_OPTIONS = TOASTER_TYPE_OPTIONS;
7360
- exports.Tabbar = Tabbar;
7361
7354
  exports.Table = Table;
7362
7355
  exports.TableNew = TableNew;
7363
7356
  exports.Tabs = Tabs;