From 3ecdb67c506e36f2d4a10460d5647bc0fc9e0635 Mon Sep 17 00:00:00 2001 From: Rob Dekker Date: Wed, 25 Oct 2023 14:38:26 +0200 Subject: [PATCH 1/5] fix: improve visibility of delete icon in chip --- src/components/multiAutoCompleteInput.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/multiAutoCompleteInput.js b/src/components/multiAutoCompleteInput.js index 502b4a1ec..993da9200 100644 --- a/src/components/multiAutoCompleteInput.js +++ b/src/components/multiAutoCompleteInput.js @@ -1055,6 +1055,13 @@ style.getColor(backgroundColorChip), '!important', ], + '& .MuiSvgIcon-root': { + color: ({ options: { backgroundColorChip, textColorChip } }) => + backgroundColorChip !== 'Light' && [ + style.getColor(textColorChip), + '!important', + ], + }, }, }, '& .MuiIconButton-root': { From f69a63d46152a4b17cba8f55d2d5a6a16dfda32c Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 1 Nov 2023 07:41:22 +0000 Subject: [PATCH 2/5] chore(release): 2.165.1 [skip ci] ## [2.165.1](https://github.com/bettyblocks/material-ui-component-set/compare/v2.165.0...v2.165.1) (2023-11-01) ### Bug Fixes * improve visibility of delete icon in chip ([3ecdb67](https://github.com/bettyblocks/material-ui-component-set/commit/3ecdb67c506e36f2d4a10460d5647bc0fc9e0635)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49dfcd842..1f60ab1ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [2.165.1](https://github.com/bettyblocks/material-ui-component-set/compare/v2.165.0...v2.165.1) (2023-11-01) + + +### Bug Fixes + +* improve visibility of delete icon in chip ([3ecdb67](https://github.com/bettyblocks/material-ui-component-set/commit/3ecdb67c506e36f2d4a10460d5647bc0fc9e0635)) + # [2.165.0](https://github.com/bettyblocks/material-ui-component-set/compare/v2.164.0...v2.165.0) (2023-10-17) diff --git a/package.json b/package.json index 0ecb41bda..e2d988909 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "component-set", - "version": "2.165.0", + "version": "2.165.1", "main": "dist/templates.json", "license": "UNLICENSED", "private": false, From 81925ad28c15c153aee7a2ba5f228fb263afff55 Mon Sep 17 00:00:00 2001 From: ingmar-stipriaan Date: Wed, 1 Nov 2023 11:10:16 +0100 Subject: [PATCH 3/5] feat: add questionnaire page templates --- src/prefabs/pageWithQuestionnaire.tsx | 2289 ++++++++++++++++++ src/prefabs/pageWithQuestionnaireStart.tsx | 1073 ++++++++ src/prefabs/questionnaire/checkboxWidget.ts | 241 ++ src/prefabs/questionnaire/dateWidget.ts | 237 ++ src/prefabs/questionnaire/dropdownWidget.ts | 255 ++ src/prefabs/questionnaire/index.ts | 17 + src/prefabs/questionnaire/multilineWidget.ts | 225 ++ src/prefabs/questionnaire/numberWidget.ts | 225 ++ src/prefabs/questionnaire/radioWidget.ts | 241 ++ src/prefabs/questionnaire/textWidget.ts | 221 ++ 10 files changed, 5024 insertions(+) create mode 100644 src/prefabs/pageWithQuestionnaire.tsx create mode 100644 src/prefabs/pageWithQuestionnaireStart.tsx create mode 100644 src/prefabs/questionnaire/checkboxWidget.ts create mode 100644 src/prefabs/questionnaire/dateWidget.ts create mode 100644 src/prefabs/questionnaire/dropdownWidget.ts create mode 100644 src/prefabs/questionnaire/index.ts create mode 100644 src/prefabs/questionnaire/multilineWidget.ts create mode 100644 src/prefabs/questionnaire/numberWidget.ts create mode 100644 src/prefabs/questionnaire/radioWidget.ts create mode 100644 src/prefabs/questionnaire/textWidget.ts diff --git a/src/prefabs/pageWithQuestionnaire.tsx b/src/prefabs/pageWithQuestionnaire.tsx new file mode 100644 index 000000000..0b85997d9 --- /dev/null +++ b/src/prefabs/pageWithQuestionnaire.tsx @@ -0,0 +1,2289 @@ +import * as React from 'react'; +import { + BeforeCreateArgs, + Icon, + PrefabComponent, + PrefabComponentOption, + ThemeColor, + addChild, + childSelector, + color, + font, + linked, + option, + prefab as makePrefab, + reconfigure, + showIf, + size, + sizes, + toggle, + variable, + wrapper, + InteractionType, +} from '@betty-blocks/component-sdk'; +import { + Box, + Column, + DataContainer, + Drawer, + DrawerBar, + DrawerContainer, + Grid, + List, + ListItem, + Media, + Row, + Tab, + Tabs, + Text as TextComp, + boxOptions, + columnOptions, + drawerBarOptions, + drawerContainerOptions, + drawerOptions, + gridOptions, + listItemOptions, + mediaOptions, + rowOptions, + tabOptions, + tabsOptions, + textOptions, +} from './structures'; +import { ModelProps, ModelQuery } from './types'; +import { + checkboxWidget, + dateWidget, + dropdownWidget, + multilineWidget, + numberWidget, + textWidget, + radioWidget, +} from './questionnaire'; + +const beforeCreate = ({ + components: { + Box: BoxComp, + Button: ButtonComp, + Content, + Field, + Footer, + Header, + ModelSelector, + Text, + TextArea, + TextInput, + }, + prefab, + save, + close, + helpers: { + addModelAndProperties, + addSchemaModel, + camelToSnakeCase, + setOption, + useCurrentPageId, + useCurrentPartialId, + useModelQuery, + }, +}: BeforeCreateArgs) => { + const [model, setModel] = React.useState(); + const [modelId, setModelId] = React.useState(''); + const [title, setTitle] = React.useState(''); + const [description, setDescription] = React.useState(''); + const [sectionTitle, setSectionTitle] = React.useState('Basic information'); + const [sectionDescription, setSectionDescription] = React.useState(''); + const [validation, setValidation] = React.useState(false); + const [validationMessage, setValidationMessage] = React.useState(''); + const [stepNumber, setStepNumber] = React.useState(1); + const [createNewQuestionnaire, setCreateNewQuestionnaire] = + React.useState(true); + // regex to only support the following characters A-Z a-z 0-9 . _ - + const nameRegExp = /^[\w\-\s.]+$/g; + + const pageId = useCurrentPageId(); + const partialId = useCurrentPartialId(); + + useModelQuery({ + variables: { id: modelId }, + onCompleted: (result: ModelQuery) => { + setModel(result.model); + }, + skip: !modelId, + }); + + const treeSearch = (refValue: string, structure: any) => + structure.reduce((acc: string, component: PrefabComponent) => { + if (acc) return acc; + if ( + component.ref && + Object.values(component.ref).indexOf(refValue) > -1 + ) { + return component; + } + return treeSearch(refValue, component.descendants); + }, null); + + const stepper = { + setStep: (step: number) => { + if (step === 1) { + return ( + <> + + Add a title and a description to the questionnaire + + + {validation && ( + + {validationMessage} +
+
+ )} + or + {createNewQuestionnaire ? ( + { + setCreateNewQuestionnaire(false); + setValidation(false); + setValidationMessage(''); + }} + style={{ cursor: 'pointer' }} + > + use an existing questionnaire model + + ) : ( + { + setCreateNewQuestionnaire(true); + setValidation(false); + setValidationMessage(''); + }} + style={{ cursor: 'pointer' }} + > + create a new questionnaire + + )} + + } + > + {createNewQuestionnaire ? ( + { + if (typeof value !== 'string') { + throw new Error('expected string'); + } + setTitle(value); + if (value.length >= 50) { + setValidationMessage( + 'Name should be at most 50 character(s)', + ); + setValidation(true); + } else if ( + value.trim().length > 0 && + !nameRegExp.test(value) + ) { + setValidationMessage( + 'Only use alphanumeric characters (A-Z a-z 0-9 . _ -) and spaces here.', + ); + setValidation(true); + } else { + setValidation(false); + setValidationMessage(''); + } + }} + value={title} + color={validation && 'pink'} + /> + ) : ( + { + setModelId(value); + setValidationMessage(''); + setValidation(false); + }} + required + modelId={modelId} + value={modelId} + /> + )} +
+ +