Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit d49bc9c

Browse files
committed
Update UI package with styling and loading indicator modifications
The user interface package (ui package.json) has been updated to version 0.1.80 to include styling refinements for disabled state buttons and a simplified loading indicator. The styling updates provide better visibility for disabled buttons across all styles. The loading indicator now utilizes a data-slot, improving the streamline of implementation.
1 parent f810e6c commit d49bc9c

File tree

4 files changed

+29
-14
lines changed

4 files changed

+29
-14
lines changed

packages/ui/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @codefixlabs/ui
22

3+
## 0.1.80
4+
5+
### Patch Changes
6+
7+
- Refine disabled state styling and simplify loading indicator
8+
39
## 0.1.79
410

511
### Patch Changes

packages/ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@codefixlabs/ui",
3-
"version": "0.1.79",
3+
"version": "0.1.80",
44
"license": "MIT",
55
"sideEffects": false,
66
"exports": {

packages/ui/src/classes/button.ts

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const buttonVariants = cva(
117117
'relative items-center gap-2 whitespace-nowrap text-sm font-medium transition-colors',
118118
'ring-offset-background',
119119
'focus-visible:ring-ring focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2',
120-
'disabled:cursor-not-allowed',
120+
'disabled:cursor-not-allowed disabled:duration-0',
121121
],
122122
{
123123
compoundVariants: [...compoundSizes],
@@ -156,28 +156,38 @@ export const buttonVariants = cva(
156156
primary: [
157157
'bg-primary text-primary-foreground',
158158
'hover:bg-primary/90',
159-
'disabled:bg-primary/50 disabled:text-primary-foreground/0 [&_[data-loading]]:disabled:text-primary-foreground',
159+
'disabled:bg-primary/50 disabled:text-primary-foreground/80',
160+
'has-[[data-slot=loading]]:text-primary-foreground/0 [&_[data-slot=loading]]:disabled:text-primary-foreground',
160161
],
161162
destructive: [
162163
'bg-destructive text-destructive-foreground',
163164
'hover:bg-destructive/90',
164-
'disabled:bg-destructive/50 disabled:text-destructive-foreground/0 [&_[data-loading]]:disabled:text-destructive-foreground',
165+
'disabled:bg-destructive/50 disabled:text-destructive-foreground/80',
166+
'has-[[data-slot=loading]]:text-destructive-foreground/0 [&_[data-slot=loading]]:disabled:text-destructive-foreground',
165167
],
166168
secondary: [
167169
'bg-secondary text-secondary-foreground',
168170
'hover:bg-secondary/90',
169-
'disabled:bg-secondary/50 disabled:text-secondary-foreground/0 [&_[data-loading]]:disabled:text-secondary-foreground',
171+
'disabled:bg-secondary/50 disabled:text-secondary-foreground/80',
172+
'has-[[data-slot=loading]]:text-secondary-foreground/0 [&_[data-slot=loading]]:disabled:text-secondary-foreground',
170173
],
171174
outline: [
172175
'border-input border',
173176
'hover:border-input/90 hover:bg-accent hover:text-accent-foreground',
174-
'disabled:border-input/50 disabled:text-accent-foreground/0 [&_[data-loading]]:disabled:text-accent-foreground',
177+
'disabled:border-input/50 disabled:text-accent-foreground/80',
178+
'has-[[data-slot=loading]]:text-accent-foreground/0 [&_[data-slot=loading]]:disabled:text-accent-foreground',
175179
],
176180
ghost: [
177181
'hover:bg-accent hover:text-accent-foreground',
178-
'disabled:text-accent-foreground/0 [&_[data-loading]]:disabled:text-accent-foreground',
182+
'disabled:text-accent-foreground/80',
183+
'has-[[data-slot=loading]]:text-accent-foreground/0 [&_[data-slot=loading]]:disabled:text-accent-foreground',
184+
],
185+
link: [
186+
'text-primary rounded-none',
187+
'hover:underline',
188+
'disabled:text-primary/80',
189+
'has-[[data-slot=loading]]:text-primary/0 [&_[data-slot=loading]]:disabled:text-primary',
179190
],
180-
link: ['text-primary rounded-none', 'hover:underline'],
181191
},
182192
},
183193
},

packages/ui/src/react/button.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,11 @@ export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
6060
{endIcon}
6161

6262
{loading ? (
63-
<span className="rounded-inherit absolute inset-0 flex items-center justify-center">
64-
<Loader2Icon
65-
className="animate-spin"
66-
data-loading={loading}
67-
size={18}
68-
/>
63+
<span
64+
className="rounded-inherit absolute inset-0 z-10 flex items-center justify-center"
65+
data-slot="loading"
66+
>
67+
<Loader2Icon className="animate-spin" size={18} />
6968
</span>
7069
) : null}
7170
</button>

0 commit comments

Comments
 (0)