@hotosm/ui 0.1.0 → 0.2.0-a1

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
@@ -1,8 +1,50 @@
1
- # HOT Shared UI Components
1
+ # HOT Shared UI
2
2
 
3
- Shared React components with theming for use across HOTOSM tools,
3
+ <!-- markdownlint-disable -->
4
+ <p align="center">
5
+ <img src="https://github.com/hotosm/fmtm/blob/main/images/hot_logo.png?raw=true" style="width: 200px;" alt="HOT"></a>
6
+ </p>
7
+ <p align="center">
8
+ <em>Shared Web Components with theming for use across HOTOSM tools.</em>
9
+ </p>
10
+ <p align="center">
11
+ <a href="https://github.com/hotosm/ui/actions/workflows/publish.yml" target="_blank">
12
+ <img src="https://github.com/hotosm/ui/actions/workflows/publish.yml/badge.svg" alt="Publish">
13
+ </a>
14
+ <a href="https://github.com/hotosm/ui/actions/workflows/cdn_deploy.yml" target="_blank">
15
+ <img src="https://github.com/hotosm/ui/actions/workflows/cdn_deploy.yml/badge.svg?branch=main" alt="CDN Deploy">
16
+ </a>
17
+ <a href="https://github.com/hotosm/ui/actions/workflows/docs.yml" target="_blank">
18
+ <img src="https://github.com/hotosm/ui/actions/workflows/docs.yml/badge.svg" alt="Publish Docs">
19
+ </a>
20
+ <a href="https://www.npmjs.com/package/@hotosm/ui" target="_blank">
21
+ <img src="https://img.shields.io/npm/v/%40hotosm/ui?color=334D058"
22
+ alt="Package version">
23
+ </a>
24
+ <a href="https://npmtrends.com/@hotosm/ui" target="_blank">
25
+ <img src="https://img.shields.io/npm/dm/%40hotosm%2Fui"
26
+ alt="Downloads">
27
+ </a>
28
+ <a href="https://github.com/hotosm/ui/blob/main/LICENSE.md" target="_blank">
29
+ <img src="https://img.shields.io/github/license/hotosm/ui.svg" alt="License">
30
+ </a>
31
+ </p>
32
+
33
+ 📖 **Documentation**: <a href="https://hotosm.github.io/ui/" target="_blank">https://hotosm.github.io/ui/</a>
34
+
35
+ 🖥️ **Source Code**: <a href="https://github.com/hotosm/ui" target="_blank">https://github.com/hotosm/ui</a>
36
+
37
+ ---
38
+
39
+ <!-- markdownlint-enable -->
40
+
41
+ Shared UI components with theming for use across HOTOSM tools,
4
42
  to reduce code duplication.
5
43
 
