@jobber/components 6.26.0 → 6.26.2
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/AnimatedPresence-es.js +4 -4
- package/dist/AnimatedSwitcher-es.js +4 -4
- package/dist/AtlantisThemeContext-es.js +6 -6
- package/dist/Autocomplete-es.js +27 -27
- package/dist/Avatar-es.js +4 -4
- package/dist/Banner-es.js +13 -13
- package/dist/BannerIcon-es.js +3 -3
- package/dist/Body-es.js +12 -12
- package/dist/Box-es.js +2 -2
- package/dist/Button-es.js +13 -13
- package/dist/ButtonDismiss-es.js +2 -2
- package/dist/Card-es.js +15 -15
- package/dist/Checkbox/index.mjs +24 -24
- package/dist/Chip-es.js +17 -17
- package/dist/ChipDismissible-es.js +7 -7
- package/dist/Chips/index.mjs +3 -3
- package/dist/Chips-es.js +13 -13
- package/dist/Combobox/components/ComboboxContent/index.cjs +0 -2
- package/dist/Combobox/components/ComboboxContent/index.mjs +0 -2
- package/dist/Combobox/hooks/useComboboxAccessibility.d.ts +3 -8
- package/dist/Combobox/index.cjs +1 -2
- package/dist/Combobox/index.mjs +1 -2
- package/dist/Combobox-es.js +6 -6
- package/dist/ComboboxAction-es.js +4 -4
- package/dist/ComboboxActivator-es.js +3 -3
- package/dist/ComboboxContent-cjs.js +3745 -39
- package/dist/ComboboxContent-es.js +3715 -27
- package/dist/ComboboxContentHeader-es.js +4 -4
- package/dist/ComboboxContentList-es.js +13 -13
- package/dist/ComboboxContentSearch-es.js +5 -5
- package/dist/ComboboxLoadMore-es.js +2 -2
- package/dist/ComboboxOption-es.js +6 -6
- package/dist/ComboboxProvider-es.js +3 -3
- package/dist/ComboboxTrigger-es.js +4 -4
- package/dist/ConfirmationModal-es.js +4 -4
- package/dist/Countdown-es.js +3 -3
- package/dist/DataDump-es.js +7 -7
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.cjs +1 -2
- package/dist/DataList/components/DataListFilters/components/DataListSort/index.mjs +1 -2
- package/dist/DataList/components/DataListFilters/index.cjs +2 -2
- package/dist/DataList/components/DataListFilters/index.mjs +2 -2
- package/dist/DataList-es.js +21 -21
- package/dist/DataList.utils-es.js +7 -7
- package/dist/DataListAction-es.js +9 -9
- package/dist/DataListActions-es.js +6 -6
- package/dist/DataListActionsMenu-es.js +4 -4
- package/dist/DataListBulkActions-es.js +3 -3
- package/dist/DataListContext-es.js +6 -6
- package/dist/DataListEmptyState-es.js +3 -3
- package/dist/DataListFilters-es.js +3 -3
- package/dist/DataListHeader-es.js +12 -12
- package/dist/DataListHeaderTile-es.js +9 -9
- package/dist/DataListItem-es.js +10 -10
- package/dist/DataListItemActions-es.js +3 -3
- package/dist/DataListItemActionsOverflow-es.js +5 -5
- package/dist/DataListItemClickable-es.js +8 -8
- package/dist/DataListItems-es.js +3 -3
- package/dist/DataListLayout-es.js +2 -2
- package/dist/DataListLayoutActions-es.js +6 -6
- package/dist/DataListLoadMore-es.js +8 -8
- package/dist/DataListLoadingState-es.js +4 -4
- package/dist/DataListOverflowFade-es.js +6 -6
- package/dist/DataListSearch-es.js +6 -6
- package/dist/DataListSort-es.js +6 -6
- package/dist/DataListSortingOptions-es.js +3 -3
- package/dist/DataListStatusBar-es.js +2 -2
- package/dist/DataListStickyHeader-es.js +2 -2
- package/dist/DataListTags-es.js +7 -7
- package/dist/DataListTotalCount-es.js +6 -6
- package/dist/DataTable-es.js +45 -45
- package/dist/DatePicker-es.js +12 -12
- package/dist/DayOfMonthSelect-es.js +18 -18
- package/dist/DescriptionList-es.js +4 -4
- package/dist/Disclosure-es.js +10 -10
- package/dist/Divider-es.js +2 -2
- package/dist/DrawerGrid-es.js +11 -11
- package/dist/Emphasis-es.js +2 -2
- package/dist/FeatureSwitch-es.js +17 -17
- package/dist/Flex-es.js +2 -2
- package/dist/Form-es.js +3 -3
- package/dist/FormField/FormFieldTypes.d.ts +6 -0
- package/dist/FormField/hooks/useAtlantisFormField.d.ts +2 -2
- package/dist/FormField-cjs.js +12 -4
- package/dist/FormField-es.js +50 -42
- package/dist/FormatDate-es.js +2 -2
- package/dist/FormatEmail-es.js +2 -2
- package/dist/FormatFile-es.js +23 -23
- package/dist/FormatRelativeDateTime-es.js +6 -6
- package/dist/FormatTime-es.js +2 -2
- package/dist/Gallery-es.js +8 -8
- package/dist/Glimmer-es.js +11 -11
- package/dist/Grid-es.js +2 -2
- package/dist/GridCell-es.js +2 -2
- package/dist/Heading-es.js +2 -2
- package/dist/Icon-es.js +9 -9
- package/dist/InlineLabel-es.js +3 -3
- package/dist/InputAvatar-es.js +11 -11
- package/dist/InputDate/index.cjs +1 -1
- package/dist/InputDate/index.mjs +10 -10
- package/dist/InputEmail-cjs.js +1 -1
- package/dist/InputEmail-es.js +3 -3
- package/dist/InputFile-es.js +20 -20
- package/dist/InputGroup-es.js +4 -4
- package/dist/InputNumber-cjs.js +1 -1
- package/dist/InputNumber-es.js +3 -3
- package/dist/InputPassword-cjs.js +1 -1
- package/dist/InputPassword-es.js +3 -3
- package/dist/InputPhoneNumber-cjs.js +2 -2
- package/dist/InputPhoneNumber-es.js +7 -7
- package/dist/InputText/index.cjs +1 -1
- package/dist/InputText/index.mjs +13 -13
- package/dist/InputTime-cjs.js +1 -1
- package/dist/InputTime-es.js +3 -3
- package/dist/InputValidation-es.js +5 -5
- package/dist/InternalChipDismissible-es.js +19 -19
- package/dist/LightBox-es.js +31 -31
- package/dist/Link-es.js +2 -2
- package/dist/List-es.js +29 -29
- package/dist/Markdown-es.js +15 -15
- package/dist/Menu-es.js +21 -21
- package/dist/Modal-es.js +18 -18
- package/dist/MultiSelect-es.js +9 -9
- package/dist/Option-cjs.js +1 -1
- package/dist/Option-es.js +4 -4
- package/dist/Page-es.js +23 -23
- package/dist/Popover-es.js +7 -7
- package/dist/ProgressBar-es.js +5 -5
- package/dist/RadioGroup-es.js +9 -9
- package/dist/RecurringSelect-es.js +19 -19
- package/dist/SegmentedControl-es.js +9 -9
- package/dist/Select/Select.d.ts +1 -1
- package/dist/SideDrawer-es.js +22 -22
- package/dist/Spinner-es.js +2 -2
- package/dist/StatusIndicator-es.js +2 -2
- package/dist/StatusLabel-es.js +5 -5
- package/dist/Switch-es.js +10 -10
- package/dist/Tabs-es.js +14 -14
- package/dist/Text-es.js +2 -2
- package/dist/Tooltip-es.js +9 -9
- package/dist/Typography-es.js +2 -2
- package/dist/showToast-es.js +11 -11
- package/dist/styles.css +5 -2
- package/dist/useChildComponent-es.js +2 -2
- package/dist/useFocusTrap-es.js +2 -2
- package/dist/useInView-es.js +2 -2
- package/dist/useIsMounted-es.js +2 -2
- package/dist/useOnKeyDown-es.js +2 -2
- package/dist/useRefocusOnActivator-es.js +2 -2
- package/dist/useResizeObserver-es.js +3 -3
- package/dist/useSafeLayoutEffect-es.js +2 -2
- package/dist/useScrollToActive-es.js +3 -3
- package/package.json +3 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import { T as Typography } from './Typography-es.js';
|
|
3
3
|
|
|
4
4
|
var styles = {"descriptionList":"BkruJ2-bRWg-","termGroup":"tpCvfS7kyDQ-","spinning":"pkFPHChT5OI-"};
|
|
5
5
|
|
|
6
6
|
function DescriptionList({ data }) {
|
|
7
|
-
return (
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
return (React__default.createElement("dl", { className: styles.descriptionList }, data.map(([term, description], i) => (React__default.createElement("div", { key: `${term}-${i}`, className: styles.termGroup },
|
|
8
|
+
React__default.createElement(Typography, { element: "dt", textColor: "heading", size: "base" }, term),
|
|
9
|
+
React__default.createElement(Typography, { element: "dd", textColor: "text", size: "base" }, description))))));
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export { DescriptionList as D };
|
package/dist/Disclosure-es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { useState } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { u as useResizeObserver } from './useResizeObserver-es.js';
|
|
4
4
|
import { I as Icon } from './Icon-es.js';
|
|
@@ -18,19 +18,19 @@ function Disclosure({ children, title, defaultOpen = false, onToggle, open, UNSA
|
|
|
18
18
|
const summaryWrapClassNames = classnames(styles.summaryWrap, { [styles.customSummaryWrap]: !isTitleString }, UNSAFE_className.summaryWrap);
|
|
19
19
|
const arrowIconWrapperClassNames = classnames(styles.arrowIconWrapper, UNSAFE_className.arrowIconWrapper);
|
|
20
20
|
const contentClassNames = classnames(styles.content, UNSAFE_className.content);
|
|
21
|
-
return (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
return (React__default.createElement("details", { open: isOpen, className: containerClassNames, style: UNSAFE_style.container },
|
|
22
|
+
React__default.createElement("summary", { className: summaryClassNames, style: UNSAFE_style.summary, onClick: handleToggle },
|
|
23
|
+
React__default.createElement("div", { className: summaryWrapClassNames, style: UNSAFE_style.summaryWrap, ref: titleRef },
|
|
24
|
+
React__default.createElement(DisclosureTitle, { title: title, size: isBelowBreakpoint ? "base" : "large", isTitleString: isTitleString, UNSAFE_className: UNSAFE_className.title, UNSAFE_style: UNSAFE_style.title }),
|
|
25
|
+
React__default.createElement("span", { className: arrowIconWrapperClassNames, style: UNSAFE_style.arrowIconWrapper },
|
|
26
|
+
React__default.createElement(Icon, { name: "arrowDown", color: "interactive", UNSAFE_className: {
|
|
27
27
|
svg: (_a = UNSAFE_className.icon) === null || _a === void 0 ? void 0 : _a.svg,
|
|
28
28
|
path: (_b = UNSAFE_className.icon) === null || _b === void 0 ? void 0 : _b.path,
|
|
29
29
|
}, UNSAFE_style: {
|
|
30
30
|
svg: (_c = UNSAFE_style.icon) === null || _c === void 0 ? void 0 : _c.svg,
|
|
31
31
|
path: (_d = UNSAFE_style.icon) === null || _d === void 0 ? void 0 : _d.path,
|
|
32
32
|
} })))),
|
|
33
|
-
|
|
33
|
+
React__default.createElement("span", { className: contentClassNames, style: UNSAFE_style.content }, children)));
|
|
34
34
|
function handleToggle(event) {
|
|
35
35
|
event.preventDefault();
|
|
36
36
|
setInternalOpen(!isOpen);
|
|
@@ -39,8 +39,8 @@ function Disclosure({ children, title, defaultOpen = false, onToggle, open, UNSA
|
|
|
39
39
|
}
|
|
40
40
|
function DisclosureTitle({ title, size, isTitleString, UNSAFE_className, UNSAFE_style, }) {
|
|
41
41
|
if (!isTitleString)
|
|
42
|
-
return
|
|
43
|
-
return (
|
|
42
|
+
return React__default.createElement(React__default.Fragment, null, title);
|
|
43
|
+
return (React__default.createElement(Typography, { element: "h4", size: size, fontWeight: "bold", textColor: "heading", UNSAFE_className: UNSAFE_className, UNSAFE_style: UNSAFE_style }, title));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export { Disclosure as D };
|
package/dist/Divider-es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
|
|
4
4
|
var styles = {"divider":"XLgPB38fKeE-","spinning":"JenuDN3dhh4-"};
|
|
@@ -9,7 +9,7 @@ var directions = {"horizontal":"evwHY54TitY-","vertical":"qT-G2Sn0Wm8-","spinnin
|
|
|
9
9
|
|
|
10
10
|
function Divider({ size = "base", direction = "horizontal", testID, }) {
|
|
11
11
|
const className = classnames(styles.divider, sizes[size], directions[direction]);
|
|
12
|
-
return (
|
|
12
|
+
return (React__default.createElement("div", { className: className, "data-testid": testID, role: "none presentation" }));
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export { Divider as D };
|
package/dist/DrawerGrid-es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { H as Heading } from './Heading-es.js';
|
|
4
4
|
import { B as ButtonDismiss } from './ButtonDismiss-es.js';
|
|
@@ -7,23 +7,23 @@ var styles$1 = {"container":"LNIwHwCs8gQ-","drawer":"iDSQR4mxUvM-","open":"y9lAh
|
|
|
7
7
|
|
|
8
8
|
function Drawer({ title, children, open = true, onRequestClose, id, }) {
|
|
9
9
|
const drawerClassNames = classnames(styles$1.container, open && styles$1.open);
|
|
10
|
-
return (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
return (React__default.createElement("aside", { className: drawerClassNames, "data-testid": "drawer-container", "aria-label": title, "aria-hidden": !open, id: id },
|
|
11
|
+
React__default.createElement("div", { className: styles$1.drawer },
|
|
12
|
+
React__default.createElement(Header, { title: title, onRequestClose: onRequestClose }),
|
|
13
|
+
React__default.createElement("div", { className: styles$1.contentScroll },
|
|
14
|
+
React__default.createElement("div", { className: styles$1.content }, children)))));
|
|
15
15
|
}
|
|
16
16
|
function Header({ title, onRequestClose }) {
|
|
17
|
-
return (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
return (React__default.createElement("div", { className: styles$1.header, "data-testid": "drawer-header" },
|
|
18
|
+
React__default.createElement("div", { className: styles$1.heading },
|
|
19
|
+
React__default.createElement(Heading, { level: 2 }, title)),
|
|
20
|
+
React__default.createElement(ButtonDismiss, { onClick: onRequestClose, ariaLabel: `Close ${title || "drawer"}` })));
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
var styles = {"drawerGrid":"_50Jq09W07gg-","spinning":"GqOdr2k9PX8-"};
|
|
24
24
|
|
|
25
25
|
function DrawerGrid({ children }) {
|
|
26
|
-
return
|
|
26
|
+
return React__default.createElement("div", { className: styles.drawerGrid }, children);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export { Drawer as D, DrawerGrid as a };
|
package/dist/Emphasis-es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import { T as Typography } from './Typography-es.js';
|
|
3
3
|
|
|
4
4
|
function Emphasis({ variation, children }) {
|
|
@@ -7,7 +7,7 @@ function Emphasis({ variation, children }) {
|
|
|
7
7
|
italic: { element: "em", emphasisType: "italic" },
|
|
8
8
|
highlight: { element: "strong", emphasisType: "highlight" },
|
|
9
9
|
};
|
|
10
|
-
return
|
|
10
|
+
return React__default.createElement(Typography, Object.assign({}, variationMap[variation]), children);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export { Emphasis as E };
|
package/dist/FeatureSwitch-es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { useState, useEffect } from 'react';
|
|
2
2
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { H as Heading } from './Heading-es.js';
|
|
@@ -15,27 +15,27 @@ function FeatureSwitch({ children, description, disabled = false, enabled, exter
|
|
|
15
15
|
const [savedIndicator, setSavedIndicator] = useState(false);
|
|
16
16
|
const featureContentClassnames = classnames(styles.featureContent, styles.content, enabled && styles.enabled);
|
|
17
17
|
shouldShowSavedIndicator();
|
|
18
|
-
return (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
title &&
|
|
23
|
-
description && (
|
|
24
|
-
|
|
25
|
-
onSwitch && (
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
return (React__default.createElement(Content, null,
|
|
19
|
+
React__default.createElement("div", { className: styles.container },
|
|
20
|
+
React__default.createElement("div", { className: styles.content },
|
|
21
|
+
React__default.createElement(Content, null,
|
|
22
|
+
title && React__default.createElement(Heading, { level: 4 }, title),
|
|
23
|
+
description && (React__default.createElement(Text, null,
|
|
24
|
+
React__default.createElement(Markdown, { content: description, basicUsage: true, externalLink: externalLink }))))),
|
|
25
|
+
onSwitch && (React__default.createElement("div", { className: styles.action },
|
|
26
|
+
React__default.createElement(Switch, { value: enabled, onChange: onSwitch, ariaLabel: description, disabled: disabled }),
|
|
27
|
+
React__default.createElement(AnimatePresence, null, hasSaveIndicator && savedIndicator && (React__default.createElement(motion.div, { className: styles.savedIndicator, initial: { y: -4, opacity: 0 }, animate: { y: 0, opacity: 1 }, exit: { y: -4, opacity: 0 }, transition: {
|
|
28
28
|
delay: 0.2,
|
|
29
29
|
type: "spring",
|
|
30
30
|
damping: 20,
|
|
31
31
|
stiffness: 300,
|
|
32
32
|
}, onAnimationComplete: handleAnimationComplete },
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
(children || onEdit) && (
|
|
36
|
-
children && (
|
|
37
|
-
onEdit && (
|
|
38
|
-
|
|
33
|
+
React__default.createElement(Text, { variation: "success" },
|
|
34
|
+
React__default.createElement(Emphasis, { variation: "italic" }, "Saved")))))))),
|
|
35
|
+
(children || onEdit) && (React__default.createElement("div", { className: styles.container },
|
|
36
|
+
children && (React__default.createElement("div", { className: featureContentClassnames }, children)),
|
|
37
|
+
onEdit && (React__default.createElement("div", { className: styles.action },
|
|
38
|
+
React__default.createElement(Button, { label: "Edit", type: "tertiary", onClick: onEdit })))))));
|
|
39
39
|
function shouldShowSavedIndicator() {
|
|
40
40
|
// Check if the component is mounted
|
|
41
41
|
const [didMount, setDidMount] = useState(false);
|
package/dist/Flex-es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
|
|
4
4
|
var styles = {"flexible":"pEdV7Oo29SE-","smallestGap":"ftl4BEGpmyA-","smallerGap":"ikaEWOhu3ZI-","smallGap":"V9xi4msiJlM-","baseGap":"Jzbdj1Ja38E-","largeGap":"cLrQOLCo-z8-","noneGap":"VZokN5bjMl0-","startAlign":"_9CW5WRJdMFo-","centerAlign":"zVzX2gVWEGw-","endAlign":"cnhrFSJxBCo-","spinning":"WKqP-JY0YEw-"};
|
|
5
5
|
|
|
6
6
|
function Flex({ align = "center", children, direction = "row", gap = "base", template, }) {
|
|
7
|
-
return (
|
|
7
|
+
return (React__default.createElement("div", { className: classnames(styles.flexible, {
|
|
8
8
|
[styles[`${gap}Gap`]]: Boolean(gap),
|
|
9
9
|
[styles[`${align}Align`]]: Boolean(align),
|
|
10
10
|
}), style: generateGridStylesFromTemplate(direction, template) }, children));
|
package/dist/Form-es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as __awaiter } from './tslib.es6-es.js';
|
|
2
|
-
import
|
|
2
|
+
import React__default, { forwardRef, useEffect, useImperativeHandle } from 'react';
|
|
3
3
|
import { useForm, FormProvider } from 'react-hook-form';
|
|
4
4
|
|
|
5
5
|
const Form = forwardRef(function InternalForm({ onSubmit, children, onStateChange }, ref) {
|
|
@@ -31,8 +31,8 @@ const Form = forwardRef(function InternalForm({ onSubmit, children, onStateChang
|
|
|
31
31
|
const formProps = {
|
|
32
32
|
onSubmit: onSubmit && handleSubmit(submitHandler),
|
|
33
33
|
};
|
|
34
|
-
return (
|
|
35
|
-
|
|
34
|
+
return (React__default.createElement(FormProvider, Object.assign({}, methods),
|
|
35
|
+
React__default.createElement(Wrapper, Object.assign({}, formProps, { "data-testid": "atlantis-form" }), children)));
|
|
36
36
|
function submitHandler() {
|
|
37
37
|
onSubmit && onSubmit();
|
|
38
38
|
}
|
|
@@ -202,5 +202,11 @@ export interface FormFieldProps extends CommonFormFieldProps {
|
|
|
202
202
|
* Determines the visibility of the toolbar.
|
|
203
203
|
*/
|
|
204
204
|
readonly toolbarVisibility?: "always" | "while-editing";
|
|
205
|
+
/**
|
|
206
|
+
* Pattern is currently only used for the InputPhone type
|
|
207
|
+
* it is used to determine the format of the phone number
|
|
208
|
+
* and the number of digits to expect.
|
|
209
|
+
*/
|
|
210
|
+
readonly pattern?: string;
|
|
205
211
|
}
|
|
206
212
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChangeEvent, FocusEvent, KeyboardEvent } from "react";
|
|
2
2
|
import { UseControllerReturn } from "react-hook-form";
|
|
3
3
|
import type { FormFieldProps, KeyBoardTypes } from "../FormFieldTypes";
|
|
4
|
-
export interface useAtlantisFormFieldProps extends Pick<FormFieldProps, "description" | "disabled" | "readonly" | "inline" | "autofocus"> {
|
|
4
|
+
export interface useAtlantisFormFieldProps extends Pick<FormFieldProps, "description" | "disabled" | "readonly" | "inline" | "autofocus" | "pattern" | "type" | "value"> {
|
|
5
5
|
/**
|
|
6
6
|
* The html id for the field
|
|
7
7
|
*/
|
|
@@ -57,7 +57,7 @@ export interface useAtlantisFormFieldProps extends Pick<FormFieldProps, "descrip
|
|
|
57
57
|
/**
|
|
58
58
|
* Provides the props for the html fields rendered by the FormField component
|
|
59
59
|
*/
|
|
60
|
-
export declare function useAtlantisFormField({ id, nameProp, name, useControllerField: useControllerField, description, disabled, readonly, keyboard, autofocus, handleChange, handleBlur, handleFocus, inline, validations, handleKeyDown, handleValidation, errorMessage, }: useAtlantisFormFieldProps): {
|
|
60
|
+
export declare function useAtlantisFormField({ id, nameProp, name, useControllerField: useControllerField, description, disabled, readonly, keyboard, autofocus, pattern, type, value, handleChange, handleBlur, handleFocus, inline, validations, handleKeyDown, handleValidation, errorMessage, }: useAtlantisFormFieldProps): {
|
|
61
61
|
textFieldProps: {
|
|
62
62
|
autoFocus: boolean | undefined;
|
|
63
63
|
onKeyDown: (event: KeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
package/dist/FormField-cjs.js
CHANGED
|
@@ -33,7 +33,7 @@ function useShowClear({ clearable, multiline, focused, hasValue, disabled = fals
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
var styles$1 = {"container":"YL-mNv-Bl6g-","wrapper":"_8lhbGTQ-hhg-","horizontalWrapper":"b5mv1x1H7YE-","textarea":"hGr6YW4AeLM-","safari":"QBCWi9GBgMs-","timeInputLabel":"_0pmqVa2zSE4-","miniLabel":"F1t76G6bDKo-","large":"_9tjyT9QUtP8-","text":"QmMiyoAWp-g-","invalid":"XWDSfe6weSY-","disabled":"Tz9LK9ABKMk-","small":"Sw5O4I0lMJg-","inline":"SaORbL7SYWY-","center":"ozy2UoT2vsg-","right":"_3TJdT91YD3c-","maxLength":"W6GrMqLy2qk-","inputWrapper":"-LmjnYRU0r0-","childrenWrapper":"yVXYv6hkuOA-","input":"vtSDcuzNr9Q-","label":"Dgk00tzlODA-","select":"NwQGiWBWIsc-","externalLabel":"Qb8zQ8n-8vc-","postfix":"yTDzs9h1otI-","affixIcon":"m0YpdssD2dY-","suffix":"_-3mMnjSh6ok-","hasAction":"OLE9N3Uem4o-","affixLabel":"-Wzcb0pBh5I-","description":"DHX5ijY3xIw-","toolbar":"AL-2brNI7dk-","spinning":"_8Rzv7CcDW80-"};
|
|
36
|
+
var styles$1 = {"container":"YL-mNv-Bl6g-","wrapper":"_8lhbGTQ-hhg-","horizontalWrapper":"b5mv1x1H7YE-","textarea":"hGr6YW4AeLM-","safari":"QBCWi9GBgMs-","timeInputLabel":"_0pmqVa2zSE4-","miniLabel":"F1t76G6bDKo-","large":"_9tjyT9QUtP8-","text":"QmMiyoAWp-g-","invalid":"XWDSfe6weSY-","disabled":"Tz9LK9ABKMk-","small":"Sw5O4I0lMJg-","inline":"SaORbL7SYWY-","center":"ozy2UoT2vsg-","right":"_3TJdT91YD3c-","maxLength":"W6GrMqLy2qk-","inputWrapper":"-LmjnYRU0r0-","childrenWrapper":"yVXYv6hkuOA-","input":"vtSDcuzNr9Q-","emptyPhoneNumber":"MVhuQuzUBUs-","label":"Dgk00tzlODA-","select":"NwQGiWBWIsc-","externalLabel":"Qb8zQ8n-8vc-","postfix":"yTDzs9h1otI-","affixIcon":"m0YpdssD2dY-","suffix":"_-3mMnjSh6ok-","hasAction":"OLE9N3Uem4o-","affixLabel":"-Wzcb0pBh5I-","description":"DHX5ijY3xIw-","toolbar":"AL-2brNI7dk-","spinning":"_8Rzv7CcDW80-"};
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
@@ -316,14 +316,19 @@ function useAtlantisFormFieldActions({ name, onChange, inputRef, onControllerCha
|
|
|
316
316
|
/**
|
|
317
317
|
* Provides the props for the html fields rendered by the FormField component
|
|
318
318
|
*/
|
|
319
|
-
function useAtlantisFormField({ id, nameProp, name, useControllerField: useControllerField, description, disabled, readonly, keyboard, autofocus, handleChange, handleBlur, handleFocus, inline, validations, handleKeyDown, handleValidation, errorMessage, }) {
|
|
319
|
+
function useAtlantisFormField({ id, nameProp, name, useControllerField: useControllerField, description, disabled, readonly, keyboard, autofocus, pattern, type, value, handleChange, handleBlur, handleFocus, inline, validations, handleKeyDown, handleValidation, errorMessage, }) {
|
|
320
320
|
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
321
|
-
const fieldProps = Object.assign(Object.assign(Object.assign({}, useControllerField), { id, className: styles$1.input,
|
|
321
|
+
const fieldProps = Object.assign(Object.assign(Object.assign({}, useControllerField), { id, className: classnames(styles$1.input, {
|
|
322
|
+
[styles$1.emptyPhoneNumber]: shouldAddPhoneNumberClass(type, value, pattern),
|
|
323
|
+
}), name: (validations || nameProp) && name, disabled: disabled, readOnly: readonly, inputMode: keyboard, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, autoFocus: autofocus }), (description &&
|
|
322
324
|
!inline && { "aria-describedby": descriptionIdentifier }));
|
|
323
325
|
const textFieldProps = Object.assign(Object.assign({}, fieldProps), { autoFocus: autofocus, onKeyDown: handleKeyDown });
|
|
324
326
|
React.useEffect(() => handleValidation(errorMessage), [errorMessage]);
|
|
325
327
|
return { textFieldProps, fieldProps, descriptionIdentifier };
|
|
326
328
|
}
|
|
329
|
+
function shouldAddPhoneNumberClass(type, value, pattern) {
|
|
330
|
+
return type === "tel" && !value && pattern && pattern[0] === "(";
|
|
331
|
+
}
|
|
327
332
|
|
|
328
333
|
function useAtlantisFormFieldName({ id, nameProp, }) {
|
|
329
334
|
/**
|
|
@@ -397,7 +402,7 @@ function FormField(props) {
|
|
|
397
402
|
return React.createElement(FormFieldInternal, Object.assign({}, props, { id: id }));
|
|
398
403
|
}
|
|
399
404
|
function FormFieldInternal(props) {
|
|
400
|
-
const { actionsRef, autocomplete = true, children, defaultValue, description, disabled, id, inputRef, inline, keyboard, max, maxLength, min, name: nameProp, readonly, rows, loading, type = "text", validations, value, onChange, onEnter, onFocus, onBlur, onValidation, onKeyUp, clearable = "never", autofocus, } = props;
|
|
405
|
+
const { actionsRef, autocomplete = true, children, defaultValue, description, disabled, id, inputRef, inline, keyboard, max, maxLength, min, name: nameProp, pattern, readonly, rows, loading, type = "text", validations, value, onChange, onEnter, onFocus, onBlur, onValidation, onKeyUp, clearable = "never", autofocus, } = props;
|
|
401
406
|
const { name } = useAtlantisFormFieldName({ id, nameProp });
|
|
402
407
|
const { errorMessage, inputRefs, useControllerField, setValue, onControllerBlur, onControllerChange, } = useAtlantisReactHookForm({
|
|
403
408
|
actionsRef,
|
|
@@ -432,6 +437,9 @@ function FormFieldInternal(props) {
|
|
|
432
437
|
readonly,
|
|
433
438
|
keyboard,
|
|
434
439
|
autofocus,
|
|
440
|
+
value,
|
|
441
|
+
type,
|
|
442
|
+
pattern,
|
|
435
443
|
handleChange,
|
|
436
444
|
handleBlur,
|
|
437
445
|
handleFocus,
|
package/dist/FormField-es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { useState, useEffect, useRef, useImperativeHandle, useId } from 'react';
|
|
2
2
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
3
3
|
import { tokens } from '@jobber/design';
|
|
4
4
|
import classnames from 'classnames';
|
|
@@ -31,7 +31,7 @@ function useShowClear({ clearable, multiline, focused, hasValue, disabled = fals
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
var styles$1 = {"container":"YL-mNv-Bl6g-","wrapper":"_8lhbGTQ-hhg-","horizontalWrapper":"b5mv1x1H7YE-","textarea":"hGr6YW4AeLM-","safari":"QBCWi9GBgMs-","timeInputLabel":"_0pmqVa2zSE4-","miniLabel":"F1t76G6bDKo-","large":"_9tjyT9QUtP8-","text":"QmMiyoAWp-g-","invalid":"XWDSfe6weSY-","disabled":"Tz9LK9ABKMk-","small":"Sw5O4I0lMJg-","inline":"SaORbL7SYWY-","center":"ozy2UoT2vsg-","right":"_3TJdT91YD3c-","maxLength":"W6GrMqLy2qk-","inputWrapper":"-LmjnYRU0r0-","childrenWrapper":"yVXYv6hkuOA-","input":"vtSDcuzNr9Q-","label":"Dgk00tzlODA-","select":"NwQGiWBWIsc-","externalLabel":"Qb8zQ8n-8vc-","postfix":"yTDzs9h1otI-","affixIcon":"m0YpdssD2dY-","suffix":"_-3mMnjSh6ok-","hasAction":"OLE9N3Uem4o-","affixLabel":"-Wzcb0pBh5I-","description":"DHX5ijY3xIw-","toolbar":"AL-2brNI7dk-","spinning":"_8Rzv7CcDW80-"};
|
|
34
|
+
var styles$1 = {"container":"YL-mNv-Bl6g-","wrapper":"_8lhbGTQ-hhg-","horizontalWrapper":"b5mv1x1H7YE-","textarea":"hGr6YW4AeLM-","safari":"QBCWi9GBgMs-","timeInputLabel":"_0pmqVa2zSE4-","miniLabel":"F1t76G6bDKo-","large":"_9tjyT9QUtP8-","text":"QmMiyoAWp-g-","invalid":"XWDSfe6weSY-","disabled":"Tz9LK9ABKMk-","small":"Sw5O4I0lMJg-","inline":"SaORbL7SYWY-","center":"ozy2UoT2vsg-","right":"_3TJdT91YD3c-","maxLength":"W6GrMqLy2qk-","inputWrapper":"-LmjnYRU0r0-","childrenWrapper":"yVXYv6hkuOA-","input":"vtSDcuzNr9Q-","emptyPhoneNumber":"MVhuQuzUBUs-","label":"Dgk00tzlODA-","select":"NwQGiWBWIsc-","externalLabel":"Qb8zQ8n-8vc-","postfix":"yTDzs9h1otI-","affixIcon":"m0YpdssD2dY-","suffix":"_-3mMnjSh6ok-","hasAction":"OLE9N3Uem4o-","affixLabel":"-Wzcb0pBh5I-","description":"DHX5ijY3xIw-","toolbar":"AL-2brNI7dk-","spinning":"_8Rzv7CcDW80-"};
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
@@ -42,7 +42,7 @@ function AffixLabel({ label, variation = "prefix", labelRef, }) {
|
|
|
42
42
|
});
|
|
43
43
|
if (!label)
|
|
44
44
|
return null;
|
|
45
|
-
return (
|
|
45
|
+
return (React__default.createElement("div", { ref: labelRef, className: affixLabelClass }, label));
|
|
46
46
|
}
|
|
47
47
|
function AffixIcon({ icon, onClick, ariaLabel, variation = "prefix", size, }) {
|
|
48
48
|
const affixIconClass = classnames(styles$1.affixIcon, {
|
|
@@ -52,7 +52,7 @@ function AffixIcon({ icon, onClick, ariaLabel, variation = "prefix", size, }) {
|
|
|
52
52
|
const iconSize = size === "small" ? "small" : "base";
|
|
53
53
|
if (!icon)
|
|
54
54
|
return null;
|
|
55
|
-
return (
|
|
55
|
+
return (React__default.createElement("div", { className: affixIconClass }, onClick ? (React__default.createElement(Button
|
|
56
56
|
/**
|
|
57
57
|
* We can cast the ariaLabel here as a `Suffix`
|
|
58
58
|
* requires an ariaLabel if there is an action
|
|
@@ -62,14 +62,14 @@ function AffixIcon({ icon, onClick, ariaLabel, variation = "prefix", size, }) {
|
|
|
62
62
|
* We can cast the ariaLabel here as a `Suffix`
|
|
63
63
|
* requires an ariaLabel if there is an action
|
|
64
64
|
*/
|
|
65
|
-
ariaLabel: ariaLabel, icon: icon, onClick: onClick, variation: "subtle", type: "tertiary", size: iconSize })) : (
|
|
65
|
+
ariaLabel: ariaLabel, icon: icon, onClick: onClick, variation: "subtle", type: "tertiary", size: iconSize })) : (React__default.createElement(Icon, { name: icon, size: iconSize, color: "greyBlue" }))));
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
function FormFieldDescription({ id, description, visible = true, }) {
|
|
69
69
|
if (!visible)
|
|
70
70
|
return null;
|
|
71
|
-
return (
|
|
72
|
-
|
|
71
|
+
return (React__default.createElement("div", { id: id, className: styles$1.description },
|
|
72
|
+
React__default.createElement(Text, { size: "small", variation: "subdued" }, description)));
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
var styles = {"clearInput":"YmRTd-KeXv4-","spinning":"B25z9B8I3gs-"};
|
|
@@ -77,8 +77,8 @@ var styles = {"clearInput":"YmRTd-KeXv4-","spinning":"B25z9B8I3gs-"};
|
|
|
77
77
|
function ClearAction({ onClick, visible, }) {
|
|
78
78
|
if (!visible)
|
|
79
79
|
return null;
|
|
80
|
-
return (
|
|
81
|
-
|
|
80
|
+
return (React__default.createElement("button", { className: styles.clearInput, onClick: onClick, type: "button", "aria-label": "Clear input" },
|
|
81
|
+
React__default.createElement(Icon, { name: "remove", size: "small" })));
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
function useToolbar(props) {
|
|
@@ -199,61 +199,61 @@ function FormFieldWrapper({ align, description, descriptionIdentifier, placehold
|
|
|
199
199
|
toolbar,
|
|
200
200
|
toolbarVisibility,
|
|
201
201
|
});
|
|
202
|
-
return (
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
(showMiniLabel || !value) && (
|
|
202
|
+
return (React__default.createElement("div", { className: containerClasses },
|
|
203
|
+
React__default.createElement("div", { className: wrapperClasses, style: wrapperInlineStyle, "data-testid": "Form-Field-Wrapper", ref: wrapperRef },
|
|
204
|
+
React__default.createElement(FormFieldInputHorizontalWrapper, null,
|
|
205
|
+
React__default.createElement(AffixIcon, Object.assign({}, prefix, { size: size })),
|
|
206
|
+
React__default.createElement(FormFieldInputWrapperStyles, null,
|
|
207
|
+
(showMiniLabel || !value) && (React__default.createElement(FormFieldLabel, { htmlFor: identifier, style: (prefixRef === null || prefixRef === void 0 ? void 0 : prefixRef.current) || (suffixRef === null || suffixRef === void 0 ? void 0 : suffixRef.current)
|
|
208
208
|
? labelStyle
|
|
209
209
|
: undefined }, placeholder)),
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
210
|
+
React__default.createElement(AffixLabel, Object.assign({}, prefix, { labelRef: prefixRef })),
|
|
211
|
+
React__default.createElement(FormFieldWrapperMain, null, children),
|
|
212
|
+
React__default.createElement(AffixLabel, Object.assign({}, suffix, { labelRef: suffixRef, variation: "suffix" }))),
|
|
213
|
+
React__default.createElement(ClearAction, { onClick: onClear, visible: showClear }),
|
|
214
|
+
React__default.createElement(AffixIcon, Object.assign({}, suffix, { variation: "suffix", size: size }))),
|
|
215
|
+
React__default.createElement(FormFieldWrapperToolbar, { toolbarVisibility: toolbarVisibility, isToolbarVisible: isToolbarVisible, toolbarAnimationEnd: toolbarAnimationEnd, toolbarAnimationStart: toolbarAnimationStart, toolbar: toolbar })),
|
|
216
|
+
React__default.createElement(FormFieldDescription, { visible: !!description && !inline, id: descriptionIdentifier, description: description }),
|
|
217
|
+
React__default.createElement(InputValidation, { message: error, visible: !!error && !inline })));
|
|
218
218
|
}
|
|
219
219
|
/**
|
|
220
220
|
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
221
221
|
*/
|
|
222
222
|
function FormFieldInputHorizontalWrapper({ children, }) {
|
|
223
|
-
return
|
|
223
|
+
return React__default.createElement("div", { className: styles$1.horizontalWrapper }, children);
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
226
226
|
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
227
227
|
*/
|
|
228
228
|
function FormFieldInputWrapperStyles({ children, }) {
|
|
229
|
-
return
|
|
229
|
+
return React__default.createElement("div", { className: styles$1.inputWrapper }, children);
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
232
|
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
233
233
|
*/
|
|
234
234
|
function FormFieldWrapperMain({ children, tabIndex = -1, }) {
|
|
235
|
-
return (
|
|
235
|
+
return (React__default.createElement("div", { className: styles$1.childrenWrapper, tabIndex: tabIndex }, children));
|
|
236
236
|
}
|
|
237
237
|
function FormFieldLabel({ children, htmlFor, style, external = false, }) {
|
|
238
238
|
if (!children)
|
|
239
239
|
return null;
|
|
240
|
-
return (
|
|
240
|
+
return (React__default.createElement("label", { className: external ? styles$1.externalLabel : styles$1.label, htmlFor: htmlFor, style: style }, children));
|
|
241
241
|
}
|
|
242
242
|
/**
|
|
243
243
|
* @internal Reach out to UX Foundations if using this component since it is possible it might change
|
|
244
244
|
*/
|
|
245
245
|
function FormFieldWrapperToolbar({ toolbar, isToolbarVisible, toolbarAnimationEnd, toolbarAnimationStart, toolbarVisibility, }) {
|
|
246
|
-
return (
|
|
246
|
+
return (React__default.createElement(AnimatePresence, { initial: toolbarVisibility === "always" ? false : true }, isToolbarVisible && (React__default.createElement(motion.div, { key: "toolbar", initial: toolbarAnimationEnd, animate: toolbarAnimationStart, exit: toolbarAnimationEnd, transition: {
|
|
247
247
|
duration: tokens["timing-base"] / 1000,
|
|
248
248
|
ease: "easeInOut",
|
|
249
249
|
}, tabIndex: -1 },
|
|
250
|
-
|
|
250
|
+
React__default.createElement("div", { className: styles$1.toolbar, "data-testid": "ATL-InputText-Toolbar" }, toolbar)))));
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
function FormFieldPostFix({ variation, visible = true, }) {
|
|
254
254
|
if (!visible)
|
|
255
255
|
return null;
|
|
256
|
-
return (
|
|
256
|
+
return (React__default.createElement("span", { className: styles$1.postfix }, variation === "select" ? (React__default.createElement(Icon, { name: "arrowDown" })) : (React__default.createElement(Spinner, { size: "small" }))));
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
/**
|
|
@@ -314,14 +314,19 @@ function useAtlantisFormFieldActions({ name, onChange, inputRef, onControllerCha
|
|
|
314
314
|
/**
|
|
315
315
|
* Provides the props for the html fields rendered by the FormField component
|
|
316
316
|
*/
|
|
317
|
-
function useAtlantisFormField({ id, nameProp, name, useControllerField: useControllerField, description, disabled, readonly, keyboard, autofocus, handleChange, handleBlur, handleFocus, inline, validations, handleKeyDown, handleValidation, errorMessage, }) {
|
|
317
|
+
function useAtlantisFormField({ id, nameProp, name, useControllerField: useControllerField, description, disabled, readonly, keyboard, autofocus, pattern, type, value, handleChange, handleBlur, handleFocus, inline, validations, handleKeyDown, handleValidation, errorMessage, }) {
|
|
318
318
|
const descriptionIdentifier = `descriptionUUID--${id}`;
|
|
319
|
-
const fieldProps = Object.assign(Object.assign(Object.assign({}, useControllerField), { id, className: styles$1.input,
|
|
319
|
+
const fieldProps = Object.assign(Object.assign(Object.assign({}, useControllerField), { id, className: classnames(styles$1.input, {
|
|
320
|
+
[styles$1.emptyPhoneNumber]: shouldAddPhoneNumberClass(type, value, pattern),
|
|
321
|
+
}), name: (validations || nameProp) && name, disabled: disabled, readOnly: readonly, inputMode: keyboard, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, autoFocus: autofocus }), (description &&
|
|
320
322
|
!inline && { "aria-describedby": descriptionIdentifier }));
|
|
321
323
|
const textFieldProps = Object.assign(Object.assign({}, fieldProps), { autoFocus: autofocus, onKeyDown: handleKeyDown });
|
|
322
324
|
useEffect(() => handleValidation(errorMessage), [errorMessage]);
|
|
323
325
|
return { textFieldProps, fieldProps, descriptionIdentifier };
|
|
324
326
|
}
|
|
327
|
+
function shouldAddPhoneNumberClass(type, value, pattern) {
|
|
328
|
+
return type === "tel" && !value && pattern && pattern[0] === "(";
|
|
329
|
+
}
|
|
325
330
|
|
|
326
331
|
function useAtlantisFormFieldName({ id, nameProp, }) {
|
|
327
332
|
/**
|
|
@@ -392,10 +397,10 @@ function FormField(props) {
|
|
|
392
397
|
// https://github.com/facebook/react/issues/27103
|
|
393
398
|
const generatedId = useId();
|
|
394
399
|
const id = props.id || generatedId;
|
|
395
|
-
return
|
|
400
|
+
return React__default.createElement(FormFieldInternal, Object.assign({}, props, { id: id }));
|
|
396
401
|
}
|
|
397
402
|
function FormFieldInternal(props) {
|
|
398
|
-
const { actionsRef, autocomplete = true, children, defaultValue, description, disabled, id, inputRef, inline, keyboard, max, maxLength, min, name: nameProp, readonly, rows, loading, type = "text", validations, value, onChange, onEnter, onFocus, onBlur, onValidation, onKeyUp, clearable = "never", autofocus, } = props;
|
|
403
|
+
const { actionsRef, autocomplete = true, children, defaultValue, description, disabled, id, inputRef, inline, keyboard, max, maxLength, min, name: nameProp, pattern, readonly, rows, loading, type = "text", validations, value, onChange, onEnter, onFocus, onBlur, onValidation, onKeyUp, clearable = "never", autofocus, } = props;
|
|
399
404
|
const { name } = useAtlantisFormFieldName({ id, nameProp });
|
|
400
405
|
const { errorMessage, inputRefs, useControllerField, setValue, onControllerBlur, onControllerChange, } = useAtlantisReactHookForm({
|
|
401
406
|
actionsRef,
|
|
@@ -430,6 +435,9 @@ function FormFieldInternal(props) {
|
|
|
430
435
|
readonly,
|
|
431
436
|
keyboard,
|
|
432
437
|
autofocus,
|
|
438
|
+
value,
|
|
439
|
+
type,
|
|
440
|
+
pattern,
|
|
433
441
|
handleChange,
|
|
434
442
|
handleBlur,
|
|
435
443
|
handleFocus,
|
|
@@ -438,19 +446,19 @@ function FormFieldInternal(props) {
|
|
|
438
446
|
handleValidation,
|
|
439
447
|
handleKeyDown,
|
|
440
448
|
});
|
|
441
|
-
return (
|
|
449
|
+
return (React__default.createElement(FormFieldWrapper, Object.assign({}, props, { value: useControllerField.value, error: errorMessage, identifier: id, descriptionIdentifier: descriptionIdentifier, clearable: clearable, onClear: handleClear }), renderField()));
|
|
442
450
|
function renderField() {
|
|
443
451
|
switch (type) {
|
|
444
452
|
case "select":
|
|
445
|
-
return (
|
|
446
|
-
|
|
447
|
-
|
|
453
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
454
|
+
React__default.createElement("select", Object.assign({}, fieldProps), children),
|
|
455
|
+
React__default.createElement(FormFieldPostFix, { variation: "select" })));
|
|
448
456
|
case "textarea":
|
|
449
|
-
return
|
|
457
|
+
return React__default.createElement("textarea", Object.assign({}, textFieldProps, { rows: rows, ref: inputRefs }));
|
|
450
458
|
default:
|
|
451
|
-
return (
|
|
452
|
-
|
|
453
|
-
loading &&
|
|
459
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
460
|
+
React__default.createElement("input", Object.assign({}, textFieldProps, { autoComplete: setAutocomplete(autocomplete), type: type, maxLength: maxLength, max: max, min: min, ref: inputRefs, onKeyUp: onKeyUp })),
|
|
461
|
+
loading && React__default.createElement(FormFieldPostFix, { variation: "spinner" }),
|
|
454
462
|
children));
|
|
455
463
|
}
|
|
456
464
|
}
|
package/dist/FormatDate-es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
|
|
3
3
|
function FormatDate({ date: inputDate, showYear = true, }) {
|
|
4
4
|
let dateObject;
|
|
@@ -8,7 +8,7 @@ function FormatDate({ date: inputDate, showYear = true, }) {
|
|
|
8
8
|
else {
|
|
9
9
|
dateObject = new Date(inputDate);
|
|
10
10
|
}
|
|
11
|
-
return
|
|
11
|
+
return React__default.createElement(React__default.Fragment, null, strFormatDate(dateObject, showYear));
|
|
12
12
|
}
|
|
13
13
|
function strFormatDate(date, showYear = true) {
|
|
14
14
|
let formatOptions = {
|
package/dist/FormatEmail-es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
|
|
4
4
|
var styles = {"email":"ViFkIUcS6PM-","spinning":"nCTmCxv5074-"};
|
|
5
5
|
|
|
6
6
|
function FormatEmail({ email }) {
|
|
7
7
|
const className = classnames(styles.email);
|
|
8
|
-
return
|
|
8
|
+
return React__default.createElement("address", { className: className }, email);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export { FormatEmail as F };
|