@4alldigital/foundation-ui--gamma 1.24.0 → 1.27.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/foundation-ui.css +1 -1
- package/dist/index.esm.js +205 -187
- package/dist/index.js +214 -196
- package/dist/types/fui/components/Button/Button.d.ts +1 -1
- package/dist/types/fui/components/Button/Button.stories.d.ts +1 -0
- package/dist/types/fui/components/Button/Button.types.d.ts +1 -0
- package/dist/types/fui/components/Card/Card.d.ts +8 -0
- package/dist/types/fui/components/Card/Card.stories.d.ts +6 -0
- package/dist/types/fui/components/Card/Card.test.d.ts +1 -0
- package/dist/types/fui/components/Card/Card.types.d.ts +27 -0
- package/dist/types/fui/components/Card/index.d.ts +1 -0
- package/dist/types/fui/components/Card/types/CardBasic/CardBasic.d.ts +8 -0
- package/dist/types/fui/components/Card/types/CardBasic/CardBasic.stories.d.ts +6 -0
- package/dist/types/fui/components/Card/types/CardBasic/CardBasic.test.d.ts +1 -0
- package/dist/types/fui/components/Card/types/CardBasic/CardBasic.types.d.ts +4 -0
- package/dist/types/fui/components/Card/types/CardBasic/index.d.ts +1 -0
- package/dist/types/fui/components/Card/types/CardMedia/CardMedia.d.ts +8 -0
- package/dist/types/fui/components/Card/types/CardMedia/CardMedia.stories.d.ts +6 -0
- package/dist/types/fui/components/Card/types/CardMedia/CardMedia.test.d.ts +1 -0
- package/dist/types/fui/components/Card/types/CardMedia/CardMedia.types.d.ts +4 -0
- package/dist/types/fui/components/Card/types/CardMedia/index.d.ts +1 -0
- package/dist/types/fui/components/Card/types/CardVideo/CardVideo.d.ts +8 -0
- package/dist/types/fui/components/Card/types/CardVideo/CardVideo.stories.d.ts +6 -0
- package/dist/types/fui/components/Card/types/CardVideo/CardVideo.test.d.ts +1 -0
- package/dist/types/fui/components/Card/types/CardVideo/CardVideo.types.d.ts +4 -0
- package/dist/types/fui/components/Card/types/CardVideo/index.d.ts +1 -0
- package/dist/types/fui/components/Checkbox/Checkbox.types.d.ts +4 -1
- package/dist/types/fui/components/Container/Container.d.ts +1 -1
- package/dist/types/fui/components/Container/Container.types.d.ts +2 -0
- package/dist/types/fui/components/ContentPageLayout/ContentPageLayout.types.d.ts +2 -2
- package/dist/types/fui/components/ContentRowsLayout/ContentRowsLayout.types.d.ts +2 -2
- package/dist/types/fui/components/Copy/Copy.d.ts +1 -1
- package/dist/types/fui/components/Copy/Copy.types.d.ts +13 -11
- package/dist/types/fui/components/Form/Form.d.ts +1 -1
- package/dist/types/fui/components/Form/Form.stories.d.ts +1 -0
- package/dist/types/fui/components/Form/Form.types.d.ts +8 -5
- package/dist/types/fui/components/FormField/FormField.d.ts +1 -1
- package/dist/types/fui/components/FormField/FormField.stories.d.ts +1 -0
- package/dist/types/fui/components/FormField/FormField.types.d.ts +10 -8
- package/dist/types/fui/components/FormSelect/FormSelect.d.ts +1 -4
- package/dist/types/fui/components/FormSelect/FormSelect.types.d.ts +7 -5
- package/dist/types/fui/components/Heading/Heading.types.d.ts +6 -6
- package/dist/types/fui/components/Label/Label.d.ts +1 -1
- package/dist/types/fui/components/Label/Label.types.d.ts +6 -2
- package/dist/types/fui/components/Link/Link.types.d.ts +1 -1
- package/dist/types/fui/components/Notice/Notice.d.ts +1 -1
- package/dist/types/fui/components/Notice/Notice.types.d.ts +1 -1
- package/dist/types/fui/components/Radio/Radio.types.d.ts +2 -1
- package/dist/types/fui/components/TextInput/TextInput.types.d.ts +2 -1
- package/dist/types/fui/components/index.d.ts +23 -0
- package/dist/types/fui/features/Search/Search.d.ts +5 -0
- package/dist/types/fui/features/Search/Search.stories.d.ts +6 -0
- package/dist/types/fui/features/Search/Search.test.d.ts +1 -0
- package/dist/types/fui/features/Search/Search.types.d.ts +10 -0
- package/dist/types/fui/features/Search/index.d.ts +1 -0
- package/dist/types/fui/features/Search/view-helpers/appendClassName.d.ts +1 -0
- package/dist/types/fui/features/Search/view-helpers/formatResult.d.ts +3 -0
- package/dist/types/fui/features/Search/view-helpers/getFilterValueDisplay.d.ts +1 -0
- package/dist/types/fui/features/Search/view-helpers/getUrlSanitizer.d.ts +6 -0
- package/dist/types/fui/features/Search/view-helpers/index.d.ts +4 -0
- package/dist/types/fui/features/Search/views/Layout/Layout.d.ts +7 -0
- package/dist/types/fui/features/Search/views/Layout/Layout.stories.d.ts +6 -0
- package/dist/types/fui/features/Search/views/Layout/Layout.test.d.ts +1 -0
- package/dist/types/fui/features/Search/views/Layout/Layout.types.d.ts +10 -0
- package/dist/types/fui/features/Search/views/Layout/index.d.ts +1 -0
- package/dist/types/fui/features/Search/views/MultiCheckboxFacet/MultiCheckboxFacet.d.ts +7 -0
- package/dist/types/fui/features/Search/views/MultiCheckboxFacet/MultiCheckboxFacet.stories.d.ts +6 -0
- package/dist/types/fui/features/Search/views/MultiCheckboxFacet/MultiCheckboxFacet.test.d.ts +1 -0
- package/dist/types/fui/features/Search/views/MultiCheckboxFacet/MultiCheckboxFacet.types.d.ts +4 -0
- package/dist/types/fui/features/Search/views/MultiCheckboxFacet/index.d.ts +1 -0
- package/dist/types/fui/features/Search/views/Paging/Paging.d.ts +7 -0
- package/dist/types/fui/features/Search/views/Paging/Paging.stories.d.ts +6 -0
- package/dist/types/fui/features/Search/views/Paging/Paging.test.d.ts +1 -0
- package/dist/types/fui/features/Search/views/Paging/Paging.types.d.ts +14 -0
- package/dist/types/fui/features/Search/views/Paging/index.d.ts +1 -0
- package/dist/types/fui/features/Search/views/PagingInfo/PagingInfo.d.ts +8 -0
- package/dist/types/fui/features/Search/views/PagingInfo/PagingInfo.stories.d.ts +6 -0
- package/dist/types/fui/features/Search/views/PagingInfo/PagingInfo.test.d.ts +1 -0
- package/dist/types/fui/features/Search/views/PagingInfo/PagingInfo.types.d.ts +16 -0
- package/dist/types/fui/features/Search/views/PagingInfo/index.d.ts +1 -0
- package/dist/types/fui/features/Search/views/Result/Result.d.ts +7 -0
- package/dist/types/fui/features/Search/views/Result/Result.stories.d.ts +6 -0
- package/dist/types/fui/features/Search/views/Result/Result.test.d.ts +1 -0
- package/dist/types/fui/features/Search/views/Result/Result.types.d.ts +22 -0
- package/dist/types/fui/features/Search/views/Result/index.d.ts +1 -0
- package/dist/types/fui/features/Search/views/Results/Results.d.ts +8 -0
- package/dist/types/fui/features/Search/views/Results/Results.stories.d.ts +6 -0
- package/dist/types/fui/features/Search/views/Results/Results.test.d.ts +1 -0
- package/dist/types/fui/features/Search/views/Results/Results.types.d.ts +19 -0
- package/dist/types/fui/features/Search/views/Results/index.d.ts +1 -0
- package/dist/types/fui/features/Search/views/ResultsPerPage/ResultsPerPage.d.ts +7 -0
- package/dist/types/fui/features/Search/views/ResultsPerPage/ResultsPerPage.stories.d.ts +6 -0
- package/dist/types/fui/features/Search/views/ResultsPerPage/ResultsPerPage.test.d.ts +1 -0
- package/dist/types/fui/features/Search/views/ResultsPerPage/ResultsPerPage.types.d.ts +17 -0
- package/dist/types/fui/features/Search/views/ResultsPerPage/index.d.ts +1 -0
- package/dist/types/fui/features/Search/views/SearchBox/SearchBox.d.ts +7 -0
- package/dist/types/fui/features/Search/views/SearchBox/SearchBox.stories.d.ts +6 -0
- package/dist/types/fui/features/Search/views/SearchBox/SearchBox.test.d.ts +1 -0
- package/dist/types/fui/features/Search/views/SearchBox/SearchBox.types.d.ts +6 -0
- package/dist/types/fui/features/Search/views/SearchBox/index.d.ts +1 -0
- package/dist/types/fui/features/Search/views/Sidebar/Sidebar.d.ts +8 -0
- package/dist/types/fui/features/Search/views/Sidebar/Sidebar.stories.d.ts +6 -0
- package/dist/types/fui/features/Search/views/Sidebar/Sidebar.test.d.ts +1 -0
- package/dist/types/fui/features/Search/views/Sidebar/Sidebar.types.d.ts +3 -0
- package/dist/types/fui/features/Search/views/Sidebar/index.d.ts +1 -0
- package/dist/types/fui/features/Search/views/SingleLinksFacet/SingleLinksFacet.d.ts +7 -0
- package/dist/types/fui/features/Search/views/SingleLinksFacet/SingleLinksFacet.stories.d.ts +6 -0
- package/dist/types/fui/features/Search/views/SingleLinksFacet/SingleLinksFacet.test.d.ts +1 -0
- package/dist/types/fui/features/Search/views/SingleLinksFacet/SingleLinksFacet.types.d.ts +4 -0
- package/dist/types/fui/features/Search/views/SingleLinksFacet/index.d.ts +1 -0
- package/dist/types/fui/features/Search/views/SingleSelectFacet/SingleSelectFacet.d.ts +7 -0
- package/dist/types/fui/features/Search/views/SingleSelectFacet/SingleSelectFacet.stories.d.ts +6 -0
- package/dist/types/fui/features/Search/views/SingleSelectFacet/SingleSelectFacet.test.d.ts +1 -0
- package/dist/types/fui/features/Search/views/SingleSelectFacet/SingleSelectFacet.types.d.ts +4 -0
- package/dist/types/fui/features/Search/views/SingleSelectFacet/index.d.ts +1 -0
- package/dist/types/fui/features/Search/views/Sorting/Sorting.d.ts +7 -0
- package/dist/types/fui/features/Search/views/Sorting/Sorting.stories.d.ts +6 -0
- package/dist/types/fui/features/Search/views/Sorting/Sorting.test.d.ts +1 -0
- package/dist/types/fui/features/Search/views/Sorting/Sorting.types.d.ts +20 -0
- package/dist/types/fui/features/Search/views/Sorting/index.d.ts +1 -0
- package/package.json +4 -31
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var cx = require('classnames');
|
|
5
5
|
var react = require('@iconify/react');
|
|
6
|
-
var reactHookForm = require('react-hook-form');
|
|
7
6
|
var React = require('react');
|
|
7
|
+
var reactHookForm = require('react-hook-form');
|
|
8
8
|
|
|
9
9
|
var Blockquote = function (_a) {
|
|
10
10
|
var text = _a.text, citation = _a.citation, className = _a.className, citationAttribute = _a.citationAttribute, _b = _a.showIcon, showIcon = _b === void 0 ? true : _b;
|
|
@@ -13,27 +13,47 @@ var Blockquote = function (_a) {
|
|
|
13
13
|
};
|
|
14
14
|
Blockquote.displayName = 'Blockquote';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
exports.BTN_TYPES = void 0;
|
|
17
17
|
(function (BTN_TYPES) {
|
|
18
18
|
BTN_TYPES["SUBMIT"] = "submit";
|
|
19
19
|
BTN_TYPES["RESET"] = "reset";
|
|
20
20
|
BTN_TYPES["BUTTON"] = "button";
|
|
21
|
-
})(BTN_TYPES || (BTN_TYPES = {}));
|
|
22
|
-
|
|
21
|
+
})(exports.BTN_TYPES || (exports.BTN_TYPES = {}));
|
|
22
|
+
exports.BTN_VARIANTS = void 0;
|
|
23
23
|
(function (BTN_VARIANTS) {
|
|
24
24
|
BTN_VARIANTS["PRIMARY"] = "primary";
|
|
25
25
|
BTN_VARIANTS["SECONDARY"] = "secondary";
|
|
26
26
|
BTN_VARIANTS["TERTIARY"] = "tertiary";
|
|
27
|
-
})(BTN_VARIANTS || (BTN_VARIANTS = {}));
|
|
28
|
-
|
|
27
|
+
})(exports.BTN_VARIANTS || (exports.BTN_VARIANTS = {}));
|
|
28
|
+
exports.BTN_SIZES = void 0;
|
|
29
29
|
(function (BTN_SIZES) {
|
|
30
30
|
BTN_SIZES["SMALL"] = "small";
|
|
31
31
|
BTN_SIZES["MEDIUM"] = "medium";
|
|
32
32
|
BTN_SIZES["LARGE"] = "large";
|
|
33
|
-
})(BTN_SIZES || (BTN_SIZES = {}));
|
|
33
|
+
})(exports.BTN_SIZES || (exports.BTN_SIZES = {}));
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Icon component
|
|
37
|
+
* List of supported icons can be found at https://icon-sets.iconify.design.
|
|
38
|
+
*/
|
|
39
|
+
var Icon = function (_a) {
|
|
40
|
+
var name = _a.name, _b = _a.size, size = _b === void 0 ? 24 : _b, color = _a.color, id = _a.id, className = _a.className, testID = _a.testID;
|
|
41
|
+
if (color) {
|
|
42
|
+
return (jsxRuntime.jsx(react.Icon, { "data-testid": testID || id || 'Icon', icon: name, width: size, height: size, color: color, className: className, fill: color || 'currentColor' }));
|
|
43
|
+
}
|
|
44
|
+
return (jsxRuntime.jsx(react.Icon, { "data-testid": testID || id || 'Icon', icon: name, width: size, height: size }));
|
|
45
|
+
};
|
|
46
|
+
Icon.displayName = 'Icon';
|
|
47
|
+
|
|
48
|
+
var Loader = function (_a) {
|
|
49
|
+
var color = _a.color, _b = _a.size, size = _b === void 0 ? 8 : _b, _c = _a.thickness, thickness = _c === void 0 ? 4 : _c;
|
|
50
|
+
var sizeClass = size ? "w-".concat(size, " h-").concat(size) : 'w-8 h-8';
|
|
51
|
+
return (jsxRuntime.jsx("div", { "data-testid": "Loader", className: 'mr-3 flex items-center justify-center', children: jsxRuntime.jsxs("div", { role: "status", className: 'flex items-center', children: [jsxRuntime.jsxs("svg", { className: "animate-spin ".concat(sizeClass, " text-white"), xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [jsxRuntime.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: color || 'currentColor', strokeWidth: thickness }), jsxRuntime.jsx("path", { className: "opacity-75", fill: color || 'currentColor', d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), jsxRuntime.jsx("span", { className: "sr-only", children: "Loading..." })] }) }));
|
|
52
|
+
};
|
|
53
|
+
Loader.displayName = 'Loader';
|
|
34
54
|
|
|
35
55
|
var Button = function (_a) {
|
|
36
|
-
var _b = _a.variant, variant = _b === void 0 ? BTN_VARIANTS.PRIMARY : _b, _c = _a.size, size = _c === void 0 ? BTN_SIZES.MEDIUM : _c, _d = _a.type, type = _d === void 0 ? BTN_TYPES.BUTTON : _d, _e = _a.wide, wide = _e === void 0 ? true : _e, _f = _a.rounded, rounded = _f === void 0 ? true : _f, _g = _a.raised, raised = _g === void 0 ? true : _g, uppercase = _a.uppercase, children = _a.children, id = _a.id, disabled = _a.disabled, ariaLabel = _a.ariaLabel, onClick = _a.onClick, icon = _a.icon, external = _a.external, iconFirst = _a.iconFirst, outline = _a.outline, testID = _a.testID, className = _a.className;
|
|
56
|
+
var _b = _a.variant, variant = _b === void 0 ? exports.BTN_VARIANTS.PRIMARY : _b, _c = _a.size, size = _c === void 0 ? exports.BTN_SIZES.MEDIUM : _c, _d = _a.type, type = _d === void 0 ? exports.BTN_TYPES.BUTTON : _d, _e = _a.wide, wide = _e === void 0 ? true : _e, _f = _a.rounded, rounded = _f === void 0 ? true : _f, _g = _a.raised, raised = _g === void 0 ? true : _g, uppercase = _a.uppercase, children = _a.children, id = _a.id, disabled = _a.disabled, ariaLabel = _a.ariaLabel, onClick = _a.onClick, icon = _a.icon, external = _a.external, iconFirst = _a.iconFirst, outline = _a.outline, testID = _a.testID, className = _a.className, isLoading = _a.isLoading;
|
|
37
57
|
var smallX = wide ? 'px-5' : 'px-3';
|
|
38
58
|
var mediumX = wide ? 'px-8' : 'px-4';
|
|
39
59
|
var largeX = wide ? 'px-11' : 'px-5';
|
|
@@ -60,50 +80,52 @@ var Button = function (_a) {
|
|
|
60
80
|
icon: 'w-6 h-6',
|
|
61
81
|
},
|
|
62
82
|
};
|
|
63
|
-
var classes = cx('font-
|
|
83
|
+
var classes = cx('appearance-none font-body flex items-center transition-all duration-200 transform active:scale-95 justify-around border-solid border rounded cursor-pointer outline-none focus:outline-none focus-visible:outline-none', { 'text-white border-primary hover:bg-primary-darker': variant === 'primary' }, { 'text-white border-secondary hover:bg-secondary-darker': variant === 'secondary' }, { 'text-black border-tertiary hover:bg-tertiary-darker': variant === 'tertiary' }, { 'bg-primary': variant === 'primary' }, { 'bg-secondary': variant === 'secondary' }, { 'bg-tertiary': variant === 'tertiary' }, { 'border-primary300 dark:border-primary400 hover:border-primary400 dark:hover:border-primary500': outline }, { shadow: raised }, { uppercase: uppercase }, { 'auto-cols-auto grid-cols-2 gap-2': icon || external }, { 'rounded-full': rounded }, { 'flex-row-reverse': iconFirst }, { 'opacity-50 cursor-not-allowed': disabled }, "".concat(sizes[size].y, " ").concat(sizes[size].x, " ").concat(sizes[size].text), className);
|
|
64
84
|
var iconClasses = cx(sizes[size].icon);
|
|
65
|
-
return (jsxRuntime.jsx("button", { id: id, "data-testid": testID || id || 'Button', onClick: onClick, className: classes, type: type, disabled: disabled, "aria-label": ariaLabel, role: "button", children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [children, icon && !external && (jsxRuntime.jsx("span", { className: "flex items-center", children: jsxRuntime.jsx(
|
|
85
|
+
return (jsxRuntime.jsx("button", { id: id, "data-testid": testID || id || 'Button', onClick: onClick, className: classes, type: type, disabled: disabled, "aria-label": ariaLabel, role: "button", children: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isLoading && (jsxRuntime.jsx("div", { className: "flex items-center", children: jsxRuntime.jsx(Loader, { size: 4 }) })), children, icon && !external && (jsxRuntime.jsx("span", { className: "flex items-center", children: jsxRuntime.jsx(Icon, { name: icon, className: iconClasses }) })), external && (jsxRuntime.jsx("span", { className: "flex items-center", children: jsxRuntime.jsx(Icon, { name: "carbon:launch", className: iconClasses }) }))] }) }));
|
|
66
86
|
};
|
|
67
87
|
Button.displayName = 'Button';
|
|
68
88
|
|
|
69
|
-
|
|
70
|
-
(function (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
})(
|
|
77
|
-
|
|
78
|
-
(function (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
})(
|
|
84
|
-
|
|
85
|
-
(function (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
})(
|
|
89
|
-
|
|
90
|
-
(function (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
})(
|
|
95
|
-
|
|
96
|
-
(function (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
})(
|
|
89
|
+
exports.COPY_ALIGN = void 0;
|
|
90
|
+
(function (COPY_ALIGN) {
|
|
91
|
+
COPY_ALIGN["LEFT"] = "left";
|
|
92
|
+
COPY_ALIGN["CENTER"] = "center";
|
|
93
|
+
COPY_ALIGN["RIGHT"] = "right";
|
|
94
|
+
COPY_ALIGN["JUSTIFY"] = "justify";
|
|
95
|
+
COPY_ALIGN["NOWRAP"] = "nowrap";
|
|
96
|
+
})(exports.COPY_ALIGN || (exports.COPY_ALIGN = {}));
|
|
97
|
+
exports.COPY_TRANSFORM = void 0;
|
|
98
|
+
(function (COPY_TRANSFORM) {
|
|
99
|
+
COPY_TRANSFORM["LOWERCASE"] = "lowercase";
|
|
100
|
+
COPY_TRANSFORM["UPPERCASE"] = "uppercase";
|
|
101
|
+
COPY_TRANSFORM["CAPITALIZE"] = "capitalize";
|
|
102
|
+
COPY_TRANSFORM["NORMALCASE"] = "normal-case";
|
|
103
|
+
})(exports.COPY_TRANSFORM || (exports.COPY_TRANSFORM = {}));
|
|
104
|
+
exports.COPY_CONTEXTUAL = void 0;
|
|
105
|
+
(function (COPY_CONTEXTUAL) {
|
|
106
|
+
COPY_CONTEXTUAL["INVERTED"] = "inverted";
|
|
107
|
+
COPY_CONTEXTUAL["MUTED"] = "muted";
|
|
108
|
+
})(exports.COPY_CONTEXTUAL || (exports.COPY_CONTEXTUAL = {}));
|
|
109
|
+
exports.COPY_SIZE = void 0;
|
|
110
|
+
(function (COPY_SIZE) {
|
|
111
|
+
COPY_SIZE["SMALL"] = "small";
|
|
112
|
+
COPY_SIZE["LARGE"] = "large";
|
|
113
|
+
COPY_SIZE["INTRO"] = "intro";
|
|
114
|
+
})(exports.COPY_SIZE || (exports.COPY_SIZE = {}));
|
|
115
|
+
exports.COPY_TAG = void 0;
|
|
116
|
+
(function (COPY_TAG) {
|
|
117
|
+
COPY_TAG["P"] = "p";
|
|
118
|
+
COPY_TAG["SPAN"] = "span";
|
|
119
|
+
COPY_TAG["DIV"] = "div";
|
|
120
|
+
COPY_TAG["SMALL"] = "small";
|
|
121
|
+
})(exports.COPY_TAG || (exports.COPY_TAG = {}));
|
|
102
122
|
|
|
103
123
|
var Copy = function (_a) {
|
|
104
124
|
var _b;
|
|
105
|
-
var children = _a.children, _c = _a.as, Tag = _c === void 0 ?
|
|
106
|
-
var classes = cx((_b = {}, _b["text-".concat(align)] = align, _b), { 'text-sm': size === 'small' }, { 'text-lg': size === 'large' }, { 'text-2xl': size === 'intro' }, { 'mb-3 leading-5': Tag === 'p' }, { 'text-sm': Tag === 'small' },
|
|
125
|
+
var children = _a.children, _c = _a.as, Tag = _c === void 0 ? exports.COPY_TAG.P : _c, size = _a.size, _d = _a.align, align = _d === void 0 ? exports.COPY_ALIGN.LEFT : _d, transform = _a.transform, id = _a.id, className = _a.className, testID = _a.testID;
|
|
126
|
+
var classes = cx((_b = {}, _b["text-".concat(align)] = align, _b), { 'text-sm': size === 'small' }, { 'text-lg': size === 'large' }, { 'text-2xl': size === 'intro' }, { 'mb-3 leading-5 mt-0': Tag === 'p' }, { 'text-sm': Tag === 'small' },
|
|
127
|
+
//'body-text',
|
|
128
|
+
transform, className);
|
|
107
129
|
return (jsxRuntime.jsx(Tag, { "data-testid": testID || id || 'Copy', className: classes, children: children }));
|
|
108
130
|
};
|
|
109
131
|
Copy.displayName = 'Copy';
|
|
@@ -111,33 +133,33 @@ Copy.displayName = 'Copy';
|
|
|
111
133
|
var Hr = function () { return (jsxRuntime.jsx("hr", { className: cx('border-0 border-b border-dark-body-text dark:border-dark-body-text') })); };
|
|
112
134
|
Hr.displayName = 'Hr';
|
|
113
135
|
|
|
114
|
-
|
|
115
|
-
(function (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
})(
|
|
122
|
-
|
|
123
|
-
(function (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
})(
|
|
130
|
-
|
|
131
|
-
(function (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
})(
|
|
136
|
+
exports.HEADING_TAGS = void 0;
|
|
137
|
+
(function (HEADING_TAGS) {
|
|
138
|
+
HEADING_TAGS["H1"] = "h1";
|
|
139
|
+
HEADING_TAGS["H2"] = "h2";
|
|
140
|
+
HEADING_TAGS["H3"] = "h3";
|
|
141
|
+
HEADING_TAGS["H4"] = "h4";
|
|
142
|
+
HEADING_TAGS["H5"] = "h5";
|
|
143
|
+
})(exports.HEADING_TAGS || (exports.HEADING_TAGS = {}));
|
|
144
|
+
exports.HEADING_ALIGN = void 0;
|
|
145
|
+
(function (HEADING_ALIGN) {
|
|
146
|
+
HEADING_ALIGN["LEFT"] = "left";
|
|
147
|
+
HEADING_ALIGN["CENTER"] = "center";
|
|
148
|
+
HEADING_ALIGN["RIGHT"] = "right";
|
|
149
|
+
HEADING_ALIGN["JUSTIFY"] = "justify";
|
|
150
|
+
HEADING_ALIGN["NOWRAP"] = "nowrap";
|
|
151
|
+
})(exports.HEADING_ALIGN || (exports.HEADING_ALIGN = {}));
|
|
152
|
+
exports.HEADING_TRANSFORM = void 0;
|
|
153
|
+
(function (HEADING_TRANSFORM) {
|
|
154
|
+
HEADING_TRANSFORM["LOWERCASE"] = "lowercase";
|
|
155
|
+
HEADING_TRANSFORM["UPPERCASE"] = "uppercase";
|
|
156
|
+
HEADING_TRANSFORM["CAPITALIZE"] = "capitalize";
|
|
157
|
+
HEADING_TRANSFORM["NORMAL_CASE"] = "normal-case";
|
|
158
|
+
})(exports.HEADING_TRANSFORM || (exports.HEADING_TRANSFORM = {}));
|
|
137
159
|
|
|
138
160
|
var Heading = function (_a) {
|
|
139
161
|
var _b;
|
|
140
|
-
var children = _a.children, _c = _a.tag, tag = _c === void 0 ?
|
|
162
|
+
var children = _a.children, _c = _a.tag, tag = _c === void 0 ? exports.HEADING_TAGS.H1 : _c, transform = _a.transform, align = _a.align, id = _a.id, testID = _a.testID, flush = _a.flush, className = _a.className;
|
|
141
163
|
var fontSize = function () {
|
|
142
164
|
switch (tag) {
|
|
143
165
|
case 'h1':
|
|
@@ -156,25 +178,11 @@ var Heading = function (_a) {
|
|
|
156
178
|
};
|
|
157
179
|
var size = fontSize();
|
|
158
180
|
var Tag = tag;
|
|
159
|
-
var classes = cx("font-heading font-bold ".concat(size), (_b = {}, _b["text-".concat(align)] = align, _b), { 'm-0': flush }, transform, className);
|
|
181
|
+
var classes = cx("font-heading font-bold mb-2 ".concat(size), (_b = {}, _b["text-".concat(align)] = align, _b), { 'm-0': flush }, transform, className);
|
|
160
182
|
return (jsxRuntime.jsx(Tag, { "data-testid": testID || id || 'Heading', className: classes, children: children }));
|
|
161
183
|
};
|
|
162
184
|
Heading.displayName = 'Heading';
|
|
163
185
|
|
|
164
|
-
/**
|
|
165
|
-
* Icon component
|
|
166
|
-
* List of supported icons can be found at https://icon-sets.iconify.design.
|
|
167
|
-
*/
|
|
168
|
-
var Icon = function (_a) {
|
|
169
|
-
var name = _a.name, _b = _a.size, size = _b === void 0 ? 24 : _b, color = _a.color, id = _a.id, className = _a.className, testID = _a.testID;
|
|
170
|
-
console.log('Icon name', name, color);
|
|
171
|
-
if (color) {
|
|
172
|
-
return (jsxRuntime.jsx(react.Icon, { "data-testid": testID || id || 'Icon', icon: name, width: size, height: size, color: color, className: className, fill: color || 'currentColor' }));
|
|
173
|
-
}
|
|
174
|
-
return (jsxRuntime.jsx(react.Icon, { "data-testid": testID || id || 'Icon', icon: name, width: size, height: size }));
|
|
175
|
-
};
|
|
176
|
-
Icon.displayName = 'Icon';
|
|
177
|
-
|
|
178
186
|
var Image = function (_a) {
|
|
179
187
|
var src = _a.src, alt = _a.alt, title = _a.title, caption = _a.caption, _b = _a.figure, figure = _b === void 0 ? false : _b, onLoad = _a.onLoad, id = _a.id, className = _a.className, testID = _a.testID;
|
|
180
188
|
var figureClasses = cx('m-0');
|
|
@@ -212,14 +220,14 @@ var Link = function (_a) {
|
|
|
212
220
|
};
|
|
213
221
|
Link.displayName = 'Link';
|
|
214
222
|
|
|
215
|
-
|
|
223
|
+
exports.Variants = void 0;
|
|
216
224
|
(function (Variants) {
|
|
217
225
|
Variants["UNSTYLED"] = "unstyled";
|
|
218
226
|
Variants["INLINE"] = "inline";
|
|
219
227
|
Variants["SMALL"] = "small";
|
|
220
228
|
Variants["LARGE"] = "large";
|
|
221
|
-
})(Variants || (Variants = {}));
|
|
222
|
-
|
|
229
|
+
})(exports.Variants || (exports.Variants = {}));
|
|
230
|
+
exports.ListTag = void 0;
|
|
223
231
|
(function (ListTag) {
|
|
224
232
|
ListTag["OL"] = "ol";
|
|
225
233
|
ListTag["UL"] = "ul";
|
|
@@ -228,10 +236,10 @@ var ListTag;
|
|
|
228
236
|
ListTag["DT"] = "dt";
|
|
229
237
|
ListTag["DD"] = "dd";
|
|
230
238
|
ListTag["LI"] = "li";
|
|
231
|
-
})(ListTag || (ListTag = {}));
|
|
239
|
+
})(exports.ListTag || (exports.ListTag = {}));
|
|
232
240
|
|
|
233
241
|
var List = function (_a) {
|
|
234
|
-
var variants = _a.variants, children = _a.children, _b = _a.as, as = _b === void 0 ? ListTag.UL : _b, id = _a.id, testID = _a.testID, className = _a.className;
|
|
242
|
+
var variants = _a.variants, children = _a.children, _b = _a.as, as = _b === void 0 ? exports.ListTag.UL : _b, id = _a.id, testID = _a.testID, className = _a.className;
|
|
235
243
|
var modifiers = variants ? variants.map(function (el) { return "list--".concat(el); }) : null;
|
|
236
244
|
var Tag = as;
|
|
237
245
|
return (jsxRuntime.jsx(Tag, { "data-testid": testID || id || 'List', className: cx(modifiers, className), children: children }));
|
|
@@ -245,72 +253,54 @@ var ListItem = function (_a) {
|
|
|
245
253
|
ListItem.displayName = 'ListItem';
|
|
246
254
|
|
|
247
255
|
var Notice = function (_a) {
|
|
248
|
-
var _b = _a.
|
|
249
|
-
return (jsxRuntime.jsx("div", { "data-testid": testID || id || 'Notice', className: "foo-bar", children:
|
|
256
|
+
var _b = _a.custom, custom = _b === void 0 ? 'bar' : _b, id = _a.id, testID = _a.testID;
|
|
257
|
+
return (jsxRuntime.jsx("div", { "data-testid": testID || id || 'Notice', className: "foo-bar", children: custom }));
|
|
250
258
|
};
|
|
251
259
|
Notice.displayName = 'Notice';
|
|
252
260
|
|
|
253
|
-
var Loader = function (_a) {
|
|
254
|
-
var color = _a.color, _b = _a.size, size = _b === void 0 ? 8 : _b, _c = _a.thickness, thickness = _c === void 0 ? 4 : _c;
|
|
255
|
-
var sizeClass = size ? "w-".concat(size, " h-").concat(size) : 'w-8 h-8';
|
|
256
|
-
return (jsxRuntime.jsx("div", { "data-testid": "Loader", children: jsxRuntime.jsxs("div", { role: "status", children: [jsxRuntime.jsxs("svg", { className: "animate-spin -ml-1 mr-3 ".concat(sizeClass, " text-white"), xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [jsxRuntime.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: color || 'currentColor', strokeWidth: thickness }), jsxRuntime.jsx("path", { className: "opacity-75", fill: color || 'currentColor', d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }), jsxRuntime.jsx("span", { className: "sr-only", children: "Loading..." })] }) }));
|
|
257
|
-
};
|
|
258
|
-
Loader.displayName = 'Loader';
|
|
259
|
-
|
|
260
261
|
var Container = function (_a) {
|
|
261
|
-
var children = _a.children, className = _a.className, spacing = _a.spacing, padded = _a.padded;
|
|
262
|
-
var classes = cx('container', 'mx-auto', 'my-0', { 'px-4': padded }, { 'py-40': spacing === 'feature' }, { 'py-24': spacing === 'component' }, { 'py-16': spacing === 'module' }, { 'py-10': spacing === 'element' }, { 'py-4': spacing === 'atom' }, { 'py-0': spacing === 'none' }, className);
|
|
262
|
+
var children = _a.children, className = _a.className, spacing = _a.spacing, padded = _a.padded, isNarrow = _a.isNarrow, isCentered = _a.isCentered;
|
|
263
|
+
var classes = cx('container', 'mx-auto', 'my-0', { 'px-4': padded }, { 'py-40': spacing === 'feature' }, { 'py-24': spacing === 'component' }, { 'py-16': spacing === 'module' }, { 'py-10': spacing === 'element' }, { 'py-4': spacing === 'atom' }, { 'py-0': spacing === 'none' }, { 'max-w-3xl': isNarrow }, { 'flex items-center justify-center flex-col': isCentered }, className);
|
|
263
264
|
return (jsxRuntime.jsx("div", { "data-testid": "Container", className: classes, children: children }));
|
|
264
265
|
};
|
|
265
266
|
Container.displayName = 'Container';
|
|
266
267
|
|
|
267
|
-
|
|
268
|
-
(function (
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
})(
|
|
268
|
+
exports.CPL_SPACING = void 0;
|
|
269
|
+
(function (CPL_SPACING) {
|
|
270
|
+
CPL_SPACING["NONE"] = "none";
|
|
271
|
+
CPL_SPACING["ATOM"] = "atom";
|
|
272
|
+
CPL_SPACING["DEFAULT"] = "default";
|
|
273
|
+
CPL_SPACING["ELEMENT"] = "element";
|
|
274
|
+
CPL_SPACING["COMPONENT"] = "component";
|
|
275
|
+
CPL_SPACING["MODULE"] = "module";
|
|
276
|
+
CPL_SPACING["FEATURE"] = "feature";
|
|
277
|
+
})(exports.CPL_SPACING || (exports.CPL_SPACING = {}));
|
|
277
278
|
|
|
278
279
|
var ContentPageLayout = function (_a) {
|
|
279
|
-
var _b = _a.spacing, spacing = _b === void 0 ?
|
|
280
|
+
var _b = _a.spacing, spacing = _b === void 0 ? exports.CPL_SPACING.DEFAULT : _b, children = _a.children, narrow = _a.narrow, flush = _a.flush, className = _a.className;
|
|
280
281
|
var classes = cx('flex', 'flex-col', 'flex-1', 'relative', { 'py-40': spacing === 'feature' }, { 'py-24': spacing === 'component' }, { 'py-16': spacing === 'module' }, { 'py-10': spacing === 'element' }, { 'py-8': spacing === 'default' }, { 'py-4': spacing === 'atom' }, { 'py-0': spacing === 'none' }, { 'max-w-5xl': narrow }, { 'p-0': flush }, className);
|
|
281
282
|
return (jsxRuntime.jsx("div", { "data-testid": "ContentPageLayout", className: classes, children: children }));
|
|
282
283
|
};
|
|
283
284
|
ContentPageLayout.displayName = 'ContentPageLayout';
|
|
284
285
|
|
|
285
|
-
|
|
286
|
-
(function (
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
})(
|
|
286
|
+
exports.CRL_SIZE = void 0;
|
|
287
|
+
(function (CRL_SIZE) {
|
|
288
|
+
CRL_SIZE["NONE"] = "none";
|
|
289
|
+
CRL_SIZE["ATOM"] = "atom";
|
|
290
|
+
CRL_SIZE["DEFAULT"] = "default";
|
|
291
|
+
CRL_SIZE["ELEMENT"] = "element";
|
|
292
|
+
CRL_SIZE["COMPONENT"] = "component";
|
|
293
|
+
CRL_SIZE["MODULE"] = "module";
|
|
294
|
+
CRL_SIZE["FEATURE"] = "feature";
|
|
295
|
+
})(exports.CRL_SIZE || (exports.CRL_SIZE = {}));
|
|
295
296
|
|
|
296
297
|
var ContentRowsLayout = function (_a) {
|
|
297
|
-
var className = _a.className, children = _a.children, _b = _a.size, size = _b === void 0 ?
|
|
298
|
+
var className = _a.className, children = _a.children, _b = _a.size, size = _b === void 0 ? exports.CRL_SIZE.DEFAULT : _b;
|
|
298
299
|
var classes = cx('grid', 'auto-rows-min', 'grid-cols-1', 'gap-x-4', { 'gap-y-0 mb-0': size === 'none' }, { 'gap-y-2 mb-2': size === 'atom' }, { 'gap-y-4 mb-4': size === 'default' }, { 'gap-y-8 mb-8': size === 'element' }, { 'gap-y-16 mb-16': size === 'module' }, { 'gap-y-24 mb-24': size === 'component' }, { 'gap-y-40 mb-40': size === 'feature' }, className);
|
|
299
300
|
return (jsxRuntime.jsx("div", { "data-testid": "ContentRowsLayout", className: classes, children: children }));
|
|
300
301
|
};
|
|
301
302
|
ContentRowsLayout.displayName = 'ContentRowsLayout';
|
|
302
303
|
|
|
303
|
-
var Form = function (_a) {
|
|
304
|
-
var children = _a.children, className = _a.className, submit = _a.submit, onSubmit = _a.onSubmit, hideSubmit = _a.hideSubmit, ariaSubmitLabel = _a.ariaSubmitLabel, submitID = _a.submitID, initialValues = _a.initialValues, _b = _a.submitVariant, submitVariant = _b === void 0 ? BTN_VARIANTS.PRIMARY : _b;
|
|
305
|
-
var _c = reactHookForm.useForm({
|
|
306
|
-
defaultValues: initialValues,
|
|
307
|
-
}), handleSubmit = _c.handleSubmit, formState = _c.formState;
|
|
308
|
-
var submitClasses = cx({ 'sr-only': hideSubmit });
|
|
309
|
-
console.log('FORM formState', formState);
|
|
310
|
-
return (jsxRuntime.jsx("div", { "data-testid": "Form", className: "w-full max-w-s @form @containers", children: jsxRuntime.jsxs("form", { onSubmit: handleSubmit(onSubmit), className: cx('form px-8 pt-6 pb-8 mb-4 w-2xs', className), children: [children, jsxRuntime.jsx("div", { className: 'flex items-center justify-end py-2', children: jsxRuntime.jsx(Button, { id: submitID || submit, className: submitClasses, ariaLabel: ariaSubmitLabel || submit || 'Submit', type: BTN_TYPES.SUBMIT, variant: submitVariant, children: submit }) })] }) }));
|
|
311
|
-
};
|
|
312
|
-
Form.displayName = 'Form';
|
|
313
|
-
|
|
314
304
|
/******************************************************************************
|
|
315
305
|
Copyright (c) Microsoft Corporation.
|
|
316
306
|
|
|
@@ -356,24 +346,43 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
356
346
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
357
347
|
};
|
|
358
348
|
|
|
359
|
-
var
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
349
|
+
var Form = function (_a) {
|
|
350
|
+
var children = _a.children, className = _a.className, submit = _a.submit, _b = _a.onSubmit, onSubmit = _b === void 0 ? function () { } : _b, onChange = _a.onChange, hideSubmit = _a.hideSubmit, ariaSubmitLabel = _a.ariaSubmitLabel, submitID = _a.submitID, _c = _a.submitVariant, submitVariant = _c === void 0 ? exports.BTN_VARIANTS.PRIMARY : _c, _d = _a.initialValues, initialValues = _d === void 0 ? {} : _d, _e = _a.isBoxed, isBoxed = _e === void 0 ? false : _e;
|
|
351
|
+
var methods = reactHookForm.useForm({
|
|
352
|
+
defaultValues: initialValues,
|
|
353
|
+
mode: 'onBlur',
|
|
354
|
+
reValidateMode: 'onChange',
|
|
355
|
+
});
|
|
356
|
+
React.useEffect(function () {
|
|
357
|
+
if (onChange && typeof onChange === 'function') {
|
|
358
|
+
var subscription_1 = methods.watch(function (value) { return onChange(value); });
|
|
359
|
+
return function () { return subscription_1.unsubscribe(); };
|
|
360
|
+
}
|
|
361
|
+
}, []);
|
|
362
|
+
var submitClasses = cx({ 'sr-only': hideSubmit });
|
|
363
|
+
return (jsxRuntime.jsx(reactHookForm.FormProvider, __assign({}, methods, { children: jsxRuntime.jsx("div", { "data-testid": "Form", className: cx('w-full max-w-s @containers @form'), children: jsxRuntime.jsxs("form", { onSubmit: methods.handleSubmit(onSubmit), className: cx('mb-4 w-2xs relative', { 'form px-8 pt-6 pb-8 ': isBoxed }, { 'opacity-50': methods.formState.isSubmitting }, className), children: [children, submit && (jsxRuntime.jsx("div", { className: "flex items-center justify-end py-2", children: jsxRuntime.jsx(Button, { id: submitID || submit, className: submitClasses, ariaLabel: ariaSubmitLabel || submit || 'Submit', type: exports.BTN_TYPES.SUBMIT, outline: true, isLoading: methods.formState.isSubmitting, disabled: methods.formState.isSubmitting || !methods.formState.isValid, variant: submitVariant, children: submit }) }))] }) }) })));
|
|
364
|
+
};
|
|
365
|
+
Form.displayName = 'Form';
|
|
366
|
+
|
|
367
|
+
exports.FIELD_TYPES = void 0;
|
|
368
|
+
(function (FIELD_TYPES) {
|
|
369
|
+
FIELD_TYPES["TEXT"] = "text";
|
|
370
|
+
FIELD_TYPES["TEXTAREA"] = "textarea";
|
|
371
|
+
FIELD_TYPES["SELECT"] = "select";
|
|
372
|
+
FIELD_TYPES["CHECKBOX"] = "checkbox";
|
|
373
|
+
FIELD_TYPES["RADIO"] = "radio";
|
|
374
|
+
FIELD_TYPES["SWITCH"] = "switch";
|
|
375
|
+
FIELD_TYPES["DATE"] = "date";
|
|
376
|
+
FIELD_TYPES["TIME"] = "time";
|
|
377
|
+
FIELD_TYPES["DATETIME"] = "datetime";
|
|
378
|
+
FIELD_TYPES["FILE"] = "file";
|
|
379
|
+
FIELD_TYPES["PASSWORD"] = "password";
|
|
380
|
+
FIELD_TYPES["EMAIL"] = "email";
|
|
381
|
+
FIELD_TYPES["NUMBER"] = "number";
|
|
382
|
+
FIELD_TYPES["TEL"] = "tel";
|
|
383
|
+
FIELD_TYPES["URL"] = "url";
|
|
384
|
+
FIELD_TYPES["SEARCH"] = "search";
|
|
385
|
+
FIELD_TYPES["HIDDEN"] = "hidden";
|
|
377
386
|
// MONTH = 'month',
|
|
378
387
|
// WEEK = 'week',
|
|
379
388
|
// HIDDEN = 'hidden',
|
|
@@ -381,7 +390,7 @@ var FieldTypes;
|
|
|
381
390
|
// RANGE = 'range',
|
|
382
391
|
// CURRENCY = 'currency',
|
|
383
392
|
// PERCENT = 'percent',
|
|
384
|
-
})(
|
|
393
|
+
})(exports.FIELD_TYPES || (exports.FIELD_TYPES = {}));
|
|
385
394
|
|
|
386
395
|
var InputType;
|
|
387
396
|
(function (InputType) {
|
|
@@ -399,10 +408,11 @@ var InputType;
|
|
|
399
408
|
InputType["WEEK"] = "week";
|
|
400
409
|
InputType["FILE"] = "file";
|
|
401
410
|
InputType["TEXTAREA"] = "textarea";
|
|
411
|
+
InputType["HIDDEN"] = "hidden";
|
|
402
412
|
})(InputType || (InputType = {}));
|
|
403
413
|
|
|
404
414
|
var TextInput = React.forwardRef(function MyInput(_a, ref) {
|
|
405
|
-
var _b = _a.type, type = _b === void 0 ? InputType.TEXT : _b,
|
|
415
|
+
var _b = _a.type, type = _b === void 0 ? InputType.TEXT : _b, _c = _a.required, required = _c === void 0 ? false : _c, className = _a.className, onChange = _a.onChange, placeholder = _a.placeholder, icon = _a.icon, _d = _a.disabled, disabled = _d === void 0 ? false : _d, rest = __rest(_a, ["type", "required", "className", "onChange", "placeholder", "icon", "disabled"]);
|
|
406
416
|
React.useEffect(function () {
|
|
407
417
|
if (typeof window !== 'undefined') {
|
|
408
418
|
// eslint-disable-next-line global-require
|
|
@@ -411,6 +421,7 @@ var TextInput = React.forwardRef(function MyInput(_a, ref) {
|
|
|
411
421
|
}, []);
|
|
412
422
|
var format = 'dd/mm/yyyy';
|
|
413
423
|
var placeholderSet = type === 'date' ? format.toUpperCase() : placeholder;
|
|
424
|
+
// console.log('TextInput', rest);
|
|
414
425
|
if (type === InputType.TEXTAREA) {
|
|
415
426
|
return (jsxRuntime.jsx("div", { "data-testid": "TextInput", className: "relative", children: jsxRuntime.jsx("textarea", __assign({ ref: ref, required: required, "aria-required": required, disabled: disabled, placeholder: placeholderSet, onChange: onChange, rows: 4, className: cx('form-item text-input resize-none', className) }, rest)) }));
|
|
416
427
|
}
|
|
@@ -420,25 +431,32 @@ TextInput.displayName = 'TextInput';
|
|
|
420
431
|
|
|
421
432
|
var Checkbox = React.forwardRef(function MyInput(_a, ref) {
|
|
422
433
|
var id = _a.id, label = _a.label, required = _a.required, className = _a.className, disabled = _a.disabled, rest = __rest(_a, ["id", "label", "required", "className", "disabled"]);
|
|
423
|
-
return (jsxRuntime.jsxs("div", { "data-testid": "Checkbox", className: cx('flex items-center', className), children: [jsxRuntime.jsxs("div",
|
|
434
|
+
return (jsxRuntime.jsxs("div", { "data-testid": "Checkbox", className: cx('flex items-center', className), children: [jsxRuntime.jsxs("div", { className: "relative bg-none w-5 h-5 flex justify-center items-center", children: [jsxRuntime.jsx("input", __assign({ id: id, ref: ref, disabled: disabled, type: "checkbox", className: "form-item checkbox m-0 appearance-none peer h-full w-full shrink-0 focus:ring-2", required: required }, rest)), jsxRuntime.jsx("span", { className: "absolute transition-opacity opacity-0 pointer-events-none peer-checked:opacity-100 w-full h-full flex items-center justify-center top-0 left-0", children: jsxRuntime.jsx(Icon, { name: "mdi:check-bold", size: 12 }) })] }), label && (jsxRuntime.jsx("label", { className: "label pl-2 leading-none text-sm", htmlFor: id, children: label }))] }));
|
|
424
435
|
});
|
|
425
436
|
Checkbox.displayName = 'Checkbox';
|
|
426
437
|
|
|
427
438
|
var Label = function (_a) {
|
|
428
|
-
var
|
|
429
|
-
return (jsxRuntime.jsx("label", { "data-testid": "Label", className:
|
|
439
|
+
var children = _a.children, id = _a.id, transform = _a.transform, className = _a.className;
|
|
440
|
+
return (jsxRuntime.jsx("label", { "data-testid": "Label", className: cx('label mb-2', transform, className), htmlFor: id, children: children }));
|
|
430
441
|
};
|
|
431
442
|
Label.displayName = 'Label';
|
|
432
443
|
|
|
433
|
-
var FormSelect = function (_a) {
|
|
434
|
-
var id = _a.id, name = _a.name, options = _a.options, required = _a.required, className = _a.className, disabled = _a.disabled;
|
|
435
|
-
|
|
436
|
-
|
|
444
|
+
var FormSelect = React.forwardRef(function MyInput(_a, ref) {
|
|
445
|
+
var id = _a.id, name = _a.name, options = _a.options, required = _a.required, className = _a.className, disabled = _a.disabled, rest = __rest(_a, ["id", "name", "options", "required", "className", "disabled"]);
|
|
446
|
+
if (!options) {
|
|
447
|
+
throw new Error('FormSelect requires options prop');
|
|
448
|
+
}
|
|
449
|
+
return (jsxRuntime.jsx("div", { id: id, className: cx('pb-2 min-w-20', className), children: jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx("select", __assign({ ref: ref, id: id, name: name, disabled: disabled, required: required, className: "form-item text-input" }, rest, { children: options.map(function (option) {
|
|
450
|
+
var _a, _b;
|
|
451
|
+
return (jsxRuntime.jsx("option", { value: (_a = option === null || option === void 0 ? void 0 : option.value) === null || _a === void 0 ? void 0 : _a.toString(), disabled: option.disabled, children: option.label }, (_b = option === null || option === void 0 ? void 0 : option.value) === null || _b === void 0 ? void 0 : _b.toString()));
|
|
452
|
+
}) })), jsxRuntime.jsx("div", { className: "form-icon absolute inset-0 z-10 pointer-events-none h-full w-12 items-center justify-center top-0 right-0 left-auto flex", children: jsxRuntime.jsx(Icon, { name: "mdi:chevron-down", size: 24, className: "pointer-events-none" }) })] }) }));
|
|
453
|
+
});
|
|
437
454
|
FormSelect.displayName = 'FormSelect';
|
|
438
455
|
|
|
439
456
|
var Radio = React.forwardRef(function MyInput(_a, ref) {
|
|
440
|
-
var
|
|
441
|
-
|
|
457
|
+
var name = _a.name, required = _a.required, className = _a.className, options = _a.options, rest = __rest(_a, ["name", "required", "className", "options"]);
|
|
458
|
+
console.log('Radio', __assign({ name: name, required: required, className: className, options: options }, rest));
|
|
459
|
+
return (jsxRuntime.jsx("div", { "data-testid": "Radio", className: cx('flex items-center', className), children: jsxRuntime.jsx("div", { className: cx('flex flex-col gap-2', className), children: options === null || options === void 0 ? void 0 : options.map(function (option) { return (jsxRuntime.jsxs("div", { className: "flex items-center relative", children: [jsxRuntime.jsxs("div", { className: "relative flex items-center", children: [jsxRuntime.jsx("input", __assign({ ref: ref, name: name, type: "radio", value: option.value, required: required, className: "form-item radio peer appearance-none m-0 p-0 w-4 h-4" }, rest, { id: option.value })), jsxRuntime.jsx("div", { className: "form-icon opacity-0 peer-checked:opacity-100 absolute w-4 h-4 flex items-center justify-center top-0 left-0 pointer-events-none", children: jsxRuntime.jsx(Icon, { name: "mdi:circle", size: 12 }) })] }), jsxRuntime.jsx("label", { className: "label pl-2 leading-none", htmlFor: option.value, children: option.label })] }, option.value)); }) }) }));
|
|
442
460
|
});
|
|
443
461
|
Radio.displayName = 'Radio';
|
|
444
462
|
|
|
@@ -455,48 +473,48 @@ var FileUpload = React.forwardRef(function MyInput(_a, ref) {
|
|
|
455
473
|
FileUpload.displayName = 'FileUpload';
|
|
456
474
|
|
|
457
475
|
var FormField = function (_a) {
|
|
458
|
-
var
|
|
459
|
-
var
|
|
460
|
-
var
|
|
461
|
-
var
|
|
476
|
+
var _b;
|
|
477
|
+
var name = _a.name, type = _a.type, label = _a.label, required = _a.required, className = _a.className, icon = _a.icon, options = _a.options, disabled = _a.disabled, description = _a.description, showPasswordLabel = _a.showPasswordLabel, hidePasswordLabel = _a.hidePasswordLabel, _c = _a.validations, validations = _c === void 0 ? {} : _c;
|
|
478
|
+
var _d = React.useState(false), passwordShowStatus = _d[0], setPasswordShow = _d[1];
|
|
479
|
+
var _e = reactHookForm.useFormContext(), control = _e.control, register = _e.register, errors = _e.formState.errors;
|
|
480
|
+
var renderType = function (type) {
|
|
462
481
|
switch (type) {
|
|
463
|
-
case
|
|
464
|
-
return
|
|
465
|
-
case
|
|
482
|
+
case exports.FIELD_TYPES.HIDDEN:
|
|
483
|
+
return jsxRuntime.jsx("input", __assign({ type: InputType.HIDDEN, disabled: disabled }, register(name)));
|
|
484
|
+
case exports.FIELD_TYPES.TEXT:
|
|
485
|
+
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.TEXT, required: required, icon: icon, className: className, disabled: disabled }, register(name, validations))));
|
|
486
|
+
case exports.FIELD_TYPES.PASSWORD: {
|
|
466
487
|
var toggleType = passwordShowStatus ? InputType.TEXT : InputType.PASSWORD;
|
|
467
488
|
var btnClass = 'appearance-none border-none bg-transparent flex items-center';
|
|
468
|
-
return (jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx("span", { className: "absolute right-0 top-0 flex items-center justify-center h-full z-10 pr-2", onClick: function () { return setPasswordShow(function (pS) { return !pS; }); }, role: "button", tabIndex: 0, children: passwordShowStatus ? (jsxRuntime.jsx("button", { type: "button", "aria-label": hidePasswordLabel, className: cx(btnClass, 'form-icon'), children: jsxRuntime.jsx(Icon, { name: "mdi:eye-off", size: 24 }) })) : (jsxRuntime.jsx("button", { type: "button", "aria-label": showPasswordLabel, className: cx(btnClass, 'form-icon'), children: jsxRuntime.jsx(Icon, { name: "mdi:eye", size: 24 }) })) }), jsxRuntime.jsx(TextInput, __assign({ type: toggleType, required: required, icon: icon, className: className, disabled: disabled },
|
|
489
|
+
return (jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx("span", { className: "absolute right-0 top-0 flex items-center justify-center h-full z-10 pr-2", onClick: function () { return setPasswordShow(function (pS) { return !pS; }); }, role: "button", tabIndex: 0, children: passwordShowStatus ? (jsxRuntime.jsx("button", { type: "button", "aria-label": hidePasswordLabel, className: cx(btnClass, 'form-icon'), children: jsxRuntime.jsx(Icon, { name: "mdi:eye-off", size: 24 }) })) : (jsxRuntime.jsx("button", { type: "button", "aria-label": showPasswordLabel, className: cx(btnClass, 'form-icon'), children: jsxRuntime.jsx(Icon, { name: "mdi:eye", size: 24 }) })) }), jsxRuntime.jsx(TextInput, __assign({ type: toggleType, required: required, icon: icon, className: className, disabled: disabled }, register(name, validations)))] }));
|
|
469
490
|
}
|
|
470
|
-
case
|
|
471
|
-
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.TEXTAREA, required: required, icon: icon, className: className, disabled: disabled },
|
|
472
|
-
case
|
|
473
|
-
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.EMAIL, required: required, icon: icon, className: className, disabled: disabled },
|
|
474
|
-
case
|
|
475
|
-
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.DATE, required: required, icon: icon, className: className, disabled: disabled },
|
|
476
|
-
case
|
|
477
|
-
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.DATETIME, required: required, icon: icon, className: className, disabled: disabled },
|
|
478
|
-
case
|
|
479
|
-
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.NUMBER, required: required, icon: icon, className: className, disabled: disabled },
|
|
480
|
-
case
|
|
481
|
-
return (jsxRuntime.jsx(Checkbox, __assign({ required: required, id: name, className: className, label: label, disabled: disabled },
|
|
482
|
-
case
|
|
483
|
-
return (jsxRuntime.jsx(Radio, __assign({ required: required, id: name, className: className, label: label, options: options, disabled: disabled },
|
|
484
|
-
case
|
|
485
|
-
return jsxRuntime.jsx(Switch, __assign({ required: required, className: className, disabled: disabled },
|
|
486
|
-
case
|
|
487
|
-
return (jsxRuntime.jsx(FormSelect, __assign({ required: required, id: name, className: className, disabled: disabled, label: label, options: options },
|
|
488
|
-
case
|
|
489
|
-
return (jsxRuntime.jsx(FileUpload, __assign({ required: required, id: name, className: className, disabled: disabled },
|
|
491
|
+
case exports.FIELD_TYPES.TEXTAREA:
|
|
492
|
+
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.TEXTAREA, required: required, icon: icon, className: className, disabled: disabled }, register(name, validations))));
|
|
493
|
+
case exports.FIELD_TYPES.EMAIL:
|
|
494
|
+
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.EMAIL, required: required, icon: icon, className: className, disabled: disabled }, register(name, validations))));
|
|
495
|
+
case exports.FIELD_TYPES.DATE:
|
|
496
|
+
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.DATE, required: required, icon: icon, className: className, disabled: disabled }, register(name, validations))));
|
|
497
|
+
case exports.FIELD_TYPES.DATETIME:
|
|
498
|
+
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.DATETIME, required: required, icon: icon, className: className, disabled: disabled }, register(name, validations))));
|
|
499
|
+
case exports.FIELD_TYPES.NUMBER:
|
|
500
|
+
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.NUMBER, required: required, icon: icon, className: className, disabled: disabled }, register(name, validations))));
|
|
501
|
+
case exports.FIELD_TYPES.CHECKBOX:
|
|
502
|
+
return (jsxRuntime.jsx(Checkbox, __assign({ required: required, id: name, className: className, label: label, disabled: disabled }, register(name, validations))));
|
|
503
|
+
case exports.FIELD_TYPES.RADIO:
|
|
504
|
+
return (jsxRuntime.jsx(Radio, __assign({ required: required, id: name, className: className, label: label, options: options, disabled: disabled }, register(name, validations))));
|
|
505
|
+
case exports.FIELD_TYPES.SWITCH:
|
|
506
|
+
return jsxRuntime.jsx(Switch, __assign({ id: name, required: required, className: className, disabled: disabled }, register(name)));
|
|
507
|
+
case exports.FIELD_TYPES.SELECT:
|
|
508
|
+
return (jsxRuntime.jsx(FormSelect, __assign({ required: required, id: name, className: className, disabled: disabled, label: label, options: options }, register(name, validations))));
|
|
509
|
+
case exports.FIELD_TYPES.FILE:
|
|
510
|
+
return (jsxRuntime.jsx(FileUpload, __assign({ required: required, id: name, className: className, disabled: disabled }, register(name, validations))));
|
|
490
511
|
default:
|
|
491
|
-
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.TEXT, required: required, disabled: disabled, icon: icon, className: className },
|
|
512
|
+
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.TEXT, required: required, disabled: disabled, icon: icon, className: className }, register(name, validations))));
|
|
492
513
|
}
|
|
493
514
|
};
|
|
494
515
|
// TODO: HELPER CLASSES : data-[invalid=true]:bg-error data-[valid]:bg-success
|
|
495
|
-
var showLabel = label && type !==
|
|
496
|
-
return (jsxRuntime.jsx("div", { className: "relative", children: jsxRuntime.jsxs("div", { "data-testid": "FormField", className: "mb-4", children: [showLabel && (jsxRuntime.jsx("div", { className: "flex items-baseline justify-between", children: jsxRuntime.jsx(Label, { label: label, id: name }) })), jsxRuntime.jsx(reactHookForm.Controller, { name:
|
|
497
|
-
var field = _a.field;
|
|
498
|
-
return renderType(type, field);
|
|
499
|
-
} }), description && jsxRuntime.jsx(Copy, { size: SIZE$1.SMALL, children: description })] }) }));
|
|
516
|
+
var showLabel = label && type !== exports.FIELD_TYPES.CHECKBOX;
|
|
517
|
+
return (jsxRuntime.jsx("div", { className: "relative", children: jsxRuntime.jsxs("div", { "data-testid": "FormField", className: "mb-4", children: [showLabel && (jsxRuntime.jsx("div", { className: "flex items-baseline justify-between", children: jsxRuntime.jsx(Label, { label: label, id: name }) })), jsxRuntime.jsx("div", { className: "mb-1", children: jsxRuntime.jsx(reactHookForm.Controller, { name: name, control: control, render: function () { return renderType(type); } }) }), description && (jsxRuntime.jsx("div", { className: "formfield-description", children: jsxRuntime.jsx(Copy, { size: exports.COPY_SIZE.SMALL, children: description }) })), errors[name] && (jsxRuntime.jsx("div", { className: "formfield-error text-error italic", children: jsxRuntime.jsx(Copy, { size: exports.COPY_SIZE.SMALL, children: (_b = errors === null || errors === void 0 ? void 0 : errors[name]) === null || _b === void 0 ? void 0 : _b.message }) }))] }) }));
|
|
500
518
|
};
|
|
501
519
|
FormField.displayName = 'FormField';
|
|
502
520
|
|