@integry/sdk 4.5.2 → 4.5.4

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 (279) hide show
  1. package/.vscode/launch.json +2 -2
  2. package/THIRD_PARTY_LICENSES +0 -37
  3. package/dist/esm/index.csm.d.ts +12 -2
  4. package/dist/esm/index.csm.js +7262 -1
  5. package/dist/umd/index.umd.d.ts +9 -1
  6. package/dist/umd/index.umd.js +7262 -1
  7. package/jest.config.cjs +10 -0
  8. package/package.json +10 -4
  9. package/src/components/AddTagButton/index.ts +23 -0
  10. package/src/components/BasicSelect/index.ts +114 -0
  11. package/src/components/BasicSelect/styles.module.scss +44 -0
  12. package/src/components/Button/index.ts +94 -0
  13. package/src/components/Button/styles.module.scss +152 -0
  14. package/src/components/CheckboxGroup/Checkbox.ts +104 -0
  15. package/src/components/CheckboxGroup/index.ts +190 -0
  16. package/src/components/CheckboxGroup/styles.module.scss +63 -0
  17. package/src/components/CollapsedMenu/index.ts +101 -0
  18. package/src/components/CollapsedMenu/styles.module.scss +46 -0
  19. package/src/components/ConfigureFieldWrapper/index.ts +85 -0
  20. package/src/components/ConfigureFieldWrapper/styles.module.scss +57 -0
  21. package/src/components/EditableText/index.ts +121 -0
  22. package/src/components/EditableText/styles.module.scss +38 -0
  23. package/src/components/EditableTextArea/index.ts +143 -0
  24. package/src/components/EditableTextArea/styles.module.scss +91 -0
  25. package/src/components/ErrorMessage/index.ts +16 -0
  26. package/src/components/ErrorMessage/styles.module.scss +19 -0
  27. package/src/components/ErrorPage/index.ts +42 -0
  28. package/src/components/ErrorPage/styles.module.scss +26 -0
  29. package/src/components/Footer/index.ts +41 -0
  30. package/src/components/Footer/styles.module.scss +40 -0
  31. package/src/components/HTMLContent/index.tsx +275 -0
  32. package/src/components/HTMLContent/styles.module.scss +3 -0
  33. package/src/components/InfoBox/index.ts +48 -0
  34. package/src/components/InfoBox/styles.module.scss +21 -0
  35. package/src/components/Input/BaseInput/index.ts +170 -0
  36. package/src/components/Input/BaseInput/styles.module.scss +94 -0
  37. package/src/components/Input/DateInput/index.ts +103 -0
  38. package/src/components/Input/DateInput/styles.module.scss +50 -0
  39. package/src/components/Input/Input/index.ts +206 -0
  40. package/src/components/Input/Input/styles.module.scss +14 -0
  41. package/src/components/Input/PasswordInput/index.ts +164 -0
  42. package/src/components/Input/PasswordInput/styles.module.scss +37 -0
  43. package/src/components/Input/index.ts +7 -0
  44. package/src/components/Label/index.ts +61 -0
  45. package/src/components/Label/styles.module.scss +41 -0
  46. package/src/components/LargeLoader/index.ts +25 -0
  47. package/src/components/LargeLoader/styles.module.scss +16 -0
  48. package/src/components/Listbox/ListBoxItem.ts +57 -0
  49. package/src/components/Listbox/index.ts +479 -0
  50. package/src/components/Listbox/styles.module.scss +197 -0
  51. package/src/components/Loader/index.ts +25 -0
  52. package/src/components/Loader/styles.module.scss +16 -0
  53. package/src/components/MediaGallery/MediaGalleryModal.ts +82 -0
  54. package/src/components/MediaGallery/MediaSlider.ts +76 -0
  55. package/src/components/MediaGallery/index.ts +92 -0
  56. package/src/components/MediaGallery/styles.module.scss +156 -0
  57. package/src/components/MediaUpload/index.ts +233 -0
  58. package/src/components/MediaUpload/styles.module.scss +118 -0
  59. package/src/components/Modal/index.ts +87 -0
  60. package/src/components/Modal/styles.module.scss +441 -0
  61. package/src/components/MultipurposeField/Dropdown/ListBoxItem.tsx +58 -0
  62. package/src/components/MultipurposeField/Dropdown/index.tsx +981 -0
  63. package/src/components/MultipurposeField/Dropdown/styles.module.scss +208 -0
  64. package/src/components/MultipurposeField/TagMenu/index.ts +384 -0
  65. package/src/components/MultipurposeField/TagMenu/styles.module.scss +136 -0
  66. package/src/components/MultipurposeField/TagOptions/index.tsx +83 -0
  67. package/src/components/MultipurposeField/TagOptions/styles.module.scss +95 -0
  68. package/src/components/MultipurposeField/index.tsx +687 -0
  69. package/src/components/MultipurposeField/styles.module.scss +56 -0
  70. package/src/components/NewModal/index.ts +69 -0
  71. package/src/components/NewModal/styles.module.scss +70 -0
  72. package/src/components/OverflowTooltip/index.tsx +59 -0
  73. package/src/components/PopUp/ConfirmationPopUp/index.ts +58 -0
  74. package/src/components/PopUp/ConfirmationPopUp/styles.module.scss +49 -0
  75. package/src/components/PopUp/SuccessPopUp/index.ts +62 -0
  76. package/src/components/PopUp/SuccessPopUp/styles.module.scss +38 -0
  77. package/src/components/RadioGroup/Radio.ts +129 -0
  78. package/src/components/RadioGroup/index.ts +169 -0
  79. package/src/components/RadioGroup/styles.module.scss +81 -0
  80. package/src/components/Search/index.ts +69 -0
  81. package/src/components/Search/styles.module.scss +149 -0
  82. package/src/components/TabBar/Tab.ts +33 -0
  83. package/src/components/TabBar/index.ts +64 -0
  84. package/src/components/TabBar/styles.module.scss +43 -0
  85. package/src/components/Tag/index.ts +29 -0
  86. package/src/components/Tag/styles.module.scss +57 -0
  87. package/src/components/TextArea/index.ts +172 -0
  88. package/src/components/TextArea/styles.module.scss +70 -0
  89. package/src/components/TextContent/index.tsx +128 -0
  90. package/src/components/TextContent/styles.module.scss +6 -0
  91. package/src/components/ThreeDotLoader/index.ts +39 -0
  92. package/src/components/ThreeDotLoader/styles.module.scss +41 -0
  93. package/src/components/TimeInput/index.ts +129 -0
  94. package/src/components/TimeInput/styles.module.scss +16 -0
  95. package/src/components/Toggle/index.ts +34 -0
  96. package/src/components/Toggle/styles.module.scss +56 -0
  97. package/src/components/Toggle-v2/index.ts +40 -0
  98. package/src/components/Toggle-v2/styles.module.scss +86 -0
  99. package/src/components/Tooltip/index.ts +271 -0
  100. package/src/components/Tooltip/styles.module.scss +105 -0
  101. package/src/components/form/ObjectField/index.ts +364 -0
  102. package/src/components/form/ObjectField/styles.module.scss +103 -0
  103. package/src/components/form/index.ts +3 -0
  104. package/src/contexts/AppContext.ts +12 -0
  105. package/src/declaration.d.ts +7 -0
  106. package/src/extensions/HMAC.ts +25 -0
  107. package/src/extensions/IntegryAPIError.ts +19 -0
  108. package/src/features/common/AccountDropdown/index.ts +291 -0
  109. package/src/features/common/AccountDropdown/styles.module.scss +19 -0
  110. package/src/features/common/ActionForm/index.ts +1818 -0
  111. package/src/features/common/ActionForm/styles.module.scss +23 -0
  112. package/src/features/common/AppCard/index.ts +207 -0
  113. package/src/features/common/AppCard/styles.module.scss +117 -0
  114. package/src/features/common/AppCardCompact/index.ts +189 -0
  115. package/src/features/common/AppCardCompact/styles.module.scss +141 -0
  116. package/src/features/common/AuthSelector/index.ts +537 -0
  117. package/src/features/common/AuthSelector/styles.module.scss +161 -0
  118. package/src/features/common/AuthSelectorCompact/index.ts +706 -0
  119. package/src/features/common/AuthSelectorCompact/styles.module.scss +219 -0
  120. package/src/features/common/AuthSelectorDropdown/index.ts +704 -0
  121. package/src/features/common/AuthSelectorDropdown/styles.module.scss +361 -0
  122. package/src/features/common/DynamicField/index.ts +229 -0
  123. package/src/features/common/DynamicField/styles.module.scss +67 -0
  124. package/src/features/common/DynamicTypedField/index.ts +217 -0
  125. package/src/features/common/DynamicTypedField/styles.module.scss +67 -0
  126. package/src/features/common/FunctionForm/index.ts +862 -0
  127. package/src/features/common/FunctionForm/styles.module.scss +163 -0
  128. package/src/features/common/MappingUI/index.ts +649 -0
  129. package/src/features/common/MappingUI/styles.module.scss +121 -0
  130. package/src/features/common/MarketplaceAppCard/index.ts +279 -0
  131. package/src/features/common/MarketplaceAppCard/styles.module.scss +231 -0
  132. package/src/features/common/MarketplaceAppCardCompact/index.ts +283 -0
  133. package/src/features/common/MarketplaceAppCardCompact/styles.module.scss +255 -0
  134. package/src/features/common/NewMappingUI/index.ts +515 -0
  135. package/src/features/common/NewMappingUI/styles.module.scss +113 -0
  136. package/src/features/common/RequestAppWidget/RequestAppModal/index.ts +67 -0
  137. package/src/features/common/RequestAppWidget/RequestAppModal/styles.module.scss +23 -0
  138. package/src/features/common/RequestAppWidget/index.ts +48 -0
  139. package/src/features/common/RequestAppWidget/request-app-form.ts +89 -0
  140. package/src/features/common/RequestAppWidget/styles.module.scss +43 -0
  141. package/src/features/common/SectionField/index.ts +272 -0
  142. package/src/features/common/SectionField/styles.module.scss +67 -0
  143. package/src/features/common/Step/index.ts +827 -0
  144. package/src/features/common/Step/styles.module.scss +12 -0
  145. package/src/features/common/StepNavigation/CollapsedSteps.ts +125 -0
  146. package/src/features/common/StepNavigation/NavItem.ts +111 -0
  147. package/src/features/common/StepNavigation/index.ts +257 -0
  148. package/src/features/common/StepNavigation/styles.module.scss +117 -0
  149. package/src/features/common/Steps/index.ts +1139 -0
  150. package/src/features/common/Steps/styles.module.scss +314 -0
  151. package/src/features/containers/AppFlowContainer/AppFlowListing/compactStyles.module.scss +383 -0
  152. package/src/features/containers/AppFlowContainer/AppFlowListing/flow-instance.tsx +367 -0
  153. package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.tsx +194 -0
  154. package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.tsx +389 -0
  155. package/src/features/containers/AppFlowContainer/AppFlowListing/flowInstanceCompact.tsx +577 -0
  156. package/src/features/containers/AppFlowContainer/AppFlowListing/index.tsx +83 -0
  157. package/src/features/containers/AppFlowContainer/AppFlowListing/styles.module.scss +212 -0
  158. package/src/features/containers/AppFlowContainer/AppFlowWrap/app-page-loader.tsx +45 -0
  159. package/src/features/containers/AppFlowContainer/AppFlowWrap/index.tsx +1081 -0
  160. package/src/features/containers/AppFlowContainer/AppFlowWrap/styles.module.scss +452 -0
  161. package/src/features/containers/AppFlowContainer/Authentication/index.ts +610 -0
  162. package/src/features/containers/AppFlowContainer/Authentication/styles.module.scss +468 -0
  163. package/src/features/containers/AppFlowContainer/index.ts +114 -0
  164. package/src/features/containers/AppPageContainer/AppPage/index.tsx +262 -0
  165. package/src/features/containers/AppPageContainer/AppPage/styles.module.scss +120 -0
  166. package/src/features/containers/AppPageContainer/IntegrationCard/index.ts +165 -0
  167. package/src/features/containers/AppPageContainer/IntegrationCard/styles.module.scss +81 -0
  168. package/src/features/containers/AppPageContainer/index.tsx +93 -0
  169. package/src/features/containers/AppPageContainer/styles.module.scss +0 -0
  170. package/src/features/containers/AppsForFlows/index.ts +161 -0
  171. package/src/features/containers/AppsForFlows/styles.module.scss +280 -0
  172. package/src/features/containers/AppsForFlowsCompact/index.ts +161 -0
  173. package/src/features/containers/AppsForFlowsCompact/styles.module.scss +279 -0
  174. package/src/features/containers/AuthSetupContainer/AppSelection.ts +73 -0
  175. package/src/features/containers/AuthSetupContainer/AuthTypeSelection.ts +67 -0
  176. package/src/features/containers/AuthSetupContainer/Footer.ts +32 -0
  177. package/src/features/containers/AuthSetupContainer/Header.ts +39 -0
  178. package/src/features/containers/AuthSetupContainer/PostAdditionPopup.ts +27 -0
  179. package/src/features/containers/AuthSetupContainer/index.ts +349 -0
  180. package/src/features/containers/AuthSetupContainer/styles.module.scss +229 -0
  181. package/src/features/containers/FlowSetupContainer/index.ts +390 -0
  182. package/src/features/containers/FlowSetupContainer/styles.module.scss +18 -0
  183. package/src/features/containers/MarkeplaceApps/index.ts +574 -0
  184. package/src/features/containers/MarkeplaceApps/styles.module.scss +559 -0
  185. package/src/features/containers/MarketplaceAppsCompact/index.ts +576 -0
  186. package/src/features/containers/MarketplaceAppsCompact/styles.module.scss +546 -0
  187. package/src/features/containers/MarketplaceAppsContainer/index.ts +83 -0
  188. package/src/features/containers/MarketplaceContainer/AppCard/index.ts +91 -0
  189. package/src/features/containers/MarketplaceContainer/AppCard/styles.module.scss +66 -0
  190. package/src/features/containers/MarketplaceContainer/AppListing/index.ts +34 -0
  191. package/src/features/containers/MarketplaceContainer/AppListing/styles.module.scss +10 -0
  192. package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/index.ts +132 -0
  193. package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/styles.module.scss +117 -0
  194. package/src/features/containers/MarketplaceContainer/index.ts +242 -0
  195. package/src/features/containers/MarketplaceContainer/styles.module.scss +84 -0
  196. package/src/features/containers/SDKContainer/index.ts +817 -0
  197. package/src/features/containers/SDKContainer/styles.module.scss +266 -0
  198. package/src/features/containers/SDKDebugContainer/index.ts +137 -0
  199. package/src/features/containers/SDKDebugContainer/styles.module.scss +37 -0
  200. package/src/features/containers/SDKFailedContainer/index.ts +117 -0
  201. package/src/features/containers/SDKFailedContainer/styles.module.scss +57 -0
  202. package/src/features/integrations/IntegrationRow/Icons.ts +77 -0
  203. package/src/features/integrations/IntegrationRow/index.ts +129 -0
  204. package/src/features/integrations/IntegrationRow/styles.module.scss +62 -0
  205. package/src/features/integrations/IntegrationsHeader/index.ts +34 -0
  206. package/src/features/integrations/IntegrationsHeader/styles.module.scss +47 -0
  207. package/src/features/integrations/IntegrationsList/index.ts +252 -0
  208. package/src/features/integrations/IntegrationsList/styles.module.scss +67 -0
  209. package/src/features/templates/Template/index.ts +295 -0
  210. package/src/features/templates/Template/styles.module.scss +226 -0
  211. package/src/features/templates/TemplatesView/index.ts +368 -0
  212. package/src/features/templates/TemplatesView/styles.module.scss +71 -0
  213. package/src/features/templates/TemplatesViewCompact/index.ts +364 -0
  214. package/src/features/templates/TemplatesViewCompact/styles.module.scss +141 -0
  215. package/src/hooks/useAutosizeTextArea.ts +22 -0
  216. package/src/hooks/useCustomRef.ts +13 -0
  217. package/src/hooks/useDebounce.ts +17 -0
  218. package/src/hooks/useElementResize.ts +40 -0
  219. package/src/hooks/useEventListener.ts +44 -0
  220. package/src/hooks/useHover.ts +40 -0
  221. package/src/hooks/useOnClickOutside.ts +32 -0
  222. package/src/index.ts +2051 -0
  223. package/src/index.umd.ts +13 -0
  224. package/src/interfaces/index.ts +924 -0
  225. package/src/modules/api/index.ts +1315 -0
  226. package/src/modules/api/responseHandler.ts +38 -0
  227. package/src/modules/event-emitter/index.ts +72 -0
  228. package/src/modules/event-emitter/runners/abstract.ts +21 -0
  229. package/src/modules/event-emitter/runners/default.ts +11 -0
  230. package/src/modules/event-emitter/runners/ntimes.ts +28 -0
  231. package/src/modules/event-emitter/types.ts +34 -0
  232. package/src/store/actionFunctions.ts +1573 -0
  233. package/src/store/index.ts +17 -0
  234. package/src/store/initialState.ts +58 -0
  235. package/src/stories/Button.stories.tsx +83 -0
  236. package/src/stories/Checkbox/Checkbox.stories.tsx +41 -0
  237. package/src/stories/Checkbox/CheckboxGroup.stories.tsx +46 -0
  238. package/src/stories/EditableText.stories.tsx +35 -0
  239. package/src/stories/Input/BaseInput.stories.tsx +48 -0
  240. package/src/stories/Input/DateInput.stories.tsx +28 -0
  241. package/src/stories/Input/Input.stories.tsx +24 -0
  242. package/src/stories/Input/PasswordInput.stories.tsx +26 -0
  243. package/src/stories/Introduction.stories.mdx +211 -0
  244. package/src/stories/Label.stories.tsx +27 -0
  245. package/src/stories/Listbox.stories.tsx +122 -0
  246. package/src/stories/Radio/Radio.stories.tsx +39 -0
  247. package/src/stories/Radio/RadioGroup.stories.tsx +46 -0
  248. package/src/stories/StepNavigation/NavItem.stories.tsx +31 -0
  249. package/src/stories/StepNavigation/StepNavigation.stories.tsx +50 -0
  250. package/src/stories/TabBar.stories.tsx +31 -0
  251. package/src/stories/TextArea.stories.tsx +23 -0
  252. package/src/stories/TimeInput.stories.tsx +37 -0
  253. package/src/stories/Toggle.stories.tsx +33 -0
  254. package/src/stories/assets/code-brackets.svg +1 -0
  255. package/src/stories/assets/colors.svg +1 -0
  256. package/src/stories/assets/comments.svg +1 -0
  257. package/src/stories/assets/direction.svg +1 -0
  258. package/src/stories/assets/flow.svg +1 -0
  259. package/src/stories/assets/plugin.svg +1 -0
  260. package/src/stories/assets/repo.svg +1 -0
  261. package/src/stories/assets/stackalt.svg +1 -0
  262. package/src/types/index.ts +293 -0
  263. package/src/types/store.ts +366 -0
  264. package/src/types/utils.ts +19 -0
  265. package/src/utils/ActivityOutputUtils.ts +163 -0
  266. package/src/utils/common.ts +20 -0
  267. package/src/utils/copyToClipboard.ts +24 -0
  268. package/src/utils/datetime.ts +101 -0
  269. package/src/utils/getUrlParam.ts +11 -0
  270. package/src/utils/isAuthMessage.ts +16 -0
  271. package/src/utils/isBrowser.ts +1 -0
  272. package/src/utils/jsonEncodeDecode.ts +15 -0
  273. package/src/utils/objectUtils.ts +116 -0
  274. package/src/utils/popup.ts +30 -0
  275. package/src/utils/searchJson.ts +51 -0
  276. package/src/utils/stepUtils.ts +45 -0
  277. package/src/utils/truncate.ts +6 -0
  278. package/test/setup.ts +1 -0
  279. package/vitest.config.ts +10 -0
