@volverjs/style 0.1.24 → 0.1.26

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 (35) hide show
  1. package/dist/base.css +1 -1
  2. package/dist/components/vv-alert.css +1 -1
  3. package/dist/components/vv-checkbox.css +1 -1
  4. package/dist/components/vv-dialog.css +1 -1
  5. package/dist/components/vv-dropdown.css +1 -1
  6. package/dist/components/vv-input-range.css +1 -0
  7. package/dist/components/vv-tooltip.css +1 -1
  8. package/dist/components.css +1 -1
  9. package/dist/export.css +1 -1
  10. package/dist/props/input.css +1 -1
  11. package/dist/props/layout.css +1 -1
  12. package/dist/props.css +1 -1
  13. package/dist/utilities/layout.css +1 -1
  14. package/dist/utilities.css +1 -1
  15. package/dist/volver.css +1 -1
  16. package/package.json +25 -20
  17. package/src/_config.scss +1 -0
  18. package/src/components/index.scss +1 -0
  19. package/src/components/vv-input-file.scss +7 -83
  20. package/src/components/vv-input-range.scss +28 -0
  21. package/src/components/vv-input-text.scss +7 -83
  22. package/src/components/vv-select.scss +7 -83
  23. package/src/components/vv-textarea.scss +7 -83
  24. package/src/props/layout.scss +28 -0
  25. package/src/settings/_index.scss +1 -0
  26. package/src/settings/_input.scss +12 -0
  27. package/src/settings/_layout.scss +3 -1
  28. package/src/settings/components/_vv-alert.scss +4 -4
  29. package/src/settings/components/_vv-checkbox.scss +5 -3
  30. package/src/settings/components/_vv-dialog.scss +56 -3
  31. package/src/settings/components/_vv-dropdown.scss +14 -0
  32. package/src/settings/components/_vv-input-range.scss +189 -0
  33. package/src/settings/components/_vv-tooltip.scss +10 -8
  34. package/src/tools/mixin-modules/_attrs.scss +28 -14
  35. package/src/tools/mixin-modules/_bem.scss +149 -70
@@ -19,7 +19,31 @@ $-valid-states: (
19
19
  active, focus, hover, focus-within, target, visited, focus-visible,
20
20
  disabled, checked, checked-within, multiple, selected, readonly,
21
21
  empty, placeholder-shown, dirty, valid, invalid, indeterminate,
22
- first-child, last-child, open, close, determinate, pressed, current
22
+ first-child, last-child, open, close, determinate, pressed, current,
23
+ popover, popover-open
24
+ );
25
+
26
+ // Selector suffixes appended to the block, and to its alias when there is one,
27
+ // for the states that are not plain pseudo-classes. A state can need more than
28
+ // one suffix: "disabled" also matches the aria attribute. States missing here
29
+ // fall back to ":not([disabled]):<state>", while "current" adds no suffix at
30
+ // all and keeps only the BEM selectors built by the caller.
31
+ $-state-suffixes: (
32
+ checked: ':checked',
33
+ checked-within: ':has(input:checked)',
34
+ close: ':not([open])',
35
+ dirty: ':not(:has(*:placeholder-shown))',
36
+ disabled: ('[disabled]', '[aria-disabled="true"]'),
37
+ focus-visible: ':not(:active):not([disabled]):not([tabindex="-1"]):not([aria-disabled="true"]):focus-visible',
38
+ multiple: '[multiple]',
39
+ open: '[open]',
40
+ // Element promoted to the top layer through the Popover API: "popover"
41
+ // matches it whether it is open or not, "popover-open" only when it is
42
+ popover: '[popover]',
43
+ popover-open: ':popover-open',
44
+ pressed: '[aria-pressed="true"]',
45
+ readonly: '[readonly]',
46
+ selected: '[aria-selected="true"]',
23
47
  );
24
48
 
25
49
  // ============================================
