-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforms.html
More file actions
336 lines (314 loc) · 12.6 KB
/
Copy pathforms.html
File metadata and controls
336 lines (314 loc) · 12.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Gosub forms & widgets test</title>
<style>
:root { --gap: 16px; --accent: #0066cc; }
* { box-sizing: border-box; }
body {
margin: 0;
padding: 24px;
font-family: DejaVu Sans, system-ui, Arial, sans-serif;
color: #1a1a1a;
background: #fafafa;
line-height: 1.5;
}
h1 { font-size: 24px; margin: 0 0 4px; }
p.lead { margin: 0 0 24px; color: #555; }
h2 {
font-size: 18px; margin: 32px 0 12px;
border-bottom: 2px solid #ddd; padding-bottom: 4px;
}
code { font-family: DejaVu Sans Mono, monospace; font-size: 12px; color: var(--accent); }
/* layout helpers */
.row { display: flex; flex-wrap: wrap; gap: var(--gap); align-items: center; margin-bottom: 12px; }
.col { display: flex; flex-direction: column; gap: 6px; }
fieldset {
border: 1px solid #ddd; border-radius: 8px; background: #fff;
padding: 16px; margin: 0 0 var(--gap);
}
legend { font-weight: bold; padding: 0 6px; color: #333; }
label { font-size: 14px; }
.field-label { display: block; font-size: 13px; color: #555; margin-bottom: 4px; }
/* ---- native (unstyled) buttons ---- */
.native-buttons button,
.native-buttons input { margin: 0 6px 6px 0; }
/* ---- styled buttons ---- */
.btn {
font: inherit; font-size: 14px;
padding: 9px 18px; border-radius: 6px; border: 1px solid transparent;
cursor: pointer; line-height: 1;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #0052a3; }
.btn-outline { background: #fff; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: #eef5ff; }
.btn-ghost { background: transparent; color: #444; }
.btn-ghost:hover { background: #ececec; }
.btn-danger { background: #cc2222; color: #fff; }
.btn-danger:hover { background: #a31a1a; }
.btn-pill { border-radius: 999px; background: #222; color: #fff; }
.btn-gradient {
color: #fff; border: none;
background: linear-gradient(135deg, #6a11cb, #2575fc);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 13px 26px; font-size: 17px; }
.btn-icon { display: inline-flex; align-items: center; gap: 8px; }
/* ---- styled text inputs ---- */
.input {
font: inherit; font-size: 14px;
padding: 9px 12px; border: 1px solid #ccc; border-radius: 6px;
background: #fff; width: 240px; max-width: 100%;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px #0066cc33; }
.input::placeholder { color: #aaa; }
textarea.input { width: 100%; min-height: 90px; resize: vertical; }
select.input { width: 240px; }
/* ---- custom toggle switch ---- */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
position: absolute; inset: 0; cursor: pointer;
background: #ccc; border-radius: 26px; transition: background .2s;
}
.slider::before {
content: ""; position: absolute; height: 20px; width: 20px;
left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }
/* ---- custom card-style radios ---- */
.card-options { display: flex; gap: var(--gap); flex-wrap: wrap; }
.card-option { position: relative; }
.card-option input { position: absolute; opacity: 0; }
.card-option .card {
display: block;
border: 2px solid #ddd; border-radius: 8px; padding: 14px 18px;
cursor: pointer; min-width: 120px; background: #fff;
}
.card-option input:checked + .card { border-color: var(--accent); background: #eef5ff; }
.card-option .card b { display: block; }
.card-option .card span { font-size: 12px; color: #666; }
/* ---- progress & meter ---- */
.bars { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.bars label { display: flex; align-items: center; gap: 12px; }
.bars label .cap { width: 90px; font-size: 13px; color: #555; }
progress, meter { width: 240px; height: 16px; }
/* styled <progress> (WebKit + Firefox pseudo-elements) */
progress.styled {
appearance: none; -webkit-appearance: none; -moz-appearance: none;
height: 12px; border: none; border-radius: 999px; background: #e6e6e6;
overflow: hidden;
}
progress.styled::-webkit-progress-bar { background: #e6e6e6; border-radius: 999px; }
progress.styled::-webkit-progress-value {
background: linear-gradient(90deg, #6a11cb, #2575fc); border-radius: 999px;
}
progress.styled::-moz-progress-bar {
background: linear-gradient(90deg, #6a11cb, #2575fc); border-radius: 999px;
}
/* custom bar built from divs (no native element) */
.track { width: 240px; height: 12px; background: #e6e6e6; border-radius: 999px; overflow: hidden; }
.track .fill { height: 100%; border-radius: 999px; background: var(--accent); }
/* form grid wrapper */
.form-card { background: #fff; border: 1px solid #ddd; border-radius: 8px; padding: 20px; max-width: 520px; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }
</style>
</head>
<body>
<h1>Gosub forms & widgets test</h1>
<p class="lead">Native form controls alongside CSS-styled variants — buttons, inputs, selects, custom toggles and card radios.</p>
<h2>Native buttons & inputs</h2>
<fieldset class="native-buttons">
<legend>Browser defaults — no styling</legend>
<div class="row">
<button><button></button>
<button type="submit">Submit</button>
<button type="reset">Reset</button>
<button disabled>Disabled</button>
<input type="button" value="input button">
<input type="submit" value="input submit">
<input type="reset" value="input reset">
</div>
</fieldset>
<h2>Styled buttons</h2>
<fieldset>
<legend>Variants</legend>
<div class="row">
<button class="btn btn-primary">Primary</button>
<button class="btn btn-outline">Outline</button>
<button class="btn btn-ghost">Ghost</button>
<button class="btn btn-danger">Danger</button>
<button class="btn btn-pill">Pill</button>
<button class="btn btn-gradient">Gradient</button>
<button class="btn btn-primary" disabled>Disabled</button>
</div>
<div class="row">
<button class="btn btn-primary btn-sm">Small</button>
<button class="btn btn-primary">Default</button>
<button class="btn btn-primary btn-lg">Large</button>
<button class="btn btn-outline btn-icon"><span>★</span> With icon</button>
</div>
</fieldset>
<h2>Text inputs</h2>
<fieldset>
<legend>Native types</legend>
<div class="row">
<div class="col">
<span class="field-label">text</span>
<input type="text" placeholder="text">
</div>
<div class="col">
<span class="field-label">password</span>
<input type="password" placeholder="password" value="secret">
</div>
<div class="col">
<span class="field-label">email</span>
<input type="email" placeholder="you@example.com">
</div>
<div class="col">
<span class="field-label">number</span>
<input type="number" value="42" min="0" max="100">
</div>
</div>
<div class="row">
<div class="col">
<span class="field-label">date</span>
<input type="date">
</div>
<div class="col">
<span class="field-label">time</span>
<input type="time">
</div>
<div class="col">
<span class="field-label">color</span>
<input type="color" value="#0066cc">
</div>
<div class="col">
<span class="field-label">file</span>
<input type="file">
</div>
</div>
<div class="row">
<div class="col">
<span class="field-label">range</span>
<input type="range" min="0" max="100" value="60">
</div>
<div class="col">
<span class="field-label">search</span>
<input type="search" placeholder="search…">
</div>
<div class="col">
<span class="field-label">disabled / readonly</span>
<input type="text" value="disabled" disabled>
</div>
</div>
</fieldset>
<fieldset>
<legend>Styled inputs</legend>
<div class="row">
<input class="input" type="text" placeholder="Styled text input">
<input class="input" type="email" placeholder="Styled email">
<select class="input">
<option>Choose an option</option>
<option>Apple</option>
<option>Banana</option>
<option>Cherry</option>
</select>
</div>
<div class="row" style="display:block">
<textarea class="input" placeholder="Styled textarea…"></textarea>
</div>
</fieldset>
<h2>Checkboxes & radios</h2>
<fieldset>
<legend>Native</legend>
<div class="row">
<label><input type="checkbox" checked> Checked</label>
<label><input type="checkbox"> Unchecked</label>
<label><input type="checkbox" disabled> Disabled</label>
</div>
<div class="row">
<label><input type="radio" name="r1" checked> Option A</label>
<label><input type="radio" name="r1"> Option B</label>
<label><input type="radio" name="r1"> Option C</label>
<label><input type="radio" name="r1" disabled> Disabled</label>
</div>
</fieldset>
<h2>Custom widgets</h2>
<fieldset>
<legend>Toggle switches</legend>
<div class="row">
<label class="switch"><input type="checkbox" checked><span class="slider"></span></label>
<label class="switch"><input type="checkbox"><span class="slider"></span></label>
<span style="font-size:14px;color:#555">CSS-only toggle built from a checkbox</span>
</div>
</fieldset>
<fieldset>
<legend>Card-style radio group</legend>
<div class="card-options">
<label class="card-option">
<input type="radio" name="plan" checked>
<span class="card"><b>Free</b><span>$0 / month</span></span>
</label>
<label class="card-option">
<input type="radio" name="plan">
<span class="card"><b>Pro</b><span>$9 / month</span></span>
</label>
<label class="card-option">
<input type="radio" name="plan">
<span class="card"><b>Team</b><span>$29 / month</span></span>
</label>
</div>
</fieldset>
<h2>Progress & meters</h2>
<fieldset>
<legend>Native <progress></legend>
<div class="bars">
<label><span class="cap">0%</span><progress max="100" value="0"></progress></label>
<label><span class="cap">30%</span><progress max="100" value="30"></progress></label>
<label><span class="cap">70%</span><progress max="100" value="70"></progress></label>
<label><span class="cap">100%</span><progress max="100" value="100"></progress></label>
<label><span class="cap">indeterminate</span><progress></progress></label>
</div>
</fieldset>
<fieldset>
<legend>Native <meter></legend>
<div class="bars">
<label><span class="cap">low</span><meter min="0" max="100" low="33" high="66" optimum="80" value="20"></meter></label>
<label><span class="cap">medium</span><meter min="0" max="100" low="33" high="66" optimum="80" value="50"></meter></label>
<label><span class="cap">high</span><meter min="0" max="100" low="33" high="66" optimum="80" value="90"></meter></label>
<label><span class="cap">disk usage</span><meter min="0" max="1" value="0.85"></meter></label>
</div>
</fieldset>
<fieldset>
<legend>Styled & custom</legend>
<div class="bars">
<label><span class="cap">gradient</span><progress class="styled" max="100" value="45"></progress></label>
<label><span class="cap">div-based</span><span class="track"><span class="fill" style="width:65%"></span></span></label>
</div>
</fieldset>
<h2>Complete form</h2>
<form class="form-card">
<div class="col" style="margin-bottom:14px">
<label class="field-label" for="name">Name</label>
<input class="input" id="name" type="text" placeholder="Jane Doe" style="width:100%">
</div>
<div class="col" style="margin-bottom:14px">
<label class="field-label" for="msg">Message</label>
<textarea class="input" id="msg" placeholder="Your message…"></textarea>
</div>
<div class="row">
<label><input type="checkbox"> Subscribe to newsletter</label>
</div>
<div class="form-actions">
<button class="btn btn-primary" type="submit">Send</button>
<button class="btn btn-ghost" type="reset">Clear</button>
</div>
</form>
</body>
</html>