@stacksjs/components 0.2.865 → 0.2.868

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 (116) hide show
  1. package/dist/AppearancePicker-61r20jpp.stx +351 -0
  2. package/dist/{Button-sebyqeva.stx → Button-pg8mzsq3.stx} +249 -0
  3. package/dist/Checkbox-52mhrzkz.stx +417 -0
  4. package/dist/ColorSwatches-ecfxphjy.stx +287 -0
  5. package/dist/{NumberInput-axcfj9y8.stx → NumberInput-e2afxyh3.stx} +303 -0
  6. package/dist/{PasswordInput-8m3109tp.stx → PasswordInput-n2ven456.stx} +315 -0
  7. package/dist/RadioGroup-ps9kn22f.stx +329 -0
  8. package/dist/RadioGroupOption-6hyy1bvb.stx +246 -0
  9. package/dist/{SegmentedControl-fr69q4gb.stx → SegmentedControl-7q0t8c9s.stx} +170 -1
  10. package/dist/{Select-1cnqbcmg.stx → Select-ygzchedx.stx} +266 -0
  11. package/dist/SettingsGroup-dkae46k5.stx +200 -0
  12. package/dist/SettingsPane-jbd1gbdt.stx +50 -0
  13. package/dist/SettingsPaneHeader-f0cvkqs7.stx +188 -0
  14. package/dist/SettingsRow-4cxbsf1q.stx +424 -0
  15. package/dist/SettingsSidebarGroup-p2ygv5yy.stx +108 -0
  16. package/dist/SettingsSidebarItem-x8fsn3w5.stx +228 -0
  17. package/dist/SettingsWindow-mm490ymt.stx +537 -0
  18. package/dist/Slider-j59dgw1c.stx +377 -0
  19. package/dist/Switch-ga9ap8n8.stx +374 -0
  20. package/dist/{TextInput-tsvfwxmg.stx → TextInput-tyqzz3jy.stx} +325 -0
  21. package/dist/index.d.ts +6 -0
  22. package/dist/index.js +35 -24
  23. package/dist/preview-frame/preview-frame.js +58 -2
  24. package/dist/settings/settings.js +757 -0
  25. package/dist/ui/appearance-picker/AppearancePicker.d.ts +12 -0
  26. package/dist/ui/appearance-picker/index.d.ts +16 -0
  27. package/dist/ui/button/Button.d.ts +24 -1
  28. package/dist/ui/button/index.d.ts +1 -0
  29. package/dist/ui/checkbox/Checkbox.d.ts +9 -1
  30. package/dist/ui/checkbox/index.d.ts +1 -0
  31. package/dist/ui/color-swatches/ColorSwatches.d.ts +26 -0
  32. package/dist/ui/color-swatches/index.d.ts +18 -0
  33. package/dist/ui/input/NumberInput.d.ts +11 -1
  34. package/dist/ui/input/PasswordInput.d.ts +9 -1
  35. package/dist/ui/input/TextInput.d.ts +12 -1
  36. package/dist/ui/input/index.d.ts +7 -3
  37. package/dist/ui/preview-frame/core.d.ts +22 -0
  38. package/dist/ui/preview-frame/view.d.ts +9 -0
  39. package/dist/ui/radio-group/RadioGroup.d.ts +14 -2
  40. package/dist/ui/radio-group/RadioGroupOption.d.ts +6 -1
  41. package/dist/ui/radio-group/index.d.ts +2 -0
  42. package/dist/ui/segmented-control/SegmentedControl.d.ts +9 -1
  43. package/dist/ui/segmented-control/index.d.ts +1 -0
  44. package/dist/ui/select/Select.d.ts +10 -1
  45. package/dist/ui/select/index.d.ts +1 -0
  46. package/dist/ui/settings/SettingsGroup.d.ts +30 -0
  47. package/dist/ui/settings/SettingsPane.d.ts +19 -0
  48. package/dist/ui/settings/SettingsPaneHeader.d.ts +20 -0
  49. package/dist/ui/settings/SettingsRow.d.ts +53 -0
  50. package/dist/ui/settings/SettingsSidebarGroup.d.ts +11 -0
  51. package/dist/ui/settings/SettingsSidebarItem.d.ts +22 -0
  52. package/dist/ui/settings/SettingsWindow.d.ts +22 -0
  53. package/dist/ui/settings/core.d.ts +146 -0
  54. package/dist/ui/settings/index.d.ts +73 -0
  55. package/dist/ui/settings/settings.d.ts +8 -0
  56. package/dist/ui/settings/view.d.ts +36 -0
  57. package/dist/ui/slider/Slider.d.ts +24 -0
  58. package/dist/ui/slider/core.d.ts +33 -0
  59. package/dist/ui/slider/index.d.ts +20 -0
  60. package/dist/ui/switch/Switch.d.ts +10 -1
  61. package/dist/ui/switch/index.d.ts +2 -1
  62. package/dist/utils/mac-theme.d.ts +24 -0
  63. package/package.json +8 -3
  64. package/src/index.ts +6 -0
  65. package/src/ui/appearance-picker/AppearancePicker.stx +351 -0
  66. package/src/ui/appearance-picker/README.md +61 -0
  67. package/src/ui/appearance-picker/index.ts +22 -0
  68. package/src/ui/button/Button.stx +249 -0
  69. package/src/ui/button/README.md +21 -0
  70. package/src/ui/button/index.ts +8 -0
  71. package/src/ui/checkbox/Checkbox.stx +275 -0
  72. package/src/ui/checkbox/index.ts +2 -0
  73. package/src/ui/color-swatches/ColorSwatches.stx +287 -0
  74. package/src/ui/color-swatches/README.md +66 -0
  75. package/src/ui/color-swatches/index.ts +25 -0
  76. package/src/ui/input/NumberInput.stx +303 -0
  77. package/src/ui/input/PasswordInput.stx +315 -0
  78. package/src/ui/input/TextInput.stx +325 -0
  79. package/src/ui/input/index.ts +9 -3
  80. package/src/ui/preview-frame/README.md +16 -14
  81. package/src/ui/preview-frame/core.ts +50 -0
  82. package/src/ui/preview-frame/index.ts +4 -4
  83. package/src/ui/preview-frame/view.ts +61 -4
  84. package/src/ui/radio-group/README.md +17 -0
  85. package/src/ui/radio-group/RadioGroup.stx +184 -6
  86. package/src/ui/radio-group/RadioGroupOption.stx +178 -2
  87. package/src/ui/radio-group/index.ts +4 -0
  88. package/src/ui/segmented-control/SegmentedControl.stx +170 -1
  89. package/src/ui/segmented-control/index.ts +2 -0
  90. package/src/ui/select/README.md +12 -0
  91. package/src/ui/select/Select.stx +266 -0
  92. package/src/ui/select/index.ts +2 -0
  93. package/src/ui/settings/README.md +221 -0
  94. package/src/ui/settings/SettingsGroup.stx +200 -0
  95. package/src/ui/settings/SettingsPane.stx +50 -0
  96. package/src/ui/settings/SettingsPaneHeader.stx +188 -0
  97. package/src/ui/settings/SettingsRow.stx +424 -0
  98. package/src/ui/settings/SettingsSidebarGroup.stx +108 -0
  99. package/src/ui/settings/SettingsSidebarItem.stx +228 -0
  100. package/src/ui/settings/SettingsWindow.stx +537 -0
  101. package/src/ui/settings/core.ts +359 -0
  102. package/src/ui/settings/index.ts +111 -0
  103. package/src/ui/settings/settings.ts +8 -0
  104. package/src/ui/settings/view.ts +740 -0
  105. package/src/ui/slider/README.md +91 -0
  106. package/src/ui/slider/Slider.stx +377 -0
  107. package/src/ui/slider/core.ts +120 -0
  108. package/src/ui/slider/index.ts +34 -0
  109. package/src/ui/switch/README.md +11 -0
  110. package/src/ui/switch/Switch.stx +217 -0
  111. package/src/ui/switch/index.ts +4 -1
  112. package/src/utils/mac-theme.ts +95 -0
  113. package/dist/Checkbox-80myyzzm.stx +0 -142
  114. package/dist/RadioGroup-smqcqgds.stx +0 -151
  115. package/dist/RadioGroupOption-twcw1b2a.stx +0 -70
  116. package/dist/Switch-s8yf2rvm.stx +0 -157
