Skip to content

Commit

Permalink
Fix #4858: AutoComplete add required property (#4871)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Sep 3, 2023
1 parent 866fa2a commit 8fc1f20
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions components/lib/autocomplete/AutoComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ export const AutoComplete = React.memo(
style={props.inputStyle}
autoComplete="off"
readOnly={props.readOnly}
required={props.required}
disabled={props.disabled}
placeholder={props.placeholder}
size={props.size}
Expand Down Expand Up @@ -621,6 +622,7 @@ export const AutoComplete = React.memo(
onKeyUp: props.onKeyUp,
placeholder: allowMoreValues ? props.placeholder : undefined,
readOnly: props.readOnly || !allowMoreValues,
required: props.required,
role: 'combobox',
style: props.inputStyle,
tabIndex: props.tabIndex,
Expand Down
9 changes: 7 additions & 2 deletions components/lib/autocomplete/autocomplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
*
*/
import * as React from 'react';
import { ButtonPassThroughOptions } from '../button/button';
import { CSSTransitionProps } from '../csstransition';
import { TooltipPassThroughOptions } from '../tooltip/tooltip';
import { TooltipOptions } from '../tooltip/tooltipoptions';
import { FormEvent } from '../ts-helpers';
import { IconType, PassThroughType } from '../utils';
import { VirtualScroller, VirtualScrollerPassThroughOptions, VirtualScrollerProps } from '../virtualscroller';
import { ButtonPassThroughOptions } from '../button/button';
import { TooltipPassThroughOptions } from '../tooltip/tooltip';

export declare type AutoCompletePassThroughType<T> = PassThroughType<T, AutoCompletePassThroughMethodOptions>;

Expand Down Expand Up @@ -360,6 +360,11 @@ export interface AutoCompleteProps extends Omit<React.DetailedHTMLProps<React.HT
* @defaultValue false
*/
readOnly?: boolean | undefined;
/**
* When present, it specifies that an input field must be filled out before submitting the form.
* @defaultValue false
*/
required?: boolean | undefined;
/**
* Icon of the remove chip element in multiple mode.
*/
Expand Down
2 changes: 0 additions & 2 deletions components/lib/passthrough/tailwind/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1888,8 +1888,6 @@ const Tailwind = {
className: classNames('outline-none', 'm-0 p-0 list-none')
},
menuitem: ({ context }) => {
console.log('context');

return {
className: classNames(
'text-gray-700 dark:text-white/80 transition-shadow duration-200 border-none rounded-none',
Expand Down

0 comments on commit 8fc1f20

Please sign in to comment.