Skip to content

Commit 3f3a12d

Browse files
authored
fix: styles in Label and NumberInput (#862)
1 parent a9da929 commit 3f3a12d

File tree

9 files changed

+33
-3
lines changed

9 files changed

+33
-3
lines changed

.changeset/grumpy-planes-lie.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Change the default Label preset to `t3m`.

.changeset/moody-bears-shake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Fix font weight for Item and Item Button.

.changeset/spicy-jeans-promise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Use right text alignment in NumberInput component.

src/components/actions/ItemButton/ItemButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const StyledItem = tasty(Item, {
3232
as: 'button',
3333
type: 'neutral',
3434
theme: 'default',
35+
isButton: true,
3536
styles: {
3637
reset: 'button',
3738
placeContent: 'center stretch',

src/components/content/Item/Item.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ export interface CubeItemProps extends BaseProps, ContainerStyleProps {
141141
* When true, applies card styling with increased border radius.
142142
*/
143143
isCard?: boolean;
144+
/**
145+
* When true, adds button modifier to the component styling.
146+
*/
147+
isButton?: boolean;
144148
/**
145149
* @private
146150
* Default tooltip placement for the item.
@@ -252,9 +256,11 @@ const ItemElement = tasty({
252256
disabled: '#dark-04',
253257
},
254258
preset: {
255-
'': 't3m',
259+
'': 't3',
260+
button: 't3m',
256261
'[data-size="xsmall"]': 't4',
257-
'[data-size="xlarge"]': 't2m',
262+
'[data-size="xlarge"]': 't2',
263+
'[data-size="xlarge"] & button': 't2m',
258264
'[data-size="inline"]': 'tag',
259265
},
260266
boxSizing: 'border-box',
@@ -685,6 +691,7 @@ const Item = <T extends HTMLElement = HTMLDivElement>(
685691
isLoading = false,
686692
isCard = false,
687693
actions,
694+
isButton = false,
688695
defaultTooltipPlacement = 'top',
689696
...rest
690697
} = props;
@@ -777,6 +784,7 @@ const Item = <T extends HTMLElement = HTMLDivElement>(
777784
selected: isSelected === true,
778785
loading: isLoading,
779786
card: isCard === true,
787+
button: isButton === true,
780788
...mods,
781789
};
782790
}, [
@@ -790,6 +798,7 @@ const Item = <T extends HTMLElement = HTMLDivElement>(
790798
isSelected,
791799
isLoading,
792800
isCard,
801+
isButton,
793802
actions,
794803
mods,
795804
]);

src/components/fields/FilterPicker/FilterPicker.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ export const FilterPicker = forwardRef(function FilterPicker<T extends object>(
723723
<ItemButton
724724
ref={triggerRef as any}
725725
data-popover-trigger
726+
isButton={false}
726727
qa={qa || 'FilterPicker'}
727728
id={id}
728729
type={type}

src/components/fields/NumberInput/NumberInput.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export interface CubeNumberInputProps
2121
}
2222

2323
const StyledTextInputBase = tasty(TextInputBase, {
24+
styles: {
25+
textAlign: 'right',
26+
},
2427
wrapperStyles: {
2528
width: 'initial 13x 100%',
2629
},

src/components/fields/Picker/Picker.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ export const Picker = forwardRef(function Picker<T extends object>(
577577
<ItemButton
578578
ref={triggerRef as any}
579579
data-popover-trigger
580+
isButton={false}
580581
id={id}
581582
qa={qa || 'PickerTrigger'}
582583
type={type}

src/components/form/Label.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const INLINE_LABEL_STYLES: Styles = {
5959

6060
export const LABEL_STYLES: Styles = {
6161
display: 'block',
62-
preset: 'h6',
62+
preset: 't3m',
6363
color: {
6464
'': '#dark',
6565
invalid: '#danger-text',

0 commit comments

Comments
 (0)