@bbl-digital/snorre 2.2.37 → 2.2.42
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/bundle.js +594 -291
- package/esm/core/Datepicker/index.js +1 -1
- package/esm/core/Datepicker/styles.js +8 -7
- package/esm/core/Editor/config.js +43 -1
- package/esm/core/Editor/index.js +6 -4
- package/esm/core/Editor/styles.js +6 -6
- package/esm/core/FileInput/index.js +1 -1
- package/esm/core/Timepicker/index.js +124 -0
- package/esm/core/Timepicker/styles.js +45 -0
- package/esm/icons/General/IconPrint.js +15 -0
- package/esm/index.js +3 -1
- package/esm/utils/time.js +86 -0
- package/lib/core/Datepicker/index.d.ts.map +1 -1
- package/lib/core/Datepicker/index.js +1 -1
- package/lib/core/Datepicker/styles.d.ts +1 -0
- package/lib/core/Datepicker/styles.d.ts.map +1 -1
- package/lib/core/Datepicker/styles.js +8 -7
- package/lib/core/Editor/config.d.ts +37 -0
- package/lib/core/Editor/config.d.ts.map +1 -1
- package/lib/core/Editor/config.js +43 -1
- package/lib/core/Editor/index.d.ts +2 -0
- package/lib/core/Editor/index.d.ts.map +1 -1
- package/lib/core/Editor/index.js +6 -4
- package/lib/core/Editor/styles.d.ts.map +1 -1
- package/lib/core/Editor/styles.js +6 -6
- package/lib/core/FileInput/index.d.ts +1 -1
- package/lib/core/FileInput/index.d.ts.map +1 -1
- package/lib/core/FileInput/index.js +1 -1
- package/lib/core/Timepicker/index.d.ts +33 -0
- package/lib/core/Timepicker/index.d.ts.map +1 -0
- package/lib/core/Timepicker/index.js +124 -0
- package/lib/core/Timepicker/styles.d.ts +19 -0
- package/lib/core/Timepicker/styles.d.ts.map +1 -0
- package/lib/core/Timepicker/styles.js +45 -0
- package/lib/icons/General/IconPrint.d.ts +4 -0
- package/lib/icons/General/IconPrint.d.ts.map +1 -0
- package/lib/icons/General/IconPrint.js +15 -0
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -1
- package/lib/utils/time.d.ts +26 -0
- package/lib/utils/time.d.ts.map +1 -0
- package/lib/utils/time.js +86 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
@@ -119,6 +119,7 @@ import IconSubway from './icons/General/IconSubway';
|
|
119
119
|
import IconSwitch from './icons/General/IconSwitch';
|
120
120
|
import IconTrain from './icons/General/IconTrain';
|
121
121
|
import IconTram from './icons/General/IconTram';
|
122
|
+
import IconPrint from './icons/General/IconPrint';
|
122
123
|
import IconTransport from './icons/General/IconTransport';
|
123
124
|
import IconTypeOfBuilding from './icons/General/IconTypeOfBuilding';
|
124
125
|
import IconUpload from './icons/General/IconUpload';
|
@@ -252,6 +253,7 @@ import YearWheel from './core/YearWheel';
|
|
252
253
|
import DropdownMenu from './core/DropdownMenu';
|
253
254
|
import DropdownMenuOption from './core/DropdownMenu/DropdownMenuOption';
|
254
255
|
import Timeline from './core/Timeline';
|
256
|
+
import Timepicker from './core/Timepicker';
|
255
257
|
import TimelineStep from './core/Timeline/TimelineStep';
|
256
258
|
import HighlightText from './core/HighlightText';
|
257
259
|
import TabBar from './core/TabBar';
|
@@ -267,4 +269,4 @@ import IconBblShield from './icons/General/IconBblShield';
|
|
267
269
|
import NoticeCard from './core/NoticeCard';
|
268
270
|
import ListPager from './core/ListPager';
|
269
271
|
import { getCurrentPage, getFirstButtonIndex, getHasMorePages, getHasPreviousPages, getSkippedItems } from './utils/pagination';
|
270
|
-
export { Topbar, Layout, LayoutShell, AppShell, AppLoader, Alert, Button, Card, Divider, Dropdown, Header, Input, Image, Checkbox, Link, List, ListItem, Tag, Text, Footer, FooterCol, FooterGroup, FooterLabel, FooterLink, FooterButton, Radio, Skeleton, Html, CustomText, Select, Option, UserMenu, UserMenuOption, Modal, NotificationsMenu, NotificationRow, Table, Cell, Row, FileInput, Datepicker, Menu, AppPicker, MainMenu, MenuItem, MenuTop, SecondaryMenu, SecondaryMenuItem, MenuSpacer, Submenu, SubmenuItem, PreemptionCard, PreemptionCardLoading, PieChart, SimpleBarChart, SimpleLineChart, BarAndLineComposedChart, BarChartWithCustomizedEvent, IconApartment, IconArchives, IconArea, IconArrowDown, IconArrowLeft, IconArrowRight, IconArrowUp, IconAttachment, IconBack, IconBath, IconBoard, IconBookmarkOutline, IconBookmarkFilled, IconBus, IconBlock, IconCar, IconCaretDown, IconCaretLeft, IconCaretUp, IconCaretRight, IconCheck, IconCheckedOutline, IconCheckedFilled, IconChevronLeft, IconChevronRight, IconChevronDown, IconClose, IconCloseAlt, IconComment, IconCompanyBuilding, IconDelete, IconDoor, IconDotFilled, IconDotOutline, IconDownload, IconDraft, IconElevator, IconErrorOutline, IconErrorFilled, IconExternalLink, IconEye, IconEyeDeny, IconFamily, IconFerry, IconFile, IconFileEdit, IconFileExcel, IconFilePDF, IconFileWord, IconFillOut, IconFloor, IconGarage, IconGrid, IconGym, IconHearth, IconHearthOutline, IconHelp, IconHistory, IconHouse, IconHumans, IconImportantComment, IconInbox, IconJointcost, IconJointcost2, IconKey, IconKitchen, IconLeisureTime, IconLock, IconLockLocked, IconLockOpen, IconMap, IconMail, IconMenu, IconMinus, IconMoney, IconParking, IconPaymentCard, IconPlus, IconPortalUser, IconReciept, IconRedo, IconRefresh, IconRoom, IconSave, IconSearch, IconSend, IconSettings, IconShopping, IconSign, IconStarFilled, IconStarHalf, IconStarOutline, IconStore, IconSubway, IconSwitch, IconTrain, IconTram, IconTransport, IconTypeOfBuilding, IconTypeOfBuildingOutline, IconUpload, IconUser, IconVote, IconWalk, IconWarning, IconWarningBell, IconZip, IconSort, IconFilterList, IconBellOutline, IconPlusAlt, IconPhone, IconHouseOutline, IconMembership, IconMembershipFilled, IconCalendar, IconInfoOutline, IconInfoFilled, IllustrationHouse, IllustrationHighHouseComposition, IllustrationHighHouse, IllustrationHouseComposition, IllustrationLowHouse, IllustrationLowHouseComposition, IllustrationSemiDetachedHouse, IllustrationSemiDetachedHouseComposition, IllustrationSmallHouse, IllustrationSmallHouseComposition, IllustrationTerraceBlock, IllustrationTerraceBlockComposition, IllustrationTownHouse, IllustrationTownHouseComposition, IllustrationHousesBackground, IllustrationHousesBackgroundWithComposition, IllustrationHouseMissing, IllustrationError, IllustrationErrorGeneric, IllustrationPaperCompleted, IllustrationPaperMissing, IllustrationMySiteBuilding, IllustrationMySiteCoffeeBook, IllustrationMySiteComputer, IllustrationMySiteGift, IllustrationMySitePapers, IllustrationMySitePiggyBank, IllustrationMySiteTransfer, IconCommunication, IconCommunicationFilled, IconCompanyBuildingOutline, IconCompanyBuildingFilled, IconDashboard, IconDashboardFilled, IconEconomy, IconEconomyFilled, IconWork, IconWorkFilled, IconProfile, IconProfileFilled, IconLookup, IconLookupFilled, IconDocument, IconDocumentFilled, IconEarth, IconEdit, IconMinusAlt, IconMinusAltFilled, IconUndo, IconVisa, IconMasterCard, IconBankAxept, IconAmericanExpress, IconFileCopy, IconBblFlame, IconBblWater, IconBblShield, useIsMobile, useScreenOrientation, getDomainFromUrl, getFormatedPhone, getUrlWithProtocol, getFormattedPrice, getFormattedPriceWithEnding, getFormattedDate, getTitleString, getDateIsValid, getReducedArray, getFormattedAccountNumber, getFormattedOrganizationNumber, isValidAccountNumber, getFormattedCardNumber, getFormattedTime, alpha, getCurrentPage, getSkippedItems, getHasPreviousPages, getHasMorePages, getFirstButtonIndex, Box, Textarea, InfoButton, CommentsTimeline, CommentLine, HeaderCell, RowCell, TableHeader, TableRow, BoxedTable, CollapseList, CollapseListItem, Banner, Calendar, YearWheel, DropdownMenu, DropdownMenuOption, Timeline, TimelineStep, HighlightText, TabBar, TabItem, Editor, TabNav, TabNavItem, NoticeCard, ListPager };
|
272
|
+
export { Topbar, Layout, LayoutShell, AppShell, AppLoader, Alert, Button, Card, Divider, Dropdown, Header, Input, Image, Checkbox, Link, List, ListItem, Tag, Text, Footer, FooterCol, FooterGroup, FooterLabel, FooterLink, FooterButton, Radio, Skeleton, Html, CustomText, Select, Option, UserMenu, UserMenuOption, Modal, NotificationsMenu, NotificationRow, Table, Cell, Row, FileInput, Datepicker, Menu, AppPicker, MainMenu, MenuItem, MenuTop, SecondaryMenu, SecondaryMenuItem, MenuSpacer, Submenu, SubmenuItem, PreemptionCard, PreemptionCardLoading, PieChart, SimpleBarChart, SimpleLineChart, BarAndLineComposedChart, BarChartWithCustomizedEvent, IconApartment, IconArchives, IconArea, IconArrowDown, IconArrowLeft, IconArrowRight, IconArrowUp, IconAttachment, IconBack, IconBath, IconBoard, IconBookmarkOutline, IconBookmarkFilled, IconBus, IconBlock, IconCar, IconCaretDown, IconCaretLeft, IconCaretUp, IconCaretRight, IconCheck, IconCheckedOutline, IconCheckedFilled, IconChevronLeft, IconChevronRight, IconChevronDown, IconClose, IconCloseAlt, IconComment, IconCompanyBuilding, IconDelete, IconDoor, IconDotFilled, IconDotOutline, IconDownload, IconDraft, IconElevator, IconErrorOutline, IconErrorFilled, IconExternalLink, IconEye, IconEyeDeny, IconFamily, IconFerry, IconFile, IconFileEdit, IconFileExcel, IconFilePDF, IconFileWord, IconFillOut, IconFloor, IconGarage, IconGrid, IconGym, IconHearth, IconHearthOutline, IconHelp, IconHistory, IconHouse, IconHumans, IconImportantComment, IconInbox, IconJointcost, IconJointcost2, IconKey, IconKitchen, IconLeisureTime, IconLock, IconLockLocked, IconLockOpen, IconMap, IconMail, IconMenu, IconMinus, IconMoney, IconParking, IconPaymentCard, IconPlus, IconPortalUser, IconReciept, IconRedo, IconRefresh, IconRoom, IconSave, IconSearch, IconSend, IconSettings, IconShopping, IconSign, IconStarFilled, IconStarHalf, IconStarOutline, IconStore, IconSubway, IconSwitch, IconTrain, IconTram, IconPrint, IconTransport, IconTypeOfBuilding, IconTypeOfBuildingOutline, IconUpload, IconUser, IconVote, IconWalk, IconWarning, IconWarningBell, IconZip, IconSort, IconFilterList, IconBellOutline, IconPlusAlt, IconPhone, IconHouseOutline, IconMembership, IconMembershipFilled, IconCalendar, IconInfoOutline, IconInfoFilled, IllustrationHouse, IllustrationHighHouseComposition, IllustrationHighHouse, IllustrationHouseComposition, IllustrationLowHouse, IllustrationLowHouseComposition, IllustrationSemiDetachedHouse, IllustrationSemiDetachedHouseComposition, IllustrationSmallHouse, IllustrationSmallHouseComposition, IllustrationTerraceBlock, IllustrationTerraceBlockComposition, IllustrationTownHouse, IllustrationTownHouseComposition, IllustrationHousesBackground, IllustrationHousesBackgroundWithComposition, IllustrationHouseMissing, IllustrationError, IllustrationErrorGeneric, IllustrationPaperCompleted, IllustrationPaperMissing, IllustrationMySiteBuilding, IllustrationMySiteCoffeeBook, IllustrationMySiteComputer, IllustrationMySiteGift, IllustrationMySitePapers, IllustrationMySitePiggyBank, IllustrationMySiteTransfer, IconCommunication, IconCommunicationFilled, IconCompanyBuildingOutline, IconCompanyBuildingFilled, IconDashboard, IconDashboardFilled, IconEconomy, IconEconomyFilled, IconWork, IconWorkFilled, IconProfile, IconProfileFilled, IconLookup, IconLookupFilled, IconDocument, IconDocumentFilled, IconEarth, IconEdit, IconMinusAlt, IconMinusAltFilled, IconUndo, IconVisa, IconMasterCard, IconBankAxept, IconAmericanExpress, IconFileCopy, IconBblFlame, IconBblWater, IconBblShield, useIsMobile, useScreenOrientation, getDomainFromUrl, getFormatedPhone, getUrlWithProtocol, getFormattedPrice, getFormattedPriceWithEnding, getFormattedDate, getTitleString, getDateIsValid, getReducedArray, getFormattedAccountNumber, getFormattedOrganizationNumber, isValidAccountNumber, getFormattedCardNumber, getFormattedTime, alpha, getCurrentPage, getSkippedItems, getHasPreviousPages, getHasMorePages, getFirstButtonIndex, Box, Textarea, InfoButton, CommentsTimeline, CommentLine, HeaderCell, RowCell, TableHeader, TableRow, BoxedTable, CollapseList, CollapseListItem, Banner, Calendar, YearWheel, DropdownMenu, DropdownMenuOption, Timeline, Timepicker, TimelineStep, HighlightText, TabBar, TabItem, Editor, TabNav, TabNavItem, NoticeCard, ListPager };
|
@@ -0,0 +1,26 @@
|
|
1
|
+
export declare const DEFAULT_DIVIDER = ":";
|
2
|
+
export declare const DEFAULT_VALUE_SHORT: string;
|
3
|
+
export declare const DEFAULT_VALUE_FULL: string;
|
4
|
+
/**
|
5
|
+
* Checks if input is a number
|
6
|
+
*/
|
7
|
+
export declare function isNumber<T>(value: T): boolean;
|
8
|
+
/**
|
9
|
+
* Validates time to keep the format:
|
10
|
+
* default 00:00 or 00:00:00 if showSeconds is true
|
11
|
+
*
|
12
|
+
* The function also keeps track of the cursor position
|
13
|
+
*/
|
14
|
+
export declare const validateTimeAndCursor: (showSeconds?: boolean, value?: string, defaultValue?: string, divider?: string, cursorPosition?: number) => [string, number];
|
15
|
+
/**
|
16
|
+
* Converts a Date to String with the format:
|
17
|
+
* default 00:00 or 00:00:00 if showSeconds is true
|
18
|
+
*/
|
19
|
+
export declare const handleDateToStringConvertion: (date: Date, showSeconds?: boolean | undefined) => string;
|
20
|
+
/**
|
21
|
+
* Converts a String to Date with the format:
|
22
|
+
* If value is formatted as 00:00:00 it will return the date with chosen seconds
|
23
|
+
* If value is formatted as 00:00 it will return the date with seconds set to 00
|
24
|
+
*/
|
25
|
+
export declare const handleStringToDateConvertion: (value: string, originalDate?: Date | undefined) => Date;
|
26
|
+
//# sourceMappingURL=time.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/packages/utils/time.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,MAAM,CAAA;AAClC,eAAO,MAAM,mBAAmB,QAA2B,CAAA;AAC3D,eAAO,MAAM,kBAAkB,QAA+C,CAAA;AAM9E;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAG7C;AAED;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,+GAM/B,CAAC,MAAM,EAAE,MAAM,CAwCjB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,4BAA4B,SACjC,IAAI,wCAET,MAUF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,UAChC,MAAM,sCAEZ,IASF,CAAA"}
|
@@ -0,0 +1,86 @@
|
|
1
|
+
export const DEFAULT_DIVIDER = ':';
|
2
|
+
export const DEFAULT_VALUE_SHORT = `00${DEFAULT_DIVIDER}00`;
|
3
|
+
export const DEFAULT_VALUE_FULL = `00${DEFAULT_DIVIDER}00${DEFAULT_DIVIDER}00`;
|
4
|
+
|
5
|
+
const formatTimeItem = value => {
|
6
|
+
return `${value || ''}00`.substr(0, 2);
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* Checks if input is a number
|
10
|
+
*/
|
11
|
+
|
12
|
+
|
13
|
+
export function isNumber(value) {
|
14
|
+
const number = Number(value);
|
15
|
+
return !isNaN(number) && String(value) === String(number);
|
16
|
+
}
|
17
|
+
/**
|
18
|
+
* Validates time to keep the format:
|
19
|
+
* default 00:00 or 00:00:00 if showSeconds is true
|
20
|
+
*
|
21
|
+
* The function also keeps track of the cursor position
|
22
|
+
*/
|
23
|
+
|
24
|
+
export const validateTimeAndCursor = (showSeconds = false, value = '', defaultValue = '', divider = DEFAULT_DIVIDER, cursorPosition = 0) => {
|
25
|
+
const [oldHH, oldMM, oldSS] = defaultValue.split(divider);
|
26
|
+
let newCursorPosition = Number(cursorPosition);
|
27
|
+
let [HH, MM, SS] = String(value).split(divider);
|
28
|
+
HH = formatTimeItem(HH);
|
29
|
+
|
30
|
+
if (Number(HH[0]) > 2) {
|
31
|
+
HH = oldHH;
|
32
|
+
newCursorPosition -= 1;
|
33
|
+
} else if (Number(HH[0]) === 2) {
|
34
|
+
if (Number(oldHH[0]) === 2 && Number(HH[1]) > 3) {
|
35
|
+
HH = `2${oldHH[1]}`;
|
36
|
+
newCursorPosition -= 2;
|
37
|
+
} else if (Number(HH[1]) > 3) {
|
38
|
+
HH = '23';
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
MM = formatTimeItem(MM);
|
43
|
+
|
44
|
+
if (Number(MM[0]) > 5) {
|
45
|
+
MM = oldMM;
|
46
|
+
newCursorPosition -= 1;
|
47
|
+
}
|
48
|
+
|
49
|
+
if (showSeconds) {
|
50
|
+
SS = formatTimeItem(SS);
|
51
|
+
|
52
|
+
if (Number(SS[0]) > 5) {
|
53
|
+
SS = oldSS;
|
54
|
+
newCursorPosition -= 1;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
const validatedValue = showSeconds ? `${HH}${divider}${MM}${divider}${SS}` : `${HH}${divider}${MM}`;
|
59
|
+
return [validatedValue, newCursorPosition];
|
60
|
+
};
|
61
|
+
/**
|
62
|
+
* Converts a Date to String with the format:
|
63
|
+
* default 00:00 or 00:00:00 if showSeconds is true
|
64
|
+
*/
|
65
|
+
|
66
|
+
export const handleDateToStringConvertion = (date, showSeconds) => {
|
67
|
+
const d = new Date(date);
|
68
|
+
const hours = d.getHours().toString().padStart(2, '0');
|
69
|
+
const minutes = d.getMinutes().toString().padStart(2, '0');
|
70
|
+
const seconds = d.getSeconds().toString().padStart(2, '0');
|
71
|
+
return `${hours}${DEFAULT_DIVIDER}${minutes}${showSeconds ? `${DEFAULT_DIVIDER}${seconds}` : ''}`;
|
72
|
+
};
|
73
|
+
/**
|
74
|
+
* Converts a String to Date with the format:
|
75
|
+
* If value is formatted as 00:00:00 it will return the date with chosen seconds
|
76
|
+
* If value is formatted as 00:00 it will return the date with seconds set to 00
|
77
|
+
*/
|
78
|
+
|
79
|
+
export const handleStringToDateConvertion = (value, originalDate) => {
|
80
|
+
const [hours, minutes, seconds] = value.split(DEFAULT_DIVIDER);
|
81
|
+
const date = originalDate || new Date(0, 0, 0);
|
82
|
+
date.setHours(Number(hours));
|
83
|
+
date.setMinutes(Number(minutes));
|
84
|
+
date.setSeconds(Number(seconds || 0));
|
85
|
+
return date;
|
86
|
+
};
|