@takecasper/acuity-design-system 1.10.1 → 1.12.0

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
@@ -5,6 +5,7 @@ This is the official repository for the new Acuity design system.
5
5
  ## Storybook
6
6
 
7
7
  Hosted Storybook can be access from [Storybook (Main branch)](https://main--6603321f619950844820974b.chromatic.com/)
8
+
8
9
  - You can also access a different branch using: https://[BRANCH_NAME]--6603321f619950844820974b.chromatic.com/
9
10
 
10
11
  You can also access Storybook locally once you setup this repo, instruction can be found under section IDE Setup > Quick Start.
@@ -117,6 +118,8 @@ Certain changes don't need to trigger lib publishing, such as adding new stories
117
118
 
118
119
  ### Styling with Tailwind
119
120
 
121
+ #### Prepend utility classes with `ds-`
122
+
120
123
  We are having an internal convention to style all components using `ds-` prefix. The reason for this is to avoid conflicting classes in projects that are using design system library.
121
124
  The prefix option lets us configure a prefix we want added to the beginning of every Tailwind class to avoid conflicts.
122
125
  But if you enable it, you need to make sure you actually use that prefix in your HTML files.
@@ -128,6 +131,16 @@ For pseudo-classes, the `ds` prefix should be appended after the pseudo-class in
128
131
 
129
132
  [Reason for this](https://github.com/tailwindlabs/tailwindcss/discussions/9824).
130
133
 
134
+ #### Add `preflight` class to component wrappers
135
+
136
+ Tailwind includes a useful set of base styles out of the box that they call [Preflight](https://v1.tailwindcss.com/docs/preflight), which is basically just [normalize.css](https://github.com/necolas/normalize.css/) plus a thin layer of additional more opinionated styles.
137
+
138
+ Since these styles are usually targeting elements, and root html scope, once that css is bundled with our component library this exported CSS might interfere with the styling of the html elements in other projects the library is being used in. This specifically creates conflicts in projects where Tailwind CSS is not the CSS library of choice and where the global styling/or base styling looks different than what Tailwind team decided to do in Tailwind Base/aka Preflight.
139
+
140
+ We decided on using [`tailwindcss-scoped-preflight`](https://github.com/Roman86/tailwindcss-scoped-preflight) Tailwind plugin, that disables the preflight on the global level and enables it on the scoped level. This plugin is limiting the scope of Tailwind's opinionated preflight styles to the customizable CSS selector. In that way we can control where exactly in DOM to apply these base styles - usually it's our own components (not the 3rd party).
141
+ We are using `isolateForComponents` strategy and added a selector `preflight`.
142
+ We should add this class for the wrapper element of the new components being added to the library to enable Tailwinds base styles.
143
+
131
144
  ### Adding new components
132
145
 
133
146
  For easier development and conditional rendering of tailwind's utility classes it is recommended to use the following 3 libraries when adding new components: