@geoffcox/sterling-svelte 0.0.25 → 0.0.27

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 (86) hide show
  1. package/Button.svelte +79 -24
  2. package/Button.svelte.d.ts +1 -0
  3. package/Checkbox.svelte +44 -19
  4. package/Checkbox.svelte.d.ts +1 -0
  5. package/ColorPicker.constants.d.ts +1 -0
  6. package/ColorPicker.constants.js +1 -0
  7. package/ColorPicker.svelte +226 -0
  8. package/ColorPicker.svelte.d.ts +22 -0
  9. package/ColorPicker.types.d.ts +4 -0
  10. package/ColorPicker.types.js +1 -0
  11. package/Dialog.svelte +10 -10
  12. package/Dropdown.svelte +88 -47
  13. package/Dropdown.svelte.d.ts +4 -0
  14. package/Field.svelte +34 -46
  15. package/HexColorSliders.svelte +150 -0
  16. package/HexColorSliders.svelte.d.ts +22 -0
  17. package/HslColorSliders.svelte +187 -0
  18. package/HslColorSliders.svelte.d.ts +22 -0
  19. package/Input.svelte +49 -21
  20. package/Input.svelte.d.ts +2 -1
  21. package/Label.svelte +3 -3
  22. package/Link.svelte +63 -17
  23. package/Link.svelte.d.ts +1 -0
  24. package/List.svelte +31 -30
  25. package/List.svelte.d.ts +1 -0
  26. package/List.types.d.ts +4 -3
  27. package/ListItem.svelte +29 -10
  28. package/ListItem.svelte.d.ts +1 -1
  29. package/Menu.svelte +92 -121
  30. package/Menu.svelte.d.ts +8 -2
  31. package/MenuBar.svelte +77 -32
  32. package/MenuBar.types.d.ts +2 -2
  33. package/MenuButton.svelte +48 -28
  34. package/MenuItem.constants.d.ts +1 -0
  35. package/MenuItem.constants.js +1 -0
  36. package/MenuItem.svelte +202 -139
  37. package/MenuItem.svelte.d.ts +7 -3
  38. package/MenuItem.types.d.ts +14 -5
  39. package/MenuItem.utils.d.ts +2 -0
  40. package/MenuItem.utils.js +16 -0
  41. package/MenuItemDisplay.svelte +9 -2
  42. package/MenuItemDisplay.svelte.d.ts +1 -0
  43. package/MenuSeparator.svelte +3 -3
  44. package/Popover.svelte +68 -64
  45. package/Popover.svelte.d.ts +4 -2
  46. package/Progress.svelte +14 -14
  47. package/Radio.svelte +42 -16
  48. package/Radio.svelte.d.ts +1 -0
  49. package/RgbColorSliders.svelte +161 -0
  50. package/RgbColorSliders.svelte.d.ts +22 -0
  51. package/Select.svelte +50 -32
  52. package/Slider.svelte +108 -118
  53. package/Slider.svelte.d.ts +1 -0
  54. package/Switch.svelte +97 -34
  55. package/Switch.svelte.d.ts +1 -0
  56. package/Tab.svelte +53 -30
  57. package/TabList.svelte +23 -28
  58. package/TabList.svelte.d.ts +1 -0
  59. package/TabList.types.d.ts +1 -1
  60. package/TextArea.svelte +45 -20
  61. package/TextArea.svelte.d.ts +3 -2
  62. package/Tooltip.svelte +12 -11
  63. package/Tree.svelte +37 -35
  64. package/Tree.svelte.d.ts +2 -0
  65. package/Tree.types.d.ts +1 -0
  66. package/TreeChevron.svelte +1 -1
  67. package/TreeItem.svelte +47 -10
  68. package/TreeItem.svelte.d.ts +2 -0
  69. package/TreeItemDisplay.svelte +26 -8
  70. package/TreeItemDisplay.svelte.d.ts +2 -0
  71. package/actions/clickOutside.js +1 -1
  72. package/actions/trapKeyboardFocus.d.ts +3 -0
  73. package/actions/trapKeyboardFocus.js +52 -0
  74. package/floating-ui.types.d.ts +2 -0
  75. package/index.d.ts +10 -5
  76. package/index.js +8 -3
  77. package/package.json +12 -1
  78. package/stores/prefersReducedMotion.d.ts +1 -0
  79. package/stores/prefersReducedMotion.js +10 -0
  80. package/stores/usingKeyboard.d.ts +1 -0
  81. package/stores/usingKeyboard.js +13 -0
  82. package/theme/applyTheme.js +3 -2
  83. package/theme/colors.d.ts +1 -0
  84. package/theme/colors.js +28 -13
  85. package/theme/darkTheme.js +130 -87
  86. package/theme/lightTheme.js +107 -87
