palace-ui 0.12.2 → 0.13.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/SPEC.md +12 -0
- package/catalog.html +9 -0
- package/package.json +1 -1
- package/palace.css +24 -0
package/SPEC.md
CHANGED
|
@@ -369,6 +369,16 @@ Inline form (input + button side by side):
|
|
|
369
369
|
</div>
|
|
370
370
|
```
|
|
371
371
|
|
|
372
|
+
A field with a button inside, at its right end (show/hide a password, paste, copy). The input reserves the button's width plus its 8px inset from the edge (`--input-action-width` is the button's width, default `4.75rem`); the button is centred in the input's box and lifts with the input on focus, so they stay aligned. Use `.btn-sm`, a real `<button type="button">`, and for a toggle let the visible text and the accessible name change together ("Show" / `aria-label="Show password"` and "Hide" / "Hide password"). Pick one way to say the state: a changing name, or a fixed name with `aria-pressed` — never both.
|
|
373
|
+
|
|
374
|
+
```html
|
|
375
|
+
<label for="pw">Password</label>
|
|
376
|
+
<div class="input-action">
|
|
377
|
+
<input type="password" id="pw" autocomplete="off">
|
|
378
|
+
<button type="button" class="btn btn-sm btn-outline" aria-label="Show password">Show</button>
|
|
379
|
+
</div>
|
|
380
|
+
```
|
|
381
|
+
|
|
372
382
|
### Status Messages
|
|
373
383
|
|
|
374
384
|
```html
|
|
@@ -390,6 +400,8 @@ Inline form (input + button side by side):
|
|
|
390
400
|
|
|
391
401
|
Use `role="alert"` for error and warning messages (assertive — interrupts the user). Use `role="status"` for success and info messages (polite — announced at the next opportunity). Omit the role for neutral/static messages that don't need to be announced.
|
|
392
402
|
|
|
403
|
+
Status boxes carry palace's hard shadow (`--p-shadow-lg` in `--p-text`); leave room for it (4px right and below) inside containers that clip.
|
|
404
|
+
|
|
393
405
|
Show/hide with JavaScript:
|
|
394
406
|
```js
|
|
395
407
|
function showStatus(el, msg, type) {
|
package/catalog.html
CHANGED
|
@@ -495,6 +495,15 @@
|
|
|
495
495
|
<input type="text" placeholder="Add a label" aria-label="Add a label" style="flex: 1;">
|
|
496
496
|
<button class="btn btn-primary">Create</button>
|
|
497
497
|
</div>
|
|
498
|
+
|
|
499
|
+
<h3 style="margin: 24px 0 12px;">Field with a Button Inside</h3>
|
|
500
|
+
<div data-source>
|
|
501
|
+
<label for="pw-demo">Password</label>
|
|
502
|
+
<div class="input-action">
|
|
503
|
+
<input type="password" id="pw-demo" autocomplete="off">
|
|
504
|
+
<button type="button" class="btn btn-sm btn-outline" aria-label="Show password">Show</button>
|
|
505
|
+
</div>
|
|
506
|
+
</div>
|
|
498
507
|
</div>
|
|
499
508
|
|
|
500
509
|
<!-- ════════════════════════════════════════ TABLES ════════════════════════════════════════ -->
|
package/package.json
CHANGED
package/palace.css
CHANGED
|
@@ -636,6 +636,29 @@ textarea:focus {
|
|
|
636
636
|
transform: var(--p-lift-sm);
|
|
637
637
|
}
|
|
638
638
|
|
|
639
|
+
/* A field with a button inside, at its right end (show/hide a password, paste,
|
|
640
|
+
copy). The input reserves the button's width plus its 8px inset; the button is centred in the
|
|
641
|
+
input's box and lifts with it, so the two stay aligned on focus. Set
|
|
642
|
+
--input-action-width to the button's width when it is wider. */
|
|
643
|
+
.input-action {
|
|
644
|
+
position: relative;
|
|
645
|
+
--input-action-width: 4.75rem;
|
|
646
|
+
}
|
|
647
|
+
.input-action > input[type] { padding-inline-end: calc(var(--input-action-width) + 8px); }
|
|
648
|
+
.input-action > .btn,
|
|
649
|
+
.input-action > button {
|
|
650
|
+
position: absolute;
|
|
651
|
+
inset-block: 0;
|
|
652
|
+
inset-inline-end: 8px;
|
|
653
|
+
height: fit-content;
|
|
654
|
+
white-space: nowrap;
|
|
655
|
+
margin-block: auto;
|
|
656
|
+
}
|
|
657
|
+
.input-action > input:focus ~ .btn,
|
|
658
|
+
.input-action > input:focus ~ button {
|
|
659
|
+
transform: var(--p-lift-sm);
|
|
660
|
+
}
|
|
661
|
+
|
|
639
662
|
/* Checkboxes, radio buttons and disclosure summaries: the focus ring of links
|
|
640
663
|
and buttons, without the lift. */
|
|
641
664
|
input[type="checkbox"]:focus-visible,
|
|
@@ -656,6 +679,7 @@ summary:focus-visible {
|
|
|
656
679
|
font-size: 13px;
|
|
657
680
|
font-weight: 600;
|
|
658
681
|
border: var(--p-border-width) solid var(--p-text);
|
|
682
|
+
box-shadow: var(--p-shadow-lg) var(--p-text);
|
|
659
683
|
}
|
|
660
684
|
|
|
661
685
|
.status-success {
|