ls-plugins v1.0.8
LsPlugins
Description
Base UI components designed for Vue.js applications
Installation
NPM
npm i ls-pluginsmain.js
import LsPlugins from "ls-plugins";
Vue.use(LsPlugins);Icons
The UI components that use icons that are dependant upoun a file named svgIcons.js. Create this file somewhere in your src folder. This is the data source of your icons. It only needs a name and the svg path value of the svg icon.
export const svgIcons = new Map([]);Example values showing name and svg path value
export const svgIcons = new Map([
["arrowdown", "M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"],
["arrowup", "M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z"],
["close", "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"],
["home", "M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"],
["menu", "M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"],
["morevert", "M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"]
]);UI Components
- LsButton
- LsCard
- LsCheckbox
- LsDialog
- LsFiscalCalendar
- LsIcon
- LsInputText
- LsMenuDropdown
- LsSearchBox
- LsSelectDropdown
- LsSpinner
- LsTableGroup
- LsTimeframes
- LsToast
- LsToggle
- LsTooltip
LsButton
Different styles of buttons
prop type required default options btnClickFunctionfalse() => nullbtnDisabledBooleanfalsefalsebtnStyleStringfalse"primary""primary", "flat", "danger"btnTextStringfalse"click"Example
<template> <LsButton btn-style="primary" btn-text="primary" :btn-click="clickButton" /> <LsButton btn-style="flat" btn-text="show toast message" :btn-click="clickButtonToast" /> <LsButton btn-style="danger" btn-text="show dialog window" :btn-click="clickButtonDialog" /> </template><script> export default { name: "App", data() { return { showDialog: false, showToast: false }; }, methods: { clickButton(e) { console.log(e); }, clickButtonDialog(e) { this.showDialog = !this.showDialog; }, clickButtonToast(e) { this.showToast = !this.showToast; } } }; </script>
LsCard
Card canvas for tables, images, etc...
slots
name required headerfalseheaderButtonfalsebodyfalsefooterfalseExample
<template> <LsCard> <div slot="header"> LsCard </div> <div slot="body"> body </div> <div slot="footer"> <LsButton btn-style="primary" btn-text="primary" :btn-click="clickButton" /> </div> </LsCard> </template><script> export default { name: "App", methods: { clickButton(e) { console.log(e); } } }; </script>
LsCheckbox
Checkbox with or without label
prop type required default idStringtrueisCheckedBooleantrueisDisabledBooleanfalsefalselabelOffStringfalse""labelOnStringfalse""onChangeFunctiontrueExample
<template> <LsCheckbox id="1" :is-checked="isChecked" :on-change="updateChecked" label-on="On" label-off="Off" /> </template><script> export default { name: "App", data() { return { isChecked: false }; }, methods: { updateChecked() { this.isChecked = !this.isChecked; } } }; </script>
LsDialog
Dialog window for user alerts or important actions
props
name type required default buttonDisabledBooleanfalsefalseisDialogActiveBooleantrueonCancelFunctiontrueonConfirmFunctiontruecancelButtonTextFunctionfalse"cancel"submitButtonTextStringfalse"submit"slots
name required lstitlefalselsbodyfalseExample
<template> <LsDialog :is-dialog-active="showDialog" :on-cancel="onCancel" :on-confirm="onConfirm"> </LsDialog> </template><script> export default { name: "App", data() { return { showDialog: false }; }, methods: { onCancel() { this.showDialog = false; }, onConfirm() { this.showDialog = false; } } }; </script>
LsFiscalCalendar
A calendar widget that includes fiscal weeks, period weeks, and holidays for each month.
Fiscal Weeks and Period Weeks can be shown or hidden using props.
props
name type required default showFwBooleanfalsetrueshowPwBooleanfalsetrueExample
<template> <LsFiscalCalendar :show-fw="Boolean(true)" :show-pw="Boolean(true)" /> </template>
LsIcon
Svg icon
props
name type required default options iconClickedFunctionfalse() => nulliconColorStringfalsergba(118, 118, 118, 1)note: needs to be in rgba format iconNameStringtrueiconSizeStringfalse"24"data
this plugin requires
svgIcons.js
Example
<template>
<LsIcon
:icon-name="iconName"
:icon-clicked="iconClicked"
icon-color="rgba(33, 150, 243, 1)" />
</template><script>
import { svgIcons } from "./svgIcons";
export default {
name: "App",
data() {
return {
iconName: svgIcons.get("home")
};
},
methods: {
iconClicked(e) {
console.log(e);
}
}
};
</script>LsInputText
Input fields for text strings
props
name type required default textLabelStringtruevalueStringtrueExample
<template> <LsInputText text-label="Name" :value="inputTextValue" @input="queryText" /> </template><script> export default { name: "App", data() { return { inputTextValue: "" }; }, methods: { queryText(e) { this.inputTextValue = e; } } }; </script>
LsMenuDropdown
Dropdown menu displaying clickable list items
props
name type required default options iconColorStringfalse"rgba(118, 118, 118, 1)"note: needs to be in rgba format iconNameStringfalsemorevertslots
name required defaultfalsedata
this plugin requires
svgIcons.js
Example
<template>
<LsMenuDropdown :icon-name="iconNameMenu">
<div>
<div>one</div>
<div>two</div>
</div>
</LsMenuDropdown>
</template><script>
import { svgIcons } from "./svgIcons";
export default {
name: "App",
data() {
return {
iconNameMenu: svgIcons.get("morevert")
};
}
};
</script>LsSearchBox
Search input field displaying active choice + list of choices
props
name type required default choicesArraytrueonFilteredFunctiontrueonSelectedFunctiontruetextLabelStringfalse"Search"scoped slots
name required defaultfalseExample
<template> <LsSearchBox :choices="choices" :on-filtered="choicesFiltered" :on-selected="choiceSelected" /> </template><script> export default { name: "App", data() { return { choices: [ "Brandt", "Bunny", "Donny", "Jackie", "Jeff", "Jesus", "Karl", "Maude", "Walter" ], selectedName: "" }; }, methods: { choicesFiltered(e) { this.choices = e; }, choiceSelected(e) { this.selectedName = e; } } }; </script>
LsSelectDropdown
Dropdown selector displaying active choice + list of choices
props
name type required default activeChoiceStringtruechoicesArraytruescoped slots
name required defaultfalseExample
<template> <LsSelectDropdown :choices="choices" :active-choice="activeChoice" /> </template><script> export default { name: "App", data() { return { activeChoice: "Walter", choices: [ "Brandt", "Bunny", "Donny", "Jackie", "Jeff", "Jesus", "Karl", "Maude", "Walter" ], selectedName: "" }; }, methods: { choiceSelected(e) { this.selectedName = e; } } }; </script>
LsSpinner
Full-page spinner with option to show loading percent completed
props
name type required default percentCompletedNumberfalse100sizeStringfalse"20px"strokeWidthStringfalse"5px"Example
<template> <LsSpinner size="30px" strokeWidth="7px" /> </template>
LsTableGroup
Creating tables that have sortable columns
props
name type required default options tableBodyArraytruetableClassStringfalse"basic""basic", "sort"tableColumnAlignArrayfalse["left"]["left", "center", "right"]tableColumnWidthsArrayfalse["md"]["xs", "sm", "md", "lg", "xl"]tableHeaderArraytruesortByColumnStringfalse"""h1", "h2", "h3", etc..scoped slots
name required headertruerowtrueExample
<template> <LsTableGroup :table-body="tableBody" :table-header="tableHeader" :table-column-align="tableColumnAlign" :table-column-widths="tableColumnWidths" table-class="sort" sort-by-column="h1"> <template v-slot:header="slotProps"> <th> <div>{{ slotProps }}</div> </th> </template> <template v-slot:row="slotProps"> <td>{{ slotProps }} </td> </template> </LsTableGroup> </template><script> export default { name: "App", data() { return { tableBody: [ { id: "1", desc: "one", color: "blue", total: 5 }, { id: "2", desc: "two", color: "red", total: 6 }, { id: "3", desc: "three", color: "green", total: 7 }, { id: "4", desc: "four", color: "yellow", total: 8 }, { id: "5", desc: "five", color: "black", total: 9 } ], tableColumnAlign: ["left", "left", "center", "center"], tableColumnWidths: ["sm", "sm", "md", "md"], tableHeader: ["id", "desc", "color", "total"] }; } }; </script>
LsTimeframes
Horizontal group of clickable buttons for setting active choice
props
name type required default timesArraytruetoggleActiveFunctiontrueExample
<template> <LsTimeframes :times="times" :toggle-active="setActive" /> </template><script> export default { name: "App", data() { return { activeTime: "Jeffrey", times: ["Jeffrey", "Walter", "Donny", "Jesus"] }; }, methods: { setActive(e) { this.activeTime = e; } } }; </script>
LsToast
Toast message pop-up
props
name type required default options cancelButtonActionFunctionfalsefalsecancelButtonTextStringfalse"cancel"cancelButtonVisibleStringfalse"false"confirmButtonActionFunctionfalsefalseconfirmButtonTextStringfalse"confirm"confirmButtonVisibleStringfalse"false"showIconBooleanfalsefalseshowMessageBooleanfalsefalsetoastPositionStringfalse"bottom left-full""bottom left-full", "bottom right-full", "bottom left", "bottom right", "bottom center"toastTypeStringfalse"ls-peek""ls-peek", "ls-stay"slots
name required msgtrueiconfalseExample
<template> <LsToast toast-position="bottom left-full" toast-type="ls-stay" confirm-button-text="ok" confirm-button-visible="true" :confirm-button-action="toggleToast" :show-message="showToast"> <div slot="msg"> This is a toast message! </div> </LsToast> </template><script> export default { name: "App", data() { return { showToast: false }; }, methods: { toggleToast() { this.showToast = false; } } }; </script>
LsToggle
Toggle switch with or without label
prop type required default idStringtrueisDisabledBooleanfalsefalseisToggledBooleantrueonToggleFunctiontruetoggleLabelStringfalse""Example
<template> <LsToggle id="toggleId" :is-toggled="showSwitch" :on-toggle="toggleSwitch" toggle-label="LsToggle" /> </template><script> export default { name: "App", data() { return { showSwitch: false }; }, methods: { toggleSwitch() { this.showSwitch = !this.showSwitch; } } }; </script>
LsTooltip
Combines svg icon with tooltip
props
name type required default options iconClickedFunctionfalsefalseiconColorStringfalse"rgba(118, 118, 118, 1)"note: needs to be in rgba format iconNameStringtrueiconRotateStringfalse"""open", "close"iconSizeStringfalse"24"toolTipPositionStringtrue"right", "left", "bottom", "bottom-left", "bottom-right", "top", "top-left", "top-right"toolTipTextStringtruedata
this plugin requires
svgIcons.jsExample
<template> <LsTooltip :icon-name="iconName" :icon-clicked="iconClicked" icon-color="rgba(33, 150, 243, 1)" tool-tip-position="bottom" tool-tip-text="tool tip text" /> </template><script> import { svgIcons } from "./svgIcons"; export default { name: "App", data() { return { iconName: svgIcons.get("home") }; } }; </script>
License
UNLICENSED