palace-ui 0.12.1 → 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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palace-ui",
3
- "version": "0.12.1",
3
+ "version": "0.13.0",
4
4
  "description": "Retro-technical design system. Hard edges, vibrant gradients, chunky shadows.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/palace.css CHANGED
@@ -325,6 +325,10 @@ button, .btn {
325
325
  border: var(--p-border-width) solid;
326
326
  border-radius: var(--p-radius);
327
327
  transition: var(--p-transition);
328
+ /* Only what a button's states change. A size that follows its container
329
+ (font size, padding, width) must never animate, or it passes through
330
+ sizes in between whenever the container settles. */
331
+ transition-property: background-color, border-color, color, box-shadow, transform, outline-color;
328
332
  text-decoration: none;
329
333
  display: inline-block;
330
334
  /* One line height for <button> and <a class="btn">, so both are the same
@@ -632,6 +636,29 @@ textarea:focus {
632
636
  transform: var(--p-lift-sm);
633
637
  }
634
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
+
635
662
  /* Checkboxes, radio buttons and disclosure summaries: the focus ring of links
636
663
  and buttons, without the lift. */
637
664
  input[type="checkbox"]:focus-visible,
@@ -652,6 +679,7 @@ summary:focus-visible {
652
679
  font-size: 13px;
653
680
  font-weight: 600;
654
681
  border: var(--p-border-width) solid var(--p-text);
682
+ box-shadow: var(--p-shadow-lg) var(--p-text);
655
683
  }
656
684
 
657
685
  .status-success {