Commit graph

20 commits

Author SHA1 Message Date
Jason Lee
a9d145dd50
Update disabled menu, button, dropdown etc. to use default cursor. (#814)
To follow macOS UX design.
2025-04-24 21:28:15 +08:00
Jason Lee
5b508d7219
gallery: Redesign the gallery. (#797)
Close #773

<img width="1712" alt="image"
src="https://github.com/user-attachments/assets/e27a28ca-cdd7-4970-8518-4fd0104bb3f8"
/>
2025-04-17 17:12:48 +08:00
Jason Lee
9a6a0f4421
tooltip: Add action, key_binding method to Tooltip. (#787) 2025-04-14 17:38:21 +08:00
Jason Lee
d0a73011de
tooltip: Add KeyBinding to tooltip and Button. (#783)
- Improve `Kbd::format` method.
- Add `tooltip_with_action` method to Button for display key binding in
tooltip.
- 
## Break change

- The `Tooltip::new` has been changed it argument and return type.
    
    ```diff
- pub fn new(text: impl Into<Text>, _: &mut Window, cx: &mut App) ->
AnyView
    + pub fn new(text: impl Into<Text>) -> Self
    ```
2025-04-14 16:40:40 +08:00
Jason Lee
73be54a0f7
input: Improve clear button position in Input. (#782)
| Before | After |
| -- | -- |
| <img width="529" alt="image"
src="https://github.com/user-attachments/assets/02fdba71-7e83-43b9-ba4c-476eb21dcf28"
/> | <img width="530" alt="image"
src="https://github.com/user-attachments/assets/ad7b6378-c9ff-4ea4-943a-87af53a2ac79"
/> |
2025-04-11 19:13:17 +08:00
Jason Lee
ebe93210af
Use normal cursor for buttons. (#760)
This change to follow native UI to use normal cursor for all buttons,
items.

Only use `pointer` for link item.
2025-04-01 17:59:27 +08:00
Jason Lee
e8f89e04d6
button: Update ButtonCustomVariant default variable value to use transparent. (#746) 2025-03-27 10:43:40 +08:00
Jason Lee
17926cea16
button: Add warning, success, info variant to Button. (#745)
<img width="1342" alt="SCR-20250327-jfzq"
src="https://github.com/user-attachments/assets/7c44458a-9467-4095-9cd6-1dcb35cc351b"
/>
<img width="1342" alt="SCR-20250327-jgak"
src="https://github.com/user-attachments/assets/07d33d60-f581-46d4-9a54-174e56ab82ca"
/>
2025-03-27 10:15:53 +08:00
Floyd Wang
8e7ef5631e
dropdown_button: Support outline style (#716) 2025-03-12 17:23:37 +08:00
Jason Lee
6da7de5299
button: Improve Button to support combine outline with other variants. (#714)
<img width="1385" alt="image"
src="https://github.com/user-attachments/assets/240df695-bfd5-4680-89a2-2640db206b24"
/>
2025-03-12 11:57:25 +08:00
Jason Lee
61bb78d174
tab: Update default tab size padding x to match with Panel's padding. (#701)
- Fix muted_foreground in dark mode.
- Fix secondary button active color in dark mode.
- Fix to ensure render last empty space when TabBar have suffix.

<img width="1203" alt="image"
src="https://github.com/user-attachments/assets/65144893-6705-4087-87f3-7e478eaa1405"
/>
<img width="1203" alt="image"
src="https://github.com/user-attachments/assets/0fe3b72b-11f5-4917-959c-a2c88ba0213c"
/>
2025-03-10 21:23:00 +08:00
Jason Lee
c9c6449d24
toggle: Add Toggle and ToggleGroup. (#691)
- Improve `Icon` to inherit parent element font size by default.

<img width="777" alt="image"
src="https://github.com/user-attachments/assets/1a0ee94e-46ef-4b02-9538-09880586d3f2"
/>
<img width="777" alt="image"
src="https://github.com/user-attachments/assets/4ecb016f-2e7c-4266-9a25-eae2566b2844"
/>
2025-03-06 19:10:28 +08:00
Jason Lee
581d92378c
tab: Add xsmall, large style to Tab. (#680)
<img width="1047" alt="image"
src="https://github.com/user-attachments/assets/763fc4c9-bda8-4292-83c5-4a44db091938"
/>
<img width="1047" alt="image"
src="https://github.com/user-attachments/assets/e21d5344-f31c-43b3-af6b-28d845af77f8"
/>
<img width="1047" alt="image"
src="https://github.com/user-attachments/assets/3da37f16-55aa-44b3-98c2-4cadfae458b3"
/>
<img width="1047" alt="image"
src="https://github.com/user-attachments/assets/cfbb1f7e-c810-4387-b7dc-d1d2870d50a6"
/>
2025-03-04 10:26:12 +08:00
Jason Lee
437f1b2098
theme: Add to support always show scrollbar mode and default to match with system style. (#621)
Close #573

- Fix theme settings to keeping when switch theme mode.
2025-02-12 15:15:33 +08:00
Jason Lee
3ffbbb0688
theme: Ensure all elements to use radius. (#596)
- Fix menu dispatch action.
2025-02-03 19:03:16 +08:00
Jason Lee
327d40e0e0
chore: Upgrade GPUI 3 (#587)
The pervious version has keep on
[gpui2](https://github.com/longbridge/gpui-component/tree/gpui2) branch,
if there need to use.

Ref https://github.com/zed-industries/zed/pull/22632

## Prepare

### Generate index.scip

```bash
rust-analyzer scip ./ > index.scip
```

### Get [refactor](https://github.com/zed-industries/refactor)

```bash
https://github.com/zed-industries/refactor.git
```

## Refactor exist code

```bash
cd refactor
cargo run -- ~/work/gpui-component
```

Then will get result if successed:

```
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/refactor /Users/jason/work/gpui-component`
Loaded 115 SCIP documents
Processing files starting with focus path: ""
Changed 90 files
```

-------------

## Changes

```diff
- View<T>
- Model<T>
+ Entity<T>

- WeakView<T>
+ WeakEntity<T>

- FocusableView
+ Focusable

- cx.bounds()
+ window.bounds()
- cx.refresh()
+ window.refresh()
- cx.focused()
+ window.focused(cx)
- cx.with_optional_element_state
- window.with_optional_element_state
```

```diff
- &mut WindowContext
+ &mut Window, &mut App

- cx: &mut WindowContext
+ window: &mut Window, cx: &mut App

- &mut ViewContext<
+ &mut Window, &mut Context<

- cx: &mut ViewContext<
+ window: &mut Window, cx: &mut Context<
```

```diff
- cx.spawn(|_, mut cx| async move { 
+ cx.spawn_in(window, |_, mut cx| async move {
- cx.dispatch_action(Box::new(...))
+ window.dispatch_action(Box::new(...), cx)
```

`cx.spawn`

```diff
- cx.spawn(|view, mut cx| async move {
+ cx.spawn_in(window, |view, mut window| async move {
+     _ = view.update_in(&mut window, move |view, window, cx| {
```
2025-01-27 03:58:48 +08:00
Jason Lee
9f2cd84b23
color: Add mix method and merge ColorExt to Colorize. (#561)
- Add `mix` method to mix two color.
- Export `ui::theme::*` to crate root, before `use
ui:theme::ActiveTheme` to `use ui::ActiveTheme`.

## Break Changes

- Moved `ui::theme::Colorize` to `ui::Colorize`.
- Merged `ColorExt` to `Colorize`.
- Renamed `to_hex_string` to `to_hex`, `parse_hex_string` to
`parse_hex`.
2025-01-21 18:31:01 +08:00
Floyd Wang
06e9b1a25c
dropdown_button: Add compact style (#555) 2025-01-20 13:49:42 +08:00
Floyd Wang
bd3cdd7167
dropdown_button: Add more style preferences (#554) 2025-01-17 16:24:46 +08:00
Floyd Wang
569a4e7262
dropdown_button: Add new component (#551)
## Regular
<img width="162" alt="image"
src="https://github.com/user-attachments/assets/4e597d0b-41d1-4b0e-9939-728cae71fe65"
/>

## Active
<img width="162" alt="image"
src="https://github.com/user-attachments/assets/0871ed6b-3188-44dd-93d4-5996f9213edc"
/>
<br />
<img width="162" alt="image"
src="https://github.com/user-attachments/assets/b05ccdc6-e405-47d0-97e7-470afadbbd38"
/>


## Break Change
Move `ButtonGroup` into the `button`.
2025-01-17 14:16:24 +08:00