Skip to content

Commit

Permalink
Revert "Revert "Release""
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanBetty authored Apr 8, 2024
1 parent bda57ad commit 34717cd
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 24 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [2.187.0](https://github.com/bettyblocks/material-ui-component-set/compare/v2.186.0...v2.187.0) (2024-04-03)


### Features

* add for and id attributes to textfield ([0ce2cc1](https://github.com/bettyblocks/material-ui-component-set/commit/0ce2cc1a35a5ecb265e9088dd3518915c53f2bb6))

# [2.186.0](https://github.com/bettyblocks/material-ui-component-set/compare/v2.185.0...v2.186.0) (2024-03-19)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "component-set",
"version": "2.186.0",
"version": "2.187.0",
"main": "dist/templates.json",
"license": "UNLICENSED",
"private": false,
Expand Down
3 changes: 3 additions & 0 deletions src/components/autocompleteInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
InteractionScope,
ModelProvider,
env,
generateUUID,
getIdProperty,
getModel,
getProperty,
Expand Down Expand Up @@ -95,6 +96,7 @@
const [debouncedCurrentValue, setDebouncedCurrentValue] = useState();
const [interactionFilter, setInteractionFilter] = useState({});
const defaultValueEvaluatedRef = useRef(false);
const { current: labelControlRef } = useRef(generateUUID());

const isNumberType = type === 'number';

Expand Down Expand Up @@ -733,6 +735,7 @@
error={errorState}
>
<Autocomplete
id={labelControlRef}
disableCloseOnSelect={!closeOnSelect}
disabled={disabled}
{...(!isListProperty && {
Expand Down
4 changes: 4 additions & 0 deletions src/components/checkboxGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

const {
env,
generateUUID,
getIdProperty,
getModel,
getProperty,
Expand Down Expand Up @@ -329,15 +330,18 @@
const hasError = errorState || !isValid;

const renderCheckbox = (checkboxLabel, checkboxValue) => {
const labelControlRef = generateUUID();
return (
<FormControlLabel
control={
<MUICheckbox
id={labelControlRef}
required={required && !isValid}
tabIndex={isDev ? -1 : undefined}
size={size}
/>
}
htmlFor={labelControlRef}
label={checkboxLabel}
labelPlacement={position}
checked={values.includes(checkboxValue)}
Expand Down
8 changes: 7 additions & 1 deletion src/components/checkboxinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,23 @@
isSwitch,
dataComponentAttribute = ['Checkbox'],
} = options;
const { env, useText } = B;
const { env, generateUUID, useText } = B;
const isDev = env === 'dev';

function boolify(textValue) {
if (typeof textValue === 'boolean') {
return textValue;
}
if (typeof textValue === 'undefined') {
return undefined;
}
return ['on', 'true', 'yes'].includes(textValue.trim().toLowerCase());
}

const [errorState, setErrorState] = useState(false);
const [helper, setHelper] = useState(useText(helperText));
const mounted = useRef(false);
const { current: labelControlRef } = useRef(generateUUID());
const parsedLabel = useText(label);
const labelText = parsedLabel;
const resolvedValue = useText(value);
Expand Down Expand Up @@ -105,6 +109,7 @@
}, [isDev, helperTextResolved, resolvedValue]);

const props = {
id: labelControlRef,
checked,
required,
onInvalid: invalidHandler,
Expand Down Expand Up @@ -143,6 +148,7 @@
classes={{ root: classes.formControl }}
>
<FormControlLabel
htmlFor={labelControlRef}
control={isSwitch ? SwitchComponent : Checkbox}
label={ControlLabel}
labelPlacement={position}
Expand Down
4 changes: 3 additions & 1 deletion src/components/dateTimePickerInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
dataComponentAttribute = ['DateTimePicker'],
floatLabel,
} = options;
const { env, useText, Icon } = B;
const { env, useText, Icon, generateUUID } = B;
const {
MuiPickersUtilsProvider,
KeyboardTimePicker,
Expand All @@ -54,6 +54,7 @@
const placeholderText = useText(placeholder);
const dataComponentAttributeValue = useText(dataComponentAttribute);
const clearable = true;
const { current: labelControlRef } = useRef(generateUUID());

const localeMap = {
nl: nlLocale,
Expand Down Expand Up @@ -218,6 +219,7 @@

const DateTimeCmp = (
<DateTimeComponent
id={labelControlRef}
error={errorState}
value={selectedDate}
size={size}
Expand Down
13 changes: 11 additions & 2 deletions src/components/fileUploadInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
allowedTypes: ['CONTENT_COMPONENT'],
orientation: 'HORIZONTAL',
jsx: (() => {
const { env, useText, Icon, usePresignedUpload, useProperty } = B;
const {
Icon,
env,
generateUUID,
usePresignedUpload,
useProperty,
useText,
} = B;
const { FormControl, FormHelperText, Typography, IconButton } =
window.MaterialUI.Core;
const {
Expand Down Expand Up @@ -34,6 +41,7 @@
const acceptedValue = useText(accept) || 'image/*';
const dataComponentAttributeValue = useText(dataComponentAttribute);
const requiredText = required ? '*' : '';
const { current: labelControlRef } = useRef(generateUUID());

const getPropertyId = (property) => {
if (typeof property === 'string') {
Expand Down Expand Up @@ -179,6 +187,7 @@
>
{children}
<input
id={labelControlRef}
accept={acceptedValue}
className={classes.input}
type="file"
Expand Down Expand Up @@ -296,7 +305,7 @@
margin={margin}
className={includeStyling()}
>
<Label className={classes.label}>
<Label htmlFor={labelControlRef} className={classes.label}>
{hideLabel ? '' : `${labelText} ${requiredText}`}
<UploadComponent />
</Label>
Expand Down
3 changes: 3 additions & 0 deletions src/components/multiAutoCompleteInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
InteractionScope,
ModelProvider,
env,
generateUUID,
getIdProperty,
getModel,
getProperty,
Expand Down Expand Up @@ -88,6 +89,7 @@
const [helper, setHelper] = useState(useText(helperTextRaw));
const [errorState, setErrorState] = useState(false);
const changeContext = useRef(null);
const { current: labelControlRef } = useRef(generateUUID());
const dataComponentAttribute =
useText(dataComponentAttributeRaw) || 'AutoComplete';

Expand Down Expand Up @@ -763,6 +765,7 @@
error={errorState}
>
<Autocomplete
id={labelControlRef}
disableCloseOnSelect={!closeOnSelect}
className={includeStyling()}
disabled={disabled}
Expand Down
37 changes: 27 additions & 10 deletions src/components/radioinput.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@
validationValueMissing = [''],
value: prefabValue,
} = options;
const { env, getProperty, useText, useAllQuery, useRelation } = B;
const {
env,
generateUUID,
getProperty,
useAllQuery,
useRelation,
useText,
} = B;
const {
FormControl: MUIFormControl,
FormControlLabel: MUIFormControlLabel,
Expand Down Expand Up @@ -276,15 +283,25 @@
}

// renders the radio component
const renderRadio = (optionValue, optionLabel) => (
<MUIFormControlLabel
disabled={disabled}
value={optionValue}
control={<Radio tabIndex={isDev ? -1 : undefined} size={size} />}
label={optionLabel}
labelPlacement={labelPosition}
/>
);
const renderRadio = (optionValue, optionLabel) => {
const labelControlRef = generateUUID();
return (
<MUIFormControlLabel
for={labelControlRef}
disabled={disabled}
value={optionValue}
control={
<Radio
id={labelControlRef}
tabIndex={isDev ? -1 : undefined}
size={size}
/>
}
label={optionLabel}
labelPlacement={labelPosition}
/>
);
};

const renderRadios = () => {
if (!valid) {
Expand Down
6 changes: 4 additions & 2 deletions src/components/ratingInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
const { FormControl, FormHelperText, InputLabel, FormGroup } =
window.MaterialUI.Core;
const { Rating } = window.MaterialUI.Lab;
const { env, useText, Icon } = B;
const { env, generateUUID, useText, Icon } = B;
const isDev = env === 'dev';

const {
Expand All @@ -30,6 +30,7 @@
} = options;

const labelText = useText(label);
const { current: labelControlRef } = useRef(generateUUID());

const [currentValue, setCurrentValue] = usePageState(
useText(defaultValue, { rawValue: true }),
Expand Down Expand Up @@ -103,7 +104,7 @@
error={errorState}
>
{labelText && !hideLabel && (
<InputLabel classes={{ root: classes.label }}>
<InputLabel for={labelControlRef} classes={{ root: classes.label }}>
{labelText}
</InputLabel>
)}
Expand All @@ -127,6 +128,7 @@
</FormHelperText>
)}
<input
id={labelControlRef}
className={classes.validationInput}
onInvalid={validationHandler}
type="text"
Expand Down
17 changes: 12 additions & 5 deletions src/components/richTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@
FirstPage,
};
const allIcons = { ...Icons, ...extraIcons };
const { FormHelperText, SvgIcon } = window.MaterialUI.Core;
const { useText, env } = B;
const { FormHelperText, InputLabel, SvgIcon } = window.MaterialUI.Core;
const { generateUUID, useText, env } = B;
const {
actionVariableId: name,
value: valueProp,
Expand Down Expand Up @@ -122,6 +122,7 @@
const [activeStyleName, setActiveStyleName] = useState('Body 1');
const placeholderText = useText(placeholder);
const helperTextResolved = useText(helperText);
const { current: labelControlRef } = useRef(generateUUID());

useEffect(() => {
setCurrentValue(optionValue);
Expand Down Expand Up @@ -924,11 +925,12 @@
data-component={useText(dataComponentAttribute) || 'RichTextEditor'}
>
{labelText && !hideLabel && (
<FormHelperText
<InputLabel
htmlFor={labelControlRef}
className={`${classes.label} ${floatLabel && classes.floatLabel}`}
>
{labelText}
</FormHelperText>
</InputLabel>
)}
<div className={classes.editorWrapper}>
<Slate
Expand Down Expand Up @@ -1013,7 +1015,12 @@
}}
/>
</Slate>
<input type="hidden" name={name} value={currentValue} />
<input
id={labelControlRef}
type="hidden"
name={name}
value={currentValue}
/>
</div>
{helperTextResolved && (
<FormHelperText classes={{ root: classes.helper }}>
Expand Down
12 changes: 11 additions & 1 deletion src/components/selectInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@
value: prefabValue,
variant,
} = options;
const { env, getProperty, useText, useAllQuery, useRelation } = B;
const {
env,
generateUUID,
getProperty,
useAllQuery,
useRelation,
useText,
} = B;
const { TextField, MenuItem } = window.MaterialUI.Core;
const isDev = env === 'dev';
const [errorState, setErrorState] = useState(false);
Expand All @@ -38,6 +45,7 @@
const [interactionFilter, setInteractionFilter] = useState({});
const [disabled, setIsDisabled] = useState(initialIsDisabled);
const mounted = useRef(false);
const { current: labelControlRef } = useRef(generateUUID());
const modelProperty = getProperty(property || '') || {};
const labelText = useText(label);
const clearLabelText = useText(clearLabel);
Expand Down Expand Up @@ -332,6 +340,7 @@
<>
<TextField
id={actionVariableId}
InputLabelProps={{ htmlFor: labelControlRef }}
select={!disabled}
defaultValue={isDev ? placeholderLabelText : currentValue}
value={isDev ? placeholderLabelText : currentValue}
Expand All @@ -348,6 +357,7 @@
onChange={handleChange}
onBlur={validationHandler}
inputProps={{
id: labelControlRef,
tabIndex: isDev ? -1 : 0,
'data-component': dataComponentAttributeValue,
}}
Expand Down
Loading

0 comments on commit 34717cd

Please sign in to comment.