@digital-ai/dot-components 4.24.0 → 4.25.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.
package/index.esm.js CHANGED
@@ -7267,10 +7267,14 @@ const DotAutoComplete = ({
7267
7267
  }
7268
7268
  });
7269
7269
  // Create handler only if 'onInputChange' or 'actionItem' prop is defined
7270
- const handleInputChange = (onInputChange || isActionItemDefined) && ((event, currentInputValue, reason) => {
7271
- isActionItemDefined && setInputText(currentInputValue);
7270
+ // Custom input change handler for AI mode
7271
+ const handleInputChange = (event, currentInputValue, reason) => {
7272
+ if (isActionItemDefined || ai) {
7273
+ setInputText(currentInputValue); // fallback for action item
7274
+ }
7275
+
7272
7276
  onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(event, currentInputValue, reason);
7273
- }) || undefined;
7277
+ };
7274
7278
  // Create callback when action item click event handler is defined,
7275
7279
  // free-solo mode is NOT set and 'Enter' key has been pressed
7276
7280
  const handleKeyDown = allowActionButtonClick && (event => {
@@ -7317,29 +7321,27 @@ const DotAutoComplete = ({
7317
7321
  }), getInputAdornment(), nativeEndAdornment]
7318
7322
  });
7319
7323
  };