@@ -0,0 +1,103 @@
1
+ import { html } from 'htm/preact';
2
+ import { ErrorMessage } from '@/components/ErrorMessage';
3
+ import { Label } from '@/components/Label';
4
+ import { Hint } from '@/components/Tooltip';
5
+ import { BaseInput } from '../BaseInput';
6
+
7
+ import styles from './styles.module.scss';
8
+
9
+ interface DateInputProps {
10
+ title: string;
11
+ description: string;
12
+ placeholder: string;
13
+ showStepValidation?: boolean;
14
+ isRequired?: boolean;
15
+ value?: string;
16
+ onChange?: (val: string) => void;
17
+ isReadOnly?: boolean;
18
+ isChanged?: boolean;
19
+ }
20
+
21
+ /**
22
+ * DateInput component
23
+ *
24
+ */
25
+ const DateInput = (props: DateInputProps) => {
26
+ const {
27
+ title,
28
+ description,
29
+ placeholder,
30
+ value,
31
+ showStepValidation = false,
32
+ isRequired = false,
33
+ onChange = () => null,
34
+ isReadOnly = false,
35
+ isChanged = false,
36
+ } = props;
37
+
38
+ return html`
39
+ <${Hint} dismissOnClick=${false} position="top" deltaY=${0}>
40
+ <div class="${styles.dateGroupWrapper}">
41
+ <fieldset>
42
+ <${Label} title=${title} description=${description}
43
+ isRequired=${isRequired} labelTag=${isReadOnly && isChanged ? 'Changed' : ''} //>
44
+ ${isReadOnly && html `<span class=${styles.readonlyHint} data-hint=${isReadOnly ? `Cannot modify user selection` : ''}></span>`}
45
+ <${BaseInput}
46
+ type="date"
47
+ placeholder=${placeholder}
48
+ handleChange=${onChange}
49
+ value=${value}
50
+ control=${() => html` <div
51
+ role="button"
52
+ class=${`${styles.visibilityToggle} ${isReadOnly ? styles.readonly : ''}`}
53
+ onclick=${() => {
54
+ if (!isReadOnly && value) onChange('');
55
+ }}
56
+ >
57
+ ${!value || isReadOnly
58
+ ? html`
59
+ <svg
60
+ width="25"
61
+ height="26"
62
+ viewBox="0 0 25 26"
63
+ fill="none"
64
+ xmlns="http://www.w3.org/2000/svg"
65
+ >
66
+ <path
67
+ fill-rule="evenodd"
68
+ clip-rule="evenodd"
69
+ d="M16.9543 5.5464H19.335L19.3349 5.54639C20.6491 5.54639 21.7156 6.61204 21.7156 7.92812L21.7147 19.8323C21.7147 21.1466 20.6482 22.2131 19.334 22.2131H5.04866C3.73449 22.2131 2.66797 21.1466 2.66797 19.8323V7.92719C2.66797 6.61296 3.73444 5.54639 5.04866 5.54639L7.42936 5.5473V4.35641C7.42936 3.69791 7.96262 3.16553 8.62019 3.16553C9.27777 3.16553 9.81102 3.69791 9.81102 4.35641V5.5464L14.5717 5.5473V4.35641C14.5717 3.69791 15.105 3.16553 15.7626 3.16553C16.4201 3.16553 16.9534 3.69791 16.9534 4.35641L16.9543 5.5464ZM4.04688 20.8324H20.3369L20.3358 8.7124H4.04688V20.8324Z"
70
+ fill="#999999"
71
+ />
72
+ </svg>
73
+ `
74
+ : html`
75
+ <svg
76
+ width="18"
77
+ height="18"
78
+ viewBox="0 0 18 18"
79
+ fill="none"
80
+ xmlns="http://www.w3.org/2000/svg"
81
+ >
82
+ <path
83
+ fill-rule="evenodd"
84
+ clip-rule="evenodd"
85
+ d="M9 0C13.9673 0 18 4.03275 18 9C18 13.9673 13.9673 18 9 18C4.03275 18 0 13.9673 0 9C0 4.03275 4.03275 0 9 0ZM9 0.75C13.5533 0.75 17.25 4.44675 17.25 9C17.25 13.5533 13.5533 17.25 9 17.25C4.44675 17.25 0.75 13.5533 0.75 9C0.75 4.44675 4.44675 0.75 9 0.75ZM9 8.46975L12.9697 4.5L13.5 5.03025L9.53025 9L13.5 12.9697L12.9697 13.5L9 9.53025L5.03025 13.5L4.5 12.9697L8.46975 9L4.5 5.03025L5.03025 4.5L9 8.46975Z"
86
+ fill="black"
87
+ />
88
+ </svg>
89
+ `}
90
+ </div>`}
91
+ isReadOnly=${isReadOnly}
92
+ ><//>
93
+ </fieldset>
94
+ ${showStepValidation &&
95
+ isRequired &&
96
+ !value &&
97
+ html`<${ErrorMessage}>Please enter a date<//>`}
98
+ </div>
99
+ <//>
100
+ `;
101
+ };
102
+
103
+ export { DateInput, DateInputProps };
@@ -0,0 +1,50 @@
1
+ .dateGroupWrapper {
2
+ fieldset {
3
+ border: none;
4
+ padding: 0;
5
+ margin: 0;
6
+ }
7
+
8
+ input[type='date'] {
9
+ position: relative;
10
+ cursor: pointer;
11
+ }
12
+
13
+ input[type='date']::-webkit-calendar-picker-indicator {
14
+ position: absolute;
15
+ top: 0;
16
+ right: 0;
17
+ width: 100%;
18
+ height: 100%;
19
+ padding: 0;
20
+ color: transparent;
21
+ background: transparent;
22
+ }
23
+ .visibilityToggle {
24
+ display: flex;
25
+ align-items: center;
26
+ position: absolute;
27
+ top: 0;
28
+ right: 10px;
29
+ bottom: 0;
30
+ margin: 0 auto;
31
+ svg {
32
+ cursor: pointer;
33
+ width: 20px;
34
+ &:hover {
35
+ opacity: 0.5;
36
+ }
37
+ }
38
+ &.readonly {
39
+ svg {
40
+ cursor: auto;
41
+ }
42
+ }
43
+ }
44
+ .readonlyHint {
45
+ width: 100%;
46
+ height: -webkit-fill-available;
47
+ z-index: 99;
48
+ position: absolute;
49
+ }
50
+ }
@@ -0,0 +1,206 @@
1
+ import { html } from 'htm/preact';
2
+ import { useEffect, useState } from 'preact/hooks';
3
+ import { forwardRef } from 'preact/compat';
4
+ import { ErrorMessage } from '@/components/ErrorMessage';
5
+ import { Label } from '@/components/Label';
6
+ import { Hint } from '@/components/Tooltip';
7
+
8
+ import { BaseInput } from '../BaseInput';
9
+ import styles from './styles.module.scss';
10
+
11
+ interface InputProps {
12
+ id: string;
13
+ title: string;
14
+ description: string;
15
+ placeholder: string;
16
+ value?: string;
17
+ regex: string | null;
18
+ regexErrorMessage: string | null;
19
+ isRequired?: boolean;
20
+ showStepValidation?: boolean;
21
+ onChange?: (
22
+ val: string | string[],
23
+ passesRegexTest?: boolean,
24
+ index?: number,
25
+ ) => void;
26
+ isReadOnly?: boolean;
27
+ isChanged?: boolean;
28
+ className?: string;
29
+ handleFocus?: () => void;
30
+ handleBlur?: () => void;
31
+ ref?: any;
32
+ fieldId: string;
33
+ hideError?: boolean;
34
+ isArray?: boolean; // New prop to check if the input is an array
35
+ isButtonEnabled?: boolean;
36
+ buttonText?: string;
37
+ onButtonClickScript?: string;
38
+ buttonScriptRequiresAuthToken?: boolean;
39
+ apiHandler?: any;
40
+ showLabel?: boolean;
41
+ forceShowDeleteIcon?: boolean;
42
+ handleRemoveInputFromParent?: (index: number) => void;
43
+ }
44
+
45
+ /**
46
+ * Input component for handling both single and array inputs
47
+ */
48
+ const Input = forwardRef((props: InputProps, ref) => {
49
+ const {
50
+ id,
51
+ title,
52
+ description,
53
+ placeholder,
54
+ value,
55
+ regex,
56
+ regexErrorMessage,
57
+ showStepValidation = false,
58
+ isRequired = false,
59
+ onChange = () => null,
60
+ handleFocus = () => null,
61
+ handleBlur = () => null,
62
+ isReadOnly = false,
63
+ isChanged = false,
64
+ className = '',
65
+ fieldId = `input-field`,
66
+ hideError = false,
67
+ isArray = false, // Default to false
68
+ isButtonEnabled = false,
69
+ buttonText = 'Add',
70
+ onButtonClickScript = '',
71
+ buttonScriptRequiresAuthToken = false,
72
+ apiHandler,
73
+ showLabel = true,
74
+ forceShowDeleteIcon = false,
75
+ handleRemoveInputFromParent,
76
+ } = props;
77
+
78
+ const [values, setValues] = useState(value ? [value] : ['']); // Track array of values
79
+ const [invalidInput, setInvalidInput] = useState(false);
80
+ const [showErrorOnFocusLoss, setShowErrorOnFocusLoss] = useState(true);
81
+
82
+ // validate on first render
83
+ useEffect(() => {
84
+ if (regex && values[values.length - 1] !== '') {
85
+ const invalid = !new RegExp(regex.replace(/^\/|\/$/g, '')).test(
86
+ `${values[values.length - 1]}`,
87
+ );
88
+ setInvalidInput(invalid);
89
+ }
90
+ }, [regex, values]);
91
+
92
+ const handleAddInput = () => {
93
+ setValues((prevValues) => {
94
+ const newValues = [...prevValues, ''];
95
+ onChange(newValues);
96
+ return newValues;
97
+ });
98
+ };
99
+
100
+ const handleChange = (inputValue: string, index: number) => {
101
+ let isValidInput = true;
102
+ if (
103
+ regex &&
104
+ inputValue !== '' &&
105
+ !new RegExp(regex.replace(/^\/|\/$/g, '')).test(inputValue)
106
+ ) {
107
+ isValidInput = false;
108
+ setInvalidInput(true);
109
+ } else {
110
+ setInvalidInput(false);
111
+ const newValues = [...values];
112
+ newValues[index] = inputValue;
113
+ setValues(newValues);
114
+ if (isArray) {
115
+ onChange(newValues, false, index);
116
+ } else {
117
+ onChange(newValues[0]);
118
+ }
119
+ }
120
+
121
+ if (
122
+ isArray &&
123
+ index === values.length - 1 &&
124
+ inputValue !== '' &&
125
+ isValidInput
126
+ ) {
127
+ handleAddInput();
128
+ }
129
+ };
130
+
131
+ const handleRemoveInput = (index: number) => {
132
+ if (forceShowDeleteIcon && handleRemoveInputFromParent) {
133
+ handleRemoveInputFromParent(index);
134
+ return;
135
+ }
136
+ setValues((prevValues) => {
137
+ const newValues = prevValues.filter((_, i) => i !== index);
138
+ onChange(newValues);
139
+ return newValues;
140
+ });
141
+ };
142
+
143
+ const validate = () => {
144
+ if (handleBlur) handleBlur();
145
+ setShowErrorOnFocusLoss(true);
146
+ };
147
+
148
+ return html`
149
+ <${Hint} dismissOnClick=${false} position="top" deltaY=${0}>
150
+ <div
151
+ class="${styles.inputGroupWrapper} ${styles[
152
+ className || ''
153
+ ]} integry-container__input"
154
+ >
155
+ <fieldset>
156
+ ${showLabel
157
+ ? html`<${Label} title=${title} description=${description}
158
+ isRequired=${isRequired}
159
+ labelTag=${isReadOnly && isChanged ? 'Changed' : ''} //>`
160
+ : html``}
161
+ ${isReadOnly &&
162
+ html`<span
163
+ class=${styles.readonlyHint}
164
+ data-hint=${isReadOnly ? `Cannot modify user selection` : ''}
165
+ ></span>`}
166
+ ${values.map((inputValue, index) => {
167
+ const inputId = isArray ? `${id}-${index}` : id;
168
+ return html`
169
+ <div key=${index} class="${styles.inputWrapper}">
170
+ <${BaseInput}
171
+ type="text"
172
+ placeholder=${placeholder}
173
+ handleChange=${(valueReceived: string) =>
174
+ handleChange(valueReceived, index)}
175
+ handleBlur=${validate}
176
+ handleFocus=${handleFocus}
177
+ value=${isArray ? inputValue : value}
178
+ isReadOnly=${isReadOnly}
179
+ className="${className}"
180
+ ref=${ref}
181
+ fieldId=${fieldId}
182
+ id="${inputId}"
183
+ showDeleteIcon=${forceShowDeleteIcon ||
184
+ (values.length > 1 && index !== values.length - 1)}
185
+ handleDeleteIconClick=${() => handleRemoveInput(index)}
186
+ isButtonEnabled=${isButtonEnabled}
187
+ buttonText=${buttonText}
188
+ onButtonClickScript=${onButtonClickScript}
189
+ buttonScriptRequiresAuthToken=${buttonScriptRequiresAuthToken}
190
+ apiHandler=${apiHandler}
191
+ />
192
+ </div>
193
+ `;
194
+ })}
195
+ ${!hideError &&
196
+ (showStepValidation || showErrorOnFocusLoss || value) &&
197
+ invalidInput &&
198
+ value &&
199
+ html`<${ErrorMessage}>${regexErrorMessage || 'Invalid input'}<//>`}
200
+ </fieldset>
201
+ </div>
202
+ <//>
203
+ `;
204
+ });
205
+
206
+ export { Input, InputProps };
@@ -0,0 +1,14 @@
1
+ .inputGroupWrapper {
2
+ fieldset {
3
+ padding: 0;
4
+ margin: 0;
5
+ border: none;
6
+ margin-bottom: 24px;
7
+ }
8
+ .readonlyHint {
9
+ width: 100%;
10
+ height: -webkit-fill-available;
11
+ z-index: 99;
12
+ position: absolute;
13
+ }
14
+ }
@@ -0,0 +1,164 @@
1
+ import { html } from 'htm/preact';
2
+ import { useEffect, useState } from 'preact/hooks';
3
+
4
+ import { ErrorMessage } from '@/components/ErrorMessage';
5
+ import { Hint } from '@/components/Tooltip';
6
+ import { BaseInput } from '../BaseInput';
7
+ import { Label } from '../../Label';
8
+
9
+ import styles from './styles.module.scss';
10
+
11
+ interface PasswordInputProps {
12
+ id: string;
13
+ title: string;
14
+ description: string;
15
+ placeholder: string;
16
+ showStepValidation?: boolean;
17
+ isRequired?: boolean;
18
+ regex: string | null;
19
+ regexErrorMessage: string | null;
20
+ value?: string;
21
+ onChange?: (val: string, passesRegexTest?: boolean) => void;
22
+ isReadOnly?: boolean;
23
+ isChanged?: boolean;
24
+ }
25
+
26
+ /**
27
+ * Input component
28
+ *
29
+ */
30
+ const PasswordInput = (props: PasswordInputProps) => {
31
+ const {
32
+ title,
33
+ description,
34
+ placeholder,
35
+ value,
36
+ regex,
37
+ regexErrorMessage,
38
+ showStepValidation = false,
39
+ isRequired = false,
40
+ onChange = () => null,
41
+ isReadOnly = false,
42
+ isChanged = false,
43
+ } = props;
44
+
45
+ const [initialValue] = useState(value);
46
+ const [passwordShown, setPasswordShown] = useState(false);
47
+ const [invalidInput, setInvalidInput] = useState(false);
48
+ const [showErrorOnFocusLoss, setShowErrorOnFocusLoss] = useState(false);
49
+
50
+ // validate on first render
51
+ useEffect(() => {
52
+ if (regex) {
53
+ const invalid = !new RegExp(regex.replace(/^\/|\/$/g, '')).test(
54
+ `${initialValue}`,
55
+ );
56
+ setInvalidInput(invalid);
57
+ }
58
+ }, [regex]);
59
+
60
+ const handleChange = (inputValue: string) => {
61
+ if (regex) {
62
+ if (!new RegExp(regex.replace(/^\/|\/$/g, '')).test(inputValue)) {
63
+ onChange(inputValue, false);
64
+ setInvalidInput(true);
65
+ } else {
66
+ onChange(inputValue, true);
67
+ setInvalidInput(false);
68
+ }
69
+ } else {
70
+ onChange(inputValue);
71
+ }
72
+ };
73
+
74
+ const validate = () => {
75
+ setShowErrorOnFocusLoss(true);
76
+ };
77
+
78
+ const togglePasswordVisiblity = () => {
79
+ setPasswordShown((isShown) => !isShown);
80
+ };
81
+
82
+ return html`
83
+ <${Hint} dismissOnClick=${false} position="top" deltaY=${0}>
84
+ <div class="${styles.passwordInputWrapper}">
85
+ <fieldset>
86
+ <${Label} title=${title} description=${description}
87
+ isRequired=${isRequired}
88
+ labelTag=${isReadOnly && isChanged ? 'Changed' : ''} //>
89
+ ${isReadOnly &&
90
+ html`<span
91
+ class=${styles.readonlyHint}
92
+ data-hint=${isReadOnly ? `Cannot modify user selection` : ''}
93
+ ></span>`}
94
+ <${BaseInput}
95
+ type=${passwordShown ? 'text' : 'password'}
96
+ placeholder=${placeholder}
97
+ handleChange=${handleChange}
98
+ handleBlur=${validate}
99
+ value=${value}
100
+ control=${() => html`
101
+ <div
102
+ class=${styles.visibilityToggle}
103
+ onclick=${togglePasswordVisiblity}
104
+ >
105
+ ${!passwordShown
106
+ ? html` <svg
107
+ width="20"
108
+ height="12"
109
+ viewBox="0 0 20 12"
110
+ fill="none"
111
+ xmlns="http://www.w3.org/2000/svg"
112
+ >
113
+ <path
114
+ fill-rule="evenodd"
115
+ clip-rule="evenodd"
116
+ d="M0.183387 6.51359C0.35582 6.72918 4.47535 11.6704 9.71968 11.6704V11.6704C14.964 11.6704 19.0836 6.72924 19.256 6.51357C19.5005 6.21515 19.5005 5.78535 19.256 5.48691V5.48615C19.0835 5.27523 14.964 0.330078 9.71968 0.330078C4.47535 0.330078 0.355766 5.27507 0.183387 5.48693C-0.0611291 5.78535 -0.0611291 6.21515 0.183387 6.51359ZM9.71968 10.0499C6.1643 10.0499 3.04855 7.1924 1.90266 6.00018C3.04632 4.80579 6.1643 1.95044 9.71968 1.95044C13.2751 1.95044 16.3908 4.80797 17.5367 6.00018C16.393 7.19458 13.2751 10.0499 9.71968 10.0499Z"
117
+ fill="#999999"
118
+ />
119
+ <path
120
+ fill-rule="evenodd"
121
+ clip-rule="evenodd"
122
+ d="M6.94922 8.29099C7.55668 8.89849 8.3806 9.24021 9.24022 9.24021C10.0998 9.24021 10.9237 8.89845 11.5312 8.29099C12.1387 7.68353 12.4804 6.85956 12.4804 5.99999C12.4804 5.14041 12.1387 4.31648 11.5312 3.70898C10.9238 3.10148 10.0998 2.75977 9.24022 2.75977C8.38064 2.75977 7.55672 3.10152 6.94922 3.70898C6.34172 4.31644 6 5.14041 6 5.99999C6 6.85956 6.34176 7.68349 6.94922 8.29099ZM7.7435 5.3803C7.99408 4.77431 8.58488 4.38021 9.24022 4.38021C9.67002 4.38021 10.0816 4.55031 10.3854 4.85481C10.6899 5.15856 10.86 5.57015 10.86 5.99995C10.86 6.65529 10.4659 7.24607 9.85987 7.49667C9.25464 7.74727 8.5583 7.60905 8.09509 7.14508C7.63111 6.68186 7.49289 5.98552 7.7435 5.3803Z"
123
+ fill="#999999"
124
+ />
125
+ </svg>`
126
+ : html` <svg
127
+ width="20"
128
+ height="12"
129
+ viewBox="0 0 20 12"
130
+ fill="none"
131
+ xmlns="http://www.w3.org/2000/svg"
132
+ >
133
+ <path
134
+ fill-rule="evenodd"
135
+ clip-rule="evenodd"
136
+ d="M0.183387 6.51359C0.35582 6.72918 4.47535 11.6704 9.71968 11.6704V11.6704C14.964 11.6704 19.0836 6.72924 19.256 6.51357C19.5005 6.21515 19.5005 5.78535 19.256 5.48691V5.48615C19.0835 5.27523 14.964 0.330078 9.71968 0.330078C4.47535 0.330078 0.355766 5.27507 0.183387 5.48693C-0.0611291 5.78535 -0.0611291 6.21515 0.183387 6.51359ZM9.71968 10.0499C6.1643 10.0499 3.04855 7.1924 1.90266 6.00018C3.04632 4.80579 6.1643 1.95044 9.71968 1.95044C13.2751 1.95044 16.3908 4.80797 17.5367 6.00018C16.393 7.19458 13.2751 10.0499 9.71968 10.0499Z"
137
+ fill="#333333"
138
+ />
139
+ <path
140
+ fill-rule="evenodd"
141
+ clip-rule="evenodd"
142
+ d="M6.94922 8.29099C7.55668 8.89849 8.3806 9.24021 9.24022 9.24021C10.0998 9.24021 10.9237 8.89845 11.5312 8.29099C12.1387 7.68353 12.4804 6.85956 12.4804 5.99999C12.4804 5.14041 12.1387 4.31648 11.5312 3.70898C10.9238 3.10148 10.0998 2.75977 9.24022 2.75977C8.38064 2.75977 7.55672 3.10152 6.94922 3.70898C6.34172 4.31644 6 5.14041 6 5.99999C6 6.85956 6.34176 7.68349 6.94922 8.29099ZM7.7435 5.3803C7.99408 4.77431 8.58488 4.38021 9.24022 4.38021C9.67002 4.38021 10.0816 4.55031 10.3854 4.85481C10.6899 5.15856 10.86 5.57015 10.86 5.99995C10.86 6.65529 10.4659 7.24607 9.85987 7.49667C9.25464 7.74727 8.5583 7.60905 8.09509 7.14508C7.63111 6.68186 7.49289 5.98552 7.7435 5.3803Z"
143
+ fill="#333333"
144
+ />
145
+ </svg>`}
146
+ </div>
147
+ `}
148
+ isReadOnly=${isReadOnly}
149
+ ><//>
150
+ ${showStepValidation &&
151
+ isRequired &&
152
+ !value &&
153
+ html`<${ErrorMessage}>Please enter a value<//>`}
154
+ ${(showStepValidation || showErrorOnFocusLoss || initialValue) &&
155
+ invalidInput &&
156
+ value &&
157
+ html`<${ErrorMessage}>${regexErrorMessage || 'Invalid input'}<//>`}
158
+ </fieldset>
159
+ </div>
160
+ <//>
161
+ `;
162
+ };
163
+
164
+ export { PasswordInput, PasswordInputProps };
@@ -0,0 +1,37 @@
1
+ .passwordInputWrapper {
2
+ fieldset {
3
+ padding: 0;
4
+ margin: 0;
5
+ border: none;
6
+ }
7
+ .innerWrap {
8
+ position: relative;
9
+ }
10
+ input {
11
+ padding-right: 36px;
12
+ }
13
+ .readonlyHint {
14
+ width: 100%;
15
+ height: -webkit-fill-available;
16
+ z-index: 99;
17
+ position: absolute;
18
+ }
19
+ }
20
+
21
+ .visibilityToggle {
22
+ display: flex;
23
+ align-items: center;
24
+ position: absolute;
25
+ top: 0;
26
+ right: 10px;
27
+ bottom: 0;
28
+ margin: 0 auto;
29
+ z-index: 999;
30
+ svg {
31
+ cursor: pointer;
32
+ width: 20px;
33
+ &:hover {
34
+ opacity: 0.5;
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,7 @@
1
+ import { Input, InputProps } from './Input';
2
+ import { DateInput, DateInputProps } from './DateInput';
3
+ import { PasswordInput, PasswordInputProps } from './PasswordInput';
4
+
5
+ export { Input, InputProps };
6
+ export { DateInput, DateInputProps };
7
+ export { PasswordInput, PasswordInputProps };
@@ -0,0 +1,61 @@
1
+ import { html } from 'htm/preact';
2
+ import { Tag } from '@/components/Tag';
3
+
4
+ import styles from './styles.module.scss';
5
+
6
+ interface LabelProps {
7
+ title: string;
8
+ description?: string;
9
+ isRequired?: boolean;
10
+ labelTag?: string;
11
+ allowRefresh?: boolean;
12
+ handleRefreshClick?: () => void;
13
+ }
14
+
15
+ const Label = (props: LabelProps) => {
16
+ const { title, description, isRequired = false, labelTag = '', allowRefresh = false, handleRefreshClick } = props;
17
+
18
+ const onClickRefresh = (): void => {
19
+ if (handleRefreshClick) {
20
+ handleRefreshClick();
21
+ }
22
+ }
23
+
24
+ return html`
25
+ <div class="${styles.label} integry-container__label">
26
+ <label class="${styles.subLabel}">
27
+ <div>
28
+ ${title}
29
+ ${isRequired && html`<span class=${styles.required}>*</span>`}
30
+ ${false && labelTag &&
31
+ html`
32
+ <span class=${styles.tagSpan}><${Tag}
33
+ label=${labelTag}
34
+ /></span>
35
+ `}
36
+ ${allowRefresh &&
37
+ html`
38
+ <svg class=${styles.refreshIcon} fill="#8c8c8c" height="12px" width="12px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
39
+ viewBox="0 0 489.698 489.698" xml:space="preserve" onclick=${onClickRefresh}>
40
+ <g>
41
+ <g>
42
+ <path d="M468.999,227.774c-11.4,0-20.8,8.3-20.8,19.8c-1,74.9-44.2,142.6-110.3,178.9c-99.6,54.7-216,5.6-260.6-61l62.9,13.1
43
+ c10.4,2.1,21.8-4.2,23.9-15.6c2.1-10.4-4.2-21.8-15.6-23.9l-123.7-26c-7.2-1.7-26.1,3.5-23.9,22.9l15.6,124.8
44
+ c1,10.4,9.4,17.7,19.8,17.7c15.5,0,21.8-11.4,20.8-22.9l-7.3-60.9c101.1,121.3,229.4,104.4,306.8,69.3
45
+ c80.1-42.7,131.1-124.8,132.1-215.4C488.799,237.174,480.399,227.774,468.999,227.774z"/>
46
+ <path d="M20.599,261.874c11.4,0,20.8-8.3,20.8-19.8c1-74.9,44.2-142.6,110.3-178.9c99.6-54.7,216-5.6,260.6,61l-62.9-13.1
47
+ c-10.4-2.1-21.8,4.2-23.9,15.6c-2.1,10.4,4.2,21.8,15.6,23.9l123.8,26c7.2,1.7,26.1-3.5,23.9-22.9l-15.6-124.8
48
+ c-1-10.4-9.4-17.7-19.8-17.7c-15.5,0-21.8,11.4-20.8,22.9l7.2,60.9c-101.1-121.2-229.4-104.4-306.8-69.2
49
+ c-80.1,42.6-131.1,124.8-132.2,215.3C0.799,252.574,9.199,261.874,20.599,261.874z"/>
50
+ </g>
51
+ </g>
52
+ </svg>
53
+ `}
54
+ </div>
55
+ ${description && html`<div>${description}</div>`}
56
+ </label>
57
+ </div>
58
+ `;
59
+ };
60
+
61
+ export { Label, LabelProps };
@@ -0,0 +1,41 @@
1
+ .label {
2
+ .subLabel {
3
+ display: block;
4
+ margin-bottom: 0;
5
+
6
+ > div:first-child {
7
+ color: #000;
8
+ font-family: Inter;
9
+ font-size: 12px;
10
+ font-style: normal;
11
+ font-weight: 400;
12
+ line-height: normal;
13
+ margin-bottom: 3px;
14
+ display: flex;
15
+ flex-direction: row;
16
+ align-items: center;
17
+
18
+ .tagSpan {
19
+ margin-left: 10px;
20
+ }
21
+ .refreshIcon {
22
+ margin-left: 8px;
23
+ cursor: pointer;
24
+ }
25
+ }
26
+ > div:nth-child(2) {
27
+ color: var(--black-and-grey-draft-and-tooltip-desc, #999);
28
+ font-family: Inter;
29
+ font-size: 12px;
30
+ font-style: normal;
31
+ font-weight: 400;
32
+ line-height: normal;
33
+ margin-bottom: 8px;
34
+ }
35
+ }
36
+ .required {
37
+ color: #333;
38
+ font-size: 16px;
39
+ margin-left: 2px;
40
+ }
41
+ }