@pathscale/ui 2.6.2 → 2.6.4

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.
@@ -6,7 +6,7 @@ import { twMerge } from "../../lib/twMerge.js";
6
6
  import { CLASSES, componentRecipe } from "./Input.recipe.js";
7
7
  import { resolveState } from "../vocabulary.js";
8
8
  var _tmpl$ = /*#__PURE__*/ template("<div>"), _tmpl$2 = /*#__PURE__*/ template("<span>"), _tmpl$3 = /*#__PURE__*/ template("<div><input><!>"), _tmpl$4 = /*#__PURE__*/ template("<label>"), _tmpl$5 = /*#__PURE__*/ template("<p>");
9
- const InputContext = createContext();
9
+ const InputContext = createContext(null);
10
10
  const __solidLayoutInputRoot = (_stable, p)=>{
11
11
  const others = omit(p, "children", "class", "size", "fullWidth", "state", "issues", "dataTheme");
12
12
  const baseId = createUniqueId();
@@ -82,10 +82,27 @@
82
82
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-accent) 22%, transparent);
83
83
  }
84
84
 
85
+ /*
86
+ * Hover has to reach a radio that carries its own indicator content.
87
+ *
88
+ * The second rule below is `:empty::before`, which is right for the dot this
89
+ * component draws itself: there is nothing to tint but the pseudo-element.
90
+ * A radio given real content — a colour swatch, an icon, a preview — has a
91
+ * non-empty indicator, so that half matched nothing, and the surviving half
92
+ * only moved `border-color` on `.radio__control`. Any consumer that also
93
+ * restyled the control's border then had no hover feedback at all: that is
94
+ * what happened to AgencyZero's colour wheel, where 31 petals gave no
95
+ * indication of which one the pointer was on.
96
+ *
97
+ * So the control lifts on hover as well. `transform` is the one channel a
98
+ * consumer's own border and background overrides cannot silently cancel, and
99
+ * it reads on a petal whose entire surface is already a colour.
100
+ */
85
101
  @media (hover: hover) {
86
102
  .radio:hover:not([data-selected="true"]):not([data-disabled="true"]) .radio__control,
87
103
  .radio[data-hovered="true"]:not([data-selected="true"]):not([data-disabled="true"]) .radio__control {
88
104
  border-color: color-mix(in oklab, var(--color-base-content) 24%, transparent);
105
+ transform: scale(1.12);
89
106
  }
90
107
 
91
108
  .radio:hover:not([data-selected="true"]):not([data-disabled="true"]) .radio__indicator:empty::before,
@@ -1,5 +1,6 @@
1
1
  @layer components {
2
2
  .switch {
3
+ --switch-travel: 2.5rem;
3
4
  position: relative;
4
5
  display: inline-flex;
5
6
  align-items: center;
@@ -64,9 +65,20 @@
64
65
  0 0 5px 0 rgb(var(--shadow-color, 0 0 0) / 2%),
65
66
  0 2px 10px 0 rgb(var(--shadow-color, 0 0 0) / 6%),
66
67
  0 0 1px 0 rgb(var(--shadow-color, 0 0 0) / 30%);
68
+ /*
69
+ * `transform`, not `margin`.
70
+ *
71
+ * Sliding the thumb by animating `margin-inline-start` re-runs layout on
72
+ * every frame of the 300ms travel, for the whole switch and whatever
73
+ * shares its formatting context. On a renderer where layout is the
74
+ * expensive phase that is what a toggle "not feeling smooth" is made of.
75
+ * A transform composites instead, so the same movement costs no layout at
76
+ * all, and `will-change` keeps it off the main thread.
77
+ */
67
78
  transition:
68
- margin 300ms ease,
79
+ transform 300ms ease,
69
80
  background-color 200ms ease;
81
+ will-change: transform;
70
82
  }
71
83
 
72
84
  .switch__icon {
@@ -121,7 +133,7 @@
121
133
  }
122
134
 
123
135
  .switch[data-selected="true"] .switch__thumb {
124
- margin-inline-start: calc(100% - 1.5rem);
136
+ transform: translateX(calc(var(--switch-travel, 2.5rem) - 1.625rem));
125
137
  box-shadow:
126
138
  0 0 5px 0 rgb(var(--shadow-color, 0 0 0) / 2%),
127
139
  0 2px 10px 0 rgb(var(--shadow-color, 0 0 0) / 6%),
@@ -157,7 +169,7 @@
157
169
  }
158
170
 
159
171
  .switch--sm[data-selected="true"] .switch__thumb {
160
- margin-inline-start: calc(100% - 1.15625rem);
172
+ transform: translateX(calc(2rem - 1.28125rem));
161
173
  }
162
174
 
163
175
  /* ── Size: md (default) ── */
@@ -179,7 +191,7 @@
179
191
  }
180
192
 
181
193
  .switch--lg[data-selected="true"] .switch__thumb {
182
- margin-inline-start: calc(100% - 1.84375rem);
194
+ transform: translateX(calc(3rem - 1.96875rem));
183
195
  }
184
196
 
185
197
  /* ── Color: default ── */
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "format": "solid-layouts-library-v2",
3
3
  "package": "@pathscale/ui",
4
- "version": "2.6.2",
4
+ "version": "2.6.4",
5
5
  "components": {
6
6
  "Accordion": {
7
7
  "kind": "embedded"
@@ -14685,7 +14685,8 @@
14685
14685
  "--switch-control-bg-hover",
14686
14686
  "--switch-control-bg-pressed",
14687
14687
  "--switch-control-border",
14688
- "--switch-control-border-checked"
14688
+ "--switch-control-border-checked",
14689
+ "--switch-travel"
14689
14690
  ],
14690
14691
  "referenced": [
14691
14692
  "--border",
@@ -14709,7 +14710,8 @@
14709
14710
  "--switch-control-bg-hover",
14710
14711
  "--switch-control-bg-pressed",
14711
14712
  "--switch-control-border",
14712
- "--switch-control-border-checked"
14713
+ "--switch-control-border-checked",
14714
+ "--switch-travel"
14713
14715
  ]
14714
14716
  },
14715
14717
  "keyframes": {
@@ -34432,6 +34434,14 @@
34432
34434
  "Switch"
34433
34435
  ]
34434
34436
  },
34437
+ "--switch-travel": {
34438
+ "declaredBy": [
34439
+ "Switch"
34440
+ ],
34441
+ "referencedBy": [
34442
+ "Switch"
34443
+ ]
34444
+ },
34435
34445
  "--dropdown-trigger-bg": {
34436
34446
  "declaredBy": [
34437
34447
  "Dropdown"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pathscale/ui",
3
- "version": "2.6.2",
3
+ "version": "2.6.4",
4
4
  "author": "pathscale",
5
5
  "repository": {
6
6
  "type": "git",