revotech-ui-kit 0.0.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/.editorconfig +29 -0
- package/.eslintrc +10 -0
- package/.storybook/main.ts +17 -0
- package/.storybook/preview-head.html +1 -0
- package/.storybook/preview.ts +17 -0
- package/LICENSE +21 -0
- package/README.md +30 -0
- package/assets/fonts/Geist/Geist-Black.otf +0 -0
- package/assets/fonts/Geist/Geist-Black.woff2 +0 -0
- package/assets/fonts/Geist/Geist-Bold.otf +0 -0
- package/assets/fonts/Geist/Geist-Bold.woff2 +0 -0
- package/assets/fonts/Geist/Geist-Light.otf +0 -0
- package/assets/fonts/Geist/Geist-Light.woff2 +0 -0
- package/assets/fonts/Geist/Geist-Medium.otf +0 -0
- package/assets/fonts/Geist/Geist-Medium.woff2 +0 -0
- package/assets/fonts/Geist/Geist-Regular.otf +0 -0
- package/assets/fonts/Geist/Geist-Regular.woff2 +0 -0
- package/assets/fonts/Geist/Geist-SemiBold.otf +0 -0
- package/assets/fonts/Geist/Geist-SemiBold.woff2 +0 -0
- package/assets/fonts/Geist/Geist-Thin.otf +0 -0
- package/assets/fonts/Geist/Geist-Thin.woff2 +0 -0
- package/assets/fonts/Geist/Geist-UltraBlack.otf +0 -0
- package/assets/fonts/Geist/Geist-UltraBlack.woff2 +0 -0
- package/assets/fonts/Geist/Geist-UltraLight.otf +0 -0
- package/assets/fonts/Geist/Geist-UltraLight.woff2 +0 -0
- package/assets/fonts/Geist/GeistVariableVF.ttf +0 -0
- package/assets/fonts/Geist/GeistVariableVF.woff2 +0 -0
- package/assets/fonts/Geist/LICENSE.TXT +92 -0
- package/assets/open-wc-logo.svg +29 -0
- package/index.html +362 -0
- package/package.json +117 -0
- package/rollup.config.js +71 -0
- package/src/components/atoms/button/button.atom.ts +39 -0
- package/src/components/atoms/button/button.stories.ts +186 -0
- package/src/components/atoms/button/button.style.ts +31 -0
- package/src/components/atoms/button/button.type.ts +10 -0
- package/src/components/atoms/checkbox/checkbox.atom.ts +62 -0
- package/src/components/atoms/checkbox/checkbox.stories.ts +42 -0
- package/src/components/atoms/command-empty/command-empty.atom.ts +44 -0
- package/src/components/atoms/command-group/command-group.atom.ts +60 -0
- package/src/components/atoms/command-item/command-item.atom.ts +74 -0
- package/src/components/atoms/command-list/command-list.atom.ts +37 -0
- package/src/components/atoms/command-separator/command-separator.atom.ts +42 -0
- package/src/components/atoms/dialog/dialog.atom.ts +301 -0
- package/src/components/atoms/dialog/dialog.stories.ts +86 -0
- package/src/components/atoms/index.ts +10 -0
- package/src/components/atoms/input/input.atom.ts +34 -0
- package/src/components/atoms/input/input.stories.ts +89 -0
- package/src/components/atoms/input/input.type.ts +24 -0
- package/src/components/atoms/label/label.atom.ts +40 -0
- package/src/components/atoms/label/label.stories.ts +18 -0
- package/src/components/atoms/label/label.style.ts +5 -0
- package/src/components/command/command.stories.ts +154 -0
- package/src/components/command/command.ts +391 -0
- package/src/components/index.ts +2 -0
- package/src/components/molecules/command/command.molecules.ts +31 -0
- package/src/components/molecules/command-input/command-input.atom.ts +130 -0
- package/src/components/molecules/index.ts +1 -0
- package/src/components/popover.ts +247 -0
- package/src/globals.css +1806 -0
- package/src/helpers/index.ts +2 -0
- package/src/helpers/mouse-conroller.helper.ts +42 -0
- package/src/helpers/style.helpers.ts +6 -0
- package/src/interfaces/actionable.interface.ts +6 -0
- package/src/interfaces/atomic.interface.ts +6 -0
- package/src/interfaces/changeable.interface.ts +14 -0
- package/src/interfaces/child-support-atomic.interface.ts +5 -0
- package/src/interfaces/index.ts +6 -0
- package/src/interfaces/intractable.interface.ts +6 -0
- package/src/interfaces/variant.interface.ts +3 -0
- package/src/lib/index.ts +0 -0
- package/src/lib/next/next.lib.ts +0 -0
- package/src/lib/react/react.lib.ts +0 -0
- package/src/styles/index.ts +1 -0
- package/src/styles/tw.styles.ts +1867 -0
- package/src/tailwind-lib.css +95 -0
- package/src/wc-ui-app.ts +81 -0
- package/tailwind.config.js +81 -0
- package/test/wc-ui-app.test.ts +22 -0
- package/tsconfig.json +25 -0
- package/web-dev-server.config.mjs +26 -0
- package/web-test-runner.config.mjs +41 -0
package/index.html
ADDED
@@ -0,0 +1,362 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8" />
|
5
|
+
<meta
|
6
|
+
name="viewport"
|
7
|
+
content="width=device-width, initial-scale=1.0, viewport-fit=cover"
|
8
|
+
/>
|
9
|
+
<meta name="Description" content="Put your description here." />
|
10
|
+
<base href="/" />
|
11
|
+
<link href="./src/globals.css" rel="stylesheet" />
|
12
|
+
<script src="https://code.iconify.design/iconify-icon/2.0.0/iconify-icon.min.js"></script>
|
13
|
+
|
14
|
+
<style>
|
15
|
+
html,
|
16
|
+
body {
|
17
|
+
margin: 0;
|
18
|
+
padding: 0;
|
19
|
+
background-color: white;
|
20
|
+
}
|
21
|
+
</style>
|
22
|
+
<title>wc-ui-app</title>
|
23
|
+
</head>
|
24
|
+
|
25
|
+
<body>
|
26
|
+
<div class="container mx-auto my-10">
|
27
|
+
<h1 class="text-4xl text-center">Web Components</h1>
|
28
|
+
<h2 class="text-2xl text-center">Button</h2>
|
29
|
+
</div>
|
30
|
+
<div class="flex flex-wrap justify-between space-x-4 gap-5 mx-3">
|
31
|
+
<rtg-button>Primary</rtg-button>
|
32
|
+
<rtg-button variant="secondary">Secodary</rtg-button>
|
33
|
+
<rtg-button variant="destructive">Destructive</rtg-button>
|
34
|
+
<rtg-button variant="outline">Outline</rtg-button>
|
35
|
+
<rtg-button variant="ghost">Ghost</rtg-button>
|
36
|
+
<rtg-button variant="link">Link</rtg-button>
|
37
|
+
<rtg-button variant="outline" size="icon"
|
38
|
+
><iconify-icon icon="mdi:home"></iconify-icon
|
39
|
+
></rtg-button>
|
40
|
+
<rtg-button
|
41
|
+
><iconify-icon class="mr-2" icon="mdi:home"></iconify-icon> Home
|
42
|
+
Page</rtg-button
|
43
|
+
>
|
44
|
+
<rtg-button disabled
|
45
|
+
><iconify-icon class="mr-2 animate-spin" icon="mdi:home"></iconify-icon>
|
46
|
+
Home Page</rtg-button
|
47
|
+
>
|
48
|
+
</div>
|
49
|
+
<div class="container mx-auto my-10">
|
50
|
+
<h2 class="text-2xl text-center">Labels</h2>
|
51
|
+
</div>
|
52
|
+
<div class="flex items-center space-x-2 mx-2 justify-center">
|
53
|
+
<rtg-checkbox id="terms"></rtg-checkbox>
|
54
|
+
<rtg-label for="terms">Accept terms and conditions</rtg-label>
|
55
|
+
</div>
|
56
|
+
<div class="container mx-auto my-10">
|
57
|
+
<h2 class="text-2xl text-center">Inputs</h2>
|
58
|
+
</div>
|
59
|
+
<div class="flex flex-wrap space-x-4 gap-5 mx-3">
|
60
|
+
<rtg-input type="email" placeholder="Email" class="min-w-80"></rtg-input>
|
61
|
+
<div class="grid w-full max-w-sm items-center gap-1.5 min-w-80">
|
62
|
+
<rtg-label for="picture">Picture</rtg-label>
|
63
|
+
<rtg-input id="picture" type="file" placeholder="file"></rtg-input>
|
64
|
+
</div>
|
65
|
+
<rtg-input
|
66
|
+
disabled
|
67
|
+
type="email"
|
68
|
+
placeholder="Email"
|
69
|
+
class="min-w-80"
|
70
|
+
></rtg-input>
|
71
|
+
<div class="grid w-full max-w-sm items-center gap-1.5 min-w-80">
|
72
|
+
<rtg-label for="email">Email address</rtg-label>
|
73
|
+
<rtg-input id="email" type="email" placeholder="Email"> </rtg-input>
|
74
|
+
</div>
|
75
|
+
<div class="flex flex-nowrap w-full max-w-sm items-center space-x-2">
|
76
|
+
<rtg-input
|
77
|
+
id="email"
|
78
|
+
type="email"
|
79
|
+
placeholder="Email"
|
80
|
+
class="min-w-80"
|
81
|
+
></rtg-input>
|
82
|
+
<rtg-button size="default" onclick="javascript:alert('Hello!')">Subscribe</rtg-button>
|
83
|
+
</div>
|
84
|
+
</div>
|
85
|
+
<div class="container mx-auto my-10">
|
86
|
+
<h2 class="text-2xl text-center">Command</h2>
|
87
|
+
</div>
|
88
|
+
<div class="flex flex-nowrap justify-center">
|
89
|
+
<div class="flex flex-wrap space-x-4 gap-5 mx-3">
|
90
|
+
<rtg-command class="w-full max-w-md">
|
91
|
+
<rtg-command-input placeholder="Search ...."></rtg-command-input>
|
92
|
+
<rtg-command-list>
|
93
|
+
<rtg-command-empty>No items found!</rtg-command-empty>
|
94
|
+
<rtg-command-group heading="Suggestions">
|
95
|
+
<rtg-command-item>
|
96
|
+
<svg
|
97
|
+
xmlns="http://www.w3.org/2000/svg"
|
98
|
+
width="24"
|
99
|
+
height="24"
|
100
|
+
viewBox="0 0 24 24"
|
101
|
+
fill="none"
|
102
|
+
stroke="currentColor"
|
103
|
+
stroke-width="2"
|
104
|
+
stroke-linecap="round"
|
105
|
+
stroke-linejoin="round"
|
106
|
+
class="mr-2 h-4 w-4"
|
107
|
+
>
|
108
|
+
<rect width="18" height="18" x="3" y="4" rx="2" ry="2"></rect>
|
109
|
+
<line x1="16" x2="16" y1="2" y2="6"></line>
|
110
|
+
<line x1="8" x2="8" y1="2" y2="6"></line>
|
111
|
+
<line x1="3" x2="21" y1="10" y2="10"></line></svg>
|
112
|
+
<span>Calendar</span>
|
113
|
+
</rtg-command-item>
|
114
|
+
<rtg-command-item>
|
115
|
+
<svg
|
116
|
+
xmlns="http://www.w3.org/2000/svg"
|
117
|
+
width="24"
|
118
|
+
height="24"
|
119
|
+
viewBox="0 0 24 24"
|
120
|
+
fill="none"
|
121
|
+
stroke="currentColor"
|
122
|
+
stroke-width="2"
|
123
|
+
stroke-linecap="round"
|
124
|
+
stroke-linejoin="round"
|
125
|
+
class="mr-2 h-4 w-4"
|
126
|
+
>
|
127
|
+
<circle cx="12" cy="12" r="10"></circle>
|
128
|
+
<path d="M8 14s1.5 2 4 2 4-2 4-2"></path>
|
129
|
+
<line x1="9" x2="9.01" y1="9" y2="9"></line>
|
130
|
+
<line x1="15" x2="15.01" y1="9" y2="9"></line></svg>
|
131
|
+
<span>Search Emoji</span>
|
132
|
+
</rtg-command-item>
|
133
|
+
<rtg-command-item>
|
134
|
+
<svg
|
135
|
+
xmlns="http://www.w3.org/2000/svg"
|
136
|
+
width="24"
|
137
|
+
height="24"
|
138
|
+
viewBox="0 0 24 24"
|
139
|
+
fill="none"
|
140
|
+
stroke="currentColor"
|
141
|
+
stroke-width="2"
|
142
|
+
stroke-linecap="round"
|
143
|
+
stroke-linejoin="round"
|
144
|
+
class="mr-2 h-4 w-4"
|
145
|
+
>
|
146
|
+
<rect width="16" height="20" x="4" y="2" rx="2"></rect>
|
147
|
+
<line x1="8" x2="16" y1="6" y2="6"></line>
|
148
|
+
<line x1="16" x2="16" y1="14" y2="18"></line>
|
149
|
+
<path d="M16 10h.01"></path>
|
150
|
+
<path d="M12 10h.01"></path>
|
151
|
+
<path d="M8 10h.01"></path>
|
152
|
+
<path d="M12 14h.01"></path>
|
153
|
+
<path d="M8 14h.01"></path>
|
154
|
+
<path d="M12 18h.01"></path>
|
155
|
+
<path d="M8 18h.01"></path></svg>
|
156
|
+
<span>Calculator</span>
|
157
|
+
</rtg-command-item>
|
158
|
+
</rtg-command-group>
|
159
|
+
<rtg-command-separator></rtg-command-separator>
|
160
|
+
<rtg-command-group heading="Settings">
|
161
|
+
<rtg-command-item onclick="javascript:alert('Profile Clicked!')">
|
162
|
+
<svg
|
163
|
+
xmlns="http://www.w3.org/2000/svg"
|
164
|
+
width="24"
|
165
|
+
height="24"
|
166
|
+
viewBox="0 0 24 24"
|
167
|
+
fill="none"
|
168
|
+
stroke="currentColor"
|
169
|
+
stroke-width="2"
|
170
|
+
stroke-linecap="round"
|
171
|
+
stroke-linejoin="round"
|
172
|
+
class="mr-2 h-4 w-4"
|
173
|
+
>
|
174
|
+
<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"></path>
|
175
|
+
<circle cx="12" cy="7" r="4"></circle></svg>
|
176
|
+
<span>Profile</span>
|
177
|
+
<span
|
178
|
+
class="ml-auto text-xs tracking-widest text-muted-foreground"
|
179
|
+
>⌘P</span>
|
180
|
+
</rtg-command-item>
|
181
|
+
<rtg-command-item>
|
182
|
+
<svg
|
183
|
+
xmlns="http://www.w3.org/2000/svg"
|
184
|
+
width="24"
|
185
|
+
height="24"
|
186
|
+
viewBox="0 0 24 24"
|
187
|
+
fill="none"
|
188
|
+
stroke="currentColor"
|
189
|
+
stroke-width="2"
|
190
|
+
stroke-linecap="round"
|
191
|
+
stroke-linejoin="round"
|
192
|
+
class="mr-2 h-4 w-4"
|
193
|
+
>
|
194
|
+
<rect width="20" height="14" x="2" y="5" rx="2"></rect>
|
195
|
+
<line x1="2" x2="22" y1="10" y2="10"></line></svg>
|
196
|
+
<span>Billing</span
|
197
|
+
><span
|
198
|
+
class="ml-auto text-xs tracking-widest text-muted-foreground"
|
199
|
+
>⌘B</span
|
200
|
+
>
|
201
|
+
</rtg-command-item>
|
202
|
+
<rtg-command-item>
|
203
|
+
<svg
|
204
|
+
xmlns="http://www.w3.org/2000/svg"
|
205
|
+
width="24"
|
206
|
+
height="24"
|
207
|
+
viewBox="0 0 24 24"
|
208
|
+
fill="none"
|
209
|
+
stroke="currentColor"
|
210
|
+
stroke-width="2"
|
211
|
+
stroke-linecap="round"
|
212
|
+
stroke-linejoin="round"
|
213
|
+
class="mr-2 h-4 w-4"
|
214
|
+
>
|
215
|
+
<path
|
216
|
+
d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"
|
217
|
+
></path>
|
218
|
+
<circle cx="12" cy="12" r="3"></circle></svg>
|
219
|
+
<span>Settings</span>
|
220
|
+
<span
|
221
|
+
class="ml-auto text-xs tracking-widest text-muted-foreground">
|
222
|
+
⌘S</span>
|
223
|
+
</rtg-command-item>
|
224
|
+
</rtg-command-group></rtg-command-list
|
225
|
+
>
|
226
|
+
</rtg-command>
|
227
|
+
</div>
|
228
|
+
</div>
|
229
|
+
<div class="container mx-auto my-10">
|
230
|
+
<h2 class="text-2xl text-center">Dialog</h2>
|
231
|
+
</div>
|
232
|
+
<div class="flex flex-nowrap justify-center">
|
233
|
+
<div class="flex flex-wrap space-x-4 gap-5 mx-3">
|
234
|
+
<rtg-dialog>
|
235
|
+
<rtg-dialog-trigger>
|
236
|
+
<rtg-button>Open Dialog</rtg-button>
|
237
|
+
</rtg-dialog-trigger>
|
238
|
+
<rtg-dialog-content>
|
239
|
+
<rtg-dialog-header title="Are you absolutely sure?" description="This action cannot be undone. This will permanently delete your
|
240
|
+
content.">
|
241
|
+
<rtg-dialog-title>Are you absolutely sure?</rtg-dialog-title>
|
242
|
+
<rtg-dialog-description>
|
243
|
+
This action cannot be undone. This will permanently delete your
|
244
|
+
content.</rtg-dialog-description
|
245
|
+
>
|
246
|
+
</rtg-dialog-header>
|
247
|
+
<rtg-dialog-footer>
|
248
|
+
<div class="flex w-full justify-between space-x-1">
|
249
|
+
<rtg-dialog-close><rtg-button variant="secondary">Close</rtg-button></rtg-dialog-close>
|
250
|
+
<div class="justify-end">
|
251
|
+
<rtg-button variant="destructive">Delete</rtg-button>
|
252
|
+
<rtg-button>Cancel</rtg-button>
|
253
|
+
</div>
|
254
|
+
</div>
|
255
|
+
</rtg-dialog-content>
|
256
|
+
</rtg-dialog>
|
257
|
+
<rtg-dialog>
|
258
|
+
<rtg-dialog-trigger>
|
259
|
+
<rtg-button variant="outline">Edit Profile</rtg-button>
|
260
|
+
</rtg-dialog-trigger>
|
261
|
+
<rtg-dialog-content class="sm:max-w-[425px]">
|
262
|
+
<rtg-dialog-header title="Edit Profile", description="Make changes to your profile here. Click save when you're done.">
|
263
|
+
<!-- <rtg-dialog-title>Edit Profile</rtg-dialog-title>
|
264
|
+
<rtg-dialog-description>
|
265
|
+
Make changes to your profile here. Click save when you're done.</rtg-dialog-description
|
266
|
+
> -->
|
267
|
+
</rtg-dialog-header>
|
268
|
+
<div class="grid gap-4 py-4">
|
269
|
+
<div class="grid grid-cols-4 items-center gap-4">
|
270
|
+
<rtg-label for="name" class="text-right">
|
271
|
+
Name
|
272
|
+
</rtg-label>
|
273
|
+
<rtg-input
|
274
|
+
id="name"
|
275
|
+
defaultValue="Pedro Duarte"
|
276
|
+
class="col-span-3"
|
277
|
+
/>
|
278
|
+
</div>
|
279
|
+
<div class="grid grid-cols-4 items-center gap-4">
|
280
|
+
<rtg-label for="username" class="text-right">
|
281
|
+
Username
|
282
|
+
</rtg-label>
|
283
|
+
<rtg-input
|
284
|
+
id="username"
|
285
|
+
defaultValue="@peduarte"
|
286
|
+
class="col-span-3"
|
287
|
+
/>
|
288
|
+
</div>
|
289
|
+
</div>
|
290
|
+
<rtg-dialog-footer>
|
291
|
+
<rtg-button type="submit" class="w-full sm:w-min">Save changes</rtg-button>
|
292
|
+
</rtg-dialog-content>
|
293
|
+
</rtg-dialog>
|
294
|
+
</div>
|
295
|
+
</div>
|
296
|
+
<div class="container mx-auto my-10">
|
297
|
+
<h2 class="text-2xl text-center">Popover</h2>
|
298
|
+
</div>
|
299
|
+
<div class="flex flex-nowrap justify-center">
|
300
|
+
<div class="flex flex-wrap space-x-4 gap-5 mx-3">
|
301
|
+
<rtg-popover>
|
302
|
+
<rtg-popover-trigger>
|
303
|
+
<rtg-button variant="outline">Open Popover</rtg-button>
|
304
|
+
</rtg-popover-trigger>
|
305
|
+
<rtg-popover-content class="w-80">
|
306
|
+
<div class="grid gap-4">
|
307
|
+
<div class="space-y-2">
|
308
|
+
<h4 class="font-medium leading-none">Dimensions</h4>
|
309
|
+
<p class="text-sm text-muted-foreground">
|
310
|
+
Set the dimensions for the layer.
|
311
|
+
</p>
|
312
|
+
</div>
|
313
|
+
<div class="grid gap-2">
|
314
|
+
<div class="grid grid-cols-3 items-center gap-4">
|
315
|
+
<rtg-label for="width">Width</rtg-label>
|
316
|
+
<rtg-input
|
317
|
+
id="width"
|
318
|
+
defaultValue="100%"
|
319
|
+
class="col-span-2 h-8"
|
320
|
+
/>
|
321
|
+
</div>
|
322
|
+
<div class="grid grid-cols-3 items-center gap-4">
|
323
|
+
<rtg-label for="maxWidth">Max. width</rtg-label>
|
324
|
+
<rtg-input
|
325
|
+
id="maxWidth"
|
326
|
+
defaultValue="300px"
|
327
|
+
class="col-span-2 h-8"
|
328
|
+
/>
|
329
|
+
</div>
|
330
|
+
<div class="grid grid-cols-3 items-center gap-4">
|
331
|
+
<rtg-label htmlFor="height">Height</rtg-label>
|
332
|
+
<rtg-input
|
333
|
+
id="height"
|
334
|
+
defaultValue="25px"
|
335
|
+
class="col-span-2 h-8"
|
336
|
+
/>
|
337
|
+
</div>
|
338
|
+
<div class="grid grid-cols-3 items-center gap-4">
|
339
|
+
<rtg-label htmlFor="maxHeight">Max. height</rtg-label>
|
340
|
+
<rtg-input
|
341
|
+
id="maxHeight"
|
342
|
+
defaultValue="none"
|
343
|
+
class="col-span-2 h-8"
|
344
|
+
/>
|
345
|
+
</div>
|
346
|
+
</div>
|
347
|
+
</div>
|
348
|
+
</rtg-popover-content>
|
349
|
+
</rtg-popover>
|
350
|
+
</div>
|
351
|
+
</div>
|
352
|
+
<div class="h-9"></div>
|
353
|
+
</div>
|
354
|
+
<script type="module" src="./dist/src/wc-ui-app.js"></script>
|
355
|
+
<script type="module" src="./dist/src/components/"></script>
|
356
|
+
<!-- <script type="module" src="./dist/src/components/input/input.js"></script>
|
357
|
+
<script type="module" src="./dist/src/components/label/label.js"></script>
|
358
|
+
<script type="module" src="./dist/src/components/checkbox/checkbox.js"></script>
|
359
|
+
<script type="module" src="./dist/src/components/command/command.js"></script>
|
360
|
+
<script type="module" src="./dist/src/components/dialog/dialog.js"></script> -->
|
361
|
+
</body>
|
362
|
+
</html>
|
package/package.json
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
{
|
2
|
+
"name": "revotech-ui-kit",
|
3
|
+
"description": "Webcomponent wc-ui following open-wc recommendations",
|
4
|
+
"license": "MIT",
|
5
|
+
"author": "wc-ui",
|
6
|
+
"version": "0.0.0",
|
7
|
+
"type": "module",
|
8
|
+
"scripts": {
|
9
|
+
"clean": "rimraf dist",
|
10
|
+
"copy-files": "copyfiles -u 1 src/**/*.html src/**/*.css src/**/*.js dist/public/",
|
11
|
+
"lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
|
12
|
+
"format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
|
13
|
+
"test": "tsc && wtr --coverage",
|
14
|
+
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
|
15
|
+
"storybook": "storybook dev -p 6006",
|
16
|
+
"storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook",
|
17
|
+
"build": "npm run clean && tsc && rollup -c rollup.config.js && npm run copy-files && npm run analyze -- --exclude dist",
|
18
|
+
"start:build": "web-dev-server --root-dir dist --app-index index.html --open",
|
19
|
+
"analyze": "cem analyze --litelement",
|
20
|
+
"start": "npm run clean && tsc && npm run copy-files && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
|
21
|
+
"tw:watch": "concurrently \"tailwindcss -i ./src/tailwind-lib.css -o ./src/globals.css --watch\" \"twlit --input ./src/globals.css --output ./src/lib/tw-styles.ts \""
|
22
|
+
},
|
23
|
+
"dependencies": {
|
24
|
+
"@storybook/addon-essentials": "^8.0.0",
|
25
|
+
"@storybook/addon-links": "^8.0.0",
|
26
|
+
"@storybook/web-components": "^8.0.0",
|
27
|
+
"@storybook/web-components-vite": "^8.0.0",
|
28
|
+
"class-variance-authority": "^0.7.0",
|
29
|
+
"clsx": "^2.1.0",
|
30
|
+
"lit": "^3.1.2",
|
31
|
+
"storybook": "^8.0.0",
|
32
|
+
"tailwind-merge": "^2.2.1",
|
33
|
+
"tailwindcss-animate": "^1.0.7"
|
34
|
+
},
|
35
|
+
"devDependencies": {
|
36
|
+
"@babel/preset-env": "^7.16.4",
|
37
|
+
"@custom-elements-manifest/analyzer": "^0.4.17",
|
38
|
+
"@open-wc/building-rollup": "^2.0.2",
|
39
|
+
"@open-wc/eslint-config": "^9.2.1",
|
40
|
+
"@open-wc/testing": "^3.1.6",
|
41
|
+
"@rollup/plugin-babel": "^5.3.0",
|
42
|
+
"@rollup/plugin-node-resolve": "^13.0.6",
|
43
|
+
"@storybook/builder-vite": "^8.0.0",
|
44
|
+
"@typescript-eslint/eslint-plugin": "^5.48.0",
|
45
|
+
"@typescript-eslint/parser": "^5.48.0",
|
46
|
+
"@web/dev-server": "^0.1.34",
|
47
|
+
"@web/dev-server-storybook": "^0.5.4",
|
48
|
+
"@web/rollup-plugin-html": "^1.11.0",
|
49
|
+
"@web/rollup-plugin-import-meta-assets": "^1.0.7",
|
50
|
+
"@web/test-runner": "^0.14.0",
|
51
|
+
"babel-plugin-template-html-minifier": "^4.1.0",
|
52
|
+
"concurrently": "^5.3.0",
|
53
|
+
"copyfiles": "^2.4.1",
|
54
|
+
"deepmerge": "^4.2.2",
|
55
|
+
"eslint": "^8.31.0",
|
56
|
+
"eslint-config-prettier": "^8.3.0",
|
57
|
+
"husky": "^9.1.4",
|
58
|
+
"lint-staged": "^10.5.4",
|
59
|
+
"prettier": "^2.4.1",
|
60
|
+
"rimraf": "^3.0.2",
|
61
|
+
"rollup": "^2.60.0",
|
62
|
+
"rollup-plugin-esbuild": "^5.0.0",
|
63
|
+
"rollup-plugin-workbox": "^6.2.0",
|
64
|
+
"tailwindcss": "^3.4.1",
|
65
|
+
"tslib": "^2.3.1",
|
66
|
+
"twlit": "^0.0.1-alpha.37",
|
67
|
+
"typescript": "^5.3.3"
|
68
|
+
},
|
69
|
+
"eslintConfig": {
|
70
|
+
"parser": "@typescript-eslint/parser",
|
71
|
+
"extends": [
|
72
|
+
"@open-wc",
|
73
|
+
"prettier"
|
74
|
+
],
|
75
|
+
"plugins": [
|
76
|
+
"@typescript-eslint"
|
77
|
+
],
|
78
|
+
"rules": {
|
79
|
+
"no-unused-vars": "off",
|
80
|
+
"@typescript-eslint/no-unused-vars": [
|
81
|
+
"error"
|
82
|
+
],
|
83
|
+
"import/no-unresolved": "off",
|
84
|
+
"import/extensions": [
|
85
|
+
"error",
|
86
|
+
"always",
|
87
|
+
{
|
88
|
+
"ignorePackages": true
|
89
|
+
}
|
90
|
+
],
|
91
|
+
"max-classes-per-file": [
|
92
|
+
"error",
|
93
|
+
{
|
94
|
+
"ignoreExpressions": true,
|
95
|
+
"max": 10
|
96
|
+
}
|
97
|
+
],
|
98
|
+
"no-plusplus": "off"
|
99
|
+
}
|
100
|
+
},
|
101
|
+
"prettier": {
|
102
|
+
"singleQuote": true,
|
103
|
+
"arrowParens": "avoid"
|
104
|
+
},
|
105
|
+
"husky": {
|
106
|
+
"hooks": {
|
107
|
+
"pre-commit": "lint-staged"
|
108
|
+
}
|
109
|
+
},
|
110
|
+
"lint-staged": {
|
111
|
+
"*.ts": [
|
112
|
+
"eslint --fix",
|
113
|
+
"prettier --write"
|
114
|
+
]
|
115
|
+
},
|
116
|
+
"customElements": "custom-elements.json"
|
117
|
+
}
|
package/rollup.config.js
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
import nodeResolve from '@rollup/plugin-node-resolve';
|
2
|
+
import babel from '@rollup/plugin-babel';
|
3
|
+
import html from '@web/rollup-plugin-html';
|
4
|
+
import { importMetaAssets } from '@web/rollup-plugin-import-meta-assets';
|
5
|
+
import esbuild from 'rollup-plugin-esbuild';
|
6
|
+
import { generateSW } from 'rollup-plugin-workbox';
|
7
|
+
import path from 'path';
|
8
|
+
|
9
|
+
export default {
|
10
|
+
input: 'index.html',
|
11
|
+
output: {
|
12
|
+
entryFileNames: '[hash].js',
|
13
|
+
chunkFileNames: '[hash].js',
|
14
|
+
assetFileNames: '[hash][extname]',
|
15
|
+
format: 'es',
|
16
|
+
dir: 'dist',
|
17
|
+
},
|
18
|
+
preserveEntrySignatures: false,
|
19
|
+
|
20
|
+
plugins: [
|
21
|
+
/** Enable using HTML as rollup entrypoint */
|
22
|
+
html({
|
23
|
+
minify: true,
|
24
|
+
injectServiceWorker: true,
|
25
|
+
serviceWorkerPath: 'dist/sw.js',
|
26
|
+
}),
|
27
|
+
/** Resolve bare module imports */
|
28
|
+
nodeResolve(),
|
29
|
+
/** Minify JS, compile JS to a lower language target */
|
30
|
+
esbuild({
|
31
|
+
minify: true,
|
32
|
+
target: ['chrome64', 'firefox67', 'safari11.1'],
|
33
|
+
}),
|
34
|
+
/** Bundle assets references via import.meta.url */
|
35
|
+
importMetaAssets(),
|
36
|
+
/** Minify html and css tagged template literals */
|
37
|
+
babel({
|
38
|
+
plugins: [
|
39
|
+
[
|
40
|
+
require.resolve('babel-plugin-template-html-minifier'),
|
41
|
+
{
|
42
|
+
modules: { lit: ['html', { name: 'css', encapsulation: 'style' }] },
|
43
|
+
failOnError: false,
|
44
|
+
strictCSS: true,
|
45
|
+
htmlMinifier: {
|
46
|
+
collapseWhitespace: true,
|
47
|
+
conservativeCollapse: true,
|
48
|
+
removeComments: true,
|
49
|
+
caseSensitive: true,
|
50
|
+
minifyCSS: true,
|
51
|
+
},
|
52
|
+
},
|
53
|
+
],
|
54
|
+
],
|
55
|
+
}),
|
56
|
+
/** Create and inject a service worker */
|
57
|
+
generateSW({
|
58
|
+
globIgnores: ['polyfills/*.js', 'nomodule-*.js'],
|
59
|
+
navigateFallback: '/index.html',
|
60
|
+
// where to output the generated sw
|
61
|
+
swDest: path.join('dist', 'sw.js'),
|
62
|
+
// directory to match patterns against to be precached
|
63
|
+
globDirectory: path.join('dist'),
|
64
|
+
// cache any html js and css by default
|
65
|
+
globPatterns: ['**/*.{html,js,css,webmanifest}'],
|
66
|
+
skipWaiting: true,
|
67
|
+
clientsClaim: true,
|
68
|
+
runtimeCaching: [{ urlPattern: 'polyfills/*.js', handler: 'CacheFirst' }],
|
69
|
+
}),
|
70
|
+
],
|
71
|
+
};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
2
|
+
import { property, customElement } from 'lit/decorators.js';
|
3
|
+
import { cn } from '@/helpers';
|
4
|
+
import { ButtonSize, ButtonType, ButtonVariant } from './button.type';
|
5
|
+
import { buttonStyle } from './button.style';
|
6
|
+
import { TWStyles } from '@/styles';
|
7
|
+
|
8
|
+
@customElement('rtg-button')
|
9
|
+
export class Button extends LitElement {
|
10
|
+
static buttonVariants = buttonStyle;
|
11
|
+
|
12
|
+
@property({ type: Boolean }) disabled = false;
|
13
|
+
|
14
|
+
@property({ type: String }) type: ButtonType = 'button';
|
15
|
+
|
16
|
+
@property({ type: String }) variant: ButtonVariant = 'default';
|
17
|
+
|
18
|
+
@property({ type: String }) size: ButtonSize = 'default';
|
19
|
+
|
20
|
+
static styles = [css``, TWStyles];
|
21
|
+
|
22
|
+
render() {
|
23
|
+
return html`
|
24
|
+
<button
|
25
|
+
type="${this.type}"
|
26
|
+
?disabled=${this.disabled}
|
27
|
+
class="${cn(
|
28
|
+
Button.buttonVariants({
|
29
|
+
variant: this.variant,
|
30
|
+
size: this.size,
|
31
|
+
className: this.className,
|
32
|
+
})
|
33
|
+
)}"
|
34
|
+
>
|
35
|
+
<slot></slot>
|
36
|
+
</button>
|
37
|
+
`;
|
38
|
+
}
|
39
|
+
}
|