@geoffcox/sterling-svelte 0.0.30 → 1.0.0

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 (223) hide show
  1. package/@types/clickOutside.d.ts +11 -7
  2. package/Button.svelte +11 -183
  3. package/Button.svelte.d.ts +2 -6
  4. package/Callout.svelte +188 -0
  5. package/Callout.svelte.d.ts +54 -0
  6. package/Checkbox.svelte +15 -177
  7. package/Checkbox.svelte.d.ts +2 -2
  8. package/ColorPicker.svelte +204 -223
  9. package/ColorPicker.svelte.d.ts +1 -2
  10. package/Dialog.svelte +91 -187
  11. package/Dialog.svelte.d.ts +3 -1
  12. package/Dropdown.svelte +52 -219
  13. package/Dropdown.svelte.d.ts +4 -8
  14. package/HexColorSliders.svelte +77 -145
  15. package/HexColorSliders.svelte.d.ts +28 -1
  16. package/HslColorSliders.svelte +99 -179
  17. package/HslColorSliders.svelte.d.ts +28 -1
  18. package/Input.svelte +27 -136
  19. package/Input.svelte.d.ts +2 -3
  20. package/Label.constants.d.ts +1 -0
  21. package/Label.constants.js +1 -0
  22. package/Label.svelte +96 -169
  23. package/Label.svelte.d.ts +6 -1
  24. package/Label.types.d.ts +3 -1
  25. package/Link.svelte +9 -106
  26. package/Link.svelte.d.ts +0 -1
  27. package/List.svelte +142 -230
  28. package/List.svelte.d.ts +2 -3
  29. package/List.types.d.ts +6 -1
  30. package/ListItem.svelte +25 -94
  31. package/ListItem.svelte.d.ts +2 -0
  32. package/Menu.svelte +48 -64
  33. package/Menu.svelte.d.ts +4 -1
  34. package/MenuBar.svelte +84 -86
  35. package/MenuBar.svelte.d.ts +4 -1
  36. package/MenuButton.svelte +67 -74
  37. package/MenuButton.svelte.d.ts +7 -3
  38. package/MenuItem.svelte +256 -288
  39. package/MenuItem.svelte.d.ts +2 -2
  40. package/MenuItemDisplay.svelte +12 -116
  41. package/MenuItemDisplay.svelte.d.ts +21 -7
  42. package/MenuSeparator.svelte +6 -45
  43. package/MenuSeparator.svelte.d.ts +8 -78
  44. package/Popover.constants.d.ts +2 -0
  45. package/{floating-ui.constants.js → Popover.constants.js} +10 -9
  46. package/Popover.svelte +72 -82
  47. package/Popover.svelte.d.ts +10 -5
  48. package/Popover.types.d.ts +4 -0
  49. package/Progress.svelte +28 -126
  50. package/Progress.svelte.d.ts +4 -3
  51. package/Radio.svelte +49 -192
  52. package/Radio.svelte.d.ts +2 -2
  53. package/RgbColorSliders.svelte +48 -137
  54. package/RgbColorSliders.svelte.d.ts +5 -5
  55. package/Select.svelte +124 -251
  56. package/Select.svelte.d.ts +6 -2
  57. package/Slider.svelte +90 -259
  58. package/Slider.svelte.d.ts +1 -2
  59. package/Switch.svelte +24 -259
  60. package/Switch.svelte.d.ts +3 -1
  61. package/Tab.svelte +27 -175
  62. package/Tab.svelte.d.ts +6 -4
  63. package/TabList.svelte +146 -171
  64. package/TabList.svelte.d.ts +3 -2
  65. package/TabList.types.d.ts +6 -1
  66. package/TextArea.svelte +32 -129
  67. package/TextArea.svelte.d.ts +1 -1
  68. package/Tooltip.svelte +88 -222
  69. package/Tooltip.svelte.d.ts +21 -13
  70. package/Tree.constants.d.ts +0 -1
  71. package/Tree.constants.js +0 -1
  72. package/Tree.svelte +35 -119
  73. package/Tree.svelte.d.ts +4 -4
  74. package/Tree.types.d.ts +1 -3
  75. package/TreeChevron.svelte +18 -98
  76. package/TreeChevron.svelte.d.ts +1 -0
  77. package/TreeItem.constants.d.ts +1 -0
  78. package/TreeItem.constants.js +1 -0
  79. package/TreeItem.svelte +251 -211
  80. package/TreeItem.svelte.d.ts +7 -3
  81. package/TreeItem.types.d.ts +1 -1
  82. package/TreeItemDisplay.svelte +20 -104
  83. package/TreeItemDisplay.svelte.d.ts +2 -2
  84. package/actions/applyLightDarkMode.d.ts +10 -0
  85. package/actions/applyLightDarkMode.js +36 -0
  86. package/actions/forwardEvents.js +3 -3
  87. package/css/Button.base.css +74 -0
  88. package/css/Button.colorful.css +17 -0
  89. package/css/Button.css +7 -0
  90. package/css/Button.secondary.colorful.css +15 -0
  91. package/css/Button.secondary.css +11 -0
  92. package/css/Button.shapes.css +14 -0
  93. package/css/Button.tool.colorful.css +13 -0
  94. package/css/Button.tool.css +18 -0
  95. package/css/Callout.base.css +43 -0
  96. package/css/Callout.colorful.css +5 -0
  97. package/css/Callout.css +2 -0
  98. package/css/Checkbox.base.css +145 -0
  99. package/css/Checkbox.colorful.css +17 -0
  100. package/css/Checkbox.css +2 -0
  101. package/css/ColorPicker.base.css +23 -0
  102. package/css/ColorPicker.css +1 -0
  103. package/css/Dialog.base.css +116 -0
  104. package/css/Dialog.css +1 -0
  105. package/css/Dropdown.base.css +147 -0
  106. package/css/Dropdown.colorful.css +23 -0
  107. package/css/Dropdown.css +2 -0
  108. package/css/HexColorSliders.base.css +106 -0
  109. package/css/HexColorSliders.css +1 -0
  110. package/css/HslColorSliders.base.css +124 -0
  111. package/css/HslColorSliders.css +1 -0
  112. package/css/Input.base.css +100 -0
  113. package/css/Input.colorful.css +22 -0
  114. package/css/Input.composed.css +8 -0
  115. package/css/Input.css +3 -0
  116. package/css/Label.base.css +119 -0
  117. package/css/Label.boxed.colorful.css +21 -0
  118. package/css/Label.boxed.css +31 -0
  119. package/css/Label.colorful.css +3 -0
  120. package/css/Label.css +4 -0
  121. package/css/Link.base.css +52 -0
  122. package/css/Link.colorful.css +15 -0
  123. package/css/Link.css +6 -0
  124. package/css/Link.ghost.colorful.css +7 -0
  125. package/css/Link.ghost.css +11 -0
  126. package/css/Link.undecorated.colorful.css +6 -0
  127. package/css/Link.undecorated.css +6 -0
  128. package/css/List.base.css +98 -0
  129. package/css/List.css +1 -0
  130. package/css/ListItem.base.css +59 -0
  131. package/css/ListItem.css +1 -0
  132. package/css/Menu.base.css +21 -0
  133. package/css/Menu.css +1 -0
  134. package/css/MenuBar.base.css +9 -0
  135. package/css/MenuBar.css +1 -0
  136. package/css/MenuButton.base.css +13 -0
  137. package/css/MenuButton.css +1 -0
  138. package/css/MenuItem.base.css +48 -0
  139. package/css/MenuItem.css +1 -0
  140. package/css/MenuItemDisplay.base.css +104 -0
  141. package/css/MenuItemDisplay.css +1 -0
  142. package/css/MenuSeparator.base.css +5 -0
  143. package/css/MenuSeparator.css +1 -0
  144. package/css/Popover copy.css +21 -0
  145. package/css/Popover.css +21 -0
  146. package/css/Progress.base.css +99 -0
  147. package/css/Progress.css +1 -0
  148. package/css/Radio.base.css +135 -0
  149. package/css/Radio.colorful.css +18 -0
  150. package/css/Radio.css +2 -0
  151. package/css/RgbColorSliders.base.css +94 -0
  152. package/css/RgbColorSliders.css +1 -0
  153. package/css/Select.base.css +127 -0
  154. package/css/Select.colorful.css +24 -0
  155. package/css/Select.composed.css +12 -0
  156. package/css/Select.css +3 -0
  157. package/css/Slider.base.css +182 -0
  158. package/css/Slider.colorful.css +11 -0
  159. package/css/Slider.composed.css +8 -0
  160. package/css/Slider.css +3 -0
  161. package/css/Switch.base.css +193 -0
  162. package/css/Switch.colorful.css +39 -0
  163. package/css/Switch.css +2 -0
  164. package/css/Tab.base.css +135 -0
  165. package/css/Tab.colorful.css +13 -0
  166. package/css/Tab.css +2 -0
  167. package/css/TabList.base.css +34 -0
  168. package/css/TabList.css +1 -0
  169. package/css/TextArea.base.css +85 -0
  170. package/css/TextArea.colorful.css +17 -0
  171. package/css/TextArea.composed.css +8 -0
  172. package/css/TextArea.css +3 -0
  173. package/css/Tooltip.base.css +6 -0
  174. package/css/Tooltip.css +1 -0
  175. package/css/Tree.base.css +74 -0
  176. package/css/Tree.composed.css +8 -0
  177. package/css/Tree.css +2 -0
  178. package/css/TreeChevron.base.css +86 -0
  179. package/css/TreeChevron.css +1 -0
  180. package/css/TreeItem.base.css +3 -0
  181. package/css/TreeItem.css +1 -0
  182. package/css/TreeItemDisplay.base.css +74 -0
  183. package/css/TreeItemDisplay.colorful.css +9 -0
  184. package/css/TreeItemDisplay.css +1 -0
  185. package/css/dark-mode.css +134 -0
  186. package/css/light-mode.css +134 -0
  187. package/css/sterling.css +37 -0
  188. package/index.d.ts +13 -18
  189. package/index.js +11 -15
  190. package/mediaQueries/prefersColorSchemeDark.d.ts +2 -0
  191. package/mediaQueries/prefersColorSchemeDark.js +10 -0
  192. package/{stores → mediaQueries}/prefersReducedMotion.d.ts +1 -0
  193. package/{stores → mediaQueries}/usingKeyboard.d.ts +1 -0
  194. package/package.json +136 -19
  195. package/Link.constants.d.ts +0 -1
  196. package/Link.constants.js +0 -1
  197. package/Link.types.d.ts +0 -4
  198. package/Tooltip.constants.d.ts +0 -1
  199. package/Tooltip.constants.js +0 -1
  200. package/Tooltip.types.d.ts +0 -4
  201. package/Tooltip.types.js +0 -1
  202. package/floating-ui.constants.d.ts +0 -1
  203. package/floating-ui.types.d.ts +0 -4
  204. package/floating-ui.types.js +0 -1
  205. package/theme/applyDarkTheme.d.ts +0 -7
  206. package/theme/applyDarkTheme.js +0 -11
  207. package/theme/applyLightTheme.d.ts +0 -7
  208. package/theme/applyLightTheme.js +0 -11
  209. package/theme/applyTheme.d.ts +0 -7
  210. package/theme/applyTheme.js +0 -20
  211. package/theme/colors.d.ts +0 -54
  212. package/theme/colors.js +0 -82
  213. package/theme/darkTheme.d.ts +0 -2
  214. package/theme/darkTheme.js +0 -142
  215. package/theme/lightTheme.d.ts +0 -2
  216. package/theme/lightTheme.js +0 -119
  217. package/theme/toggleDarkTheme.d.ts +0 -18
  218. package/theme/toggleDarkTheme.js +0 -53
  219. package/theme/types.d.ts +0 -21
  220. package/theme/types.js +0 -1
  221. /package/{Link.types.js → Popover.types.js} +0 -0
  222. /package/{stores → mediaQueries}/prefersReducedMotion.js +0 -0
  223. /package/{stores → mediaQueries}/usingKeyboard.js +0 -0
