@pine-ds/doc-components 0.0.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/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@pine-ds/doc-components",
3
+ "description": "Pine documentation components",
4
+ "author": "Kajabi Design System Services",
5
+ "version": "0.0.1",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "publishConfig": {
11
+ "access": "public",
12
+ "directory": "dist"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/Kajabi/pine.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/kajab/pine/issues"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "scripts": {
25
+ "build": "tsc && vite build",
26
+ "build.watch": "tsc && vite build --watch",
27
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
28
+ "prepublishOnly": "npm run build",
29
+ "preview": "vite preview",
30
+ "start": "npm run build.watch"
31
+ },
32
+ "peerDependencies": {
33
+ "react": "^18.2.0",
34
+ "react-dom": "^18.2.0"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^20.9.0",
38
+ "@types/react": "^18.2.37",
39
+ "@types/react-dom": "^18.2.15",
40
+ "@types/react-syntax-highlighter": "^15.5.11",
41
+ "@typescript-eslint/eslint-plugin": "^6.10.0",
42
+ "@typescript-eslint/parser": "^6.10.0",
43
+ "@vitejs/plugin-react": "^4.2.0",
44
+ "eslint": "^8.53.0",
45
+ "eslint-plugin-react-hooks": "^4.6.0",
46
+ "eslint-plugin-react-refresh": "^0.4.4",
47
+ "glob": "^10.3.10",
48
+ "react": "^18.2.0",
49
+ "react-dom": "^18.2.0",
50
+ "sass": "^1.69.5",
51
+ "typescript": "^5.2.2",
52
+ "vite": "^5.0.0",
53
+ "vite-plugin-dts": "^3.6.3",
54
+ "vite-plugin-lib-inject-css": "^1.3.0",
55
+ "vite-tsconfig-paths": "^4.2.1"
56
+ },
57
+ "sideEffects": [
58
+ "**/*.css"
59
+ ],
60
+ "dependencies": {
61
+ "markdown-to-jsx": "^7.3.2",
62
+ "react-syntax-highlighter": "^15.5.0"
63
+ }
64
+ }
package/readme.md ADDED
@@ -0,0 +1,62 @@
1
+ # Pine Doc Components
2
+
3
+ ## Background
4
+
5
+ We started off using Storybook to document our [Stencil Web Components](https://https://stenciljs.com). With Stencil you have framework integrations or Output Targets, we were using React. Instead of having multiple versions of Storybook (WebComponents, React, etc), we elected to recreate the common components we used within Storybook (ArgsTable and Canvas).
6
+
7
+ ## Components
8
+
9
+ ### docArgsTable
10
+ The docArgsTable component can be used to show a static table of arg types for a given component as a way to document its interface.
11
+
12
+ ### Properties
13
+
14
+ |name|description|
15
+ |---|----|
16
+ |docSource|The `docs-json` output type from Stencil. During compiliation Stencil will generate a JSON file with all of the components metadata. You can read more about docs-json [here](https://stenciljs.com/docs/docs-json). It expects the `components` key.|
17
+ |componentName|The name of the component to lookup.|
18
+
19
+
20
+
21
+ ### docCanvas
22
+ The Canvas component is a wrapper, featuring a series of buttons to view the various Source snippets.
23
+
24
+ #### Properties
25
+ |name|description|
26
+ |----|-----|
27
+ |mdxSource|An object of key/value pairs. Each key will render a button that will show the source code.|
28
+
29
+ ## How to use
30
+
31
+
32
+ ### docArgsTable
33
+ ```javascript
34
+ import { DocArgsTable } from '@pine-ds/doc-components';
35
+ import { components } from '../../../../dist/docs.json';
36
+
37
+ <DocArgsTable componentName='pds-radio' docSource={components} />
38
+ ```
39
+
40
+ **output**
41
+ ![Alt text](public/doc-args-table.png)
42
+
43
+ ### docCanvas
44
+
45
+ ```javascript
46
+ import { DocCanvas } from '@pine-ds/doc-components';
47
+
48
+ <DocCanvas mdxSource={{
49
+ react: `<PdsRadio componentId="message1" label="Label" helperMessage="This is short message text." />`,
50
+ webComponent: `<pds-radio component-id="message1" label="Label" helper-message="This is short message text." />`
51
+ }}>
52
+ <pds-radio component-id="message1" label="Label" helper-message="This is short message text." />
53
+ </DocCanvas>
54
+ ```
55
+
56
+ **output**
57
+
58
+ Default state
59
+ ![Alt text](public/doc-canvas-default-state.png)
60
+
61
+ Active Tab
62
+ ![Alt text](public/doc-canvas-active-tab.png)