@4alldigital/foundation-ui--gamma 1.22.1 → 1.24.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 +307 -102
- package/dist/index.js +308 -101
- package/dist/types/fui/components/Blockquote/Blockquote.d.ts +2 -3
- package/dist/types/fui/components/Button/Button.d.ts +3 -2
- package/dist/types/fui/components/Button/Button.types.d.ts +20 -4
- package/dist/types/fui/components/Checkbox/Checkbox.d.ts +5 -0
- package/dist/types/fui/components/Checkbox/Checkbox.stories.d.ts +6 -0
- package/dist/types/fui/components/Checkbox/Checkbox.test.d.ts +1 -0
- package/dist/types/fui/components/Checkbox/Checkbox.types.d.ts +12 -0
- package/dist/types/fui/components/Checkbox/index.d.ts +1 -0
- package/dist/types/fui/components/Container/Container.d.ts +3 -2
- package/dist/types/fui/components/Container/Container.types.d.ts +1 -0
- package/dist/types/fui/components/ContentPageLayout/ContentPageLayout.d.ts +5 -1
- package/dist/types/fui/components/ContentRowsLayout/ContentRowsLayout.d.ts +3 -4
- package/dist/types/fui/components/Copy/Copy.d.ts +4 -8
- package/dist/types/fui/components/Copy/Copy.types.d.ts +11 -10
- package/dist/types/fui/components/FileUpload/FileUpload.d.ts +5 -0
- package/dist/types/fui/components/FileUpload/FileUpload.stories.d.ts +6 -0
- package/dist/types/fui/components/FileUpload/FileUpload.test.d.ts +1 -0
- package/dist/types/fui/components/FileUpload/FileUpload.types.d.ts +7 -0
- package/dist/types/fui/components/FileUpload/index.d.ts +1 -0
- package/dist/types/fui/components/Form/Form.d.ts +8 -0
- package/dist/types/fui/components/Form/Form.stories.d.ts +7 -0
- package/dist/types/fui/components/Form/Form.test.d.ts +1 -0
- package/dist/types/fui/components/Form/Form.types.d.ts +27 -0
- package/dist/types/fui/components/Form/index.d.ts +1 -0
- package/dist/types/fui/components/FormField/FormField.d.ts +8 -0
- package/dist/types/fui/components/FormField/FormField.stories.d.ts +7 -0
- package/dist/types/fui/components/FormField/FormField.test.d.ts +1 -0
- package/dist/types/fui/components/FormField/FormField.types.d.ts +34 -0
- package/dist/types/fui/components/FormField/index.d.ts +1 -0
- package/dist/types/fui/components/FormSelect/FormSelect.d.ts +8 -0
- package/dist/types/fui/components/FormSelect/FormSelect.stories.d.ts +6 -0
- package/dist/types/fui/components/FormSelect/FormSelect.test.d.ts +1 -0
- package/dist/types/fui/components/FormSelect/FormSelect.types.d.ts +41 -0
- package/dist/types/fui/components/FormSelect/index.d.ts +1 -0
- package/dist/types/fui/components/Heading/Heading.d.ts +3 -4
- package/dist/types/fui/components/Hr/Hr.d.ts +4 -1
- package/dist/types/fui/components/Icon/Icon.d.ts +3 -4
- package/dist/types/fui/components/Icon/Icon.types.d.ts +2 -1
- package/dist/types/fui/components/Image/Image.d.ts +5 -1
- package/dist/types/fui/components/Label/Label.d.ts +8 -0
- package/dist/types/fui/components/Label/Label.stories.d.ts +6 -0
- package/dist/types/fui/components/Label/Label.test.d.ts +1 -0
- package/dist/types/fui/components/Label/Label.types.d.ts +4 -0
- package/dist/types/fui/components/Label/index.d.ts +1 -0
- package/dist/types/fui/components/Link/Link.d.ts +2 -6
- package/dist/types/fui/components/List/List.d.ts +4 -5
- package/dist/types/fui/components/List/List.types.d.ts +1 -0
- package/dist/types/fui/components/ListItem/ListItem.d.ts +3 -4
- package/dist/types/fui/components/ListItem/ListItem.types.d.ts +1 -0
- package/dist/types/fui/components/Loader/Loader.d.ts +3 -4
- package/dist/types/fui/components/Loader/Loader.types.d.ts +1 -0
- package/dist/types/fui/components/Notice/Notice.d.ts +5 -1
- package/dist/types/fui/components/Radio/Radio.d.ts +5 -0
- package/dist/types/fui/components/Radio/Radio.stories.d.ts +6 -0
- package/dist/types/fui/components/Radio/Radio.test.d.ts +1 -0
- package/dist/types/fui/components/Radio/Radio.types.d.ts +13 -0
- package/dist/types/fui/components/Radio/index.d.ts +1 -0
- package/dist/types/fui/components/Switch/Switch.d.ts +5 -0
- package/dist/types/fui/components/Switch/Switch.stories.d.ts +6 -0
- package/dist/types/fui/components/Switch/Switch.test.d.ts +1 -0
- package/dist/types/fui/components/Switch/Switch.types.d.ts +7 -0
- package/dist/types/fui/components/Switch/index.d.ts +1 -0
- package/dist/types/fui/components/TextInput/TextInput.d.ts +5 -0
- package/dist/types/fui/components/TextInput/TextInput.stories.d.ts +6 -0
- package/dist/types/fui/components/TextInput/TextInput.test.d.ts +1 -0
- package/dist/types/fui/components/TextInput/TextInput.types.d.ts +35 -0
- package/dist/types/fui/components/TextInput/index.d.ts +1 -0
- package/dist/types/fui/components/index.d.ts +2 -0
- package/dist/types/fui/hooks/useTheme.d.ts +1 -0
- package/package.json +2 -4
package/dist/index.js
CHANGED
|
@@ -3,18 +3,37 @@
|
|
|
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
|
+
var React = require('react');
|
|
6
8
|
|
|
7
9
|
var Blockquote = function (_a) {
|
|
8
|
-
var text = _a.text, citation = _a.citation, className = _a.className, citationAttribute = _a.citationAttribute,
|
|
10
|
+
var text = _a.text, citation = _a.citation, className = _a.className, citationAttribute = _a.citationAttribute, _b = _a.showIcon, showIcon = _b === void 0 ? true : _b;
|
|
9
11
|
var classes = cx('text-xl italic font-bold', className);
|
|
10
12
|
return (jsxRuntime.jsxs("blockquote", { "data-testid": "Blockquote", className: classes, children: [showIcon && jsxRuntime.jsx("svg", { "aria-hidden": "true", className: "w-10 h-10", viewBox: "0 0 24 27", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsxRuntime.jsx("path", { d: "M14.017 18L14.017 10.609C14.017 4.905 17.748 1.039 23 0L23.995 2.151C21.563 3.068 20 5.789 20 8H24V18H14.017ZM0 18V10.609C0 4.905 3.748 1.038 9 0L9.996 2.151C7.563 3.068 6 5.789 6 8H9.983L9.983 18L0 18Z", fill: "currentColor" }) }), jsxRuntime.jsx("div", { children: text }), citation && (jsxRuntime.jsx("figcaption", { className: "flex flex-start items-center mt-6 space-x-3", children: jsxRuntime.jsxs("div", { className: "flex items-center divide-x-2", children: [jsxRuntime.jsx("cite", { className: "pr-3 font-medium", children: citation }), citationAttribute && jsxRuntime.jsx("cite", { className: "pl-3 text-sm font-light", children: citationAttribute })] }) }))] }));
|
|
11
13
|
};
|
|
12
|
-
Blockquote.
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
Blockquote.displayName = 'Blockquote';
|
|
15
|
+
|
|
16
|
+
var BTN_TYPES;
|
|
17
|
+
(function (BTN_TYPES) {
|
|
18
|
+
BTN_TYPES["SUBMIT"] = "submit";
|
|
19
|
+
BTN_TYPES["RESET"] = "reset";
|
|
20
|
+
BTN_TYPES["BUTTON"] = "button";
|
|
21
|
+
})(BTN_TYPES || (BTN_TYPES = {}));
|
|
22
|
+
var BTN_VARIANTS;
|
|
23
|
+
(function (BTN_VARIANTS) {
|
|
24
|
+
BTN_VARIANTS["PRIMARY"] = "primary";
|
|
25
|
+
BTN_VARIANTS["SECONDARY"] = "secondary";
|
|
26
|
+
BTN_VARIANTS["TERTIARY"] = "tertiary";
|
|
27
|
+
})(BTN_VARIANTS || (BTN_VARIANTS = {}));
|
|
28
|
+
var BTN_SIZES;
|
|
29
|
+
(function (BTN_SIZES) {
|
|
30
|
+
BTN_SIZES["SMALL"] = "small";
|
|
31
|
+
BTN_SIZES["MEDIUM"] = "medium";
|
|
32
|
+
BTN_SIZES["LARGE"] = "large";
|
|
33
|
+
})(BTN_SIZES || (BTN_SIZES = {}));
|
|
15
34
|
|
|
16
35
|
var Button = function (_a) {
|
|
17
|
-
var
|
|
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;
|
|
18
37
|
var smallX = wide ? 'px-5' : 'px-3';
|
|
19
38
|
var mediumX = wide ? 'px-8' : 'px-4';
|
|
20
39
|
var largeX = wide ? 'px-11' : 'px-5';
|
|
@@ -38,69 +57,59 @@ var Button = function (_a) {
|
|
|
38
57
|
y: 'py-3',
|
|
39
58
|
space: 'space-x-4',
|
|
40
59
|
text: 'text-lg',
|
|
41
|
-
icon: 'w-6 h-6'
|
|
60
|
+
icon: 'w-6 h-6',
|
|
42
61
|
},
|
|
43
62
|
};
|
|
44
|
-
var classes = cx('font-bold flex items-center transition-all duration-200 transform active:scale-95 justify-around border-solid border rounded', { 'text-white border-primary hover:bg-primary-darker hover:border-primary-darker': variant === 'primary' }, { 'text-white border-secondary hover:bg-secondary-darker hover:border-secondary-darker': variant === 'secondary' }, { 'text-black border-tertiary hover:bg-tertiary-darker hover:border-tertiary-darker': variant === 'tertiary' }, { 'bg-primary': variant === 'primary' && !outline }, { 'bg-secondary': variant === 'secondary' && !outline }, { 'bg-tertiary': variant === 'tertiary' && !outline }, { 'bg-transparent': outline }, { shadow: raised }, { uppercase: uppercase }, { 'auto-cols-auto grid-cols-2 gap-2': icon || external }, { 'rounded-full': rounded }, { 'flex-row-reverse': iconFirst }, "".concat(sizes[size].y, " ").concat(sizes[size].x, " ").concat(sizes[size].text));
|
|
63
|
+
var classes = cx('font-bold flex items-center transition-all duration-200 transform active:scale-95 justify-around border-solid border rounded cursor-pointer focus:outline-none', { 'text-white border-primary hover:bg-primary-darker hover:border-primary-darker': variant === 'primary' }, { 'text-white border-secondary hover:bg-secondary-darker hover:border-secondary-darker': variant === 'secondary' }, { 'text-black border-tertiary hover:bg-tertiary-darker hover:border-tertiary-darker': variant === 'tertiary' }, { 'bg-primary': variant === 'primary' && !outline }, { 'bg-secondary': variant === 'secondary' && !outline }, { 'bg-tertiary': variant === 'tertiary' && !outline }, { 'bg-transparent': outline }, { shadow: raised }, { uppercase: uppercase }, { 'auto-cols-auto grid-cols-2 gap-2': icon || external }, { 'rounded-full': rounded }, { 'flex-row-reverse': iconFirst }, "".concat(sizes[size].y, " ").concat(sizes[size].x, " ").concat(sizes[size].text), className);
|
|
45
64
|
var iconClasses = cx(sizes[size].icon);
|
|
46
|
-
return (jsxRuntime.jsx("button", { id: id, "data-testid": testID || id ||
|
|
47
|
-
};
|
|
48
|
-
Button.defaultProps = {
|
|
49
|
-
variant: 'primary',
|
|
50
|
-
size: 'medium',
|
|
51
|
-
type: 'button',
|
|
52
|
-
raised: true,
|
|
53
|
-
wide: true,
|
|
54
|
-
rounded: true,
|
|
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(react.Icon, { icon: icon, className: iconClasses }) })), external && (jsxRuntime.jsx("span", { className: "flex items-center", children: jsxRuntime.jsx(react.Icon, { icon: "carbon:launch", className: iconClasses }) }))] }) }));
|
|
55
66
|
};
|
|
67
|
+
Button.displayName = 'Button';
|
|
56
68
|
|
|
57
|
-
var
|
|
58
|
-
(function (
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
})(
|
|
65
|
-
var
|
|
66
|
-
(function (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
})(
|
|
72
|
-
var
|
|
73
|
-
(function (
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
})(
|
|
77
|
-
var
|
|
78
|
-
(function (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
})(
|
|
83
|
-
var
|
|
84
|
-
(function (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
69
|
+
var ALIGN;
|
|
70
|
+
(function (ALIGN) {
|
|
71
|
+
ALIGN["LEFT"] = "left";
|
|
72
|
+
ALIGN["CENTER"] = "center";
|
|
73
|
+
ALIGN["RIGHT"] = "right";
|
|
74
|
+
ALIGN["JUSTIFY"] = "justify";
|
|
75
|
+
ALIGN["NOWRAP"] = "nowrap";
|
|
76
|
+
})(ALIGN || (ALIGN = {}));
|
|
77
|
+
var TRANSFORM;
|
|
78
|
+
(function (TRANSFORM) {
|
|
79
|
+
TRANSFORM["LOWERCASE"] = "lowercase";
|
|
80
|
+
TRANSFORM["UPPERCASE"] = "uppercase";
|
|
81
|
+
TRANSFORM["CAPITALIZE"] = "capitalize";
|
|
82
|
+
TRANSFORM["NORMALCASE"] = "normal-case";
|
|
83
|
+
})(TRANSFORM || (TRANSFORM = {}));
|
|
84
|
+
var CONTEXTUAL;
|
|
85
|
+
(function (CONTEXTUAL) {
|
|
86
|
+
CONTEXTUAL["INVERTED"] = "inverted";
|
|
87
|
+
CONTEXTUAL["MUTED"] = "muted";
|
|
88
|
+
})(CONTEXTUAL || (CONTEXTUAL = {}));
|
|
89
|
+
var SIZE$1;
|
|
90
|
+
(function (SIZE) {
|
|
91
|
+
SIZE["SMALL"] = "small";
|
|
92
|
+
SIZE["LARGE"] = "large";
|
|
93
|
+
SIZE["INTRO"] = "intro";
|
|
94
|
+
})(SIZE$1 || (SIZE$1 = {}));
|
|
95
|
+
var TAG;
|
|
96
|
+
(function (TAG) {
|
|
97
|
+
TAG["P"] = "p";
|
|
98
|
+
TAG["SPAN"] = "span";
|
|
99
|
+
TAG["DIV"] = "div";
|
|
100
|
+
TAG["SMALL"] = "small";
|
|
101
|
+
})(TAG || (TAG = {}));
|
|
89
102
|
|
|
90
103
|
var Copy = function (_a) {
|
|
91
104
|
var _b;
|
|
92
|
-
var children = _a.children,
|
|
105
|
+
var children = _a.children, _c = _a.as, Tag = _c === void 0 ? TAG.P : _c, size = _a.size, _d = _a.align, align = _d === void 0 ? ALIGN.LEFT : _d, transform = _a.transform, id = _a.id, testID = _a.testID;
|
|
93
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' }, 'body-text', transform);
|
|
94
|
-
return jsxRuntime.jsx(Tag, { "data-testid": testID || id ||
|
|
95
|
-
};
|
|
96
|
-
Copy.defaultProps = {
|
|
97
|
-
inverted: false,
|
|
98
|
-
maxLength: false,
|
|
99
|
-
tag: Tag.DIV,
|
|
100
|
-
align: Align.LEFT,
|
|
107
|
+
return (jsxRuntime.jsx(Tag, { "data-testid": testID || id || 'Copy', className: classes, children: children }));
|
|
101
108
|
};
|
|
109
|
+
Copy.displayName = 'Copy';
|
|
102
110
|
|
|
103
111
|
var Hr = function () { return (jsxRuntime.jsx("hr", { className: cx('border-0 border-b border-dark-body-text dark:border-dark-body-text') })); };
|
|
112
|
+
Hr.displayName = 'Hr';
|
|
104
113
|
|
|
105
114
|
var HeadingTag;
|
|
106
115
|
(function (HeadingTag) {
|
|
@@ -128,7 +137,7 @@ var HeadingTransform;
|
|
|
128
137
|
|
|
129
138
|
var Heading = function (_a) {
|
|
130
139
|
var _b;
|
|
131
|
-
var children = _a.children,
|
|
140
|
+
var children = _a.children, _c = _a.tag, tag = _c === void 0 ? HeadingTag.H1 : _c, transform = _a.transform, align = _a.align, id = _a.id, testID = _a.testID, flush = _a.flush, className = _a.className;
|
|
132
141
|
var fontSize = function () {
|
|
133
142
|
switch (tag) {
|
|
134
143
|
case 'h1':
|
|
@@ -150,27 +159,24 @@ var Heading = function (_a) {
|
|
|
150
159
|
var classes = cx("font-heading font-bold ".concat(size), (_b = {}, _b["text-".concat(align)] = align, _b), { 'm-0': flush }, transform, className);
|
|
151
160
|
return (jsxRuntime.jsx(Tag, { "data-testid": testID || id || 'Heading', className: classes, children: children }));
|
|
152
161
|
};
|
|
153
|
-
Heading.
|
|
154
|
-
tag: HeadingTag.H1,
|
|
155
|
-
};
|
|
162
|
+
Heading.displayName = 'Heading';
|
|
156
163
|
|
|
157
164
|
/**
|
|
158
165
|
* Icon component
|
|
159
166
|
* List of supported icons can be found at https://icon-sets.iconify.design.
|
|
160
167
|
*/
|
|
161
168
|
var Icon = function (_a) {
|
|
162
|
-
var name = _a.name,
|
|
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);
|
|
163
171
|
if (color) {
|
|
164
|
-
return jsxRuntime.jsx(react.Icon, { "data-testid": testID || id ||
|
|
172
|
+
return (jsxRuntime.jsx(react.Icon, { "data-testid": testID || id || 'Icon', icon: name, width: size, height: size, color: color, className: className, fill: color || 'currentColor' }));
|
|
165
173
|
}
|
|
166
|
-
return jsxRuntime.jsx(react.Icon, { "data-testid": testID || id ||
|
|
167
|
-
};
|
|
168
|
-
Icon.defaultProps = {
|
|
169
|
-
size: 24,
|
|
174
|
+
return (jsxRuntime.jsx(react.Icon, { "data-testid": testID || id || 'Icon', icon: name, width: size, height: size }));
|
|
170
175
|
};
|
|
176
|
+
Icon.displayName = 'Icon';
|
|
171
177
|
|
|
172
178
|
var Image = function (_a) {
|
|
173
|
-
var src = _a.src, alt = _a.alt, title = _a.title, caption = _a.caption,
|
|
179
|
+
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;
|
|
174
180
|
var figureClasses = cx('m-0');
|
|
175
181
|
var classes = cx('w-full h-auto', className);
|
|
176
182
|
/**
|
|
@@ -184,9 +190,10 @@ var Image = function (_a) {
|
|
|
184
190
|
*/
|
|
185
191
|
return jsxRuntime.jsx("img", { "data-testid": testID || id || "Image", onLoad: onLoad, src: src, alt: alt, title: title, className: classes });
|
|
186
192
|
};
|
|
193
|
+
Image.displayName = 'Image';
|
|
187
194
|
|
|
188
195
|
var Link = function (_a) {
|
|
189
|
-
var href = _a.href, children = _a.children,
|
|
196
|
+
var href = _a.href, children = _a.children, _b = _a.onClick, onClick = _b === void 0 ? function () { return console.log('Link clicked'); } : _b, history = _a.history, target = _a.target, id = _a.id, testID = _a.testID, className = _a.className;
|
|
190
197
|
var handleClick = function (event) {
|
|
191
198
|
if (onClick) {
|
|
192
199
|
onClick(event);
|
|
@@ -203,12 +210,7 @@ var Link = function (_a) {
|
|
|
203
210
|
var classes = cx('link', className);
|
|
204
211
|
return (jsxRuntime.jsx("a", { "data-testid": testID || id || 'Link', className: classes, href: href, onClick: handleClick, target: target, children: children }));
|
|
205
212
|
};
|
|
206
|
-
Link.
|
|
207
|
-
href: undefined,
|
|
208
|
-
onClick: function () { return console.log('Link clicked'); },
|
|
209
|
-
history: undefined,
|
|
210
|
-
target: undefined,
|
|
211
|
-
};
|
|
213
|
+
Link.displayName = 'Link';
|
|
212
214
|
|
|
213
215
|
var Variants;
|
|
214
216
|
(function (Variants) {
|
|
@@ -229,51 +231,56 @@ var ListTag;
|
|
|
229
231
|
})(ListTag || (ListTag = {}));
|
|
230
232
|
|
|
231
233
|
var List = function (_a) {
|
|
232
|
-
var variants = _a.variants, children = _a.children,
|
|
233
|
-
var modifiers = variants
|
|
234
|
-
? variants.map(function (el) { return "list--".concat(el); })
|
|
235
|
-
: null;
|
|
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;
|
|
235
|
+
var modifiers = variants ? variants.map(function (el) { return "list--".concat(el); }) : null;
|
|
236
236
|
var Tag = as;
|
|
237
|
-
return jsxRuntime.jsx(Tag, { "data-testid": testID || id ||
|
|
238
|
-
};
|
|
239
|
-
List.defaultProps = {
|
|
240
|
-
as: ListTag.UL,
|
|
237
|
+
return (jsxRuntime.jsx(Tag, { "data-testid": testID || id || 'List', className: cx(modifiers, className), children: children }));
|
|
241
238
|
};
|
|
239
|
+
List.displayName = 'List';
|
|
242
240
|
|
|
243
241
|
var ListItem = function (_a) {
|
|
244
|
-
var children = _a.children,
|
|
245
|
-
return jsxRuntime.jsx(Tag, { "data-testid": testID || id ||
|
|
246
|
-
};
|
|
247
|
-
ListItem.defaultProps = {
|
|
248
|
-
as: 'li',
|
|
242
|
+
var children = _a.children, _b = _a.as, Tag = _b === void 0 ? 'li' : _b, id = _a.id, testID = _a.testID, className = _a.className;
|
|
243
|
+
return (jsxRuntime.jsx(Tag, { "data-testid": testID || id || 'ListItem', className: cx('list-item', className), children: children }));
|
|
249
244
|
};
|
|
245
|
+
ListItem.displayName = 'ListItem';
|
|
250
246
|
|
|
251
247
|
var Notice = function (_a) {
|
|
252
|
-
var
|
|
253
|
-
return (jsxRuntime.jsx("div", { "data-testid": testID || id ||
|
|
248
|
+
var _b = _a.foo, foo = _b === void 0 ? 'bar' : _b, id = _a.id, testID = _a.testID;
|
|
249
|
+
return (jsxRuntime.jsx("div", { "data-testid": testID || id || 'Notice', className: "foo-bar", children: foo }));
|
|
254
250
|
};
|
|
251
|
+
Notice.displayName = 'Notice';
|
|
255
252
|
|
|
256
253
|
var Loader = function (_a) {
|
|
257
|
-
var size = _a.
|
|
254
|
+
var color = _a.color, _b = _a.size, size = _b === void 0 ? 8 : _b, _c = _a.thickness, thickness = _c === void 0 ? 4 : _c;
|
|
258
255
|
var sizeClass = size ? "w-".concat(size, " h-").concat(size) : 'w-8 h-8';
|
|
259
|
-
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:
|
|
260
|
-
};
|
|
261
|
-
Loader.defaultProps = {
|
|
262
|
-
size: 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..." })] }) }));
|
|
263
257
|
};
|
|
258
|
+
Loader.displayName = 'Loader';
|
|
264
259
|
|
|
265
260
|
var Container = function (_a) {
|
|
266
|
-
var children = _a.children, className = _a.className, spacing = _a.spacing;
|
|
267
|
-
var classes = cx('container', 'mx-auto', 'my-0', 'px-4', { '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);
|
|
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);
|
|
268
263
|
return (jsxRuntime.jsx("div", { "data-testid": "Container", className: classes, children: children }));
|
|
269
264
|
};
|
|
270
|
-
Container.
|
|
265
|
+
Container.displayName = 'Container';
|
|
266
|
+
|
|
267
|
+
var SPACING;
|
|
268
|
+
(function (SPACING) {
|
|
269
|
+
SPACING["NONE"] = "none";
|
|
270
|
+
SPACING["ATOM"] = "atom";
|
|
271
|
+
SPACING["DEFAULT"] = "default";
|
|
272
|
+
SPACING["ELEMENT"] = "element";
|
|
273
|
+
SPACING["COMPONENT"] = "component";
|
|
274
|
+
SPACING["MODULE"] = "module";
|
|
275
|
+
SPACING["FEATURE"] = "feature";
|
|
276
|
+
})(SPACING || (SPACING = {}));
|
|
271
277
|
|
|
272
278
|
var ContentPageLayout = function (_a) {
|
|
273
|
-
var
|
|
279
|
+
var _b = _a.spacing, spacing = _b === void 0 ? SPACING.DEFAULT : _b, children = _a.children, narrow = _a.narrow, flush = _a.flush, className = _a.className;
|
|
274
280
|
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);
|
|
275
281
|
return (jsxRuntime.jsx("div", { "data-testid": "ContentPageLayout", className: classes, children: children }));
|
|
276
282
|
};
|
|
283
|
+
ContentPageLayout.displayName = 'ContentPageLayout';
|
|
277
284
|
|
|
278
285
|
var SIZE;
|
|
279
286
|
(function (SIZE) {
|
|
@@ -287,13 +294,211 @@ var SIZE;
|
|
|
287
294
|
})(SIZE || (SIZE = {}));
|
|
288
295
|
|
|
289
296
|
var ContentRowsLayout = function (_a) {
|
|
290
|
-
var className = _a.className, children = _a.children,
|
|
297
|
+
var className = _a.className, children = _a.children, _b = _a.size, size = _b === void 0 ? SIZE.DEFAULT : _b;
|
|
291
298
|
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);
|
|
292
299
|
return (jsxRuntime.jsx("div", { "data-testid": "ContentRowsLayout", className: classes, children: children }));
|
|
293
300
|
};
|
|
294
|
-
ContentRowsLayout.
|
|
295
|
-
|
|
301
|
+
ContentRowsLayout.displayName = 'ContentRowsLayout';
|
|
302
|
+
|
|
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
|
+
/******************************************************************************
|
|
315
|
+
Copyright (c) Microsoft Corporation.
|
|
316
|
+
|
|
317
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
318
|
+
purpose with or without fee is hereby granted.
|
|
319
|
+
|
|
320
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
321
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
322
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
323
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
324
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
325
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
326
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
327
|
+
***************************************************************************** */
|
|
328
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
var __assign = function() {
|
|
332
|
+
__assign = Object.assign || function __assign(t) {
|
|
333
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
334
|
+
s = arguments[i];
|
|
335
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
336
|
+
}
|
|
337
|
+
return t;
|
|
338
|
+
};
|
|
339
|
+
return __assign.apply(this, arguments);
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
function __rest(s, e) {
|
|
343
|
+
var t = {};
|
|
344
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
345
|
+
t[p] = s[p];
|
|
346
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
347
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
348
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
349
|
+
t[p[i]] = s[p[i]];
|
|
350
|
+
}
|
|
351
|
+
return t;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
355
|
+
var e = new Error(message);
|
|
356
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
var FieldTypes;
|
|
360
|
+
(function (FieldTypes) {
|
|
361
|
+
FieldTypes["TEXT"] = "text";
|
|
362
|
+
FieldTypes["TEXTAREA"] = "textarea";
|
|
363
|
+
FieldTypes["SELECT"] = "select";
|
|
364
|
+
FieldTypes["CHECKBOX"] = "checkbox";
|
|
365
|
+
FieldTypes["RADIO"] = "radio";
|
|
366
|
+
FieldTypes["SWITCH"] = "switch";
|
|
367
|
+
FieldTypes["DATE"] = "date";
|
|
368
|
+
FieldTypes["TIME"] = "time";
|
|
369
|
+
FieldTypes["DATETIME"] = "datetime";
|
|
370
|
+
FieldTypes["FILE"] = "file";
|
|
371
|
+
FieldTypes["PASSWORD"] = "password";
|
|
372
|
+
FieldTypes["EMAIL"] = "email";
|
|
373
|
+
FieldTypes["NUMBER"] = "number";
|
|
374
|
+
FieldTypes["TEL"] = "tel";
|
|
375
|
+
FieldTypes["URL"] = "url";
|
|
376
|
+
FieldTypes["SEARCH"] = "search";
|
|
377
|
+
// MONTH = 'month',
|
|
378
|
+
// WEEK = 'week',
|
|
379
|
+
// HIDDEN = 'hidden',
|
|
380
|
+
// COLOR = 'color',
|
|
381
|
+
// RANGE = 'range',
|
|
382
|
+
// CURRENCY = 'currency',
|
|
383
|
+
// PERCENT = 'percent',
|
|
384
|
+
})(FieldTypes || (FieldTypes = {}));
|
|
385
|
+
|
|
386
|
+
var InputType;
|
|
387
|
+
(function (InputType) {
|
|
388
|
+
InputType["TEXT"] = "text";
|
|
389
|
+
InputType["PASSWORD"] = "password";
|
|
390
|
+
InputType["EMAIL"] = "email";
|
|
391
|
+
InputType["NUMBER"] = "number";
|
|
392
|
+
InputType["TEL"] = "tel";
|
|
393
|
+
InputType["URL"] = "url";
|
|
394
|
+
InputType["SEARCH"] = "search";
|
|
395
|
+
InputType["DATE"] = "date";
|
|
396
|
+
InputType["TIME"] = "time";
|
|
397
|
+
InputType["DATETIME"] = "datetime-local";
|
|
398
|
+
InputType["MONTH"] = "month";
|
|
399
|
+
InputType["WEEK"] = "week";
|
|
400
|
+
InputType["FILE"] = "file";
|
|
401
|
+
InputType["TEXTAREA"] = "textarea";
|
|
402
|
+
})(InputType || (InputType = {}));
|
|
403
|
+
|
|
404
|
+
var TextInput = React.forwardRef(function MyInput(_a, ref) {
|
|
405
|
+
var _b = _a.type, type = _b === void 0 ? InputType.TEXT : _b, required = _a.required, className = _a.className, onChange = _a.onChange, placeholder = _a.placeholder, icon = _a.icon, disabled = _a.disabled, rest = __rest(_a, ["type", "required", "className", "onChange", "placeholder", "icon", "disabled"]);
|
|
406
|
+
React.useEffect(function () {
|
|
407
|
+
if (typeof window !== 'undefined') {
|
|
408
|
+
// eslint-disable-next-line global-require
|
|
409
|
+
require('date-input-polyfill');
|
|
410
|
+
}
|
|
411
|
+
}, []);
|
|
412
|
+
var format = 'dd/mm/yyyy';
|
|
413
|
+
var placeholderSet = type === 'date' ? format.toUpperCase() : placeholder;
|
|
414
|
+
if (type === InputType.TEXTAREA) {
|
|
415
|
+
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
|
+
}
|
|
417
|
+
return (jsxRuntime.jsxs("div", { "data-testid": "TextInput", className: "relative", children: [icon && (jsxRuntime.jsx("div", { className: "form-icon absolute inset-y-0 start-3 flex items-center ps-3.5 pointer-events-none", children: jsxRuntime.jsx(Icon, { name: icon }) })), jsxRuntime.jsx("input", __assign({ ref: ref, type: type, required: required, "aria-required": required, disabled: disabled, placeholder: placeholderSet, onChange: onChange, className: cx('form-item text-input', { 'pl-12': icon }, className) }, rest))] }));
|
|
418
|
+
});
|
|
419
|
+
TextInput.displayName = 'TextInput';
|
|
420
|
+
|
|
421
|
+
var Checkbox = React.forwardRef(function MyInput(_a, ref) {
|
|
422
|
+
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", __assign({ className: "relative bg-none w-5 h-5 flex justify-center items-center", "aria-label": label, id: id, ref: ref }, rest, { 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", htmlFor: id, children: label }))] }));
|
|
424
|
+
});
|
|
425
|
+
Checkbox.displayName = 'Checkbox';
|
|
426
|
+
|
|
427
|
+
var Label = function (_a) {
|
|
428
|
+
var label = _a.label, id = _a.id;
|
|
429
|
+
return (jsxRuntime.jsx("label", { "data-testid": "Label", className: "label mb-1", htmlFor: id, children: label }));
|
|
430
|
+
};
|
|
431
|
+
Label.displayName = 'Label';
|
|
432
|
+
|
|
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
|
+
return (jsxRuntime.jsx("div", { id: id, className: cx('pb-2', className), children: jsxRuntime.jsxs("div", { className: "relative", children: [jsxRuntime.jsx("select", { id: id, name: name, disabled: disabled, required: required, className: "form-item text-input", children: options.map(function (option) { return (jsxRuntime.jsx("option", { value: option.value, disabled: option.disabled, children: option.label }, option.value)); }) }), 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" }) })] }) }));
|
|
436
|
+
};
|
|
437
|
+
FormSelect.displayName = 'FormSelect';
|
|
438
|
+
|
|
439
|
+
var Radio = React.forwardRef(function MyInput(_a, ref) {
|
|
440
|
+
var id = _a.id, name = _a.name, label = _a.label, required = _a.required, className = _a.className, options = _a.options, rest = __rest(_a, ["id", "name", "label", "required", "className", "options"]);
|
|
441
|
+
return (jsxRuntime.jsx("div", { "data-testid": "Radio", className: cx('flex items-center', className), children: jsxRuntime.jsx("div", __assign({ className: cx('flex flex-col gap-2', className), "aria-label": label, id: id, ref: ref }, rest, { 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", { id: option.value, name: name, type: "radio", required: required, className: "form-item radio peer appearance-none m-0 p-0 w-4 h-4" }), 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
|
+
});
|
|
443
|
+
Radio.displayName = 'Radio';
|
|
444
|
+
|
|
445
|
+
var Switch = React.forwardRef(function MyInput(_a, ref) {
|
|
446
|
+
var id = _a.id, name = _a.name, required = _a.required, disabled = _a.disabled, className = _a.className, rest = __rest(_a, ["id", "name", "required", "disabled", "className"]);
|
|
447
|
+
return (jsxRuntime.jsxs("label", { "data-testid": "Switch", className: cx('inline-flex items-center cursor-pointer', className), children: [jsxRuntime.jsx("input", __assign({ ref: ref, id: id, name: name, type: "checkbox", value: "", className: "sr-only peer", disabled: disabled, required: required }, rest)), jsxRuntime.jsx("div", { className: "form-item switch peer-focus:ring-info dark:peer-focus:ring-info relative w-11 h-6 peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[1px] after:start-[1px] after:bg-white after:border after:rounded-full after:h-5 after:w-5 after:transition-all transition-all" })] }));
|
|
448
|
+
});
|
|
449
|
+
Switch.displayName = 'Switch';
|
|
450
|
+
|
|
451
|
+
var FileUpload = React.forwardRef(function MyInput(_a, ref) {
|
|
452
|
+
var id = _a.id, name = _a.name, required = _a.required, disabled = _a.disabled, className = _a.className, rest = __rest(_a, ["id", "name", "required", "disabled", "className"]);
|
|
453
|
+
return (jsxRuntime.jsx("div", { "data-testid": "FileUpload", className: className, children: jsxRuntime.jsx("input", __assign({ ref: ref, className: cx('form-item text-input file-upload p-0 relative m-0 min-w-0 flex-auto appearance-none block box-border bg-clip-padding file:p-3 file:cursor-pointer file:mr-3 file:overflow-hidden cursor-pointer file:border-0 file:rounded-none file:border-solid file:border-inherit file:transition file:duration-150 file:ease-in-out file:[border-inline-end-width:1px] file:[margin-inline-end:0.75rem] '), "aria-describedby": "file_input_help", type: "file", disabled: disabled, required: required, name: name, id: id }, rest)) }));
|
|
454
|
+
});
|
|
455
|
+
FileUpload.displayName = 'FileUpload';
|
|
456
|
+
|
|
457
|
+
var FormField = function (_a) {
|
|
458
|
+
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;
|
|
459
|
+
var _b = reactHookForm.useForm(), control = _b.control, register = _b.register;
|
|
460
|
+
var _c = React.useState(false), passwordShowStatus = _c[0], setPasswordShow = _c[1];
|
|
461
|
+
var renderType = function (type, field) {
|
|
462
|
+
switch (type) {
|
|
463
|
+
case FieldTypes.TEXT:
|
|
464
|
+
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.TEXT, required: required, icon: icon, className: className, disabled: disabled }, field, register(name))));
|
|
465
|
+
case FieldTypes.PASSWORD: {
|
|
466
|
+
var toggleType = passwordShowStatus ? InputType.TEXT : InputType.PASSWORD;
|
|
467
|
+
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 }, field, register(name)))] }));
|
|
469
|
+
}
|
|
470
|
+
case FieldTypes.TEXTAREA:
|
|
471
|
+
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.TEXTAREA, required: required, icon: icon, className: className, disabled: disabled }, field, register(name))));
|
|
472
|
+
case FieldTypes.EMAIL:
|
|
473
|
+
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.EMAIL, required: required, icon: icon, className: className, disabled: disabled }, field, register(name))));
|
|
474
|
+
case FieldTypes.DATE:
|
|
475
|
+
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.DATE, required: required, icon: icon, className: className, disabled: disabled }, field, register(name))));
|
|
476
|
+
case FieldTypes.DATETIME:
|
|
477
|
+
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.DATETIME, required: required, icon: icon, className: className, disabled: disabled }, field, register(name))));
|
|
478
|
+
case FieldTypes.NUMBER:
|
|
479
|
+
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.NUMBER, required: required, icon: icon, className: className, disabled: disabled }, field, register(name))));
|
|
480
|
+
case FieldTypes.CHECKBOX:
|
|
481
|
+
return (jsxRuntime.jsx(Checkbox, __assign({ required: required, id: name, className: className, label: label, disabled: disabled }, field, register(name))));
|
|
482
|
+
case FieldTypes.RADIO:
|
|
483
|
+
return (jsxRuntime.jsx(Radio, __assign({ required: required, id: name, className: className, label: label, options: options, disabled: disabled }, field, register(name))));
|
|
484
|
+
case FieldTypes.SWITCH:
|
|
485
|
+
return jsxRuntime.jsx(Switch, __assign({ required: required, className: className, disabled: disabled }, field, register(name)));
|
|
486
|
+
case FieldTypes.SELECT:
|
|
487
|
+
return (jsxRuntime.jsx(FormSelect, __assign({ required: required, id: name, className: className, disabled: disabled, label: label, options: options }, field, register(name))));
|
|
488
|
+
case FieldTypes.FILE:
|
|
489
|
+
return (jsxRuntime.jsx(FileUpload, __assign({ required: required, id: name, className: className, disabled: disabled }, field, register(name))));
|
|
490
|
+
default:
|
|
491
|
+
return (jsxRuntime.jsx(TextInput, __assign({ type: InputType.TEXT, required: required, disabled: disabled, icon: icon, className: className }, field, register(name))));
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
// TODO: HELPER CLASSES : data-[invalid=true]:bg-error data-[valid]:bg-success
|
|
495
|
+
var showLabel = label && type !== FieldTypes.CHECKBOX;
|
|
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: "checkbox", control: control, rules: { required: true }, render: function (_a) {
|
|
497
|
+
var field = _a.field;
|
|
498
|
+
return renderType(type, field);
|
|
499
|
+
} }), description && jsxRuntime.jsx(Copy, { size: SIZE$1.SMALL, children: description })] }) }));
|
|
296
500
|
};
|
|
501
|
+
FormField.displayName = 'FormField';
|
|
297
502
|
|
|
298
503
|
exports.Blockquote = Blockquote;
|
|
299
504
|
exports.Button = Button;
|
|
@@ -301,6 +506,8 @@ exports.Container = Container;
|
|
|
301
506
|
exports.ContentPageLayout = ContentPageLayout;
|
|
302
507
|
exports.ContentRowsLayout = ContentRowsLayout;
|
|
303
508
|
exports.Copy = Copy;
|
|
509
|
+
exports.Form = Form;
|
|
510
|
+
exports.FormField = FormField;
|
|
304
511
|
exports.Heading = Heading;
|
|
305
512
|
exports.Hr = Hr;
|
|
306
513
|
exports.Icon = Icon;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Props } from './Blockquote.types';
|
|
2
2
|
declare const Blockquote: {
|
|
3
3
|
({ text, citation, className, citationAttribute, showIcon, }: Props): React.ReactElement;
|
|
4
|
-
|
|
5
|
-
showIcon: boolean;
|
|
6
|
-
};
|
|
4
|
+
displayName: string;
|
|
7
5
|
};
|
|
8
6
|
export default Blockquote;
|
|
7
|
+
export type { Props };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Props } from './Button.types';
|
|
2
2
|
declare const Button: {
|
|
3
|
-
({ variant, size, uppercase, children, id,
|
|
4
|
-
|
|
3
|
+
({ variant, size, type, wide, rounded, raised, uppercase, children, id, disabled, ariaLabel, onClick, icon, external, iconFirst, outline, testID, className, }: Props): React.ReactElement;
|
|
4
|
+
displayName: string;
|
|
5
5
|
};
|
|
6
6
|
export default Button;
|
|
7
|
+
export type { Props };
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
import { MouseEventHandler } from 'react';
|
|
2
|
+
export declare enum BTN_TYPES {
|
|
3
|
+
SUBMIT = "submit",
|
|
4
|
+
RESET = "reset",
|
|
5
|
+
BUTTON = "button"
|
|
6
|
+
}
|
|
7
|
+
export declare enum BTN_VARIANTS {
|
|
8
|
+
PRIMARY = "primary",
|
|
9
|
+
SECONDARY = "secondary",
|
|
10
|
+
TERTIARY = "tertiary"
|
|
11
|
+
}
|
|
12
|
+
export declare enum BTN_SIZES {
|
|
13
|
+
SMALL = "small",
|
|
14
|
+
MEDIUM = "medium",
|
|
15
|
+
LARGE = "large"
|
|
16
|
+
}
|
|
2
17
|
export interface Props {
|
|
3
|
-
variant?:
|
|
4
|
-
size
|
|
18
|
+
variant?: BTN_VARIANTS;
|
|
19
|
+
size?: BTN_SIZES;
|
|
5
20
|
uppercase?: boolean;
|
|
6
21
|
children: React.ReactNode;
|
|
7
|
-
type?:
|
|
22
|
+
type?: BTN_TYPES;
|
|
8
23
|
disabled?: boolean;
|
|
9
|
-
ariaLabel
|
|
24
|
+
ariaLabel?: string;
|
|
10
25
|
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
11
26
|
icon?: string;
|
|
12
27
|
external?: boolean;
|
|
@@ -17,4 +32,5 @@ export interface Props {
|
|
|
17
32
|
rounded?: boolean;
|
|
18
33
|
id?: string;
|
|
19
34
|
testID?: string;
|
|
35
|
+
className?: string;
|
|
20
36
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|