@purple/phoenix-components 5.0.0-beta.0 → 5.0.0-beta.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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [5.0.0-beta.1](https://github.com/purple-technology/phoenix-components/compare/v5.0.0-beta.0...v5.0.0-beta.1) (2023-02-13)
6
+
7
+
8
+ ### Features
9
+
10
+ * common design tokens for web and mobile ([e66d80b](https://github.com/purple-technology/phoenix-components/commit/e66d80b65a4c9e71ed83cbadbf7eb5bbc1268036))
11
+ * **Icon:** themeable filled icons ([3657d05](https://github.com/purple-technology/phoenix-components/commit/3657d050b2cd93654235b67bfbfdd059df5ab3a2))
12
+ * **Modal:** accept any CSS value for width prop ([2e6e483](https://github.com/purple-technology/phoenix-components/commit/2e6e48347bd67c3d8e396cf99e55d76a51f0168b))
13
+ * update tokens for specific components ([5669aef](https://github.com/purple-technology/phoenix-components/commit/5669aefb3fea99991086ec5faab67fbb9007bf50))
14
+
5
15
  ## [5.0.0-beta.0](https://github.com/purple-technology/phoenix-components/compare/v5.0.0-alpha.7...v5.0.0-beta.0) (2023-02-06)
6
16
 
7
17
 
package/README.md CHANGED
@@ -28,18 +28,16 @@ Phoenix Components takes advantage of some 3rd party libraries to create consist
28
28
 
29
29
  `npm i @purple/phoenix-components`
30
30
 
31
- ## Usage
31
+ ## Usage with default design tokens
32
32
 
33
- 1. Phoenix components use by default Mulish font with weights 400 and 600. If you want to use this default font, please add it to your project, using for example Google Fonts. (If you want to use different font family and/or different font weights, please refer to the section Customization.)
33
+ 1. Phoenix components use by default Mulish font with weights 400 and 600. If you want to use this default font, please add it to your project, using for example Google Fonts.
34
34
 
35
35
  ```html
36
36
  <link rel="preconnect" href="https://fonts.gstatic.com">
37
37
  <link href="https://fonts.googleapis.com/css2?family=Mulish:wght@400;600&display=swap" rel="stylesheet">
38
38
  ```
39
-
40
- 2. Import `Theme` from Phoenix Components and wrap the app in `<ThemeProvider>` from `styled-components` providing the `Theme` object. If your repository already contains custom `styled-components` theme, merge both themes together. If you're going to use overrides inside `$pc` key (see the Customization section), you need to use deep merge (e.g. `merge` from `lodash`).
41
-
42
- Also, import `<GlobalStyles>` component which provides styles such as default font and sizes, and include it once in your project.
39
+
40
+ 2. Import `Theme` from Phoenix Components and wrap the app in `<ThemeProvider>` from `styled-components` providing the `Theme` object. If your repository already contains custom `styled-components` theme, merge both themes together. Also, import `<GlobalStyles>` component which provides styles such as default font and sizes, and include it once in your project.
43
41
 
44
42
  ```typescript
45
43
  import merge from 'lodash/merge'
@@ -72,9 +70,9 @@ You can optionally include `dir` key in the theme with values either `'ltr'` or
72
70
  import { TextInput } from '@purple/phoenix-components'
73
71
  ```
74
72
 
75
- ## Customization
73
+ ## Components customization
76
74
 
77
- You can either extended the components with `styled-components`.
75
+ You can extend the components with `styled-components`.
78
76
  For example:
79
77
 
80
78
  ```typescript
@@ -86,24 +84,19 @@ const StyledInput = styled(TextInput)`
86
84
  `
87
85
  ```
88
86
 
89
- Or you can override the default properties inside the `$pc` object. In your own theme file, define the overrides as shown below, deep merge your theme file with the Phoenix theme file, and provide it to `ThemeProvider`.
87
+ ## Custom design tokens
88
+
89
+ Since version 5, Phoenix components use design tokens for styling. If you want to change appearance of the components you need to provide `ThemeProvider` with a custom set of tokens. This custom set of tokens should come as a JSON file. Afterwards all you need to do is merge default phoenix theme with your custom tokens. (Note: tokens reside within the theme object as a key `tokens`)
90
90
 
91
91
  ```typescript
92
- export const Theme = {
93
- ...
94
-
95
- // overriding phoenix components defaults
96
- $pc: {
97
- fontFamily: 'Mulish, sans-serif',
98
- fontWeight: {
99
- regular: 400,
100
- bold: 600
101
- }
102
- }
103
- }
92
+ import customTokens from './customTokens.json'
93
+
94
+ (...)
95
+
96
+ <ThemeProvider theme={merge(PhoenixTheme, { tokens: customTokens })}>
104
97
  ```
105
98
 
106
- For more information about what's possible to customize please refer directly to the file `src/theme.tsx`.
99
+ Previously (in v4), components were styled using object `$pc` within the theme file. This object is deprecated and will be removed in version 6.
107
100
 
108
101
  ## 🔼 Migration guide from v4 to v5
109
102
 
@@ -175,7 +168,7 @@ Spacings were also updated to be more consistent with other units. **However, th
175
168
  | xxxl | **3xl** |
176
169
 
177
170
  > #### What to do?
178
- > Since these changes are backwards-compatible, you don't have to do anything right now.
171
+ > Since these changes are backwards-compatible, you don't have to do anything right now. But from now on, use the new values. Also, only new values will be hinting in your editor.
179
172
 
180
173
  ### Button and Link Button
181
174
 
@@ -217,9 +210,12 @@ Prop `colorTheme` has been removed and there's only `color` prop now excepting a
217
210
 
218
211
  Props `colorTheme` and `light` removed and replaced with a simple `color` prop. This prop behaves similarly like prop `color` in Heading/Text/Paragraph components, ie. excepting all text colors (primary, secondary, tertiary, quaternary), color theme colors (brand, success, warning, error, info, neutral) and any valid CSS value.
219
212
 
213
+ Also, filled icons ending with -primary are now named as -brand, so instead of `icon="smartphone-primary"`, it's now `icon="smartphone-brand"` etc.
214
+
220
215
  > #### What to do?
221
216
  > - Search for all instances of Icon component and if there's a `light` prop, then just replace it with `color="white"`
222
217
  > - Search for all instances of Icon component and replace all `colorTheme` props with `color` (Note: If you haven't already done it before, replace values `primary` with `brand` - see the section Colors)
218
+ > - Search for all used filled brand icons. These icons were ending with `-primary`. You have to replace all `-primary` at the end with `-brand`
223
219
 
224
220
  ## 🔼 Migration guide from v3 to v4
225
221