@@ -35,6 +35,16 @@ export const step = $num($props.step, 1)
35
35
  export const showControls = $bool($props.showControls, true)
36
36
  export const className = $props.className || ''
37
37
  export const inputClassName = $props.inputClassName || ''
38
+ /*
39
+ * `variant="mac"` draws the stepper a Mac draws: a narrow field with its
40
+ * digits against the right edge, and beside it a 15x22 capsule holding an up
41
+ * and a down chevron. The field is the same <input type="number">, so the
42
+ * arrow keys step it as the browser does, and the two buttons are the ones
43
+ * the default look has. Only the classes change, to `stx-mac-stepper`, which
44
+ * this file's <style> block draws from the `--stx-mac-*` tokens. `size` is
45
+ * not read; the field is as wide as `--stx-mac-stepper-width` (56px unset).
46
+ */
47
+ export const mac = $props.variant === 'mac'
38
48
 
39
49
  /*
40
50
  * Padding decides the height here too, with no `h-*` to override it: an app
@@ -135,6 +145,58 @@ function decrement() {
135
145
  defineExpose({ value: inputValue, increment, decrement })
136
146
  </script>
137
147
 
148
+ @if(mac)
149
+ <div class="stx-mac-stepper-wrap {{ className }}">
150
+ @if(label)
151
+ <label for="{{ inputId }}" class="stx-mac-field-label" @if(error)data-error="true"@endif>
152
+ {{ label }}
153
+ @if(required)
154
+ <span class="stx-mac-field-required">*</span>
155
+ @endif
156
+ </label>
157
+ @endif
158
+
159
+ <div class="stx-mac-stepper">
160
+ <input
161
+ @if(name)name="{{ name }}"@endif
162
+ @if(autocomplete)autocomplete="{{ autocomplete }}"@endif
163
+ @if(form)form="{{ form }}"@endif
164
+ @if(inputMode)inputmode="{{ inputMode }}"@endif
165
+ @if(enterKeyHint)enterkeyhint="{{ enterKeyHint }}"@endif
166
+ type="number"
167
+ id="{{ inputId }}"
168
+ class="stx-mac-field stx-mac-stepper-field {{ inputClassName }}"
169
+ value="{{ value }}"
170
+ :value="inputValue()"
171
+ placeholder="{{ placeholder }}"
172
+ :placeholder="String(placeholderText() ?? '')"
173
+ @if(disabled)disabled@endif
174
+ @if(readonly)readonly@endif
175
+ @if(required)required@endif
176
+ @if(min !== undefined)min="{{ min }}"@endif
177
+ @if(max !== undefined)max="{{ max }}"@endif
178
+ step="{{ step }}"
179
+ @input="onInput($event)"
180
+ @change="onChange($event)"
181
+ :aria-invalid="{{ error ? 'true' : 'false' }}"
182
+ @if(helperText)aria-describedby="{{ helperId }}"@endif
183
+ />
184
+
185
+ @if(showControls && !disabled && !readonly)
186
+ <div class="stx-mac-stepper-buttons">
187
+ <button type="button" @click="increment()" class="stx-mac-stepper-button stx-mac-stepper-up" aria-label="Increment"></button>
188
+ <button type="button" @click="decrement()" class="stx-mac-stepper-button stx-mac-stepper-down" aria-label="Decrement"></button>
189
+ </div>
190
+ @endif
191
+ </div>
192
+
193
+ @if(helperText)
194
+ <p id="{{ helperId }}" class="stx-mac-field-helper" @if(error)data-error="true"@endif>
195
+ {{ helperText }}
196
+ </p>
197
+ @endif
198
+ </div>
199
+ @else
138
200
  <div class="w-full {{ className }}">
139
201
  @if(label)
140
202
  <label for="{{ inputId }}" class="{{ labelClasses }}">
@@ -214,3 +276,244 @@ defineExpose({ value: inputValue, increment, decrement })
214
276
  </p>
215
277
  @endif
216
278
  </div>
279
+ @endif
280
+
281
+ <style data-native-exclude>
282
+ :where(:root) {
283
+ --stx-mac-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', sans-serif;
284
+ --stx-mac-font-size: 13px;
285
+ --stx-mac-font-size-small: 11px;
286
+ --stx-mac-hairline: 0.5px;
287
+ --stx-mac-focus-ring: 0 0 0 3px color-mix(in srgb, var(--stx-mac-accent) 35%, transparent);
288
+ --stx-mac-card-radius: 12px;
289
+ --stx-mac-control-radius: 6px;
290
+ --stx-mac-row-height: 38px;
291
+ --stx-mac-row-inset: 10px;
292
+ --stx-mac-sidebar-width: 226px;
293
+ --stx-mac-accent: var(--stx-accent, rgb(0, 122, 255));
294
+ --stx-mac-accent-ink: #ffffff;
295
+ --stx-mac-ink: rgba(0, 0, 0, 0.85);
296
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.5);
297
+ --stx-mac-ink-tertiary: rgba(0, 0, 0, 0.26);
298
+ --stx-mac-window: #ffffff;
299
+ --stx-mac-sidebar: #f2f1f0;
300
+ --stx-mac-card: rgba(0, 0, 0, 0.04);
301
+ --stx-mac-separator: rgba(0, 0, 0, 0.1);
302
+ --stx-mac-hover: rgba(0, 0, 0, 0.05);
303
+ --stx-mac-selection-inactive: rgba(0, 0, 0, 0.08);
304
+ --stx-mac-well: rgba(0, 0, 0, 0.07);
305
+ --stx-mac-control: #ffffff;
306
+ --stx-mac-control-line: rgba(0, 0, 0, 0.12);
307
+ --stx-mac-control-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
308
+ --stx-mac-switch-on: #34c759;
309
+ --stx-mac-knob: #ffffff;
310
+ --stx-mac-danger: #ff3b30;
311
+ }
312
+ :where(.dark) {
313
+ --stx-mac-accent: var(--stx-accent, #0a84ff);
314
+ --stx-mac-accent-ink: #ffffff;
315
+ --stx-mac-ink: rgba(255, 255, 255, 0.85);
316
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.55);
317
+ --stx-mac-ink-tertiary: rgba(255, 255, 255, 0.25);
318
+ --stx-mac-window: #1e1e1e;
319
+ --stx-mac-sidebar: #2a2a2a;
320
+ --stx-mac-card: rgba(255, 255, 255, 0.05);
321
+ --stx-mac-separator: rgba(255, 255, 255, 0.1);
322
+ --stx-mac-hover: rgba(255, 255, 255, 0.06);
323
+ --stx-mac-selection-inactive: rgba(255, 255, 255, 0.1);
324
+ --stx-mac-well: rgba(255, 255, 255, 0.1);
325
+ --stx-mac-control: rgba(255, 255, 255, 0.14);
326
+ --stx-mac-control-line: rgba(255, 255, 255, 0.06);
327
+ --stx-mac-control-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.4), inset 0 0.5px 0 rgba(255, 255, 255, 0.12);
328
+ --stx-mac-switch-on: #30d158;
329
+ --stx-mac-knob: #ffffff;
330
+ --stx-mac-danger: #ff453a;
331
+ }
332
+ @media (max-resolution: 1.5dppx) {
333
+ :where(:root) {
334
+ --stx-mac-hairline: 1px;
335
+ }
336
+ }
337
+ @media (prefers-contrast: more) {
338
+ :where(:root) {
339
+ --stx-mac-separator: rgba(0, 0, 0, 0.4);
340
+ --stx-mac-control-line: rgba(0, 0, 0, 0.5);
341
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.75);
342
+ --stx-mac-hairline: 1px;
343
+ }
344
+ :where(.dark) {
345
+ --stx-mac-separator: rgba(255, 255, 255, 0.45);
346
+ --stx-mac-control-line: rgba(255, 255, 255, 0.5);
347
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.8);
348
+ }
349
+ }
350
+
351
+ .stx-mac-stepper-wrap {
352
+ display: inline-block;
353
+ max-width: 100%;
354
+ font-family: var(--stx-mac-font);
355
+ font-size: var(--stx-mac-font-size);
356
+ letter-spacing: -0.08px;
357
+ -webkit-font-smoothing: antialiased;
358
+ color: var(--stx-mac-ink);
359
+ cursor: default;
360
+ }
361
+
362
+ .stx-mac-field-label {
363
+ display: block;
364
+ margin-bottom: 4px;
365
+ line-height: 16px;
366
+ -webkit-user-select: none;
367
+ user-select: none;
368
+ }
369
+
370
+ .stx-mac-field-label[data-error='true'],
371
+ .stx-mac-field-required,
372
+ .stx-mac-field-helper[data-error='true'] {
373
+ color: var(--stx-mac-danger);
374
+ }
375
+
376
+ .stx-mac-field-box {
377
+ position: relative;
378
+ display: flex;
379
+ align-items: center;
380
+ }
381
+
382
+ .stx-mac-field {
383
+ --stx-mac-field-line: inset 0 0 0 var(--stx-mac-hairline) var(--stx-mac-control-line);
384
+ display: block;
385
+ flex: 1 1 auto;
386
+ box-sizing: border-box;
387
+ width: 100%;
388
+ min-width: 0;
389
+ height: 24px;
390
+ margin: 0;
391
+ padding: 0 7px;
392
+ border: 0;
393
+ border-radius: var(--stx-mac-control-radius);
394
+ background: var(--stx-mac-control);
395
+ box-shadow: var(--stx-mac-field-line);
396
+ color: var(--stx-mac-ink);
397
+ font: inherit;
398
+ letter-spacing: inherit;
399
+ -webkit-appearance: none;
400
+ appearance: none;
401
+ outline: none;
402
+ transition: box-shadow 150ms ease;
403
+ }
404
+
405
+ .stx-mac-field::placeholder {
406
+ color: var(--stx-mac-ink-tertiary);
407
+ }
408
+
409
+ .stx-mac-field:focus-visible {
410
+ box-shadow: var(--stx-mac-field-line), var(--stx-mac-focus-ring);
411
+ }
412
+
413
+ .stx-mac-field[aria-invalid='true'] {
414
+ --stx-mac-field-line: inset 0 0 0 1px var(--stx-mac-danger);
415
+ }
416
+
417
+ .stx-mac-field:disabled {
418
+ opacity: 0.5;
419
+ }
420
+
421
+ .stx-mac-field-helper {
422
+ margin: 4px 0 0;
423
+ font-size: var(--stx-mac-font-size-small);
424
+ line-height: 14px;
425
+ letter-spacing: 0;
426
+ color: var(--stx-mac-ink-secondary);
427
+ }
428
+
429
+ @media (prefers-reduced-motion: reduce) {
430
+ .stx-mac-field {
431
+ transition: none;
432
+ }
433
+ }
434
+
435
+ .stx-mac-stepper {
436
+ display: inline-flex;
437
+ align-items: center;
438
+ gap: 4px;
439
+ }
440
+
441
+ /* Two classes, so these win over the plain field's rules whichever component's stylesheet the page loads last. */
442
+ .stx-mac-field.stx-mac-stepper-field {
443
+ flex: none;
444
+ width: var(--stx-mac-stepper-width, 56px);
445
+ text-align: right;
446
+ font-variant-numeric: tabular-nums;
447
+ -moz-appearance: textfield;
448
+ }
449
+
450
+ .stx-mac-field.stx-mac-stepper-field::-webkit-inner-spin-button,
451
+ .stx-mac-field.stx-mac-stepper-field::-webkit-outer-spin-button {
452
+ margin: 0;
453
+ -webkit-appearance: none;
454
+ }
455
+
456
+ .stx-mac-stepper-buttons {
457
+ --stx-mac-stepper-pressed: color-mix(in srgb, var(--stx-mac-ink) 10%, transparent);
458
+ display: flex;
459
+ flex: none;
460
+ flex-direction: column;
461
+ width: 15px;
462
+ height: 22px;
463
+ overflow: hidden;
464
+ border-radius: 7.5px;
465
+ background: var(--stx-mac-control);
466
+ box-shadow: var(--stx-mac-control-shadow);
467
+ }
468
+
469
+ .stx-mac-stepper-buttons:has(:focus-visible) {
470
+ box-shadow: var(--stx-mac-control-shadow), var(--stx-mac-focus-ring);
471
+ }
472
+
473
+ .stx-mac-stepper-button {
474
+ position: relative;
475
+ flex: 1 1 0;
476
+ width: 15px;
477
+ margin: 0;
478
+ padding: 0;
479
+ border: 0;
480
+ background: transparent;
481
+ color: var(--stx-mac-ink);
482
+ -webkit-appearance: none;
483
+ appearance: none;
484
+ cursor: default;
485
+ outline: none;
486
+ }
487
+
488
+ .stx-mac-stepper-button:active {
489
+ background: var(--stx-mac-stepper-pressed);
490
+ }
491
+
492
+ /* Each chevron is the corner of a small square turned on its point. */
493
+ .stx-mac-stepper-button::before {
494
+ content: '';
495
+ position: absolute;
496
+ left: 5.25px;
497
+ box-sizing: border-box;
498
+ width: 4.5px;
499
+ height: 4.5px;
500
+ border: solid currentColor;
501
+ border-width: 1.5px 0 0 1.5px;
502
+ }
503
+
504
+ .stx-mac-stepper-up::before {
505
+ top: 5px;
506
+ transform: rotate(45deg);
507
+ }
508
+
509
+ .stx-mac-stepper-down::before {
510
+ top: 1.5px;
511
+ transform: rotate(225deg);
512
+ }
513
+
514
+ @media (prefers-contrast: more) {
515
+ .stx-mac-stepper-buttons {
516
+ box-shadow: inset 0 0 0 1px var(--stx-mac-control-line);
517
+ }
518
+ }
519
+ </style>
@@ -28,6 +28,14 @@ export const required = $bool($props.required)
28
28
  export const showStrength = $bool($props.showStrength)
