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