package/Progress.svelte CHANGED
@@ -1,28 +1,31 @@
1
- <script>export let value = 0;
1
+ <script>//----- Props ----- //
2
+ /** When true, the progress bar is disabled. */
3
+ export let disabled = false;
4
+ /** The maximum value. */
2
5
  export let max = 100;
6
+ /** A read-only percentage between 0 and 100 calculated from value and max. */
3
7
  export let percent = 0;
8
+ /** The current status of the progress. */
9
+ export let status = 'none';
10
+ /** The current value. */
11
+ export let value = 0;
12
+ /** Additional class names to apply. */
13
+ export let variant = '';
14
+ /** When true, the progress bar is displayed vertically. */
4
15
  export let vertical = false;
5
- export let status = "none";
6
- export let disabled = false;
16
+ //----- State ----- //
7
17
  let clientHeight;
8
18
  let clientWidth;
9
- $:
10
- clampMax = Math.max(1, max);
11
- $:
12
- clampValue = Math.max(0, Math.min(value, clampMax));
13
- $:
14
- ratio = clampValue / clampMax;
19
+ $: clampMax = Math.max(1, max);
20
+ $: clampValue = Math.max(0, Math.min(value, clampMax));
21
+ $: ratio = clampValue / clampMax;
15
22
  $: {
16
- percent = Math.round(ratio * 100);
23
+ percent = Math.round(ratio * 100);
17
24
  }
