@luscii-healthtech/web-ui 42.13.2 → 43.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.
@@ -1259,6 +1259,7 @@ const Stack = (props) => {
1259
1259
  "ui:justify-between": justify === "between",
1260
1260
  "ui:justify-around": justify === "around",
1261
1261
  "ui:justify-evenly": justify === "evenly",
1262
+ "ui:justify-stretch": justify === "stretch",
1262
1263
  "ui:items-center": align === "center",
1263
1264
  "ui:items-start": align === "start",
1264
1265
  "ui:items-end": align === "end",
@@ -4099,19 +4100,32 @@ Page.propTypes = {
4099
4100
  navLayoutProps: PropTypes__default.default.object
4100
4101
  };
4101
4102
 
4102
- const Step = ({ title, stepNumber, active, localization }) => {
4103
- const barColor = active ? "ui:bg-primary" : "ui:bg-slate-200";
4104
- return jsxRuntime.jsxs("div", { className: "ui:w-full", children: [jsxRuntime.jsx("div", { className: `ui:mb-2 ui:h-1 ui:w-full ui:rounded ${barColor}` }), jsxRuntime.jsx(Text, { text: `${localization.step} ${stepNumber}`, type: "strong", color: active ? "blue-800" : "slate-500" }), jsxRuntime.jsx(Text, { text: title, type: "strong" })] });
4103
+ const Step = ({ title, subtitle, state = "completed" }) => {
4104
+ let barColor = "ui:bg-slate-200";
4105
+ let titleColor = "slate-500";
4106
+ switch (state) {
4107
+ case "completed":
4108
+ case "current":
4109
+ barColor = "ui:bg-primary";
4110
+ titleColor = "blue-800";
4111
+ break;
4112
+ }
4113
+ return jsxRuntime.jsxs(Box, { width: "full", children: [jsxRuntime.jsx(Box, { mb: "xxs", width: "full", className: classNames__default.default("ui:h-1 ui:rounded", barColor) }), jsxRuntime.jsx(Text, { variant: "strong", color: titleColor, children: title }), subtitle && jsxRuntime.jsx(Text, { variant: "strong", color: "base", children: subtitle })] });
4105
4114
  };
4106
4115
 
4107
- const Steps = ({ orderedStepTitles, currentStep, className, localization }) => {
4108
- const renderedSteps = orderedStepTitles.map((stepTitle, index) => jsxRuntime.jsx(
4109
- Step,
4110
- { title: stepTitle, stepNumber: index + 1, active: index + 1 <= currentStep, localization },
4111
- `step-${index}-${stepTitle.split(" ")[0]}`
4112
- ));
4113
- return jsxRuntime.jsx("div", { className: `ui:flex ui:flex-row ui:justify-items-stretch ui:space-x-6 ${className}`, children: renderedSteps });
4116
+ const Steps = (props) => {
4117
+ const { children, className } = props;
4118
+ return jsxRuntime.jsx(Stack, { axis: "x", justify: "stretch", gap: "l", className, children: React__namespace.default.Children.map(children, (child) => {
4119
+ if (!React__namespace.default.isValidElement(child)) {
4120
+ return null;
4121
+ }
4122
+ if (child.type === Step) {
4123
+ return jsxRuntime.jsx(Step, Object.assign({}, child.props));
4124
+ }
4125
+ return child;
4126
+ }) });
4114
4127
  };
4128
+ Steps.Step = Step;
4115
4129
 
4116
4130
  const isBreadcrumbDividerProps = (subject) => {
4117
4131
  if (!subject || typeof subject !== "object") {
@@ -4260,7 +4274,16 @@ const CRUDPage = ({ submitButtonProps, cancelButtonProps, className, children, i
4260
4274
  * since the spacing needed will be occupied by the `belowHeader` component itself.
4261
4275
  */
4262
4276
  { "ui:mt-xl": !belowHeader }
4263
- ), children: [steps && jsxRuntime.jsx(Steps, { className: "ui:mb-4", orderedStepTitles: steps.titles, currentStep: steps.currentStep, localization: steps.localization }), children, jsxRuntime.jsx(Line, { left: accessory ? accessoriesToRender : [submitButton, cancelButton], className: classNames__default.default("cweb-crud-page-button-line", "ui:mt-4 ui:border-t ui:border-solid ui:border-color-divider ui:pt-4") })] }) })] }) });
4277
+ ), children: [steps && jsxRuntime.jsx(Steps, { className: "ui:mb-4", children: steps.titles.map((stepTitle, index) => {
4278
+ const stepNumber = index + 1;
4279
+ let state = "upcoming";
4280
+ if (stepNumber < steps.currentStep) {
4281
+ state = "completed";
4282
+ } else if (stepNumber === steps.currentStep) {
4283
+ state = "current";
4284
+ }
4285
+ return jsxRuntime.jsx(Steps.Step, { title: `${steps.localization.step} ${stepNumber}`, subtitle: stepTitle, state }, stepTitle);
4286
+ }) }), children, jsxRuntime.jsx(Line, { left: accessory ? accessoriesToRender : [submitButton, cancelButton], className: classNames__default.default("cweb-crud-page-button-line", "ui:mt-4 ui:border-t ui:border-solid ui:border-color-divider ui:pt-4") })] }) })] }) });
4264
4287
  };
4265
4288
  const PageHeaderBlock = ({ header, title }) => {
4266
4289
  if (!title && !header) {
@@ -6358,8 +6381,11 @@ const Aside = (props) => {
6358
6381
  SplitViewLayout.Aside = Aside;
6359
6382
 
6360
6383
  const Header = (props) => {
6361
- const { children, className, leftActionSlot, rightActionSlot } = props, restProps = __rest(props, ["children", "className", "leftActionSlot", "rightActionSlot"]);
6362
- const classes = classNames__default.default(className, "ui:max-w-[100vw] ui:content-center");
6384
+ const { children, className, leftActionSlot, rightActionSlot, slotsAlignment = "center" } = props, restProps = __rest(props, ["children", "className", "leftActionSlot", "rightActionSlot", "slotsAlignment"]);
6385
+ const classes = classNames__default.default(className, "ui:max-w-[100vw]", {
6386
+ "ui:items-center": slotsAlignment === "center",
6387
+ "ui:items-start": slotsAlignment === "start"
6388
+ });
6363
6389
  return jsxRuntime.jsxs(Stack, Object.assign({ as: "header", p: "xl", axis: "x", className: classes, gap: "xxl", align: "center", justify: "center", backgroundColor: "background" }, restProps, { children: [(leftActionSlot || rightActionSlot) && jsxRuntime.jsx(Box, { className: "ui:w-[--spacing(9)] ui:h-[--spacing(9)]", children: leftActionSlot }), jsxRuntime.jsx(Stack, { axis: "x", justify: "center", width: "full", className: "ui:lg:max-w-[--spacing(310)]", children: jsxRuntime.jsx(Box, { width: "full", children }) }), (leftActionSlot || rightActionSlot) && jsxRuntime.jsx(Box, { className: "ui:w-[--spacing(9)] ui:h-[--spacing(9)]", children: rightActionSlot })] }));
6364
6390
  };
6365
6391
  Header.displayName = "PageWithCenteredContentLayout.Header";