@geoffcox/sterling-svelte 1.0.4 → 1.0.5
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/Checkbox.svelte +7 -1
- package/Input.svelte +1 -1
- package/Radio.svelte +7 -1
- package/Switch.svelte +8 -1
- package/css/Radio.button.css +113 -0
- package/css/Radio.css +1 -0
- package/css/Tab.base.css +1 -4
- package/package.json +3 -1
package/Checkbox.svelte
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>import { idGenerator } from './idGenerator';
|
|
2
|
+
import { usingKeyboard } from './mediaQueries/usingKeyboard';
|
|
2
3
|
// ----- Props ----- //
|
|
3
4
|
export let checked = false;
|
|
4
5
|
export let disabled = false;
|
|
@@ -28,7 +29,12 @@ export const focus = (options) => {
|
|
|
28
29
|
@component
|
|
29
30
|
A styled HTML input type=checkbox element.
|
|
30
31
|
-->
|
|
31
|
-
<div
|
|
32
|
+
<div
|
|
33
|
+
class={`sterling-checkbox ${variant}`}
|
|
34
|
+
class:checked
|
|
35
|
+
class:disabled
|
|
36
|
+
class:using-keyboard={$usingKeyboard}
|
|
37
|
+
>
|
|
32
38
|
<div class="container">
|
|
33
39
|
<input
|
|
34
40
|
bind:this={inputRef}
|
package/Input.svelte
CHANGED
|
@@ -44,7 +44,7 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
|
|
|
44
44
|
<slot {disabled} {value} {variant} />
|
|
45
45
|
</label>
|
|
46
46
|
{/if}
|
|
47
|
-
<div class={`sterling-input ${variant}`} class:disabled>
|
|
47
|
+
<div class={`sterling-input ${variant}`} class:disabled class:using-keyboard={$usingKeyboard}>
|
|
48
48
|
<input
|
|
49
49
|
bind:this={inputRef}
|
|
50
50
|
class:using-keyboard={$usingKeyboard}
|
package/Radio.svelte
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>import { idGenerator } from './idGenerator';
|
|
2
|
+
import { usingKeyboard } from './mediaQueries/usingKeyboard';
|
|
2
3
|
// ----- Props ----- //
|
|
3
4
|
export let checked = false;
|
|
4
5
|
export let disabled = false;
|
|
@@ -73,7 +74,12 @@ const onChange = (e) => {
|
|
|
73
74
|
@component
|
|
74
75
|
A styled HTML input type=radio element with optional label.
|
|
75
76
|
-->
|
|
76
|
-
<div
|
|
77
|
+
<div
|
|
78
|
+
class={`sterling-radio ${variant}`}
|
|
79
|
+
class:checked
|
|
80
|
+
class:disabled
|
|
81
|
+
class:using-keyboard={$usingKeyboard}
|
|
82
|
+
>
|
|
77
83
|
<div class="container">
|
|
78
84
|
<input
|
|
79
85
|
bind:this={inputRef}
|
package/Switch.svelte
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script>import { idGenerator } from './idGenerator';
|
|
2
|
+
import { usingKeyboard } from './mediaQueries/usingKeyboard';
|
|
2
3
|
// ----- Props ----- //
|
|
3
4
|
export let checked = false;
|
|
4
5
|
export let disabled = false;
|
|
@@ -39,7 +40,13 @@ export const focus = (options) => {
|
|
|
39
40
|
@component
|
|
40
41
|
A styled HTML input type=checkbox element.
|
|
41
42
|
-->
|
|
42
|
-
<div
|
|
43
|
+
<div
|
|
44
|
+
class={`sterling-switch ${variant}`}
|
|
45
|
+
class:checked
|
|
46
|
+
class:disabled
|
|
47
|
+
class:vertical
|
|
48
|
+
class:using-keyboard={$usingKeyboard}
|
|
49
|
+
>
|
|
43
50
|
<input
|
|
44
51
|
bind:this={inputRef}
|
|
45
52
|
bind:checked
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
.sterling-radio.button {
|
|
2
|
+
align-content: center;
|
|
3
|
+
align-items: center;
|
|
4
|
+
background-color: var(--stsv-button__background-color);
|
|
5
|
+
border-color: var(--stsv-button__border-color);
|
|
6
|
+
border-radius: 0;
|
|
7
|
+
border-style: solid;
|
|
8
|
+
border-width: 2px;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
color: var(--stsv-button__color);
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
font: inherit;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
justify-items: center;
|
|
17
|
+
margin-left: -2px;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
padding: 0.5em 1em;
|
|
20
|
+
position: relative;
|
|
21
|
+
text-decoration: none;
|
|
22
|
+
text-overflow: ellipsis;
|
|
23
|
+
transition: background-color 250ms, color 250ms, border-color 250ms;
|
|
24
|
+
white-space: nowrap;
|
|
25
|
+
user-select: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* .sterling-radio.button:first-child {
|
|
29
|
+
border-top-left-radius: 8px;
|
|
30
|
+
border-bottom-left-radius: 8px;
|
|
31
|
+
border-left-width: 2px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.sterling-radio.button:last-child {
|
|
35
|
+
border-top-right-radius: 8px;
|
|
36
|
+
border-bottom-right-radius: 8px;
|
|
37
|
+
} */
|
|
38
|
+
|
|
39
|
+
.sterling-radio.button:not(.checked):not(.disabled):hover {
|
|
40
|
+
background-color: var(--stsv-button__background-color--hover);
|
|
41
|
+
border-color: var(--stsv-button__border-color--hover);
|
|
42
|
+
color: var(--stsv-button__color--hover);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.sterling-radio.button.checked {
|
|
46
|
+
background-color: var(--stsv-button__background-color--active);
|
|
47
|
+
border-color: var(--stsv-button__border-color--active);
|
|
48
|
+
color: var(--stsv-button__color--active);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.sterling-radio.button.using-keyboard:focus-within {
|
|
52
|
+
border-color: var(--stsv-button__border-color--focus);
|
|
53
|
+
outline-color: var(--stsv-common__outline-color);
|
|
54
|
+
outline-offset: 0;
|
|
55
|
+
outline-style: solid;
|
|
56
|
+
outline-width: 2px;
|
|
57
|
+
z-index: 1;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.sterling-radio.button .container {
|
|
61
|
+
margin-right: 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.sterling-radio.button input {
|
|
65
|
+
height: 0;
|
|
66
|
+
width: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.sterling-radio.button.disabled * {
|
|
70
|
+
cursor: not-allowed;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.sterling-radio.button.disabled::after {
|
|
74
|
+
content: '';
|
|
75
|
+
position: absolute;
|
|
76
|
+
left: 0;
|
|
77
|
+
right: 0;
|
|
78
|
+
top: 0;
|
|
79
|
+
bottom: 0;
|
|
80
|
+
background: repeating-linear-gradient(
|
|
81
|
+
var(--stsv-common--disabled__stripe-angle),
|
|
82
|
+
var(--stsv-common--disabled__stripe-color),
|
|
83
|
+
var(--stsv-common--disabled__stripe-color) var(--stsv-common--disabled__stripe-width),
|
|
84
|
+
var(--stsv-common--disabled__stripe-color--alt) var(--stsv-common--disabled__stripe-width),
|
|
85
|
+
var(--stsv-common--disabled__stripe-color--alt)
|
|
86
|
+
calc(2 * var(--stsv-common--disabled__stripe-width))
|
|
87
|
+
);
|
|
88
|
+
pointer-events: none;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.sterling-radio.button .indicator,
|
|
92
|
+
.sterling-radio.button input:checked + .indicator,
|
|
93
|
+
.sterling-radio.button:not(.disabled):hover .indicator,
|
|
94
|
+
.sterling-radio.button input:focus-visible + .indicator {
|
|
95
|
+
display: none;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.sterling-radio.button .indicator::after,
|
|
99
|
+
.sterling-radio.button input:checked + .indicator::after {
|
|
100
|
+
display: none;
|
|
101
|
+
}
|
|
102
|
+
.sterling-radio.button .container::after,
|
|
103
|
+
.sterling-radio.button.disabled .container::after {
|
|
104
|
+
display: none;
|
|
105
|
+
opacity: 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@media (prefers-reduced-motion) {
|
|
109
|
+
.sterling-radio.button,
|
|
110
|
+
.sterling-radio.button::after {
|
|
111
|
+
transition: none;
|
|
112
|
+
}
|
|
113
|
+
}
|
package/css/Radio.css
CHANGED
package/css/Tab.base.css
CHANGED
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
justify-content: flex-end;
|
|
37
37
|
justify-items: flex-end;
|
|
38
38
|
column-gap: 0.15em;
|
|
39
|
+
padding: 0.25em 1em;
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
.sterling-tab.using-keyboard:focus-visible {
|
|
@@ -82,10 +83,6 @@
|
|
|
82
83
|
padding: 0 0.2em;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
.sterling-tab.vertical .content .text {
|
|
86
|
-
padding-top: 0.25em;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
86
|
/* ----- indicator -----*/
|
|
90
87
|
|
|
91
88
|
.sterling-tab .indicator {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geoffcox/sterling-svelte",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"author": "Geoff Cox",
|
|
5
5
|
"description": "A modern, accessible, and lightweight component library for Svelte.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
"exports": {
|
|
80
80
|
"./package.json": "./package.json",
|
|
81
|
+
"./.DS_Store": "./.DS_Store",
|
|
81
82
|
"./Button.constants": "./Button.constants.js",
|
|
82
83
|
"./Button.svelte": "./Button.svelte",
|
|
83
84
|
"./Button.types": "./Button.types.js",
|
|
@@ -204,6 +205,7 @@
|
|
|
204
205
|
"./css/Progress.base.css": "./css/Progress.base.css",
|
|
205
206
|
"./css/Progress.css": "./css/Progress.css",
|
|
206
207
|
"./css/Radio.base.css": "./css/Radio.base.css",
|
|
208
|
+
"./css/Radio.button.css": "./css/Radio.button.css",
|
|
207
209
|
"./css/Radio.colorful.css": "./css/Radio.colorful.css",
|
|
208
210
|
"./css/Radio.css": "./css/Radio.css",
|
|
209
211
|
"./css/RgbColorSliders.base.css": "./css/RgbColorSliders.base.css",
|