bernova 1.7.5 → 1.7.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Merge pull request #35 from kubit-ui/feat/new-function-named-literals
8
+
3
9
  ## 1.7.5
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -45,6 +45,7 @@
45
45
  - [Complex Styles](#Complex-Styles)
46
46
  - [Foreign Feature](#Foreign-Feature)
47
47
  - [Dynamic Values Feature](#Dynamic-Values-Feature)
48
+ - [Literals Values Feature](#Literals-Values-Feature)
48
49
  - [Fonts](#setting-text-fonts)
49
50
  - [Reset CSS](#enable-reset-css)
50
51
  - [Typescript helps](#typescript-helps)
@@ -1108,6 +1109,50 @@ export const Container = ({ bgColor, borderColor, children }) => {
1108
1109
 
1109
1110
  In this case, only the styles for the header will be generated, and in the development tools, for _nav_item_ and _login_button_, the existing classes for BUTTON and LINK will be returned.
1110
1111
 
1112
+ ### Literals Values Feature
1113
+
1114
+ You might need to set a literal value in the component's styles object for Bernova. By default, it would be processed as a CSS class with its respective values. However, if that value is within the _$literals_ key, these values can be retrieved by the provider or set in the **cssClassNames** object.
1115
+
1116
+ ```js
1117
+ const BUTTON = {
1118
+ padding: '4px',
1119
+ border_radius: '8px',
1120
+ PRIMARY: {
1121
+ color: 'white',
1122
+ background: 'red',
1123
+ $literals: {
1124
+ loader_variant: 'loader-primary.json',
1125
+ },
1126
+ },
1127
+ SECONDARY: {
1128
+ color: 'black',
1129
+ background: 'gray',
1130
+ $literals: {
1131
+ loader_variant: 'loader-secondary.json',
1132
+ },
1133
+ },
1134
+ };
1135
+ ```
1136
+
1137
+ Example of implementation:
1138
+
1139
+ ```jsx
1140
+ import { useClassNames } from '@/hooks';
1141
+
1142
+ const Button = (props) => {
1143
+ const styles = useClassNames({ component: 'BUTTON', variant: 'PRIMARY' });
1144
+
1145
+ /**
1146
+ * styles = {
1147
+ * button: 'button button--primary',
1148
+ * loader_variant: 'loader-primary.json'
1149
+ * }
1150
+ */
1151
+ };
1152
+ ```
1153
+
1154
+ **Important**: Within literals, values can be of different primitive types: numbers, booleans, etc.
1155
+
1111
1156
  ## Access to classNames
1112
1157
 
1113
1158
  To use the generated CSS classes, you can use the name directly on the HTML element, as the library will return a valid CSS file.