Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UISACQCOMP-243 Add labelless prop to FieldTags component to hide label #850

Merged
merged 8 commits into from
Feb 5, 2025
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Move reusable version history hook useVersionHistoryValueResolvers to the ACQ lib. Refs UISACQCOMP-235.
* Move reusable claiming code from `ui-receiving` to the shared library. Refs UISACQCOMP-236.
* Support `CLAIMS` export type in the `useIntegrationConfigs` hook. Refs UISACQCOMP-238.
* Add `labelless`, `fullWidth`, `marginBottom0` props to `FieldTags` component. Refs UISACQCOMP-243.

## [6.0.4](https://github.com/folio-org/stripes-acq-components/tree/v6.0.4) (2025-01-21)
[Full Changelog](https://github.com/folio-org/stripes-acq-components/compare/v6.0.3...v6.0.4)
Expand Down
11 changes: 11 additions & 0 deletions lib/FieldTags/FieldTagsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@

const FieldTagsContainer = ({
formValues,
fullWidth,
labelless = false,
marginBottom0,
mutator,
name,
resources,
...props
}) => {
const allTags = get(resources, ['tags', 'records'], []);
const tagSettings = get(resources, ['configTags', 'records'], []);
Expand All @@ -29,7 +33,7 @@
description: tag,
})
),
[],

Check warning on line 36 in lib/FieldTags/FieldTagsContainer.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

React Hook useCallback has a missing dependency: 'mutator.tags'. Either include it or remove the dependency array

Check warning on line 36 in lib/FieldTags/FieldTagsContainer.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

React Hook useCallback has a missing dependency: 'mutator.tags'. Either include it or remove the dependency array
);

if (!tagsEnabled) return null;
Expand All @@ -38,8 +42,12 @@
<FieldTagsFinal
allTags={allTags}
formValues={formValues}
fullWidth={fullWidth}
labelless={labelless}
marginBottom0={marginBottom0}
name={name}
onAdd={onAdd}
{...props}
/>
);
};
Expand All @@ -51,6 +59,9 @@

FieldTagsContainer.propTypes = {
formValues: PropTypes.object,
fullWidth: PropTypes.bool,
labelless: PropTypes.bool,
marginBottom0: PropTypes.bool,
mutator: PropTypes.object.isRequired,
name: PropTypes.string.isRequired,
resources: PropTypes.object.isRequired,
Expand Down
12 changes: 11 additions & 1 deletion lib/FieldTags/FieldTagsFinal.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@
const FieldTagsFinal = ({
allTags,
formValues,
fullWidth,
labelless = false,
marginBottom0,
name,
onAdd,
...props
}) => {
const { change } = useForm();
const addTag = useCallback(
Expand All @@ -40,7 +44,7 @@
onAdd(tag);
}
},
[name, onAdd],

Check warning on line 47 in lib/FieldTags/FieldTagsFinal.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

React Hook useCallback has missing dependencies: 'change' and 'formValues'. Either include them or remove the dependency array

Check warning on line 47 in lib/FieldTags/FieldTagsFinal.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

React Hook useCallback has missing dependencies: 'change' and 'formValues'. Either include them or remove the dependency array
);

const addAction = useMemo(() => ({ onSelect: addTag, render: renderTag }), [addTag]);
Expand All @@ -63,17 +67,23 @@
emptyMessage=" "
filter={filterArrayValues}
formatter={formatter}
fullWidth={fullWidth}
itemToString={itemToString}
label={label}
label={!labelless && label}
marginBottom0={marginBottom0}
name={name}
validateFields={[]}
{...props}
/>
);
};

FieldTagsFinal.propTypes = {
allTags: PropTypes.arrayOf(PropTypes.object),
formValues: PropTypes.object,
fullWidth: PropTypes.bool,
labelless: PropTypes.bool,
marginBottom0: PropTypes.bool,
name: PropTypes.string.isRequired,
onAdd: PropTypes.func.isRequired,
};
Expand Down
5 changes: 4 additions & 1 deletion lib/FileUploader/FileUploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ const FileUploader = ({ onSelectFile }) => {
({ getRootProps, getInputProps, open }) => (
<div {...getRootProps(defaultRootProps)}>
<div className={css.fileUploader}>
<input {...getInputProps()} />
<input
data-testid="file-uploader-input"
{...getInputProps()}
/>

<div className={css.fileUploaderTitle}>
<FormattedMessage id="stripes-acq-components.fileUploader.dropFile" />
Expand Down
Loading