Class: Plutonium::UI::Display::Theme

Inherits:
Phlexi::Display::Theme
  • Object
show all
Defined in:
lib/plutonium/ui/display/theme.rb

Class Method Summary collapse

Class Method Details

.themeObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/plutonium/ui/display/theme.rb', line 7

def self.theme
  super.merge({
    base: "",
    value_wrapper: "max-h-[300px] overflow-y-auto",
    # Merged into the fields_wrapper's Block, which supplies `pu-card`
    # itself — this is only for anything a caller wants to add on top.
    fields_wrapper: nil,
    fields_inner: "pu-card-body grid grid-cols-1 md:grid-cols-2 2xl:grid-cols-4 gap-x-8 gap-y-6 grid-flow-row-dense",

    # display_layout sectioning. `sections_wrapper` replaces
    # `fields_inner` as the card's inner padding box when a layout is
    # declared (it stacks sections instead of fields directly), and
    # each section's field grid uses `section_grid` — the same grid as
    # `fields_inner` without the padding, which the wrapper now owns.
    # Split into their own keys so overriding one path doesn't
    # silently reshape the other.
    # Sections are their OWN cards (see Component::Section), so this
    # only has to stack them — no card, no padding of its own.
    sections_wrapper: "space-y-4",
    section_grid: "grid grid-cols-1 md:grid-cols-2 2xl:grid-cols-4 gap-x-8 gap-y-6 grid-flow-row-dense",

    # Section chrome (heading, accent, divider, collapsible caret).
    # Shared defaults with the form so both read the same; override any
    # key here to restyle show-page sections alone.
    **Plutonium::UI::Component::Section::DEFAULT_THEME,

    # Labels and descriptions
    label: "text-sm font-semibold uppercase tracking-wide text-[var(--pu-text-muted)] mb-2",
    description: "text-sm text-[var(--pu-text-subtle)]",
    placeholder: "text-lg text-[var(--pu-text-subtle)] italic",

    # Value types
    string: "text-lg text-[var(--pu-text)] whitespace-pre-line leading-relaxed",
    text: "text-lg text-[var(--pu-text)] whitespace-pre-line leading-relaxed",
    link: "text-lg text-primary-600 dark:text-primary-400 hover:text-primary-500 dark:hover:text-primary-300 whitespace-pre-line transition-colors",

    # Color display
    color: "flex items-center text-lg text-[var(--pu-text)] whitespace-pre-line",
    color_indicator: "w-10 h-10 rounded-lg mr-3 shadow-sm border border-[var(--pu-border)]",

    # Boolean / badge pills — variant class is applied by the component.
    boolean: "",
    badge: "",
    currency: "text-lg text-[var(--pu-text)] tabular-nums",

    # Contact info
    email: "flex items-center gap-2 text-lg text-primary-600 dark:text-primary-400 hover:text-primary-500 transition-colors",
    phone: "flex items-center gap-2 text-lg text-primary-600 dark:text-primary-400 hover:text-primary-500 transition-colors",

    # Structured content
    json: "text-sm text-[var(--pu-text)] whitespace-pre font-mono bg-[var(--pu-surface-alt)] border border-[var(--pu-border-muted)] rounded-[var(--pu-radius-md)] p-4 overflow-x-auto",
    prefixed_icon: "w-6 h-6 mr-2 text-[var(--pu-text-muted)]",
    markdown: "format dark:format-invert format-primary max-w-none",

    # Attachments
    attachment_value_wrapper: "grid grid-cols-[repeat(auto-fill,minmax(0,200px))] gap-4",

    # Render delegation
    phlexi_render: :string
  })
end