Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/curly-trainers-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cube-dev/ui-kit": patch
---

Fix minor issues with input styling.
5 changes: 5 additions & 0 deletions .changeset/famous-items-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cube-dev/ui-kit": patch
---

Expose shouldFocusWrap for ListBox, FilterListBox, and FilterPicker to control whether keyboard navigation should wrap around.
2 changes: 1 addition & 1 deletion src/components/fields/ComboBox/ComboBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
}}
data-size={size}
>
{prefix ? <div data-element="Prefix">{prefix}</div> : null}
<InputElement
ref={inputRef}
qa="Input"
Expand All @@ -448,7 +449,6 @@ export const ComboBox = forwardRef(function ComboBox<T extends object>(
{...modAttrs(mods)}
data-size={size}
/>
{prefix ? <div data-element="Prefix">{prefix}</div> : null}
<div data-element="Suffix">
{suffixPosition === 'before' ? suffix : null}
{validationState || isLoading ? (
Expand Down
5 changes: 5 additions & 0 deletions src/components/fields/DatePicker/DateInputBase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ const DateInputElement = tasty({
role: 'presentation',
styles: {
...DEFAULT_INPUT_STYLES,
height: {
'': '(@size-md - 2bw)',
'[data-size="small"]': '(@size-sm - 2bw)',
'[data-size="large"]': '(@size-lg - 2bw)',
},
display: 'flex',
flow: 'row',
placeItems: 'center start',
Expand Down
7 changes: 7 additions & 0 deletions src/components/fields/FilterListBox/FilterListBox.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,13 @@ const meta: Meta<typeof FilterListBox> = {
defaultValue: { summary: false },
},
},
shouldFocusWrap: {
control: { type: 'boolean' },
description: 'Whether keyboard navigation should wrap around',
table: {
defaultValue: { summary: false },
},
},

/* State */
isLoading: {
Expand Down
25 changes: 14 additions & 11 deletions src/components/fields/FilterListBox/FilterListBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ const SearchInputElement = tasty({
...DEFAULT_INPUT_STYLES,
fill: '#clear',
padding: {
'': '.5x 1.5x',
prefix: '.5x 1.5x .5x .5x',
'': '0 1.5x',
prefix: '0 1.5x 0 .5x',
},
},
});
Expand Down Expand Up @@ -194,6 +194,7 @@ export const FilterListBox = forwardRef(function FilterListBox<
description,
styles,
focusOnHover,
shouldFocusWrap,
labelSuffix,
selectedKey,
defaultSelectedKey,
Expand Down Expand Up @@ -607,7 +608,7 @@ export const FilterListBox = forwardRef(function FilterListBox<
const newIndex = currentIndex + direction;
if (newIndex >= 0 && newIndex < visibleKeys.length) {
nextKey = visibleKeys[newIndex];
} else {
} else if (shouldFocusWrap) {
// Wrap around
nextKey = isArrowDown
? visibleKeys[0]
Expand Down Expand Up @@ -715,6 +716,7 @@ export const FilterListBox = forwardRef(function FilterListBox<
focused: isFocused,
loading: !!isLoading,
searchable: true,
prefix: !!isLoading,
...externalMods,
}),
[
Expand Down Expand Up @@ -784,7 +786,14 @@ export const FilterListBox = forwardRef(function FilterListBox<
};

const searchInput = (
<SearchWrapperElement mods={mods} data-size="small">
<SearchWrapperElement mods={mods} data-size={size}>
{isLoading && (
<div data-element="Prefix">
<div data-element="InputIcon">
{isLoading ? <LoadingIcon /> : null}
</div>
</div>
)}
<SearchInputElement
ref={searchInputRef}
data-is-prefix={isLoading ? '' : undefined}
Expand All @@ -811,13 +820,6 @@ export const FilterListBox = forwardRef(function FilterListBox<
{...keyboardProps}
{...modAttrs(mods)}
/>
{isLoading && (
<div data-element="Prefix">
<div data-element="InputIcon">
{isLoading ? <LoadingIcon /> : null}
</div>
</div>
)}
</SearchWrapperElement>
);

Expand Down Expand Up @@ -856,6 +858,7 @@ export const FilterListBox = forwardRef(function FilterListBox<
listRef={listRef}
stateRef={listStateRef}
listStyles={listStyles}
shouldFocusWrap={shouldFocusWrap}
optionStyles={optionStyles}
sectionStyles={sectionStyles}
headingStyles={headingStyles}
Expand Down
7 changes: 7 additions & 0 deletions src/components/fields/FilterPicker/FilterPicker.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ const meta: Meta<typeof FilterPicker> = {
defaultValue: { summary: false },
},
},
shouldFocusWrap: {
control: { type: 'boolean' },
description: 'Whether keyboard navigation should wrap around',
table: {
defaultValue: { summary: false },
},
},

/* State */
isDisabled: {
Expand Down
Loading
Loading