@purestack/ts-components 1.1.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.
Files changed (106) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -0
  3. package/dist/ts-components.d.mts +1662 -0
  4. package/dist/ts-components.d.mts.map +1 -0
  5. package/dist/ts-components.mjs +9200 -0
  6. package/dist/ts-components.mjs.map +1 -0
  7. package/package.json +130 -0
  8. package/src/defineComponents.ts +87 -0
  9. package/src/index.ts +270 -0
  10. package/src/registerStyles.ts +63 -0
  11. package/src/standard/alertBox/alertBox.ts +64 -0
  12. package/src/standard/autoId.ts +25 -0
  13. package/src/standard/badge/badge.ts +41 -0
  14. package/src/standard/badge/badgeStyle.ts +21 -0
  15. package/src/standard/barChart/barChart.ts +338 -0
  16. package/src/standard/barChart/barChartStyle.ts +81 -0
  17. package/src/standard/btn/btn.ts +191 -0
  18. package/src/standard/btn/btnStyle.ts +59 -0
  19. package/src/standard/btnGroup/btnGroup.ts +208 -0
  20. package/src/standard/btnGroup/btnGroupStyle.ts +85 -0
  21. package/src/standard/chart/cartesianChart.ts +99 -0
  22. package/src/standard/chart/chartDefaults.ts +25 -0
  23. package/src/standard/chart/chartUtils.ts +84 -0
  24. package/src/standard/classicLogo/classicLogo.ts +429 -0
  25. package/src/standard/classicLogo/classicLogoStyle.ts +292 -0
  26. package/src/standard/componentVariant.ts +153 -0
  27. package/src/standard/composer/composer.ts +1035 -0
  28. package/src/standard/composer/composerCanvasInitialStyle.ts +225 -0
  29. package/src/standard/composer/composerCanvasRevertStyle.ts +14 -0
  30. package/src/standard/composer/composerCanvasSharedStyle.ts +60 -0
  31. package/src/standard/composer/composerCanvasStyleTypes.ts +8 -0
  32. package/src/standard/composer/composerCanvasThemeStyle.ts +53 -0
  33. package/src/standard/composer/composerStyle.ts +156 -0
  34. package/src/standard/composer/emailHtmlPolicy.ts +474 -0
  35. package/src/standard/consent/consent.ts +173 -0
  36. package/src/standard/consent/consentStyle.ts +44 -0
  37. package/src/standard/contactForm/contactForm.ts +135 -0
  38. package/src/standard/contactForm/contactFormStyle.ts +116 -0
  39. package/src/standard/doughnutChart/doughnutChart.ts +527 -0
  40. package/src/standard/doughnutChart/doughnutChartStyle.ts +64 -0
  41. package/src/standard/dropFiles/dropFiles.ts +480 -0
  42. package/src/standard/dropFiles/dropFilesStyle.ts +171 -0
  43. package/src/standard/expandablePanel/expandablePanel.ts +106 -0
  44. package/src/standard/expandablePanel/expandablePanelStyle.ts +56 -0
  45. package/src/standard/flex/flex.ts +269 -0
  46. package/src/standard/flex/flexStyle.ts +556 -0
  47. package/src/standard/footer/footer.ts +93 -0
  48. package/src/standard/footer/footerStyle.ts +39 -0
  49. package/src/standard/form/autoCompleteInput.ts +567 -0
  50. package/src/standard/form/form.ts +205 -0
  51. package/src/standard/form/formCheck.ts +96 -0
  52. package/src/standard/form/formInputField.ts +184 -0
  53. package/src/standard/form/formSelectField.ts +152 -0
  54. package/src/standard/form/formStyle.ts +585 -0
  55. package/src/standard/form/multiAutoCompleteInput.ts +880 -0
  56. package/src/standard/grid/grid.ts +177 -0
  57. package/src/standard/grid/gridStyle.ts +56 -0
  58. package/src/standard/icon/icon.ts +96 -0
  59. package/src/standard/icon/iconStyle.ts +50 -0
  60. package/src/standard/landing/codeShowcase.ts +54 -0
  61. package/src/standard/landing/comparisonColumn.ts +30 -0
  62. package/src/standard/landing/comparisonFeature.ts +22 -0
  63. package/src/standard/landing/comparisonTable.ts +38 -0
  64. package/src/standard/landing/ctaSection.ts +59 -0
  65. package/src/standard/landing/featureCard.ts +41 -0
  66. package/src/standard/landing/landing.ts +52 -0
  67. package/src/standard/landing/landingBand.ts +217 -0
  68. package/src/standard/landing/landingSection.ts +43 -0
  69. package/src/standard/landing/landingTypes.ts +141 -0
  70. package/src/standard/landing/metricItem.ts +25 -0
  71. package/src/standard/landing/metricStrip.ts +20 -0
  72. package/src/standard/lineChart/lineChart.ts +462 -0
  73. package/src/standard/lineChart/lineChartStyle.ts +91 -0
  74. package/src/standard/logo/logo.ts +192 -0
  75. package/src/standard/logo/logoStyle.ts +164 -0
  76. package/src/standard/modal/modal.ts +171 -0
  77. package/src/standard/modal/modalStore.ts +154 -0
  78. package/src/standard/modal/modalStyle.ts +190 -0
  79. package/src/standard/navMenu/navMenu.ts +278 -0
  80. package/src/standard/navMenu/navMenuStyle.ts +323 -0
  81. package/src/standard/pageLinks/pageLinks.ts +90 -0
  82. package/src/standard/pageScript/pageScript.ts +155 -0
  83. package/src/standard/pageToc/pageToc.ts +154 -0
  84. package/src/standard/pageToc/pageTocStyle.ts +372 -0
  85. package/src/standard/panel/panel.ts +55 -0
  86. package/src/standard/panel/panelStyle.ts +15 -0
  87. package/src/standard/pricing/pricing.ts +146 -0
  88. package/src/standard/searchBox/searchBox.ts +54 -0
  89. package/src/standard/searchBox/searchBoxStyle.ts +180 -0
  90. package/src/standard/sectionHeader/sectionHeader.ts +99 -0
  91. package/src/standard/signIn/signIn.ts +167 -0
  92. package/src/standard/signIn/signInStyle.ts +70 -0
  93. package/src/standard/tabs/tabs.ts +193 -0
  94. package/src/standard/tabs/tabsStyle.ts +231 -0
  95. package/src/standard/themeToggle/themeToggle.ts +33 -0
  96. package/src/standard/themeToggle/themeToggleStyle.ts +88 -0
  97. package/src/standard/toast/toastHost.ts +42 -0
  98. package/src/standard/toast/toastStore.ts +50 -0
  99. package/src/standard/topBar/topBar.ts +101 -0
  100. package/src/standard/topBar/topBarStyle.ts +169 -0
  101. package/src/standard/virtualList/variableVirtualTable.ts +371 -0
  102. package/src/standard/virtualList/virtualList.ts +423 -0
  103. package/src/standard/virtualList/virtualListStyle.ts +34 -0
  104. package/src/standard/virtualList/virtualTable.ts +179 -0
  105. package/src/standard/virtualList/virtualTableStyle.ts +24 -0
  106. package/tsconfig.json +23 -0
