@bigbinary/neeto-themes-frontend 2.2.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # neeto-themes-nano
2
2
 
3
- The `neeto-themes-nano` allows us to build and use themes within neeto applications. This nano exports `@bigbinary/neeto-themes-frontend` NPM package and `neeto-themes-engine` Rails engine.
3
+ The `neeto-themes-nano` allows us to build and use themes within neeto
4
+ applications. This nano exports `@bigbinary/neeto-themes-frontend` NPM package
5
+ and `neeto-themes-engine` Rails engine.
4
6
 
5
7
  ## Contents
6
8
 
@@ -52,25 +54,29 @@ The `neeto-themes-nano` allows us to build and use themes within neeto applicati
52
54
 
53
55
  5. Add the following line to `models/organization.rb` file.
54
56
 
55
- ```ruby
56
- has_many :themes, class_name: "NeetoThemesEngine::Theme", as: :owner
57
- ```
57
+ ```ruby
58
+ has_many :themes, class_name: "NeetoThemesEngine::Theme", as: :owner
59
+ ```
60
+
58
61
  6. Configure model to add below association to attach theme.
59
62
 
60
- ```ruby
61
- has_one :theme_entity, as: :themeable, class_name: "NeetoThemesEngine::ThemeEntity", dependent: :destroy
62
- has_one :theme, through: :theme_entity, class_name: "NeetoThemesEngine::Theme"
63
- ```
63
+ ```ruby
64
+ has_one :theme_entity, as: :themeable, class_name: "NeetoThemesEngine::ThemeEntity", dependent: :destroy
65
+ has_one :theme, through: :theme_entity, class_name: "NeetoThemesEngine::Theme"
66
+ ```
64
67
 
65
68
  ### Usage
66
69
 
67
70
  1. **Create an engine initializer**
68
71
 
69
- Create a file named `neeto_themes_engine.rb` in the `config/initializers` folder.
72
+ Create a file named `neeto_themes_engine.rb` in the `config/initializers`
73
+ folder.
70
74
 
71
75
  2. **Customize theme schema**
72
76
 
73
- The engine supports customizing theme schemas based on the needs of the host application. This schema will be used in the frontend to render the theme properties. Eg:
77
+ The engine supports customizing theme schemas based on the needs of the host
78
+ application. This schema will be used in the frontend to render the theme
79
+ properties. Eg:
74
80
 
75
81
  ```ruby
76
82
  NeetoThemesEngine.theme_properties_schema = [
@@ -79,42 +85,54 @@ The `neeto-themes-nano` allows us to build and use themes within neeto applicati
79
85
  ]
80
86
  ```
81
87
 
82
- Each object in the array should have the following keys:
83
- - `key`: The unique identifier for the theme property.
88
+ Each object in the array should have the following keys:
84
89
 
85
- - `kind`: The kind of the theme property.
90
+ - `key`: The unique identifier for the theme property.
86
91
 
87
- Optional keys that can be included:
92
+ - `kind`: The kind of the theme property.
88
93
 
89
- - `default_value`: Sets a default value when creating a new theme.
94
+ Optional keys that can be included:
90
95
 
91
- - `hidden`: This boolean prop helps to hide the property from the UI but allows to use it as CSS variable.
96
+ - `default_value`: Sets a default value when creating a new theme.
92
97
 