18
- $:
19
- percentHeight = clientHeight * ratio;
20
- $:
21
- percentWidth = clientWidth * ratio;
22
- $:
23
- indicatorStyle = vertical ? `height: ${percentHeight}px` : `width: ${percentWidth}px`;
24
- $:
25
- indicatorColor = status === "auto" ? percent === 100 ? "success" : "info" : status;
25
+ $: percentHeight = clientHeight * ratio;
26
+ $: percentWidth = clientWidth * ratio;
27
+ $: indicatorStyle = vertical ? `height: ${percentHeight}px` : `width: ${percentWidth}px`;
28
+ $: indicatorColor = status === 'auto' ? (percent === 100 ? 'success' : 'info') : status;
26
29
  </script>
27
30
 
28
31
  <!--
@@ -31,11 +34,15 @@ $:
31
34
  Does not use the HTML progress element.
32
35
  -->
33
36
  <!-- svelte-ignore a11y-label-has-associated-control -->
34
-
37
+ <!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
35
38
  <div
36
- class="sterling-progress"
39
+ class={`sterling-progress ${variant}`}
37
40
  class:disabled
38
41
  class:vertical
42
+ class:info={indicatorColor === 'info'}
43
+ class:success={indicatorColor === 'success'}
44
+ class:warning={indicatorColor === 'warning'}
45
+ class:error={indicatorColor === 'danger'}
39
46
  role="progressbar"
