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

Documentation for kselect #821

Merged
merged 4 commits into from
Nov 28, 2024
Merged
Changes from 2 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: 30 additions & 4 deletions lib/KSelect/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
:class="labelClasses"
:style="activeColorStyle"
>
<!-- @slot Displays the label -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<!-- @slot Displays the label -->
<!-- @slot Optional slot as alternative to `label` prop -->

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize for the delay in addressing the PR comments. The comments have now been addressed. Please review at your earliest convenience.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries @yeshwanth235. Thank you!! 🚀

<slot>{{ label }}</slot>
</div>

Expand All @@ -51,6 +52,7 @@
class="ui-select-display-value"
:class="{ 'is-placeholder': !hasDisplayText }"
>
<!-- @slot Displays the selected value else placeholder -->
AlexVelezLl marked this conversation as resolved.
Show resolved Hide resolved
<slot name="display">
{{ hasDisplayText ? displayText : (
hasFloatingLabel && isLabelInline) ? null : placeholder }}
Expand Down Expand Up @@ -106,6 +108,7 @@

@mouseover.native.stop="onMouseover(option)"
>
<!-- @slot Highlights the selected value -->
AlexVelezLl marked this conversation as resolved.
Show resolved Hide resolved
<slot
name="option"

Expand All @@ -117,6 +120,7 @@
</KSelectOption>

<div v-show="hasNoResults" class="ui-select-no-results">
<!-- @slot Text displayed if no results found -->
AlexVelezLl marked this conversation as resolved.
Show resolved Hide resolved
<slot name="no-results">
{{ noResultsText }}
</slot>
Expand All @@ -128,12 +132,14 @@

<div v-if="hasFeedback" class="ui-select-feedback">
<div v-if="showError" class="ui-select-feedback-text">
<!-- @slot Displays error text -->
AlexVelezLl marked this conversation as resolved.
Show resolved Hide resolved
<slot name="error">
{{ invalidText }}
</slot>
</div>

<div v-else-if="showHelp" class="ui-select-feedback-text">
<!-- @slot Displays help text -->
AlexVelezLl marked this conversation as resolved.
Show resolved Hide resolved
<slot name="help">
{{ help }}
</slot>
Expand Down Expand Up @@ -214,14 +220,14 @@
},
},
/**
* Placeholder
* Sets the placeholder value
*/
placeholder: {
type: String,
default: '',
},
/**
* Label
* Set default label
yeshwanth235 marked this conversation as resolved.
Show resolved Hide resolved
*/
label: {
type: String,
Expand Down Expand Up @@ -255,6 +261,9 @@
type: String,
default: '',
},
/**
* key attribute to identify individual elements within a list rendered
yeshwanth235 marked this conversation as resolved.
Show resolved Hide resolved
*/
keys: {
type: Object,
default() {
Expand Down Expand Up @@ -297,6 +306,10 @@
type: Boolean,
default: false,
},
/**
* If provided, shows a KIconButton with the given text
yeshwanth235 marked this conversation as resolved.
Show resolved Hide resolved
*
*/
clearText: {
type: String,
default: '',
Expand Down Expand Up @@ -500,14 +513,23 @@
showDropdown() {
if (this.showDropdown) {
this.onOpen();
/**
* Emit on opening dropdown
*/
this.$emit('dropdown-open');
} else {
this.onClose();
/**
* Emit on closing dropdown
*/
this.$emit('dropdown-close');
}
},

query() {
/**
* Emit on change query
yeshwanth235 marked this conversation as resolved.
Show resolved Hide resolved
*/
this.$emit('query-change', this.query);
},

Expand Down Expand Up @@ -575,7 +597,10 @@
setValue(value) {
value = value ? value : this.multiple ? [] : '';
this.selection = value;

/**
* Emitted when the value is selected or
yeshwanth235 marked this conversation as resolved.
Show resolved Hide resolved
* Emitted when reset method is called.
*/
this.$emit('input', value);
},

Expand Down Expand Up @@ -863,7 +888,8 @@
},

/**
* @public
* Resets the selected values of dropdown
* @public This is a public method
*/
reset() {
this.setValue(JSON.parse(this.initialValue));
Expand Down