@integry/sdk 4.7.39 → 4.7.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.csm.js +1 -1
- package/dist/umd/index.umd.js +1 -1
- package/package.json +6 -1
- package/.eslintignore +0 -1
- package/.vscode/launch.json +0 -17
- package/CHANGELOG_INTERNAL.md +0 -134
- package/README_INTERNAL.md +0 -176
- package/THIRD_PARTY_LICENSES +0 -525
- package/generateTests.js +0 -80
- package/jest.config.cjs +0 -10
- package/src/components/AddTagButton/index.ts +0 -23
- package/src/components/BasicSelect/index.ts +0 -123
- package/src/components/BasicSelect/styles.module.scss +0 -44
- package/src/components/Button/index.ts +0 -97
- package/src/components/Button/styles.module.scss +0 -152
- package/src/components/CheckboxGroup/Checkbox.ts +0 -104
- package/src/components/CheckboxGroup/index.ts +0 -190
- package/src/components/CheckboxGroup/styles.module.scss +0 -63
- package/src/components/CollapsedMenu/index.ts +0 -104
- package/src/components/CollapsedMenu/styles.module.scss +0 -46
- package/src/components/ConfigureFieldWrapper/index.ts +0 -85
- package/src/components/ConfigureFieldWrapper/styles.module.scss +0 -57
- package/src/components/EditableText/index.ts +0 -121
- package/src/components/EditableText/styles.module.scss +0 -38
- package/src/components/EditableTextArea/index.ts +0 -143
- package/src/components/EditableTextArea/styles.module.scss +0 -91
- package/src/components/ErrorMessage/index.ts +0 -16
- package/src/components/ErrorMessage/styles.module.scss +0 -19
- package/src/components/ErrorPage/index.ts +0 -42
- package/src/components/ErrorPage/styles.module.scss +0 -26
- package/src/components/Footer/index.ts +0 -41
- package/src/components/Footer/styles.module.scss +0 -40
- package/src/components/HTMLContent/index.tsx +0 -205
- package/src/components/HTMLContent/styles.module.scss +0 -3
- package/src/components/InfoBox/index.ts +0 -48
- package/src/components/InfoBox/styles.module.scss +0 -21
- package/src/components/Input/BaseInput/index.ts +0 -170
- package/src/components/Input/BaseInput/styles.module.scss +0 -95
- package/src/components/Input/DateInput/index.ts +0 -103
- package/src/components/Input/DateInput/styles.module.scss +0 -50
- package/src/components/Input/Input/index.ts +0 -225
- package/src/components/Input/Input/styles.module.scss +0 -16
- package/src/components/Input/PasswordInput/index.ts +0 -164
- package/src/components/Input/PasswordInput/styles.module.scss +0 -37
- package/src/components/Input/index.ts +0 -7
- package/src/components/Label/index.ts +0 -61
- package/src/components/Label/styles.module.scss +0 -41
- package/src/components/LargeLoader/index.ts +0 -25
- package/src/components/LargeLoader/styles.module.scss +0 -16
- package/src/components/Listbox/ListBoxItem.ts +0 -57
- package/src/components/Listbox/index.ts +0 -488
- package/src/components/Listbox/styles.module.scss +0 -197
- package/src/components/Loader/index.ts +0 -25
- package/src/components/Loader/styles.module.scss +0 -16
- package/src/components/MediaGallery/MediaGalleryModal.ts +0 -82
- package/src/components/MediaGallery/MediaSlider.ts +0 -76
- package/src/components/MediaGallery/index.ts +0 -92
- package/src/components/MediaGallery/styles.module.scss +0 -156
- package/src/components/MediaUpload/index.ts +0 -233
- package/src/components/MediaUpload/styles.module.scss +0 -118
- package/src/components/Modal/index.ts +0 -87
- package/src/components/Modal/styles.module.scss +0 -441
- package/src/components/MultipurposeField/Dropdown/ListBoxItem.tsx +0 -59
- package/src/components/MultipurposeField/Dropdown/index.tsx +0 -1202
- package/src/components/MultipurposeField/Dropdown/styles.module.scss +0 -215
- package/src/components/MultipurposeField/TagMenu/index.ts +0 -536
- package/src/components/MultipurposeField/TagMenu/styles.module.scss +0 -175
- package/src/components/MultipurposeField/TagOptions/index.tsx +0 -83
- package/src/components/MultipurposeField/TagOptions/styles.module.scss +0 -95
- package/src/components/MultipurposeField/index.tsx +0 -944
- package/src/components/MultipurposeField/styles.module.scss +0 -77
- package/src/components/NewModal/index.ts +0 -69
- package/src/components/NewModal/styles.module.scss +0 -70
- package/src/components/OverflowTooltip/index.tsx +0 -59
- package/src/components/PopUp/ConfirmationPopUp/index.ts +0 -58
- package/src/components/PopUp/ConfirmationPopUp/styles.module.scss +0 -49
- package/src/components/PopUp/SuccessPopUp/index.ts +0 -62
- package/src/components/PopUp/SuccessPopUp/styles.module.scss +0 -38
- package/src/components/RadioGroup/Radio.ts +0 -128
- package/src/components/RadioGroup/index.ts +0 -169
- package/src/components/RadioGroup/styles.module.scss +0 -81
- package/src/components/Search/index.ts +0 -69
- package/src/components/Search/styles.module.scss +0 -149
- package/src/components/TabBar/Tab.ts +0 -33
- package/src/components/TabBar/index.ts +0 -64
- package/src/components/TabBar/styles.module.scss +0 -43
- package/src/components/Tag/index.ts +0 -29
- package/src/components/Tag/styles.module.scss +0 -57
- package/src/components/TagsMenu/index.ts +0 -1697
- package/src/components/TagsMenu/styles.module.scss +0 -350
- package/src/components/TestComponent/index.ts +0 -71
- package/src/components/TestComponent/styles.module.scss +0 -152
- package/src/components/TextArea/index.ts +0 -172
- package/src/components/TextArea/styles.module.scss +0 -72
- package/src/components/TextContent/index.tsx +0 -128
- package/src/components/TextContent/styles.module.scss +0 -6
- package/src/components/ThreeDotLoader/index.ts +0 -39
- package/src/components/ThreeDotLoader/styles.module.scss +0 -41
- package/src/components/TimeInput/index.ts +0 -129
- package/src/components/TimeInput/styles.module.scss +0 -16
- package/src/components/Toggle/index.ts +0 -34
- package/src/components/Toggle/styles.module.scss +0 -56
- package/src/components/Toggle-v2/index.ts +0 -40
- package/src/components/Toggle-v2/styles.module.scss +0 -86
- package/src/components/Tooltip/index.ts +0 -271
- package/src/components/Tooltip/styles.module.scss +0 -105
- package/src/components/form/FunctionField/index.ts +0 -816
- package/src/components/form/FunctionField/styles.module.scss +0 -478
- package/src/components/form/ObjectField/__snapshots__/index.ts.test.tsx.snap +0 -3
- package/src/components/form/ObjectField/index.ts +0 -593
- package/src/components/form/ObjectField/index.ts.test.tsx +0 -213
- package/src/components/form/ObjectField/styles.module.scss +0 -103
- package/src/components/form/index.ts +0 -4
- package/src/contexts/AppContext.ts +0 -12
- package/src/declaration.d.ts +0 -7
- package/src/extensions/HMAC.ts +0 -25
- package/src/extensions/IntegryAPIError.ts +0 -19
- package/src/features/common/AccountDropdown/index.ts +0 -291
- package/src/features/common/AccountDropdown/styles.module.scss +0 -19
- package/src/features/common/ActionForm/index.ts +0 -2602
- package/src/features/common/ActionForm/styles.module.scss +0 -35
- package/src/features/common/AppCard/index.ts +0 -207
- package/src/features/common/AppCard/styles.module.scss +0 -117
- package/src/features/common/AppCardCompact/index.ts +0 -189
- package/src/features/common/AppCardCompact/styles.module.scss +0 -141
- package/src/features/common/AuthSelector/index.ts +0 -537
- package/src/features/common/AuthSelector/styles.module.scss +0 -161
- package/src/features/common/AuthSelectorCompact/index.ts +0 -706
- package/src/features/common/AuthSelectorCompact/styles.module.scss +0 -219
- package/src/features/common/AuthSelectorDropdown/index.ts +0 -704
- package/src/features/common/AuthSelectorDropdown/styles.module.scss +0 -361
- package/src/features/common/AuthSelectorV2/index.ts +0 -336
- package/src/features/common/AuthSelectorV2/styles.module.scss +0 -235
- package/src/features/common/DynamicField/index.ts +0 -402
- package/src/features/common/DynamicField/styles.module.scss +0 -266
- package/src/features/common/DynamicTypedField/index.ts +0 -504
- package/src/features/common/DynamicTypedField/styles.module.scss +0 -135
- package/src/features/common/FunctionForm/index.ts +0 -1095
- package/src/features/common/FunctionForm/styles.module.scss +0 -225
- package/src/features/common/MappingUI/index.ts +0 -649
- package/src/features/common/MappingUI/styles.module.scss +0 -121
- package/src/features/common/MarketplaceAppCard/index.ts +0 -279
- package/src/features/common/MarketplaceAppCard/styles.module.scss +0 -231
- package/src/features/common/MarketplaceAppCardCompact/index.ts +0 -283
- package/src/features/common/MarketplaceAppCardCompact/styles.module.scss +0 -255
- package/src/features/common/NewMappingUI/index.ts +0 -515
- package/src/features/common/NewMappingUI/styles.module.scss +0 -113
- package/src/features/common/RequestAppWidget/RequestAppModal/index.ts +0 -67
- package/src/features/common/RequestAppWidget/RequestAppModal/styles.module.scss +0 -23
- package/src/features/common/RequestAppWidget/index.ts +0 -48
- package/src/features/common/RequestAppWidget/request-app-form.ts +0 -89
- package/src/features/common/RequestAppWidget/styles.module.scss +0 -43
- package/src/features/common/SectionField/index.ts +0 -272
- package/src/features/common/SectionField/styles.module.scss +0 -67
- package/src/features/common/Step/index.ts +0 -827
- package/src/features/common/Step/styles.module.scss +0 -12
- package/src/features/common/StepNavigation/CollapsedSteps.ts +0 -131
- package/src/features/common/StepNavigation/NavItem.ts +0 -111
- package/src/features/common/StepNavigation/index.ts +0 -261
- package/src/features/common/StepNavigation/styles.module.scss +0 -117
- package/src/features/common/Steps/index.ts +0 -1140
- package/src/features/common/Steps/styles.module.scss +0 -314
- package/src/features/containers/AppFlowContainer/AppFlowListing/compactStyles.module.scss +0 -404
- package/src/features/containers/AppFlowContainer/AppFlowListing/flow-instance.tsx +0 -367
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.test.tsx +0 -58
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.tsx +0 -208
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.test.tsx +0 -49
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.tsx +0 -421
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowInstanceCompact.tsx +0 -577
- package/src/features/containers/AppFlowContainer/AppFlowListing/index.tsx +0 -83
- package/src/features/containers/AppFlowContainer/AppFlowListing/styles.module.scss +0 -233
- package/src/features/containers/AppFlowContainer/AppFlowWrap/app-page-loader.tsx +0 -45
- package/src/features/containers/AppFlowContainer/AppFlowWrap/index.tsx +0 -1085
- package/src/features/containers/AppFlowContainer/AppFlowWrap/styles.module.scss +0 -465
- package/src/features/containers/AppFlowContainer/Authentication/index.ts +0 -610
- package/src/features/containers/AppFlowContainer/Authentication/styles.module.scss +0 -468
- package/src/features/containers/AppFlowContainer/index.ts +0 -114
- package/src/features/containers/AppPageContainer/AppPage/index.tsx +0 -262
- package/src/features/containers/AppPageContainer/AppPage/styles.module.scss +0 -120
- package/src/features/containers/AppPageContainer/IntegrationCard/index.ts +0 -165
- package/src/features/containers/AppPageContainer/IntegrationCard/styles.module.scss +0 -81
- package/src/features/containers/AppPageContainer/index.tsx +0 -93
- package/src/features/containers/AppPageContainer/styles.module.scss +0 -0
- package/src/features/containers/AppsForFlows/index.ts +0 -161
- package/src/features/containers/AppsForFlows/styles.module.scss +0 -280
- package/src/features/containers/AppsForFlowsCompact/index.ts +0 -161
- package/src/features/containers/AppsForFlowsCompact/styles.module.scss +0 -279
- package/src/features/containers/AuthSetupContainer/AppSelection.ts +0 -73
- package/src/features/containers/AuthSetupContainer/AuthTypeSelection.ts +0 -67
- package/src/features/containers/AuthSetupContainer/Footer.ts +0 -32
- package/src/features/containers/AuthSetupContainer/Header.ts +0 -39
- package/src/features/containers/AuthSetupContainer/PostAdditionPopup.ts +0 -27
- package/src/features/containers/AuthSetupContainer/index.ts +0 -349
- package/src/features/containers/AuthSetupContainer/styles.module.scss +0 -229
- package/src/features/containers/FlowSetupContainer/index.ts +0 -391
- package/src/features/containers/FlowSetupContainer/styles.module.scss +0 -18
- package/src/features/containers/MarkeplaceApps/index.ts +0 -583
- package/src/features/containers/MarkeplaceApps/styles.module.scss +0 -558
- package/src/features/containers/MarketplaceAppsCompact/index.ts +0 -585
- package/src/features/containers/MarketplaceAppsCompact/styles.module.scss +0 -563
- package/src/features/containers/MarketplaceAppsContainer/index.ts +0 -91
- package/src/features/containers/MarketplaceContainer/AppCard/index.ts +0 -91
- package/src/features/containers/MarketplaceContainer/AppCard/styles.module.scss +0 -66
- package/src/features/containers/MarketplaceContainer/AppListing/index.ts +0 -34
- package/src/features/containers/MarketplaceContainer/AppListing/styles.module.scss +0 -10
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/index.ts +0 -132
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/styles.module.scss +0 -117
- package/src/features/containers/MarketplaceContainer/index.ts +0 -242
- package/src/features/containers/MarketplaceContainer/styles.module.scss +0 -84
- package/src/features/containers/SDKContainer/index.ts +0 -817
- package/src/features/containers/SDKContainer/styles.module.scss +0 -266
- package/src/features/containers/SDKDebugContainer/index.ts +0 -137
- package/src/features/containers/SDKDebugContainer/styles.module.scss +0 -37
- package/src/features/containers/SDKFailedContainer/index.ts +0 -117
- package/src/features/containers/SDKFailedContainer/styles.module.scss +0 -57
- package/src/features/integrations/IntegrationRow/Icons.ts +0 -77
- package/src/features/integrations/IntegrationRow/index.ts +0 -129
- package/src/features/integrations/IntegrationRow/styles.module.scss +0 -62
- package/src/features/integrations/IntegrationsHeader/index.ts +0 -34
- package/src/features/integrations/IntegrationsHeader/styles.module.scss +0 -47
- package/src/features/integrations/IntegrationsList/index.ts +0 -252
- package/src/features/integrations/IntegrationsList/styles.module.scss +0 -67
- package/src/features/templates/Template/index.ts +0 -295
- package/src/features/templates/Template/styles.module.scss +0 -226
- package/src/features/templates/TemplatesView/index.ts +0 -368
- package/src/features/templates/TemplatesView/styles.module.scss +0 -71
- package/src/features/templates/TemplatesViewCompact/index.ts +0 -364
- package/src/features/templates/TemplatesViewCompact/styles.module.scss +0 -141
- package/src/hooks/useAutosizeTextArea.ts +0 -22
- package/src/hooks/useCustomRef.ts +0 -13
- package/src/hooks/useDebounce.ts +0 -17
- package/src/hooks/useElementResize.ts +0 -40
- package/src/hooks/useEventListener.ts +0 -42
- package/src/hooks/useHover.ts +0 -40
- package/src/hooks/useOnClickOutside.ts +0 -32
- package/src/index.ts +0 -2244
- package/src/index.umd.ts +0 -13
- package/src/interfaces/index.ts +0 -938
- package/src/modules/api/index.ts +0 -1325
- package/src/modules/api/responseHandler.ts +0 -38
- package/src/modules/event-emitter/index.ts +0 -72
- package/src/modules/event-emitter/runners/abstract.ts +0 -21
- package/src/modules/event-emitter/runners/default.ts +0 -11
- package/src/modules/event-emitter/runners/ntimes.ts +0 -28
- package/src/modules/event-emitter/types.ts +0 -34
- package/src/store/actionFunctions.ts +0 -1578
- package/src/store/index.ts +0 -17
- package/src/store/initialState.ts +0 -58
- package/src/types/index.ts +0 -320
- package/src/types/preact-compat.d.ts +0 -4
- package/src/types/store.ts +0 -366
- package/src/types/utils.ts +0 -19
- package/src/utils/ActivityOutputUtils.ts +0 -176
- package/src/utils/common.ts +0 -20
- package/src/utils/copyToClipboard.ts +0 -24
- package/src/utils/datetime.ts +0 -101
- package/src/utils/getUrlParam.ts +0 -11
- package/src/utils/isAuthMessage.ts +0 -16
- package/src/utils/isBrowser.ts +0 -1
- package/src/utils/jsonEncodeDecode.ts +0 -15
- package/src/utils/objectUtils.ts +0 -117
- package/src/utils/popup.ts +0 -30
- package/src/utils/searchJson.ts +0 -51
- package/src/utils/stepUtils.ts +0 -45
- package/src/utils/truncate.ts +0 -6
- package/test/setup.ts +0 -1
- package/vitest.config.ts +0 -16
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
.checkboxGroup {
|
|
2
|
-
fieldset {
|
|
3
|
-
border: none;
|
|
4
|
-
padding: 0;
|
|
5
|
-
}
|
|
6
|
-
.checkboxGroupWrap {
|
|
7
|
-
margin-top: 14px;
|
|
8
|
-
width: fit-content;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.checkboxWrap {
|
|
13
|
-
margin-bottom: 14px;
|
|
14
|
-
width: fit-content;
|
|
15
|
-
.readonlyHint {
|
|
16
|
-
width: 100%;
|
|
17
|
-
height: 100%;
|
|
18
|
-
z-index: 99;
|
|
19
|
-
position: absolute;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.checkbox {
|
|
24
|
-
position: relative;
|
|
25
|
-
display: flex;
|
|
26
|
-
margon-bottom: 2px;
|
|
27
|
-
align-items: center;
|
|
28
|
-
margin-top: 12px;
|
|
29
|
-
.button {
|
|
30
|
-
display: block;
|
|
31
|
-
height: 20px;
|
|
32
|
-
width: 20px;
|
|
33
|
-
background-color: transparent;
|
|
34
|
-
svg {
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
input[type='checkbox'] {
|
|
38
|
-
opacity: 0;
|
|
39
|
-
margin: 0;
|
|
40
|
-
display: none;
|
|
41
|
-
}
|
|
42
|
-
label {
|
|
43
|
-
display: flex;
|
|
44
|
-
flex: 1;
|
|
45
|
-
cursor: pointer;
|
|
46
|
-
font-size: 14px;
|
|
47
|
-
color: #333333;
|
|
48
|
-
}
|
|
49
|
-
.text {
|
|
50
|
-
display: flex;
|
|
51
|
-
color: #333;
|
|
52
|
-
font-size: 14px;
|
|
53
|
-
padding-left: 10px;
|
|
54
|
-
font-weight: 400;
|
|
55
|
-
line-height: 26px;
|
|
56
|
-
margin-top: -2px;
|
|
57
|
-
}
|
|
58
|
-
.description {
|
|
59
|
-
font-size: 12px;
|
|
60
|
-
color: #222;
|
|
61
|
-
margin-left: 12px;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { useOnClickOutside } from '@/hooks/useOnClickOutside';
|
|
2
|
-
import { html } from 'htm/preact';
|
|
3
|
-
import { useCallback, useRef, useState } from 'preact/hooks';
|
|
4
|
-
|
|
5
|
-
import styles from './styles.module.scss';
|
|
6
|
-
|
|
7
|
-
interface Option {
|
|
8
|
-
id: string;
|
|
9
|
-
label: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface CollapsedMenuProps {
|
|
13
|
-
options: Option[];
|
|
14
|
-
onOptionSelect(option: Option): void;
|
|
15
|
-
Icon?: preact.VNode;
|
|
16
|
-
className?: string;
|
|
17
|
-
verticalIcon?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const CollapsedMenu = (props: CollapsedMenuProps) => {
|
|
21
|
-
const {
|
|
22
|
-
options = [],
|
|
23
|
-
onOptionSelect = () => null,
|
|
24
|
-
Icon = null,
|
|
25
|
-
className,
|
|
26
|
-
verticalIcon = false,
|
|
27
|
-
} = props;
|
|
28
|
-
|
|
29
|
-
const popupRef = useRef<HTMLDivElement | null>(null);
|
|
30
|
-
|
|
31
|
-
const [open, setOpen] = useState(false);
|
|
32
|
-
|
|
33
|
-
const onClickAway = useCallback(() => setOpen(false), []);
|
|
34
|
-
|
|
35
|
-
useOnClickOutside(popupRef, onClickAway);
|
|
36
|
-
|
|
37
|
-
const onClick = (option: Option) => {
|
|
38
|
-
setOpen(false);
|
|
39
|
-
onOptionSelect(option);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
return html`
|
|
43
|
-
<div
|
|
44
|
-
ref=${popupRef}
|
|
45
|
-
class=${`${styles.collapsedMenu} ${className ? styles[className] : ''}`}
|
|
46
|
-
>
|
|
47
|
-
<div
|
|
48
|
-
class=${styles.trigger}
|
|
49
|
-
onclick=${(e: MouseEvent) => {
|
|
50
|
-
e.stopPropagation();
|
|
51
|
-
setOpen((prev) => !prev);
|
|
52
|
-
}}
|
|
53
|
-
>
|
|
54
|
-
${Icon
|
|
55
|
-
? html`<${Icon} />`
|
|
56
|
-
: html`<svg
|
|
57
|
-
style="${verticalIcon ? 'rotate: 90deg;' : ''}"
|
|
58
|
-
width="20"
|
|
59
|
-
height="20"
|
|
60
|
-
viewBox="0 0 20 20"
|
|
61
|
-
fill="none"
|
|
62
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
63
|
-
>
|
|
64
|
-
<path
|
|
65
|
-
fill-rule="evenodd"
|
|
66
|
-
clip-rule="evenodd"
|
|
67
|
-
d="M4.5 11C5.32843 11 6 10.3284 6 9.5C6 8.67157 5.32843 8 4.5 8C3.67157 8 3 8.67157 3 9.5C3 10.3284 3.67157 11 4.5 11Z"
|
|
68
|
-
fill="#999999"
|
|
69
|
-
/>
|
|
70
|
-
<path
|
|
71
|
-
fill-rule="evenodd"
|
|
72
|
-
clip-rule="evenodd"
|
|
73
|
-
d="M9.5 11C10.3284 11 11 10.3284 11 9.5C11 8.67157 10.3284 8 9.5 8C8.67157 8 8 8.67157 8 9.5C8 10.3284 8.67157 11 9.5 11Z"
|
|
74
|
-
fill="#999999"
|
|
75
|
-
/>
|
|
76
|
-
<path
|
|
77
|
-
fill-rule="evenodd"
|
|
78
|
-
clip-rule="evenodd"
|
|
79
|
-
d="M14.5 11C15.3284 11 16 10.3284 16 9.5C16 8.67157 15.3284 8 14.5 8C13.6716 8 13 8.67157 13 9.5C13 10.3284 13.6716 11 14.5 11Z"
|
|
80
|
-
fill="#999999"
|
|
81
|
-
/>
|
|
82
|
-
</svg>`}
|
|
83
|
-
</div>
|
|
84
|
-
<div class="${styles.popup} ${open ? styles.open : ''}">
|
|
85
|
-
<div class=${styles.optionWrap}>
|
|
86
|
-
${options.map(
|
|
87
|
-
(el) =>
|
|
88
|
-
html`<div
|
|
89
|
-
class=${styles.option}
|
|
90
|
-
onclick=${(event: any) => {
|
|
91
|
-
event.stopPropagation();
|
|
92
|
-
onClick(el);
|
|
93
|
-
}}
|
|
94
|
-
>
|
|
95
|
-
${el.label}
|
|
96
|
-
</div>`,
|
|
97
|
-
)}
|
|
98
|
-
</div>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
`;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export { CollapsedMenu, CollapsedMenuProps };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
.collapsedMenu {
|
|
2
|
-
position: relative;
|
|
3
|
-
.trigger {
|
|
4
|
-
display: flex;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
cursor: pointer;
|
|
7
|
-
width: max-content;
|
|
8
|
-
}
|
|
9
|
-
.popup {
|
|
10
|
-
display: none;
|
|
11
|
-
position: absolute;
|
|
12
|
-
width: 150px;
|
|
13
|
-
top: 20px;
|
|
14
|
-
left: auto;
|
|
15
|
-
margin-right: 20px;
|
|
16
|
-
right: 0;
|
|
17
|
-
z-index: 99;
|
|
18
|
-
color: #6d6f7b;
|
|
19
|
-
&.open {
|
|
20
|
-
display: block;
|
|
21
|
-
}
|
|
22
|
-
.optionWrap {
|
|
23
|
-
background: #fff;
|
|
24
|
-
padding: 4px 0;
|
|
25
|
-
border: 1px solid #f3f3f3;
|
|
26
|
-
box-shadow: 0px 2px 7px rgba(162, 162, 162, 0.25);
|
|
27
|
-
border-radius: 4px;
|
|
28
|
-
.option {
|
|
29
|
-
padding: 12px 14px;
|
|
30
|
-
font-size: 12px;
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
overflow: hidden;
|
|
33
|
-
text-overflow: ellipsis;
|
|
34
|
-
&:hover {
|
|
35
|
-
background: #eeeeee;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
.instanceMenu {
|
|
42
|
-
.popup {
|
|
43
|
-
right: -10px;
|
|
44
|
-
width: 109px;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { html } from 'htm/preact';
|
|
2
|
-
import { StoreType } from '@/types/store';
|
|
3
|
-
import { actionFunctions } from '@/store/actionFunctions';
|
|
4
|
-
import { useContext } from 'preact/hooks';
|
|
5
|
-
import AppContext from '@/contexts/AppContext';
|
|
6
|
-
import { TemplateField } from '@/interfaces';
|
|
7
|
-
|
|
8
|
-
import { connect } from 'unistore/preact';
|
|
9
|
-
import styles from './styles.module.scss';
|
|
10
|
-
|
|
11
|
-
interface ConfigureFieldWrapperPropsType extends StoreType {
|
|
12
|
-
children: Element;
|
|
13
|
-
field: TemplateField;
|
|
14
|
-
genericData: StoreType['genericData'];
|
|
15
|
-
editFieldData: StoreType['editFieldData'];
|
|
16
|
-
stepId: string | number;
|
|
17
|
-
templateId: string | number;
|
|
18
|
-
}
|
|
19
|
-
// interface for GearIcon
|
|
20
|
-
|
|
21
|
-
const GearIcon = () => html`
|
|
22
|
-
<svg
|
|
23
|
-
width="12"
|
|
24
|
-
height="12"
|
|
25
|
-
viewBox="0 0 16 16"
|
|
26
|
-
fill="none"
|
|
27
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
28
|
-
>
|
|
29
|
-
<path
|
|
30
|
-
d="M13.2333 10.6576C13.2668 10.5914 13.2957 10.5252 13.3269 10.4628C13.3581 10.4004 13.3794 10.354 13.403 10.2992L13.4182 10.2619V10.2406C13.4434 10.1782 13.4647 10.1157 13.4883 10.0457C13.5119 9.9757 13.537 9.91938 13.5606 9.85088V9.80826L16 9.36379V6.73109L13.598 6.23257L13.5843 6.19376V6.17854C13.5607 6.10851 13.5356 6.04002 13.5105 5.97228C13.4853 5.90378 13.4716 5.85735 13.448 5.80103L13.4328 5.76373V5.74242C13.4077 5.68001 13.378 5.62141 13.3506 5.56128C13.3232 5.50115 13.2958 5.43646 13.2646 5.36644L13.2532 5.34513V5.33143L14.6247 3.30995L12.76 1.44526L10.7103 2.79165L10.673 2.77415H10.6593C10.5931 2.74066 10.5268 2.71174 10.4644 2.68053C10.402 2.64932 10.3556 2.62802 10.3008 2.60442L10.2635 2.5892H10.2422C10.1798 2.56408 10.1174 2.54277 10.0473 2.51918C9.97733 2.49558 9.92253 2.47047 9.8525 2.44916H9.80988L9.36387 0H6.73115L6.23263 2.402L6.19381 2.4157H6.17859C6.10857 2.4393 6.04007 2.46441 5.97233 2.48953C5.90383 2.51465 5.8574 2.52835 5.80108 2.55194L5.76378 2.56716H5.74247C5.68006 2.59228 5.62146 2.62196 5.56133 2.64936C5.5012 2.67676 5.43651 2.70416 5.36649 2.73537L5.34137 2.74907H5.32767L3.31007 1.37528L1.44537 3.23997L2.79177 5.2897L2.77427 5.32699V5.34069C2.74078 5.40691 2.71186 5.47312 2.68065 5.53553C2.64945 5.59794 2.62814 5.64437 2.60302 5.70145L2.5878 5.73875V5.76006C2.56268 5.82247 2.54137 5.88488 2.51777 5.9549C2.49418 6.02492 2.46906 6.08124 2.44547 6.14974V6.19236L0 6.63608V9.26877L2.40202 9.76577L2.41572 9.80459V9.81981C2.43931 9.88983 2.46443 9.95833 2.48955 10.0261C2.51467 10.0946 2.52836 10.141 2.55196 10.1973L2.56718 10.2346V10.2559C2.5923 10.3183 2.62198 10.3769 2.64938 10.4394C2.67678 10.5018 2.70418 10.5642 2.7331 10.6342L2.74832 10.6616V10.6753L1.37529 12.6899L3.23999 14.5546L5.28973 13.2082L5.32703 13.2258H5.34073C5.40694 13.2592 5.47316 13.2882 5.53557 13.3194C5.59798 13.3506 5.64441 13.3719 5.70149 13.397L5.73879 13.4122H5.7601C5.82251 13.4373 5.88492 13.4586 5.95494 13.4822C6.02496 13.5058 6.08128 13.531 6.14978 13.5545H6.1924L6.63612 16H9.26884L9.76584 13.598L9.80466 13.5843H9.81988C9.8899 13.5607 9.9584 13.5356 10.0261 13.5105C10.0946 13.4854 10.1411 13.4717 10.1974 13.4481L10.2347 13.4328H10.256C10.3184 13.4077 10.377 13.378 10.4371 13.3506C10.4973 13.3232 10.562 13.2958 10.632 13.2646L10.6533 13.2532H10.667L12.69 14.6247L14.5547 12.76L13.2083 10.7103L13.2258 10.673L13.2333 10.6576ZM8.00002 11.4408C7.08745 11.4408 6.21218 11.0785 5.56682 10.4331C4.92146 9.7877 4.55911 8.91244 4.55911 7.99994C4.55911 7.08744 4.92141 6.21211 5.56682 5.56676C6.21224 4.9214 7.08751 4.55906 8.00002 4.55906C8.91252 4.55906 9.78785 4.92135 10.4332 5.56676C11.0786 6.21217 11.4409 7.08744 11.4409 7.99994C11.4409 8.91244 11.0786 9.78776 10.4332 10.4331C9.78779 11.0785 8.91252 11.4408 8.00002 11.4408Z"
|
|
31
|
-
fill="#4250F0"
|
|
32
|
-
/>
|
|
33
|
-
</svg>
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
const ConfigureFieldWrapper = (props: ConfigureFieldWrapperPropsType) => {
|
|
37
|
-
const context = useContext(AppContext);
|
|
38
|
-
const {
|
|
39
|
-
children,
|
|
40
|
-
field,
|
|
41
|
-
genericData,
|
|
42
|
-
editFieldData,
|
|
43
|
-
userConfig,
|
|
44
|
-
stepId,
|
|
45
|
-
templateId,
|
|
46
|
-
} = props;
|
|
47
|
-
const editField = () => {
|
|
48
|
-
props.setEditFieldData({ fieldId: field.id });
|
|
49
|
-
};
|
|
50
|
-
const editFieldId = editFieldData?.fieldId || 0;
|
|
51
|
-
const editingCurrentField = editFieldId === field.id;
|
|
52
|
-
const blurryOverlayClass =
|
|
53
|
-
!!editFieldId && editFieldId !== field.id ? `${styles.blur}` : '';
|
|
54
|
-
const disableConfigureButtonClass =
|
|
55
|
-
!!editFieldId && !editingCurrentField ? `${styles.disabled}` : '';
|
|
56
|
-
|
|
57
|
-
return userConfig?.viewAsIU
|
|
58
|
-
? html`
|
|
59
|
-
<div class=${styles.configureFieldWrapper}>
|
|
60
|
-
<div class=${`${styles.fieldOverlay} ${blurryOverlayClass}`} />
|
|
61
|
-
${userConfig.viewAsIU &&
|
|
62
|
-
html`${editingCurrentField
|
|
63
|
-
? html`<div class=${styles.configuring}>Configuring...</div>`
|
|
64
|
-
: html`<div
|
|
65
|
-
class=${`${styles.configureButtonWrapper} ${disableConfigureButtonClass}`}
|
|
66
|
-
onClick=${editField}
|
|
67
|
-
>
|
|
68
|
-
<${GearIcon}//>
|
|
69
|
-
<div>Configure</div>
|
|
70
|
-
</div>`} `}
|
|
71
|
-
${children}
|
|
72
|
-
</div>
|
|
73
|
-
`
|
|
74
|
-
: html`${children}`;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export default connect<
|
|
78
|
-
ConfigureFieldWrapperPropsType,
|
|
79
|
-
ConfigureFieldWrapperPropsType,
|
|
80
|
-
StoreType,
|
|
81
|
-
unknown
|
|
82
|
-
>(
|
|
83
|
-
['genericData', 'editFieldData', 'userConfig'],
|
|
84
|
-
actionFunctions,
|
|
85
|
-
)(ConfigureFieldWrapper);
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
.configureFieldWrapper {
|
|
2
|
-
position: relative;
|
|
3
|
-
.configuring {
|
|
4
|
-
position: absolute;
|
|
5
|
-
right: 0;
|
|
6
|
-
font-weight: 500;
|
|
7
|
-
font-size: 12px;
|
|
8
|
-
line-height: 20px;
|
|
9
|
-
text-align: right;
|
|
10
|
-
color: #333333;
|
|
11
|
-
}
|
|
12
|
-
.configureButtonWrapper {
|
|
13
|
-
position: absolute;
|
|
14
|
-
right: 0;
|
|
15
|
-
z-index: 1;
|
|
16
|
-
display: flex;
|
|
17
|
-
gap: 4px;
|
|
18
|
-
cursor: pointer;
|
|
19
|
-
z-index: 1;
|
|
20
|
-
font-weight: 500;
|
|
21
|
-
font-size: 12px;
|
|
22
|
-
line-height: 20px;
|
|
23
|
-
color: #4250f0;
|
|
24
|
-
align-items: center;
|
|
25
|
-
.gearIcon {
|
|
26
|
-
width: 12px;
|
|
27
|
-
height: 12px;
|
|
28
|
-
}
|
|
29
|
-
&.disabled {
|
|
30
|
-
cursor: default;
|
|
31
|
-
opacity: 0.5;
|
|
32
|
-
pointer-events: none;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.fieldOverlay {
|
|
37
|
-
// center align text
|
|
38
|
-
background: #ffffff;
|
|
39
|
-
width: 100%;
|
|
40
|
-
height: 100%;
|
|
41
|
-
position: absolute;
|
|
42
|
-
z-index: 1;
|
|
43
|
-
opacity: 0;
|
|
44
|
-
display: flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
justify-content: center;
|
|
47
|
-
&.blur {
|
|
48
|
-
// #E6E6E6 rgba(230, 230, 230, 1)
|
|
49
|
-
background: #ffffff;
|
|
50
|
-
opacity: 0.5;
|
|
51
|
-
}
|
|
52
|
-
&.hidden {
|
|
53
|
-
background: rgba(230, 230, 230, 1);
|
|
54
|
-
opacity: 0.9;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { html } from 'htm/preact';
|
|
2
|
-
import { useEffect, useRef, useState } from 'preact/hooks';
|
|
3
|
-
import { OverflowTooltip } from '@/components/OverflowTooltip';
|
|
4
|
-
import { useOnClickOutside } from '@/hooks/useOnClickOutside';
|
|
5
|
-
import useHover from '@/hooks/useHover';
|
|
6
|
-
|
|
7
|
-
import styles from './styles.module.scss';
|
|
8
|
-
|
|
9
|
-
interface EditableTextProps {
|
|
10
|
-
value: string;
|
|
11
|
-
customStyles?: {
|
|
12
|
-
wrapperClassName?: string;
|
|
13
|
-
inputClassName?: string;
|
|
14
|
-
};
|
|
15
|
-
handleChange?: (value: string) => void;
|
|
16
|
-
handleBlur?: () => void;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* EditableText component
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
const EditableText = (props: EditableTextProps) => {
|
|
24
|
-
const { value, customStyles, handleChange = () => null } = props;
|
|
25
|
-
|
|
26
|
-
const [isEditing, setIsEditing] = useState(false);
|
|
27
|
-
const inputRef = useRef<HTMLButtonElement | null>(null);
|
|
28
|
-
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
29
|
-
|
|
30
|
-
const isHovered = useHover(containerRef, isEditing);
|
|
31
|
-
|
|
32
|
-
const determineChangedValue = () => {
|
|
33
|
-
const latestVal = inputRef.current?.value.trim() || '';
|
|
34
|
-
if (latestVal === '') {
|
|
35
|
-
// revert to original value
|
|
36
|
-
handleChange(value);
|
|
37
|
-
} else if (latestVal !== value) {
|
|
38
|
-
// let the update go through if value changed
|
|
39
|
-
handleChange(latestVal);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
useOnClickOutside(containerRef, () => {
|
|
44
|
-
if (isEditing) {
|
|
45
|
-
setIsEditing(false);
|
|
46
|
-
determineChangedValue();
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// If released key is our target key then set to false
|
|
51
|
-
const upHandler = ({ key }: { key: string }): void => {
|
|
52
|
-
if (key === 'Enter') {
|
|
53
|
-
// we need to set editable to false
|
|
54
|
-
setIsEditing(false);
|
|
55
|
-
determineChangedValue();
|
|
56
|
-
} else if (key === 'Escape') {
|
|
57
|
-
setIsEditing(false);
|
|
58
|
-
// revert to original value
|
|
59
|
-
// determineChangedValue();
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
if (inputRef && inputRef.current && isEditing === true) {
|
|
65
|
-
inputRef.current.value = value;
|
|
66
|
-
inputRef.current.focus();
|
|
67
|
-
if (inputRef && inputRef.current) {
|
|
68
|
-
inputRef.current?.addEventListener('keyup', upHandler);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// Remove event listeners on cleanup
|
|
72
|
-
return () => {
|
|
73
|
-
if (inputRef && inputRef.current) {
|
|
74
|
-
inputRef.current.removeEventListener('keyup', upHandler);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
}, [isEditing, inputRef]);
|
|
78
|
-
|
|
79
|
-
const handleEditClick = (e: MouseEvent) => {
|
|
80
|
-
if (e.currentTarget instanceof HTMLButtonElement) {
|
|
81
|
-
setIsEditing((prev) => !prev);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
return html`
|
|
86
|
-
<div
|
|
87
|
-
ref=${containerRef}
|
|
88
|
-
class="${styles.editableTextWrapper} ${customStyles?.wrapperClassName}"
|
|
89
|
-
style="${isHovered ? 'grid-template-columns: minmax(20px, 1fr) 30px;' : ''}"
|
|
90
|
-
>
|
|
91
|
-
${isEditing
|
|
92
|
-
? html`<input
|
|
93
|
-
class="${styles.input} ${customStyles?.inputClassName}"
|
|
94
|
-
ref=${inputRef}
|
|
95
|
-
/>`
|
|
96
|
-
: html` <${OverflowTooltip} text=${value} /> `}
|
|
97
|
-
${!isEditing &&
|
|
98
|
-
isHovered &&
|
|
99
|
-
html`
|
|
100
|
-
<button class=${styles.editButton} onclick=${handleEditClick}>
|
|
101
|
-
<svg
|
|
102
|
-
width="12"
|
|
103
|
-
height="12"
|
|
104
|
-
viewBox="0 0 12 12"
|
|
105
|
-
fill="none"
|
|
106
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
107
|
-
>
|
|
108
|
-
<path
|
|
109
|
-
fill-rule="evenodd"
|
|
110
|
-
clip-rule="evenodd"
|
|
111
|
-
d="M1.22758 11.3122C1.1985 11.327 1.15461 11.327 1.11071 11.327L1.1107 11.327C1.00864 11.327 0.891777 11.2831 0.803982 11.1953C0.687111 11.0784 0.643213 10.9034 0.687111 10.7574L1.57761 7.70745C1.63634 7.54667 1.72356 7.38648 1.84043 7.26961L8.11669 0.979047C8.51063 0.585109 9.16739 0.585109 9.56133 0.979047L11.006 2.42368C11.1958 2.61294 11.2978 2.86152 11.2978 3.13858C11.2978 3.41564 11.1958 3.67846 11.006 3.86831L4.71539 10.1589C4.59852 10.2906 4.43833 10.3778 4.27756 10.4217L1.22758 11.3122ZM8.72894 4.92028L7.0796 3.27095L2.74516 7.6054L4.39449 9.25473L8.72894 4.92028ZM8.75798 1.59257C8.78706 1.56349 8.83096 1.54867 8.86003 1.54867C8.90393 1.54867 8.933 1.56349 8.96208 1.59257L10.4067 3.0372C10.4358 3.0811 10.4506 3.12499 10.4506 3.13925C10.4506 3.15407 10.4506 3.21222 10.4067 3.2413L9.35659 4.29256L7.70725 2.64322L8.75798 1.59257ZM3.60653 9.69257L2.29302 8.37905L1.75316 10.2325L3.60653 9.69257Z"
|
|
112
|
-
fill="#4250f0"
|
|
113
|
-
/>
|
|
114
|
-
</svg>
|
|
115
|
-
</button>
|
|
116
|
-
`}
|
|
117
|
-
</div>
|
|
118
|
-
`;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
export { EditableText, EditableTextProps };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
.editableTextWrapper {
|
|
2
|
-
display: flex;
|
|
3
|
-
width: 100%;
|
|
4
|
-
.input,
|
|
5
|
-
.value {
|
|
6
|
-
display: block;
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
font-size: inherit;
|
|
10
|
-
line-height: inherit;
|
|
11
|
-
margin: 0;
|
|
12
|
-
padding: 0;
|
|
13
|
-
}
|
|
14
|
-
.input {
|
|
15
|
-
flex: 1;
|
|
16
|
-
overflow: visible;
|
|
17
|
-
font-family: inherit;
|
|
18
|
-
font-size: inherit;
|
|
19
|
-
line-height: inherit;
|
|
20
|
-
&:focus {
|
|
21
|
-
outline-offset: 0;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
.input,
|
|
25
|
-
.editButton {
|
|
26
|
-
border: 0;
|
|
27
|
-
outline: 0;
|
|
28
|
-
background: none;
|
|
29
|
-
box-shadow: none;
|
|
30
|
-
text-shadow: none;
|
|
31
|
-
}
|
|
32
|
-
.editButton {
|
|
33
|
-
display: flex;
|
|
34
|
-
cursor: pointer;
|
|
35
|
-
align-items: center;
|
|
36
|
-
margin-left: 4px;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { html } from 'htm/preact';
|
|
2
|
-
import { useEffect, useRef, useState } from 'preact/hooks';
|
|
3
|
-
import { useOnClickOutside } from '@/hooks/useOnClickOutside';
|
|
4
|
-
// import useHover from '@/hooks/useHover';
|
|
5
|
-
import useAutosizeTextArea from '@/hooks/useAutosizeTextArea';
|
|
6
|
-
import styles from './styles.module.scss';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
interface EditableTextAreaProps {
|
|
10
|
-
value: string;
|
|
11
|
-
handleChange?: (value: string) => void;
|
|
12
|
-
placeholder?: string;
|
|
13
|
-
keepEditingOn?: boolean;
|
|
14
|
-
isContentEditable?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* EditableText component
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
const EditableTextArea = (props: EditableTextAreaProps) => {
|
|
22
|
-
const { value, handleChange = () => null, placeholder = 'Enter text here...', keepEditingOn = false, isContentEditable = false } = props;
|
|
23
|
-
|
|
24
|
-
const [isEditing, setIsEditing] = useState(keepEditingOn || false);
|
|
25
|
-
const [editValue, setEditValue] = useState('');
|
|
26
|
-
const textAreaRef = useRef<HTMLTextAreaElement | null>(null);
|
|
27
|
-
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
28
|
-
const contentEditableRef = useRef<HTMLDivElement | null>(null);
|
|
29
|
-
const lastSavedValueRef = useRef<string>(value || '');
|
|
30
|
-
|
|
31
|
-
// const isHovered = useHover(containerRef, isEditing);
|
|
32
|
-
|
|
33
|
-
useAutosizeTextArea(textAreaRef.current, editValue);
|
|
34
|
-
|
|
35
|
-
const determineChangedValue = () => {
|
|
36
|
-
const latestVal = editValue.trim() || '';
|
|
37
|
-
if (latestVal !== lastSavedValueRef.current) {
|
|
38
|
-
handleChange(latestVal);
|
|
39
|
-
lastSavedValueRef.current = latestVal;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
useOnClickOutside(containerRef, () => {
|
|
44
|
-
if (isEditing || keepEditingOn) {
|
|
45
|
-
setIsEditing(false);
|
|
46
|
-
determineChangedValue();
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// If released key is our target key then set to false
|
|
51
|
-
const upHandler = ({ key }: { key: string }): void => {
|
|
52
|
-
if (key === 'Enter') {
|
|
53
|
-
// we need to set editable to false
|
|
54
|
-
setIsEditing(false);
|
|
55
|
-
// determineChangedValue();
|
|
56
|
-
} else if (key === 'Escape') {
|
|
57
|
-
setIsEditing(false);
|
|
58
|
-
// revert to original value
|
|
59
|
-
// determineChangedValue();
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
if (textAreaRef && textAreaRef.current && isEditing === true) {
|
|
65
|
-
textAreaRef.current.focus();
|
|
66
|
-
if (textAreaRef && textAreaRef.current) {
|
|
67
|
-
textAreaRef.current?.addEventListener('keyup', upHandler);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
// Remove event listeners on cleanup
|
|
71
|
-
return () => {
|
|
72
|
-
if (textAreaRef && textAreaRef.current) {
|
|
73
|
-
textAreaRef.current.removeEventListener('keyup', upHandler);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
}, [isEditing, textAreaRef]);
|
|
77
|
-
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
if (value !== editValue) {
|
|
80
|
-
setEditValue(value);
|
|
81
|
-
}
|
|
82
|
-
}, [value]);
|
|
83
|
-
|
|
84
|
-
const handleEditClick = (e: MouseEvent) => {
|
|
85
|
-
if (e.currentTarget instanceof HTMLButtonElement) {
|
|
86
|
-
setIsEditing((prev) => !prev);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
91
|
-
const handleTextAreaChange = (evt: any) => {
|
|
92
|
-
const val = evt.target?.value;
|
|
93
|
-
console.info('changed', value);
|
|
94
|
-
setEditValue(val);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
return html`
|
|
98
|
-
<div ref=${containerRef} class=${styles.editableTextWrapper}>
|
|
99
|
-
${isContentEditable ? html`
|
|
100
|
-
<div class="${styles.editableContentWrap}">
|
|
101
|
-
<span contentEditable=${true}
|
|
102
|
-
dangerouslySetInnerHTML=${{
|
|
103
|
-
__html: value,
|
|
104
|
-
}}
|
|
105
|
-
ref=${contentEditableRef}
|
|
106
|
-
onBlur=${(e: any) => { setEditValue(e.currentTarget?.textContent || '') }}
|
|
107
|
-
class="${styles.editContentSpan}"
|
|
108
|
-
oninput=${(e: any) => { setEditValue(e.currentTarget?.textContent || '') }}
|
|
109
|
-
/>
|
|
110
|
-
${!editValue && html`
|
|
111
|
-
<span class="${styles.placeholder}" onclick=${(e: any) => { contentEditableRef.current?.focus() }}>${placeholder}</span>
|
|
112
|
-
`}
|
|
113
|
-
<button class="${styles.contentEditButton}" onclick=${(e: any) => { contentEditableRef.current?.focus() }}>
|
|
114
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
115
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.838837 15.9777C0.795063 16 0.728973 16 0.662884 16L0.662875 15.9999C0.50922 15.9999 0.333276 15.9339 0.201097 15.8019C0.0251438 15.6262 -0.0409457 15.3631 0.0251438 15.1437L1.36583 10.5588C1.45425 10.3171 1.58556 10.0763 1.76151 9.9006L11.2107 0.444147C11.8037 -0.148049 12.7925 -0.148049 13.3856 0.444147L15.5605 2.61583C15.8464 2.90034 16 3.27402 16 3.69052C16 4.10702 15.8464 4.50211 15.5605 4.78751L6.08987 14.244C5.91392 14.4419 5.67274 14.5731 5.43069 14.639L0.838837 15.9777ZM12.1323 6.36906L9.64921 3.88966L3.12354 10.4055L5.60667 12.8849L12.1323 6.36906ZM12.1762 1.36628C12.2199 1.32257 12.286 1.30029 12.3298 1.30029C12.3959 1.30029 12.4397 1.32257 12.4834 1.36628L14.6584 3.53796C14.7022 3.60395 14.7245 3.66994 14.7245 3.69137C14.7245 3.71365 14.7245 3.80107 14.6584 3.84477L13.0774 5.42511L10.5942 2.94571L12.1762 1.36628ZM4.42044 13.5431L2.4429 11.5685L1.63013 14.3547L4.42044 13.5431Z" fill="#4250F0"/>
|
|
116
|
-
</svg>
|
|
117
|
-
</button>
|
|
118
|
-
</div>
|
|
119
|
-
` : html `
|
|
120
|
-
${(isEditing || keepEditingOn)
|
|
121
|
-
? html`
|
|
122
|
-
<textarea rows="1" class=${styles.input}
|
|
123
|
-
placeholder="${placeholder}"
|
|
124
|
-
ref=${textAreaRef}
|
|
125
|
-
value=${editValue}
|
|
126
|
-
oninput=${handleTextAreaChange}
|
|
127
|
-
/>
|
|
128
|
-
`
|
|
129
|
-
: html` <div class=${styles.value}>${editValue}</div> `}
|
|
130
|
-
${(!isEditing || keepEditingOn) &&
|
|
131
|
-
html`
|
|
132
|
-
<button class=${styles.editButton} onclick=${handleEditClick}>
|
|
133
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
134
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.838837 15.9777C0.795063 16 0.728973 16 0.662884 16L0.662875 15.9999C0.50922 15.9999 0.333276 15.9339 0.201097 15.8019C0.0251438 15.6262 -0.0409457 15.3631 0.0251438 15.1437L1.36583 10.5588C1.45425 10.3171 1.58556 10.0763 1.76151 9.9006L11.2107 0.444147C11.8037 -0.148049 12.7925 -0.148049 13.3856 0.444147L15.5605 2.61583C15.8464 2.90034 16 3.27402 16 3.69052C16 4.10702 15.8464 4.50211 15.5605 4.78751L6.08987 14.244C5.91392 14.4419 5.67274 14.5731 5.43069 14.639L0.838837 15.9777ZM12.1323 6.36906L9.64921 3.88966L3.12354 10.4055L5.60667 12.8849L12.1323 6.36906ZM12.1762 1.36628C12.2199 1.32257 12.286 1.30029 12.3298 1.30029C12.3959 1.30029 12.4397 1.32257 12.4834 1.36628L14.6584 3.53796C14.7022 3.60395 14.7245 3.66994 14.7245 3.69137C14.7245 3.71365 14.7245 3.80107 14.6584 3.84477L13.0774 5.42511L10.5942 2.94571L12.1762 1.36628ZM4.42044 13.5431L2.4429 11.5685L1.63013 14.3547L4.42044 13.5431Z" fill="#4250F0"/>
|
|
135
|
-
</svg>
|
|
136
|
-
</button>
|
|
137
|
-
`}
|
|
138
|
-
`}
|
|
139
|
-
</div>
|
|
140
|
-
`;
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
export { EditableTextArea, EditableTextAreaProps };
|