@oneblink/apps-react 2.9.0-beta.7 → 2.9.0-beta.8
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/components/renderer/FormElementLabelContainer.d.ts +6 -0
- package/dist/components/renderer/FormElementLabelContainer.js +17 -5
- package/dist/components/renderer/FormElementLabelContainer.js.map +1 -1
- package/dist/form-elements/FormElementSection.js +5 -7
- package/dist/form-elements/FormElementSection.js.map +1 -1
- package/dist/hooks/useHint.d.ts +1 -1
- package/dist/hooks/useHint.js +0 -2
- package/dist/hooks/useHint.js.map +1 -1
- package/package.json +1 -1
@@ -8,5 +8,11 @@ declare function FormElementLabelContainer({ className, element, id, required, c
|
|
8
8
|
children: React.ReactNode;
|
9
9
|
leading?: React.ReactNode;
|
10
10
|
}): JSX.Element;
|
11
|
+
export declare function HintTooltip({ hint }: {
|
12
|
+
hint: string;
|
13
|
+
}): JSX.Element;
|
14
|
+
export declare function HintBelowLabel({ hint }: {
|
15
|
+
hint: string;
|
16
|
+
}): JSX.Element;
|
11
17
|
declare const _default: React.MemoExoticComponent<typeof FormElementLabelContainer>;
|
12
18
|
export default _default;
|
@@ -3,18 +3,30 @@ import { Tooltip } from '@mui/material';
|
|
3
3
|
import clsx from 'clsx';
|
4
4
|
import useHint from '../../hooks/useHint';
|
5
5
|
function FormElementLabelContainer({ className, element, id, required, children, leading, }) {
|
6
|
-
const hint = useHint(element.hint);
|
7
6
|
return (React.createElement("div", { className: clsx('ob-form__element', className) },
|
8
7
|
React.createElement("div", { className: "label ob-label__container" },
|
9
8
|
leading,
|
10
9
|
React.createElement("label", { className: clsx('ob-label', {
|
11
10
|
'ob-label__required is-required': required,
|
12
11
|
}), htmlFor: id }, element.label),
|
13
|
-
|
14
|
-
React.createElement(
|
15
|
-
hint && element.hintPosition === 'BELOW_LABEL' && (React.createElement("div", { className: "ob-hint-text__container" },
|
16
|
-
React.createElement(
|
12
|
+
element.hint &&
|
13
|
+
(element.hintPosition === 'TOOLTIP' || !element.hintPosition) && (React.createElement(HintTooltip, { hint: element.hint }))),
|
14
|
+
element.hint && element.hintPosition === 'BELOW_LABEL' && (React.createElement("div", { className: "ob-hint-text__container" },
|
15
|
+
React.createElement(HintBelowLabel, { hint: element.hint }))),
|
17
16
|
children));
|
18
17
|
}
|
18
|
+
export function HintTooltip({ hint }) {
|
19
|
+
const html = useHint(hint);
|
20
|
+
return (React.createElement(Tooltip, { title: React.createElement("div", { dangerouslySetInnerHTML: {
|
21
|
+
__html: html,
|
22
|
+
} }), arrow: true, enterTouchDelay: 0, leaveTouchDelay: 10000 },
|
23
|
+
React.createElement("i", { className: "material-icons has-text-grey-light ob-label__hint" }, "info")));
|
24
|
+
}
|
25
|
+
export function HintBelowLabel({ hint }) {
|
26
|
+
const html = useHint(hint);
|
27
|
+
return (React.createElement("div", { className: "ob-hint-text", dangerouslySetInnerHTML: {
|
28
|
+
__html: html,
|
29
|
+
} }));
|
30
|
+
}
|
19
31
|
export default React.memo(FormElementLabelContainer);
|
20
32
|
//# sourceMappingURL=FormElementLabelContainer.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FormElementLabelContainer.js","sourceRoot":"","sources":["../../../src/components/renderer/FormElementLabelContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,OAAO,MAAM,qBAAqB,CAAA;AAEzC,SAAS,yBAAyB,CAAC,EACjC,SAAS,EACT,OAAO,EACP,EAAE,EACF,QAAQ,EACR,QAAQ,EACR,OAAO,GAQR;IACC,
|
1
|
+
{"version":3,"file":"FormElementLabelContainer.js","sourceRoot":"","sources":["../../../src/components/renderer/FormElementLabelContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,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I,EAAoB;IACvD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE1B,OAAO,CACL,6BACE,SAAS,EAAC,cAAc,EACxB,uBAAuB,EAAE;YACvB,MAAM,EAAE,IAAI;SACb,GACD,CACH,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { Tooltip } from '@mui/material'\nimport clsx from 'clsx'\nimport { FormTypes } from '@oneblink/types'\nimport useHint from '../../hooks/useHint'\n\nfunction FormElementLabelContainer({\n className,\n element,\n id,\n required,\n children,\n leading,\n}: {\n className: string\n element: FormTypes.FormElementBase\n id: string\n required: boolean\n children: React.ReactNode\n leading?: React.ReactNode\n}) {\n return (\n <div className={clsx('ob-form__element', className)}>\n <div className=\"label ob-label__container\">\n {leading}\n <label\n className={clsx('ob-label', {\n 'ob-label__required is-required': required,\n })}\n htmlFor={id}\n >\n {element.label}\n </label>\n {element.hint &&\n (element.hintPosition === 'TOOLTIP' || !element.hintPosition) && (\n <HintTooltip hint={element.hint} />\n )}\n </div>\n {element.hint && element.hintPosition === 'BELOW_LABEL' && (\n <div className=\"ob-hint-text__container\">\n <HintBelowLabel hint={element.hint} />\n </div>\n )}\n {children}\n </div>\n )\n}\n\nexport function HintTooltip({ hint }: { hint: string }) {\n const html = useHint(hint)\n\n return (\n <Tooltip\n title={\n <div\n dangerouslySetInnerHTML={{\n __html: html,\n }}\n />\n }\n arrow\n enterTouchDelay={0}\n leaveTouchDelay={10000}\n >\n <i className=\"material-icons has-text-grey-light ob-label__hint\">info</i>\n </Tooltip>\n )\n}\n\nexport function HintBelowLabel({ hint }: { hint: string }) {\n const html = useHint(hint)\n\n return (\n <div\n className=\"ob-hint-text\"\n dangerouslySetInnerHTML={{\n __html: html,\n }}\n />\n )\n}\n\nexport default React.memo(FormElementLabelContainer)\n"]}
|
@@ -4,11 +4,10 @@ import { Collapse, Tooltip } from '@mui/material';
|
|
4
4
|
import useBooleanState from '../hooks/useBooleanState';
|
5
5
|
import OneBlinkFormElements from '../components/renderer/OneBlinkFormElements';
|
6
6
|
import { checkSectionValidity } from '../services/form-validation';
|
7
|
-
import
|
7
|
+
import { HintBelowLabel, HintTooltip, } from '../components/renderer/FormElementLabelContainer';
|
8
8
|
function FormElementSection({ element, onLookup, displayValidationMessages, ...props }) {
|
9
9
|
const [isCollapsed, , , toggle] = useBooleanState(element.isCollapsed);
|
10
10
|
const [isDisplayingError, setIsDisplayingError] = React.useState(isCollapsed);
|
11
|
-
const hint = useHint(element.hint);
|
12
11
|
React.useEffect(() => {
|
13
12
|
if (isCollapsed && !isDisplayingError) {
|
14
13
|
setIsDisplayingError(true);
|
@@ -54,17 +53,16 @@ function FormElementSection({ element, onLookup, displayValidationMessages, ...p
|
|
54
53
|
React.createElement("div", { className: "ob-section__header cypress-section-header", onClick: toggle },
|
55
54
|
React.createElement("h3", { className: "ob-section__header-text title is-3" },
|
56
55
|
element.label,
|
57
|
-
hint &&
|
58
|
-
(element.hintPosition === 'TOOLTIP' || !element.hintPosition) && (React.createElement(
|
59
|
-
React.createElement("i", { className: "material-icons has-text-grey-light ob-label__hint" }, "info")))),
|
56
|
+
element.hint &&
|
57
|
+
(element.hintPosition === 'TOOLTIP' || !element.hintPosition) && (React.createElement(HintTooltip, { hint: element.hint }))),
|
60
58
|
React.createElement("div", { className: "ob-section__header-icon-container" },
|
61
59
|
isInvalid && (React.createElement(Tooltip, { title: "Section has errors" },
|
62
60
|
React.createElement("i", { className: "material-icons has-text-danger cypress-section-invalid-icon section-invalid-icon fade-in" }, "warning"))),
|
63
61
|
React.createElement("i", { className: clsx('ob-section__header-icon material-icons', {
|
64
62
|
'is-rotated': !isCollapsed,
|
65
63
|
}) }, "expand_more")),
|
66
|
-
hint && element.hintPosition === 'BELOW_LABEL' && (React.createElement("div", { className: "ob-section__hint-text-container" },
|
67
|
-
React.createElement(
|
64
|
+
element.hint && element.hintPosition === 'BELOW_LABEL' && (React.createElement("div", { className: "ob-section__hint-text-container" },
|
65
|
+
React.createElement(HintBelowLabel, { hint: element.hint })))),
|
68
66
|
React.createElement("hr", { className: "ob-section__divider" }),
|
69
67
|
React.createElement(Collapse, { in: !isCollapsed, classes: {
|
70
68
|
root: 'ob-section__content',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FormElementSection.js","sourceRoot":"","sources":["../../src/form-elements/FormElementSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,eAAe,MAAM,0BAA0B,CAAA;AACtD,OAAO,oBAEN,MAAM,6CAA6C,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAElE,OAAO,
|
1
|
+
{"version":3,"file":"FormElementSection.js","sourceRoot":"","sources":["../../src/form-elements/FormElementSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,eAAe,MAAM,0BAA0B,CAAA;AACtD,OAAO,oBAEN,MAAM,6CAA6C,CAAA;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAElE,OAAO,EACL,cAAc,EACd,WAAW,GACZ,MAAM,kDAAkD,CAAA;AAEzD,SAAS,kBAAkB,CAA6C,EACtE,OAAO,EACP,QAAQ,EACR,yBAAyB,EACzB,GAAG,KAAK,EAGT;IACC,MAAM,CAAC,WAAW,EAAE,AAAD,EAAG,AAAD,EAAG,MAAM,CAAC,GAAG,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IACtE,MAAM,CAAC,iBAAiB,EAAE,oB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iC;gBAC9C,oBAAC,cAAc,IAAC,IAAI,EAAE,OAAO,CAAC,IAAI,GAAI,CAClC,CACP,CACG;QACN,4BAAI,SAAS,EAAC,qBAAqB,GAAG;QACtC,oBAAC,QAAQ,IACP,EAAE,EAAE,CAAC,WAAW,EAChB,OAAO,EAAE;gBACP,IAAI,EAAE,qBAAqB;gBAC3B,OAAO,EAAE,sBAAsB;gBAC/B,MAAM,EAAE,uBAAuB;aAChC;YAED,oBAAC,oBAAoB,OACf,KAAK,EACT,yBAAyB,EAAE,wBAAwB,EACnD,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,OAAO,CAAC,QAAQ,GAC1B,CACO,CACP,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport clsx from 'clsx'\nimport { Collapse, Tooltip } from '@mui/material'\nimport { FormTypes } from '@oneblink/types'\nimport useBooleanState from '../hooks/useBooleanState'\nimport OneBlinkFormElements, {\n Props,\n} from '../components/renderer/OneBlinkFormElements'\nimport { checkSectionValidity } from '../services/form-validation'\nimport { FormElementLookupHandler } from '../types/form'\nimport {\n HintBelowLabel,\n HintTooltip,\n} from '../components/renderer/FormElementLabelContainer'\n\nfunction FormElementSection<T extends FormTypes._NestedElementsElement>({\n element,\n onLookup,\n displayValidationMessages,\n ...props\n}: Omit<Props<T>, 'elements'> & {\n element: FormTypes.SectionElement\n}) {\n const [isCollapsed, , , toggle] = useBooleanState(element.isCollapsed)\n const [isDisplayingError, setIsDisplayingError] = React.useState(isCollapsed)\n\n React.useEffect(() => {\n if (isCollapsed && !isDisplayingError) {\n setIsDisplayingError(true)\n }\n }, [isCollapsed, isDisplayingError])\n\n const displayValidationMessage =\n displayValidationMessages || isDisplayingError\n\n const isInvalid = React.useMemo(() => {\n return (\n displayValidationMessage &&\n checkSectionValidity(element, props.formElementsValidation)\n )\n }, [displayValidationMessage, element, props.formElementsValidation])\n\n const isValid = React.useMemo(() => {\n return !checkSectionValidity(element, props.formElementsValidation)\n }, [element, props.formElementsValidation])\n\n const handleLookup = React.useCallback<FormElementLookupHandler>(\n (mergeLookupResults) => {\n onLookup((currentFormSubmission) => {\n let model = currentFormSubmission.submission\n const elements = currentFormSubmission.elements.map((formElement) => {\n if (formElement.type === 'section' && formElement.id === element.id) {\n const { elements, submission } = mergeLookupResults({\n elements: formElement.elements,\n submission: currentFormSubmission.submission,\n lastElementUpdated: currentFormSubmission.lastElementUpdated,\n })\n model = submission\n return {\n ...formElement,\n elements,\n }\n }\n return formElement\n })\n\n return {\n elements,\n submission: model,\n lastElemenetUpdated: currentFormSubmission.lastElementUpdated,\n }\n })\n },\n [element.id, onLookup],\n )\n\n return (\n <div\n className={clsx('ob-section', {\n 'ob-section__invalid': isInvalid,\n 'ob-section__valid': isValid,\n })}\n >\n <div\n className=\"ob-section__header cypress-section-header\"\n onClick={toggle}\n >\n <h3 className=\"ob-section__header-text title is-3\">\n {element.label}\n {element.hint &&\n (element.hintPosition === 'TOOLTIP' || !element.hintPosition) && (\n <HintTooltip hint={element.hint} />\n )}\n </h3>\n <div className=\"ob-section__header-icon-container\">\n {isInvalid && (\n <Tooltip title=\"Section has errors\">\n <i className=\"material-icons has-text-danger cypress-section-invalid-icon section-invalid-icon fade-in\">\n warning\n </i>\n </Tooltip>\n )}\n <i\n className={clsx('ob-section__header-icon material-icons', {\n 'is-rotated': !isCollapsed,\n })}\n >\n expand_more\n </i>\n </div>\n {element.hint && element.hintPosition === 'BELOW_LABEL' && (\n <div className=\"ob-section__hint-text-container\">\n <HintBelowLabel hint={element.hint} />\n </div>\n )}\n </div>\n <hr className=\"ob-section__divider\" />\n <Collapse\n in={!isCollapsed}\n classes={{\n root: 'ob-section__content',\n entered: 'ob-section__expanded',\n hidden: 'ob-section__collapsed',\n }}\n >\n <OneBlinkFormElements\n {...props}\n displayValidationMessages={displayValidationMessage}\n onLookup={handleLookup}\n elements={element.elements}\n />\n </Collapse>\n </div>\n )\n}\n\nexport default React.memo(FormElementSection)\n"]}
|
package/dist/hooks/useHint.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const useHint: (elementHint: string
|
1
|
+
declare const useHint: (elementHint: string) => string;
|
2
2
|
export default useHint;
|
package/dist/hooks/useHint.js
CHANGED
@@ -8,8 +8,6 @@ const useHint = (elementHint) => {
|
|
8
8
|
const { formSubmissionModel, elements } = useFormSubmissionModel();
|
9
9
|
const index = React.useContext(RepeatableSetIndexContext);
|
10
10
|
return React.useMemo(() => {
|
11
|
-
if (!elementHint)
|
12
|
-
return;
|
13
11
|
let html = elementHint;
|
14
12
|
html = html.replace('{INDEX}', (index + 1).toString());
|
15
13
|
html = submissionService.replaceElementValues(html, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useHint.js","sourceRoot":"","sources":["../../src/hooks/useHint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,YAAY,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAA;AACrF,OAAO,sBAAsB,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,OAAO,GAAG,CAAC,
|
1
|
+
{"version":3,"file":"useHint.js","sourceRoot":"","sources":["../../src/hooks/useHint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,YAAY,MAAM,2BAA2B,CAAA;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAA;AACrF,OAAO,sBAAsB,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEpD,MAAM,OAAO,GAAG,CAAC,WAAmB,EAAE,EAAE;IACtC,MAAM,EAAE,mBAAmB,EAAE,QAAQ,EAAE,GAAG,sBAAsB,EAAE,CAAA;IAClE,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAA;IACzD,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxB,IAAI,IAAI,GAAG,WAAW,CAAA;QACtB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;QAEtD,IAAI,GAAG,iBAAiB,CAAC,oBAAoB,CAAC,IAAI,EAAE;YAClD,UAAU,EAAE,mBAAmB;YAC/B,YAAY,EAAE,QAAQ;YACtB,cAAc,EAAE,mBAAmB,CAAC,cAAc;YAClD,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;YAC9D,YAAY,EAAE,mBAAmB,CAAC,YAAY;YAC9C,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;SAC/D,CAAC,CAAA;QAEF,OAAO,YAAY,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,mBAAmB,EAAE,KAAK,CAAC,CAAC,CAAA;AACzD,CAAC,CAAA;AAED,eAAe,OAAO,CAAA","sourcesContent":["import * as React from 'react'\nimport sanitizeHtml from '../services/sanitize-html'\nimport { RepeatableSetIndexContext } from '../form-elements/FormElementRepeatableSet'\nimport useFormSubmissionModel from './useFormSubmissionModelContext'\nimport { submissionService } from '@oneblink/sdk-core'\nimport { localisationService } from '@oneblink/apps'\n\nconst useHint = (elementHint: string) => {\n const { formSubmissionModel, elements } = useFormSubmissionModel()\n const index = React.useContext(RepeatableSetIndexContext)\n return React.useMemo(() => {\n let html = elementHint\n html = html.replace('{INDEX}', (index + 1).toString())\n\n html = submissionService.replaceElementValues(html, {\n submission: formSubmissionModel,\n formElements: elements,\n formatCurrency: localisationService.formatCurrency,\n formatDate: (v) => localisationService.formatDate(new Date(v)),\n formatNumber: localisationService.formatNumber,\n formatTime: (v) => localisationService.formatTime(new Date(v)),\n })\n\n return sanitizeHtml(html)\n }, [elementHint, elements, formSubmissionModel, index])\n}\n\nexport default useHint\n"]}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@oneblink/apps-react",
|
3
3
|
"description": "Helper functions for OneBlink apps in ReactJS.",
|
4
|
-
"version": "2.9.0-beta.
|
4
|
+
"version": "2.9.0-beta.8",
|
5
5
|
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
|
6
6
|
"bugs": {
|
7
7
|
"url": "https://github.com/oneblink/apps-react/issues"
|