@photonhealth/elements 0.10.1 → 0.10.3

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.
Files changed (4) hide show
  1. package/README.md +22 -41
  2. package/dist/index.js +267 -267
  3. package/dist/index.mjs +8208 -8102
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -1,44 +1,25 @@
1
- # Photon Web Components
2
-
3
- Photon's collection of customizable and reusable components to help clients integrate seamlessly with our system.
4
-
5
- ## Creating a WebComponent in SolidJS
6
-
7
- We utilize SolidJS ability (solid-element) to author a normal SolidJS component and transpile it to the WebComponent API (ref: [https://developer.mozilla.org/en-US/docs/Web/Web_Components](https://developer.mozilla.org/en-US/docs/Web/Web_Components)).
8
-
9
- A SolidJS WebComponent, at it’s most basic, looks like the following contained in an index.tsx:
10
-
11
- ```tsx
12
- //Shoelace
13
- import { customElement } from 'solid-element';
14
-
15
- //Styles
16
- import tailwind from '../tailwind.css?inline';
17
- import styles from './style.css?inline'; //Inline is required to encapsulate the styles below
18
-
19
- customElement(
20
- 'photon-my-first-component', // WebComponent Tag Name
21
- {
22
- disabled: false,
23
- loading: false,
24
- full: false
25
- }, // Default Props
26
- (props: { disabled: boolean; loading: boolean; full: boolean }, options) => {
27
- return (
28
- <>
29
- <style>{tailwind}</style>
30
- <style>{styles}</style>
31
- <div>
32
- <p class="text-blue-500">My first component</p>
33
- </div>
34
- </>
35
- );
36
- }
37
- );
1
+ # Photon Elements
2
+
3
+ Photon's collection of customizable and reusable components to help clients integrate seamlessly with our system. Elements can be used to add prescribing functionality into any web-based clinical tool.
4
+
5
+ ## Documentation
6
+
7
+ ### Installation
8
+
9
+ ```shell
10
+ npm i @photonhealth/elements
38
11
  ```
39
12
 
40
- The API centers around calling the `customElement` function:
13
+ ### Usage
14
+
15
+ ```javascript
16
+ import('@photonhealth/webcomponents').catch((err) => {});
17
+ ```
18
+
19
+ You can also import within the `head` tag in HTML:
20
+
21
+ ```html
22
+ <script src="https://cdn.rx.dev/elements/@latest/dist/index.js" type="module"></script>
23
+ ```
41
24
 
42
- - First Parameter is the WebComponent Tag Name. This is the name under which your component will be registered and usable from HTML. In this example, `photon-my-first-component`
43
- - Second Parameter is the default values of properties. If you have properties a user isn’t supposed to specify, you can declare the defaults here. Any properties that are not kebab case (e.g first-word) are transformed to kebab-case when passed from HTML/JSX (per WebComponent Spec Guidelines)
44
- - Third Parameter is a function of (props, options) ⇒ JSX.Element. NOTE: Do not de-structure `props` as in SolidJS this will make your properties (which are a Proxy object) lose reactivity. The second parameter, `options` contains a singular property `element` which gives you raw access to your DOM element created by this web-component. This is considered advanced functionality and rarely used (though I use it in our codebase and have examples of when it’s appropriate).
25
+ Full documentation of available elements and example configurations can be found here: [Photon Elements Documentation](https://docs.photon.health/docs/elements)