7320
- const renderAISendAdornment = params => {
7321
- const {
7322
- inputProps
7323
- } = params;
7324
- return jsxs(Fragment, {
7325
- children: [jsx(DotIconButton, {
7326
- iconId: "send-airplane",
7327
- tooltip: "Send",
7328
- "data-testid": dataTestId && `${dataTestId}-send-airplane-icon`,
7329
- shape: "square",
7330
- color: "ai",
7331
- disabled: !(inputProps === null || inputProps === void 0 ? void 0 : inputProps.value),
7332
- onClick: () => {
7333
- if (inputProps === null || inputProps === void 0 ? void 0 : inputProps.value) {
7334
- handleAiAction(inputProps.value.toString());
7335
- }
7324
+ const renderAISendAdornment = useMemo(() => {
7325
+ return jsx(DotIconButton, {
7326
+ iconId: "send-airplane",
7327
+ tooltip: "Send",
7328
+ "data-testid": dataTestId && `${dataTestId}-send-airplane-icon`,
7329
+ shape: "square",
7330
+ color: "ai",
7331
+ disabled: !inputText,
7332
+ onClick: () => {
7333
+ if (inputText) {
7334
+ handleAiAction(inputText);
7335
+ setInputText('');
7336
+ onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange({
7337
+ target: {
7338
+ value: ''
7339
+ }
7340
+ }, '', 'clear');
7336
7341
  }
7337
- }), jsx("span", {
7338
- className: "ai-text-clear-icon",
7339
- children: params.InputProps.endAdornment
7340
- })]
7342
+ }
7341
7343
  });
7342
- };
7344
+ }, [inputText]);
7343
7345
  const renderTrimmedLongOptions = (props, option) => {
7344
7346
  const key = 'id' in option ? option.id : option.title;
7345
7347
  return jsx(DotTooltip, {
@@ -7360,7 +7362,7 @@ const DotAutoComplete = ({
7360
7362
  };
7361
7363
  const getEndAdornment = params => {
7362
7364
  if (ai) {
7363
- return renderAISendAdornment(params);
7365
+ return renderAISendAdornment;
7364
7366
  }
7365
7367
  if (!readOnly) {
7366
7368
  return renderEndAdornment(params.InputProps.endAdornment);
@@ -7448,7 +7450,8 @@ const DotAutoComplete = ({
7448
7450
  'data-testid': dataTestId && `${dataTestId}-input`,
7449
7451
  id: inputId,
7450
7452
  className: useStylesWithRootClass(inputProps.className, 'dot-input'),
7451
- readOnly
7453
+ readOnly,
7454
+ value: ai ? inputText : inputProps.value
7452
7455
  }),
7453
7456
  InputLabelProps: {
7454
7457
  htmlFor: inputId
@@ -7469,8 +7472,9 @@ const DotAutoComplete = ({
7469
7472
  if (event.key === 'Enter' && ai) {
7470
7473
  event.stopPropagation();
7471
7474
  event.preventDefault();
7472
- const text = event.target.value;
7473
- handleAiAction(text);
7475
+ handleAiAction(inputText);
7476
+ setInputText(''); // Clear input after enter
7477
+ onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(event, '', 'clear');
7474
7478
  }
7475
7479
  },
7476
7480
  placeholder: showPlaceholder ? placeholder : undefined,
@@ -13836,7 +13840,9 @@ const StyledDatePicker = styled(DatePicker)`
13836
13840
  }
13837
13841
 
13838
13842
  .dot-icon-btn .dot-i {
13839
- margin-top: -5px;
13843
+ color: ${theme.palette.figma.typography.black};
13844
+ margin-top: -6px;
13845
+ margin-right: 6px;
13840
13846
  }
13841
13847
 
13842
13848
  .MuiFormLabel-root {
@@ -13947,7 +13953,9 @@ const StyledTimePicker = styled(TimePicker)`
13947
13953
  }
13948
13954
 
13949
13955
  .dot-icon-btn .dot-i {
13950
- margin-top: -5px;
13956
+ margin-top: -6px;
13957
+ margin-right: 6px;
13958
+ color: ${theme.palette.figma.typography.black};
13951
13959
  }
13952
13960
 
13953
13961
  .MuiFormLabel-root {
@@ -52595,7 +52603,8 @@ const DotDatePicker = ({
52595
52603
  children: [error && jsx(DotIcon, {
52596
52604
  className: "dot-error-icon",
52597
52605
  "data-testid": "dot-error-icon",
52598
- iconId: "error-solid"
52606
+ iconId: "error-solid",
52607
+ fontSize: "large"
52599
52608
  }), jsx(DotIconButton, {
52600
52609
  ariaLabel: "Open date picker",
52601
52610
  "data-pendoid": "date-picker-open-btn",
@@ -53002,7 +53011,8 @@ const DotTimePicker = ({
53002
53011
  children: [error && jsx(DotIcon, {
53003
53012
  className: "dot-error-icon",
53004
53013
  "data-testid": dataTestId && `${dataTestId}-input-error-icon`,
53005
- iconId: "error-solid"
53014
+ iconId: "error-solid",
53015
+ fontSize: "large"
53006
53016
  }), !disableOpenPicker && !isComponentReadOnly && !disabled && jsx(DotIconButton, {
53007
53017
  ariaLabel: "Open time picker",
53008
53018
  "data-pendoid": dataPendoId && `${dataPendoId}-open-btn`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-ai/dot-components",
3
- "version": "4.24.0",
3
+ "version": "4.25.1",
4
4
  "private": false,
5
5
  "license": "SEE LICENSE IN <LICENSE.md>",
6
6
  "contributors": [
@@ -80,6 +80,6 @@ export interface DatePickerProps extends CommonProps {
80
80
  */
81
81
  showDaysOutsideCurrentMonth?: boolean;
82
82
  /** The selected value. Used when the component is controlled. Date in ISO 8601 format, ie: YYYY-MM-DD */
83
- value?: string;
83
+ value?: string | null;
84
84
  }
85
85
  export declare const DotDatePicker: ({ ariaLabel, autoFocus, className, closeOnSelect, "data-pendoid": dataPendoId, "data-testid": dataTestId, defaultValue, disableOpenPicker, disablePast, disablePortal, disabled, displayWeekNumber, displayClearButton, error, fixedWeekNumber, focusInputOnPopperOpened, format, fullWidth, helperText, inputId, inputName, label, locale, maxDate, minDate, onAccept, onBlur, onChange, onClose, onError, onKeyDown, onOpen, open, persistentLabel, readOnly, required, showDaysOutsideCurrentMonth, value, informationToolTip, }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
@@ -55,7 +55,7 @@ export interface TimePickerProps extends CommonProps {
55
55
  /** If true, the label is displayed as required and the input element will be required. */
56
56
  required?: boolean;
57
57
  /** The selected value. Used when the component is controlled. Time in ISO 8601 format, ie: HH:mm */
58
- value?: string;
58
+ value?: string | null;
59
59
  }
60
60
  export declare const DEFAULT_PICKER_TIME_FORMAT = "HH:mm";
61
61
  export declare const DEFAULT_TIME_FORMAT = "HH:mm";