@eldrajs/ui 0.3.0 → 0.3.2

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.
@@ -510,40 +510,49 @@
510
510
  animation: eldra-pulse 1.2s var(--eldra-ease-out) infinite;
511
511
  }
512
512
 
513
- /* The skeleton shimmer (spec "Skeleton" → Behaviour & motion): "Shimmer sweeps left to right over
514
- 1.4s, ease-out, infinitely… Reduced motion: shimmer removed; shapes are static." Shared
515
- infrastructure rather than a `Price`-only rule: `Price`'s own loading state below is the first
516
- consumer, and the `Skeleton` primitive (a later task) reuses this same utility for every shape.
517
- The shape itself is a `surface-strong` fill (spec "Skeleton" → States, "Shape" row); the shimmer
518
- is a `background`-coloured band at 60% strength (States, "Shimmer" row) that sweeps across it.
519
- It is layered on with a `::after` that slides across rather than an animated
520
- `background-position` on the shape's own fill, so the base fill and the moving highlight are
521
- independent — reduced motion removes the highlight element outright (`display: none`) instead of
522
- merely freezing it mid-sweep, which is what "shapes are static" asks for rather than an instant
523
- jump to one frame of the animation. */
513
+ /* The skeleton shimmer (spec "Skeleton" → Behaviour & motion: "Shimmer sweeps left to right…
514
+ infinitely… Reduced motion: shimmer removed; shapes are static."). The shape is a
515
+ `surface-strong` fill (States, "Shape" row) with a `background`-coloured glare at 60% strength
516
+ (States, "Shimmer" row) laid on by a `::after` that slides across it, so reduced motion removes
517
+ the glare outright (`display: none`) rather than freezing it mid-sweep.
518
+
519
+ The glare sweeps for the first 1.8s of a 3s cycle and then rests, eased at both ends, and is a
520
+ soft band across the middle of the `::after` rather than a wash over the whole shape. The
521
+ spec's 1.4s `ease-out` sweep, back to back with no rest, lunged and then jumped back to the
522
+ start, which read as fast and mechanical (operator review, 2026-11-10; README Deviations).
523
+
524
+ Consumer knobs, each with the default below: `--eldra-skeleton-duration` (3s, the whole cycle),
525
+ `--eldra-skeleton-color` (`surface-strong`, the shape's fill) and `--eldra-skeleton-highlight`
526
+ (`background` at 60%, the glare). `Price`'s loading state shares the utility. */
524
527
  @keyframes eldra-shimmer {
525
- from {
528
+ 0% {
526
529
  transform: translateX(-100%);
527
530
  }
528
- to {
531
+ 60%,
532
+ 100% {
529
533
  transform: translateX(100%);
530
534
  }
531
535
  }
532
536
  @utility eldra-skeleton {
533
537
  position: relative;
534
538
  overflow: hidden;
535
- background-color: var(--eldra-color-surface-strong);
539
+ background-color: var(--eldra-skeleton-color, var(--eldra-color-surface-strong));
536
540
  &::after {
537
541
  content: '';
538
542
  position: absolute;
539
543
  inset: 0;
540
544
  background: linear-gradient(
541
545
  90deg,
542
- transparent,
543
- color-mix(in oklab, var(--eldra-color-background), transparent 40%),
544
- transparent
546
+ transparent 15%,
547
+ var(
548
+ --eldra-skeleton-highlight,
549
+ color-mix(in oklab, var(--eldra-color-background), transparent 40%)
550
+ )
551
+ 50%,
552
+ transparent 85%
545
553
  );
546
- animation: eldra-shimmer 1.4s var(--eldra-ease-out) infinite;
554
+ transform: translateX(-100%);
555
+ animation: eldra-shimmer var(--eldra-skeleton-duration, 3s) var(--eldra-ease-in-out) infinite;
547
556
  }
548
557
  @media (prefers-reduced-motion: reduce) {
549
558
  &::after {
@@ -551,6 +560,24 @@
551
560
  }
552
561
  }
553
562
  }
563
+ /* `Skeleton`'s `text` and `title` rows (spec "Skeleton" → Sizes: text "height 0.875rem, 0.3rem
564
+ margin above and below (one 1.5 line-height row)", title 1.5rem). Variables with the spec's
565
+ numbers as defaults, so a consumer sets a taller line for its own denser or larger type without
566
+ sizing every shape: `--eldra-skeleton-line-height`, `--eldra-skeleton-line-gap` and
567
+ `--eldra-skeleton-title-height`. */
568
+ @utility eldra-skeleton-text {
569
+ height: var(--eldra-skeleton-line-height, 0.875rem);
570
+ margin-block: var(--eldra-skeleton-line-gap, 0.3rem);
571
+ }
572
+ @utility eldra-skeleton-title {
573
+ height: var(--eldra-skeleton-title-height, 1.5rem);
574
+ }
575
+ /* `Skeleton`'s `box`: one shape of any size, the component itself. Its height before a consumer
576
+ sizes it is `--eldra-skeleton-box-height`, so a bare box is visible rather than 0px tall; a
577
+ `height` prop (inline) or a height class (a later layer) wins over it. */
578
+ @utility eldra-skeleton-box {
579
+ height: var(--eldra-skeleton-box-height, 1rem);
580
+ }
554
581
 
555
582
  /* A value that is still on screen while a fresher one is being fetched (`Price`, `StockBadge` and,
556
583
  through them, `ProductCard`, with `revalidating` set): the value keeps its place and its text and
@@ -613,10 +640,17 @@
613
640
  that never moves. Where `@property` is unsupported the alpha still switches 0 -> 1, so the ring
614
641
  simply appears at full size — the same thing reduced motion asks for, never a missing ring.
615
642
 
616
- The ring's geometry is one `box-shadow` pair rather than a shadow plus an `outline`: two spreads
617
- off the same box stay locked together, and the shadow is what fades. `outline` stays at width 0
618
- and is reinstated only under forced colours, where a UA drops `box-shadow` entirely — that rule
619
- is static, because the system Highlight colour is not ours to fade.
643
+ The ring is two `box-shadow` spreads off the element's border edge: the `focus-inner` infill
644
+ and, under it, the coloured ring. At rest the ring is a 1px band against the border
645
+ (`--eldra-focus-rest-width`, `--eldra-focus-rest-offset`), transparent unless a field is invalid
646
+ (`eldra-field-invalid` sets `--eldra-focus-rest-color`). On focus the same `--eldra-focus-alpha`
647
+ that fades the colours also moves the band out past the 2px infill and widens it to 2px, and
648
+ back on blur. Shadows, not an outline: a browser draws an outline's width and offset only at
649
+ whole device pixels (3 distinct frames across a 2px move at 2x, measured in Chromium), but a
650
+ shadow's spread at any fraction (all 9 of 9 steps), so the move is continuous. A spread is
651
+ measured from the border's outer edge, the edge the border itself is drawn from, so the band
652
+ never comes apart from the border at a fractional zoom. Under forced colours, where a UA drops
653
+ `box-shadow`, an `outline` stands in, static, in `Highlight`.
620
654
 
621
655
  Each mix reads `color-mix(in srgb, transparent, <colour> calc(...))` — transparent FIRST — on
622
656
  purpose. Tailwind compiles every `color-mix()` with a plain fallback for engines that lack it,
@@ -641,26 +675,72 @@
641
675
  inherits: false;
642
676
  initial-value: 0;
643
677
  }
678
+ /* The ring's resting band (see above). Registered without inheritance, so a field's error line
679
+ never reaches a focusable element inside it (a tag's remove button, a clear button).
680
+ `--eldra-focus-rest-forced` is the band's width under forced colours, 0 unless a field sets it. */
681
+ @property --eldra-focus-rest-width {
682
+ syntax: '*';
683
+ inherits: false;
684
+ }
685
+ @property --eldra-focus-rest-offset {
686
+ syntax: '*';
687
+ inherits: false;
688
+ }
689
+ @property --eldra-focus-rest-color {
690
+ syntax: '*';
691
+ inherits: false;
692
+ }
693
+ @property --eldra-focus-rest-forced {
694
+ syntax: '*';
695
+ inherits: false;
696
+ }
644
697
  /* The ring's `box-shadow` ends with Tailwind's own shadow variables (`--tw-shadow`, `--tw-ring-shadow`
645
698
  and the rest), each falling back to an empty shadow: a consumer's `shadow-*` or `ring-*` on the
646
699
  same element is drawn under the ring rather than replaced by it, and with none set the list
647
- paints exactly the ring. */
700
+ paints exactly the ring. The band's moving edges are lifted into `--eldra-focus-gap` and
701
+ `--eldra-focus-reach` so each `calc()` holds one `var()` per term: a `var()` nested in another's
702
+ fallback inside a `calc()` is what a bundler's postcss-calc pass warns about on every build. */
648
703
  @utility eldra-focus {
649
- /* Width 0 in every colour mode but forced colours, where the ring below is dropped by the UA. */
650
- outline: 0 solid transparent;
651
- outline-offset: var(--eldra-focus-offset);
652
704
  --eldra-focus-alpha: 0;
705
+ --eldra-focus-from-width: var(--eldra-focus-rest-width, 1px);
706
+ --eldra-focus-from-offset: var(--eldra-focus-rest-offset, 0px);
707
+ --eldra-focus-from-color: var(--eldra-focus-rest-color, transparent);
708
+ --eldra-focus-gap: calc(
709
+ var(--eldra-focus-from-offset) + (var(--eldra-focus-offset) - var(--eldra-focus-from-offset)) *
710
+ var(--eldra-focus-alpha)
711
+ );
712
+ --eldra-focus-reach: calc(
713
+ var(--eldra-focus-gap) + var(--eldra-focus-from-width) +
714
+ (var(--eldra-focus-width) - var(--eldra-focus-from-width)) * var(--eldra-focus-alpha)
715
+ );
716
+ /* Width 0 in every colour mode but forced colours, where the shadows below are dropped. */
717
+ outline: 0 solid transparent;
718
+ /* The infill is listed three times on purpose. Both spreads are cut out at the element's edge,
719
+ and on a rounded corner that cut is anti-aliased: one infill lets a hairline of the ring
720
+ beneath show through it (a grey arc inside a ghost `Button`'s ring, at 4x), three cover it. */
653
721
  box-shadow:
654
- 0 0 0 var(--eldra-focus-offset)
722
+ 0 0 0 var(--eldra-focus-gap)
723
+ color-mix(
724
+ in srgb,
725
+ transparent,
726
+ var(--eldra-color-focus-inner) calc(var(--eldra-focus-alpha) * 100%)
727
+ ),
728
+ 0 0 0 var(--eldra-focus-gap)
655
729
  color-mix(
656
730
  in srgb,
657
731
  transparent,
658
732
  var(--eldra-color-focus-inner) calc(var(--eldra-focus-alpha) * 100%)
659
733
  ),
660
- 0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width))
734
+ 0 0 0 var(--eldra-focus-gap)
661
735
  color-mix(
662
736
  in srgb,
663
737
  transparent,
738
+ var(--eldra-color-focus-inner) calc(var(--eldra-focus-alpha) * 100%)
739
+ ),
740
+ 0 0 0 var(--eldra-focus-reach)
741
+ color-mix(
742
+ in srgb,
743
+ var(--eldra-focus-from-color),
664
744
  var(--eldra-color-focus) calc(var(--eldra-focus-alpha) * 100%)
665
745
  ),
666
746
  var(--tw-inset-shadow, 0 0 #0000),
@@ -685,6 +765,8 @@
685
765
  --eldra-focus-alpha: 1;
686
766
  @supports not (color: color-mix(in srgb, red, red)) {
687
767
  box-shadow:
768
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
769
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
688
770
  0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
689
771
  0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width)) var(--eldra-color-focus),
690
772
  var(--tw-inset-shadow, 0 0 #0000),
@@ -694,9 +776,14 @@
694
776
  var(--tw-shadow, 0 0 #0000);
695
777
  }
696
778
  }
779
+ /* Static under forced colours: a field's error line in `CanvasText` against the border (none
780
+ elsewhere), and the ring in `Highlight` past the infill while it shows. */
697
781
  @media (forced-colors: active) {
782
+ outline-width: var(--eldra-focus-rest-forced, 0px);
783
+ outline-color: CanvasText;
698
784
  &:focus-visible {
699
785
  outline-width: var(--eldra-focus-width);
786
+ outline-offset: var(--eldra-focus-offset);
700
787
  outline-color: Highlight;
701
788
  }
702
789
  }
@@ -706,6 +793,8 @@
706
793
  --eldra-focus-alpha: 1;
707
794
  @supports not (color: color-mix(in srgb, red, red)) {
708
795
  box-shadow:
796
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
797
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
709
798
  0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
710
799
  0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width)) var(--eldra-color-focus),
