52 Commits

Author SHA1 Message Date
Jason Lee
ff109f5b4a assets: Move assets files into crates/assets folder for crate publish. (#1609) 2025-11-14 19:00:46 +08:00
Jason Lee
19fad3c081 docs: Improve docs to use variable version from toml. (#1603) 2025-11-14 16:14:54 +08:00
Jason Lee
fc39dee024 assets: Add gpui-component-assets crate. (#1601) 2025-11-14 15:07:15 +08:00
Jason Lee
ee7a16912f example: Follow up #1594 missed changes. (#1595) 2025-11-14 11:24:02 +08:00
Jason Lee
0814def218 Revert "root: Render overlays inside Root element by default. (#1570)" (#1584)
Revert #1573, #1570
2025-11-13 13:37:55 +08:00
Jason Lee
cbd4346b87 root: Impl Styled for Root. (#1573) 2025-11-12 17:57:15 +08:00
Jason Lee
f26f01909e root: Render overlays inside Root element by default. (#1570)
## Break Change

- The `Root::render_notification_layer`, `Root::render_sheet_layer`,
`Root::render_dialog_layer` has been removed, we don't need it now, the
Root element has default rendered them.
2025-11-12 08:04:54 +00:00
Jason Lee
f88b547b70 Bump v0.4.0-preview2 2025-11-12 15:16:49 +08:00
Jason Lee
214d3f6622 notification: Add &mut Self to content and action method. (#1569) 2025-11-12 15:10:42 +08:00
Jason Lee
3cd94ea0be popover: Fix click trigger to close popover. (#1559) 2025-11-11 21:14:56 +08:00
Jason Lee
2dbfba3490 popover: Improve Popover API. (#1545)
- Add `open`, `on_open_change` method to control open state.
- Add `default_open` method.

## Break Change

This PR to rewrite the API of Popover API to make it easy to use. 

- The `content` method now can receive an element directly.

```diff
- .content(|window, cx| {
-     cx.new(|cx| {
-         PopoverContent::new(window, cx, |_, _| {
-             div().child("This popover content.")
-         })
-     })
- })
+ .content(|state, window, cx| {
+     div().child("This popover content.")
+ })
```

- And you can also just use `child` and `children` to add child
elements.

```rs
Popover::new("my-popover")
    .trigger(Button::new("trigger").label("Open Popover"))
    .child("This popover content.")
```

- Removed `PopoverContent`, and changed `Popover` default paddings to
`p_3`.
2025-11-11 17:45:30 +08:00
Floyd Wang
74f23bfca8 tab: Refactor creation to use builder pattern (#1553)
## Breaking change

```diff
- Tab::new("Account")
+ Tab::new().label("Account")
```

We can currently create a tab item without a label, such as only an
icon.
2025-11-11 10:35:00 +08:00
Nico GrĂ¼ndel
2cba6e8be9 slider: Add option to choose between linear and logarithmic scale (#1543)
Adds the ability to choose between a linear and a logarithmic scale for
the slider. A logarithmic scale is the right and intuitive choice for
many different slider applications. Building this right into the
component has two advantages:
- The user doesn't have to convert at every point where they might use
or update the slider value
- On a logarithmic scale, the distance between steps varies over the
sliders range. This implementation respects that

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
2025-11-10 02:56:09 +00:00
Jason Lee
a2c55dda46 form: Rename FormField to Field. (#1539) 2025-11-07 18:43:01 +08:00
Jason Lee
945db0be56 dialog: Rename Modal to Dialog. (#1538)
## Break Change

- Renamed `Modal` to `Dialog`.

```diff
- window.open_modal(...)
+ window.open_dialog(...)

- window.close_modal(...);
+ window.close_dialog(...);
```

- Renamed `show_close` method to `close_button` in Dialog.
```diff
- .show_close(false)
+ .close_button(true)
```
2025-11-07 17:25:55 +08:00
Jason Lee
89041f9ab8 docs: Update version to v0.4.0-preview1 in docs. (#1534) 2025-11-06 22:35:38 +08:00
Jason Lee
80689264e2 sheet: Rename Drawer to Sheet. (#1527)
## Break Change

- Renamed `Drawer` to `Sheet`, also renamed relative method contains
`drawer` to `sheet`.
- Renamed `ContextModal` to `WindowExt`.

```diff
- use gpui_component::drawer::Drawer
+ use gpui_component::sheet::Sheet

- use gpui_component::ContextModal
+ use gpui_component::WindowExt
```
2025-11-06 07:19:10 +00:00
Jason Lee
4dc10165fb spinner: Rename Indicator to Spinner. (#1526)
## Break Change

- Renamed `Indicator` to `Spinner`.

```diff
- use gpui_component::indicator::Indicator;
+ use gpui_component::spinner::Spinner;
```
2025-11-06 11:36:39 +08:00
Jason Lee
c06e91101e collapsible: Add Collapsible. (#1525)
Close #1479 

<img width="1171" height="791" alt="image"
src="https://github.com/user-attachments/assets/eac5cd9f-ef8c-4eb4-b93d-f63c9302c99a"
/>
2025-11-06 10:57:18 +08:00
Jason Lee
998a5fd922 chore: Standardize the overall API and improve docs. (#1516) 2025-11-05 19:10:30 +08:00
Jason Lee
2ba0dfbb96 popover: Renamed no_style to appearance like the Input. (#1523)
## Break Change

- The `no_style` method has been removed, use `appearance` instead.
2025-11-05 08:01:27 +00:00
Jason Lee
469b53178b form: Renamed column to columns. (#1522)
## Break Change

- Renamed `column` to `columns` and receive `usize` type.
2025-11-05 07:32:15 +00:00
Jason Lee
aea8223637 description_list: Renamed child to item, and add child to add DescriptionItem. (#1521)
## Break Change

- The original `child` method has been renamed to `item`.
- Now the add new `child` to accept a `DescriptionItem` type like the
`children` method.
2025-11-05 07:26:17 +00:00
Jason Lee
2093046942 clipboard: Removed content method from Clipboard. (#1520)
## Break Change

- The `content` method has been removed from `Clipboard`, if you want
display something, you can wrap it in a h_flex.
2025-11-05 07:17:58 +00:00
Jason Lee
0524c51b3e toggle: Refactor Toggle, ToggleGroup API. (#1515)
## Break Changes

- Refactor `Toggle` new API to require a `id`, and renamed `on_change`
to `on_click.
- Renamed `on_change` method to `on_click` for `ToggleGroup`.

```diff
- Toggle::label("Hello").id("hello").on_change(..)
+ Toggle::new("hello).label("Hello").on_click(..)

- ToggleGroup::new("group1).on_change(..)
+ ToggleGroup::new("group1).on_click(..)
```
2025-11-05 10:47:55 +08:00