Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeldking committed May 17, 2024
1 parent 6912793 commit d2ca83a
Show file tree
Hide file tree
Showing 4 changed files with 1,796 additions and 2,485 deletions.
17 changes: 8 additions & 9 deletions src/combobox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ import { TextFieldBase } from '../textfield';
import { ProgressCircle } from '../progress';
import { Popover } from '../popover';
import { useProviderProps } from '../provider';
import { AriaButtonProps } from '../types';
import { ACComboBoxProps } from '../types';
import { AriaButtonProps, ACComboBoxProps } from '../types';
import { ArrowIosDownwardOutline, Icon } from '../icon';

function ComboBox<T extends object>(
Expand Down Expand Up @@ -72,7 +71,7 @@ const ComboBoxBase = React.forwardRef(function ComboBoxBase<T extends object>(
let listBoxRef = useRef(null);
let inputRef = useRef<HTMLInputElement>(null);
// serve as the new popover `triggerRef` instead of `unwrappedButtonRef` before for better positioning.
let inputGroupRef = useRef<HTMLDivElement>();
let inputGroupRef = useRef<HTMLDivElement>(null);
let domRef = useFocusableRef(ref, inputRef);

let { contains } = useFilter({ sensitivity: 'base' });
Expand Down Expand Up @@ -239,10 +238,10 @@ const ComboBoxInput = React.forwardRef(function ComboBoxInput(
aria-label={'loading'}
size="S"
isIndeterminate
className={classNames(
'spectrum-Textfield-circleLoader',
'ac-input-group-input-circle-loader'
)}
// className={classNames(
// 'spectrum-Textfield-circleLoader',
// 'ac-input-group-input-circle-loader'
// )}
/>
);

Expand Down Expand Up @@ -308,7 +307,7 @@ const ComboBoxInput = React.forwardRef(function ComboBoxInput(
<TextFieldBase
inputProps={inputProps}
inputRef={inputRef}
UNSAFE_className={classNames('ac-input-group-field')}
className={classNames('ac-input-group-field')}
inputClassName={classNames('ac-input-group-input')}
validationIconClassName={classNames(
'ac-input-group-input-validationIcon'
Expand All @@ -322,7 +321,7 @@ const ComboBoxInput = React.forwardRef(function ComboBoxInput(
showLoading &&
(isOpen || menuTrigger === 'manual' || loadingState === 'loading')
}
loadingIndicator={loadingState != null && loadingCircle}
// loadingIndicator={loadingState != null && loadingCircle}
disableFocusRing
/>
<PressResponder preventFocusOnPress isPressed={isOpen}>
Expand Down
8 changes: 6 additions & 2 deletions src/progress/ProgressCircle.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { clamp } from '@react-aria/utils';
import { AriaLabelingProps, DOMRef } from '@react-types/shared';
import React, { CSSProperties } from 'react';
import { useProgressBar } from '@react-aria/progress';
import { classNames, useDOMRef } from '../utils';
import { DOMProps, ProgressBaseProps } from '../types';
import {
DOMProps,
ProgressBaseProps,
AriaLabelingProps,
DOMRef,
} from '../types';
import { progressCircleCSS } from './styles';

interface AriaProgressCircleProps extends DOMProps, AriaLabelingProps {}
Expand Down
36 changes: 16 additions & 20 deletions src/textfield/TextFieldBase.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { css, keyframes } from '@emotion/react';
import { FocusRing } from '@react-aria/focus';
import { useFocusRing } from '@react-aria/focus';
import { mergeProps } from '@react-aria/utils';
import { PressEvents } from '@react-types/shared';
import React, {
Expand Down Expand Up @@ -110,6 +110,7 @@ interface TextFieldBaseProps
className?: string;
/** Whether the input should be displayed with a quiet style. */
isQuiet?: boolean;
disableFocusRing?: boolean;
}

const textFieldBaseCSS = (styleProps: StyleProps) => css`
Expand Down Expand Up @@ -302,6 +303,7 @@ function TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef>) {
className,
height,
width,
disableFocusRing,
} = props;
const { hoverProps, isHovered } = useHover({ isDisabled });
const [isFocused, setIsFocused] = React.useState(false);
Expand Down Expand Up @@ -334,6 +336,11 @@ function TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef>) {
/>
);

let { focusProps, isFocusVisible } = useFocusRing({
isTextInput: true,
autoFocus,
});

let textField = (
<div
className={classNames('ac-textfield', {
Expand All @@ -344,7 +351,7 @@ function TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef>) {
'ac-textfield--loadable': loadingIndicator,
'ac-textfield--multiline': multiLine,
'is-hovered': isHovered,
'is-focused': isFocused,
'is-focused': !disableFocusRing && isFocusVisible,
'is-disabled': isDisabled,
'is-readonly': isReadOnly,
})}
Expand All @@ -356,24 +363,13 @@ function TextFieldBase(props: TextFieldBaseProps, ref: Ref<TextFieldRef>) {
{addonBefore != null ? (
<AddonBefore key="addon-before">{addonBefore}</AddonBefore>
) : null}
<FocusRing
focusRingClass={'focus-ring'}
isTextInput
autoFocus={autoFocus}
>
<ElementType
key="element"
{...mergeProps(inputProps, hoverProps, {
onFocus: () => {
setIsFocused(true);
},
onBlur: () => setIsFocused(false),
})}
ref={inputRef as any}
rows={multiLine ? 1 : undefined}
className={classNames('ac-textfield__input', inputClassName)}
/>
</FocusRing>
<ElementType
key="element"
{...mergeProps(inputProps, hoverProps, focusProps)}
ref={inputRef as any}
rows={multiLine ? 1 : undefined}
className={classNames('ac-textfield__input', inputClassName)}
/>
{validationState && validationState === 'invalid' && !isLoading
? validation
: null}
Expand Down
Loading

0 comments on commit d2ca83a

Please sign in to comment.