Skip to content

Commit

Permalink
Merge pull request GEOLYTIX#1266 from RobAndrewHurst/pill_docs
Browse files Browse the repository at this point in the history
`mapp.ui.elements.pills` Documentation and Rename 👀
  • Loading branch information
RobAndrewHurst authored May 21, 2024
2 parents 2ec868c + 8f43244 commit 4ae5637
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
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
}

0 comments on commit 4ae5637

Please sign in to comment.