93
- - `depends_on`: Provides a dependency on other properties. If a key is provided, it will check for its value and only appear in the UI if the dependent property is present.
98
+ - `hidden`: This boolean prop helps to hide the property from the UI but
99
+ allows to use it as CSS variable.
100
+
101
+ - `depends_on`: Provides a dependency on other properties. If a key is
102
+ provided, it will check for its value and only appear in the UI if the
103
+ dependent property is present.
104
+
105
+ - `parent_class`: This key needs to be added for custom css feature to work
106
+ properly. See more on [custom css](#custom-css) feature.
94
107
 
95
108
  3. **Provide a css variable prefix**
96
109
 
97
- This value will be used to prefix all CSS variables. Eg:
110
+ This value will be used to prefix all CSS variables. Eg:
111
+
112
+ ```ruby
113
+ NeetoThemesEngine.css_variable_prefix = "neeto-cal"
114
+ ```
98
115
 
99
- ```ruby
100
- NeetoThemesEngine.css_variable_prefix = "neeto-cal"
101
- ```
102
- variable generated for the theme property `primary_color` will be `--neeto-cal-primary-color`.
116
+ variable generated for the theme property `primary_color` will be
117
+ `--neeto-cal-primary-color`.
103
118
 
104
119
  4. **Provide the entities to which the theme property is attached**
105
120
 
106
- This value will be used to determine the entity to which the theme property is attached. We can provide multiple entities. Eg:
121
+ This value will be used to determine the entity to which the theme property
122
+ is attached. We can provide multiple entities. Eg:
123
+
124
+ ```ruby
125
+ NeetoThemesEngine.valid_themeable_types = ["Meeting", "Booking"]
126
+ ```
107
127
 
108
- ```ruby
109
- NeetoThemesEngine.valid_themeable_types = ["Meeting", "Booking"]
110
- ```
111
128
  5. **Provide a default theme name** (Optional)
112
129
 
113
- This provided value will be used to identify the default theme. If not provided, the default theme will be named "Plain blue".
130
+ This provided value will be used to identify the default theme. If not
131
+ provided, the default theme will be named "Plain blue".
114
132
 
115
- ```ruby
116
- NeetoThemesEngine.default_theme_name = "My theme"
117
- ```
133
+ ```ruby
134
+ NeetoThemesEngine.default_theme_name = "My theme"
135
+ ```
118
136
 
119
137
  ### Frontend package
120
138
 
@@ -127,13 +145,17 @@ The `neeto-themes-nano` allows us to build and use themes within neeto applicati
127
145
  ```
128
146
 
129
147
  ### Instructions for development
130
- Check the [Frontend package development guide](https://neeto-engineering.neetokb.com/p/a-d34cb4b0) for step-by-step instructions to develop the frontend package.
148
+
149
+ Check the
150
+ [Frontend package development guide](https://neeto-engineering.neetokb.com/p/a-d34cb4b0)
151
+ for step-by-step instructions to develop the frontend package.
131
152
 
132
153
  ### Usage
133
154
 
134
155
  #### Components
135
156
 
136
- 1. Import the `NeetoThemesBuilder` component from `@bigbinary/neeto-themes-frontend`:
157
+ 1. Import the `NeetoThemesBuilder` component from
158
+ `@bigbinary/neeto-themes-frontend`:
137
159
 
138
160
  ```javascript
139
161
  import React from "react";
@@ -150,6 +172,7 @@ Check the [Frontend package development guide](https://neeto-engineering.neetokb
150
172
  );
151
173
 
152
174
  export default App;
175
+ ```
153
176
 
154
177
  #### hooks
155
178
 
@@ -158,15 +181,30 @@ Check the [Frontend package development guide](https://neeto-engineering.neetokb
158
181
  ```javascript
159
182
  import { useThemeUtils } from "@bigbinary/neeto-themes-frontend";
160
183
 
161
- const { setTheme,previewingTheme, currentTheme } = useThemeUtils();
184
+ const { setTheme, previewingTheme, currentTheme } = useThemeUtils();
162
185
  ```
163
186
 
164
- - `setTheme`: This method is used to set the theme for the entity.
187
+ - `setTheme`: This method is used to set the theme for the entity.
188
+
189
+ - `previewingTheme`: This object contains the currently previewing theme.
165
190
 
166
- - `previewingTheme`: This object contains the currently previewing theme.
191
+ - `currentTheme`: This object contains the current theme which is applied to the
192
+ entity.
167
193
 
168
- - `currentTheme`: This object contains the current theme which is applied to the entity.
194
+ ### Custom CSS
169
195
 
196
+ `neeto-themes-nano` will inject custom css into your application as part of a
197
+ theme. It requires the initializer to be set with the additional property
198
+ `{ kind: "custom_css", key: "custom_css", default_value: "", parent_class: "neeto-form-eui" }`.
199
+ The `parent_class` key will be used as a parent to inject styles and for CSS
200
+ nesting. This ensures that styles are not injected on pages where you do not
201
+ want it and also ensures that style rules targeting elements outside this class
202
+ will not be applied. Please ensure that the value provided to `parent_class` is
203
+ present in your application as a wrapper CSS class. For example:
204
+ `neeto-form-eui` in neetoForm is present in all external pages where theme needs
205
+ to be applied. It also provides a code editor with syntax highlighting which
206
+ depends on [Monaco editor](https://github.com/suren-atoyan/monaco-react) as a
207
+ peer dependency. Please install it in the host application for proper working.
170
208
 
171
209
  ## Instructions for Publishing
172
210
 
@@ -11,7 +11,7 @@
11
11
  "recording_other": "Recordings"
12
12
  },
13
13
  "common": {
14
- "design": "Design",
14
+ "theme": "Theme",
15
15
  "preview": "Preview",
16
16
  "save": "Save",
17
17
  "done": "Done",
@@ -33,9 +33,12 @@
33
33
  "saveChanges": "Save changes",
34
34
  "addNewTheme": "Add new theme",
35
35
  "backToThemes": "Back to themes",
36
+ "backToEdit": "Back to edit",
36
37
  "save": "Save",
37
38
  "reset": "Reset",
38
- "applyThisTheme": "Apply this theme"
39
+ "applyThisTheme": "Apply this theme",
40
+ "expandEditor": "Expand editor",
41
+ "minimizeEditor": "Minimize editor"
39
42
  },
40
43
  "alerts": {
41
44
  "title": {
@@ -57,7 +60,12 @@
57
60
  "customThemes": "Custom themes",
58
61
  "themeOptions": {
59
62
  "clone": "Clone",
60
- "delete": "Delete"
63
+ "delete": "Delete",
64
+ "setAsGlobalTheme": {
65
+ "label": "Set as global theme",
66
+ "helpText": "Enabling this will set this theme as the default theme, automatically applying it to all your future {{entityType}}s.",
67
+ "tooltipContent": "This theme is currently set as the global theme. Select another theme to change it."
68
+ }
61
69
  },
62
70
  "themeCard": {
63
71
  "primary": "Primary",
@@ -72,6 +80,7 @@
72
80
  "title": "New theme",
73
81
  "newThemeName": "My theme"
74
82
  },
83
+ "customCSS": "Custom CSS",
75
84
  "themeCloned": "Theme has been cloned successfully.",
76
85
  "themeCloneFailed": "Failed to clone theme, please try after some time."
77
86
  }