Skip to content

Commit

Permalink
feat(conditionBuilder): tree variant initial implmentation (carbon-de…
Browse files Browse the repository at this point in the history
…sign-system#5397)

* feat(conditionBuilder): keyboard accessibility for sentance variant

* feat(conditionBuilder): keyboard accessibility add button

* feat(conditionBuilder): keyboard accessibility close button

* feat(conditionBuilder): review comments

* feat(conditionBuilder): review comments 2

* feat(conditionBuilder): tree variant implementation

* Update WebTerminal-test.avt.e2e.js

* feat(conditionBuilder): fixed preview content structure

* feat(ConditionBuilder): resolve review comments
  • Loading branch information
amal-k-joy authored Jun 12, 2024
1 parent 793b7d2 commit 553f2c7
Show file tree
Hide file tree
Showing 18 changed files with 911 additions and 210 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
// .#{$block-class} {
// // TODO: Styles.
// }

.#{$block-class} {
padding: $spacing-06;
}
.#{$block-class}__condition-builder__group {
display: flex;
}
Expand All @@ -47,5 +49,23 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
}
.#{$block-class}__condition-block {
display: flex;
width: max-content;
flex-direction: row;
}
.#{$block-class}__content-container {
display: flex;
flex-direction: column;
row-gap: $spacing-02;
}
.#{$block-class}__heading {
margin-top: $spacing-03;
margin-bottom: $spacing-03;
}
.#{$block-class}__tree
.#{$block-class}__actions-container
.#{$block-class}__condition-wrapper {
flex-direction: column;
}
.#{$block-class}__group-separator {
margin-top: $spacing-02;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
@use '@carbon/react/scss/theme' as *;
@use '@carbon/react/scss/spacing' as *;
@use '@carbon/react/scss/motion';
@use '@carbon/styles/scss/components/tag' as *;
@use '@carbon/styles/scss/utilities/focus-outline';
@use '../../../global/styles/project-settings' as c4p-settings;
@use '@carbon/styles/scss/type';
@use '@carbon/styles/scss/type' as *;
@use '@carbon/react/scss/utilities';

$block-class: #{c4p-settings.$pkg-prefix}--condition-builder;

Expand All @@ -14,12 +16,17 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
display: inline-flex;
}

[role='row']:focus {
.#{$block-class} [role='row'] {
position: relative;
outline: none;
}
.#{$block-class} [role='row']:focus::after {
@include focus-outline.focus-outline('outline');

outline-offset: 0;
position: absolute;
content: '';
inset: 0;
}

.#{$block-class}__condition__deletion-preview
.#{$block-class}__button:not(
.#{$block-class}__statement-button,
Expand All @@ -44,3 +51,15 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
text-overflow: ellipsis;
text-wrap: nowrap;
}
.#{$block-class}__group-preview {
opacity: 0.5;
pointer-events: none;
}
.#{$block-class}__connector-disabled {
display: flex;
min-width: $spacing-10;
align-items: center;
background-color: $layer;
color: $text-helper;
padding-inline: $spacing-03;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use 'sass:list';
@use 'sass:string';
@use '@carbon/react/scss/theme' as *;
@use '../../../global/styles/project-settings' as c4p-settings;
@use '@carbon/styles/scss/type';
Expand All @@ -8,10 +10,11 @@
@use '@carbon/styles/scss/components/tag';

@use '@carbon/styles/scss/type' as *;
@use '@carbon/react/scss/colors' as *;

$block-class: #{c4p-settings.$pkg-prefix}--condition-builder;

.#{$block-class}__content-container * {
.#{$block-class}__condition-wrapper * {
@include type-style('body-01');
}

Expand Down Expand Up @@ -120,7 +123,7 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
}
.#{$block-class}__condition-builder__group.hoveredConnector
.#{$block-class}__condition-wrapper
> .conditionBlockWrapper
> .#{$block-class}__condition-block
.#{$block-class}__connector-button {
background-color: $layer-hover;
}
Expand Down Expand Up @@ -149,9 +152,6 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
padding-right: $spacing-03;
padding-left: $spacing-03;
}
.#{$block-class}__conditionWrapper {
display: flex;
}

.#{$block-class}__multiselectSelectionStatusContainer {
display: flex;
Expand All @@ -165,22 +165,59 @@ $block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
.#{$block-class}__item-option__option:focus {
@include focus-outline.focus-outline('outline');
}
// .#{$block-class}__tree {
// .#{$block-class}__condition-wrapper > :nth-child(n + 3) {
// flex-basis: 100%;
// }
// .#{$block-class}__groupConnector {
// background-color: $layer;
// }
// .#{$block-class}__condition-wrapper
// > :nth-child(1)
// .#{$block-class}__button,
// .#{$block-class}__condition-wrapper
// > :nth-child(2)
// .#{$block-class}__button {
// box-shadow: inset 0 #{$spacing-01} 0 0 var(--#{$block-class}__condition-wrapper-color);
// }
// }
//need to revamp to a simpler logic
$colors: (
($purple-70, $purple-60, $purple-50, $purple-40, $purple-30, $purple-20),
($cyan-70, $cyan-60, $cyan-50, $cyan-40, $cyan-30, $cyan-20),
($teal-70, $teal-60, $teal-50, $teal-40, $teal-30, $teal-20),
(
$magenta-70,
$magenta-60,
$magenta-50,
$magenta-40,
$magenta-30,
$magenta-20
),
($red-70, $red-60, $red-50, $red-40, $red-30, $red-20),
($orange-70, $orange-60, $orange-50, $orange-40, $orange-30, $orange-20),
($yellow-70, $yellow-60, $yellow-50, $yellow-40, $yellow-30, $yellow-20),
($green-70, $green-60, $green-50, $green-40, $green-30, $green-20)
);

@for $i from 1 through list.length($colors) {
$selector: (
string.unquote(
'.#{$block-class}__content-container > .#{$block-class}__group-wrapper:nth-of-type(#{list.length($colors)}n+#{$i})'
)
);
$group-colors: list.nth($colors, $i);
@each $color in $group-colors {
#{$selector} {
/* stylelint-disable-next-line carbon/theme-token-use */
--#{$block-class}__condition-wrapper-color: #{$color};
}

$selector: list.append(
$selector,
string.unquote('.#{$block-class}__group')
);
}
}

.#{$block-class}__tree {
.#{$block-class}__condition-wrapper > :nth-child(n + 3) {
flex-basis: 100%;
}
.#{$block-class}__groupConnector {
background-color: $layer;
}
.#{$block-class}__condition-wrapper > :nth-child(1) .#{$block-class}__button,
.#{$block-class}__condition-wrapper > :nth-child(2) .#{$block-class}__button {
/* stylelint-disable-next-line carbon/theme-token-use */
box-shadow: inset 0 #{$spacing-01} 0 0 var(--#{$block-class}__condition-wrapper-color);
}
}

.#{$block-class}__groupOperatorConnector {
margin-bottom: $spacing-02;
}
Expand Down
Loading

0 comments on commit 553f2c7

Please sign in to comment.