@farm-investimentos/front-mfe-components-vue3 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/dist/demo.html +10 -0
- package/dist/front-mfe-components.common.js +17771 -0
- package/dist/front-mfe-components.common.js.map +1 -0
- package/dist/front-mfe-components.css +1 -0
- package/dist/front-mfe-components.umd.js +17781 -0
- package/dist/front-mfe-components.umd.js.map +1 -0
- package/dist/front-mfe-components.umd.min.js +2 -0
- package/dist/front-mfe-components.umd.min.js.map +1 -0
- package/package.json +91 -0
- package/src/components/AlertBox/AlertBox.scss +52 -0
- package/src/components/AlertBox/AlertBox.stories.js +79 -0
- package/src/components/AlertBox/AlertBox.vue +127 -0
- package/src/components/AlertBox/__tests__/AlertBox.spec.js +32 -0
- package/src/components/AlertBox/__tests__/valueWatcher.spec.js +15 -0
- package/src/components/AlertBox/index.ts +4 -0
- package/src/components/AlertBox/valueWatcher.ts +10 -0
- package/src/components/AlertReload/AlertReload.scss +33 -0
- package/src/components/AlertReload/AlertReload.stories.js +34 -0
- package/src/components/AlertReload/AlertReload.vue +46 -0
- package/src/components/AlertReload/__tests__/AlertReload.spec.js +18 -0
- package/src/components/AlertReload/index.ts +4 -0
- package/src/components/ButtonToggle/ButtonToggle.scss +14 -0
- package/src/components/ButtonToggle/ButtonToggle.stories.js +50 -0
- package/src/components/ButtonToggle/ButtonToggle.vue +53 -0
- package/src/components/ButtonToggle/IButtonToggle.ts +5 -0
- package/src/components/ButtonToggle/__tests__/ButtonToggle.spec.js +35 -0
- package/src/components/ButtonToggle/index.ts +4 -0
- package/src/components/Buttons/ConfirmButton/ConfirmButton.stories.js +50 -0
- package/src/components/Buttons/ConfirmButton/ConfirmButton.vue +33 -0
- package/src/components/Buttons/ConfirmButton/__tests__/ConfirmButton.spec.js +14 -0
- package/src/components/Buttons/ConfirmButton/index.ts +4 -0
- package/src/components/Buttons/DangerButton/DangerButton.stories.js +49 -0
- package/src/components/Buttons/DangerButton/DangerButton.vue +32 -0
- package/src/components/Buttons/DangerButton/__tests__/DangerButton.spec.js +14 -0
- package/src/components/Buttons/DangerButton/index.ts +4 -0
- package/src/components/Buttons/DefaultButton/Buttons.stories.scss +10 -0
- package/src/components/Buttons/DefaultButton/DefaultButton.scss +328 -0
- package/src/components/Buttons/DefaultButton/DefaultButton.stories.js +317 -0
- package/src/components/Buttons/DefaultButton/DefaultButton.vue +128 -0
- package/src/components/Buttons/DefaultButton/__tests__/DefaultButton.spec.js +32 -0
- package/src/components/Buttons/DefaultButton/index.ts +4 -0
- package/src/components/Buttons/ExportButton/ExportButton.stories.js +40 -0
- package/src/components/Buttons/ExportButton/ExportButton.vue +82 -0
- package/src/components/Buttons/ExportButton/__tests__/ExportButton.spec.js +14 -0
- package/src/components/Buttons/ExportButton/index.ts +4 -0
- package/src/components/Buttons/ImportButton/ImportButton.scss +8 -0
- package/src/components/Buttons/ImportButton/ImportButton.stories.js +23 -0
- package/src/components/Buttons/ImportButton/ImportButton.vue +35 -0
- package/src/components/Buttons/ImportButton/__tests__/ImportButton.spec.js +23 -0
- package/src/components/Buttons/ImportButton/index.ts +4 -0
- package/src/components/Buttons/MultiImportButton/MultiImportButton.stories.js +35 -0
- package/src/components/Buttons/MultiImportButton/MultiImportButton.vue +54 -0
- package/src/components/Buttons/MultiImportButton/__tests__/MultiImportButton.spec.js +14 -0
- package/src/components/Buttons/MultiImportButton/index.ts +4 -0
- package/src/components/Buttons/RemoveButton/RemoveButton.scss +5 -0
- package/src/components/Buttons/RemoveButton/RemoveButton.stories.js +17 -0
- package/src/components/Buttons/RemoveButton/RemoveButton.vue +44 -0
- package/src/components/Buttons/RemoveButton/__tests__/RemoveButton.spec.js +23 -0
- package/src/components/Buttons/RemoveButton/index.ts +4 -0
- package/src/components/Buttons/ToggleButton/ToggleButton.stories.js +22 -0
- package/src/components/Buttons/ToggleButton/ToggleButton.vue +75 -0
- package/src/components/Buttons/ToggleButton/__tests__/ToggleButton.spec.js +21 -0
- package/src/components/Buttons/ToggleButton/index.ts +4 -0
- package/src/components/Card/Card.scss +18 -0
- package/src/components/Card/Card.stories.js +40 -0
- package/src/components/Card/Card.vue +24 -0
- package/src/components/Card/CardComposition.stories.ts +69 -0
- package/src/components/Card/CardContent/CardContent.scss +17 -0
- package/src/components/Card/CardContent/CardContent.stories.js +47 -0
- package/src/components/Card/CardContent/CardContent.vue +39 -0
- package/src/components/Card/CardContent/__tests__/CardContent.spec.js +20 -0
- package/src/components/Card/CardContent/index.ts +4 -0
- package/src/components/Card/__tests__/Card.spec.js +20 -0
- package/src/components/Card/index.ts +5 -0
- package/src/components/Checkbox/Checkbox.scss +108 -0
- package/src/components/Checkbox/Checkbox.stories.js +194 -0
- package/src/components/Checkbox/Checkbox.vue +193 -0
- package/src/components/Checkbox/__tests__/Checkbox.spec.js +34 -0
- package/src/components/Checkbox/__tests__/modelValueWatcher.spec.js +43 -0
- package/src/components/Checkbox/index.ts +4 -0
- package/src/components/Checkbox/modelValueWatcher.ts +12 -0
- package/src/components/Chip/Chip.scss +109 -0
- package/src/components/Chip/Chip.stories.js +96 -0
- package/src/components/Chip/Chip.stories.scss +13 -0
- package/src/components/Chip/Chip.vue +66 -0
- package/src/components/Chip/__tests__/Chip.spec.js +20 -0
- package/src/components/Chip/index.ts +4 -0
- package/src/components/ChipInviteStatus/ChipInviteStatus.stories.js +30 -0
- package/src/components/ChipInviteStatus/ChipInviteStatus.vue +38 -0
- package/src/components/ChipInviteStatus/__tests__/ChipInviteStatus.spec.js +22 -0
- package/src/components/ChipInviteStatus/index.ts +4 -0
- package/src/components/ChipInviteStatus/keys.ts +11 -0
- package/src/components/Collapsible/Collapsible.scss +48 -0
- package/src/components/Collapsible/Collapsible.stories.js +150 -0
- package/src/components/Collapsible/Collapsible.vue +189 -0
- package/src/components/Collapsible/__tests__/Collapsible.spec.js +38 -0
- package/src/components/Collapsible/index.ts +3 -0
- package/src/components/ContextMenu/ContextMenu.scss +33 -0
- package/src/components/ContextMenu/ContextMenu.stories.js +248 -0
- package/src/components/ContextMenu/ContextMenu.vue +250 -0
- package/src/components/ContextMenu/__tests__/ContextMenu.spec.js +29 -0
- package/src/components/ContextMenu/index.ts +5 -0
- package/src/components/CopyToClipboard/CopyToClipboard.stories.js +83 -0
- package/src/components/CopyToClipboard/CopyToClipboard.vue +133 -0
- package/src/components/CopyToClipboard/__tests__/CopyToClipboard.spec.js +24 -0
- package/src/components/CopyToClipboard/index.ts +4 -0
- package/src/components/DataTableEmptyWrapper/DataTableEmptyWrapper.scss +17 -0
- package/src/components/DataTableEmptyWrapper/DataTableEmptyWrapper.stories.js +30 -0
- package/src/components/DataTableEmptyWrapper/DataTableEmptyWrapper.vue +50 -0
- package/src/components/DataTableEmptyWrapper/__tests__/DataTableEmptyWrapper.spec.js +20 -0
- package/src/components/DataTableEmptyWrapper/index.ts +4 -0
- package/src/components/DataTableHeader/DataTableHeader.scss +65 -0
- package/src/components/DataTableHeader/DataTableHeader.stories.js +109 -0
- package/src/components/DataTableHeader/DataTableHeader.vue +197 -0
- package/src/components/DataTableHeader/__tests__/DataTableHeader.spec.js +95 -0
- package/src/components/DataTableHeader/index.ts +3 -0
- package/src/components/DataTablePaginator/DataTablePaginator.scss +90 -0
- package/src/components/DataTablePaginator/DataTablePaginator.stories.js +49 -0
- package/src/components/DataTablePaginator/DataTablePaginator.vue +218 -0
- package/src/components/DataTablePaginator/__tests__/DataTablePaginator.spec.js +32 -0
- package/src/components/DataTablePaginator/index.ts +3 -0
- package/src/components/DatePicker/DatePicker.scss +18 -0
- package/src/components/DatePicker/DatePicker.stories.js +134 -0
- package/src/components/DatePicker/DatePicker.vue +292 -0
- package/src/components/DatePicker/__tests__/DatePicker.spec.js +108 -0
- package/src/components/DatePicker/customDatePicker.scss +79 -0
- package/src/components/DatePicker/index.ts +3 -0
- package/src/components/DatePicker/vDatePicker.scss +214 -0
- package/src/components/DialogFooter/DialogFooter.scss +34 -0
- package/src/components/DialogFooter/DialogFooter.stories.js +49 -0
- package/src/components/DialogFooter/DialogFooter.vue +102 -0
- package/src/components/DialogFooter/IExtraButton.ts +9 -0
- package/src/components/DialogFooter/__tests__/DialogFooter.spec.js +20 -0
- package/src/components/DialogFooter/index.ts +3 -0
- package/src/components/DialogHeader/DialogHeader.scss +32 -0
- package/src/components/DialogHeader/DialogHeader.stories.js +69 -0
- package/src/components/DialogHeader/DialogHeader.vue +61 -0
- package/src/components/DialogHeader/__tests__/DialogHeader.spec.js +24 -0
- package/src/components/DialogHeader/index.ts +3 -0
- package/src/components/Form/Form.stories.js +390 -0
- package/src/components/Form/Form.vue +100 -0
- package/src/components/Form/__tests__/Form.spec.js +14 -0
- package/src/components/Form/index.ts +4 -0
- package/src/components/Icon/Icon.scss +61 -0
- package/src/components/Icon/Icon.stories.js +156 -0
- package/src/components/Icon/Icon.vue +100 -0
- package/src/components/Icon/Icons.stories.scss +31 -0
- package/src/components/Icon/__tests__/Icon.spec.js +34 -0
- package/src/components/Icon/icons_list.ts +2557 -0
- package/src/components/Icon/index.ts +4 -0
- package/src/components/IconBox/IconBox.scss +42 -0
- package/src/components/IconBox/IconBox.stories.js +92 -0
- package/src/components/IconBox/IconBox.vue +78 -0
- package/src/components/IconBox/__tests__/IconBox.spec.js +37 -0
- package/src/components/IconBox/index.ts +3 -0
- package/src/components/IdCaption/IdCaption.scss +51 -0
- package/src/components/IdCaption/IdCaption.stories.js +224 -0
- package/src/components/IdCaption/IdCaption.vue +168 -0
- package/src/components/IdCaption/__tests__/IdCaption.spec.js +14 -0
- package/src/components/IdCaption/index.ts +3 -0
- package/src/components/Label/Label.scss +33 -0
- package/src/components/Label/Label.stories.js +60 -0
- package/src/components/Label/Label.vue +27 -0
- package/src/components/Label/__tests__/Label.spec.js +20 -0
- package/src/components/Label/index.ts +4 -0
- package/src/components/List/List.scss +0 -0
- package/src/components/List/List.stories.js +30 -0
- package/src/components/List/List.vue +75 -0
- package/src/components/List/__tests__/List.spec.js +33 -0
- package/src/components/List/composition/index.ts +3 -0
- package/src/components/List/composition/useFocus.ts +49 -0
- package/src/components/List/index.ts +4 -0
- package/src/components/ListItem/ListItem.scss +37 -0
- package/src/components/ListItem/ListItem.stories.js +81 -0
- package/src/components/ListItem/ListItem.vue +76 -0
- package/src/components/ListItem/ListItem.vue.bkpv2 +84 -0
- package/src/components/ListItem/__tests__/ListItem.spec.js +20 -0
- package/src/components/ListItem/index.ts +4 -0
- package/src/components/Loader/Loader.scss +116 -0
- package/src/components/Loader/Loader.stories.ts +48 -0
- package/src/components/Loader/Loader.vue +83 -0
- package/src/components/Loader/__tests__/Loader.spec.js +35 -0
- package/src/components/Loader/index.ts +3 -0
- package/src/components/Logger/Logger.scss +56 -0
- package/src/components/Logger/Logger.stories.js +228 -0
- package/src/components/Logger/Logger.vue +49 -0
- package/src/components/Logger/LoggerItem/ILoggerItem.ts +11 -0
- package/src/components/Logger/LoggerItem/LoggerItem.scss +99 -0
- package/src/components/Logger/LoggerItem/LoggerItem.stories.js +144 -0
- package/src/components/Logger/LoggerItem/LoggerItem.vue +98 -0
- package/src/components/Logger/LoggerItem/__tests__/LoggerItem.spec.js +93 -0
- package/src/components/Logger/LoggerItem/index.ts +4 -0
- package/src/components/Logger/LoggerItem/mappingIconKeys.ts +5 -0
- package/src/components/Logger/__tests__/Logger.spec.js +75 -0
- package/src/components/Logger/index.ts +4 -0
- package/src/components/MainFilter/MainFilter.scss +16 -0
- package/src/components/MainFilter/MainFilter.stories.js +84 -0
- package/src/components/MainFilter/MainFilter.vue +147 -0
- package/src/components/MainFilter/__tests__/MainFilter.spec.js +45 -0
- package/src/components/MainFilter/index.ts +3 -0
- package/src/components/ManagersList/ManagersList.stories.js +10 -0
- package/src/components/ManagersList/ManagersList.vue +29 -0
- package/src/components/ManagersList/__tests__/ManagersList.spec.js +27 -0
- package/src/components/ManagersList/index.ts +3 -0
- package/src/components/Modal/Modal.scss +110 -0
- package/src/components/Modal/Modal.stories.js +299 -0
- package/src/components/Modal/Modal.vue +135 -0
- package/src/components/Modal/__tests__/Modal.spec.js +19 -0
- package/src/components/Modal/index.ts +4 -0
- package/src/components/ModalPromptUser/ModalPromptUser.scss +3 -0
- package/src/components/ModalPromptUser/ModalPromptUser.stories.js +121 -0
- package/src/components/ModalPromptUser/ModalPromptUser.vue +135 -0
- package/src/components/ModalPromptUser/__tests__/ModalPromptUser.spec.js +27 -0
- package/src/components/ModalPromptUser/index.ts +3 -0
- package/src/components/MultipleFilePicker/MultipleFilePicker.scss +168 -0
- package/src/components/MultipleFilePicker/MultipleFilePicker.stories.js +74 -0
- package/src/components/MultipleFilePicker/MultipleFilePicker.vue +261 -0
- package/src/components/MultipleFilePicker/__tests__/MultipleFilePicker.spec.js +184 -0
- package/src/components/MultipleFilePicker/index.ts +3 -0
- package/src/components/MultipleSelectShortener/MultipleSelectShortener.stories.js +32 -0
- package/src/components/MultipleSelectShortener/MultipleSelectShortener.vue +48 -0
- package/src/components/MultipleSelectShortener/__tests__/MultipleSelectShortener.spec.js +21 -0
- package/src/components/MultipleSelectShortener/index.ts +4 -0
- package/src/components/ProgressBar/ProgressBar.scss +25 -0
- package/src/components/ProgressBar/ProgressBar.stories.js +49 -0
- package/src/components/ProgressBar/ProgressBar.vue +111 -0
- package/src/components/ProgressBar/__tests__/ProgressBar.spec.js +31 -0
- package/src/components/ProgressBar/index.ts +4 -0
- package/src/components/PromptUserToConfirm/PromptUserToConfirm.stories.js +51 -0
- package/src/components/PromptUserToConfirm/PromptUserToConfirm.vue +62 -0
- package/src/components/PromptUserToConfirm/__tests__/PromptUserToConfirm.spec.js +24 -0
- package/src/components/PromptUserToConfirm/index.ts +3 -0
- package/src/components/Radio/Radio.scss +109 -0
- package/src/components/Radio/Radio.stories.js +147 -0
- package/src/components/Radio/Radio.vue +110 -0
- package/src/components/Radio/__tests__/Radio.spec.js +27 -0
- package/src/components/Radio/index.ts +4 -0
- package/src/components/RadioGroup/RadioGroup.stories.js +85 -0
- package/src/components/RadioGroup/RadioGroup.vue +95 -0
- package/src/components/RadioGroup/__tests__/RadioGroup.spec.js +24 -0
- package/src/components/RadioGroup/index.ts +4 -0
- package/src/components/RangeDatePicker/RangeDatePicker.stories.js +76 -0
- package/src/components/RangeDatePicker/RangeDatePicker.vue +201 -0
- package/src/components/RangeDatePicker/__tests__/RangeDatePicker.spec.js +107 -0
- package/src/components/RangeDatePicker/index.ts +3 -0
- package/src/components/ResetTableRowSelection/ResetTableRowSelection.stories.js +15 -0
- package/src/components/ResetTableRowSelection/ResetTableRowSelection.vue +35 -0
- package/src/components/ResetTableRowSelection/__tests__/ResetTableRowSelection.spec.js +33 -0
- package/src/components/ResetTableRowSelection/index.ts +4 -0
- package/src/components/ResourceMetaInfo/ResourceMetaInfo.scss +14 -0
- package/src/components/ResourceMetaInfo/ResourceMetaInfo.stories.js +138 -0
- package/src/components/ResourceMetaInfo/ResourceMetaInfo.vue +140 -0
- package/src/components/ResourceMetaInfo/__tests__/ResourceMetaInfo.spec.js +182 -0
- package/src/components/ResourceMetaInfo/index.ts +4 -0
- package/src/components/Select/Select.scss +49 -0
- package/src/components/Select/Select.stories.js +346 -0
- package/src/components/Select/Select.vue +439 -0
- package/src/components/Select/__tests__/Select.spec.js +174 -0
- package/src/components/Select/__tests__/composition.spec.js +27 -0
- package/src/components/Select/composition/buildData.ts +34 -0
- package/src/components/Select/composition/index.ts +3 -0
- package/src/components/Select/index.ts +4 -0
- package/src/components/SelectAutoComplete/SelectAutoComplete.scss +49 -0
- package/src/components/SelectAutoComplete/SelectAutoComplete.stories.js +328 -0
- package/src/components/SelectAutoComplete/SelectAutoComplete.vue +535 -0
- package/src/components/SelectAutoComplete/__tests__/SelectAutoComplete.spec.js +130 -0
- package/src/components/SelectAutoComplete/__tests__/useSelectAutoComplete.spec.js +28 -0
- package/src/components/SelectAutoComplete/composables/index.ts +3 -0
- package/src/components/SelectAutoComplete/composables/useSelectAutoComplete.ts +37 -0
- package/src/components/SelectAutoComplete/index.ts +4 -0
- package/src/components/SelectModalOptions/SelectModalOptions.scss +15 -0
- package/src/components/SelectModalOptions/SelectModalOptions.stories.js +46 -0
- package/src/components/SelectModalOptions/SelectModalOptions.vue +298 -0
- package/src/components/SelectModalOptions/__tests__/SelectModalOptions.spec.js +132 -0
- package/src/components/SelectModalOptions/index.ts +4 -0
- package/src/components/Stepper/StepperHeader/IStep.ts +6 -0
- package/src/components/Stepper/StepperHeader/StepperHeader.scss +127 -0
- package/src/components/Stepper/StepperHeader/StepperHeader.stories.js +89 -0
- package/src/components/Stepper/StepperHeader/StepperHeader.vue +106 -0
- package/src/components/Stepper/StepperHeader/__tests__/StepperHeader.spec.js +63 -0
- package/src/components/Stepper/StepperHeader/_mixins.scss +46 -0
- package/src/components/Stepper/StepperHeader/index.ts +4 -0
- package/src/components/Stepper/index.ts +5 -0
- package/src/components/Switcher/Switcher.scss +71 -0
- package/src/components/Switcher/Switcher.stories.js +112 -0
- package/src/components/Switcher/Switcher.vue +94 -0
- package/src/components/Switcher/__tests__/Switcher.spec.js +26 -0
- package/src/components/Switcher/index.ts +4 -0
- package/src/components/TableContextMenu/TableContextMenu.scss +9 -0
- package/src/components/TableContextMenu/TableContextMenu.stories.js +92 -0
- package/src/components/TableContextMenu/TableContextMenu.vue +89 -0
- package/src/components/TableContextMenu/__tests__/TableContextMenu.spec.js +45 -0
- package/src/components/TableContextMenu/index.ts +3 -0
- package/src/components/Tabs/Tabs.scss +72 -0
- package/src/components/Tabs/Tabs.stories.js +68 -0
- package/src/components/Tabs/Tabs.vue +130 -0
- package/src/components/Tabs/__tests__/Tabs.spec.js +59 -0
- package/src/components/Tabs/index.ts +4 -0
- package/src/components/TextArea/TextArea.scss +75 -0
- package/src/components/TextArea/TextArea.stories.js +147 -0
- package/src/components/TextArea/TextArea.vue +224 -0
- package/src/components/TextArea/__tests__/TextArea.spec.js +48 -0
- package/src/components/TextArea/index.ts +4 -0
- package/src/components/TextFieldV2/TextFieldV2.scss +99 -0
- package/src/components/TextFieldV2/TextFieldV2.stories.js +260 -0
- package/src/components/TextFieldV2/TextFieldV2.vue +276 -0
- package/src/components/TextFieldV2/__tests__/TextFieldV2.spec.js +52 -0
- package/src/components/TextFieldV2/index.ts +4 -0
- package/src/components/Tooltip/Tooltip.scss +38 -0
- package/src/components/Tooltip/Tooltip.stories.js +100 -0
- package/src/components/Tooltip/Tooltip.vue +125 -0
- package/src/components/Tooltip/__tests__/Tooltip.spec.js +20 -0
- package/src/components/Tooltip/index.ts +5 -0
- package/src/components/Typography/BodyText/BodyText.scss +8 -0
- package/src/components/Typography/BodyText/BodyText.stories.js +58 -0
- package/src/components/Typography/BodyText/BodyText.vue +51 -0
- package/src/components/Typography/BodyText/__tests__/BodyText.spec.js +31 -0
- package/src/components/Typography/BodyText/configurations.ts +10 -0
- package/src/components/Typography/Caption/Caption.scss +8 -0
- package/src/components/Typography/Caption/Caption.stories.js +54 -0
- package/src/components/Typography/Caption/Caption.vue +51 -0
- package/src/components/Typography/Caption/__tests__/Caption.spec.js +31 -0
- package/src/components/Typography/Caption/configurations.ts +7 -0
- package/src/components/Typography/Heading/Heading.scss +20 -0
- package/src/components/Typography/Heading/Heading.stories.js +32 -0
- package/src/components/Typography/Heading/Heading.vue +50 -0
- package/src/components/Typography/Heading/__tests__/Heading.spec.js +38 -0
- package/src/components/Typography/Heading/configurations.ts +10 -0
- package/src/components/Typography/OverlayText/OverlayText.scss +3 -0
- package/src/components/Typography/OverlayText/OverlayText.stories.js +25 -0
- package/src/components/Typography/OverlayText/OverlayText.vue +22 -0
- package/src/components/Typography/OverlayText/__tests__/OverlayText.spec.js +20 -0
- package/src/components/Typography/Small/Small.scss +3 -0
- package/src/components/Typography/Small/Small.stories.js +34 -0
- package/src/components/Typography/Small/Small.vue +47 -0
- package/src/components/Typography/Small/__tests__/Small.spec.js +31 -0
- package/src/components/Typography/Small/configurations.ts +7 -0
- package/src/components/Typography/Subtitle/Subtitle.scss +8 -0
- package/src/components/Typography/Subtitle/Subtitle.stories.js +57 -0
- package/src/components/Typography/Subtitle/Subtitle.vue +52 -0
- package/src/components/Typography/Subtitle/__tests__/Subtitle.spec.js +31 -0
- package/src/components/Typography/Subtitle/configurations.ts +8 -0
- package/src/components/Typography/Typography.scss +87 -0
- package/src/components/Typography/Typography.stories.js +210 -0
- package/src/components/Typography/Typography.vue +132 -0
- package/src/components/Typography/__tests__/Typography.spec.js +60 -0
- package/src/components/Typography/index.ts +11 -0
- package/src/components/ValueCaption/ValueCaption.scss +19 -0
- package/src/components/ValueCaption/ValueCaption.stories.js +58 -0
- package/src/components/ValueCaption/ValueCaption.vue +63 -0
- package/src/components/ValueCaption/__tests__/ValueCaption.spec.js +14 -0
- package/src/components/ValueCaption/index.ts +4 -0
- package/src/components/layout/Basic.stories.js +113 -0
- package/src/components/layout/Box/Box.scss +15 -0
- package/src/components/layout/Box/Box.stories.js +41 -0
- package/src/components/layout/Box/Box.vue +37 -0
- package/src/components/layout/Box/__tests__/Box.spec.js +20 -0
- package/src/components/layout/Box/index.ts +4 -0
- package/src/components/layout/Col/Col.scss +110 -0
- package/src/components/layout/Col/Col.stories.js +174 -0
- package/src/components/layout/Col/Col.vue +141 -0
- package/src/components/layout/Col/__tests__/Col.spec.js +20 -0
- package/src/components/layout/Col/index.ts +4 -0
- package/src/components/layout/Container/Container.scss +35 -0
- package/src/components/layout/Container/Container.stories.js +23 -0
- package/src/components/layout/Container/Container.vue +18 -0
- package/src/components/layout/Container/index.ts +4 -0
- package/src/components/layout/ContainerFooter/Container.stories.js +29 -0
- package/src/components/layout/ContainerFooter/ContainerFooter.scss +13 -0
- package/src/components/layout/ContainerFooter/ContainerFooter.vue +27 -0
- package/src/components/layout/ContainerFooter/index.ts +4 -0
- package/src/components/layout/DisplayBreakpoints.stories.mdx +90 -0
- package/src/components/layout/GridSystem.stories.js +138 -0
- package/src/components/layout/Line/Line.scss +25 -0
- package/src/components/layout/Line/Line.stories.js +53 -0
- package/src/components/layout/Line/Line.vue +58 -0
- package/src/components/layout/Line/__tests__/Line.spec.js +22 -0
- package/src/components/layout/Line/index.ts +4 -0
- package/src/components/layout/PropsValues.stories.mdx +30 -0
- package/src/components/layout/Row/Row.scss +42 -0
- package/src/components/layout/Row/Row.stories.js +112 -0
- package/src/components/layout/Row/Row.vue +77 -0
- package/src/components/layout/Row/__tests__/Row.spec.js +20 -0
- package/src/components/layout/Row/index.ts +4 -0
- package/src/composition/__tests__/deepEqual.spec.js +13 -0
- package/src/composition/__tests__/validateFormFieldBuilder.spec.js +34 -0
- package/src/composition/__tests__/validateFormStateBuilder.spec.js +8 -0
- package/src/composition/deepEqual.ts +24 -0
- package/src/composition/validateFormFieldBuilder.ts +18 -0
- package/src/composition/validateFormMethodBuilder.ts +9 -0
- package/src/composition/validateFormStateBuilder.ts +13 -0
- package/src/configurations/_functions.scss +9 -0
- package/src/configurations/_mixins.scss +103 -0
- package/src/configurations/_theme-colors-background.scss +10 -0
- package/src/configurations/_theme-colors-base.module.scss +8 -0
- package/src/configurations/_theme-colors-bw.module.scss +10 -0
- package/src/configurations/_theme-colors-stroke.scss +10 -0
- package/src/configurations/_theme-colors-text.scss +10 -0
- package/src/configurations/_theme-colors-variations.scss +9 -0
- package/src/configurations/_theme-colors.scss +122 -0
- package/src/configurations/_variables.scss +36 -0
- package/src/configurations/colors.ts +12 -0
- package/src/configurations/flexVariables.ts +5 -0
- package/src/configurations/gutters.ts +1 -0
- package/src/configurations/sizes.ts +1 -0
- package/src/configurations/typographyHtmlTags.ts +16 -0
- package/src/examples/Colors.stories.js +122 -0
- package/src/examples/Colors.stories.scss +21 -0
- package/src/examples/Table.stories.js +200 -0
- package/src/examples/VuetifyDialog.stories.js +129 -0
- package/src/helpers/calculateMainZindex.js +12 -0
- package/src/helpers/date.ts +94 -0
- package/src/helpers/formatDatePickerHeader.ts +19 -0
- package/src/helpers/index.ts +4 -0
- package/src/helpers/isChildOfFixedElement.js +16 -0
- package/src/helpers/randomId.ts +9 -0
- package/src/main.ts +92 -0
- package/src/scss/Sticky-table.scss +112 -0
- package/src/scss/Table.scss +2 -0
- package/src/scss/VMenuOverrides.scss +17 -0
- package/src/scss/VuejsDialog.scss +93 -0
- package/src/scss/cssVariablesGenerator.scss +25 -0
- package/src/scss/utils.scss +51 -0
- package/src/shims-libs.d.ts +4 -0
- package/src/shims-tsx.d.ts +11 -0
- package/src/shims-vue.d.ts +4 -0
- package/src/stories/Introduction.stories.mdx +118 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/logo_farmtech.svg +21 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/vue-file-import.d.ts +4 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import IdCaption from '../IdCaption.vue';
|
|
3
|
+
|
|
4
|
+
describe('FilePicker component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
wrapper = shallowMount(IdCaption);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('Created hook', () => {
|
|
12
|
+
expect(wrapper).toBeDefined();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.farm-label {
|
|
2
|
+
font-weight: bold;
|
|
3
|
+
display: block;
|
|
4
|
+
font-size: 12px;
|
|
5
|
+
margin-bottom: 8px;
|
|
6
|
+
line-height: 24px;
|
|
7
|
+
color: var(--farm-bw-black-50);
|
|
8
|
+
font-weight: 600;
|
|
9
|
+
|
|
10
|
+
&.farm-label--required:not(:has(.farm-tooltip)) {
|
|
11
|
+
&::after {
|
|
12
|
+
content: '*';
|
|
13
|
+
margin-left: 2px;
|
|
14
|
+
color: var(--farm-error-base);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&:has(.farm-tooltip) {
|
|
19
|
+
:deep(.farm-tooltip::before) {
|
|
20
|
+
content: '*';
|
|
21
|
+
margin-left: 1px;
|
|
22
|
+
margin-right: 2px;
|
|
23
|
+
color: var(--farm-error-base);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:has(.farm-tooltip):not(.farm-label--required) {
|
|
28
|
+
:deep(.farm-tooltip::before) {
|
|
29
|
+
content: '';
|
|
30
|
+
margin-left: 2px;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// import { withDesign } from 'storybook-addon-designs';
|
|
2
|
+
import Label from './Label.vue';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Form/Label',
|
|
6
|
+
component: Label,
|
|
7
|
+
// decorators: [withDesign],
|
|
8
|
+
parameters: {
|
|
9
|
+
viewMode: 'docs',
|
|
10
|
+
design: {
|
|
11
|
+
type: 'figma',
|
|
12
|
+
url: 'https://www.figma.com/file/1f84J4m1IBghWhozQvdyyt/%E2%9C%85---Design-System-%7C-v1?node-id=1503%3A227',
|
|
13
|
+
},
|
|
14
|
+
docs: {
|
|
15
|
+
description: {
|
|
16
|
+
component: `Label<br />
|
|
17
|
+
selector: <em>farm-label</em><br />
|
|
18
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>`,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Primary = () => ({
|
|
25
|
+
template: '<farm-label>Label</farm-label>',
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const Required = () => ({
|
|
29
|
+
template: `<div>
|
|
30
|
+
<farm-label required>Label</farm-label>
|
|
31
|
+
</div>`,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const Tooltip = () => ({
|
|
35
|
+
template: `<div class="pt-9">
|
|
36
|
+
<farm-label>
|
|
37
|
+
Label with tooltip
|
|
38
|
+
<farm-tooltip>
|
|
39
|
+
this is the tooltip!
|
|
40
|
+
<template v-slot:activator="{ on, attrs }">
|
|
41
|
+
<farm-icon size="sm" color="gray">help-circle</farm-icon>
|
|
42
|
+
</template>
|
|
43
|
+
</farm-tooltip>
|
|
44
|
+
</farm-label>
|
|
45
|
+
</div>`,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const TooltipWithRequired = () => ({
|
|
49
|
+
template: `<div class="pt-9">
|
|
50
|
+
<farm-label required>
|
|
51
|
+
Label with tooltip
|
|
52
|
+
<farm-tooltip>
|
|
53
|
+
this is the tooltip!
|
|
54
|
+
<template v-slot:activator="{ on, attrs }">
|
|
55
|
+
<farm-icon size="sm" color="gray">help-circle</farm-icon>
|
|
56
|
+
</template>
|
|
57
|
+
</farm-tooltip>
|
|
58
|
+
</farm-label>
|
|
59
|
+
</div>`,
|
|
60
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label
|
|
3
|
+
:class="{ 'farm-label': true, 'farm-label--required': required }"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
>
|
|
6
|
+
<slot></slot>
|
|
7
|
+
</label>
|
|
8
|
+
</template>
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
name: 'farm-label',
|
|
14
|
+
props: {
|
|
15
|
+
/**
|
|
16
|
+
* Show required indicator
|
|
17
|
+
*/
|
|
18
|
+
required: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
</script>
|
|
25
|
+
<style lang="scss" scoped>
|
|
26
|
+
@import 'Label';
|
|
27
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import Label from '../Label';
|
|
3
|
+
|
|
4
|
+
describe('Label component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
wrapper = shallowMount(Label);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('Created hook', () => {
|
|
12
|
+
expect(wrapper).toBeDefined();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe('mount component', () => {
|
|
16
|
+
it('renders correctly', () => {
|
|
17
|
+
expect(wrapper.element).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// import { withDesign } from 'storybook-addon-designs';
|
|
2
|
+
import List from './List.vue';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Display/List/List',
|
|
6
|
+
component: List,
|
|
7
|
+
// decorators: [withDesign],
|
|
8
|
+
parameters: {
|
|
9
|
+
viewMode: 'docs',
|
|
10
|
+
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
component: `List<br />
|
|
14
|
+
selector: <em>farm-list</em><br />
|
|
15
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>`,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const Primary = () => ({
|
|
22
|
+
template: `<farm-list>
|
|
23
|
+
<farm-listitem clickable hoverColor="primary">primary</farm-listitem>
|
|
24
|
+
<farm-listitem clickable hoverColor="extra-1" hoverColorVariation="lighten">extra 1 lighten</farm-listitem>
|
|
25
|
+
<farm-listitem clickable hoverColor="error" hoverColorVariation="lighten">
|
|
26
|
+
<farm-icon size="sm" color="error">trash-can</farm-icon>
|
|
27
|
+
<farm-typography color="error" tag="span">Error</farm-typography>
|
|
28
|
+
</farm-listitem>
|
|
29
|
+
</farm-list>`,
|
|
30
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ul ref="contentRef" @focusin="onFocusin" @focusout="onFocusout" @focus="onFocus">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</ul>
|
|
5
|
+
</template>
|
|
6
|
+
<script lang="ts">
|
|
7
|
+
import { onMounted, onUnmounted, ref } from 'vue';
|
|
8
|
+
import { useFocus } from './composition';
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
name: 'farm-list',
|
|
12
|
+
setup(_, { emit }) {
|
|
13
|
+
const contentRef = ref<HTMLElement>();
|
|
14
|
+
const isFocused = ref(false);
|
|
15
|
+
const { focus } = useFocus(contentRef);
|
|
16
|
+
|
|
17
|
+
onMounted(() => {
|
|
18
|
+
contentRef.value.querySelectorAll('[tabindex]:not([tabindex="-1"]), li').forEach(tag =>
|
|
19
|
+
tag.addEventListener('keydown', (e: KeyboardEvent) => {
|
|
20
|
+
e.preventDefault();
|
|
21
|
+
if (isFocused.value) {
|
|
22
|
+
emit('keydown', e);
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
onUnmounted(() => {
|
|
29
|
+
if (contentRef.value) {
|
|
30
|
+
contentRef.value
|
|
31
|
+
.querySelectorAll('[tabindex]:not([tabindex="-1"]), li')
|
|
32
|
+
.forEach(tag =>
|
|
33
|
+
tag.removeEventListener('keydown', (e: KeyboardEvent) => {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
if (isFocused.value) {
|
|
36
|
+
emit('keydown', e);
|
|
37
|
+
}
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
function onFocusin() {
|
|
44
|
+
isFocused.value = true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function onFocusout() {
|
|
48
|
+
isFocused.value = false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function onFocus(e: FocusEvent) {
|
|
52
|
+
if (
|
|
53
|
+
!(
|
|
54
|
+
isFocused.value ||
|
|
55
|
+
(e.relatedTarget && contentRef.value.contains(e.relatedTarget as Node))
|
|
56
|
+
)
|
|
57
|
+
) {
|
|
58
|
+
focus();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
contentRef,
|
|
64
|
+
focus,
|
|
65
|
+
onFocus,
|
|
66
|
+
onFocusin,
|
|
67
|
+
onFocusout,
|
|
68
|
+
isFocused,
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
</script>
|
|
73
|
+
<style lang="scss" scoped>
|
|
74
|
+
@import './List';
|
|
75
|
+
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import List from '../List';
|
|
3
|
+
|
|
4
|
+
describe('List component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
let component;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
wrapper = shallowMount(List);
|
|
10
|
+
component = wrapper.vm;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test('Created hook', () => {
|
|
14
|
+
expect(wrapper).toBeDefined();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
describe('mount component', () => {
|
|
18
|
+
it('renders correctly', () => {
|
|
19
|
+
expect(wrapper.element).toMatchSnapshot();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
describe('Methods', () => {
|
|
23
|
+
it('should isFocused be true when call onFocusin', () => {
|
|
24
|
+
component.onFocusin();
|
|
25
|
+
expect(component.isFocused).toBeTruthy();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should isFocused be false when call onFocusout', () => {
|
|
29
|
+
component.onFocusout();
|
|
30
|
+
expect(component.isFocused).toBeFalsy();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
type UseFocusReturn = {
|
|
4
|
+
focus: (location?: 'next' | 'prev' | 'first' | 'last') => void;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export default function useFocus(contentRef: Ref<HTMLElement>): UseFocusReturn {
|
|
8
|
+
function focus(location?: 'next' | 'prev' | 'first' | 'last') {
|
|
9
|
+
if (!contentRef.value) return;
|
|
10
|
+
|
|
11
|
+
const focusable = [
|
|
12
|
+
...contentRef.value.querySelectorAll('[tabindex]:not([tabindex="-1"]), li'),
|
|
13
|
+
].filter(el => !el.hasAttribute('disabled')) as HTMLElement[];
|
|
14
|
+
|
|
15
|
+
const idx = focusable.indexOf(document.activeElement as HTMLElement);
|
|
16
|
+
|
|
17
|
+
if (!location) {
|
|
18
|
+
if (!contentRef.value.contains(document.activeElement)) {
|
|
19
|
+
focusable[0].focus();
|
|
20
|
+
}
|
|
21
|
+
} else if (location === 'first') {
|
|
22
|
+
const savedTabIndex = focusable[0].getAttribute('tabindex');
|
|
23
|
+
|
|
24
|
+
focusable[0].setAttribute('tabindex', '-1');
|
|
25
|
+
focusable[0].focus();
|
|
26
|
+
focusable[0].setAttribute('tabindex', savedTabIndex);
|
|
27
|
+
} else if (location === 'last') {
|
|
28
|
+
focusable[focusable.length - 1].focus();
|
|
29
|
+
} else {
|
|
30
|
+
let el;
|
|
31
|
+
let idxx = idx;
|
|
32
|
+
const inc = location === 'next' ? 1 : -1;
|
|
33
|
+
|
|
34
|
+
do {
|
|
35
|
+
idxx += inc;
|
|
36
|
+
el = focusable[idxx];
|
|
37
|
+
} while ((!el || el.offsetParent == null) && idxx < focusable.length && idxx >= 0);
|
|
38
|
+
if (el) {
|
|
39
|
+
el.focus();
|
|
40
|
+
} else {
|
|
41
|
+
focus(location === 'next' ? 'first' : 'last');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
focus,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@import '../../configurations/theme-colors';
|
|
2
|
+
|
|
3
|
+
.farm-listitem {
|
|
4
|
+
list-style-type: none;
|
|
5
|
+
transition: background-color 300ms linear;
|
|
6
|
+
padding: 8px;
|
|
7
|
+
height: 36px;
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
|
|
11
|
+
&--clickable {
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
> a {
|
|
16
|
+
text-decoration: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:hover,
|
|
20
|
+
&:focus {
|
|
21
|
+
border-radius: 5px;
|
|
22
|
+
|
|
23
|
+
@each $color in $theme-colors-list {
|
|
24
|
+
&#{'.farm-listitem--' + $color + '-base'} {
|
|
25
|
+
background-color: rgba(themeColor($color), 0.27);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&#{'.farm-listitem--' + $color + '-lighten'} {
|
|
29
|
+
background-color: rgba(themeColor($color, 'lighten'), 0.27);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&#{'.farm-listitem--' + $color + '-darken'} {
|
|
33
|
+
background-color: rgba(themeColor($color, 'darken'), 0.27);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// import { withDesign } from 'storybook-addon-designs';
|
|
2
|
+
import ListItem from './ListItem.vue';
|
|
3
|
+
|
|
4
|
+
import baseThemeColors from '../../configurations/_theme-colors-base.module.scss';
|
|
5
|
+
|
|
6
|
+
const colors = Object.keys(baseThemeColors);
|
|
7
|
+
const variations = ['base', 'darken', 'lighten'];
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
title: 'Display/List/ListItem',
|
|
11
|
+
component: ListItem,
|
|
12
|
+
// decorators: [withDesign],
|
|
13
|
+
parameters: {
|
|
14
|
+
viewMode: 'docs',
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: `ListItem<br />
|
|
18
|
+
selector: <em>farm-listitem</em><br />
|
|
19
|
+
<span style="color: var(--farm-primary-base);">ready for use</span>`,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const Primary = () => ({
|
|
26
|
+
template: `<farm-listitem>
|
|
27
|
+
Item
|
|
28
|
+
</farm-listitem>`,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const HoverColors = () => ({
|
|
32
|
+
data() {
|
|
33
|
+
return {
|
|
34
|
+
colors,
|
|
35
|
+
variations,
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
methods: {
|
|
39
|
+
getIconVariation(variation) {
|
|
40
|
+
if (variation === 'base' || variation === 'lighten') {
|
|
41
|
+
return 'darken';
|
|
42
|
+
}
|
|
43
|
+
return 'base';
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
template: `<farm-row>
|
|
47
|
+
<farm-col v-for="color in colors" :key="color" cols="12" md="4" class="mb-4">
|
|
48
|
+
<h4>{{ color }}</h4>
|
|
49
|
+
<farm-listitem
|
|
50
|
+
v-for="variation in variations"
|
|
51
|
+
:key="color + '_' + variation"
|
|
52
|
+
:hoverColor="color"
|
|
53
|
+
:hoverColorVariation="variation"
|
|
54
|
+
>
|
|
55
|
+
<farm-icon
|
|
56
|
+
:color="color"
|
|
57
|
+
:variation="getIconVariation(variation)"
|
|
58
|
+
>
|
|
59
|
+
book
|
|
60
|
+
</farm-icon>
|
|
61
|
+
{{ color }} {{ variation }}
|
|
62
|
+
</farm-listitem>
|
|
63
|
+
</farm-col>
|
|
64
|
+
</farm-row>`,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export const Clickable = () => ({
|
|
68
|
+
methods: {
|
|
69
|
+
onClick() {
|
|
70
|
+
alert('Clicked');
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
template: `<farm-listitem
|
|
74
|
+
clickable
|
|
75
|
+
hoverColor="error"
|
|
76
|
+
hoverColorVariation="lighten"
|
|
77
|
+
@click="onClick"
|
|
78
|
+
>
|
|
79
|
+
try me
|
|
80
|
+
</farm-listitem>`,
|
|
81
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li @click="onClick" :class="{
|
|
3
|
+
'farm-listitem': true,
|
|
4
|
+
[cssColorWithVariation]: cssColorWithVariation,
|
|
5
|
+
'farm-listitem--clickable': clickable || to,
|
|
6
|
+
}">
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</li>
|
|
9
|
+
</template>
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { computed, PropType, toRefs } from 'vue';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
name: 'farm-listitem',
|
|
15
|
+
props: {
|
|
16
|
+
to: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: null,
|
|
19
|
+
},
|
|
20
|
+
/**
|
|
21
|
+
* Color on hover
|
|
22
|
+
*/
|
|
23
|
+
hoverColor: {
|
|
24
|
+
type: [String, null] as PropType<
|
|
25
|
+
| 'primary'
|
|
26
|
+
| 'secondary'
|
|
27
|
+
| 'secondary-green'
|
|
28
|
+
| 'secondary-golden'
|
|
29
|
+
| 'neutral'
|
|
30
|
+
| 'error'
|
|
31
|
+
| 'warning'
|
|
32
|
+
| 'info'
|
|
33
|
+
| 'extra-1'
|
|
34
|
+
| 'extra-2'
|
|
35
|
+
>,
|
|
36
|
+
default: null,
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Color variation on hover
|
|
40
|
+
*/
|
|
41
|
+
hoverColorVariation: {
|
|
42
|
+
type: [String, null] as PropType<'base' | 'lighten' | 'darken'>,
|
|
43
|
+
default: 'base',
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* Is clickable
|
|
47
|
+
*/
|
|
48
|
+
clickable: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
setup(props, { emit }) {
|
|
54
|
+
const { hoverColor, hoverColorVariation } = toRefs(props);
|
|
55
|
+
|
|
56
|
+
const cssColorWithVariation = computed((): String => {
|
|
57
|
+
if (!hoverColor.value) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return `farm-listitem--${hoverColor.value}-${hoverColorVariation.value}`;
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const onClick = () => {
|
|
64
|
+
emit('click:item');
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
cssColorWithVariation,
|
|
69
|
+
onClick,
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
</script>
|
|
74
|
+
<style lang="scss" scoped>
|
|
75
|
+
@import './ListItem';
|
|
76
|
+
</style>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li
|
|
3
|
+
@click="onClick"
|
|
4
|
+
:class="{
|
|
5
|
+
'farm-listitem': true,
|
|
6
|
+
[cssColorWithVariation]: cssColorWithVariation,
|
|
7
|
+
'farm-listitem--clickable': clickable || to,
|
|
8
|
+
}"
|
|
9
|
+
>
|
|
10
|
+
<router-link :to="to" v-if="to">
|
|
11
|
+
<slot></slot>
|
|
12
|
+
</router-link>
|
|
13
|
+
<template v-else>
|
|
14
|
+
<slot></slot>
|
|
15
|
+
</template>
|
|
16
|
+
</li>
|
|
17
|
+
</template>
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
import { computed, PropType, toRefs } from 'vue';
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
name: 'farm-listitem',
|
|
23
|
+
props: {
|
|
24
|
+
to: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: null,
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Color on hover
|
|
30
|
+
*/
|
|
31
|
+
hoverColor: {
|
|
32
|
+
type: [String, null] as PropType<
|
|
33
|
+
| 'primary'
|
|
34
|
+
| 'secondary'
|
|
35
|
+
| 'secondary-green'
|
|
36
|
+
| 'secondary-golden'
|
|
37
|
+
| 'neutral'
|
|
38
|
+
| 'error'
|
|
39
|
+
| 'warning'
|
|
40
|
+
| 'info'
|
|
41
|
+
| 'extra-1'
|
|
42
|
+
| 'extra-2'
|
|
43
|
+
>,
|
|
44
|
+
default: null,
|
|
45
|
+
},
|
|
46
|
+
/**
|
|
47
|
+
* Color variation on hover
|
|
48
|
+
*/
|
|
49
|
+
hoverColorVariation: {
|
|
50
|
+
type: [String, null] as PropType<'base' | 'lighten' | 'darken'>,
|
|
51
|
+
default: 'base',
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* Is clickable
|
|
55
|
+
*/
|
|
56
|
+
clickable: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: false,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
setup(props, { emit }) {
|
|
62
|
+
const { hoverColor, hoverColorVariation } = toRefs(props);
|
|
63
|
+
|
|
64
|
+
const cssColorWithVariation = computed((): String => {
|
|
65
|
+
if (!hoverColor.value) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return `farm-listitem--${hoverColor.value}-${hoverColorVariation.value}`;
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const onClick = () => {
|
|
72
|
+
emit('click');
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
cssColorWithVariation,
|
|
77
|
+
onClick,
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
</script>
|
|
82
|
+
<style lang="scss" scoped>
|
|
83
|
+
@import './ListItem';
|
|
84
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import ListItem from '../ListItem';
|
|
3
|
+
|
|
4
|
+
describe('ListItem component', () => {
|
|
5
|
+
let wrapper;
|
|
6
|
+
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
wrapper = shallowMount(ListItem);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
test('Created hook', () => {
|
|
12
|
+
expect(wrapper).toBeDefined();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe('mount component', () => {
|
|
16
|
+
it('renders correctly', () => {
|
|
17
|
+
expect(wrapper.element).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|