@homefile/components-v2 2.18.0 → 2.19.0
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/dist/assets/images/filter-size.png +0 -0
- package/dist/assets/images/index.d.ts +2 -1
- package/dist/assets/images/index.js +2 -1
- package/dist/assets/images/index.ts +2 -0
- package/dist/components/homeAssistant/monitorAlerts/alertDetails/AlertFields.d.ts +1 -1
- package/dist/components/homeAssistant/monitorAlerts/alertDetails/AlertFields.js +9 -3
- package/dist/components/homeAssistant/monitorAlerts/alertDetails/FilterSize.d.ts +2 -0
- package/dist/components/homeAssistant/monitorAlerts/alertDetails/FilterSize.js +6 -0
- package/dist/components/homeAssistant/monitorAlerts/alertDetails/SearchField.d.ts +2 -0
- package/dist/components/homeAssistant/monitorAlerts/alertDetails/SearchField.js +27 -0
- package/dist/components/homeAssistant/monitorAlerts/alertDetails/index.d.ts +2 -0
- package/dist/components/homeAssistant/monitorAlerts/alertDetails/index.js +2 -0
- package/dist/helpers/forms/dynamicForm.helper.js +3 -2
- package/dist/interfaces/forms/dynamicForm/DynamicForm.interface.d.ts +1 -1
- package/dist/interfaces/homeAssistant/BackendAlert.interface.d.ts +1 -1
- package/dist/interfaces/inputs/SearchInput.interface.d.ts +2 -2
- package/dist/mocks/forms/dynamicForm.mock.js +34 -1
- package/package.json +1 -1
- package/src/assets/images/filter-size.png +0 -0
- package/src/assets/images/index.ts +2 -0
- package/src/components/forms/dynamicForm/fields/TextField.tsx +1 -1
- package/src/components/homeAssistant/monitorAlerts/alertDetails/AlertFields.tsx +10 -4
- package/src/components/homeAssistant/monitorAlerts/alertDetails/FilterSize.tsx +19 -0
- package/src/components/homeAssistant/monitorAlerts/alertDetails/SearchField.tsx +36 -0
- package/src/components/homeAssistant/monitorAlerts/alertDetails/index.ts +2 -0
- package/src/helpers/forms/dynamicForm.helper.ts +4 -2
- package/src/interfaces/forms/dynamicForm/DynamicForm.interface.ts +1 -0
- package/src/interfaces/homeAssistant/BackendAlert.interface.ts +1 -1
- package/src/interfaces/inputs/SearchInput.interface.ts +3 -3
- package/src/mocks/forms/dynamicForm.mock.ts +37 -1
|
Binary file
|
|
@@ -53,6 +53,7 @@ import Exclamation from './exclamation.svg';
|
|
|
53
53
|
import Face from './face.svg';
|
|
54
54
|
import Feedback from './feedback.svg';
|
|
55
55
|
import FileUploading from './file-uploading.svg';
|
|
56
|
+
import FilterSize from './filter-size.png';
|
|
56
57
|
import Finance from './finance.svg';
|
|
57
58
|
import Fire from './fire.svg';
|
|
58
59
|
import Flag from './flag.png';
|
|
@@ -161,7 +162,7 @@ import WizardDetailed from './wizard-detailed.svg';
|
|
|
161
162
|
import WizardQuick from './wizard-quick.svg';
|
|
162
163
|
import YellowFolder from './yellow-folder.svg';
|
|
163
164
|
import YellowFolderUnshared from './yellow-folder-unshared.svg';
|
|
164
|
-
export { AlertDelete, AlertDeletePurple, Arrow, Batery, Bathroom, Battery, Battery2, Bedroom, BgBlue, BgLogo, Billing, BillingAddress, BlueFolder, BlueFolderShared, BookOpened, Box, Building, Calc, Calendar2, Catalog, ChatBubble, Check, CheckInCircle, CheckPen, Chemistry, CircleFace, Cleaning, Closet, Clouds, Co2, Company, Company2, ComputerReport, Confirmation, Construction, Contacts, Contacts2, Contributor, Create, CreditCard, Detector, Diamond, DiningRoom, DocIcon, Document, Document2, Drop, DropCalendar, Electricity, Entryway, EstValue, Exclamation, Face, Feedback, FileUploading, Finance, Fire, Flag, FormSent, Foundation, Garage, GearPencil, GearTime, GenericField, GlassWater, GreenFolder, Group, Groups, GuestBedroom, Hallway, HandPencil, Heater, Help, HomeAddress, Homeowner, House, HouseHands, IA, ImageDefault, ImgIcon, Inbox, Insect, Kitchen, Laundry, Light, LivingRoom, Loading, Location, LogoCompany, LogoSmall, MagnifyingGlassReport, Manager, MasterBedroom, Member, Message, MobileDrop, Money, Mudroom, NeedHelp, Office, Painting, PartnerGeneric, Patio, PdfIcon, PersonMail, Plate, Play, Plus, Pool, Pool2, PressureWasher, Price, Profile, ProgressReport, Proposal, RealEstate, Receipt, ReceiptBg, ReceiptHouse, Receipts, Recipient, Records, Register, RelationshipHome, ResendPassword, Rocket, Roof2, Security, Send, ShareHome, ShareWith, SixtyEight, SMS, Social, SolarPanel, Speaker, Sprinkler, Structure, Subscription, Target, Temperature, Theatre, Thumbnail, ThumbnailSmall, ThumbUp, Trash, Trees, TreesCrop, TreesCrop2, VideoIcon, VideoPlay, VioletFolder, Warning, Warranty, WellDone, WholeHome, Wind, WindWhite, Wizard, WizardDetailed, WizardQuick, YellowFolder, YellowFolderUnshared, };
|
|
165
|
+
export { AlertDelete, AlertDeletePurple, Arrow, Batery, Bathroom, Battery, Battery2, Bedroom, BgBlue, BgLogo, Billing, BillingAddress, BlueFolder, BlueFolderShared, BookOpened, Box, Building, Calc, Calendar2, Catalog, ChatBubble, Check, CheckInCircle, CheckPen, Chemistry, CircleFace, Cleaning, Closet, Clouds, Co2, Company, Company2, ComputerReport, Confirmation, Construction, Contacts, Contacts2, Contributor, Create, CreditCard, Detector, Diamond, DiningRoom, DocIcon, Document, Document2, Drop, DropCalendar, Electricity, Entryway, EstValue, Exclamation, Face, Feedback, FileUploading, FilterSize, Finance, Fire, Flag, FormSent, Foundation, Garage, GearPencil, GearTime, GenericField, GlassWater, GreenFolder, Group, Groups, GuestBedroom, Hallway, HandPencil, Heater, Help, HomeAddress, Homeowner, House, HouseHands, IA, ImageDefault, ImgIcon, Inbox, Insect, Kitchen, Laundry, Light, LivingRoom, Loading, Location, LogoCompany, LogoSmall, MagnifyingGlassReport, Manager, MasterBedroom, Member, Message, MobileDrop, Money, Mudroom, NeedHelp, Office, Painting, PartnerGeneric, Patio, PdfIcon, PersonMail, Plate, Play, Plus, Pool, Pool2, PressureWasher, Price, Profile, ProgressReport, Proposal, RealEstate, Receipt, ReceiptBg, ReceiptHouse, Receipts, Recipient, Records, Register, RelationshipHome, ResendPassword, Rocket, Roof2, Security, Send, ShareHome, ShareWith, SixtyEight, SMS, Social, SolarPanel, Speaker, Sprinkler, Structure, Subscription, Target, Temperature, Theatre, Thumbnail, ThumbnailSmall, ThumbUp, Trash, Trees, TreesCrop, TreesCrop2, VideoIcon, VideoPlay, VioletFolder, Warning, Warranty, WellDone, WholeHome, Wind, WindWhite, Wizard, WizardDetailed, WizardQuick, YellowFolder, YellowFolderUnshared, };
|
|
165
166
|
export * from './alerts';
|
|
166
167
|
export * from './animations';
|
|
167
168
|
export * from './appliances';
|
|
@@ -53,6 +53,7 @@ import Exclamation from './exclamation.svg';
|
|
|
53
53
|
import Face from './face.svg';
|
|
54
54
|
import Feedback from './feedback.svg';
|
|
55
55
|
import FileUploading from './file-uploading.svg';
|
|
56
|
+
import FilterSize from './filter-size.png';
|
|
56
57
|
import Finance from './finance.svg';
|
|
57
58
|
import Fire from './fire.svg';
|
|
58
59
|
import Flag from './flag.png';
|
|
@@ -161,7 +162,7 @@ import WizardDetailed from './wizard-detailed.svg';
|
|
|
161
162
|
import WizardQuick from './wizard-quick.svg';
|
|
162
163
|
import YellowFolder from './yellow-folder.svg';
|
|
163
164
|
import YellowFolderUnshared from './yellow-folder-unshared.svg';
|
|
164
|
-
export { AlertDelete, AlertDeletePurple, Arrow, Batery, Bathroom, Battery, Battery2, Bedroom, BgBlue, BgLogo, Billing, BillingAddress, BlueFolder, BlueFolderShared, BookOpened, Box, Building, Calc, Calendar2, Catalog, ChatBubble, Check, CheckInCircle, CheckPen, Chemistry, CircleFace, Cleaning, Closet, Clouds, Co2, Company, Company2, ComputerReport, Confirmation, Construction, Contacts, Contacts2, Contributor, Create, CreditCard, Detector, Diamond, DiningRoom, DocIcon, Document, Document2, Drop, DropCalendar, Electricity, Entryway, EstValue, Exclamation, Face, Feedback, FileUploading, Finance, Fire, Flag, FormSent, Foundation, Garage, GearPencil, GearTime, GenericField, GlassWater, GreenFolder, Group, Groups, GuestBedroom, Hallway, HandPencil, Heater, Help, HomeAddress, Homeowner, House, HouseHands, IA, ImageDefault, ImgIcon, Inbox, Insect, Kitchen, Laundry, Light, LivingRoom, Loading, Location, LogoCompany, LogoSmall, MagnifyingGlassReport, Manager, MasterBedroom, Member, Message, MobileDrop, Money, Mudroom, NeedHelp, Office, Painting, PartnerGeneric, Patio, PdfIcon, PersonMail, Plate, Play, Plus, Pool, Pool2, PressureWasher, Price, Profile, ProgressReport, Proposal, RealEstate, Receipt, ReceiptBg, ReceiptHouse, Receipts, Recipient, Records, Register, RelationshipHome, ResendPassword, Rocket, Roof2, Security, Send, ShareHome, ShareWith, SixtyEight, SMS, Social, SolarPanel, Speaker, Sprinkler, Structure, Subscription, Target, Temperature, Theatre, Thumbnail, ThumbnailSmall, ThumbUp, Trash, Trees, TreesCrop, TreesCrop2, VideoIcon, VideoPlay, VioletFolder, Warning, Warranty, WellDone, WholeHome, Wind, WindWhite, Wizard, WizardDetailed, WizardQuick, YellowFolder, YellowFolderUnshared, };
|
|
165
|
+
export { AlertDelete, AlertDeletePurple, Arrow, Batery, Bathroom, Battery, Battery2, Bedroom, BgBlue, BgLogo, Billing, BillingAddress, BlueFolder, BlueFolderShared, BookOpened, Box, Building, Calc, Calendar2, Catalog, ChatBubble, Check, CheckInCircle, CheckPen, Chemistry, CircleFace, Cleaning, Closet, Clouds, Co2, Company, Company2, ComputerReport, Confirmation, Construction, Contacts, Contacts2, Contributor, Create, CreditCard, Detector, Diamond, DiningRoom, DocIcon, Document, Document2, Drop, DropCalendar, Electricity, Entryway, EstValue, Exclamation, Face, Feedback, FileUploading, FilterSize, Finance, Fire, Flag, FormSent, Foundation, Garage, GearPencil, GearTime, GenericField, GlassWater, GreenFolder, Group, Groups, GuestBedroom, Hallway, HandPencil, Heater, Help, HomeAddress, Homeowner, House, HouseHands, IA, ImageDefault, ImgIcon, Inbox, Insect, Kitchen, Laundry, Light, LivingRoom, Loading, Location, LogoCompany, LogoSmall, MagnifyingGlassReport, Manager, MasterBedroom, Member, Message, MobileDrop, Money, Mudroom, NeedHelp, Office, Painting, PartnerGeneric, Patio, PdfIcon, PersonMail, Plate, Play, Plus, Pool, Pool2, PressureWasher, Price, Profile, ProgressReport, Proposal, RealEstate, Receipt, ReceiptBg, ReceiptHouse, Receipts, Recipient, Records, Register, RelationshipHome, ResendPassword, Rocket, Roof2, Security, Send, ShareHome, ShareWith, SixtyEight, SMS, Social, SolarPanel, Speaker, Sprinkler, Structure, Subscription, Target, Temperature, Theatre, Thumbnail, ThumbnailSmall, ThumbUp, Trash, Trees, TreesCrop, TreesCrop2, VideoIcon, VideoPlay, VioletFolder, Warning, Warranty, WellDone, WholeHome, Wind, WindWhite, Wizard, WizardDetailed, WizardQuick, YellowFolder, YellowFolderUnshared, };
|
|
165
166
|
export * from './alerts';
|
|
166
167
|
export * from './animations';
|
|
167
168
|
export * from './appliances';
|
|
@@ -53,6 +53,7 @@ import Exclamation from './exclamation.svg'
|
|
|
53
53
|
import Face from './face.svg'
|
|
54
54
|
import Feedback from './feedback.svg'
|
|
55
55
|
import FileUploading from './file-uploading.svg'
|
|
56
|
+
import FilterSize from './filter-size.png'
|
|
56
57
|
import Finance from './finance.svg'
|
|
57
58
|
import Fire from './fire.svg'
|
|
58
59
|
import Flag from './flag.png'
|
|
@@ -218,6 +219,7 @@ export {
|
|
|
218
219
|
Face,
|
|
219
220
|
Feedback,
|
|
220
221
|
FileUploading,
|
|
222
|
+
FilterSize,
|
|
221
223
|
Finance,
|
|
222
224
|
Fire,
|
|
223
225
|
Flag,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { FieldTypesI } from '../../../../interfaces';
|
|
2
|
-
export declare const AlertFields: ({ fields }: FieldTypesI) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const AlertFields: ({ fields, callback }: FieldTypesI) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { createElement as _createElement } from "react";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Stack, Text } from '@chakra-ui/react';
|
|
4
|
-
import { VideoDetail } from '
|
|
5
|
-
|
|
4
|
+
import { FilterSize, SearchField, VideoDetail } from '../../..';
|
|
5
|
+
import { fieldIcons } from '../../../../helpers';
|
|
6
|
+
export const AlertFields = ({ fields, callback }) => {
|
|
6
7
|
return (_jsx(Stack, { spacing: "base", p: "base", children: fields === null || fields === void 0 ? void 0 : fields.map((field) => {
|
|
7
|
-
const { id, type, value } = field;
|
|
8
|
+
const { id, type, value, icon } = field;
|
|
9
|
+
const mappedIcon = icon && fieldIcons[icon];
|
|
8
10
|
switch (type) {
|
|
9
11
|
case 'text':
|
|
10
12
|
return (_jsx(Text, { fontSize: "sm", fontFamily: "secondary", lineHeight: "1.2", whiteSpace: "pre-line", children: String(value) }, id));
|
|
11
13
|
case 'video':
|
|
12
14
|
return _createElement(VideoDetail, Object.assign({}, field, { key: id }));
|
|
15
|
+
case 'filter-size':
|
|
16
|
+
return _createElement(FilterSize, Object.assign({}, field, { key: id, icon: mappedIcon }));
|
|
17
|
+
case 'search':
|
|
18
|
+
return _createElement(SearchField, Object.assign({}, field, { key: id, callback: callback }));
|
|
13
19
|
default:
|
|
14
20
|
return null;
|
|
15
21
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Flex, Image, Stack, Text } from '@chakra-ui/react';
|
|
3
|
+
import { CustomDivider } from '../../..';
|
|
4
|
+
export const FilterSize = ({ name, icon, value }) => {
|
|
5
|
+
return (_jsxs(Stack, { spacing: "base", children: [_jsx(CustomDivider, {}), _jsx(Text, { fontWeight: "semibold", children: name }), _jsxs(Flex, { gap: "base", children: [_jsx(Image, { boxSize: "86px", src: icon }), _jsx(Text, { fontSize: "sm", fontFamily: "secondary", lineHeight: "1.2", children: value })] }), _jsx(CustomDivider, {})] }));
|
|
6
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Stack, Text } from '@chakra-ui/react';
|
|
14
|
+
import { SearchInput } from '../../..';
|
|
15
|
+
import { useState } from 'react';
|
|
16
|
+
export const SearchField = (_a) => {
|
|
17
|
+
var { callback, description } = _a, props = __rest(_a, ["callback", "description"]);
|
|
18
|
+
const [search, setSearch] = useState('');
|
|
19
|
+
const handleSearch = (value) => {
|
|
20
|
+
callback === null || callback === void 0 ? void 0 : callback(Object.assign(Object.assign({}, props), { value }));
|
|
21
|
+
};
|
|
22
|
+
return (_jsxs(Stack, { spacing: "base", children: [_jsx(Text, { fontSize: "sm", fontFamily: "secondary", lineHeight: "1.2", children: description }), _jsx(SearchInput, { onChange: (e) => setSearch(e.target.value), value: search, maxW: "full", onBlur: () => handleSearch(search), onKeyDown: (e) => {
|
|
23
|
+
if (e.key === 'Enter') {
|
|
24
|
+
handleSearch(search);
|
|
25
|
+
}
|
|
26
|
+
} })] }));
|
|
27
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './AlertFields';
|
|
2
2
|
export * from './ChangeAirFilter';
|
|
3
3
|
export * from './CustomDivider';
|
|
4
|
+
export * from './FilterSize';
|
|
5
|
+
export * from './SearchField';
|
|
4
6
|
export * from './SmokeDetectorBattery';
|
|
5
7
|
export * from './SmokeDetectorExpired';
|
|
6
8
|
export * from './VideoDetail';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './AlertFields';
|
|
2
2
|
export * from './ChangeAirFilter';
|
|
3
3
|
export * from './CustomDivider';
|
|
4
|
+
export * from './FilterSize';
|
|
5
|
+
export * from './SearchField';
|
|
4
6
|
export * from './SmokeDetectorBattery';
|
|
5
7
|
export * from './SmokeDetectorExpired';
|
|
6
8
|
export * from './VideoDetail';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Paint, Receipt, Barcode, GoldenBars, Heart, Rating, Notes, Book, ImgIcon, Registry, ShareWith, Calendar, Contacts, Tools2, Billing, Calc, CheckPen, GenericField, Price, Battery2, Co2, Detector, Electricity, Sprinkler, SixtyEight, DropCalendar, MobileDrop, SolarPanel, Calendar2, Drop, Wind, Foundation, Heater, Light, Plate, Pool2, Closet, Structure, GlassWater, Roof2, Target, CircleFace, Pressure, WindowCleaning, RoofCleaning, HolidayLights, GutterCleaning, HomeCleaning, HouseWashing, PressureWasher, BookOpened, Company2, AADisease, AADressing, AALawn, AAMowing, AAWeed, AApest } from '../../assets/images';
|
|
1
|
+
import { Paint, Receipt, Barcode, GoldenBars, Heart, Rating, Notes, Book, ImgIcon, Registry, ShareWith, Calendar, Contacts, Tools2, Billing, Calc, CheckPen, GenericField, Price, Battery2, Co2, Detector, Electricity, Sprinkler, SixtyEight, DropCalendar, MobileDrop, SolarPanel, Calendar2, Drop, Wind, Foundation, Heater, Light, Plate, Pool2, Closet, Structure, GlassWater, Roof2, Target, CircleFace, Pressure, WindowCleaning, RoofCleaning, HolidayLights, GutterCleaning, HomeCleaning, HouseWashing, PressureWasher, BookOpened, Company2, AADisease, AADressing, AALawn, AAMowing, AAWeed, AApest, FilterSize, } from '../../assets/images';
|
|
2
2
|
export const fieldIcons = {
|
|
3
3
|
barcode: Barcode,
|
|
4
4
|
billing: Billing,
|
|
@@ -58,5 +58,6 @@ export const fieldIcons = {
|
|
|
58
58
|
'aa-disease': AADisease,
|
|
59
59
|
'aa-weed': AAWeed,
|
|
60
60
|
'aa-dressing': AADressing,
|
|
61
|
-
'aa-pest': AApest
|
|
61
|
+
'aa-pest': AApest,
|
|
62
|
+
'filter-size': FilterSize,
|
|
62
63
|
};
|
|
@@ -3,7 +3,7 @@ export type KindTypes = 'ai-image' | 'ai-grid' | 'checkbox' | 'checkbox-agreemen
|
|
|
3
3
|
export type UIKindTypes = 'tile-body' | 'tile-body-logo' | 'tile-body-header' | 'tile-body-section' | 'tile-body-section-grid' | 'tile-body-partner-image' | 'tile-body-description' | 'tile-form' | 'tile-body-action' | 'vertical-icon' | 'primary-cta' | 'secondary-cta';
|
|
4
4
|
export type HomeItemTypes = 'appliances' | 'images' | 'guidelines' | 'item-related' | 'item-icon-btn';
|
|
5
5
|
export type IconTypes = 'barcode' | 'battery' | 'billing' | 'book' | 'book-opened' | 'calc' | 'calendar' | 'check' | 'co2' | 'contact' | 'date' | 'default' | 'detector' | 'electricity' | 'goldbars' | 'heart' | 'image' | 'notes' | 'palette' | 'people' | 'price' | 'rating' | 'receipt' | 'registry' | 'sprinkler' | 'tools' | 'wind' | '68' | 'calendar2' | 'water' | 'calendar-drop' | 'umbrella' | 'heater' | 'roof' | 'foundation' | 'solar-panel' | 'pool' | 'drop' | 'mobile-drop' | 'light' | 'plate' | 'pressure-washer' | 'house' | 'target' | 'title' | 'company' | UIIconTypes;
|
|
6
|
-
export type UIIconTypes = 'sh-pressure' | 'sh-window' | 'sh-roof' | 'sh-lights' | 'sh-gutter' | 'sh-home' | 'sh-house' | 'aa-mowing' | 'aa-fertilization' | 'aa-disease' | 'aa-weed' | 'aa-dressing' | 'aa-pest';
|
|
6
|
+
export type UIIconTypes = 'sh-pressure' | 'sh-window' | 'sh-roof' | 'sh-lights' | 'sh-gutter' | 'sh-home' | 'sh-house' | 'aa-mowing' | 'aa-fertilization' | 'aa-disease' | 'aa-weed' | 'aa-dressing' | 'aa-pest' | 'filter-size';
|
|
7
7
|
export type ValueTypes = string | string[] | number | boolean;
|
|
8
8
|
export type OptionsTypes = string[] | number[] | null;
|
|
9
9
|
export interface ReportI {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DynamicFormI } from '..';
|
|
2
2
|
export type AlertCategory = 'safeguard' | 'maintain' | 'budget' | 'improve';
|
|
3
3
|
export type AlertTabType = 'details' | 'filter-size' | 'purchase' | 'hire-out';
|
|
4
|
-
export type AlertFieldType = 'alert' | '
|
|
4
|
+
export type AlertFieldType = 'alert' | 'search';
|
|
5
5
|
export interface BackendAlertI extends DynamicFormI {
|
|
6
6
|
category: AlertCategory;
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface SearchInputI extends
|
|
1
|
+
import { InputProps } from '@chakra-ui/react';
|
|
2
|
+
export interface SearchInputI extends InputProps {
|
|
3
3
|
maxW?: string;
|
|
4
4
|
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
5
5
|
placeholder?: string;
|
|
@@ -852,7 +852,7 @@ export const alertFieldsMock = [
|
|
|
852
852
|
{
|
|
853
853
|
id: faker.database.mongodbObjectId(),
|
|
854
854
|
name: 'Details',
|
|
855
|
-
label: '
|
|
855
|
+
label: '',
|
|
856
856
|
description: faker.lorem.sentence(),
|
|
857
857
|
comments: faker.lorem.sentence(),
|
|
858
858
|
value: '',
|
|
@@ -891,6 +891,39 @@ export const alertFieldsMock = [
|
|
|
891
891
|
value: faker.image.urlPicsumPhotos(),
|
|
892
892
|
type: 'filter-size',
|
|
893
893
|
visible: true,
|
|
894
|
+
children: [
|
|
895
|
+
{
|
|
896
|
+
id: faker.database.mongodbObjectId(),
|
|
897
|
+
name: '',
|
|
898
|
+
label: '',
|
|
899
|
+
description: '',
|
|
900
|
+
comments: '',
|
|
901
|
+
value: 'Home air filters are typically located in the HVAC system’s return air vent, furnace compartment, or air handler, usually near the blower unit or ductwork intake.',
|
|
902
|
+
type: 'text',
|
|
903
|
+
visible: true,
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
id: faker.database.mongodbObjectId(),
|
|
907
|
+
name: 'Check the filter:',
|
|
908
|
+
label: '',
|
|
909
|
+
description: '',
|
|
910
|
+
comments: '',
|
|
911
|
+
icon: 'filter-size',
|
|
912
|
+
value: 'The size of the filter is usually printed on the side of the filter in inches. The size may be written as length x width x depth. For example, a filter that is 16 in long, 20 in wide, and 1 in deep would be written as 16 x 20 x 1. ',
|
|
913
|
+
type: 'filter-size',
|
|
914
|
+
visible: true,
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
id: faker.database.mongodbObjectId(),
|
|
918
|
+
name: '',
|
|
919
|
+
label: '',
|
|
920
|
+
description: 'or enter your air conditioning/furnace model number below.',
|
|
921
|
+
comments: '',
|
|
922
|
+
value: '',
|
|
923
|
+
type: 'search',
|
|
924
|
+
visible: true,
|
|
925
|
+
},
|
|
926
|
+
],
|
|
894
927
|
},
|
|
895
928
|
],
|
|
896
929
|
},
|
package/package.json
CHANGED
|
Binary file
|
|
@@ -53,6 +53,7 @@ import Exclamation from './exclamation.svg'
|
|
|
53
53
|
import Face from './face.svg'
|
|
54
54
|
import Feedback from './feedback.svg'
|
|
55
55
|
import FileUploading from './file-uploading.svg'
|
|
56
|
+
import FilterSize from './filter-size.png'
|
|
56
57
|
import Finance from './finance.svg'
|
|
57
58
|
import Fire from './fire.svg'
|
|
58
59
|
import Flag from './flag.png'
|
|
@@ -218,6 +219,7 @@ export {
|
|
|
218
219
|
Face,
|
|
219
220
|
Feedback,
|
|
220
221
|
FileUploading,
|
|
222
|
+
FilterSize,
|
|
221
223
|
Finance,
|
|
222
224
|
Fire,
|
|
223
225
|
Flag,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Controller, useFormContext } from 'react-hook-form'
|
|
2
2
|
import { Flex } from '@chakra-ui/react'
|
|
3
|
-
import {
|
|
3
|
+
import { TextInput } from '@/components'
|
|
4
4
|
import { TextFieldI } from '@/interfaces'
|
|
5
5
|
|
|
6
6
|
export const TextField = ({
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { FieldTypesI } from '@/interfaces'
|
|
1
|
+
import { FieldTypesI, IconTypes } from '@/interfaces'
|
|
2
2
|
import { Box, Stack, Text } from '@chakra-ui/react'
|
|
3
|
-
import { VideoDetail } from '
|
|
3
|
+
import { FilterSize, SearchField, VideoDetail } from '@/components'
|
|
4
|
+
import { fieldIcons } from '@/helpers'
|
|
4
5
|
|
|
5
|
-
export const AlertFields = ({ fields }: FieldTypesI) => {
|
|
6
|
+
export const AlertFields = ({ fields, callback }: FieldTypesI) => {
|
|
6
7
|
return (
|
|
7
8
|
<Stack spacing="base" p="base">
|
|
8
9
|
{fields?.map((field) => {
|
|
9
|
-
const { id, type, value } = field
|
|
10
|
+
const { id, type, value, icon } = field
|
|
11
|
+
const mappedIcon = icon && (fieldIcons[icon] as IconTypes)
|
|
10
12
|
switch (type) {
|
|
11
13
|
case 'text':
|
|
12
14
|
return (
|
|
@@ -22,6 +24,10 @@ export const AlertFields = ({ fields }: FieldTypesI) => {
|
|
|
22
24
|
)
|
|
23
25
|
case 'video':
|
|
24
26
|
return <VideoDetail {...field} key={id} />
|
|
27
|
+
case 'filter-size':
|
|
28
|
+
return <FilterSize {...field} key={id} icon={mappedIcon} />
|
|
29
|
+
case 'search':
|
|
30
|
+
return <SearchField {...field} key={id} callback={callback} />
|
|
25
31
|
default:
|
|
26
32
|
return null
|
|
27
33
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Flex, Image, Stack, Text } from '@chakra-ui/react'
|
|
2
|
+
import { CustomDivider } from '@/components'
|
|
3
|
+
import { ReportI } from '@/interfaces'
|
|
4
|
+
|
|
5
|
+
export const FilterSize = ({ name, icon, value }: ReportI) => {
|
|
6
|
+
return (
|
|
7
|
+
<Stack spacing="base">
|
|
8
|
+
<CustomDivider />
|
|
9
|
+
<Text fontWeight="semibold">{name}</Text>
|
|
10
|
+
<Flex gap="base">
|
|
11
|
+
<Image boxSize="86px" src={icon} />
|
|
12
|
+
<Text fontSize="sm" fontFamily="secondary" lineHeight="1.2">
|
|
13
|
+
{value}
|
|
14
|
+
</Text>
|
|
15
|
+
</Flex>
|
|
16
|
+
<CustomDivider />
|
|
17
|
+
</Stack>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Stack, Text } from '@chakra-ui/react'
|
|
2
|
+
import { SearchInput } from '@/components'
|
|
3
|
+
import { FieldTypesI, ReportI } from '@/interfaces'
|
|
4
|
+
import { useState } from 'react'
|
|
5
|
+
|
|
6
|
+
export const SearchField = ({
|
|
7
|
+
callback,
|
|
8
|
+
description,
|
|
9
|
+
...props
|
|
10
|
+
}: ReportI & Pick<FieldTypesI, 'callback'>) => {
|
|
11
|
+
const [search, setSearch] = useState('')
|
|
12
|
+
const handleSearch = (value: string) => {
|
|
13
|
+
callback?.({
|
|
14
|
+
...props,
|
|
15
|
+
value,
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
return (
|
|
19
|
+
<Stack spacing="base">
|
|
20
|
+
<Text fontSize="sm" fontFamily="secondary" lineHeight="1.2">
|
|
21
|
+
{description}
|
|
22
|
+
</Text>
|
|
23
|
+
<SearchInput
|
|
24
|
+
onChange={(e) => setSearch(e.target.value)}
|
|
25
|
+
value={search}
|
|
26
|
+
maxW="full"
|
|
27
|
+
onBlur={() => handleSearch(search)}
|
|
28
|
+
onKeyDown={(e) => {
|
|
29
|
+
if (e.key === 'Enter') {
|
|
30
|
+
handleSearch(search)
|
|
31
|
+
}
|
|
32
|
+
}}
|
|
33
|
+
/>
|
|
34
|
+
</Stack>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './AlertFields'
|
|
2
2
|
export * from './ChangeAirFilter'
|
|
3
3
|
export * from './CustomDivider'
|
|
4
|
+
export * from './FilterSize'
|
|
5
|
+
export * from './SearchField'
|
|
4
6
|
export * from './SmokeDetectorBattery'
|
|
5
7
|
export * from './SmokeDetectorExpired'
|
|
6
8
|
export * from './VideoDetail'
|
|
@@ -56,7 +56,8 @@ import {
|
|
|
56
56
|
AALawn,
|
|
57
57
|
AAMowing,
|
|
58
58
|
AAWeed,
|
|
59
|
-
AApest
|
|
59
|
+
AApest,
|
|
60
|
+
FilterSize,
|
|
60
61
|
} from '@/assets/images'
|
|
61
62
|
import { IconTypes } from '@/interfaces'
|
|
62
63
|
|
|
@@ -119,5 +120,6 @@ export const fieldIcons: Record<IconTypes, string> = {
|
|
|
119
120
|
'aa-disease': AADisease,
|
|
120
121
|
'aa-weed': AAWeed,
|
|
121
122
|
'aa-dressing': AADressing,
|
|
122
|
-
'aa-pest': AApest
|
|
123
|
+
'aa-pest': AApest,
|
|
124
|
+
'filter-size': FilterSize,
|
|
123
125
|
}
|
|
@@ -4,7 +4,7 @@ export type AlertCategory = 'safeguard' | 'maintain' | 'budget' | 'improve'
|
|
|
4
4
|
|
|
5
5
|
export type AlertTabType = 'details' | 'filter-size' | 'purchase' | 'hire-out'
|
|
6
6
|
|
|
7
|
-
export type AlertFieldType = 'alert' | '
|
|
7
|
+
export type AlertFieldType = 'alert' | 'search'
|
|
8
8
|
|
|
9
9
|
export interface BackendAlertI extends DynamicFormI {
|
|
10
10
|
category: AlertCategory
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InputProps } from '@chakra-ui/react'
|
|
2
2
|
|
|
3
|
-
export interface SearchInputI extends
|
|
3
|
+
export interface SearchInputI extends InputProps {
|
|
4
4
|
maxW?: string
|
|
5
5
|
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void
|
|
6
6
|
placeholder?: string
|
|
7
7
|
size?: string
|
|
8
8
|
value: string
|
|
9
|
-
}
|
|
9
|
+
}
|
|
@@ -868,7 +868,7 @@ export const alertFieldsMock: ReportI[] = [
|
|
|
868
868
|
{
|
|
869
869
|
id: faker.database.mongodbObjectId(),
|
|
870
870
|
name: 'Details',
|
|
871
|
-
label: '
|
|
871
|
+
label: '',
|
|
872
872
|
description: faker.lorem.sentence(),
|
|
873
873
|
comments: faker.lorem.sentence(),
|
|
874
874
|
value: '',
|
|
@@ -908,6 +908,42 @@ export const alertFieldsMock: ReportI[] = [
|
|
|
908
908
|
value: faker.image.urlPicsumPhotos(),
|
|
909
909
|
type: 'filter-size',
|
|
910
910
|
visible: true,
|
|
911
|
+
children: [
|
|
912
|
+
{
|
|
913
|
+
id: faker.database.mongodbObjectId(),
|
|
914
|
+
name: '',
|
|
915
|
+
label: '',
|
|
916
|
+
description: '',
|
|
917
|
+
comments: '',
|
|
918
|
+
value:
|
|
919
|
+
'Home air filters are typically located in the HVAC system’s return air vent, furnace compartment, or air handler, usually near the blower unit or ductwork intake.',
|
|
920
|
+
type: 'text',
|
|
921
|
+
visible: true,
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
id: faker.database.mongodbObjectId(),
|
|
925
|
+
name: 'Check the filter:',
|
|
926
|
+
label: '',
|
|
927
|
+
description: '',
|
|
928
|
+
comments: '',
|
|
929
|
+
icon: 'filter-size',
|
|
930
|
+
value:
|
|
931
|
+
'The size of the filter is usually printed on the side of the filter in inches. The size may be written as length x width x depth. For example, a filter that is 16 in long, 20 in wide, and 1 in deep would be written as 16 x 20 x 1. ',
|
|
932
|
+
type: 'filter-size',
|
|
933
|
+
visible: true,
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
id: faker.database.mongodbObjectId(),
|
|
937
|
+
name: '',
|
|
938
|
+
label: '',
|
|
939
|
+
description:
|
|
940
|
+
'or enter your air conditioning/furnace model number below.',
|
|
941
|
+
comments: '',
|
|
942
|
+
value: '',
|
|
943
|
+
type: 'search',
|
|
944
|
+
visible: true,
|
|
945
|
+
},
|
|
946
|
+
],
|
|
911
947
|
},
|
|
912
948
|
],
|
|
913
949
|
},
|