@@ -494,79 +518,17 @@ $-valid-states: (
494
518
  // Helper to add state-specific selectors
495
519
  // Returns the updated selectors list
496
520
  @function -add-state-selectors($state, $block-item, $modifier, $alias, $selectors) {
497
- @if $state == 'checked-within' {
498
- $selectors: list.join($selectors, '#{$modifier}#{$block-item}:has(input:checked)');
499
-
500
- @if $alias {
501
- $selectors: list.join($selectors, '#{$modifier}#{$alias}:has(input:checked)');
502
- }
503
- } @else if $state == 'open' {
504
- $selectors: list.join($selectors, '#{$modifier}#{$block-item}[open]');
505
-
506
- @if $alias {
507
- $selectors: list.join($selectors, '#{$modifier}#{$alias}[open]');
508
- }
509
- } @else if $state == 'close' {
510
- $selectors: list.join($selectors, '#{$modifier}#{$block-item}:not([open])');
511
-
512
- @if $alias {
513
- $selectors: list.join($selectors, '#{$modifier}#{$alias}:not([open])');
514
- }
515
- } @else if $state == 'dirty' {
516
- $selectors: list.join($selectors, '#{$modifier}#{$block-item}:not(:has(*:placeholder-shown))');
517
-
518
- @if $alias {
519
- $selectors: list.join($selectors, '#{$modifier}#{$alias}:not(:has(*:placeholder-shown))');
520
- }
521
- } @else if $state == 'disabled' or $state == 'readonly' or $state == 'multiple' {
522
- $selectors: list.join($selectors, '#{$modifier}#{$block-item}[#{$state}]');
523
-
524
- @if $alias {
525
- $selectors: list.join($selectors, '#{$modifier}#{$alias}[#{$state}]');
526
- }
527
-
528
- @if $state == 'disabled' {
529
- $selectors: list.join($selectors, '#{$modifier}#{$block-item}[aria-disabled="true"]');
530
-
531
- @if $alias {
532
- $selectors: list.join($selectors, '#{$modifier}#{$alias}[aria-disabled="true"]');
533
- }
534
- }
535
- } @else if $state == 'focus-visible' {
536
- $selectors: list.join(
537
- $selectors,
538
- '#{$modifier}#{$block-item}:not(:active):not([disabled]):not([tabindex="-1"]):not([aria-disabled="true"]):#{$state}'
539
- );
540
-
541
- @if $alias {
542
- $selectors: list.join(
543
- $selectors,
544
- '#{$modifier}#{$alias}:not(:active):not([disabled]):not([tabindex="-1"]):not([aria-disabled="true"]):#{$state}'
545
- );
546
- }
547
- } @else if $state == 'checked' {
548
- $selectors: list.join($selectors, '#{$modifier}#{$block-item}:#{$state}');
549
-
550
- @if $alias {
551
- $selectors: list.join($selectors, '#{$modifier}#{$alias}:#{$state}');
552
- }
553
- } @else if $state == 'pressed' {
554
- $selectors: list.join($selectors, '#{$modifier}#{$block-item}[aria-pressed="true"]');
521
+ @if $state == 'current' {
522
+ @return $selectors;
523
+ }
555
524
 
556
- @if $alias {
557
- $selectors: list.join($selectors, '#{$modifier}#{$alias}[aria-pressed="true"]');
558
- }
559
- } @else if $state == 'selected' {
560
- $selectors: list.join($selectors, '#{$modifier}#{$block-item}[aria-selected="true"]');
525
+ $suffixes: map.get($-state-suffixes, $state) or ':not([disabled]):#{$state}';
561
526
 
562
- @if $alias {
563
- $selectors: list.join($selectors, '#{$modifier}#{$alias}[aria-selected="true"]');
564
- }
565
- } @else if $state != 'current' {
566
- $selectors: list.join($selectors, '#{$modifier}#{$block-item}:not([disabled]):#{$state}');
527
+ @each $suffix in $suffixes {
528
+ $selectors: list.join($selectors, '#{$modifier}#{$block-item}#{$suffix}');
567
529
 
568
530
  @if $alias {
569
- $selectors: list.join($selectors, '#{$modifier}#{$alias}:not([disabled]):#{$state}');
531
+ $selectors: list.join($selectors, '#{$modifier}#{$alias}#{$suffix}');
570
532
  }
571
533
  }
572
534
 
@@ -749,3 +711,120 @@ $-valid-states: (
749
711
  }
750
712
  }
751
713
  }
714
+
715
+ // ============================================
716
+ // Control states
717
+ // ============================================
718
+ // A field component is a wrapper element around a native control, so its own
719
+ // `state` maps generate selectors (`.vv-input-text:disabled`) that can never
720
+ // match. This re-applies those placeholders on the control's attribute
721
+ // instead, through `:has()`, block first and then element by element.
722
+
723
+ // `$states` are read from the map's `state` key and must name an attribute of
724
+ // the control: `disabled` and `readonly` for a text field, `disabled` alone
725
+ // where HTML has no readonly (`select`, `input[type="range"]`). Components
726
+ // that spell readonly as a modifier because they freeze the control with the
727
+ // disabled attribute list that modifier in `$except-modifiers`, otherwise the
728
+ // hook would dim a readonly field: `:has()` carries the specificity of its
729
+ // argument, so with `$zero-specificity: false` it outweighs the modifier and
730
+ // source order alone would not settle it.
731
+ @mixin spread-map-into-control-states(
732
+ $map,
733
+ $block,
734
+ $control: 'input',
735
+ $states: ('disabled', 'readonly'),
736
+ $except-modifiers: (),
737
+ $zero-specificity: true
738
+ ) {
739
+ $component-selector: '.#{$block}';
740
+ $exception: '';
741
+
742
+ @each $modifier in $except-modifiers {
743
+ $exception: '#{$exception}:not(#{$component-selector}--#{$modifier})';
744
+ }
745
+
746
+ @each $state in $states {
747
+ $selector: (
748
+ '#{$component-selector}#{$exception}:has(#{$control}[#{$state}])'
749
+ );
750
+
751
+ @include wrap-with-where(
752
+ $selector: $selector,
753
+ $enabled: $zero-specificity
754
+ ) {
755
+ @extend %#{$block}--#{$state} !optional;
756
+ }
757
+
758
+ // element
759
+ @if map.get($map, 'state', $state, 'element') {
760
+ @each $element, $element-map
761
+ in map.get($map, 'state', $state, 'element')
762
+ {
763
+ $element-selector: (
764
+ '#{$selector} #{$component-selector}__#{$element}'
765
+ );
766
+ $alias: map.get($map, 'element', $element, '_alias');
767
+
768
+ @if $alias {
769
+ $element-selector: list.append(
770
+ $element-selector,
771
+ ('#{$selector} #{$alias}')
772
+ );
773
+ }
774
+
775
+ @include wrap-with-where(
776
+ $selector: $element-selector,
777
+ $enabled: $zero-specificity
778
+ ) {
779
+ @extend %#{$block}-state-#{$state}__#{$element} !optional;
780
+ }
781
+
782
+ // element state
783
+ @each $element-state, $state-map
784
+ in map.get($element-map, 'state')
785
+ {
786
+ @if $element-state {
787
+ $element-selector-state: ();
788
+
789
+ @each $item in $element-selector {
790
+ $element-selector-state: list.append(
791
+ $element-selector-state,
792
+ ('#{$item}:#{$element-state}')
793
+ );
794
+ }
795
+
796
+ @include wrap-with-where(
797
+ $selector: $element-selector-state,
798
+ $enabled: $zero-specificity
799
+ ) {
800
+ @extend %#{$block}-state-#{$state}-element-#{$element}--#{$element-state}
801
+ !optional;
802
+ }
803
+ }
804
+ }
805
+
806
+ // element pseudo
807
+ @each $pseudo, $pseudo-map in map.get($element-map, 'pseudo') {
808
+ @if $pseudo {
809
+ $element-selector-pseudo: ();
810
+
811
+ @each $item in $element-selector {
812
+ $element-selector-pseudo: list.append(
813
+ $element-selector-pseudo,
814
+ ('#{$item}::#{$pseudo}')
815
+ );
816
+ }
817
+
818
+ @include wrap-with-where(
819
+ $selector: $element-selector-pseudo,
820
+ $enabled: $zero-specificity
821
+ ) {
822
+ @extend %#{$block}-state-#{$state}-element-#{$element}--#{$pseudo}
823
+ !optional;
824
+ }
825
+ }
826
+ }
827
+ }
828
+ }
829
+ }
830
+ }