Commit graph

33 commits

Author SHA1 Message Date
Jason Lee
7360d2834d
theme: Update default radius to 6px, and modal to 8px. (#995) 2025-06-20 20:07:19 +08:00
Jason Lee
fdeb46b293 modal: Update modal inner padding from p_4 to p_6. 2025-06-20 18:16:35 +08:00
Jason Lee
d7e04ecdd0
scrollbar: Improve Scrollbar to get correct scroll size. (#985)
Continue #984

- Fixes there may Scrollbar size not match the content size. Close #979
- Improved Table scrollbar to only render at scrollable area when there
have fixed columns.

<img width="850" alt="image"
src="https://github.com/user-attachments/assets/84f54515-e61a-484f-b2b4-ea5abb98ddb8"
/>


## Break Changes

- The `Scrollbar` has been removed `entity_id` and `scroll_size`
argument from new method, it will get that value from `scroll_handle`.
- There still have a `scroll_size` optional method, if you want to give
your own.
  - Also changed the `scroll_state`, `scroll_handle` to receive a ref.

```diff
- Scrollbar::vertical(entity_id, scroll_state, scroll_handle, scroll_size);
+ Scrollbar::vertical(&scroll_state, &scroll_handle);
+ Scrollbar::vertical(&scroll_state, &scroll_handle).scroll_size(scroll_size);
```
2025-06-18 19:09:34 +08:00
Jason Lee
1752d3e2b4
chore: Improve Scrollbar and Scrollable to support Axis and ScrollbarAxis. (#983) 2025-06-18 16:00:35 +08:00
Jason Lee
64e3653bc9 modal: Add scrollbar to modal again. (#971) 2025-06-17 18:49:49 +08:00
Jason Lee
0e3b61a704
Revert "modal: Add scrollbar to Modal for overflow contents. #960" (#970) 2025-06-17 17:48:42 +08:00
Jason Lee
d2633faf82
modal: Add scrollbar to Modal for overflow contents. (#960)
- Add `overlay` variable to Theme.

<img width="536" alt="image"
src="https://github.com/user-attachments/assets/12ed43c8-00b5-41b1-8cf6-0f31b533525c"
/>
2025-06-16 17:35:02 +08:00
Floyd Wang
838ffe0a79
modal: Display overlay at the correct z-index (#909)
| Before | After |
| - | - |
| <img width="1712" alt="SCR-20250528-ksil"
src="https://github.com/user-attachments/assets/3725f142-0792-478a-ac7e-1a9c5604821a"
/> | <img width="1712" alt="SCR-20250528-krmi"
src="https://github.com/user-attachments/assets/b0fac5db-97b2-4ebd-83e2-94786950185c"
/> |
2025-05-28 11:57:23 +08:00
Jason Lee
f4e8b952e9
modal: Add alert method to create modal with a Ok button. (#829)
- Fix to handle close modal when `on_ok`, `on_cancel` not present.
2025-05-02 10:28:26 +08:00
Floyd Wang
8ef4e2eb17
modal: Respond confirm events only when on_ok or footer present (#786) 2025-04-14 16:56:16 +08:00
王子凌
b016d9fff4
modal: Fix close Modal by clicking overlay to support closing layer by layer. (#771)
Fix the issue that wrongly trigger `overlay` click event for the
layer-stacked `modals`.

Fix #772 

I.E. When clicking the `overlay`, only the last modal will possibly be
hide(If the last modal is not `overlayClosable`, click the overlay, all
the modals will not be hide).


![gif](https://github.com/user-attachments/assets/96ac97fc-6b6d-463d-bce9-393e6236c5df)

I had tried another solution:

![image](https://github.com/user-attachments/assets/d9882d70-c82c-4397-a5ff-65cd49dc08ab)

![image](https://github.com/user-attachments/assets/3855fb6b-4aac-4c7c-9581-3b0843ef78dc)

If this one is better than prev, I will commit it~

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-04-03 13:29:31 +08:00
Jason Lee
a60acd7e4d
list: Add secondary confirm support to list. (#769) 2025-04-02 16:45:27 +08:00
Jason Lee
87b8958059
modal: Use bold text for Modal title. (#715)
<img width="995" alt="image"
src="https://github.com/user-attachments/assets/3e9ba919-eb91-4e8d-ba89-3a85e263e550"
/>
2025-03-12 11:57:59 +08:00
Jason Lee
8edd80d5ee
modal: Do not occlude when overlay is not enable. (#657) 2025-02-25 12:25:46 +08:00
Jason Lee
231772ee4e
modal: Remove opacity animation for improve Modal appear. (#633) 2025-02-17 13:32:17 +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
Jason Lee
20feab5f40
modal: Add confirm Modal with default Ok, Cancel buttons. (#558)
<img width="581" alt="image"
src="https://github.com/user-attachments/assets/ad53fb63-f3be-41e6-90c0-f03cba48c4db"
/>

- Added `overlay_closable` method to Modal to control overlay click to
close modal.
- Added `on_ok`, `on_cancel` callback method.
- Added `confirm` to setup to use default confirm style (With a Ok,
Cancel button).

## Break Changes

- The `footer` method has been changed to with a fn not a element.
2025-01-20 17:42:05 +08:00
Jason Lee
0327df323d
modal: Fix Model, Drawer overlay size on tiling mode. (#518) 2024-12-27 17:22:02 +08:00
Jason Lee
9eba97ddf6
modal: Fix modal, drawer overlay position on Linux. (#515)
- Update `overlay` for Modal, still handle click out to dismiss, even it
no overlay.
2024-12-24 14:43:37 +08:00
Jason Lee
23f9352295
button: Rename ButtonStyle to ButtonVariant. (#460)
This is a breaking changes, we need refactor exist code by this:

- `ButtonStyled` -> `ButtonVariants`
- `.style` -> `.with_variant`
- `ButtonStyle` -> `ButtonVariant`
- `ButtonCustomStyle` -> `ButtonCustomVariant`
2024-12-03 19:22:28 +08:00
ihavecoke
5aad0bf340
modal: Add keyboard option to Modal to enable/disable default keyboard event. (#400) 2024-11-08 13:50:05 +08:00
Floyd Wang
c5b4505560
feat(button): Remove track_focus (#282) 2024-09-27 14:39:48 +08:00
Jason Lee
a8d4abea69
button: Improve ButtonGroup to add style, size methods. (#241)
- Add `ButtonStyled` trait to apply the style for Button and
ButtonGroup.
2024-09-13 12:00:47 +08:00
Jason Lee
ce87c3a001
modal: Improve Modal and Panel focus handle. (#238)
- modal: Improve modal focus take, when modal close, make sure focus
back.
- modal: Fix hover close button will cross to back modal on multiple
modal layer.
- panel: Add focus handle to Panel and TabPanel.
- panel: Update title method to return `AnyElement`.
2024-09-12 19:51:33 +08:00
Jason Lee
fbbb985e84
ui: Improve UI details (Modal, Checkbox, Radio and MenuItem) (#233)
- modal: Reduce modal title line height.
- checkbox, radio: Fix label line height to align with checkbox.
- menu: Update Menu item style, height to 28px, and fix divider padding.

<img width="523" alt="image"
src="https://github.com/user-attachments/assets/c254dc07-9d37-4885-b687-58ec4d8e95a4">

<img width="453" alt="image"
src="https://github.com/user-attachments/assets/3ad44419-1953-4048-8173-4d8c0646777a">

<img width="369" alt="image"
src="https://github.com/user-attachments/assets/84d23eb2-15f9-47d7-b6d4-15295ab3a544">
2024-09-10 19:42:54 +08:00
Jason Lee
a0d3d35be4
modal: Add to support open multiple Modals. (#232)
- Add `Esc` to close modal.
2024-09-10 16:58:22 +08:00
Jason Lee
2c469da55a
Update GPUI and apply opacity feature. (#215) 2024-09-04 19:29:51 +08:00
Jason Lee
0da882349f
Add exit animation to Notification.
- Add `cubic_bezier` method and change modal to use this.

Ref #148 

https://github.com/user-attachments/assets/c09adc18-554c-4300-8109-98f3ab183910
2024-08-30 11:24:55 +08:00
ihavecoke
a5217df13e
Popover content supports setting the maximum width (#180)
Before:

![image](https://github.com/user-attachments/assets/cde8dc35-f59d-474c-8386-b6f666e83249)

After:

![image](https://github.com/user-attachments/assets/d5db1bed-5c2d-4efd-81e4-a0d13e48b035)
2024-08-27 22:08:50 +08:00
Jason Lee
3550b1ee13
Add slide down animation t Modal. (#141)
- Export cx.active_modal and cx.active_drawer
- Add support custom modal style, and add show_close option.
2024-08-14 17:23:39 +08:00
Jason Lee
b934ff76e6
Add Modal (#138)
https://github.com/user-attachments/assets/f4c2f9dd-2508-4251-a861-1af3af7542a3
2024-08-13 17:41:12 +08:00