Class: Plutonium::UI::Form::Theme

Inherits:
Phlexi::Form::Theme
  • Object
show all
Defined in:
lib/plutonium/ui/form/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
68
69
70
71
72
# File 'lib/plutonium/ui/form/theme.rb', line 7

def self.theme
  super.merge({
    base: "relative bg-white dark:bg-gray-800 shadow-md sm:rounded-lg my-3 p-6 space-y-6",
    fields_wrapper: "grid grid-cols-1 md:grid-cols-2 2xl:grid-cols-4 gap-4 grid-flow-row-dense",
    actions_wrapper: "flex justify-end space-x-2",
    wrapper: nil,
    inner_wrapper: "w-full",
    # errors
    form_errors_wrapper: "flex p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400",
    form_errors_message: "font-medium",
    form_errors_list: "mt-1.5 list-disc list-inside",
    # label themes
    label: "mt-2 block mb-2 text-base font-bold",
    invalid_label: "text-red-700 dark:text-red-500",
    valid_label: "text-green-700 dark:text-green-500",
    neutral_label: "text-gray-500 dark:text-gray-400",
    # input themes
    input: "w-full p-2 border rounded-md shadow-sm font-medium text-sm dark:bg-gray-700 focus:ring-2",
    invalid_input: "bg-red-50 border-red-500 dark:border-red-500 text-red-900 dark:text-red-500 placeholder-red-700 dark:placeholder-red-500 focus:ring-red-500 focus:border-red-500",
    valid_input: "bg-green-50 border-green-500 dark:border-green-500 text-green-900 dark:text-green-400 placeholder-green-700 dark:placeholder-green-500 focus:ring-green-500 focus:border-green-500",
    neutral_input: "border-gray-300 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white focus:ring-primary-500 focus:border-primary-500",
    # checkbox
    checkbox: "p-2 border rounded-md shadow-sm font-medium text-sm dark:bg-gray-700",
    # radio buttons
    radio_button: "p-2 border shadow-sm font-medium text-sm dark:bg-gray-700",
    # color
    color: "pu-color-input appearance-none bg-transparent border-none cursor-pointer w-10 h-10",
    invalid_color: nil,
    valid_color: nil,
    neutral_color: nil,
    # file
    # file: "w-full border rounded-md shadow-sm font-medium text-sm dark:bg-gray-700 focus:outline-none",
    file: "w-full border rounded-md shadow-sm font-medium text-sm dark:bg-gray-700 border-gray-300 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white focus:ring-primary-500 focus:border-primary-500 focus:outline-none focus:ring-2 [&::file-selector-button]:mr-3 [&::file-selector-button]:px-4 [&::file-selector-button]:py-2 [&::file-selector-button]:bg-gray-50 [&::file-selector-button]:border-0 [&::file-selector-button]:rounded-l-md [&::file-selector-button]:text-sm [&::file-selector-button]:font-medium [&::file-selector-button]:text-gray-700 [&::file-selector-button]:hover:bg-gray-100 [&::file-selector-button]:cursor-pointer dark:[&::file-selector-button]:bg-gray-600 dark:[&::file-selector-button]:text-gray-200 dark:[&::file-selector-button]:hover:bg-gray-500",
    # hint themes
    hint: "mt-2 text-sm text-gray-500 dark:text-gray-200 whitespace-pre",
    # error themes
    error: "mt-2 text-sm text-red-600 dark:text-red-500",
    # button themes
    button: "px-4 py-2 bg-primary-600 text-white rounded-md hover:bg-primary-700 focus:outline-none focus:ring-2 focus:ring-primary-500",
    # flatpickr
    flatpickr: :input,
    valid_flatpickr: :valid_input,
    invalid_flatpickr: :invalid_input,
    neutral_flatpickr: :neutral_input,
    # int_tel_input
    int_tel_input: :input,
    valid_int_tel_input: :valid_input,
    invalid_int_tel_input: :invalid_input,
    neutral_int_tel_input: :neutral_input,
    uppy: :file,
    valid_uppy: :valid_file,
    invalid_uppy: :invalid_file,
    neutral_uppy: :neutral_file,

    association: :select,
    valid_association: :valid_select,
    invalid_association: :invalid_select,
    neutral_association: :neutral_select,

    polymorpic_association: :association,
    valid_polymorpic_association: :valid_association,
    invalid_polymorpic_association: :invalid_association,
    neutral_polymorpic_association: :neutral_association

  })
end