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(NcInputField): add optional pill form appearance to the component #4876

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 29 additions & 5 deletions src/components/NcInputField/NcInputField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ For a list of all available props and attributes, please check the [HTMLInputEle
'input-field__input--label-outside': labelOutside,
'input-field__input--success': success,
'input-field__input--error': error,
'input-field__input--pill': pill,
}]"
:value="value"
v-on="$listeners"
Expand All @@ -76,6 +77,9 @@ For a list of all available props and attributes, please check the [HTMLInputEle
<NcButton v-if="showTrailingButton"
type="tertiary-no-background"
class="input-field__trailing-button"
:class="[{
'input-field__trailing-button--pill': pill,
}]"
:aria-label="trailingButtonLabel"
:disabled="disabled"
@click="handleTrailingButtonClick">
Expand Down Expand Up @@ -237,6 +241,16 @@ export default {
type: Boolean,
default: false,
},

/**
* Specifies whether the input should have a pill form.
* By default, input has rounded corners.
*/
pill: {
type: Boolean,
default: false,
},

/**
* Class to add to the input field.
* Necessary to use NcInputField in the NcActionInput component.
Expand Down Expand Up @@ -418,6 +432,10 @@ export default {
box-shadow: rgb(248, 250, 252) 0px 0px 0px 2px, var(--color-primary-element) 0px 0px 0px 4px, rgba(0, 0, 0, 0.05) 0px 1px 2px 0px
}
}

&--pill {
border-radius: var(--border-radius-pill);
}
}

&__label {
Expand Down Expand Up @@ -482,11 +500,17 @@ export default {
}
}

&__trailing-button.button-vue {
position: absolute;
top: 0;
right: 0;
border-radius: var(--border-radius-large);
&__trailing-button {
&.button-vue {
position: absolute;
top: 0;
right: 0;
border-radius: var(--border-radius-large);
}

&--pill.button-vue {
border-radius: var(--border-radius-pill);
}
}

&__helper-text-message {
Expand Down
Loading