@@ -0,0 +1,585 @@
1
+ import type { ThemePalette } from '@purestack/ts-style'
2
+ import {
3
+ BREAKPOINTS,
4
+ mediaMax,
5
+ styleBuilder,
6
+ type ThemeMode,
7
+ themes,
8
+ } from '@purestack/ts-style'
9
+
10
+ export function registerFormStyles() {
11
+ themes.forEach((theme, palette) => {
12
+ registerFormShellStyles(theme)
13
+ registerFormFieldStyles(theme, palette)
14
+ registerAutoCompleteInputStyles(theme, palette)
15
+ registerMultiAutoCompleteInputStyles(theme, palette)
16
+ registerFormMetaStyles(theme, palette)
17
+ registerFormCheckStyles(theme, palette)
18
+ registerFormStatusStyles(theme, palette)
19
+ registerFormResponsiveStyles(theme)
20
+ registerFormSelectFieldStyles(theme, palette)
21
+ })
22
+ }
23
+
24
+ function registerFormShellStyles(theme: ThemeMode) {
25
+ styleBuilder.select('.form-block', theme).display('grid').gap('0.75rem')
26
+ }
27
+
28
+ function registerFormFieldStyles(theme: ThemeMode, palette: ThemePalette) {
29
+ styleBuilder.select('.form-block__field', theme).display('grid').gap('0.6em')
30
+ styleBuilder
31
+ .select('.form-block__label', theme)
32
+ .apply(palette.applyFont(palette.font.size.xxs, palette.font.weight.w700))
33
+ .color(palette.current.tone)
34
+ .lineHeight('1')
35
+ styleBuilder
36
+ .select('.form-block__input-shell', theme)
37
+ .width('100%')
38
+ .boxSizing('border-box')
39
+ .borderRadius(palette.radii.md)
40
+ .transition('border-color 160ms ease, box-shadow 160ms ease')
41
+ .display('flex')
42
+ .alignItems('stretch')
43
+ .overflow('hidden')
44
+ styleBuilder
45
+ .select(
46
+ '.form-block__input-shell:has(.form-block__input:focus-visible)',
47
+ theme,
48
+ )
49
+ .outline('none')
50
+ .borderColor(palette.current.border.default)
51
+ .boxShadow(`0 0 0 3px ${palette.current.border.focus}`)
52
+ styleBuilder
53
+ .select('.form-block__input', theme)
54
+ .width('100%')
55
+ .minWidth('0')
56
+ .boxSizing('border-box')
57
+ .padding('0.5em 0.6em')
58
+ .border('none')
59
+ .borderRadius('0')
60
+ .apply(palette.applyFont(palette.font.size.sm))
61
+ .background('transparent')
62
+ .boxShadow('none')
63
+ .flex('1 1 auto')
64
+ styleBuilder
65
+ .select('.form-block__input::placeholder', theme)
66
+ .color(palette.current.text.subtle)
67
+ styleBuilder.select('.form-block__input:focus-visible', theme).outline('none')
68
+ styleBuilder
69
+ .select('.form-block__input[type="color"]', theme)
70
+ .padding('0.2rem')
71
+ .height('2rem')
72
+ .cursor('pointer')
73
+ styleBuilder
74
+ .select(
75
+ '.form-block__input[type="number"]::-webkit-outer-spin-button, .form-block__input[type="number"]::-webkit-inner-spin-button',
76
+ theme,
77
+ )
78
+ .appearance('none')
79
+ .margin('0')
80
+ styleBuilder
81
+ .select('.form-block__input[type="number"]', theme)
82
+ .appearance('textfield')
83
+ styleBuilder
84
+ .select('.form-block__input-icon', theme)
85
+ .color(palette.current.text.subtle)
86
+ // Size the icon from the field's text, not from the surrounding page, so it
87
+ // stays in proportion with the value and placeholder beside it.
88
+ styleBuilder
89
+ .select('.icon.form-block__input-icon', theme)
90
+ .fontSize(palette.font.size.sm)
91
+ .width('1.4em')
92
+ .height('1.4em')
93
+ styleBuilder
94
+ .select(
95
+ '.form-block__input-shell > .form-block__input-icon:first-child',
96
+ theme,
97
+ )
98
+ .marginLeft('0.6em')
99
+ .marginRight('0')
100
+ styleBuilder
101
+ .select(
102
+ '.form-block__input-shell > .form-block__input-icon:last-child',
103
+ theme,
104
+ )
105
+ .marginLeft('0')
106
+ .marginRight('0.6em')
107
+ styleBuilder
108
+ .select('.form-block__number-controls', theme)
109
+ .display('grid')
110
+ .gridTemplateRows('1fr 1fr')
111
+ .width('2em')
112
+ .flex('0 0 auto')
113
+ .background('transparent')
114
+ styleBuilder
115
+ .select('.form-block__number-btn', theme)
116
+ .display('grid')
117
+ .placeItems('center')
118
+ .padding('0')
119
+ .border('none')
120
+ .apply(palette.applyFont(palette.font.size.sm, palette.font.weight.w700))
121
+ .lineHeight('1')
122
+ .cursor('pointer')
123
+ }
124
+
125
+ function registerFormSelectFieldStyles(
126
+ theme: ThemeMode,
127
+ palette: ThemePalette,
128
+ ) {
129
+ registerFormSelectControlStyles(theme)
130
+ registerFormSelectOptionStyles(theme, palette)
131
+ registerFormSelectIconStyles(theme)
132
+ }
133
+
134
+ function registerFormSelectControlStyles(theme: ThemeMode) {
135
+ styleBuilder.select('.form-block__select-shell', theme).position('relative')
136
+ styleBuilder
137
+ .select('.form-block__select', theme)
138
+ .appearance('none')
139
+ .cursor('pointer')
140
+ .paddingRight('2.9em')
141
+ styleBuilder
142
+ .select('.form-block__select:disabled', theme)
143
+ .cursor('not-allowed')
144
+ styleBuilder
145
+ .select(
146
+ '.form-block__select-shell:has(> .form-block__input-icon:first-child) .form-block__select',
147
+ theme,
148
+ )
149
+ .paddingLeft('2.9em')
150
+ }
151
+
152
+ function registerFormSelectOptionStyles(
153
+ theme: ThemeMode,
154
+ palette: ThemePalette,
155
+ ) {
156
+ styleBuilder
157
+ .select('option, optgroup', theme)
158
+ .backgroundColor(palette.current.canvascolor)
159
+ styleBuilder
160
+ .select('option:disabled, optgroup:disabled', theme)
161
+ .color(palette.current.text.subtle)
162
+ }
163
+
164
+ function registerFormSelectIconStyles(theme: ThemeMode) {
165
+ styleBuilder
166
+ .select(
167
+ '.form-block__select-shell > .form-block__input-icon:first-child',
168
+ theme,
169
+ )
170
+ .position('absolute')
171
+ .left('0.6em')
172
+ .top('50%')
173
+ .transform('translateY(-50%)')
174
+ .pointerEvents('none')
175
+ .marginLeft('0')
176
+ .marginRight('0')
177
+
178
+ styleBuilder
179
+ .select(
180
+ '.form-block__select-shell > .form-block__input-icon:last-child',
181
+ theme,
182
+ )
183
+ .position('absolute')
184
+ .right('0.6em')
185
+ .top('50%')
186
+ .transform('translateY(-50%)')
187
+ .pointerEvents('none')
188
+ .marginLeft('0')
189
+ .marginRight('0')
190
+ }
191
+
192
+ function registerAutoCompleteInputStyles(
193
+ theme: ThemeMode,
194
+ palette: ThemePalette,
195
+ ) {
196
+ styleBuilder
197
+ .select('.auto-complete-input', theme)
198
+ .position('relative')
199
+ .maxWidth('100%')
200
+
201
+ styleBuilder
202
+ .select('.auto-complete-input__popup', theme)
203
+ .position('absolute')
204
+ .left('0')
205
+ .right('0')
206
+ .top('calc(100% + 0.375rem)')
207
+ .boxSizing('border-box')
208
+ .maxHeight('18rem')
209
+ .overflow('auto')
210
+ .padding('0.35em')
211
+ .borderRadius(palette.radii.md)
212
+ .border(`1px solid ${palette.current.border.default}`)
213
+ .background(palette.current.surface.rest.background)
214
+ .boxShadow(palette.effect.strongShadow)
215
+ .zIndex('70')
216
+
217
+ styleBuilder
218
+ .select('.auto-complete-input__listbox', theme)
219
+ .display('grid')
220
+ .gap('0.2em')
221
+
222
+ styleBuilder
223
+ .select('.auto-complete-input__option', theme)
224
+ .borderRadius(palette.radii.sm)
225
+ .color(palette.current.text.default)
226
+ .cursor('pointer')
227
+ .transition('background 140ms ease, color 140ms ease')
228
+
229
+ styleBuilder
230
+ .select(
231
+ '.auto-complete-input__option:hover:not(.auto-complete-input__option--disabled), .auto-complete-input__option--active',
232
+ theme,
233
+ )
234
+ .background(palette.current.button.hover.background)
235
+ .color(palette.current.button.hover.text)
236
+
237
+ styleBuilder
238
+ .select('.auto-complete-input__option--selected', theme)
239
+ .background(palette.current.surfaceAlt.rest.background)
240
+
241
+ styleBuilder
242
+ .select('.auto-complete-input__option--disabled', theme)
243
+ .cursor('not-allowed')
244
+ .opacity('0.55')
245
+
246
+ styleBuilder
247
+ .select(
248
+ '.auto-complete-input__message, .auto-complete-input__default-row',
249
+ theme,
250
+ )
251
+ .boxSizing('border-box')
252
+ .width('100%')
253
+ .padding('0.55em 0.65em')
254
+ .apply(palette.applyFont(palette.font.size.sm))
255
+
256
+ styleBuilder
257
+ .select('.auto-complete-input__message', theme)
258
+ .color(palette.current.text.subtle)
259
+
260
+ styleBuilder
261
+ .select('.auto-complete-input__default-row', theme)
262
+ .display('grid')
263
+ .gridTemplateColumns('minmax(0, 1fr) auto')
264
+ .alignItems('center')
265
+ .gap('0.6em')
266
+
267
+ styleBuilder
268
+ .select('.auto-complete-input__default-label', theme)
269
+ .overflow('hidden')
270
+ .textOverflow('ellipsis')
271
+ .whiteSpace('nowrap')
272
+
273
+ styleBuilder
274
+ .select('.auto-complete-input__default-check', theme)
275
+ .width('1em')
276
+ .height('1em')
277
+ .color(palette.current.tone)
278
+ }
279
+
280
+ function registerMultiAutoCompleteInputStyles(
281
+ theme: ThemeMode,
282
+ palette: ThemePalette,
283
+ ) {
284
+ styleBuilder
285
+ .select('.multi-auto-complete-input', theme)
286
+ .position('relative')
287
+ .maxWidth('100%')
288
+
289
+ styleBuilder
290
+ .select('.multi-auto-complete-input__shell', theme)
291
+ .minHeight('2.45em')
292
+ .cursor('text')
293
+
294
+ styleBuilder
295
+ .select('.multi-auto-complete-input__shell--disabled', theme)
296
+ .cursor('not-allowed')
297
+
298
+ styleBuilder
299
+ .select('.multi-auto-complete-input__control', theme)
300
+ .display('flex')
301
+ .alignItems('center')
302
+ .flexWrap('wrap')
303
+ .gap('0.35em')
304
+ .width('100%')
305
+ .minWidth('0')
306
+ .padding('0.35em')
307
+ .boxSizing('border-box')
308
+
309
+ styleBuilder
310
+ .select('.multi-auto-complete-input__query', theme)
311
+ .width('8rem')
312
+ .minWidth('7rem')
313
+ .padding('0.15em 0.25em')
314
+ .lineHeight('1.5')
315
+
316
+ styleBuilder
317
+ .select('.multi-auto-complete-input__item', theme)
318
+ .display('inline-flex')
319
+ .alignItems('center')
320
+ .maxWidth('100%')
321
+ .gap('0.3em')
322
+ .padding('0.18em 0.25em 0.18em 0.55em')
323
+ .borderRadius(palette.radii.sm)
324
+ .background(palette.current.surfaceAlt.rest.background)
325
+ .color(palette.current.text.default)
326
+ .apply(palette.applyFont(palette.font.size.xs, palette.font.weight.w600))
327
+
328
+ styleBuilder
329
+ .select('.multi-auto-complete-input__item--invalid', theme)
330
+ .background(palette.semanticTone.danger.surface.rest.background)
331
+ .color(palette.semanticTone.danger.text.default)
332
+
333
+ styleBuilder
334
+ .select('.multi-auto-complete-input__item--disabled', theme)
335
+ .opacity('0.58')
336
+
337
+ styleBuilder
338
+ .select('.multi-auto-complete-input__item-label', theme)
339
+ .minWidth('0')
340
+ .overflow('hidden')
341
+ .textOverflow('ellipsis')
342
+ .whiteSpace('nowrap')
343
+
344
+ styleBuilder
345
+ .select('.multi-auto-complete-input__remove', theme)
346
+ .display('grid')
347
+ .placeItems('center')
348
+ .width('1.35em')
349
+ .height('1.35em')
350
+ .padding('0')
351
+ .border('none')
352
+ .borderRadius(palette.radii.sm)
353
+ .background('transparent')
354
+ .color('currentColor')
355
+ .cursor('pointer')
356
+
357
+ styleBuilder
358
+ .select('.multi-auto-complete-input__remove:hover', theme)
359
+ .background(palette.current.button.hover.background)
360
+ .color(palette.current.button.hover.text)
361
+
362
+ styleBuilder
363
+ .select('.multi-auto-complete-input__remove .icon', theme)
364
+ .width('1em')
365
+ .height('1em')
366
+
367
+ styleBuilder
368
+ .select('.multi-auto-complete-input__popup', theme)
369
+ .position('absolute')
370
+ .left('0')
371
+ .right('0')
372
+ .top('calc(100% + 0.375rem)')
373
+ .boxSizing('border-box')
374
+ .maxHeight('18rem')
375
+ .overflow('auto')
376
+ .padding('0.35em')
377
+ .borderRadius(palette.radii.md)
378
+ .border(`1px solid ${palette.current.border.default}`)
379
+ .background(palette.current.surface.rest.background)
380
+ .boxShadow(palette.effect.strongShadow)
381
+ .zIndex('70')
382
+
383
+ styleBuilder
384
+ .select('.multi-auto-complete-input__listbox', theme)
385
+ .display('grid')
386
+ .gap('0.2em')
387
+
388
+ styleBuilder
389
+ .select('.multi-auto-complete-input__option', theme)
390
+ .borderRadius(palette.radii.sm)
391
+ .color(palette.current.text.default)
392
+ .cursor('pointer')
393
+ .transition('background 140ms ease, color 140ms ease')
394
+
395
+ styleBuilder
396
+ .select(
397
+ '.multi-auto-complete-input__option:hover:not(.multi-auto-complete-input__option--disabled), .multi-auto-complete-input__option--active',
398
+ theme,
399
+ )
400
+ .background(palette.current.button.hover.background)
401
+ .color(palette.current.button.hover.text)
402
+
403
+ styleBuilder
404
+ .select('.multi-auto-complete-input__option--disabled', theme)
405
+ .cursor('not-allowed')
406
+ .opacity('0.55')
407
+
408
+ styleBuilder
409
+ .select(
410
+ '.multi-auto-complete-input__message, .multi-auto-complete-input__default-row',
411
+ theme,
412
+ )
413
+ .boxSizing('border-box')
414
+ .width('100%')
415
+ .padding('0.55em 0.65em')
416
+ .apply(palette.applyFont(palette.font.size.sm))
417
+
418
+ styleBuilder
419
+ .select('.multi-auto-complete-input__message', theme)
420
+ .color(palette.current.text.subtle)
421
+
422
+ styleBuilder
423
+ .select('.multi-auto-complete-input__default-label', theme)
424
+ .display('block')
425
+ .overflow('hidden')
426
+ .textOverflow('ellipsis')
427
+ .whiteSpace('nowrap')
428
+ }
429
+
430
+ function registerFormMetaStyles(theme: ThemeMode, palette: ThemePalette) {
431
+ styleBuilder
432
+ .select('.form-block__meta', theme)
433
+ .display('flex')
434
+ .alignItems('center')
435
+ .justifyContent('space-between')
436
+ .gap('0.625rem')
437
+ styleBuilder
438
+ .select('.form-block__assist-link', theme)
439
+ .apply(palette.applyFont(palette.font.size.xxs, palette.font.weight.w700))
440
+ .textDecoration('none')
441
+ .color(palette.current.tone)
442
+ styleBuilder
443
+ .select('.form-block__assist-link:hover', theme)
444
+ .textDecoration('underline')
445
+ styleBuilder
446
+ .select('.form-block__divider', theme)
447
+ .position('relative')
448
+ .height('1px')
449
+ .background(palette.current.border.default)
450
+ .margin('0.125rem 0')
451
+ styleBuilder
452
+ .select('.form-block__divider::after', theme)
453
+ .content('attr(data-label)')
454
+ .position('absolute')
455
+ .left('50%')
456
+ .top('50%')
457
+ .transform('translate(-50%, -50%)')
458
+ .padding('0 0.5em')
459
+ .apply(palette.applyFont(palette.font.size.xxxs, palette.font.weight.w700))
460
+ .background(palette.current.surfaceAlt.rest.background)
461
+ .color(palette.current.text.subtle)
462
+ }
463
+
464
+ function registerFormCheckStyles(theme: ThemeMode, palette: ThemePalette) {
465
+ styleBuilder
466
+ .select('.form-block__check', theme)
467
+ .position('relative')
468
+ .display('grid')
469
+ .gridTemplateColumns('auto minmax(0, 1fr)')
470
+ .alignItems('start')
471
+ .gap('0.65em')
472
+ .padding('0.45em 0.55em')
473
+ .borderRadius(palette.radii.md)
474
+ .apply(palette.applyFont(palette.font.size.xxs))
475
+ .color(palette.current.tone)
476
+ .cursor('pointer')
477
+ .transition('background 150ms ease, color 150ms ease, opacity 150ms ease')
478
+ styleBuilder
479
+ .select('.form-block__check:hover', theme)
480
+ .background(palette.current.surfaceAlt.hover.background)
481
+ .color(palette.current.surfaceAlt.hover.text)
482
+ styleBuilder
483
+ .select('.form-block__check--bare', theme)
484
+ .gridTemplateColumns('auto')
485
+ .gap('0')
486
+ .padding('0')
487
+ .width('fit-content')
488
+ styleBuilder
489
+ .select('.form-block__check--bare:hover', theme)
490
+ .background('transparent')
491
+ styleBuilder
492
+ .select('.form-block__check:has(.form-block__check-input:disabled)', theme)
493
+ .cursor('not-allowed')
494
+ .opacity('0.62')
495
+ styleBuilder
496
+ .select('.form-block__check-input', theme)
497
+ .position('absolute')
498
+ .width('1px')
499
+ .height('1px')
500
+ .margin('0')
501
+ .opacity('0')
502
+ .pointerEvents('none')
503
+ styleBuilder
504
+ .select('.form-block__check-control', theme)
505
+ .position('relative')
506
+ .display('grid')
507
+ .placeItems('center')
508
+ .width('1.35em')
509
+ .height('1.35em')
510
+ .boxSizing('border-box')
511
+ .border(`1px solid ${palette.current.border.default}`)
512
+ .borderRadius(palette.radii.sm)
513
+ .background(palette.current.surfaceAlt.rest.background)
514
+ .color(palette.current.button.rest.text)
515
+ .boxShadow('inset 0 1px 0 rgba(255, 255, 255, 0.08)')
516
+ .transition(
517
+ 'background 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease',
518
+ )
519
+ styleBuilder
520
+ .select('.form-block__check-control::after', theme)
521
+ .content('""')
522
+ .width('0.38em')
523
+ .height('0.68em')
524
+ .border('solid currentColor')
525
+ .borderWidth('0 0.16em 0.16em 0')
526
+ .opacity('0')
527
+ .transform('translateY(-0.08em) rotate(45deg) scale(0.72)')
528
+ .transition('opacity 120ms ease, transform 150ms ease')
529
+ styleBuilder
530
+ .select(
531
+ '.form-block__check-input:focus-visible + .form-block__check-control',
532
+ theme,
533
+ )
534
+ .outline('none')
535
+ .borderColor(palette.current.border.default)
536
+ .boxShadow(`0 0 0 3px ${palette.current.border.focus}`)
537
+ styleBuilder
538
+ .select(
539
+ '.form-block__check-input:active + .form-block__check-control',
540
+ theme,
541
+ )
542
+ .transform('scale(0.96)')
543
+ styleBuilder
544
+ .select(
545
+ '.form-block__check-input:checked + .form-block__check-control',
546
+ theme,
547
+ )
548
+ .borderColor(palette.current.button.rest.border)
549
+ .background(palette.current.button.rest.background)
550
+ .boxShadow('none')
551
+ styleBuilder
552
+ .select(
553
+ '.form-block__check-input:checked + .form-block__check-control::after',
554
+ theme,
555
+ )
556
+ .opacity('1')
557
+ .transform('translateY(-0.08em) rotate(45deg) scale(1)')
558
+ styleBuilder
559
+ .select(
560
+ '.form-block__check-input:disabled + .form-block__check-control',
561
+ theme,
562
+ )
563
+ .boxShadow('none')
564
+ styleBuilder
565
+ .select('.form-block__check-label', theme)
566
+ .minWidth('0')
567
+ .lineHeight('1.35')
568
+ }
569
+
570
+ function registerFormStatusStyles(theme: ThemeMode, palette: ThemePalette) {
571
+ styleBuilder
572
+ .select('.form-status', theme)
573
+ .marginTop('0.25rem')
574
+ .padding('0.5em 0.6em')
575
+ .borderRadius(palette.radii.md)
576
+ .apply(palette.applyFont(palette.font.size.sm))
577
+ }
578
+
579
+ function registerFormResponsiveStyles(theme: ThemeMode) {
580
+ styleBuilder
581
+ .select('.form-block__meta', theme)
582
+ .media(mediaMax(BREAKPOINTS.sm))
583
+ .flexDirection('column')
584
+ .alignItems('flex-start')
585
+ }