Skip to content

Commit d3989ec

Browse files
committed
fix #1037 Stepper support for styling similar to v1
1 parent 1ff2c68 commit d3989ec

File tree

4 files changed

+42
-22
lines changed

4 files changed

+42
-22
lines changed

domino-ui/src/main/java/org/dominokit/domino/ui/stepper/Stepper.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,22 @@ public Stepper reset(StepState startState, Consumer<List<Step>> stepsConsumer) {
309309
return this;
310310
}
311311

312+
/**
313+
* Hide/Show the last step tail
314+
*
315+
* @param hide boolean to hide/show the last step tail
316+
* @return same StepperTrack instance
317+
*/
318+
public Stepper setHideStepperTail(boolean hide) {
319+
stepperTrack.setHideStepperTail(hide);
320+
return this;
321+
}
322+
323+
/** @return true if the stepper last step tail is hidden. */
324+
public boolean isStepperTailHidden() {
325+
return stepperTrack.isStepperTailHidden();
326+
}
327+
312328
/** {@inheritDoc} */
313329
@Override
314330
public HTMLDivElement element() {

domino-ui/src/main/java/org/dominokit/domino/ui/stepper/StepperStyles.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,5 @@ public interface StepperStyles {
3636
CssClass dui_stepper_active_content = () -> "dui-stepper-active-content";
3737
CssClass dui_step_prefix = () -> "dui-step-prefix";
3838
CssClass dui_step_last = () -> "dui-step-last";
39-
String D_STEPPER = "d-stepper";
40-
String STEP_CONTENT = "step-content";
41-
String LAST_STEP = "last-step";
42-
String HORIZONTAL_STEPPER = "horizontal-stepper";
43-
String VERTICAL_STEPPER = "vertical-stepper";
44-
String STEP_ACTIVE = "step-active";
45-
String STEP_INACTIVE = "step-inactive";
46-
String STEP_ERROR = "step-error";
47-
String STEP_COMPLETED = "step-completed";
48-
String STEP_DISABLED = "step-disabled";
49-
String STEP_HEADER = "step-header";
50-
String STEP_NUMBER_CNTR = "step-number-cntr";
51-
String STEP_NUMBER = "step-number";
52-
String STEP_VERTICAL_BAR = "step-vertical-bar";
53-
String STEP_TITLE_CNTR = "step-title-cntr";
54-
String STEP_MAIN_TITLE_CNTR = "step-main-title-cntr";
55-
String STEP_TITLE = "step-title";
56-
String STEP_HORIZONTAL_BAR = "step-horizontal-bar";
57-
String STEP_DESCRIPTION = "step-description";
58-
String STEP_ERRORS = "step-errors";
59-
String STEP_INVALID = "step-invalid";
39+
CssClass dui_hide_stepper_tail = () -> "dui-stepper-hide-tail";
6040
}

domino-ui/src/main/java/org/dominokit/domino/ui/stepper/StepperTrack.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
*/
4545
public class StepperTrack extends BaseDominoElement<HTMLDivElement, StepperTrack>
4646
implements StepperStyles, HasComponentConfig<StepperConfig> {
47+
4748
private final DivElement root;
4849
private final List<StepTracker> trackers = new ArrayList<>();
4950
public BooleanCssClass textPosition = BooleanCssClass.of(dui_reversed);
@@ -424,6 +425,22 @@ public StepperTrack setTextPositionReversed(boolean reversed) {
424425
return this;
425426
}
426427

428+
/**
429+
* Hide/Show the last step tail
430+
*
431+
* @param hide boolean to hide/show the last step tail
432+
* @return same StepperTrack instance
433+
*/
434+
public StepperTrack setHideStepperTail(boolean hide) {
435+
BooleanCssClass.of(dui_hide_stepper_tail, hide).apply(this);
436+
return this;
437+
}
438+
439+
/** @return true if the stepper last step tail is hidden. */
440+
public boolean isStepperTailHidden() {
441+
return dui_hide_stepper_tail.isAppliedTo(this);
442+
}
443+
427444
/** {@inheritDoc} */
428445
@Override
429446
public HTMLDivElement element() {

domino-ui/src/main/resources/org/dominokit/domino/ui/public/css/domino-ui/dui-components/domino-ui-stepper.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,4 +318,11 @@
318318
border-radius: var(--dui-stepper-step-prefix-border-radius);
319319
background-color: var(--dui-accent-l-4);
320320
color: var(--dui-text-color);
321-
}
321+
}
322+
323+
.dui-stepper-hide-tail .dui-step-track:last-child {
324+
flex-grow: 0;
325+
}
326+
.dui-stepper-hide-tail .dui-step-track:last-child .dui-tracker-line {
327+
display: none;
328+
}

0 commit comments

Comments
 (0)