Commit graph

382 commits

Author SHA1 Message Date
Jason Lee
deb1187c40
story: Fix #1017 duplicate action name error. (#1020) 2025-06-30 11:18:57 +08:00
Jason Lee
21dbaffcf4
input: Add Cursor and Selection type and export line number, cursor. (#1012) 2025-06-27 20:48:26 +08:00
Jason Lee
692ee83b61
chore: Move shadow_xs to StyledExt trait. (#1010)
This PR for fix https://github.com/longbridge/gpui-component/pull/1009
mistake.
2025-06-25 16:54:48 +08:00
Jason Lee
c8481bee19
theme: Update theme details to match Shadcn. (#1009)
## Light

<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/b1893648-5994-4c08-a79a-30b10dc62c47"
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/de5b4e13-7889-473b-b0c0-9ac11de0a4b0"
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/9f17c2a1-3a71-4d56-be6c-49f26f5e7406"
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/a4e99a61-a618-4c3b-a237-93bbc17d4cae"
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/64313ae5-8284-46ff-a75f-5a14a1e3b339"
/>
<img width="1193" alt="image"
src="https://github.com/user-attachments/assets/5c134172-0ab6-4299-950d-bac3dda7b61d"
/>
<img width="1374" alt="image"
src="https://github.com/user-attachments/assets/c8816288-d008-490d-9db3-4fa796278001"
/>
<img width="1428" alt="image"
src="https://github.com/user-attachments/assets/d903a854-15e3-48aa-8ebd-969c1c91c624"
/>



## Dark

<img width="1467" alt="image"
src="https://github.com/user-attachments/assets/720418b4-8a9b-42c9-814b-a0be660e8eba"
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/4ca20f31-c998-40bb-b4bf-6079c506f9ec"
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/ae828624-55b3-4d33-8a20-2c71a0a838cc"
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/7014c76c-5e18-4cd5-9cf1-6bccbb58e56a"
/>
<img width="1393" alt="image"
src="https://github.com/user-attachments/assets/6e1c514d-5f76-460a-9c7e-a38f2f0e712a"
/>
<img width="1374" alt="image"
src="https://github.com/user-attachments/assets/07ad8c20-317b-4209-9f92-b500f53dd4c0"
/>
<img width="1428" alt="image"
src="https://github.com/user-attachments/assets/6bd2969d-9bec-4ed7-9280-109a81144dfa"
/>
2025-06-25 16:40:27 +08:00
Jason Lee
67f0ffbc9c
chore: Upgrade GPUI and fix action API changes. (#1008)
Ref https://github.com/zed-industries/zed/pull/33263
2025-06-25 11:06:12 +08:00
Jason Lee
ed0887420f
chore: Impl Styled for more elements. (#1007)
This PR for continuing #1005 was missed commits.
2025-06-24 19:36:42 +08:00
Jason Lee
9aa593ce0b
chore: Apply Styled to elements to support flexable style refinement. (#1005)
## Break Changes

- date_picker, dropdown: Removed `width` method, use `w`, `w_full`
instead.

    ```diff
    - .width(px(100.))
    + .w(px(100.))
    ```

- calendar: Removed `bordered` method, use `border` method from GPUI
instead.

    ```diff
    - .bordered(false)
    + .border_0()
    ```
2025-06-24 18:56:35 +08:00
Jason Lee
7360d2834d
theme: Update default radius to 6px, and modal to 8px. (#995) 2025-06-20 20:07:19 +08:00
Michael Angerman
389c25c287
chore: Fix spelling of the word masked (#990) 2025-06-19 12:34:19 +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
Floyd Wang
c5fed17941
notification: Better style details (#982)
| Before | After |
| - | - |
| <img width="752" alt="Before"
src="https://github.com/user-attachments/assets/d4e08e87-100a-4b8d-90f3-909900d41e66"
/> | <img width="752" alt="After"
src="https://github.com/user-attachments/assets/e84c145e-8990-4c47-bbff-0d4e86acca64"
/> |
2025-06-18 14:21:25 +08:00
Floyd Wang
1055131ffe
notification: Support remove notification with the given id (#980) 2025-06-18 14:02:07 +08:00
Floyd Wang
c39e7af50c
number_input_story: Fix subtraction overflow (#976) 2025-06-18 10:16:57 +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
de491a790c
input: Fix Input prefix, suffix position, and mask * in vertical center. (#965)
- Fix Input, NumberInput padding x with prefix, suffix.
- Fix Input mask char to render in vertical center.

<img width="498" alt="image"
src="https://github.com/user-attachments/assets/f7b34e17-2503-4a24-9e16-3a30b48bacb5"
/>

- Fix to only use `Tab`, `Shift-Tab` to indent in multi-line mode.
- Improve blink cursor to render with 1.5px width and same as
line-height.
2025-06-17 13:59:02 +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
Jason Lee
61283a71f0
scrollbar: Refactor ScrollbarState to have Cell inside. (#959)
## Break Change

- Now we added `Rc<Cell<>>` inside the ScrollbarState.

```diff
- scroll_state: Rc<Cell<ScrollbarState>>,
+ scroll_state: ScrollbarState,
```
2025-06-16 15:11:52 +08:00
Jason Lee
e29b51cc83
popover: Improve PopoverContent to support styled methods. (#951)
- Add `refine_style` method to `StyledExt`.
- Also improve the Popover example style.

<img width="1053" alt="image"
src="https://github.com/user-attachments/assets/bf435a79-6c34-41ab-802a-29a7600ecd29"
/>
2025-06-12 15:00:00 +08:00
Jason Lee
a3a4f1942d
chart: Update Chart story by use JSON file data. (#947) 2025-06-11 21:34:22 +08:00
Jason Lee
4c0e13bc8d
radio: Add id to RadioGroup to avoid clicks conflict. (#941)
## Break Changes

- The `RadioGroup` now require a `id` to init.

```diff
- RadioGroup::horizontal()
+ RadioGroup::horizontal("group-id-1")
- RadioGroup::vertical()
+ RadioGroup::vertical("group-id-2")
```
2025-06-11 15:45:24 +08:00
Floyd Wang
c333fd7106
notification: Add support for rendering custom content (#938)
## Break Change
You no longer need to pass a message when creating a new notification.
Instead, use the `message` method.

```diff 
- Notification::new("There was a problem with your request.");
+ Notification::new().message("There was a problem with your request.");
```

<img width="1023" alt="image"
src="https://github.com/user-attachments/assets/4b93f2bb-e130-45d6-974f-8b14efac58a4"
/>
2025-06-10 12:06:02 +08:00
Jason Lee
d598e58666
tag: Add rounded to Tag and support outline for all variants. (#923)
<img width="1316" alt="image"
src="https://github.com/user-attachments/assets/e06f672d-f311-4dc2-b62a-c1f5cbce6973"
/>
2025-06-06 13:35:24 +08:00
Floyd Wang
a1bdd50735 story: Reorder story menu 2025-06-04 19:29:32 +08:00
Floyd Wang
516c8fada4
chart: Introduce chart (#878)
Add a new component called `plot`. It provides a low-level approach to
data analysis and visualization.
Chart is a collection of ready-to-use chart components built with
`plot`.

| Light | Dark |
| - | - |
| <img width="1712" alt="SCR-20250604-qhxb"
src="https://github.com/user-attachments/assets/bf7ce76e-ab7a-42c2-92e7-17cd135de66f"
/> | <img width="1712" alt="SCR-20250604-qhxr"
src="https://github.com/user-attachments/assets/dd3e44ea-bbb5-41a2-8cce-38b316d7d800"
/> |
2025-06-04 19:22:11 +08:00
Jason Lee
7934e8af31 story: Fix double border in ResizableStory. 2025-06-04 18:11:00 +08:00
Jason Lee
2b796c94e9
highlighter: Improve performance for large file. (#911)
Still need to improve.

This version can work smooth when the file lines are less than 5000
lines.

> cargo run --release on MacBook Pro, Apple M3 CPU

- Editing at 110 FPS+
- Display at 120 FPS.

<img width="977" alt="image"
src="https://github.com/user-attachments/assets/37958bcb-20d8-486b-8c50-2728d16f971b"
/>
2025-06-03 23:20:33 +08:00
Floyd Wang
dc1d516a30
button: Impl Selectable for the dropdown button (#913)
## Break Change
- Add `is_selected` to the `Selectable` trait; Returns true if the
element is selected.
2025-06-02 14:25:18 +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
bad9506ebb
inspector: Fix Inspector on release build. (#906) 2025-05-27 18:51:57 +08:00
Floyd Wang
ebe10e20c7
alert: Add support for text wrapping (#899)
<img width="935" alt="image"
src="https://github.com/user-attachments/assets/6eb10c67-5301-4414-af7f-9b4444b77fb6"
/>
2025-05-26 17:09:12 +08:00
Jason Lee
1c11b5fb55
inspector: Add Inspector. (#897)
<img width="1434" alt="image"
src="https://github.com/user-attachments/assets/f6ec2e1d-ff1c-4798-90fe-d29bef20fa9d"
/>
2025-05-26 16:44:11 +08:00
Floyd Wang
a1ad647527
number_input: Add support for prefix and suffix (#896)
<img width="1097" alt="image"
src="https://github.com/user-attachments/assets/b4c1fc69-88ad-4ecd-b1c8-1a5a92836e82"
/>
2025-05-26 16:16:22 +08:00
Jason Lee
f539817d9b
alert: Add banner mode and on_close to Alert. (#893)
## Break Changes

- The `Alert::new` method change to 2 args, first is `id`.

```diff
- fn new(message: impl Into<Text>) -> Self
+ fn new(id: impl Into<ElementId>, message: impl Into<Text>) -> Self
```

<img width="1120" alt="image"
src="https://github.com/user-attachments/assets/214df737-6129-4a53-8f3b-86e83bc8082b"
/>
2025-05-23 19:20:13 +08:00
Floyd Wang
244090ddc5
number_input: Remove InputEvent from NumberInputEvent (#884)
## Break Change
- Number input no longer emits `InputEvent`; you need an additional
subscription for `InputEvent`.
2025-05-22 14:38:43 +08:00
ZW
6a190da785
calendar: Support custom matcher (#873)
See #870
2025-05-20 21:07:17 +08:00
Jason Lee
b97abd6394
input: Fix auto-grow height. (#865)
Fix #864 

Updated InputState API to split `single_line`, `multi_line` and
`auto_grow`.

The `InputState::new` for default single_line, and added `multi_line`
and `auto_grow` to change other mode.

### With no wrap

https://github.com/user-attachments/assets/22a8f0d6-e264-4f39-bb30-386a41975d2b

### With soft wrap

https://github.com/user-attachments/assets/b71f0fb1-5937-470b-a278-8b1de7cfd7d7
2025-05-19 19:26:27 +08:00
Jason Lee
bc398adbf3
input: Refactor Input, Picker as stateless mode. (#858) 2025-05-16 23:41:26 +08:00
Jason Lee
c0e0d82594
input: Add mask pattern to format display. (#854)
- Add `mask_pattern` to Input, NumberInput.
- Fix Input `set_text` to move cursor to end.

https://github.com/user-attachments/assets/2d7e362a-3f80-47a4-94e3-efd729bffcac
2025-05-14 22:27:46 +08:00
Jason Lee
1535df796e
resizable: Refactor to use stateless Resizable element. (#852)
## Break Changes

- The `ResizablePanelGroup` and `ResizablePanel` are changed to as
stateless element, please check out the diff to migrate.
2025-05-12 17:15:11 +08:00
Jason Lee
0a95f7c0f1
resizable: Add size_range to limit panel size and fix resize and initial_size of panel. (#844)
## Fix panel resize bug

- Fix some panel resizing details.
- Fix initial_size for panel and ensure split dock panel to get average
size.

### Before


https://github.com/user-attachments/assets/cd6c7e10-aec7-46a6-8a4d-11bf4d221f92

### After


https://github.com/user-attachments/assets/90c8b865-630a-4abd-98c9-310800b12fee
2025-05-12 11:07:06 +08:00
Michael Angerman
28582bc905
chore: Remove unused file text_view (#850)
The file text_view was empty.
So it does not need to be in the repo.
2025-05-12 10:40:00 +08:00
Jason Lee
d288a51e06
dock: Revert panel radio size to back to use Pixels type for panel size. (#842)
This PR to revert previous dock changes to back to use `Pixels` type for
panel size.

- #833 
- #839 
- #840
2025-05-09 16:47:24 +08:00
Jason Lee
6514aec22a
dock: Refactor to use ratio for dock, panel size. (#833) 2025-05-07 01:32:31 +08:00
Jason Lee
e530af9b51
notification: Add action button to Notification. (#832)
- Fix `Icon` clone to keep text_color and other attributes.

<img width="1303" alt="image"
src="https://github.com/user-attachments/assets/abb35045-166e-450e-a200-1d4a1d2b6dd8"
/>
2025-05-06 16:58:07 +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
Jason Lee
38d9c24af5
chore: Update getter method to return reference to view components. (#827) 2025-04-30 17:18:44 +08:00
Floyd Wang
a5e5fc52b4
dropdown: Support change options for the dropdown (#824) 2025-04-30 10:33:21 +08:00
Jason Lee
832f8b8f75
svg_img: Refactor SvgImg to avoid assign source image size and fix drop image error. (#821)
## Break Change

- Removed `source` method from `SvgImg`, now need assign source in `new`
method.
- There is no need to give image size, it will read the size from SVG
file.
2025-04-29 19:25:43 +08:00
Sunli
dc776224f9
svg_img: Fix memory leak in SvgImg (#818) 2025-04-28 14:42:37 +08:00