Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: variables generation #334

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/dist
/dist-ssr
/node_modules
/tokens

# Logs
logs
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"serve": "vite preview",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"build-tokens": "token-transformer ./tokens/tokens.json tokens/transformed-tokens.json && style-dictionary build --config sd.config.json",
"lint:js": "eslint '**/*.{vue,ts}'",
"lint:js:fix": "eslint --fix '**/*.{vue,ts,html}'",
"lint:style": "stylelint '**/*.{css,scss,vue}'",
Expand Down Expand Up @@ -83,8 +84,10 @@
"rollup-plugin-vue": "^6.0.0",
"sass": "^1.51.0",
"sass-loader": "^12.6.0",
"style-dictionary": "^3.7.1",
"style-loader": "^3.3.1",
"stylelint": "^14.8.2",
"token-transformer": "^0.0.25",
"typescript": "^4.6.4",
"vite": "^2.9.8",
"vite-plugin-dts": "^1.1.1",
Expand Down
16 changes: 16 additions & 0 deletions sd.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
SeregaBB marked this conversation as resolved.
Show resolved Hide resolved
"source": ["tokens/transformed-tokens.json"],
"platforms": {
"scss": {
"transformGroup": "scss",
"transforms": ["attribute/cti", "name/cti/kebab", "size/px", "color/css"],
"buildPath": "src/",
"files": [
{
"destination": "token-variables.scss",
"format": "scss/map-deep"
}
]
}
}
}
81 changes: 40 additions & 41 deletions src/qComponents/QInput/src/q-input.scss
Original file line number Diff line number Diff line change
@@ -1,29 +1,6 @@
.q-input {
--field-color-base: var(--color-primary-black);
--field-color-placeholder: rgb(var(--color-rgb-gray) / 32%);
--field-color-disabled: rgb(var(--color-rgb-gray) / 64%);
--field-icon-color-base: var(--color-primary-blue);
--field-icon-color-hover: var(--color-primary-black);
--field-icon-color-inactive: rgb(var(--color-rgb-gray) / 64%);
--field-background-color-base: var(--color-tertiary-gray-light);
--field-background-color-hover: var(--color-tertiary-gray);
--field-background-color-focus: var(--color-tertiary-gray-ultra-light);
--field-background-color-disabled: var(--color-tertiary-gray);
--field-box-shadow-base: -1px -1px 3px rgb(var(--color-rgb-white) / 25%),
1px 1px 3px rgb(var(--color-rgb-blue) / 40%),
4px 4px 8px rgb(var(--color-rgb-blue) / 40%),
-4px -4px 12px var(--color-tertiary-white);
--field-box-shadow-hover: -1px -1px 4px rgb(var(--color-rgb-white) / 25%),
1px 1px 4px rgb(var(--color-rgb-blue) / 40%),
4px 4px 8px rgb(var(--color-rgb-blue) / 40%),
-4px -4px 8px rgb(var(--color-rgb-white) / 80%);
--field-box-shadow-focus: -1px -1px 3px rgb(var(--color-rgb-white) / 25%),
1px 1px 3px rgb(var(--color-rgb-blue) / 40%),
inset -1px -1px 1px rgb(var(--color-rgb-white) / 70%),
inset 1px 1px 2px rgb(var(--color-rgb-blue) / 20%);
--field-box-shadow-disabled: -1px -1px 3px rgb(var(--color-rgb-white) / 25%),
1px 1px 3px rgb(var(--color-rgb-blue) / 40%);
@import '../../../vars';

.q-input {
position: relative;
display: inline-block;
width: 100%;
Expand All @@ -37,11 +14,12 @@
font-size: var(--font-size-base);
font-weight: var(--font-weight-base);
line-height: var(--line-height-base);
color: var(--field-color-base);
background-color: var(--field-background-color-base);
color: $input-filled-text-color;
background-color: $input-default-background-color;
border: none;
border-radius: var(--border-radius-base);
box-shadow: var(--field-box-shadow-base);
outline: 1px solid $input-default-border-color;
box-shadow: create-shadow($tokens, 'input', 'default', 'dropShadow');
appearance: textfield;

&::-webkit-outer-spin-button,
Expand All @@ -52,7 +30,7 @@

&::placeholder,
&:placeholder-shown {
color: var(--field-color-placeholder);
color: $input-disabled-text-color;
text-overflow: ellipsis;
opacity: 1;
}
Expand All @@ -71,21 +49,26 @@

.q-input_focused &,
&.focus-visible {
background-color: var(--field-background-color-focus);
box-shadow: var(--field-box-shadow-focus);
color: $input-focus-filled-text-color;
background-color: $input-filled-background-color;
outline: 1px solid $input-focus-filled-border-color;
box-shadow: create-shadow($tokens, 'input', 'focus', 'dropShadow');
}

&:hover {
background-color: var(--field-background-color-hover);
box-shadow: var(--field-box-shadow-hover);
color: $input-hover-filled-text-color;
background-color: $input-hover-background-color;
outline: 1px solid $input-hover-border-color;
box-shadow: create-shadow($tokens, 'input', 'hover', 'dropShadow');
}

.q-input_disabled & {
padding-right: 40px;
color: var(--field-color-disabled);
color: $input-disabled-text-color;
cursor: not-allowed;
background-color: var(--field-background-color-disabled);
box-shadow: var(--field-box-shadow-disabled);
background-color: $input-disabled-background-color;
outline: 1px solid $input-disabled-border-color;
box-shadow: create-shadow($tokens, 'input', 'disabled', 'dropShadow');
}

.q-input_suffix & {
Expand All @@ -96,7 +79,7 @@
&,
&.focus-visible {
padding-left: 15px;
border: var(--border-error);
outline: 1px solid var(--border-error);
}
}
}
Expand All @@ -116,23 +99,39 @@
width: 40px;
font-size: 24px;
line-height: 40px;
color: var(--field-icon-color-inactive);
color: $input-default-icon-color;
text-align: center;

&:not(:last-child) {
display: none;
}

.q-input_disabled & {
color: $input-disabled-icon-color;
}

.q-input_focused .q-input__inner &,
.q-input__inner.focus-visible & {
color: $input-focus-icon-color;
}

.q-input__inner:hover & {
color: $input-hover-icon-color;
}

&.q-icon-close,
&.q-icon-eye,
&.q-icon-eye-close {
color: var(--field-icon-color-base);
color: $input-filled-icon-color;
pointer-events: all;
cursor: pointer;

&:hover,
&:hover {
color: $input-hover-filled-icon-color;
}

&.focus-visible {
color: var(--field-icon-color-hover);
color: $input-focus-filled-icon-color;
}
}
}
Expand Down
Loading