@hexure/ui 1.9.2 → 1.9.3
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/cjs/index.js +59 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/index.d.ts +3 -0
- package/dist/esm/index.js +49 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/index.d.ts +3 -0
- package/dist/index.d.ts +69 -1
- package/package.json +1 -1
|
@@ -32,3 +32,6 @@ export { default as Tag } from './components/Tag';
|
|
|
32
32
|
export { default as Toggle } from './components/Toggle';
|
|
33
33
|
export { default as Tooltip } from './components/Tooltip';
|
|
34
34
|
export { default as ZeroState } from './components/ZeroState';
|
|
35
|
+
export * from './utils/Accessibility';
|
|
36
|
+
export * from './utils/Form';
|
|
37
|
+
export * from './Theme';
|
package/dist/esm/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import React, { useRef, useDebugValue, useContext, createElement, useState, useE
|
|
|
2
2
|
import Icon, { Icon as Icon$1 } from '@mdi/react';
|
|
3
3
|
import { mdiChevronUp, mdiChevronDown, mdiLoading, mdiInformationOutline, mdiAlertOctagonOutline, mdiAlertOutline, mdiCheckboxMarkedCircleOutline, mdiDotsHorizontal, mdiClose, mdiMinusCircle, mdiFolderPlusOutline, mdiChevronRight, mdiChevronLeft, mdiCheck } from '@mdi/js';
|
|
4
4
|
import Numeral from 'numeral';
|
|
5
|
-
import 'moment';
|
|
5
|
+
import Moment from 'moment';
|
|
6
6
|
|
|
7
7
|
/******************************************************************************
|
|
8
8
|
Copyright (c) Microsoft Corporation.
|
|
@@ -3413,6 +3413,53 @@ const FileUpload = ({ accept, onChange, onError, maxFiles = 10, maxSize = 2, mes
|
|
|
3413
3413
|
message ? (React.createElement(Copy, { align: 'center', color: 'GRAY' }, message)) : null))) : null)));
|
|
3414
3414
|
};
|
|
3415
3415
|
|
|
3416
|
+
const getAgesFromDob = (dob) => {
|
|
3417
|
+
let calculated_current_age = null;
|
|
3418
|
+
let calculated_nearest_age = null;
|
|
3419
|
+
if (dob) {
|
|
3420
|
+
// Note: Moment accounts for leap years automatically
|
|
3421
|
+
const birth_date_this_year = Moment(dob).year(Moment().year());
|
|
3422
|
+
const next_birth_date = Moment().isBefore(birth_date_this_year)
|
|
3423
|
+
? birth_date_this_year
|
|
3424
|
+
: birth_date_this_year.add(1, 'years');
|
|
3425
|
+
calculated_current_age = Moment().diff(dob, 'years');
|
|
3426
|
+
calculated_nearest_age = next_birth_date.isBefore(Moment().add(6, 'months'))
|
|
3427
|
+
? calculated_current_age + 1
|
|
3428
|
+
: calculated_current_age;
|
|
3429
|
+
}
|
|
3430
|
+
return { calculated_nearest_age, calculated_current_age };
|
|
3431
|
+
};
|
|
3432
|
+
const getDaysForMonth = (month) => {
|
|
3433
|
+
const days = [];
|
|
3434
|
+
let max_days = 31;
|
|
3435
|
+
let i = 1;
|
|
3436
|
+
if ([4, 6, 9, 11].includes(month)) {
|
|
3437
|
+
max_days = 30;
|
|
3438
|
+
}
|
|
3439
|
+
if (month === 2) {
|
|
3440
|
+
max_days = 29;
|
|
3441
|
+
}
|
|
3442
|
+
for (i; i <= max_days; i++) {
|
|
3443
|
+
days.push({ value: i });
|
|
3444
|
+
}
|
|
3445
|
+
return days;
|
|
3446
|
+
};
|
|
3447
|
+
const getYears = () => {
|
|
3448
|
+
const years = [];
|
|
3449
|
+
let i = 1916;
|
|
3450
|
+
for (i; i < 2021; i++) {
|
|
3451
|
+
years.push({ value: i });
|
|
3452
|
+
}
|
|
3453
|
+
return years;
|
|
3454
|
+
};
|
|
3455
|
+
const validateEmail = (email) => {
|
|
3456
|
+
const email_pattern = new RegExp(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/);
|
|
3457
|
+
return email_pattern.test(email);
|
|
3458
|
+
};
|
|
3459
|
+
const validatePhone = (phone) => {
|
|
3460
|
+
const number_pattern = new RegExp(/^[2-9]\d{9}$/);
|
|
3461
|
+
return number_pattern.test(phone);
|
|
3462
|
+
};
|
|
3416
3463
|
const formatAsPhone = (number) => {
|
|
3417
3464
|
let formatted_value = `${number}`.replace(/[^0-9.]/g, '');
|
|
3418
3465
|
const size = formatted_value.length;
|
|
@@ -4318,5 +4365,5 @@ const ZeroState = (_a) => {
|
|
|
4318
4365
|
action && (React.createElement(Button, { children: action === null || action === void 0 ? void 0 : action.children, icon: action === null || action === void 0 ? void 0 : action.icon, onClick: action === null || action === void 0 ? void 0 : action.onClick }))));
|
|
4319
4366
|
};
|
|
4320
4367
|
|
|
4321
|
-
export { Accordion, ActionDialog, Alert, BulkActionBar, Button, ButtonMenu, Checkbox, Checklist, Copy, DatePicker, Drawer, Field, FieldGroup, FileUpload, Heading, Input$1 as Input, Link, Loader, Logo, Modal, MoreMenu, MultiSelect, PageHeader, Pagination, ProgressBar, Radio, RadioList, Select, Table, Tabs, Tag, Toggle, Tooltip, ZeroState };
|
|
4368
|
+
export { Accordion, ActionDialog, Alert, BulkActionBar, Button, ButtonMenu, Checkbox, Checklist, Colors, Copy, DatePicker, Drawer, EditableTheme, Field, FieldGroup, FileUpload, FontSizes, FontStyles, Heading, Input$1 as Input, Link, Loader, Logo, Modal, MoreMenu, MultiSelect, PageHeader, Pagination, ProgressBar, Radio, RadioList, Select, Table, Tabs, Tag, Toggle, Tooltip, ZeroState, formatAsPhone, formatAsSsn, getAgesFromDob, getDaysForMonth, getYears, validateEmail, validatePhone };
|
|
4322
4369
|
//# sourceMappingURL=index.js.map
|