gpui_form_component/
lib.rs1#[cfg(feature = "derive")]
9pub use gpui_form_component_derive::InfiniteSelect;
10
11mod calendar;
12mod calendar_navigation;
13
14pub mod date_picker;
16
17pub mod file_picker;
19
20pub mod i18n;
22
23pub mod infinite_select;
25
26#[doc(hidden)]
32pub mod __macro_support {
33 pub use gpui_es_fluent::{localize_label, localize_message};
34}
35
36#[cfg(all(test, feature = "component-shape"))]
37mod tests {
38 use std::path::PathBuf;
39
40 use component_shape::DeclaredComponentShape;
41 use gpui_form_runtime::shape::{
42 GpuiComponentEventOf, GpuiComponentShape, GpuiComponentShapeFor, GpuiComponentStateOf,
43 GpuiComponentValueBinding, GpuiFormComponentShapePolicy,
44 };
45 use gpui_kit::EventEmitter;
46
47 use crate::{
48 date_picker::{DatePicker, DateRangePicker},
49 file_picker::FilePicker,
50 };
51
52 fn assert_declared_shape<Shape>()
53 where
54 Shape: DeclaredComponentShape + GpuiComponentShape + GpuiFormComponentShapePolicy,
55 {
56 }
57
58 fn assert_shape_for<Shape, Value>()
59 where
60 Shape: GpuiComponentShapeFor<Value>,
61 {
62 }
63
64 fn assert_value_binding<Shape, Value>()
65 where
66 Shape: GpuiComponentValueBinding<Value>,
67 GpuiComponentStateOf<Shape>: EventEmitter<GpuiComponentEventOf<Shape, Value>>,
68 {
69 }
70
71 #[test]
72 fn component_shape_feature_publishes_runtime_component_contracts() {
73 assert_declared_shape::<DatePicker>();
74 assert_shape_for::<DatePicker, chrono::NaiveDate>();
75 assert_value_binding::<DatePicker, chrono::NaiveDate>();
76
77 assert_declared_shape::<DateRangePicker>();
78 assert_shape_for::<DateRangePicker, (chrono::NaiveDate, chrono::NaiveDate)>();
79 assert_value_binding::<DateRangePicker, (chrono::NaiveDate, chrono::NaiveDate)>();
80
81 assert_declared_shape::<FilePicker>();
82 assert_shape_for::<FilePicker, Vec<PathBuf>>();
83 assert_value_binding::<FilePicker, Vec<PathBuf>>();
84 }
85}