@oneblink/apps-react 1.0.0-beta.3 → 1.0.0-beta.6
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/CustomAccordion.js +5 -2
- package/dist/components/CustomAccordion.js.map +1 -1
- package/dist/components/ErrorSnackbar.js +8 -2
- package/dist/components/ErrorSnackbar.js.map +1 -1
- package/dist/form-elements/FormElementDate.js +1 -1
- package/dist/form-elements/FormElementDate.js.map +1 -1
- package/package.json +1 -1
@@ -9,6 +9,9 @@ export const CustomAccordion = styled(Accordion)(({ theme }) => ({
|
|
9
9
|
'&:before': {
|
10
10
|
display: 'none',
|
11
11
|
},
|
12
|
+
'&.Mui-expanded': {
|
13
|
+
margin: 'unset',
|
14
|
+
},
|
12
15
|
'& .Mui-expanded': {
|
13
16
|
margin: 'auto',
|
14
17
|
},
|
@@ -23,8 +26,8 @@ export const CustomAccordionSummary = styled(AccordionSummary)(({ theme }) => ({
|
|
23
26
|
marginBottom: theme.spacing(1.5),
|
24
27
|
},
|
25
28
|
'& .MuiAccordionSummary-content': {
|
26
|
-
'
|
27
|
-
margin: theme.spacing(1, 0),
|
29
|
+
'&.Mui-expanded': {
|
30
|
+
margin: theme.spacing(1.5, 0),
|
28
31
|
},
|
29
32
|
},
|
30
33
|
}));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"CustomAccordion.js","sourceRoot":"","sources":["../../src/components/CustomAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,GACP,MAAM,eAAe,CAAA;AAEtB,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAC/D,MAAM,EAAE,aAAa,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE;IAC5C,SAAS,EAAE,MAAM;IACjB,KAAK,EAAE,MAAM;IACb,sBAAsB,EAAE;QACtB,YAAY,EAAE,MAAM;KACrB;IACD,UAAU,EAAE;QACV,OAAO,EAAE,MAAM;KAChB;IACD,iBAAiB,EAAE;QACjB,MAAM,EAAE,MAAM;KACf;CACF,CAAC,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7E,eAAe,EAAE,oBAAoB;IACrC,gBAAgB,EAAE;QAChB,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;KAC5B;IACD,iBAAiB,EAAE;QACjB,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAC7B,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;KACjC;IACD,gCAAgC,EAAE;QAChC,
|
1
|
+
{"version":3,"file":"CustomAccordion.js","sourceRoot":"","sources":["../../src/components/CustomAccordion.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,GACP,MAAM,eAAe,CAAA;AAEtB,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAC/D,MAAM,EAAE,aAAa,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE;IAC5C,SAAS,EAAE,MAAM;IACjB,KAAK,EAAE,MAAM;IACb,sBAAsB,EAAE;QACtB,YAAY,EAAE,MAAM;KACrB;IACD,UAAU,EAAE;QACV,OAAO,EAAE,MAAM;KAChB;IACD,gBAAgB,EAAE;QAChB,MAAM,EAAE,OAAO;KAChB;IACD,iBAAiB,EAAE;QACjB,MAAM,EAAE,MAAM;KACf;CACF,CAAC,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7E,eAAe,EAAE,oBAAoB;IACrC,gBAAgB,EAAE;QAChB,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;KAC5B;IACD,iBAAiB,EAAE;QACjB,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAC7B,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;KACjC;IACD,gCAAgC,EAAE;QAChC,gBAAgB,EAAE;YAChB,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;SAC9B;KACF;CACF,CAAC,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7E,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5B,SAAS,EAAE,aAAa,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE;CAChD,CAAC,CAAC,CAAA","sourcesContent":["import {\n Accordion,\n AccordionSummary,\n AccordionDetails,\n styled,\n} from '@mui/material'\n\nexport const CustomAccordion = styled(Accordion)(({ theme }) => ({\n border: `1px solid ${theme.palette.divider}`,\n boxShadow: 'none',\n width: '100%',\n '&:not(:last-of-type)': {\n borderBottom: 'none',\n },\n '&:before': {\n display: 'none',\n },\n '&.Mui-expanded': {\n margin: 'unset',\n },\n '& .Mui-expanded': {\n margin: 'auto',\n },\n}))\n\nexport const CustomAccordionSummary = styled(AccordionSummary)(({ theme }) => ({\n backgroundColor: 'rgba(0, 0, 0, .03)',\n '&.Mui-expanded': {\n minHeight: theme.spacing(6),\n },\n '& .Mui-expanded': {\n marginTop: theme.spacing(1.5),\n marginBottom: theme.spacing(1.5),\n },\n '& .MuiAccordionSummary-content': {\n '&.Mui-expanded': {\n margin: theme.spacing(1.5, 0),\n },\n },\n}))\n\nexport const CustomAccordionDetails = styled(AccordionDetails)(({ theme }) => ({\n padding: theme.spacing(1, 2),\n borderTop: `1px solid ${theme.palette.divider}`,\n}))\n"]}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import Snackbar from '@mui/material
|
2
|
+
import { Snackbar, IconButton } from '@mui/material';
|
3
|
+
import { Close } from '@mui/icons-material';
|
3
4
|
import MuiAlert from '@mui/material/Alert';
|
5
|
+
import { styled } from '@mui/material/styles';
|
4
6
|
const Alert = React.forwardRef(function Alert(props, ref) {
|
5
7
|
return React.createElement(MuiAlert, { elevation: 6, ref: ref, variant: "filled", ...props });
|
6
8
|
});
|
@@ -14,7 +16,11 @@ function ErrorSnackbar({ open, onClose, children, }) {
|
|
14
16
|
vertical: 'bottom',
|
15
17
|
horizontal: 'right',
|
16
18
|
}, open: open, onClose: handleClose },
|
17
|
-
React.createElement(Alert, {
|
19
|
+
React.createElement(Alert, { severity: "error", action: React.createElement(IconButton, { key: "close", "aria-label": "Close", color: "inherit", onClick: handleClose, "data-cypress": "error-snackbar-close", size: "large" },
|
20
|
+
React.createElement(StyledCloseIcon, null)) }, children)));
|
18
21
|
}
|
22
|
+
const StyledCloseIcon = styled(Close)(() => ({
|
23
|
+
fontSize: 20,
|
24
|
+
}));
|
19
25
|
export default React.memo(ErrorSnackbar);
|
20
26
|
//# sourceMappingURL=ErrorSnackbar.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ErrorSnackbar.js","sourceRoot":"","sources":["../../src/components/ErrorSnackbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,QAAQ,MAAM,
|
1
|
+
{"version":3,"file":"ErrorSnackbar.js","sourceRoot":"","sources":["../../src/components/ErrorSnackbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAA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C,CAAC,CAAA;AAEH,eAAe,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { Snackbar, IconButton } from '@mui/material'\nimport { Close } from '@mui/icons-material'\nimport MuiAlert, { AlertProps } from '@mui/material/Alert'\nimport { styled } from '@mui/material/styles'\n\nconst Alert = React.forwardRef<HTMLDivElement, AlertProps>(function Alert(\n props,\n ref,\n) {\n return <MuiAlert elevation={6} ref={ref} variant=\"filled\" {...props} />\n})\n\nfunction ErrorSnackbar({\n open,\n onClose,\n children,\n}: {\n open: boolean\n children: React.ReactNode\n onClose: (arg: null) => unknown\n}) {\n const handleClose = React.useCallback(\n (e: unknown, reason?: string) => {\n if (reason !== 'clickaway') {\n onClose(null)\n }\n },\n [onClose],\n )\n return (\n <Snackbar\n anchorOrigin={{\n vertical: 'bottom',\n horizontal: 'right',\n }}\n open={open}\n onClose={handleClose}\n >\n <Alert\n severity=\"error\"\n action={\n <IconButton\n key=\"close\"\n aria-label=\"Close\"\n color=\"inherit\"\n onClick={handleClose}\n data-cypress=\"error-snackbar-close\"\n size=\"large\"\n >\n <StyledCloseIcon />\n </IconButton>\n }\n >\n {children}\n </Alert>\n </Snackbar>\n )\n}\n\nconst StyledCloseIcon = styled(Close)(() => ({\n fontSize: 20,\n}))\n\nexport default React.memo(ErrorSnackbar)\n"]}
|
@@ -13,7 +13,7 @@ function FormElementDate({ id, element, value, onChange, validationMessage, disp
|
|
13
13
|
const opts = {
|
14
14
|
altInput: true,
|
15
15
|
dateFormat: 'Y-m-d',
|
16
|
-
altFormat: localisationService.
|
16
|
+
altFormat: localisationService.getFlatpickrFormats().shortDate,
|
17
17
|
allowInput: true,
|
18
18
|
altInputClass: 'input ob-input cypress-date-control',
|
19
19
|
minDate: parseDateValue({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FormElementDate.js","sourceRoot":"","sources":["../../src/form-elements/FormElementDate.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,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,CACP;gBACD,oBAAC,YAAY,IACX,aAAa,QACb,KAAK,EAAE,KAAK,EACZ,iBAAiB,EAAE,iBAAiB,GACpC,CACE;YAEL,CAAC,OAAO,IAAI,wBAAwB,CAAC,IAAI,CAAC,CAAC,iBAAiB,IAAI,CAC/D,6BAAK,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,kBAAkB;gBAC5C,6BAAK,SAAS,EAAC,2DAA2D,IACvE,iBAAiB,CACd,CACF,CACP,CACyB,CACxB,CACP,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA","sourcesContent":["import * as React from 'react'\nimport { localisationService } from '@oneblink/apps'\n\nimport CopyToClipboardButton from '../components/renderer/CopyToClipboardButton'\nimport useFlatpickr, { FlatpickrOptions } from '../hooks/useFlatpickr'\nimport useBooleanState from '../hooks/useBooleanState'\nimport LookupButton from '../components/renderer/LookupButton'\nimport { FormTypes } from '@oneblink/types'\nimport FormElementLabelContainer from '../components/renderer/FormElementLabelContainer'\nimport { generateDate, parseDateValue } from '../services/generate-default-data'\nimport { FormElementValueChangeHandler } from '../types/form'\n\ntype Props = {\n id: string\n element: FormTypes.DateElement\n value: unknown | undefined\n onChange: FormElementValueChangeHandler<string>\n displayValidationMessage: boolean\n validationMessage: string | undefined\n}\n\nfunction FormElementDate({\n id,\n element,\n value,\n onChange,\n validationMessage,\n displayValidationMessage,\n}: Props) {\n const htmlDivElementRef = React.useRef<HTMLDivElement>(null)\n\n const [isDirty, setIsDirty] = useBooleanState(false)\n\n const flatpickrOptions = React.useMemo(() => {\n const opts: FlatpickrOptions = {\n altInput: true,\n dateFormat: 'Y-m-d',\n altFormat: localisationService.getFlatpickrFormats().shortDate,\n allowInput: true,\n altInputClass: 'input ob-input cypress-date-control',\n minDate: parseDateValue({\n dateOnly: false,\n daysOffset: element.fromDateDaysOffset,\n value: element.fromDate,\n }),\n maxDate: parseDateValue({\n dateOnly: false,\n daysOffset: element.toDateDaysOffset,\n value: element.toDate,\n }),\n defaultDate: undefined,\n allowInvalidPreload: true,\n onClose: setIsDirty,\n }\n\n return opts\n }, [\n element.fromDate,\n element.fromDateDaysOffset,\n element.toDate,\n element.toDateDaysOffset,\n setIsDirty,\n ])\n\n const handleChange = React.useCallback(\n (newValue) => onChange(element, newValue),\n [element, onChange],\n )\n\n useFlatpickr(\n {\n id,\n value,\n onChange: handleChange,\n dateOnly: true,\n },\n flatpickrOptions,\n htmlDivElementRef,\n )\n\n const text = React.useMemo(() => {\n if (typeof value === 'string') {\n const date = generateDate({\n daysOffset: undefined,\n value,\n dateOnly: true,\n })\n if (date) {\n return localisationService.formatDate(date)\n }\n }\n return null\n }, [value])\n\n return (\n <div className=\"cypress-date-element\" ref={htmlDivElementRef}>\n <FormElementLabelContainer\n className=\"ob-date\"\n id={id}\n element={element}\n required={element.required}\n >\n <div className=\"field has-addons\">\n <div className=\"control is-expanded has-icons-right\">\n <input\n type=\"date\"\n id={id}\n name={element.name}\n placeholder={element.placeholderValue}\n disabled={element.readOnly}\n className=\"input ob-input\"\n />\n <span className=\"ob-input-icon icon is-small is-right\">\n <i className=\"material-icons is-size-5\">event</i>\n </span>\n </div>\n {!!element.readOnly && !!text && (\n <div className=\"control\">\n <CopyToClipboardButton\n className=\"button is-input-addon cypress-copy-to-clipboard-button\"\n isInputButton\n text={text}\n />\n </div>\n )}\n <LookupButton\n isInputButton\n value={value}\n validationMessage={validationMessage}\n />\n </div>\n\n {(isDirty || displayValidationMessage) && !!validationMessage && (\n <div role=\"alert\" className=\"has-margin-top-8\">\n <div className=\"has-text-danger ob-error__text cypress-validation-message\">\n {validationMessage}\n </div>\n </div>\n )}\n </FormElementLabelContainer>\n </div>\n )\n}\n\nexport default React.memo(FormElementDate)\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": "1.0.0-beta.
|
4
|
+
"version": "1.0.0-beta.6",
|
5
5
|
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
|
6
6
|
"bugs": {
|
7
7
|
"url": "https://github.com/oneblink/apps-react/issues"
|