44
+ The components are
45
+ [Web Components](https://developer.mozilla.org/en-US/docs/Web/API/Web_components),
46
+ currently written in **Lit**, using TypeScript.
47
+
6
48
  ## Install
7
49
 
8
50
  Via NPM:
@@ -10,11 +52,64 @@ Via NPM:
10
52
  ```bash
11
53
  npm install @hotosm/ui
12
54
 
13
- yarn install @hotosm/ui
55
+ yarn add @hotosm/ui
14
56
 
15
57
  pnpm install @hotosm/ui
16
58
  ```
17
59
 
18
60
  ## Usage
19
61
 
20
- TBC
62
+ ### HTML / HTMX
63
+
64
+ ```html
65
+ // Import the components
66
+ <script
67
+ type="module"
68
+ src="https://s3.amazonaws.com/hotosm-ui/latest/ui.js"
69
+ ></script>
70
+
71
+ // Import the styles (or create your own)
72
+ <link
73
+ rel="stylesheet"
74
+ href="https://s3.amazonaws.com/hotosm-ui/latest/style.css"
75
+ />
76
+
77
+ <div>
78
+ <hot-button disabled> </hot-button>
79
+ </div>
80
+ ```
81
+
82
+ See the docs for more [usage examples](https://hotosm.github.io/ui/usage/).
83
+
84
+ > core.js will contain the minimal low level components.
85
+ >
86
+ > extra.js will contain additional wrapper components.
87
+ >
88
+ > There should be versioning of the components, plus a /latest/ version too.
89
+
90
+ ### React
91
+
92
+ Install your required version with a pin, or latest:
93
+
94
+ ```bash
95
+ pnpm install @hotosm/ui
96
+ ```
97
+
98
+ ```js
99
+ import { hot-button } from '@hotosm/ui';
100
+
101
+ const HomePage = ({}) => {
102
+ return (
103
+ <div className="your-css-classes">
104
+ <div
105
+ ...
106
+ >
107
+ <hot-button disabled>
108
+ </hot-button>
109
+ </div>
110
+ </div>
111
+ );
112
+ };
113
+
114
+ export default HomePage;
115
+ ```
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@hotosm/ui",
3
- "version": "0.1.0",
4
- "description": "Shared React components with theming for use across HOTOSM tools.",
3
+ "version": "0.2.0a1",
4
+ "description": "Shared UI components with theming for use across HOTOSM tools.",
5
+ "type": "module",
6
+ "engines": {
7
+ "node": ">=14.17"
8
+ },
5
9
  "keywords": [],
6
10
  "author": {
7
11
  "name": "HOTOSM",
@@ -12,35 +16,78 @@
12
16
  "name": "Joe",
13
17
  "url": "https://github.com/joltcode"
14
18
  },
19
+ {
20
+ "name": "Emi Mariscal",
21
+ "url": "https://github.com/emi420"
22
+ },
23
+ {
24
+ "name": "Deepak Pradhan",
25
+ "url": "https://github.com/varun2948"
26
+ },
15
27
  {
16
28
  "name": "Sam Woodcock",
17
29
  "url": "https://github.com/spwoodcock"
18
30
  }
19
31
  ],
20
32
  "license": "GPL-3.0-only",
33
+ "dependencies": {
34
+ "@shoelace-style/shoelace": "^2.15.1"
35
+ },
21
36
  "devDependencies": {
22
- "@ladle/react": "^3.2.1",
23
- "@types/react": "^18.2.28",
37
+ "@lit/react": "^1.0.4",
38
+ "@storybook/addon-essentials": "^7.6.5",
39
+ "@storybook/addon-links": "^7.6.5",
40
+ "@storybook/blocks": "^7.6.5",
41
+ "@storybook/web-components": "^8.0.8",
42
+ "@storybook/web-components-vite": "^7.6.19",
43
+ "@typescript-eslint/eslint-plugin": "^6.4.0",
44
+ "@unocss/postcss": "^0.58.5",
24
45
  "autoprefixer": "^10.4.16",
25
- "postcss": "^8.4.31",
26
- "tailwindcss": "^3.3.3",
27
- "typescript": "^5.2.2"
28
- },
29
- "dependencies": {
30
- "clsx": "^2.0.0",
46
+ "class-variance-authority": "0.7.0",
47
+ "clsx": "2.0.0",
48
+ "eslint": "^8.0.1",
49
+ "eslint-config-prettier": "^9.1.0",
50
+ "eslint-config-standard-with-typescript": "^43.0.0",
51
+ "eslint-plugin-import": "^2.25.2",
52
+ "eslint-plugin-lit": "^1.10.1",
53
+ "eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
54
+ "eslint-plugin-promise": "^6.0.0",
55
+ "eslint-plugin-wc": "^2.0.4",
56
+ "lit": "^3.1.0",
31
57
  "react": "^18.2.0",
32
- "tailwind-merge": "^1.14.0"
58
+ "react-dom": "^18.2.0",
59
+ "storybook": "^7.6.5",
60
+ "typescript": "^5.2.2",
61
+ "unocss": "^0.58.0",
62
+ "web-component-analyzer": "^2.0.0"
63
+ },
64
+ "dependencies-comments": {
65
+ "react": "Required for Storybook",
66
+ "react-dom": "Required for Storybook"
67
+ },
68
+ "files": [
69
+ "*.js",
70
+ "*.d.ts",
71
+ "./theme/hot.css"
72
+ ],
73
+ "publishConfig": {
74
+ "access": "public"
33
75
  },
34
76
  "repository": {
35
77
  "type": "git",
36
- "url": "git+https://github.com/hotosm/shared-ui-components.git"
78
+ "url": "git+https://github.com/hotosm/ui.git"
37
79
  },
38
80
  "bugs": {
39
- "url": "https://github.com/hotosm/shared-ui-components/issues"
81
+ "url": "https://github.com/hotosm/ui/issues"
40
82
  },
41
- "homepage": "https://github.com/hotosm/shared-ui-components#readme",
83
+ "homepage": "https://github.com/hotosm/ui#readme",
42
84
  "scripts": {
85
+ "dev": "pnpm run build && storybook dev -p 3001",
86
+ "build": "tsc",
87
+ "build:docstrings": "wca analyze 'components/**/*.{js,ts}' --outDir 'docs/components' --format 'markdown'",
88
+ "build:stories": "storybook build --output-dir=docs/stories",
89
+ "build:docs": "pnpm run build:docstrings && pnpm run dev:build-web-components && pnpm run build:stories",
43
90
  "test": "echo \"Error: no test specified\" && exit 1",
44
- "dev": "ladle dev --host 0.0.0.0 --port 3000"
91
+ "lint": "eslint --ext .js,.ts ./"
45
92
  }
46
93
  }
