Skip to content

Commit

Permalink
feat(input): enable input font-family custom property (#322) (#324)
Browse files Browse the repository at this point in the history
close #322

---------

Co-authored-by: Kia King Ishii <kia.king.08@gmail.com>
  • Loading branch information
cuebit and kiaking committed Jul 31, 2023
1 parent 2d99920 commit 4f111b1
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 4 deletions.
12 changes: 9 additions & 3 deletions docs/styles/input-styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@ Input related component such as `SInputText` or `SInputSelect` shares many commo

Here are the list of all available CSS variables that you can customize.

### Font size
### Font stylings

Customize the font size of the generic input value. The font size is different depending on the input's size defined by the `size` prop. You may override the font size for all inputsizes, or customize them individually.
Customize the font size and family of the generic input value. The font size is different depending on the input's size defined by the `size` prop. You may override the font size for all input sizes, or customize them individually.

```css
:root {
/**
* Set the font size for all size of inputs. By default it's
* Set the font family for all size of inputs. By default it is
* undefined and base font family will be used.
*/
--input-value-font-family: undefined;

/**
* Set the font size and family for all size of inputs. By default it's
* undefined and size specific values defined below is used.
*/
--input-font-size: undefined;
Expand Down
1 change: 1 addition & 0 deletions lib/components/SDropdownSectionFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ function handleClick(option: DropdownSectionFilterOption, value: string | number
padding: 0 8px;
width: 100%;
font-size: 14px;
font-family: var(--input-value-font-family);
line-height: 32px;
background-color: var(--input-bg-color);
transition: border-color 0.25s;
Expand Down
2 changes: 1 addition & 1 deletion lib/components/SInputHMS.vue
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ function createRequiredTouched(): boolean[] {
}
.input {
font-family: var(--font-family-number);
font-family: var(--input-value-font-family, var(--font-family-number));
line-height: 24px;
background-color: transparent;
Expand Down
1 change: 1 addition & 0 deletions lib/components/SInputText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ function getValue(e: Event | FocusEvent | KeyboardEvent): string | null {
width: 100%;
background-color: transparent;
cursor: text;
font-family: var(--input-value-font-family);
&.neutral:not(.hide) { color: var(--input-value-color); }
&.info:not(.hide) { color: var(--c-info-text); }
Expand Down
1 change: 1 addition & 0 deletions lib/components/SInputTextarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ function emitBlur(e: FocusEvent): void {
border: 1px solid var(--input-border-color);
border-radius: 6px;
width: 100%;
font-family: var(--input-value-font-family);
font-weight: 400;
background-color: var(--input-bg-color);
transition: border-color 0.25s, background-color 0.25s;
Expand Down
1 change: 1 addition & 0 deletions lib/components/SInputYMD.vue
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ function createRequiredTouched(): boolean[] {
.input {
line-height: 24px;
font-family: var(--input-value-font-family, var(--font-family-number));
font-feature-settings: "tnum";
background-color: transparent;
Expand Down

0 comments on commit 4f111b1

Please sign in to comment.