package/Select.svelte CHANGED
@@ -178,7 +178,7 @@ const onListSelect = (event) => {
178
178
  on:mouseover
179
179
  on:mouseout
180
180
  on:mouseup
181
- on:wheel
181
+ on:wheel|passive
182
182
  on:paste
183
183
  on:click={onSelectClick}
184
184
  on:click_outside={() => (open = false)}
@@ -199,19 +199,21 @@ const onListSelect = (event) => {
199
199
  <div class="chevron" />
200
200
  </slot>
201
201
  </div>
202
- <Popup reference={selectRef} bind:open id={popupId}>
203
- <List
204
- bind:this={listRef}
205
- composed
206
- {disabled}
207
- selectedValue={pendingSelectedValue}
208
- on:click={onListClick}
209
- on:keydown={onListKeydown}
210
- on:select={onListSelect}
211
- tabIndex={open ? 0 : -1}
212
- >
213
- <slot />
214
- </List>
202
+ <Popup reference={selectRef} bind:open id={popupId} persistent>
203
+ <div class="popup-content">
204
+ <List
205
+ bind:this={listRef}
206
+ composed
207
+ {disabled}
208
+ selectedValue={pendingSelectedValue}
209
+ on:click={onListClick}
210
+ on:keydown={onListKeydown}
211
+ on:select={onListSelect}
212
+ tabIndex={open ? 0 : -1}
213
+ >
214
+ <slot />
215
+ </List>
216
+ </div>
215
217
  </Popup>
216
218
  </div>
217
219
 
@@ -219,12 +221,12 @@ const onListSelect = (event) => {
219
221
  .sterling-select {
220
222
  align-content: center;
221
223
  align-items: center;
222
- background-color: var(--stsv-Input__background-color);
223
- border-color: var(--stsv-Input__border-color);
224
- border-radius: var(--stsv-Input__border-radius);
225
- border-style: var(--stsv-Input__border-style);
226
- border-width: var(--stsv-Input__border-width);
227
- color: var(--stsv-Input__color);
224
+ background-color: var(--stsv-input__background-color);
225
+ border-color: var(--stsv-input__border-color);
226
+ border-radius: var(--stsv-input__border-radius);
227
+ border-style: var(--stsv-input__border-style);
228
+ border-width: var(--stsv-input__border-width);
229
+ color: var(--stsv-input__color);
228
230
  cursor: pointer;
229
231
  display: grid;
230
232
  grid-template-columns: 1fr auto;
@@ -236,19 +238,19 @@ const onListSelect = (event) => {
236
238
  }
237
239
 
238
240
  .sterling-select:hover {
239
- background-color: var(--stsv-Input__background-color--hover);
240
- border-color: var(--stsv-Input__border-color--hover);
241
- color: var(--stsv-Input__color--hover);
241
+ background-color: var(--stsv-input__background-color--hover);
242
+ border-color: var(--stsv-input__border-color--hover);
243
+ color: var(--stsv-input__color--hover);
242
244
  }
243
245
 
244
246
  .sterling-select:focus {
245
- background-color: var(--stsv-Input__background-color--focus);
246
- border-color: var(--stsv-Input__border-color--focus);
247
- color: var(--stsv-Input__color--focus);
248
- outline-color: var(--stsv-Common__outline-color);
249
- outline-offset: var(--stsv-Common__outline-offset);
250
- outline-style: var(--stsv-Common__outline-style);
251
- outline-width: var(--stsv-Common__outline-width);
247
+ background-color: var(--stsv-input__background-color--focus);
248
+ border-color: var(--stsv-input__border-color--focus);
249
+ color: var(--stsv-input__color--focus);
250
+ outline-color: var(--stsv-common__outline-color);
251
+ outline-offset: var(--stsv-common__outline-offset);
252
+ outline-style: var(--stsv-common__outline-style);
253
+ outline-width: var(--stsv-common__outline-width);
252
254
  }
253
255
 
254
256
  .sterling-select.disabled {
@@ -257,7 +259,13 @@ const onListSelect = (event) => {
257
259
  }
258
260
 
259
261
  .sterling-select::after {
260
- background: var(--stsv-Disabled__background);
262
+ background: repeating-linear-gradient(
263
+ 45deg,
264
+ var(--stsv-common__background-color1--disabled),
265
+ var(--stsv-common__background-color1--disabled) 3px,
266
+ var(--stsv-common__background-color2--disabled) 3px,
267
+ var(--stsv-common__background-color2--disabled) 6px
268
+ );
261
269
  bottom: 0;
262
270
  content: '';
263
271
  left: 0;
@@ -327,7 +335,17 @@ const onListSelect = (event) => {
327
335
  }
328
336
 
329
337
  .popup-content {
330
- max-height: 15em;
338
+ background-color: var(--stsv-common__background-color);
339
+ border-color: var(--stsv-common__border-color);
340
+ border-radius: var(--stsv-common__border-radius);
341
+ border-style: var(--stsv-common__border-style);
342
+ border-width: var(--stsv-common__border-width);
343
+ padding: 0.25em;
344
+ display: grid;
345
+ grid-template-columns: 1fr;
346
+ grid-template-rows: 1fr;
347
+ overflow: hidden;
348
+ max-height: 20em;
331
349
  }
332
350
 
333
351
  @media (prefers-reduced-motion) {
package/Slider.svelte CHANGED
@@ -1,10 +1,11 @@
1
1
  <script>import { createEventDispatcher } from "svelte";
2
2
  import { round } from "lodash-es";
3
+ export let colorful = false;
3
4
  export let composed = false;
4
5
  export let disabled = false;
5
6
  export let min = 0;
6
7
  export let max = 100;
7
- export let precision = 0;
8
+ export let precision = void 0;
8
9
  export let step = void 0;
9
10
  export let value = 0;
10
11
  export let vertical = false;
@@ -22,48 +23,17 @@ const dispatch = createEventDispatcher();
22
23
  const raiseChange = (newValue) => {
23
24
  dispatch("change", { value: newValue });
24
25
  };
25
- const getPrecision = (value2) => {
26
- if (value2 !== void 0 && Number !== null && !Number.isNaN(value2)) {
27
- const text = value2.toString();
28
- const position = text.indexOf(".");
29
- if (position !== -1) {
30
- const fraction = text.substring(position + 1);
31
- if (fraction) {
32
- return fraction.length;
33
- }
34
- }
35
- }
36
- return 0;
37
- };
38
- $:
39
- highestPrecision = Math.max(
40
- precision,
41
- getPrecision(min),
42
- getPrecision(max),
43
- getPrecision(step)
44
- );
45
26
  const setValue = (newValue) => {
46
- value = round(Math.max(min, Math.min(max, newValue)), highestPrecision);
27
+ const clamped = Math.max(min, Math.min(max, newValue));
28
+ value = precision !== void 0 ? round(clamped, precision) : clamped;
47
29
  };
48
30
  $: {
49
31
  if (min > max) {
50
32
  min = max;
51
33
  }
52
34
  }
53
- $: {
54
- if (value < min || value > max || value !== round(value, highestPrecision)) {
55
- setValue(value);
56
- }
57
- }
58
- $: {
59
- if (step) {
60
- let stepValue = Math.max(min, Math.min(value, max));
61
- stepValue = Math.round(stepValue / step) * step + min;
62
- if (stepValue !== value) {
63
- setValue(stepValue);
64
- }
65
- }
66
- }
35
+ $:
36
+ min, max, precision, setValue(value);
67
37
  $:
68
38
  ratio = (value - min) / (max - min);
69
39
  $:
@@ -137,6 +107,7 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
137
107
  aria-valuenow={value}
138
108
  aria-valuemax={max}
139
109
  class="sterling-slider"
110
+ class:colorful
140
111
  class:composed
141
112
  class:disabled
142
113
  class:horizontal={!vertical}
@@ -177,7 +148,7 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
177
148
  on:pointerout
178
149
  on:pointerup
179
150
  on:pointerup={onPointerUp}
180
- on:wheel
151
+ on:wheel|passive
181
152
  {...$$restProps}
182
153
  >
183
154
  <div
@@ -202,34 +173,106 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
202
173
  transition: background-color 250ms, color 250ms, border-color 250ms;
203
174
  }
204
175
 
176
+ .sterling-slider.horizontal {
177
+ height: 2em;
178
+ }
179
+
205
180
  .sterling-slider.vertical {
206
181
  height: 100%;
182
+ width: 2em;
207
183
  }
208
184
 
185
+ .sterling-slider.composed,
186
+ .sterling-slider.composed:hover,
187
+ .sterling-slider.composed.focus,
188
+ .sterling-slider.composed.disabled {
189
+ background: none;
190
+ border: none;
191
+ outline: none;
192
+ }
193
+
194
+ /* ----- container ----- */
195
+
209
196
  .container {
210
197
  position: relative;
211
198
  }
212
199
 
200
+ .sterling-slider.horizontal .container {
201
+ margin: 0 0.75em;
202
+ }
203
+
204
+ .sterling-slider.vertical .container {
205
+ margin: 0.75em 0;
206
+ }
207
+
208
+ /* ----- track ----- */
209
+
213
210
  .track {
214
211
  position: absolute;
215
- background: var(--stsv-Display__background-color);
212
+ background: var(--stsv-common__background-color--secondary);
216
213
  transition: background-color 250ms, color 250ms, border-color 250ms;
217
214
  }
218
215
 
216
+ .sterling-slider.horizontal .track {
217
+ left: 0;
218
+ right: 0;
219
+ top: 50%;
220
+ height: 3px;
221
+ transform: translate(0, -50%);
222
+ }
223
+
224
+ .sterling-slider.vertical .track {
225
+ bottom: 0;
226
+ left: 50%;
227
+ top: 0;
228
+ transform: translate(-50%, 0);
229
+ width: 3px;
230
+ }
231
+
232
+ .sterling-slider:focus-visible {
233
+ outline-color: var(--stsv-common__outline-color);
234
+ outline-offset: var(--stsv-common__outline-offset);
235
+ outline-style: var(--stsv-common__outline-style);
236
+ outline-width: var(--stsv-common__outline-width);
237
+ }
238
+
239
+ /* ----- fill ----- */
240
+
219
241
  .fill {
220
- background: var(--stsv-Display__color);
242
+ background: var(--stsv-common__color);
243
+ position: absolute;
244
+ transition: background-color 250ms, color 250ms, border-color 250ms;
245
+ }
246
+
247
+ .sterling-slider.horizontal .fill {
248
+ height: 3px;
249
+ top: 50%;
250
+ transform: translate(0, -50%);
251
+ }
252
+
253
+ .sterling-slider.vertical .fill {
254
+ bottom: 0;
255
+ left: 50%;
256
+ transform: translate(-50%, 0);
257
+ width: 3px;
258
+ }
259
+
260
+ .sterling-slider.colorful .fill {
261
+ background: var(--stsv-input--colorful__border-color--selected);
221
262
  position: absolute;
222
263
  transition: background-color 250ms, color 250ms, border-color 250ms;
223
264
  }
224
265
 
266
+ /* ----- thumb ----- */
267
+
225
268
  .thumb {
226
- background-color: var(--stsv-Button__background-color);
227
- border-color: var(--stsv-Button__border-color);
269
+ background-color: var(--stsv-button__background-color);
270
+ border-color: var(--stsv-button__border-color);
228
271
  border-radius: 10000px;
229
- border-style: var(--stsv-Button__border-style);
230
- border-width: var(--stsv-Button__border-width);
272
+ border-style: var(--stsv-button__border-style);
273
+ border-width: var(--stsv-button__border-width);
231
274
  box-sizing: border-box;
232
- color: var(--stsv-Button__color);
275
+ color: var(--stsv-button__color);
233
276
  cursor: pointer;
234
277
  display: block;
235
278
  font: inherit;
@@ -244,89 +287,37 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
244
287
  width: 1.5em;
245
288
  }
246
289
 
247
- /* ----- horizontal ----- */
248
-
249
- .sterling-slider.horizontal {
250
- height: 2em;
251
- }
252
-
253
- .sterling-slider.horizontal .container {
254
- margin: 0 0.75em;
255
- }
256
-
257
- .sterling-slider.horizontal .track {
258
- left: 0;
259
- right: 0;
260
- top: 50%;
261
- height: 3px;
262
- transform: translate(0, -50%);
263
- }
264
-
265
- .sterling-slider.horizontal .fill {
266
- height: 3px;
267
- top: 50%;
268
- transform: translate(0, -50%);
269
- }
270
-
271
290
  .sterling-slider.horizontal .thumb {
272
291
  top: 50%;
273
292
  transform: translate(-50%, -50%);
274
293
  }
275
294
 
276
- /* ----- vertical ----- */
277
-
278
- .sterling-slider.vertical {
279
- width: 2em;
280
- }
281
- .sterling-slider.vertical .container {
282
- margin: 0.75em 0;
283
- }
284
-
285
- .sterling-slider.vertical .track {
286
- bottom: 0;
287
- left: 50%;
288
- top: 0;
289
- transform: translate(-50%, 0);
290
- width: 3px;
291
- }
292
-
293
- .sterling-slider.vertical .fill {
294
- bottom: 0;
295
- left: 50%;
296
- transform: translate(-50%, 0);
297
- width: 3px;
298
- }
299
-
300
295
  .sterling-slider.vertical .thumb {
301
296
  left: 50%;
302
297
  transform: translate(-50%, 50%);
303
298
  }
304
299
 
305
- /* ----- hover ----- */
306
-
307
300
  .thumb:hover {
308
- background-color: var(--stsv-Button__background-color--hover);
309
- border-color: var(--stsv-Button__border-color--hover);
310
- color: var(--stsv-Button__color--hover);
301
+ background-color: var(--stsv-button__background-color--hover);
302
+ border-color: var(--stsv-button__border-color--hover);
303
+ color: var(--stsv-button__color--hover);
311
304
  }
312
305
 
313
- /* ----- active ----- */
314
-
315
306
  .thumb:active {
316
- background-color: var(--stsv-Button__background-color--active);
317
- border-color: var(--stsv-Button__border-color--active);
318
- color: var(--stsv-Button__color--active);
307
+ background-color: var(--stsv-button__background-color--active);
308
+ border-color: var(--stsv-button__border-color--active);
309
+ color: var(--stsv-button__color--active);
319
310
  }
320
311
 
321
- /* ----- focus ----- */
322
- .sterling-slider:focus-visible {
323
- outline-color: var(--stsv-Common__outline-color);
324
- outline-offset: var(--stsv-Common__outline-offset);
325
- outline-style: var(--stsv-Common__outline-style);
326
- outline-width: var(--stsv-Common__outline-width);
312
+ /* ----- thumb colorful ----- */
313
+
314
+ .sterling-slider.colorful .thumb {
315
+ background-color: var(--stsv-button--colorful__background-color);
316
+ border-color: var(--stsv-button--colorful__border-color);
317
+ color: var(--stsv-button--colorful__color);
327
318
  }
328
319
 
329
- /* ----- disabled ----- */
320
+ /* ----- thumb disabled ----- */
330
321
 
331
322
  .sterling-slider.disabled .thumb {
332
323
  cursor: not-allowed;
@@ -334,7 +325,13 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
334
325
  }
335
326
 
336
327
  .sterling-slider .thumb::after {
337
- background: var(--stsv-Disabled__background);
328
+ background: repeating-linear-gradient(
329
+ 45deg,
330
+ var(--stsv-common__background-color1--disabled),
331
+ var(--stsv-common__background-color1--disabled) 3px,
332
+ var(--stsv-common__background-color2_disabled) 3px,
333
+ var(--stsv-common__background-color2_disabled) 6px
334
+ );
338
335
  bottom: 0;
339
336
  content: '';
340
337
  left: 0;
@@ -350,14 +347,7 @@ Slider lets the user chose a value within a min/max range by dragging a thumb bu
350
347
  opacity: 1;
351
348
  }
352
349
 
353
- .sterling-slider.composed,
354
- .sterling-slider.composed:hover,
355
- .sterling-slider.composed.focus,
356
- .sterling-slider.composed.disabled {
357
- background: none;
358
- border: none;
359
- outline: none;
360
- }
350
+ /* ----- reduced motion ----- */
361
351
 
362
352
  @media (prefers-reduced-motion) {
363
353
  .sterling-slider,
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
+ colorful?: boolean | undefined;
5
6
  composed?: boolean | undefined;
6
7
  disabled?: boolean | undefined;
7
8
  min?: number | undefined;
package/Switch.svelte CHANGED
@@ -1,6 +1,7 @@
1
1
  <script>import Label from "./Label.svelte";
2
2
  import { idGenerator } from "./idGenerator";
3
3
  export let checked = false;
4
+ export let colorful = false;
4
5
  export let disabled = false;
5
6
  export let vertical = false;
6
7
  export let onText = void 0;
@@ -38,7 +39,7 @@ export const focus = (options) => {
38
39
  @component
39
40
  A styled HTML input type=checkbox element.
40
41
  -->
41
- <div class="sterling-switch" class:vertical class:disabled>
42
+ <div class="sterling-switch" class:colorful class:disabled class:vertical>
42
43
  <input
43
44
  bind:this={inputRef}
44
45
  bind:checked
@@ -69,7 +70,7 @@ export const focus = (options) => {
69
70
  on:mouseover
70
71
  on:mouseout
71
72
  on:mouseup
72
- on:wheel
73
+ on:wheel|passive
73
74
  {...$$restProps}
74
75
  />
75
76
  {#if hasOffLabel}
@@ -144,6 +145,8 @@ export const focus = (options) => {
144
145
  grid-row: 1 / span 1;
145
146
  }
146
147
 
148
+ /* ----- input hidden ----- */
149
+
147
150
  input {
148
151
  font: inherit;
149
152
  margin: 0;
@@ -156,14 +159,16 @@ export const focus = (options) => {
156
159
  opacity: 0;
157
160
  }
158
161
 
162
+ /* ----- switch ----- */
163
+
159
164
  .switch {
160
- background-color: var(--stsv-Input__background-color);
161
- border-color: var(--stsv-Input__border-color);
165
+ background-color: var(--stsv-input__background-color);
166
+ border-color: var(--stsv-input__border-color);
162
167
  border-radius: 10000px;
163
- border-style: var(--stsv-Input__border-style);
164
- border-width: var(--stsv-Input__border-width);
168
+ border-style: var(--stsv-input__border-style);
169
+ border-width: var(--stsv-input__border-width);
165
170
  box-sizing: border-box;
166
- color: var(--stsv-Input__color);
171
+ color: var(--stsv-input__color);
167
172
  font: inherit;
168
173
  pointer-events: none;
169
174
  position: relative;
@@ -172,21 +177,23 @@ export const focus = (options) => {
172
177
  }
173
178
 
174
179
  .sterling-switch:hover .switch {
175
- background-color: var(--stsv-Input__background-color--hover);
176
- border-color: var(--stsv-Input__border-color--hover);
177
- color: var(--stsv-Input__color--hover);
180
+ background-color: var(--stsv-input__background-color--hover);
181
+ border-color: var(--stsv-input__border-color--hover);
182
+ color: var(--stsv-input__color--hover);
178
183
  }
179
184
 
180
185
  input:focus-visible ~ .switch {
181
- background-color: var(--stsv-Input__background-color--focus);
182
- border-color: var(--stsv-Input__border-color--focus);
183
- color: var(--stsv-Common__color--focux);
184
- outline-color: var(--stsv-Common__outline-color);
185
- outline-offset: var(--stsv-Common__outline-offset);
186
- outline-style: var(--stsv-Common__outline-style);
187
- outline-width: var(--stsv-Common__outline-width);
186
+ background-color: var(--stsv-input__background-color--focus);
187
+ border-color: var(--stsv-input__border-color--focus);
188
+ color: var(--stsv-common__color--focux);
189
+ outline-color: var(--stsv-common__outline-color);
190
+ outline-offset: var(--stsv-common__outline-offset);
191
+ outline-style: var(--stsv-common__outline-style);
192
+ outline-width: var(--stsv-common__outline-width);
188
193
  }
189
194
 
195
+ /* ----- switch vertical ----- */
196
+
190
197
  .sterling-switch:not(.vertical) .switch {
191
198
  width: 2em;
192
199
  height: 1.25em;
@@ -197,19 +204,43 @@ export const focus = (options) => {
197
204
  height: 2em;
198
205
  }
199
206
 
207
+ /* ----- labels ----- */
208
+
200
209
  .off-label,
201
210
  .on-label {
202
- padding-top: var(--stsv-Button__border-width);
211
+ padding-top: var(--stsv-button__border-width);
212
+ }
213
+
214
+ /* ----- switch colorful ----- */
215
+
216
+ .sterling-switch.colorful .switch {
217
+ background-color: var(--stsv-input--colorful__background-color);
218
+ border-color: var(--stsv-input--colorful__border-color);
219
+ color: var(--stsv-input--colorful__color);
220
+ }
221
+
222
+ .sterling-switch.colorful:hover .switch {
223
+ background-color: var(--stsv-input--colorful__background-color--hover);
224
+ border-color: var(--stsv-input--colorful__border-color--hover);
225
+ color: var(--stsv-input_--colorful_color--hover);
226
+ }
227
+
228
+ .sterling-switch.colorful input:focus-visible ~ .switch {
229
+ background-color: var(--stsv-input--colorful__background-color--focus);
230
+ border-color: var(--stsv-input--colorful__border-color--focus);
231
+ color: var(--stsv-input--colorful__color--focus);
203
232
  }
204
233
 
234
+ /* ----- thumb ----- */
235
+
205
236
  .thumb {
206
- background-color: var(--stsv-Button__background-color);
207
- border-color: var(--stsv-Button__border-color);
237
+ background-color: var(--stsv-button__background-color);
238
+ border-color: var(--stsv-button__border-color);
208
239
  border-radius: 10000px;
209
- border-style: var(--stsv-Button__border-style);
210
- border-width: var(--stsv-Button__border-width);
240
+ border-style: var(--stsv-button__border-style);
241
+ border-width: var(--stsv-button__border-width);
211
242
  box-sizing: border-box;
212
- color: var(--stsv-Button__color);
243
+ color: var(--stsv-button__color);
213
244
  display: block;
214
245
  font: inherit;
215
246
  height: 1.25em;
@@ -219,19 +250,47 @@ export const focus = (options) => {
219
250
  }
220
251
 
221
252
  .sterling-switch:hover .thumb {
222
- background-color: var(--stsv-Button__background-color--hover);
223
- border-color: var(--stsv-Button__border-color--hover);
224
- color: var(--stsv-Button__color--hover);
253
+ background-color: var(--stsv-button__background-color--hover);
254
+ border-color: var(--stsv-button__border-color--hover);
255
+ color: var(--stsv-button__color--hover);
225
256
  }
226
257
 
227
258
  .sterling-switch:active .thumb {
228
- background-color: var(--stsv-Button__background-color--active);
229
- border-color: var(--stsv-Button__border-color--active);
230
- color: var(--stsv-Button__color--hover);
259
+ background-color: var(--stsv-button__background-color--active);
260
+ border-color: var(--stsv-button__border-color--active);
261
+ color: var(--stsv-button__color--hover);
262
+ }
263
+
264
+ /* ----- thumb colorful ----- */
265
+
266
+ .sterling-switch.colorful .thumb {
267
+ background-color: var(--stsv-button--colorful__background-color);
268
+ border-color: var(--stsv-button--colorful__border-color);
269
+ color: var(--stsv-button--colorful__color);
270
+ }
271
+
272
+ .sterling-switch.colorful:hover .thumb {
273
+ background-color: var(--stsv-button--colorful__background-color--hover);
274
+ border-color: var(--stsv-button--colorful__border-color--hover);
275
+ color: var(--stsv-button--colorful__color--hover);
231
276
  }
232
277
 
278
+ .sterling-switch.colorful:active .thumb {
279
+ background-color: var(--stsv-button--colorful__background-color--active);
280
+ border-color: var(--stsv-button--colorful__border-color--active);
281
+ color: var(--stsv-button--colorful__color--hover);
282
+ }
283
+
284
+ /* ----- thumb disabled ----- */
285
+
233
286
  .sterling-switch .thumb::after {
234
- background: var(--stsv-Disabled__background);
287
+ background: repeating-linear-gradient(
288
+ 45deg,
289
+ var(--stsv-common__background-color1--disabled),
290
+ var(--stsv-common__background-color1--disabled) 3px,
291
+ var(--stsv-common__background-color2--disabled) 3px,
292
+ var(--stsv-common__background-color2--disabled) 6px
293
+ );
235
294
  bottom: 0;
236
295
  content: '';
237
296
  left: 0;
@@ -247,16 +306,20 @@ export const focus = (options) => {
247
306
  opacity: 1;
248
307
  }
249
308
 
309
+ /* ----- thumb vertical ----- */
310
+
250
311
  .sterling-switch:not(.vertical) .thumb {
251
- top: calc(-1 * var(--stsv-Button__border-width));
252
- transform: translateX(calc(var(--thumb-offset) - var(--stsv-Button__border-width)));
312
+ top: calc(-1 * var(--stsv-button__border-width));
313
+ transform: translateX(calc(var(--thumb-offset) - var(--stsv-button__border-width)));
253
314
  }
254
315
 
255
316
  .sterling-switch.vertical .thumb {
256
- left: calc(-1 * var(--stsv-Button__border-width));
257
- transform: translateY(calc(var(--thumb-offset) - var(--stsv-Button__border-width)));
317
+ left: calc(-1 * var(--stsv-button__border-width));
318
+ transform: translateY(calc(var(--thumb-offset) - var(--stsv-button__border-width)));
258
319
  }
259
320
 
321
+ /* ----- reduced motion ----- */
322
+
260
323
  @media (prefers-reduced-motion) {
261
324
  .switch,
262
325
  .thumb,
@@ -3,6 +3,7 @@ declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
5
  checked?: boolean | undefined;
6
+ colorful?: boolean | undefined;
6
7
  disabled?: boolean | undefined;
7
8
  vertical?: boolean | undefined;
8
9
  onText?: string | undefined;