Skip to main content

tablo_ui/
lib.rs

1//! Renders the styled components `tablo-core` uses; apps depend on this crate
2//! instead of running `topcoat ui add`.
3
4pub mod components;
5pub mod icons;
6
7// The primitives under `components/primitives/` are copied verbatim from `topcoat-ui-registry`
8// (sync with `cargo xtask sync-topcoat-ui`); owned code lives in `components/composites/`.
9//
10// The components that carry Tablo's look are Tablo's own, in `composites/`; of the primitives,
11// only the ones a custom page builds from are public API. The rest are `#[doc(hidden)]`:
12// `tablo-core` renders with them, but a registry change to them never moves Tablo's semver. The
13// sync's `PUBLIC_PRIMITIVES` list decides which is which.
14#[doc(hidden)]
15pub use components::primitives::{
16    alert_dialog::alert_dialog,
17    avatar::{AvatarSize, avatar, avatar_fallback, avatar_image},
18    breadcrumb::{
19        breadcrumb, breadcrumb_ellipsis, breadcrumb_item, breadcrumb_link, breadcrumb_list,
20        breadcrumb_page, breadcrumb_separator,
21    },
22    dialog::{
23        dialog, dialog_content, dialog_description, dialog_footer, dialog_header, dialog_title,
24    },
25    dropdown_menu::{
26        dropdown_menu, dropdown_menu_content, dropdown_menu_item, dropdown_menu_label,
27        dropdown_menu_separator, dropdown_menu_sub, dropdown_menu_sub_content,
28        dropdown_menu_sub_trigger, dropdown_menu_trigger,
29    },
30    floating::{FLOATING_SCOPE, FloatingAlign, FloatingAnchor, FloatingSide, floating_variants},
31    pagination::{
32        pagination, pagination_content, pagination_ellipsis, pagination_item, pagination_link,
33        pagination_next, pagination_previous,
34    },
35    sheet::{SheetSide, sheet, sheet_content},
36    sidebar::{
37        SidebarCollapsible, SidebarMenuButtonSize, SidebarMenuButtonVariant, SidebarSide,
38        SidebarVariant, sidebar, sidebar_content, sidebar_footer, sidebar_group,
39        sidebar_group_action, sidebar_group_content, sidebar_group_label, sidebar_header,
40        sidebar_input, sidebar_inset, sidebar_menu, sidebar_menu_action, sidebar_menu_badge,
41        sidebar_menu_button, sidebar_menu_button_variants, sidebar_menu_item,
42        sidebar_menu_skeleton, sidebar_menu_sub, sidebar_menu_sub_button, sidebar_menu_sub_item,
43        sidebar_provider, sidebar_rail, sidebar_separator, sidebar_trigger,
44    },
45};
46pub use components::{
47    composites::{
48        alert::{AlertVariant, alert, alert_description, alert_title},
49        badge::{BadgeVariant, badge, badge_variants},
50        button::{ButtonSize, ButtonVariant, button, button_variants},
51        card::{card, card_content, card_description, card_footer, card_header, card_title},
52        controls::{checkbox, input, radio_group, radio_group_item, switch, textarea},
53        empty_state::empty_state,
54        error_state::error_state,
55        page::{page, page_actions, page_content, page_description, page_header, page_title},
56        select::select,
57        stat::stat,
58        table::{
59            table, table_body, table_caption, table_cell, table_footer, table_head, table_header,
60            table_row,
61        },
62        toast::{
63            toast, toast_close, toast_content, toast_description, toast_icon, toast_title, toaster,
64        },
65    },
66    primitives::{
67        field::{
68            FieldLegendVariant, FieldOrientation, field, field_content, field_description,
69            field_error, field_group, field_label, field_legend, field_separator, field_set,
70            field_title,
71        },
72        label::label,
73        separator::{SeparatorOrientation, separator},
74        skeleton::skeleton,
75    },
76};
77
78/// Tablo's prebuilt stylesheet: Tailwind over Tablo's own sources on the default theme, for
79/// `Panel::shell_assets`. It styles every panel page and none of the app's own classes; an app
80/// that changes a token or writes Tailwind classes builds its own with `tablo_build::tailwind()`.
81pub const DEFAULT_STYLESHEET: topcoat::asset::Asset = topcoat::asset::asset!("../assets/tablo.css");
82pub const SIDEBAR_JS: topcoat::asset::Asset = topcoat::asset::asset!("../assets/sidebar.js");
83pub const THEME_JS: topcoat::asset::Asset = topcoat::asset::asset!("../assets/theme.js");
84pub const SELECTS_JS: topcoat::asset::Asset = topcoat::asset::asset!("../assets/selects.js");
85pub const REPEATERS_JS: topcoat::asset::Asset = topcoat::asset::asset!("../assets/repeaters.js");
86pub const FILE_LISTS_JS: topcoat::asset::Asset = topcoat::asset::asset!("../assets/file_lists.js");
87pub const PASSWORD_JS: topcoat::asset::Asset = topcoat::asset::asset!("../assets/password.js");
88pub const TABS_JS: topcoat::asset::Asset = topcoat::asset::asset!("../assets/tabs.js");
89pub const WIZARD_JS: topcoat::asset::Asset = topcoat::asset::asset!("../assets/wizard.js");
90pub const FORMS_JS: topcoat::asset::Asset = topcoat::asset::asset!("../assets/forms.js");
91pub const RICH_TEXT_JS: topcoat::asset::Asset = topcoat::asset::asset!("../assets/rich_text.js");
92pub const SEARCH_SHORTCUT_JS: topcoat::asset::Asset =
93    topcoat::asset::asset!("../assets/search_shortcut.js");
94pub const CHOICE_CREATE_JS: topcoat::asset::Asset =
95    topcoat::asset::asset!("../assets/choice_create.js");
96/// The TipTap bundle `rich_text.js` imports where a page holds a rich text control (ADR-0032):
97/// no page loads it otherwise.
98pub const TIPTAP_JS: topcoat::asset::Asset = topcoat::asset::asset!("../assets/tiptap/tiptap.js");
99
100/// Schibsted Grotesk, the Ledger theme's text and display face: a variable font, weights 400 to
101/// 900, latin subset, under the SIL Open Font License 1.1 (`assets/fonts/`).
102pub const SCHIBSTED_GROTESK: topcoat::asset::Asset =
103    topcoat::asset::asset!("../assets/fonts/schibsted-grotesk.woff2");
104/// Martian Mono, the Ledger theme's caption face: a variable font, weights 100 to 800, latin
105/// subset, under the SIL Open Font License 1.1 (`assets/fonts/`).
106pub const MARTIAN_MONO: topcoat::asset::Asset =
107    topcoat::asset::asset!("../assets/fonts/martian-mono.woff2");
108
109/// The scripts every panel page loads, in order.
110pub const SHELL_SCRIPTS: [topcoat::asset::Asset; 12] = [
111    SIDEBAR_JS,
112    THEME_JS,
113    SELECTS_JS,
114    CHOICE_CREATE_JS,
115    REPEATERS_JS,
116    FILE_LISTS_JS,
117    PASSWORD_JS,
118    TABS_JS,
119    WIZARD_JS,
120    FORMS_JS,
121    RICH_TEXT_JS,
122    SEARCH_SHORTCUT_JS,
123];