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

mapp.ui.elements.pills Documentation and Rename 👀 #1266

Merged
merged 3 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions lib/ui/elements/_elements.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import searchbox from './searchbox.mjs';
import slider from './slider.mjs';
import slider_ab from './slider_ab.mjs';
import { numericFormatter, getSeparators } from './numericFormatter.mjs';
import pillComponent from './pillComponent.mjs'
import pills from './pills.mjs'

/**
UI elements object containing various UI components.
Expand All @@ -40,7 +40,7 @@ UI elements object containing various UI components.
@property {Function} slider_ab - Slider with A/B comparison component.
@property {Function} numericFormatter - Numeric formatter function.
@property {Function} getSeparators - Function to get numeric separators.
@property {Function} pillComponent - pill component.
@property {Function} pills - pills component.

Exporting UI elements.
@type {UIElements}
Expand All @@ -56,7 +56,7 @@ export default {
dropdown_multi,
legendIcon,
modal,
pillComponent,
pills,
helpModal,
searchbox,
slider,
Expand Down
20 changes: 11 additions & 9 deletions lib/ui/elements/pillComponent.mjs → lib/ui/elements/pills.mjs
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
/**
### mapp.ui.elements.pillComponent()
Module that returns a pillComponent UI element used in mapp.
@module /ui/elements/pillComponent
### mapp.ui.elements.pill()
Module that returns a pill UI element used in mapp.
@module /ui/elements/pills
*/

/**
Creates a searchbox component.
@function pillComponent
@function pill
@param {Object} component The config object argument.
@param {HTMLElement} pillComponent.target The target element to append to.
@param {Object} pillComponent.pills array of values to be initially selected
@param {Function} [pillComponent.addCallback] function to execute once a pill has been added. Takes as arguments added value and array of selected values
@param {Function} [pillComponent.removeCallback] function to execute once a pill has been removed. Takes as arguments removed value and array of selected values
@param {HTMLElement} pill.target The target element to append to.
@param {Object} pill.pills array of values to be initially selected
@param {Function} [pill.addCallback] function to execute once a pill has been added. Takes as arguments added value and array of selected values
@param {Function} [pill.removeCallback] function to execute once a pill has been removed. Takes as arguments removed value and array of selected values
@returns {Object} The decorated object argument.
*/

mapp.utils.merge(mapp.dictionaries, {
en: {
pill_component_remove: "Remove"
pill_component_remove: 'Remove'
}
});

Expand Down
2 changes: 1 addition & 1 deletion lib/ui/locations/entries/pills.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export default entry => {

entry.pills ??= entry.value || []

mapp.ui.elements.pillComponent(entry)
mapp.ui.elements.pills(entry)

return entry.container
}
Loading