@abgov/jsonforms-components 1.9.0 → 1.10.0

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.
Files changed (2) hide show
  1. package/index.esm.js +17 -23
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -7,8 +7,6 @@ import { withJsonFormsRendererProps, withJsonFormsControlProps, withJsonFormsEnu
7
7
  import React, { createContext, useEffect, useState, useMemo, useContext, useCallback } from 'react';
8
8
  import merge from 'lodash/merge';
9
9
  import axios from 'axios';
10
- import TextField from '@mui/material/TextField';
11
- import Autocomplete from '@mui/material/Autocomplete';
12
10
  import isEmpty from 'lodash/isEmpty';
13
11
  import range from 'lodash/range';
14
12
  import Ajv from 'ajv';
@@ -3415,7 +3413,8 @@ const EnumSelectAutoComplete = props => {
3415
3413
  schema,
3416
3414
  path,
3417
3415
  handleChange,
3418
- uischema
3416
+ uischema,
3417
+ label
3419
3418
  } = props;
3420
3419
  let enumData = (schema === null || schema === void 0 ? void 0 : schema.enum) || [];
3421
3420
  const dataKey = (_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.enumContext) === null || _b === void 0 ? void 0 : _b.key;
@@ -3423,11 +3422,6 @@ const EnumSelectAutoComplete = props => {
3423
3422
  const location = (_f = (_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.enumContext) === null || _f === void 0 ? void 0 : _f.location;
3424
3423
  const type = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.enumContext) === null || _h === void 0 ? void 0 : _h.type;
3425
3424
  const values = (_k = (_j = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _j === void 0 ? void 0 : _j.enumContext) === null || _k === void 0 ? void 0 : _k.values;
3426
- const defaultProps = {
3427
- options: enumData,
3428
- getOptionLabel: option => option
3429
- };
3430
- const [inputValue, setInputValue] = React.useState('');
3431
3425
  useEffect(() => {
3432
3426
  if (dataKey && url) {
3433
3427
  addDataByOptions(dataKey, url, location, type, values);
@@ -3437,25 +3431,25 @@ const EnumSelectAutoComplete = props => {
3437
3431
  const newData = getData(dataKey);
3438
3432
  // eslint-disable-next-line
3439
3433
  enumData = newData;
3440
- defaultProps.options = enumData;
3441
3434
  }
3442
- return jsx(Autocomplete, Object.assign({}, defaultProps, {
3443
- id: "autocomplete",
3444
- getOptionLabel: option => option,
3445
- isOptionEqualToValue: (option, value) => option.id === value.id,
3446
- value: data || null,
3435
+ return jsx(GoADropdown, {
3436
+ value: data,
3447
3437
  onChange: (name, value) => {
3448
3438
  handleChange(path, value);
3449
- setInputValue(value);
3450
3439
  },
3451
- renderInput: params => {
3452
- return jsx(TextField, Object.assign({}, params, {
3453
- variant: "outlined",
3454
- size: "small",
3455
- placeholder: schema === null || schema === void 0 ? void 0 : schema.description
3456
- }));
3457
- }
3458
- }));
3440
+ testId: `autocomplete-dropdown-${label}`,
3441
+ id: `autocomplete-dropdown-${label}`,
3442
+ width: "100%",
3443
+ filterable: true,
3444
+ relative: true,
3445
+ ariaLabel: label,
3446
+ children: enumData === null || enumData === void 0 ? void 0 : enumData.map(item => {
3447
+ return jsx(GoADropdownItem, {
3448
+ value: item,
3449
+ label: item
3450
+ }, `autocomplete-${item}`);
3451
+ })
3452
+ });
3459
3453
  };
3460
3454
  const numControlAutoComplete = props => {
3461
3455
  return jsx(GoAInputBaseControl, Object.assign({}, props, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",