Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
monorepo FLOW-935 f-select global styles updated
Browse files Browse the repository at this point in the history
  • Loading branch information
vikas-cldcvr committed Oct 9, 2023
1 parent dab43c7 commit 1a1f268
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 144 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
@import "./../../mixins/scss/mixins";

:root {
--input-border-radius-curved: 4px;
--input-border-radius-round: 22px;
}

f-icon-button {
@include base();
display: inline-flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,3 @@ in this case it is `f-icon-button`
opacity: 1 !important;
}
}

:root {
--input-border-radius-curved: 4px;
--input-border-radius-round: 22px;
}
6 changes: 6 additions & 0 deletions packages/flow-core/src/components/f-input/f-input-global.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// common mixins imported from this file
@import "./../../mixins/scss/mixins";
@import "./f-input-variables";

:root {
--input-border-radius-curved: 4px;
--input-border-radius-round: 22px;
}

f-input {
width: 100%;
&[disabled] {
Expand Down
5 changes: 0 additions & 5 deletions packages/flow-core/src/components/f-input/f-input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,3 @@ applies styles on f-input
}
}
}

:root {
--input-border-radius-curved: 4px;
--input-border-radius-round: 22px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/**
$categories map will have state specific inner maps.
**/
$categories: (
"fill": (
"background": var(--color-input-default),
"hover": var(--color-input-default-hover)
),
"transparent": (
"background": transparent,
"hover": var(--color-surface-default-hover)
),
"outline": (
"background": transparent,
"hover": var(--color-surface-default-hover)
)
);

/**
$sizes map will have state specific inner maps.
**/
$sizes: (
"medium": (
"main-height": 36px,
"height": 34px,
"loader": 24px,
"maxlength": -38px
),
"small": (
"main-height": 28px,
"height": 26px,
"loader": 16px,
"maxlength": -34px
)
);

/**
$states map will have state specific inner maps.
**/
$states: (
"primary": (
"input": var(--color-primary-default),
"border": var(--color-primary-default),
"focus": var(--color-primary-default)
),
"default": (
"input": var(--color-input-default),
"border": var(--color-border-default),
"focus": var(--color-primary-default)
),
"success": (
"input": var(--color-success-default),
"border": var(--color-success-default),
"focus": var(--color-success-default)
),
"warning": (
"input": var(--color-warning-default),
"border": var(--color-warning-default),
"focus": var(--color-warning-default)
),
"danger": (
"input": var(--color-danger-default),
"border": var(--color-danger-default),
"focus": var(--color-danger-default)
),
"inherit": (
"input": var(--color-input-default),
"border": var(--color-input-border-default),
"focus": var(--color-input-focus)
)
);
64 changes: 64 additions & 0 deletions packages/flow-core/src/components/f-select/f-select-global.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
@import "./../../mixins/scss/mixins";
@import "./f-select-variables";

:root {
--input-border-radius-curved: 4px;
--input-border-radius-round: 22px;
}

f-select {
display: flex;
flex-direction: row;
align-items: center;
&[disabled] {
@include disabled();
}
@each $state, $color in $states {
&[state="#{$state}"] {
@include input-color($state);
}
}
}

f-form-group {
&[variant="compact"][direction="horizontal"] {
f-select {
&:first-child {
--input-border-radius-curved: 4px 0px 0px 4px;
--input-border-radius-round: 22px 0px 0px 22px;
}
&:last-child {
--input-border-radius-curved: 0px 4px 4px 0px;
--input-border-radius-round: 0px 22px 22px 0px;
}
&:not(:first-child):not(:last-child) {
--input-border-radius-curved: 0px 0px 0px 0px;
--input-border-radius-round: 0px 0px 0px 0px;
}
}
}
}

f-select.f-search-border {
--input-border-radius-curved: 4px 0px 0px 4px;
--input-border-radius-round: 22px 0px 0px 22px;
&[category="fill"][state="default"] {
border-right: 1px solid var(--color-border-default);
}
}

f-div[direction="column"] {
> f-select {
flex: 1 1;
max-height: 100%;
width: 100%;
}
}

f-div[direction="row"] {
> f-select {
flex: 1 1;
max-width: 100%;
height: 100%;
}
}
135 changes: 1 addition & 134 deletions packages/flow-core/src/components/f-select/f-select.scss
Original file line number Diff line number Diff line change
@@ -1,78 +1,7 @@
@use "sass:map";
// common mixins imported from this file
@import "./../../mixins/scss/mixins";

/**
$categories map will have state specific inner maps.
**/
$categories: (
"fill": (
"background": var(--color-input-default),
"hover": var(--color-input-default-hover)
),
"transparent": (
"background": transparent,
"hover": var(--color-surface-default-hover)
),
"outline": (
"background": transparent,
"hover": var(--color-surface-default-hover)
)
);

/**
$sizes map will have state specific inner maps.
**/
$sizes: (
"medium": (
"main-height": 36px,
"height": 34px,
"loader": 24px,
"maxlength": -38px
),
"small": (
"main-height": 28px,
"height": 26px,
"loader": 16px,
"maxlength": -34px
)
);

/**
$states map will have state specific inner maps.
**/
$states: (
"primary": (
"input": var(--color-primary-default),
"border": var(--color-primary-default),
"focus": var(--color-primary-default)
),
"default": (
"input": var(--color-input-default),
"border": var(--color-border-default),
"focus": var(--color-primary-default)
),
"success": (
"input": var(--color-success-default),
"border": var(--color-success-default),
"focus": var(--color-success-default)
),
"warning": (
"input": var(--color-warning-default),
"border": var(--color-warning-default),
"focus": var(--color-warning-default)
),
"danger": (
"input": var(--color-danger-default),
"border": var(--color-danger-default),
"focus": var(--color-danger-default)
),
"inherit": (
"input": var(--color-input-default),
"border": var(--color-input-border-default),
"focus": var(--color-input-focus)
)
);
@import "./f-select-variables";

/**
applies styles on f-select
Expand Down Expand Up @@ -344,65 +273,3 @@ applies styles on f-select
@include disabled();
}
}

f-select {
display: flex;
flex-direction: row;
align-items: center;
&[disabled] {
@include disabled();
}
@each $state, $color in $states {
&[state="#{$state}"] {
@include input-color($state);
}
}
}

:root {
--input-border-radius-curved: 4px;
--input-border-radius-round: 22px;
}

f-form-group {
&[variant="compact"][direction="horizontal"] {
f-select {
&:first-child {
--input-border-radius-curved: 4px 0px 0px 4px;
--input-border-radius-round: 22px 0px 0px 22px;
}
&:last-child {
--input-border-radius-curved: 0px 4px 4px 0px;
--input-border-radius-round: 0px 22px 22px 0px;
}
&:not(:first-child):not(:last-child) {
--input-border-radius-curved: 0px 0px 0px 0px;
--input-border-radius-round: 0px 0px 0px 0px;
}
}
}
}

f-select.f-search-border {
--input-border-radius-curved: 4px 0px 0px 4px;
--input-border-radius-round: 22px 0px 0px 22px;
&[category="fill"][state="default"] {
border-right: 1px solid var(--color-border-default);
}
}

f-div[direction="column"] {
> f-select {
flex: 1 1;
max-height: 100%;
width: 100%;
}
}

f-div[direction="row"] {
> f-select {
flex: 1 1;
max-width: 100%;
height: 100%;
}
}
4 changes: 4 additions & 0 deletions packages/flow-core/src/components/f-select/f-select.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HTMLTemplateResult, PropertyValues, unsafeCSS } from "lit";
import { property, query, queryAll, queryAssignedElements, state } from "lit/decorators.js";
import eleStyle from "./f-select.scss?inline";
import globalStyle from "./f-select-global.scss?inline";
import { FRoot } from "../../mixins/components/f-root/f-root";
import { FText } from "../f-text/f-text";
import { FDiv } from "../f-div/f-div";
Expand All @@ -24,6 +25,8 @@ import {
} from "./handlers";
import { FIconButton } from "../f-icon-button/f-icon-button";
import { flowElement } from "./../../utils";
import { injectCss } from "@cldcvr/flow-core-config";
injectCss("f-select", globalStyle);

export type FSelectState = "primary" | "default" | "success" | "warning" | "danger";
export type FSelectHeightProp = number;
Expand Down Expand Up @@ -65,6 +68,7 @@ export class FSelect extends FRoot {
*/
static styles = [
unsafeCSS(eleStyle),
unsafeCSS(globalStyle),
...FText.styles,
...FDiv.styles,
...FIcon.styles,
Expand Down

0 comments on commit 1a1f268

Please sign in to comment.