40
47
  on:blur
41
48
  on:click
@@ -71,111 +78,6 @@ $:
71
78
  {...$$restProps}
72
79
  >
73
80
  <div class="container" bind:clientWidth bind:clientHeight>
74
- <div
75
- class="indicator"
76
- class:info={indicatorColor === 'info'}
77
- class:success={indicatorColor === 'success'}
78
- class:warning={indicatorColor === 'warning'}
79
- class:error={indicatorColor === 'danger'}
80
- style={indicatorStyle}
81
- />
81
+ <div class="indicator" style={indicatorStyle} />
82
82
  </div>
83
83
  </div>
84
-
85
- <style>
86
- .sterling-progress {
87
- align-content: flex-start;
88
- align-items: flex-start;
89
- background: var(--stsv-common__background-color);
90
- border-width: var(--stsv-common__border-width);
91
- border-style: var(--stsv-common__border-style);
92
- border-color: var(--stsv-common__border-color);
93
- border-radius: var(--stsv-common__border-radius);
94
- box-sizing: border-box;
95
- display: block;
96
- height: 1em;
97
- padding: 0.25em;
98
- position: relative;
99
- transition: background-color 250ms, color 250ms, border-color 250ms;
100
- }
101
-
102
- .sterling-progress.disabled::after {
103
- content: '';
104
- position: absolute;
105
- left: 0;
106
- right: 0;
107
- top: 0;
108
- bottom: 0;
109
- background: repeating-linear-gradient(
110
- var(--stsv-common--disabled__stripe-angle),
111
- var(--stsv-common--disabled__stripe-color),
112
- var(--stsv-common--disabled__stripe-color) var(--stsv-common--disabled__stripe-width),
113
- var(--stsv-common--disabled__stripe-color--alt) var(--stsv-common--disabled__stripe-width),
114
- var(--stsv-common--disabled__stripe-color--alt)
115
- calc(2 * var(--stsv-common--disabled__stripe-width))
116
- );
117
- pointer-events: none;
118
- }
119
-
120
- .container {
121
- display: flex;
122
- justify-content: flex-start;
123
- width: 100%;
124
- height: 100%;
125
- }
126
-
127
- .indicator {
128
- background-color: var(--stsv-common__border-color);
129
- box-sizing: border-box;
130
- height: 100%;
131
- min-height: 1px;
132
- transition: background-color 250ms, color 250ms, border-color 250ms;
133
- }
134
-
135
- /* ----- Vertical ----- */
136
-
137
- .sterling-progress.vertical {
138
- align-items: center;
139
- align-content: center;
140
- height: unset;
141
- width: 1em;
142
- }
143
-
144
- .sterling-progress.vertical .container {
145
- flex-direction: column;
146
- justify-content: flex-end;
147
- min-width: unset;
148
- }
149
-
150
- .sterling-progress.vertical .indicator {
151
- height: unset;
152
- min-height: unset;
153
- min-width: 1px;
154
- width: 100%;
155
- }
156
-
157
- /* ----- Colorful ----- */
158
-
159
- .indicator.info {
160
- background-color: var(--stsv-status--info__border-color);
161
- }
162
-
163
- .indicator.success {
164
- background-color: var(--stsv-status--success__border-color);
165
- }
166
-
167
- .indicator.warning {
168
- background-color: var(--stsv-status--warning__border-color);
169
- }
170
-
171
- .indicator.error {
172
- background-color: var(--stsv-status--danger__border-color);
173
- }
174
-
175
- @media (prefers-reduced-motion) {
176
- .sterling-progress,
177
- .indicator {
178
- transition: none;
179
- }
180
- }
181
- </style>
@@ -2,12 +2,13 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
- value?: number | undefined;
5
+ disabled?: boolean | undefined;
6
6
  max?: number | undefined;