711
800
  var(--tw-inset-shadow, 0 0 #0000),
@@ -718,6 +807,7 @@
718
807
  @media (forced-colors: active) {
719
808
  &:focus {
720
809
  outline-width: var(--eldra-focus-width);
810
+ outline-offset: var(--eldra-focus-offset);
721
811
  outline-color: Highlight;
722
812
  }
723
813
  }
@@ -744,6 +834,8 @@
744
834
  --eldra-focus-alpha: 1;
745
835
  @supports not (color: color-mix(in srgb, red, red)) {
746
836
  box-shadow:
837
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
838
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
747
839
  0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
748
840
  0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width)) var(--eldra-color-focus),
749
841
  var(--tw-inset-shadow, 0 0 #0000),
@@ -756,6 +848,7 @@
756
848
  @media (forced-colors: active) {
757
849
  &[aria-expanded='true'] {
758
850
  outline-width: var(--eldra-focus-width);
851
+ outline-offset: var(--eldra-focus-offset);
759
852
  outline-color: Highlight;
760
853
  }
761
854
  }
@@ -777,6 +870,8 @@
777
870
  --eldra-focus-alpha: 1;
778
871
  @supports not (color: color-mix(in srgb, red, red)) {
779
872
  box-shadow:
873
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
874
+ 0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
780
875
  0 0 0 var(--eldra-focus-offset) var(--eldra-color-focus-inner),
781
876
  0 0 0 calc(var(--eldra-focus-offset) + var(--eldra-focus-width)) var(--eldra-color-focus),
782
877
  var(--tw-inset-shadow, 0 0 #0000),
@@ -789,6 +884,7 @@
789
884
  @media (forced-colors: active) {
790
885
  &:has(:focus-visible) {
791
886
  outline-width: var(--eldra-focus-width);
887
+ outline-offset: var(--eldra-focus-offset);
792
888
  outline-color: Highlight;
793
889
  }
794
890
  }
@@ -877,10 +973,10 @@
877
973
  }
878
974
 
879
975
  /* A field's own boundary (spec "Actions and forms" -> Compact controls: "1px `border-strong`
880
- boundary"). The width is a variable rather than Tailwind's `border`, because the invalid inset
881
- line below is inset by exactly this much and drawn exactly this thick: with `border` hard-wired
882
- to 1px, setting `--eldra-field-border-width` moved the line without moving the border it sits
883
- inside, and the two came apart. One variable now drives both. The literal default lives here,
976
+ boundary"). The width is a variable rather than Tailwind's `border`, because the invalid line
977
+ (`eldra-field-invalid` below) is drawn exactly this thick against it: with `border` hard-wired to
978
+ 1px, setting `--eldra-field-border-width` thickened one and not the other. One variable drives
979
+ both. The literal default lives here,
884
980
  not in a component class — the same shape as `eldra-link-radius` above. `border-style` comes
885
981
  from Tailwind's preflight (`*, ::before, ::after { border: 0 solid }`), which both the
886
982
  `tailwind.css` and the `style.css` route carry, so a width alone is a solid border and
@@ -938,46 +1034,19 @@
938
1034
  border-width: var(--eldra-editor-placeholder-border-width, 1.5px);
939
1035
  }
940
1036
 
941
- /* The error boundary of a field (spec "Input" → States, Error row): "2px `danger` (1px border +
942
- 1px inset line). On focus the inset line sits inside the `focus-inner` infill."
943
-
944
- Two things make that impossible to draw on the `<input>` itself. `eldra-focus` owns the
945
- element's `box-shadow` (the focus infill) and its `outline` (the ring), and a second rule for
946
- either would replace the ring rather than add to it; and an `<input>` is a replaced element, so
947
- it has no `::after` to lend. So the inset line is drawn by the field's own wrapper — the one
948
- element that shares the input's box exactly — as a pseudo-element inset by the input's border
949
- width. Keeping the border at 1px in every state is the point: a 2px border would move the value
950
- by 1px the moment the field went invalid. `pointer-events: none` keeps the clear button
951
- clickable through it, and because the line is *inside* the box while the focus infill is
952
- outside it, the two never overlap — which is what the spec's focus sentence asks for. */
1037
+ /* The error boundary of a field (spec "Input" → States, Error row): "2px `danger`". Drawn as the
1038
+ field's 1px `danger` border plus `eldra-focus`'s resting band in `danger`, as wide as the border
1039
+ and against its outer edge. Both start from that one edge, so they stay one 2px line at every
1040
+ zoom (a second line drawn by a pseudo-element inset by the border width came apart from it at
1041
+ 90%, 110% and 125%). The border stays 1px in every state, so the value never moves when the
1042
+ field turns invalid. On focus the band travels out past the `focus-inner` infill and becomes the
1043
+ ring, as on every control; the border reads 1px `danger` inside it. It goes on the element that
1044
+ carries `eldra-focus` and the border (the input, the textarea, the select trigger, or the
1045
+ `MultiSelect` field that wraps its tags). */
953
1046
  @utility eldra-field-invalid {
954
- position: relative;
955
- &::after {
956
- content: '';
957
- position: absolute;
958
- inset: var(--eldra-field-border-width, 1px);
959
- border: var(--eldra-field-border-width, 1px) solid var(--eldra-color-danger);
960
- /* The radius is lifted into a custom property of its own rather than written inline in the
961
- `calc()`. It substitutes to exactly the same token chain — the computed value is unchanged,
962
- and `source-scan.spec.ts` asserts both halves of it in the compiled stylesheet — but the
963
- `calc()` a bundler's PostCSS pass then has to parse holds one level of `var()` fallback
964
- instead of three. Two-deep nesting (`var(--a, var(--b, var(--c)))`) inside a `calc()` is
965
- what postcss-calc's grammar chokes on, and it printed a "Parse error … got unexpected
966
- RPAREN" warning on every consumer build (seen in the starter's). It is only a warning — the
967
- declaration is passed through untouched — but a package cannot ship noise into every
968
- consumer's build log, and a real parse error in that pass would look exactly the same. */
969
- --eldra-field-invalid-radius: var(
970
- --eldra-field-radius,
971
- var(--eldra-input-radius, var(--eldra-radius-md))
972
- );
973
- border-radius: calc(var(--eldra-field-invalid-radius) - var(--eldra-field-border-width, 1px));
974
- pointer-events: none;
975
- }
976
- @media (forced-colors: active) {
977
- &::after {
978
- border-color: CanvasText;
979
- }
980
- }
1047
+ --eldra-focus-rest-width: var(--eldra-field-border-width, 1px);
1048
+ --eldra-focus-rest-color: var(--eldra-color-danger);
1049
+ --eldra-focus-rest-forced: var(--eldra-field-border-width, 1px);
981
1050
  }
982
1051
 
983
1052
  /* The radio group Card's own boundary (spec "Radio group" → Sizes, Card row: "1px border"). The
@@ -990,8 +1059,7 @@
990
1059
  }
991
1060
 
992
1061
  /* The selected Card's boundary (spec "Radio group" → States, Selected row: "2px `primary` (1px
993
- border + 1px inset line)"). The same technique as `eldra-field-invalid` above, and for the same
994
- reason: keeping the real border at 1px in every state and adding a second 1px inset line only
1062
+ border + 1px inset line)"). Keeping the real border at 1px in every state and adding a second 1px inset line only
995
1063
  when selected is what stops the card growing — and its neighbours shifting — the moment it is
996
1064
  chosen. The line's colour defaults to `primary`; the invalid-and-selected state (Decision: an
997
1065
  invalid `Checkbox` that is also checked keeps its fill and swaps only the border colour) sets
@@ -1308,7 +1376,7 @@
1308
1376
 
1309
1377
  /* The sold-out-and-selected pill's boundary (spec "Variant picker" → States, "Sold out + selected"
1310
1378
  row): "**2px** solid `text`" — the only pill row whose border is thicker than the other four.
1311
- The same technique as `eldra-radio-card-selected` and `eldra-field-invalid`: the real border
1379
+ The same technique as `eldra-radio-card-selected`: the real border
1312
1380
  stays `eldra-variant-pill-border`'s 1px in every state, so a pill never resizes (and its row
1313
1381
  neighbours never reflow) the moment it becomes both sold out and selected, and a second 1px
1314
1382
  inset line does the rest. */
@@ -1,4 +1,4 @@
1
- import { A as focusInvalid, L as CurrencyInput_default, N as Input_default, R as UnitInput_default, _t as FIELD_KEY, b as MultiSelect_default, ft as CheckboxGroup_default, i as SearchBar_default, j as Switch_default, jt as useUiId, k as FormLayout_default, kt as useEldraScope, l as RadioGroup_default, n as Textarea_default, pt as Checkbox_default, r as Select_default, t as VariantPicker_default, y as QuantityStepper_default } from "./VariantPicker-C-9sMXGI.js";
1
+ import { A as focusInvalid, L as CurrencyInput_default, N as Input_default, R as UnitInput_default, _t as FIELD_KEY, b as MultiSelect_default, ft as CheckboxGroup_default, i as SearchBar_default, j as Switch_default, jt as useUiId, k as FormLayout_default, kt as useEldraScope, l as RadioGroup_default, n as Textarea_default, pt as Checkbox_default, r as Select_default, t as VariantPicker_default, y as QuantityStepper_default } from "./VariantPicker-CvfuDMDD.js";
2
2
  import { r as useMessages } from "./useMessages-B5nzZghs.js";
3
3
  import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createSlots, createTextVNode, defineComponent, guardReactiveProps, inject, isRef, mergeProps, nextTick, normalizeClass, normalizeProps, onMounted, onScopeDispose, openBlock, provide, ref, renderList, renderSlot, toDisplayString, unref, watch, withCtx } from "vue";
4
4
  import { FormContextKey, useField, useForm } from "vee-validate";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eldrajs/ui",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Accessible Vue 3 core components for Eldra storefronts: buttons, forms, selects, cards, overlays and navigation, themed through CSS design tokens.",
5
5
  "keywords": [
6
6
  "accessible",