@digital-ai/dot-components 4.20.1 → 4.20.3

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/index.esm.js CHANGED
@@ -7035,6 +7035,9 @@ const getTextFieldRootClassNames = (textFieldWarningClassName, isReadOnly) => us
7035
7035
  const getInputRootClassNames = isDense => useStylesWithRootClass(inputRootClassName, !isDense && inputMediumClassName);
7036
7036
  const getDefaultAutoCompleteValue = (hasMultiple, defaultValue) => hasMultiple && isString$2(defaultValue) ? [defaultValue] : defaultValue;
7037
7037
  const getAutoCompleteGroupBy = group => group ? option => option.group : undefined;
7038
+ const isTitleEqual = (option, value) => {
7039
+ return typeof value === 'string' ? option.title === value : option.title === (value === null || value === void 0 ? void 0 : value.title);
7040
+ };
7038
7041
 
7039
7042
  function ariaLabelOrAlternates(ariaLabel, label, placeholder) {
7040
7043
  return ariaLabel || label || placeholder;
@@ -7067,7 +7070,7 @@ const DotAutoComplete = ({
7067
7070
  inputId,
7068
7071
  inputRef,
7069
7072
  inputValue,
7070
- isOptionEqualToValue,
7073
+ isOptionEqualToValue = isTitleEqual,
7071
7074
  label,
7072
7075
  loading,
7073
7076
  maxHeight,
@@ -8994,6 +8997,7 @@ const Grid = ({
8994
8997
  return jsxs("div", {
8995
8998
  className: rootClasses,
8996
8999
  children: [children, isLoading && jsx(DotProgress, {
9000
+ ariaLabel: "Loading more data",
8997
9001
  className: "loading-more-data",
8998
9002
  color: "inherit",
8999
9003
  size: 20
@@ -10834,7 +10838,7 @@ const DotMetadataApiProvider = ({
10834
10838
  return null;
10835
10839
  });
10836
10840
  } else {
10837
- return cancelablePromise(DashboardsService.unfavoriteDashboard(dashboardId)).then(response => {
10841
+ return cancelablePromise(DashboardsService.unfavoriteDashboard(dashboardId, accountId)).then(response => {
10838
10842
  setDashboardsError(null);
10839
10843
  setDashboards(orig => handleUpdateDashboard(orig, response));
10840
10844
  return response;
@@ -11782,6 +11786,7 @@ function DotDashboardDialog({
11782
11786
  onContinue,
11783
11787
  title
11784
11788
  }) {
11789
+ var _a;
11785
11790
  const [isDirty, setIsDirty] = useState(false);
11786
11791
  const [isLoadingSubmit, setIsLoadingSubmit] = useState(false);
11787
11792
  const [nameError, setNameError] = useState(null);
@@ -11858,13 +11863,19 @@ function DotDashboardDialog({
11858
11863
  const useFormValues = Object.assign(Object.assign({}, formValues), {
11859
11864
  id: (editDashboard === null || editDashboard === void 0 ? void 0 : editDashboard.parent_id) ? editDashboard === null || editDashboard === void 0 ? void 0 : editDashboard.parent_id : editDashboard === null || editDashboard === void 0 ? void 0 : editDashboard.id
11860
11865
  });
11861
- const validName = yield validateName(useFormValues.name);
11862
- // If we fail name validation, set the nameError and don't call the submit function because it will fail.
11863
- if (validName) {
11864
- yield onSubmit(useFormValues, isDone);
11865
- }
11866
- isSubmittingRef.current = false;
11867
- setIsLoadingSubmit(false);
11866
+ yield cancelablePromise(validateName(useFormValues.name)).then(validName => {
11867
+ // If we fail name validation, set the nameError and don't call
11868
+ // the submit function because it will fail.
11869
+ if (validName) {
11870
+ cancelablePromise(onSubmit(useFormValues, isDone)).then(() => {
11871
+ isSubmittingRef.current = false;
11872
+ setIsLoadingSubmit(false);
11873
+ });
11874
+ } else {
11875
+ isSubmittingRef.current = false;
11876
+ setIsLoadingSubmit(false);
11877
+ }
11878
+ });
11868
11879
  }), [formValues, editDashboard, validateName]);
11869
11880
  const handleMouseDown = () => {
11870
11881
  isSubmittingRef.current = true;
@@ -11904,11 +11915,9 @@ function DotDashboardDialog({
11904
11915
  const availableCategoryOptions = [];
11905
11916
  if (availableCategories) {
11906
11917
  availableCategories.forEach(category => {
11907
- if (!categories.includes(category)) {
11908
- availableCategoryOptions.push({
11909
- title: category
11910
- });
11911
- }
11918
+ availableCategoryOptions.push({
11919
+ title: category
11920
+ });
11912
11921
  });
11913
11922
  }
11914
11923
  return availableCategoryOptions;
@@ -11953,7 +11962,7 @@ function DotDashboardDialog({
11953
11962
  }, message)), jsx(DotInputText, {
11954
11963
  autoFocus: true,
11955
11964
  "data-testid": "dashboard-dialog-name-input",
11956
- error: nameError || name.length > DASHBOARD_NAME_MAX_LENGTH,
11965
+ error: !!nameError || name.length > DASHBOARD_NAME_MAX_LENGTH,
11957
11966
  helperText: nameError || name.length > DASHBOARD_NAME_MAX_LENGTH && `Name must be ${DASHBOARD_NAME_MAX_LENGTH} characters or less`,
11958
11967
  id: "name",
11959
11968
  label: "Dashboard name",
@@ -11987,7 +11996,7 @@ function DotDashboardDialog({
11987
11996
  "data-testid": "dashboard-dialog-apptype-input",
11988
11997
  name: "Select application",
11989
11998
  disabled: isDisabled('apptype'),
11990
- value: editDashboard.target_apps[0]
11999
+ value: ((_a = editDashboard.target_apps) === null || _a === void 0 ? void 0 : _a.length) > 0 ? editDashboard.target_apps[0] : undefined
11991
12000
  })]
11992
12001
  }), jsx(DotTypography, {
11993
12002
  variant: "h3",
@@ -12751,8 +12760,7 @@ function DotDashboardOptionsMenu({
12751
12760
  return updateDashboard(dashboard, {
12752
12761
  name: data.name,
12753
12762
  description: data.description,
12754
- categories: data.categories,
12755
- target_apps: data.target_apps
12763
+ categories: data.categories
12756
12764
  }).then(result => {
12757
12765
  if (result && 'id' in result) {
12758
12766
  setIsEditPropertiesDialogOpen(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "4.20.1",
3
+ "version": "4.20.3",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -17,3 +17,4 @@ export declare const getTextFieldRootClassNames: (textFieldWarningClassName: str
17
17
  export declare const getInputRootClassNames: (isDense: boolean) => string;
18
18
  export declare const getDefaultAutoCompleteValue: (hasMultiple: boolean, defaultValue: AutoCompleteValue) => string | AutoCompleteOption | AutoCompleteValue[];
19
19
  export declare const getAutoCompleteGroupBy: (group: boolean) => (option: AutoCompleteOption) => string;
20
+ export declare const isTitleEqual: (option: AutoCompleteOption, value: AutoCompleteOption | string) => boolean;