package/theme/hot.css ADDED
@@ -0,0 +1,122 @@
1
+ :root {
2
+ --hot-red-900: #b9302d;
3
+ --hot-red-800: #c93938;
4
+ --hot-red-700: #d63f3f;
5
+ --hot-red-600: #e84846;
6
+ --hot-red-500: #f75047;
7
+ --hot-red-400: #f15f5e;
8
+ --hot-red-300: #e67c7e;
9
+ --hot-red-200: #efa0a2;
10
+ --hot-red-100: #fed1d7;
11
+ --hot-red-50: #feecf0;
12
+ --hot-red: var(--hot-red-700);
13
+ --hot-red-rgb: 215 63 63;
14
+
15
+ --hot-darkred-900: #5b1018;
16
+ --hot-darkred-800: #6c2020;
17
+ --hot-darkred-700: #7c2e26;
18
+ --hot-darkred-600: #8d3a2f;
19
+ --hot-darkred-500: #994335;
20
+ --hot-darkred-400: #b15e4e;
21
+ --hot-darkred-300: #c87968;
22
+ --hot-darkred-200: #e69b8c;
23
+ --hot-darkred-100: #ffbead;
24
+ --hot-darkred-50: #ffdec8;
25
+ --hot-darkred: var(--hot-darkred-700);
26
+ --hot-darkred-rgb: 108 32 32;
27
+
28
+ --hot-light-gray: #e1e0e0;
29
+ --hot-light-gray-rgb: 225 224 224;
30
+ --hot-gray-900: #2c3038;
31
+ --hot-gray-800: #3f444f;
32
+ --hot-gray-700: #4f5765;
33
+ --hot-gray-600: #606a7c;
34
+ --hot-gray-500: #6e798d;
35
+ --hot-gray-400: #848c9d;
36
+ --hot-gray-300: #9aa1af;
37
+ --hot-gray-200: #b7bcc5;
38
+ --hot-gray-100: #d3d7dc;
39
+ --hot-gray-50: #eeeef0;
40
+ --hot-gray: var(--hot-gray-900);
41
+ --hot-gray-rgb: 104 112 127;
42
+
43
+ --hot-yellow-900: #ef7e1a;
44
+ --hot-yellow-800: #f4a628;
45
+ --hot-yellow-700: #f6bd30;
46
+ --hot-yellow-600: #f9d538;
47
+ --hot-yellow-500: #f7e53a;
48
+ --hot-yellow-400: #faea58;
49
+ --hot-yellow-300: #fcef77;
50
+ --hot-yellow-200: #fdf39d;
51
+ --hot-yellow-100: #fef8c4;
52
+ --hot-yellow-50: #fefde7;
53
+ --hot-yellow: var(--hot-yellow-800);
54
+ --hot-yellow-rgb: 250 167 30;
55
+
56
+ --hot-green-900: #105950;
57
+ --hot-green-800: #15766e;
58
+ --hot-green-700: #17867e;
59
+ --hot-green-600: #1a978f;
60
+ --hot-green-500: #1da49d;
61
+ --hot-green-400: #34b3ad;
62
+ --hot-green-300: #57c1bd;
63
+ --hot-green-200: #87d3d1;
64
+ --hot-green-100: #b7e4e3;
65
+ --hot-green-50: #e2f4f4;
66
+ --hot-green: var(--hot-green-300);
67
+ --hot-green-rgb: 69 156 160;
68
+
69
+ --hot-blue-900: #182642;
70
+ --hot-blue-800: #20365b;
71
+ --hot-blue-700: #263f68;
72
+ --hot-blue-600: #2e4873;
73
+ --hot-blue-500: #344f7b;
74
+ --hot-blue-400: #53688b;
75
+ --hot-blue-300: #71829e;
76
+ --hot-blue-200: #97a5ba;
77
+ --hot-blue-100: #bfc8d6;
78
+ --hot-blue-50: #e6e9ee;
79
+ --hot-blue: var(--hot-blue-800);
80
+ --hot-blue-rgb: 32 54 91;
81
+
82
+ --hot-white: #ffffff;
83
+ --hot-white-rgb: 255 255 255;
84
+ --hot-black: #2c3038;
85
+ --hot-black-rgb: 44 48 56;
86
+
87
+ --hot-primary: var(--hot-red);
88
+ --hot-primary-light: var(--hot-red-200);
89
+ --hot-primary-dark: var(--hot-red-900);
90
+ --hot-primary-contrastText: var(--hot-white);
91
+ --hot-primary-rgb: var(--hot-red-rgb);
92
+
93
+ --hot-secondary: var(--hot-gray);
94
+ --hot-secondary-light: var(--hot-gray-200);
95
+ --hot-secondary-dark: var(--hot-black);
96
+ --hot-secondary-contrastText: var(--hot-white);
97
+ --hot-secondary-rgb: var(--hot-gray-rgb);
98
+
99
+ --hot-info: var(--hot-blue);
100
+ --hot-info-light: var(--hot-blue-300);
101
+ --hot-info-dark: var(--hot-blue-900);
102
+ --hot-info-contrastText: var(--hot-white);
103
+ --hot-info-rgb: var(--hot-blue-rgb);
104
+
105
+ --hot-error: var(--hot-darkred);
106
+ --hot-error-light: var(--hot-darkred-400);
107
+ --hot-error-dark: var(--hot-darkred-900);
108
+ --hot-error-contrastText: var(--hot-white);
109
+ --hot-error-rgb: var(--hot-darkred-rgb);
110
+
111
+ --hot-warning: var(--hot-yellow);
112
+ --hot-warning-light: var(--hot-yellow-400);
113
+ --hot-warning-dark: var(--hot-yellow-900);
114
+ --hot-warning-contrastText: var(--hot-white);
115
+ --hot-warning-rgb: var(--hot-yellow-rgb);
116
+
117
+ --hot-success: var(--hot-green);
118
+ --hot-success-light: var(--hot-green-100);
119
+ --hot-success-dark: var(--hot-green-600);
120
+ --hot-success-contrastText: var(--hot-white);
121
+ --hot-success-rgb: var(--hot-green-rgb);
122
+ }
@@ -1 +0,0 @@
1
- import "./styles.css";
package/.ladle/styles.css DELETED
@@ -1,3 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;