ab-ui-library 1.55.3 → 1.56.1

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.
@@ -1,3 +1,3 @@
1
1
  import type { TTableProps } from './types';
2
2
  import 'react-loading-skeleton/dist/skeleton.css';
3
- export declare function Table<TData>({ data, columns, isLoading, hasError, isActionsVisible, totalCount, emptyTitle, emptySubTitle, emptyIllustration, withSelect, withBorder, defaultPageIndex, defaultPageSize, defaultHiddenColumns, collapsibleRows, renderExpandedContent, renderHeader, renderFooter, onSortChange, onRowClick, tableSettings, onRowSelection, onColumnSizing, onPaginationChange, rowEventsProps, activeRowId, getRowId, resetExpandedOnPageChange, rowClassName, }: TTableProps<TData>): import("react/jsx-runtime").JSX.Element;
3
+ export declare function Table<TData>({ data, columns, isLoading, hasError, isActionsVisible, totalCount, emptyTitle, emptySubTitle, emptyButtonProps, emptyIllustration, withSelect, withBorder, defaultPageIndex, defaultPageSize, defaultHiddenColumns, collapsibleRows, renderExpandedContent, renderHeader, renderFooter, onSortChange, onRowClick, tableSettings, onRowSelection, onColumnSizing, onPaginationChange, rowEventsProps, activeRowId, getRowId, resetExpandedOnPageChange, rowClassName, }: TTableProps<TData>): import("react/jsx-runtime").JSX.Element;
@@ -88,6 +88,7 @@ function Table(_ref2) {
88
88
  totalCount = _ref2$totalCount === void 0 ? 0 : _ref2$totalCount,
89
89
  emptyTitle = _ref2.emptyTitle,
90
90
  emptySubTitle = _ref2.emptySubTitle,
91
+ emptyButtonProps = _ref2.emptyButtonProps,
91
92
  emptyIllustration = _ref2.emptyIllustration,
92
93
  _ref2$withSelect = _ref2.withSelect,
93
94
  withSelect = _ref2$withSelect === void 0 ? false : _ref2$withSelect,
@@ -232,7 +233,8 @@ function Table(_ref2) {
232
233
  }, !isLoading && (!(data !== null && data !== void 0 && data.length) || hasError) ? /*#__PURE__*/React.createElement(Empty, {
233
234
  mainMessage: emptyTitle,
234
235
  paragraphMessage: emptySubTitle,
235
- illustration: emptyIllustration
236
+ illustration: emptyIllustration,
237
+ buttonProps: emptyButtonProps
236
238
  }) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("thead", {
237
239
  className: "advanced-table__thead"
238
240
  }, table.getHeaderGroups().map(function (headerGroup) {
@@ -1,5 +1,6 @@
1
1
  import type { ColumnDef, ColumnSizingState, PaginationState, RowSelectionState, Table, Row } from '@tanstack/react-table';
2
2
  import type { HTMLAttributes, ReactNode } from 'react';
3
+ import type { TButtonPropTypes } from '../Button/types';
3
4
  export type TTable<TData> = Table<TData>;
4
5
  export type TRowSelectionState = RowSelectionState;
5
6
  export type TColumnSizingState = ColumnSizingState;
@@ -18,6 +19,7 @@ export type TTableProps<TData> = {
18
19
  hasError?: boolean;
19
20
  emptyTitle?: string;
20
21
  emptySubTitle?: string;
22
+ emptyButtonProps?: TButtonPropTypes;
21
23
  emptyIllustration?: string;
22
24
  className?: string;
23
25
  withSelect?: boolean;
@@ -72,7 +72,9 @@ var MultiTextareaWithChipsComponent = function MultiTextareaWithChipsComponent(_
72
72
  formProps = _ref.formProps,
73
73
  minChipLength = _ref.minChipLength,
74
74
  maxChipLength = _ref.maxChipLength,
75
- onBlurConfig = _ref.onBlurConfig;
75
+ onBlurConfig = _ref.onBlurConfig,
76
+ _ref$transformToUpper = _ref.transformToUppercase,
77
+ transformToUppercase = _ref$transformToUpper === void 0 ? false : _ref$transformToUpper;
76
78
  var _useState = useState(''),
77
79
  _useState2 = _slicedToArray(_useState, 2),
78
80
  inputValue = _useState2[0],
@@ -108,7 +110,8 @@ var MultiTextareaWithChipsComponent = function MultiTextareaWithChipsComponent(_
108
110
  var handleSelectOption = function handleSelectOption(option) {
109
111
  if (chipManagement.getChipTexts().includes(option)) return;
110
112
  try {
111
- var validatedChip = chipValidation.createValidatedChip(option);
113
+ var valueToValidate = transformToUppercase ? option.toUpperCase() : option;
114
+ var validatedChip = chipValidation.createValidatedChip(valueToValidate);
112
115
  chipManagement.addChip(validatedChip);
113
116
  setInputValue('');
114
117
  dropdownLogic.closeDropdown();
@@ -122,7 +125,8 @@ var MultiTextareaWithChipsComponent = function MultiTextareaWithChipsComponent(_
122
125
  var handleAddCustomValue = useCallback(function (value) {
123
126
  if (chipManagement.getChipTexts().includes(value)) return;
124
127
  try {
125
- var validatedChip = chipValidation.createValidatedChip(value);
128
+ var valueToValidate = transformToUppercase ? value.toUpperCase() : value;
129
+ var validatedChip = chipValidation.createValidatedChip(valueToValidate);
126
130
  chipManagement.addChip(validatedChip);
127
131
  setInputValue('');
128
132
  setChipError('');
@@ -131,7 +135,7 @@ var MultiTextareaWithChipsComponent = function MultiTextareaWithChipsComponent(_
131
135
  setChipError(error instanceof Error ? error.message : 'Invalid value');
132
136
  }
133
137
  }
134
- }, [chipManagement, chipValidation, allowInvalidChips]);
138
+ }, [chipManagement, chipValidation, allowInvalidChips, transformToUppercase]);
135
139
  var onBlurLogic = useOnBlurLogic({
136
140
  inputValue: inputValue,
137
141
  disabled: disabled,
@@ -154,6 +158,9 @@ var MultiTextareaWithChipsComponent = function MultiTextareaWithChipsComponent(_
154
158
  var handleInputChange = function handleInputChange(e) {
155
159
  if (disabled) return;
156
160
  var value = e.target.value;
161
+ if (transformToUppercase) {
162
+ value = value.toUpperCase();
163
+ }
157
164
  setInputValue(value);
158
165
  dropdownLogic.handleInputChange(value);
159
166
  };
@@ -244,7 +251,7 @@ var MultiTextareaWithChipsComponent = function MultiTextareaWithChipsComponent(_
244
251
  onFocus: handleInputFocus,
245
252
  onBlur: handleInputBlur,
246
253
  placeholder: inputPlaceholder,
247
- className: "multi-textarea-chips__input",
254
+ className: 'multi-textarea-chips__input',
248
255
  disabled: disabled,
249
256
  "aria-describedby": hasError ? "".concat(fieldName, "-error") : helperText ? "".concat(fieldName, "-helper") : undefined,
250
257
  "aria-invalid": hasError ? 'true' : 'false',
@@ -30,6 +30,7 @@ export interface TMultiTextareaWithChipsProps extends IFormCompProps {
30
30
  minChipLength?: number;
31
31
  maxChipLength?: number;
32
32
  searchPlaceholderText?: string;
33
+ transformToUppercase?: boolean;
33
34
  typeAndEnterPlaceholderText?: string;
34
35
  noOptionsPlaceholderText?: string;
35
36
  fieldName?: string;
@@ -247,6 +247,10 @@ var Select = function Select(props) {
247
247
  return onItemSelect(null);
248
248
  };
249
249
  var onOpenOptions = function onOpenOptions(e) {
250
+ var selected = getSelectedOption();
251
+ if (selected !== null && selected !== void 0 && selected.label && isCreateOnOutsideClick) {
252
+ setSearchValue("".concat(selected.label));
253
+ }
250
254
  var result = e === null || e === void 0 ? void 0 : e.target;
251
255
  var className = result === null || result === void 0 ? void 0 : result.getAttribute('class');
252
256
  if (e && className && (className.indexOf('icon-') !== -1 || className.indexOf('svg-icon') !== -1)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ab-ui-library",
3
- "version": "1.55.3",
3
+ "version": "1.56.1",
4
4
  "description": "UI library for AM",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",