@mobielnl/elements 0.3.1 → 0.5.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 +30 -1
- package/dist/elements.css +1 -1
- package/dist/elements.js +9 -8
- package/dist/elements.umd.cjs +431 -103
- package/dist/{index-CnFEAbFx.js → index-Bqq_Hib9.js} +28920 -25378
- package/dist/index-D18KRxRT.js +2382 -0
- package/dist/index.d.ts +227 -130
- package/package.json +26 -17
- package/dist/index-BN9HDB-5.js +0 -2597
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Only Websend developers can currently contribute. See [Contributing Guide](https
|
|
|
14
14
|
|
|
15
15
|
### For React projects
|
|
16
16
|
|
|
17
|
-
You will need Node.js 18+ and React
|
|
17
|
+
You will need Node.js 18+ and React 19+.
|
|
18
18
|
|
|
19
19
|
#### Install with your preferred package manager (pnpm, npm, yarn, bun, etc.)
|
|
20
20
|
|
|
@@ -45,6 +45,35 @@ All CSS styling is scoped to this `<ElementsRoot>` wrapper, which is essentially
|
|
|
45
45
|
|
|
46
46
|
Components nested within this wrapper will inherit the styling. This is done so that it does not overwrite other CSS styling.
|
|
47
47
|
|
|
48
|
+
#### Shadow DOM (optional)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
You can opt in for a Shadow DOM to isolate the CSS from your application's global styles.
|
|
52
|
+
|
|
53
|
+
It is possible to inject a CSS string or CSS path url into the Shadow DOM. The `withShadowDOM` prop accepts:
|
|
54
|
+
- `true` - Enables Shadow DOM without injecting CSS (for advanced use-cases)
|
|
55
|
+
- `{ cssUrl: string }` - Enables Shadow DOM and injects a stylesheet from the provided URL
|
|
56
|
+
- `{ css: string }` - Enables Shadow DOM and injects CSS from a string
|
|
57
|
+
|
|
58
|
+
**Important**: When using Shadow DOM, you must provide a CSS URL or string that points to the Elements CSS so styles render inside the shadow root.
|
|
59
|
+
|
|
60
|
+
```css
|
|
61
|
+
/* File: elements.css */
|
|
62
|
+
@import "@mobielnl/elements/style.css";
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import { ElementsRoot, ProductResults } from "@mobielnl/elements";
|
|
67
|
+
|
|
68
|
+
export default function Example() {
|
|
69
|
+
return (
|
|
70
|
+
<ElementsRoot withShadowDOM={{ cssUrl: "/elements.css" }}>
|
|
71
|
+
<ProductResults />
|
|
72
|
+
</ElementsRoot>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
48
77
|
#### Custom Styling with Tailwind CSS
|
|
49
78
|
|
|
50
79
|
You can customize component styling using the `classNames` prop.
|