29
29
  export const className = $props.className || ''
30
30
  export const inputClassName = $props.inputClassName || ''
31
+ /*
32
+ * `variant="mac"` draws the secure field a Mac draws: TextInput's Mac field
33
+ * (24px, 6px corners, a raised face inside a hairline) with the reveal button
34
+ * inside its trailing edge. Same <input>, same attributes and events; only
35
+ * the classes change, to `stx-mac-field`, which this file's <style> block
36
+ * draws from the `--stx-mac-*` tokens. `size` is not read.
37
+ */
38
+ export const mac = $props.variant === 'mac'
31
39
 
32
40
  /*
33
41
  * Padding decides the height here too, with no `h-*` to override it: an app
@@ -141,6 +149,8 @@ const strengthLabelColor = derived(() => {
141
149
  })
142
150
  const inputType = derived(() => showPassword() ? 'text' : 'password')
143
151
  const toggleAriaLabel = derived(() => showPassword() ? 'Hide password' : 'Show password')
152
+ // The Mac look colours its strength bar from this word rather than a class.
153
+ const strengthLevel = derived(() => strengthText().toLowerCase())
144
154
 
145
155
  defineExpose({ value: inputValue })
146
156
  </script>
@@ -197,6 +207,68 @@ defineExpose({ value: inputValue })
197
207
  <p id="{{ helperId }}" class="{{ nativeHelperClasses }}">{{ helperText }}</p>
198
208
  @endif
199
209
  </div>
210
+ @elseif(mac)
211
+ <div class="stx-mac-field-wrap {{ className }}">
212
+ @if(label)
213
+ <label for="{{ inputId }}" class="stx-mac-field-label" @if(error)data-error="true"@endif>
214
+ {{ label }}
215
+ @if(required)
216
+ <span class="stx-mac-field-required">*</span>
217
+ @endif
218
+ </label>
219
+ @endif
220
+
221
+ <div class="stx-mac-field-box">
222
+ <input
223
+ @if(name)name="{{ name }}"@endif
224
+ @if(autocomplete)autocomplete="{{ autocomplete }}"@endif
225
+ @if(form)form="{{ form }}"@endif
226
+ @if(inputMode)inputmode="{{ inputMode }}"@endif
227
+ @if(enterKeyHint)enterkeyhint="{{ enterKeyHint }}"@endif
228
+ :type="inputType()"
229
+ id="{{ inputId }}"
230
+ class="stx-mac-field stx-mac-field-secure {{ inputClassName }}"
231
+ value="{{ value }}"
232
+ :value="inputValue()"
233
+ placeholder="{{ placeholder }}"
234
+ :placeholder="String(placeholderText() ?? '')"
235
+ @if(disabled)disabled@endif
236
+ @if(readonly)readonly@endif
237
+ @if(required)required@endif
238
+ @input="onInput($event)"
239
+ :aria-invalid="{{ error ? 'true' : 'false' }}"
240
+ @if(helperText)aria-describedby="{{ helperId }}"@endif
241
+ />
242
+
243
+ <button
244
+ type="button"
245
+ @click="toggleVisibility()"
246
+ class="stx-mac-field-reveal"
247
+ :aria-label="toggleAriaLabel()"
248
+ >
249
+ <i :show="showPassword()" class="i-f7-eye-slash stx-mac-field-glyph"></i>
250
+ <i :show="!showPassword()" class="i-f7-eye stx-mac-field-glyph"></i>
251
+ </button>
252
+ </div>
253
+
254
+ @if(showStrength)
255
+ <div :show="inputValue().length > 0" class="stx-mac-field-strength" :data-level="strengthLevel()">
256
+ <div class="stx-mac-field-strength-head">
257
+ <span>Password strength</span>
258
+ <span class="stx-mac-field-strength-word" x-text="strengthText()"></span>
259
+ </div>
260
+ <div class="stx-mac-field-strength-track">
261
+ <div class="stx-mac-field-strength-bar" :style="`width: ${strength()}%`"></div>
262
+ </div>
263
+ </div>
264
+ @endif
265
+
266
+ @if(helperText)
267
+ <p id="{{ helperId }}" class="stx-mac-field-helper" @if(error)data-error="true"@endif>
268
+ {{ helperText }}
269
+ </p>
270
+ @endif
271
+ </div>
200
272
  @else
201
273
  <div class="w-full {{ className }}">
202
274
  @if(label)
@@ -282,3 +354,246 @@ defineExpose({ value: inputValue })
282
354
  @endif
283
355
  </div>
284
356
  @endif
357
+
358
+ <style data-native-exclude>
359
+ :where(:root) {
360
+ --stx-mac-font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI Variable Text', 'Segoe UI', system-ui, Roboto, 'Helvetica Neue', sans-serif;
361
+ --stx-mac-font-size: 13px;
362
+ --stx-mac-font-size-small: 11px;
363
+ --stx-mac-hairline: 0.5px;
364
+ --stx-mac-focus-ring: 0 0 0 3px color-mix(in srgb, var(--stx-mac-accent) 35%, transparent);
365
+ --stx-mac-card-radius: 12px;
366
+ --stx-mac-control-radius: 6px;
367
+ --stx-mac-row-height: 38px;
368
+ --stx-mac-row-inset: 10px;
369
+ --stx-mac-sidebar-width: 226px;
370
+ --stx-mac-accent: var(--stx-accent, rgb(0, 122, 255));
371
+ --stx-mac-accent-ink: #ffffff;
372
+ --stx-mac-ink: rgba(0, 0, 0, 0.85);
373
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.5);
374
+ --stx-mac-ink-tertiary: rgba(0, 0, 0, 0.26);
375
+ --stx-mac-window: #ffffff;
376
+ --stx-mac-sidebar: #f2f1f0;
377
+ --stx-mac-card: rgba(0, 0, 0, 0.04);
378
+ --stx-mac-separator: rgba(0, 0, 0, 0.1);
379
+ --stx-mac-hover: rgba(0, 0, 0, 0.05);
380
+ --stx-mac-selection-inactive: rgba(0, 0, 0, 0.08);
381
+ --stx-mac-well: rgba(0, 0, 0, 0.07);
382
+ --stx-mac-control: #ffffff;
383
+ --stx-mac-control-line: rgba(0, 0, 0, 0.12);
384
+ --stx-mac-control-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.14), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
385
+ --stx-mac-switch-on: #34c759;
386
+ --stx-mac-knob: #ffffff;
387
+ --stx-mac-danger: #ff3b30;
388
+ }
389
+ :where(.dark) {
390
+ --stx-mac-accent: var(--stx-accent, #0a84ff);
391
+ --stx-mac-accent-ink: #ffffff;
392
+ --stx-mac-ink: rgba(255, 255, 255, 0.85);
393
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.55);
394
+ --stx-mac-ink-tertiary: rgba(255, 255, 255, 0.25);
395
+ --stx-mac-window: #1e1e1e;
396
+ --stx-mac-sidebar: #2a2a2a;
397
+ --stx-mac-card: rgba(255, 255, 255, 0.05);
398
+ --stx-mac-separator: rgba(255, 255, 255, 0.1);
399
+ --stx-mac-hover: rgba(255, 255, 255, 0.06);
400
+ --stx-mac-selection-inactive: rgba(255, 255, 255, 0.1);
401
+ --stx-mac-well: rgba(255, 255, 255, 0.1);
402
+ --stx-mac-control: rgba(255, 255, 255, 0.14);
403
+ --stx-mac-control-line: rgba(255, 255, 255, 0.06);
404
+ --stx-mac-control-shadow: 0 0.5px 1.5px rgba(0, 0, 0, 0.4), inset 0 0.5px 0 rgba(255, 255, 255, 0.12);
405
+ --stx-mac-switch-on: #30d158;
406
+ --stx-mac-knob: #ffffff;
407
+ --stx-mac-danger: #ff453a;
408
+ }
409
+ @media (max-resolution: 1.5dppx) {
410
+ :where(:root) {
411
+ --stx-mac-hairline: 1px;
412
+ }
413
+ }
414
+ @media (prefers-contrast: more) {
415
+ :where(:root) {
416
+ --stx-mac-separator: rgba(0, 0, 0, 0.4);
417
+ --stx-mac-control-line: rgba(0, 0, 0, 0.5);
418
+ --stx-mac-ink-secondary: rgba(0, 0, 0, 0.75);
419
+ --stx-mac-hairline: 1px;
420
+ }
421
+ :where(.dark) {
422
+ --stx-mac-separator: rgba(255, 255, 255, 0.45);
423
+ --stx-mac-control-line: rgba(255, 255, 255, 0.5);
424
+ --stx-mac-ink-secondary: rgba(255, 255, 255, 0.8);
425
+ }
426
+ }
427
+
428
+ .stx-mac-field-wrap {
429
+ display: block;
430
+ width: var(--stx-mac-field-width, 100%);
431
+ max-width: 100%;
432
+ font-family: var(--stx-mac-font);
433
+ font-size: var(--stx-mac-font-size);
434
+ letter-spacing: -0.08px;
435
+ -webkit-font-smoothing: antialiased;
436
+ color: var(--stx-mac-ink);
437
+ cursor: default;
438
+ }
439
+
440
+ .stx-mac-field-label {
441
+ display: block;
442
+ margin-bottom: 4px;
443
+ line-height: 16px;
444
+ -webkit-user-select: none;
445
+ user-select: none;
446
+ }
447
+
448
+ .stx-mac-field-label[data-error='true'],
449
+ .stx-mac-field-required,
450
+ .stx-mac-field-helper[data-error='true'] {
451
+ color: var(--stx-mac-danger);
452
+ }
453
+
454
+ .stx-mac-field-box {
455
+ position: relative;
456
+ display: flex;
457
+ align-items: center;
458
+ }
459
+
460
+ .stx-mac-field {
461
+ --stx-mac-field-line: inset 0 0 0 var(--stx-mac-hairline) var(--stx-mac-control-line);
462
+ display: block;
463
+ flex: 1 1 auto;
464
+ box-sizing: border-box;
465
+ width: 100%;
466
+ min-width: 0;
467
+ height: 24px;
468
+ margin: 0;
469
+ padding: 0 7px;
470
+ border: 0;
471
+ border-radius: var(--stx-mac-control-radius);
472
+ background: var(--stx-mac-control);
473
+ box-shadow: var(--stx-mac-field-line);
474
+ color: var(--stx-mac-ink);
475
+ font: inherit;
476
+ letter-spacing: inherit;
477
+ -webkit-appearance: none;
478
+ appearance: none;
479
+ outline: none;
480
+ transition: box-shadow 150ms ease;
481
+ }
482
+
483
+ .stx-mac-field::placeholder {
484
+ color: var(--stx-mac-ink-tertiary);
485
+ }
486
+
487
+ .stx-mac-field:focus-visible {
488
+ box-shadow: var(--stx-mac-field-line), var(--stx-mac-focus-ring);
489
+ }
490
+
491
+ .stx-mac-field[aria-invalid='true'] {
492
+ --stx-mac-field-line: inset 0 0 0 1px var(--stx-mac-danger);
493
+ }
494
+
495
+ .stx-mac-field:disabled {
496
+ opacity: 0.5;
497
+ }
498
+
499
+ .stx-mac-field-helper {
500
+ margin: 4px 0 0;
501
+ font-size: var(--stx-mac-font-size-small);
502
+ line-height: 14px;
503
+ letter-spacing: 0;
504
+ color: var(--stx-mac-ink-secondary);
505
+ }
506
+
507
+ @media (prefers-reduced-motion: reduce) {
508
+ .stx-mac-field {
509
+ transition: none;
510
+ }
511
+ }
512
+
513
+ /* Two classes, so these win over the plain field's rules whichever component's stylesheet the page loads last. */
514
+ .stx-mac-field.stx-mac-field-secure {
515
+ padding-right: 26px;
516
+ }
517
+
518
+ .stx-mac-field-reveal {
519
+ position: absolute;
520
+ top: 3px;
521
+ right: 4px;
522
+ display: inline-flex;
523
+ align-items: center;
524
+ justify-content: center;
525
+ width: 18px;
526
+ height: 18px;
527
+ margin: 0;
528
+ padding: 0;
529
+ border: 0;
530
+ border-radius: 5px;
531
+ background: transparent;
532
+ color: var(--stx-mac-ink-secondary);
533
+ -webkit-appearance: none;
534
+ appearance: none;
535
+ cursor: default;
536
+ outline: none;
537
+ }
538
+
539
+ .stx-mac-field-reveal:hover {
540
+ color: var(--stx-mac-ink);
541
+ }
542
+
543
+ .stx-mac-field-reveal:focus-visible {
544
+ box-shadow: var(--stx-mac-focus-ring);
545
+ }
546
+
547
+ .stx-mac-field-glyph {
548
+ width: 13px;
549
+ height: 13px;
550
+ }
551
+
552
+ .stx-mac-field-strength {
553
+ --stx-mac-field-strength: var(--stx-mac-danger);
554
+ margin-top: 6px;
555
+ font-size: var(--stx-mac-font-size-small);
556
+ letter-spacing: 0;
557
+ color: var(--stx-mac-ink-secondary);
558
+ -webkit-user-select: none;
559
+ user-select: none;
560
+ }
561
+
562
+ .stx-mac-field-strength[data-level='medium'] {
563
+ --stx-mac-field-strength: #ff9500;
564
+ }
565
+
566
+ .stx-mac-field-strength[data-level='strong'] {
567
+ --stx-mac-field-strength: var(--stx-mac-switch-on);
568
+ }
569
+
570
+ .stx-mac-field-strength-head {
571
+ display: flex;
572
+ justify-content: space-between;
573
+ margin-bottom: 3px;
574
+ }
575
+
576
+ .stx-mac-field-strength-word {
577
+ color: var(--stx-mac-field-strength);
578
+ }
579
+
580
+ .stx-mac-field-strength-track {
581
+ height: 4px;
582
+ overflow: hidden;
583
+ border-radius: 2px;
584
+ background: var(--stx-mac-well);
585
+ }
586
+
587
+ .stx-mac-field-strength-bar {
588
+ height: 100%;
589
+ border-radius: 2px;
590
+ background: var(--stx-mac-field-strength);
591
+ transition: width 150ms ease;
592
+ }
593
+
594
+ @media (prefers-reduced-motion: reduce) {
595
+ .stx-mac-field-strength-bar {
596
+ transition: none;
597
+ }
598
+ }
599
+ </style>