7
7
  percent?: number | undefined;
8
- vertical?: boolean | undefined;
9
8
  status?: string | undefined;
10
- disabled?: boolean | undefined;
9
+ value?: number | undefined;
10
+ variant?: string | undefined;
11
+ vertical?: boolean | undefined;
11
12
  };
12
13
  events: {
13
14
  blur: FocusEvent;
package/Radio.svelte CHANGED
@@ -1,57 +1,71 @@
1
- <script>import { idGenerator } from "./idGenerator";
1
+ <script>import { idGenerator } from './idGenerator';
2
+ // ----- Props ----- //
2
3
  export let checked = false;
3
4
  export let disabled = false;
4
- export let group = void 0;
5
- export let id = void 0;
6
- export let colorful = false;
5
+ // bind:group doesn't seem to work properly (yet) in a nested radio.
6
+ // The workaround is to export `checked` and `group` properties
7
+ // and implement the same behavior.
8
+ export let group = undefined;
9
+ export let id = undefined;
10
+ /** Additional class names to apply. */
11
+ export let variant = '';
12
+ // ensure initial state is consistent
7
13
  if (checked && $$restProps.value !== group) {
8
- group = $$restProps.value;
9
- } else if (!checked && $$restProps.value === group) {
10
- checked = true;
14
+ group = $$restProps.value;
15
+ }
16
+ else if (!checked && $$restProps.value === group) {
17
+ checked = true;
11
18
  }
19
+ // ----- State ----- //
12
20
  let inputRef;
13
21
  let previousChecked = checked;
14
22
  let previousGroup = group;
15
23
  const reconcile = () => {
16
- if (checked !== previousChecked) {
17
- if (checked && $$restProps.value) {
18
- group = $$restProps.value;
19
- previousGroup = $$restProps.value;
24
+ if (checked !== previousChecked) {
25
+ // when checked, set group to value
26
+ if (checked && $$restProps.value) {
27
+ group = $$restProps.value;
28
+ previousGroup = $$restProps.value;
29
+ }
30
+ previousChecked = checked;
20
31
  }
21
- previousChecked = checked;
22
- } else if (group !== previousGroup) {
23
- if ($$restProps.value) {
24
- checked = $$restProps.value === group;
25
- previousChecked = checked;
32
+ else if (group !== previousGroup) {
33
+ // when group changes, update checked
34
+ if ($$restProps.value) {
35
+ checked = $$restProps.value === group;
36
+ previousChecked = checked;
37
+ }
38
+ previousGroup = group;
26
39
  }
27
- previousGroup = group;
28
- }
29
40
  };
30
- $:
31
- checked, group, $$restProps.value, reconcile();
41
+ $: checked, group, $$restProps.value, reconcile();
32
42
  $: {
33
- if (inputRef && checked && !inputRef.checked) {
34
- inputRef.click();
35
- }
43
+ if (inputRef && checked && !inputRef.checked) {
44
+ // setting checked doesn't cause raise on:change,
45
+ // so we click the radio to cause it to be checked.
46
+ inputRef.click();
47
+ }
36
48
  }
37
49
  $: {
38
- if ($$slots.default && id === void 0) {
39
- id = idGenerator.nextId("Radio");
40
- }
50
+ if ($$slots.default && id === undefined) {
51
+ id = idGenerator.nextId('Radio');
52
+ }
41
53
  }
54
+ // ----- Methods ----- //
42
55
  export const blur = () => {
43
- inputRef?.blur();
56
+ inputRef?.blur();
44
57
  };
45
58
  export const click = () => {
46
- inputRef?.click();
59
+ inputRef?.click();
47
60
  };
48
61
  export const focus = (options) => {
49
- inputRef?.focus(options);
62
+ inputRef?.focus(options);
50
63
  };
64
+ // ----- Event Handlers ----- //
51
65
  const onChange = (e) => {
52
- if (e.currentTarget.checked) {
53
- group = $$restProps.value;
54
- }
66
+ if (e.currentTarget.checked) {
67
+ group = $$restProps.value;
68
+ }
55
69
  };
56
70
  </script>
57
71
 
@@ -59,13 +73,13 @@ const onChange = (e) => {
59
73
  @component
60
74
  A styled HTML input type=radio element with optional label.
61
75
  -->
62
- <div class="sterling-radio" class:colorful class:disabled>
76
+ <div class={`sterling-radio ${variant}`} class:disabled>
63
77
  <div class="container">
64
78
  <input
65
79
  bind:this={inputRef}
66
80
  {checked}
67
81
  {disabled}
68
- {group}
82
+ name={group}
69
83
  {id}
70
84
  type="radio"
71
85
  on:blur
@@ -100,164 +114,7 @@ const onChange = (e) => {
100
114
  </div>
101
115
  {#if $$slots.default}
102
116
  <label for={id}>
103
- <slot {colorful} {checked} {disabled} {group} inputId={id} value={$$restProps.value} />
117
+ <slot {checked} {disabled} {group} inputId={id} value={$$restProps.value} {variant} />
104
118
  </label>
105
119
  {/if}
106
120
  </div>
107
-
108
- <style>
109
- .sterling-radio {
110
- align-content: center;
111
- align-items: center;
112
- box-sizing: border-box;
113
- display: inline-flex;
114
- font: inherit;
115
- margin: 0;
116
- outline: none;
117
- padding: 0;
118
- }
119
- /*
120
- The container
121
- - allows the input to be hidden
122
- - avoids input participating in layout
123
- - prevents collisions with surrounding slots
124
- */
125
- .container {
126
- box-sizing: border-box;
127
- position: relative;
128
- font: inherit;
129
- display: flex;
130
- align-items: center;
131
- margin-right: 0.25em;
132
- }
133
-
134
- /*
135
- The input is hidden since the built-in browser radio cannot be customized
136
- */
137
- input {
138
- font: inherit;
139
- margin: 0;
140
- padding: 0;
141
- position: absolute;
142
- opacity: 0;
143
- height: 21px;
144
- width: 21px;
145
- }
146
-
147
- /*
148
- The indicator handles both the radio box and circle mark.
149
- The box cannot be on the container since the adjacent sibling selector is needed
150
- and there is not a parent CSS selector.
151
- */
152
- .indicator {
153
- background-color: var(--stsv-input__background-color);
154
- border-color: var(--stsv-input__border-color);
155
- border-style: var(--stsv-input__border-style);
156
- border-width: var(--stsv-input__border-width);
157
- border-radius: 10000px;
158
- box-sizing: border-box;
159
- display: inline-block;
160
- height: 21px;
161
- position: relative;
162
- pointer-events: none;
163
- transition: background-color 250ms, color 250ms, border-color 250ms;
164
- width: 21px;
165
- }
166
-
167
- input:checked + .indicator {
168
- background-color: var(--stsv-input__background-color);
169
- border-color: var(--stsv-input__border-color);
170
- }
171
-
172
- .sterling-radio:not(.disabled):hover .indicator {
173
- background-color: var(--stsv-input__background-color--hover);
174
- border-color: var(--stsv-input__border-color--hover);
175
- }
176
-
177
- input:focus-visible + .indicator {
178
- outline-color: var(--stsv-common__outline-color);
179
- outline-offset: var(--stsv-common__outline-offset);
180
- outline-style: var(--stsv-common__outline-style);
181
- outline-width: var(--stsv-common__outline-width);
182
- }
183
-
184
- .indicator::after {
185
- background-color: transparent;
186
- border-radius: 10000px;
187
- content: '';
188
- height: 9px;
189
- left: 50%;
190
- position: absolute;
191
- top: 50%;
192
- transform: translate(-50%, -50%);
193
- transition: background-color 250ms;
194
- width: 9px;
195
- }
196
-
197
- input:checked + .indicator::after {
198
- background-color: var(--stsv-input__color);
199
- }
200
-
201
- .sterling-radio.colorful .indicator {
202
- background-color: var(--stsv-input--colorful__background-color);
203
- border-color: var(--stsv-input--colorful__border-color);
204
- }
205
-
206
- .sterling-radio.colorful input:checked + .indicator {
207
- background-color: var(--stsv-input--colorful__background-color);
208
- border-color: var(--stsv-input--colorful__border-color);
209
- }
210
-
211
- .sterling-radio.colorful:not(.disabled):hover .indicator {
212
- background-color: var(--stsv-input--colorful__background-color--hover);
213
- border-color: var(--stsv-input--colorful__border-color--hover);
214
- }
215
-
216
- .sterling-radio.colorful input:checked + .indicator::after {
217
- background-color: var(--stsv-input--colorful__color);
218
- }
219
-
220
- .sterling-radio.disabled * {
221
- cursor: not-allowed;
222
- }
223
-
224
- .container::after {
225
- background: repeating-linear-gradient(
226
- var(--stsv-common--disabled__stripe-angle),
227
- var(--stsv-common--disabled__stripe-color),
228
- var(--stsv-common--disabled__stripe-color) var(--stsv-common--disabled__stripe-width),
229
- var(--stsv-common--disabled__stripe-color--alt) var(--stsv-common--disabled__stripe-width),
230
- var(--stsv-common--disabled__stripe-color--alt)
231
- calc(2 * var(--stsv-common--disabled__stripe-width))
232
- );
233
- border-radius: 10000px;
234
- bottom: 0;
235
- content: '';
236
- left: 0;
237
- opacity: 0;
238
- position: absolute;
239
- right: 0;
240
- top: 0;
241
- pointer-events: none;
242
- transition: opacity 250ms;
243
- }
244
-
245
- label {
246
- color: var(--stsv-common__color);
247
- transition: color 250ms;
248
- font: inherit;
249
- }
250
-
251
- .sterling-radio.disabled .container::after {
252
- opacity: 1;
253
- }
254
-
255
- @media (prefers-reduced-motion) {
256
- .indicator,
257
- .indicator::after,
258
- .container::after,
259
- label {
260
- transition: none;
261
- }
262
- }
263
- </style>
package/Radio.svelte.d.ts CHANGED
@@ -6,7 +6,7 @@ declare const __propDef: {
6
6
  disabled?: boolean | undefined;
7
7
  group?: any | undefined | null;
8
8
  id?: string | undefined;
9
- colorful?: boolean | undefined;
9
+ variant?: string | undefined;
10
10
  blur?: (() => void) | undefined;
11
11
  click?: (() => void) | undefined;
12
12
  focus?: ((options?: FocusOptions) => void) | undefined;
@@ -42,12 +42,12 @@ declare const __propDef: {
42
42
  };
43
43
  slots: {
44
44
  default: {
45
- colorful: boolean;
46
45
  checked: boolean;
47
46
  disabled: boolean;
48
47
  group: any;
49
48
  inputId: string | undefined;
50
49
  value: any;
50
+ variant: string;
51
51
  };
52
52
  };
53
53
  };