@geoffcox/sterling-svelte 0.0.26 → 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 (74) 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 +87 -55
  13. package/Dropdown.svelte.d.ts +4 -0
  14. package/Field.svelte +31 -31
  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 +28 -16
  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 +7 -7
  30. package/MenuBar.svelte +1 -1
  31. package/MenuButton.svelte +3 -5
  32. package/MenuItem.svelte +33 -11
  33. package/MenuItem.svelte.d.ts +1 -0
  34. package/MenuItemDisplay.svelte +7 -1
  35. package/MenuSeparator.svelte +3 -3
  36. package/Popover.svelte +66 -51
  37. package/Popover.svelte.d.ts +4 -2
  38. package/Progress.svelte +14 -14
  39. package/Radio.svelte +42 -16
  40. package/Radio.svelte.d.ts +1 -0
  41. package/RgbColorSliders.svelte +161 -0
  42. package/RgbColorSliders.svelte.d.ts +22 -0
  43. package/Select.svelte +30 -24
  44. package/Slider.svelte +108 -118
  45. package/Slider.svelte.d.ts +1 -0
  46. package/Switch.svelte +97 -34
  47. package/Switch.svelte.d.ts +1 -0
  48. package/Tab.svelte +52 -29
  49. package/TabList.svelte +21 -10
  50. package/TabList.svelte.d.ts +1 -0
  51. package/TabList.types.d.ts +1 -0
  52. package/TextArea.svelte +45 -20
  53. package/TextArea.svelte.d.ts +3 -2
  54. package/Tooltip.svelte +12 -11
  55. package/Tree.svelte +34 -21
  56. package/Tree.svelte.d.ts +2 -0
  57. package/Tree.types.d.ts +1 -0
  58. package/TreeChevron.svelte +1 -1
  59. package/TreeItem.svelte +40 -9
  60. package/TreeItem.svelte.d.ts +2 -0
  61. package/TreeItemDisplay.svelte +26 -8
  62. package/TreeItemDisplay.svelte.d.ts +2 -0
  63. package/actions/clickOutside.js +1 -1
  64. package/actions/trapKeyboardFocus.d.ts +3 -0
  65. package/actions/trapKeyboardFocus.js +52 -0
  66. package/floating-ui.types.d.ts +2 -0
  67. package/index.d.ts +8 -3
  68. package/index.js +7 -2
  69. package/package.json +10 -1
  70. package/theme/applyTheme.js +3 -2
  71. package/theme/colors.d.ts +1 -0
  72. package/theme/colors.js +28 -13
  73. package/theme/darkTheme.js +130 -87
  74. package/theme/lightTheme.js +107 -87
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;
package/Tab.svelte CHANGED
@@ -7,6 +7,7 @@ export let text = void 0;
7
7
  export let value;
8
8
  let tabRef;
9
9
  const {
10
+ colorful,
10
11
  disabled: tabListDisabled,
11
12
  selectedValue,
12
13
  vertical
@@ -36,6 +37,7 @@ export const focus = (options) => {
36
37
  bind:this={tabRef}
37
38
  aria-selected={selected}
38
39
  class="sterling-tab"
40
+ class:colorful={$colorful}
39
41
  disabled={_disabled}
40
42
  class:selected
41
43
  class:using-keyboard={$usingKeyboard}
@@ -74,7 +76,7 @@ export const focus = (options) => {
74
76
  on:pointerover
75
77
  on:pointerout
76
78
  on:pointerup
77
- on:wheel
79
+ on:wheel|passive
78
80
  >
79
81
  <div class="content">
80
82
  <slot disabled={_disabled} {selected} {value} {text}>
@@ -90,13 +92,13 @@ export const focus = (options) => {
90
92
  .sterling-tab {
91
93
  align-content: center;
92
94
  align-items: center;
93
- background-color: var(--stsv-Common__background-color);
95
+ background-color: var(--stsv-common__background-color);
94
96
  border-color: transparent;
95
- border-radius: var(--stsv-Button__border-radius);
96
- border-style: var(--stsv-Common__border-style);
97
+ border-radius: var(--stsv-button__border-radius);
98
+ border-style: var(--stsv-common__border-style);
97
99
  border-width: 0;
98
100
  box-sizing: border-box;
99
- color: var(--stsv-Common__color);
101
+ color: var(--stsv-common__color);
100
102
  cursor: pointer;
101
103
  display: grid;
102
104
  font: inherit;
@@ -127,30 +129,28 @@ export const focus = (options) => {
127
129
  column-gap: 0.15em;
128
130
  }
129
131
 
130
- .sterling-tab:hover {
131
- background-color: var(--stsv-Common__background-color--hover);
132
- color: var(--stsv-Common__color--hover);
133
- }
134
-
135
- .sterling-tab:active {
136
- background-color: var(--stsv-Common__background-color--active);
137
- color: var(--stsv-Common__color--active);
138
- }
139
-
140
132
  .sterling-tab.using-keyboard:focus-visible {
141
- outline-color: var(--stsv-Common__outline-color);
142
- outline-offset: var(--stsv-Common__outline-offset);
143
- outline-style: var(--stsv-Common__outline-style);
144
- outline-width: var(--stsv-Common__outline-width);
133
+ outline-color: var(--stsv-common__outline-color);
134
+ outline-offset: var(--stsv-common__outline-offset);
135
+ outline-style: var(--stsv-common__outline-style);
136
+ outline-width: var(--stsv-common__outline-width);
145
137
  }
146
138
 
139
+ /* ----- disabled -----*/
140
+
147
141
  .sterling-tab:disabled {
148
142
  cursor: not-allowed;
149
143
  outline: none;
150
144
  }
151
145
 
152
146
  .sterling-tab::after {
153
- background: var(--stsv-Disabled__background);
147
+ background: repeating-linear-gradient(
148
+ 45deg,
149
+ var(--stsv-common__background-color1--disabled),
150
+ var(--stsv-common__background-color1--disabled) 3px,
151
+ var(--stsv-common__background-color2--disabled) 3px,
152
+ var(--stsv-common__background-color2--disabled) 6px
153
+ );
154
154
  bottom: 0;
155
155
  content: '';
156
156
  left: 0;
@@ -166,6 +166,8 @@ export const focus = (options) => {
166
166
  opacity: 1;
167
167
  }
168
168
 
169
+ /* ----- content -----*/
170
+
169
171
  .content {
170
172
  padding: 0 0.2em;
171
173
  }
@@ -174,6 +176,8 @@ export const focus = (options) => {
174
176
  padding-top: 0.25em;
175
177
  }
176
178
 
179
+ /* ----- indicator -----*/
180
+
177
181
  .indicator {
178
182
  background-color: transparent;
179
183
  border-radius: 10000px;
@@ -190,24 +194,43 @@ export const focus = (options) => {
190
194
  width: 0.4em;
191
195
  }
192
196
 
193
- .sterling-tab:hover .indicator {
194
- background-color: var(--stsv-Display__color--faint);
197
+ .sterling-tab:not(.selected):not(:active):hover .indicator {
198
+ background-color: var(--stsv-input__border-color--hover);
199
+ opacity: 0.3;
195
200
  }
196
201
 
197
202
  .sterling-tab:active .indicator {
198
- background-color: var(--stsv-Button__border-color--hover);
203
+ background-color: var(--stsv-input__border-color--selected);
199
204
  }
200
205
 
201
- .sterling-tab:disabled .indicator,
202
- .sterling-tab:disabled:hover .indicator,
203
- .sterling-tab:disabled:active .indicator {
204
- background-color: transparent;
206
+ .sterling-tab.selected .indicator {
207
+ background-color: var(--stsv-input__border-color--selected);
205
208
  }
206
209
 
207
- .sterling-tab.selected .indicator {
208
- background-color: var(--stsv-Input__color);
210
+ /* ----- indicator colorful -----*/
211
+
212
+ .sterling-tab.colorful:not(.selected):not(:active):hover .indicator {
213
+ background-color: var(--stsv-input--colorful__border-color--hover);
214
+ }
215
+
216
+ .sterling-tab.colorful:active .indicator {
217
+ background-color: var(--stsv-input--colorful__border-color--selected);
218
+ }
219
+
220
+ .sterling-tab.colorful.selected .indicator {
221
+ background-color: var(--stsv-input--colorful__border-color--selected);
209
222
  }
210
223
 
224
+ /* ----- indicator disabled -----*/
225
+
226
+ .sterling-tab:disabled:not(.selected) .indicator,
227
+ .sterling-tab:disabled:not(.selected):hover .indicator,
228
+ .sterling-tab:disabled:not(.selected):active .indicator {
229
+ background-color: transparent;
230
+ }
231
+
232
+ /* ----- reduced motion -----*/
233
+
211
234
  @media (prefers-reduced-motion) {
212
235
  .sterling-tab,
213
236
  .sterling-tab::after,
package/TabList.svelte CHANGED
@@ -2,14 +2,18 @@
2
2
  import { writable } from "svelte/store";
3
3
  import { TAB_LIST_CONTEXT_KEY } from "./TabList.constants";
4
4
  import { usingKeyboard } from "./stores/usingKeyboard";
5
+ export let colorful = false;
5
6
  export let disabled = false;
6
7
  export let vertical = false;
7
8
  export let selectedValue = void 0;
8
9
  let tabListRef;
9
10
  let lastSelectedTabRef;
11
+ const colorfulStore = writable(colorful);
10
12
  const disabledStore = writable(disabled);
11
13
  const selectedValueStore = writable(selectedValue);
12
14
  const verticalStore = writable(vertical);
15
+ $:
16
+ colorfulStore.set(colorful);
13
17
  $:
14
18
  disabledStore.set(disabled);
15
19
  $:
@@ -30,7 +34,12 @@ export const blur = () => {
30
34
  tabListRef?.blur();
31
35
  };
32
36
  export const focus = (options) => {
33
- tabListRef?.focus(options);
37
+ let selectedItem = getSelectedTabElement();
38
+ if (selectedValue && selectedItem) {
39
+ selectTab(selectedValue, selectedItem);
40
+ } else {
41
+ selectFirstTab();
42
+ }
34
43
  };
35
44
  const isElementTab = (candidate) => {
36
45
  return candidate && candidate.getAttribute("data-value") !== null && candidate.getAttribute("data-value") !== void 0 && candidate.getAttribute("role") === "tab";
@@ -61,8 +70,8 @@ export const selectFirstTab = () => {
61
70
  return false;
62
71
  };
63
72
  export const selectPreviousTab = () => {
64
- let selectedItem = getSelectedTabElement();
65
- let candidate = selectedItem?.previousElementSibling;
73
+ let selectedTab = getSelectedTabElement();
74
+ let candidate = selectedTab?.previousElementSibling;
66
75
  while (candidate && !isElementTab(candidate)) {
67
76
  candidate = candidate.previousElementSibling;
68
77
  }
@@ -74,8 +83,8 @@ export const selectPreviousTab = () => {
74
83
  return false;
75
84
  };
76
85
  export const selectNextTab = () => {
77
- let selectedItem = getSelectedTabElement();
78
- let candidate = selectedItem?.nextElementSibling;
86
+ let selectedTab = getSelectedTabElement();
87
+ let candidate = selectedTab?.nextElementSibling;
79
88
  while (candidate && !isElementTab(candidate)) {
80
89
  candidate = candidate.nextElementSibling;
81
90
  }
@@ -158,6 +167,7 @@ const onKeydown = (event) => {
158
167
  }
159
168
  };
160
169
  setContext(TAB_LIST_CONTEXT_KEY, {
170
+ colorful: colorfulStore,
161
171
  disabled: disabledStore,
162
172
  selectedValue: selectedValueStore,
163
173
  vertical: verticalStore
@@ -168,9 +178,10 @@ setContext(TAB_LIST_CONTEXT_KEY, {
168
178
  aria-orientation={vertical ? 'vertical' : 'horizontal'}
169
179
  bind:this={tabListRef}
170
180
  class="sterling-tab-list"
171
- role="tablist"
172
- class:vertical
181
+ class:colorful
173
182
  class:disabled
183
+ class:vertical
184
+ role="tablist"
174
185
  on:blur
175
186
  on:click
176
187
  on:click={onClick}
@@ -198,7 +209,7 @@ setContext(TAB_LIST_CONTEXT_KEY, {
198
209
  on:mouseout
199
210
  on:mouseup
200
211
  on:scroll
201
- on:wheel
212
+ on:wheel|passive
202
213
  on:paste
203
214
  {...$$restProps}
204
215
  >
@@ -210,7 +221,7 @@ setContext(TAB_LIST_CONTEXT_KEY, {
210
221
  box-sizing: border-box;
211
222
  display: grid;
212
223
  margin: 0;
213
- padding: calc(2 * var(--stsv-Common__outline-width));
224
+ padding: calc(2 * var(--stsv-common__outline-width));
214
225
  }
215
226
 
216
227
  .sterling-tab-list:not(.vertical) {
@@ -232,7 +243,7 @@ setContext(TAB_LIST_CONTEXT_KEY, {
232
243
  }
233
244
 
234
245
  .sterling-tab-list:hover {
235
- color: var(--stsv-Common__color--hover);
246
+ color: var(--stsv-common__color--hover);
236
247
  }
237
248
 
238
249
  @media (prefers-reduced-motion) {
@@ -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
  disabled?: boolean | undefined;
6
7
  vertical?: boolean | undefined;
7
8
  selectedValue?: string | undefined;
@@ -1,5 +1,6 @@
1
1
  import type { Readable, Writable } from 'svelte/store';
2
2
  export type TabListContext = {
3
+ colorful: Readable<boolean>;
3
4
  disabled: Readable<boolean>;
4
5
  selectedValue: Writable<string | undefined>;
5
6
  vertical: Readable<boolean>;
package/TextArea.svelte CHANGED
@@ -1,5 +1,6 @@
1
1
  <script>import { onMount } from "svelte";
2
2
  export let autoHeight = false;
3
+ export let colorful = false;
3
4
  export let disabled = false;
4
5
  export let resize = "none";
5
6
  export let value = "";
@@ -42,7 +43,7 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
42
43
  };
43
44
  </script>
44
45
 
45
- <div class="sterling-text-area" class:disabled>
46
+ <div class="sterling-text-area" class:colorful class:disabled>
46
47
  <textarea
47
48
  bind:this={textAreaRef}
48
49
  bind:value
@@ -81,7 +82,7 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
81
82
  on:select
82
83
  on:submit
83
84
  on:reset
84
- on:wheel
85
+ on:wheel|passive
85
86
  on:input={onInput}
86
87
  {...$$restProps}
87
88
  />
@@ -95,13 +96,13 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
95
96
  }
96
97
 
97
98
  textarea {
98
- background-color: var(--stsv-Input__background-color);
99
- border-color: var(--stsv-Input__border-color);
100
- border-radius: var(--stsv-Input__border-radius);
101
- border-style: var(--stsv-Input__border-style);
102
- border-width: var(--stsv-Input__border-width);
99
+ background-color: var(--stsv-input__background-color);
100
+ border-color: var(--stsv-input__border-color);
101
+ border-radius: var(--stsv-input__border-radius);
102
+ border-style: var(--stsv-input__border-style);
103
+ border-width: var(--stsv-input__border-width);
103
104
  box-sizing: border-box;
104
- color: var(--stsv-Input__color);
105
+ color: var(--stsv-input__color);
105
106
  display: block;
106
107
  font: inherit;
107
108
  line-height: inherit;
@@ -117,19 +118,37 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
117
118
  }
118
119
 
119
120
  textarea:hover {
120
- background-color: var(--stsv-Input__background-color--hover);
121
- border-color: var(--stsv-Input__border-color--hover);
122
- color: var(--stsv-Input__color--hover);
121
+ background-color: var(--stsv-input__background-color--hover);
122
+ border-color: var(--stsv-input__border-color--hover);
123
+ color: var(--stsv-input__color--hover);
123
124
  }
124
125
 
125
126
  textarea:focus {
126
- background-color: var(--stsv-Input__background-color--focus);
127
- border-color: var(--stsv-Input__border-color--focus);
128
- color: var(--stsv-Input__color--focus);
129
- outline-color: var(--stsv-Common__outline-color);
130
- outline-offset: var(--stsv-Common__outline-offset);
131
- outline-style: var(--stsv-Common__outline-style);
132
- outline-width: var(--stsv-Common__outline-width);
127
+ background-color: var(--stsv-input__background-color--focus);
128
+ border-color: var(--stsv-input__border-color--focus);
129
+ color: var(--stsv-input__color--focus);
130
+ outline-color: var(--stsv-common__outline-color);
131
+ outline-offset: var(--stsv-common__outline-offset);
132
+ outline-style: var(--stsv-common__outline-style);
133
+ outline-width: var(--stsv-common__outline-width);
134
+ }
135
+
136
+ .sterling-text-area.colorful textarea {
137
+ background-color: var(--stsv-input--colorful__background-color);
138
+ border-color: var(--stsv-input--colorful__border-color);
139
+ color: var(--stsv-input--colorful__color);
140
+ }
141
+
142
+ .sterling-text-area.colorful textarea:hover {
143
+ background-color: var(--stsv-input--colorful__background-color--hover);
144
+ border-color: var(--stsv-input--colorful__border-color--hover);
145
+ color: var(--stsv-input--colorful__color--hover);
146
+ }
147
+
148
+ .sterling-text-area.colorful textarea:focus {
149
+ background-color: var(--stsv-input--colorful__background-color--focus);
150
+ border-color: var(--stsv-input--colorful__border-color--focus);
151
+ color: var(--stsv-input--colorful__color--focus);
133
152
  }
134
153
 
135
154
  .sterling-text-area:disabled {
@@ -138,7 +157,13 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
138
157
  }
139
158
 
140
159
  .sterling-text-area::after {
141
- background: var(--stsv-Disabled__background);
160
+ background: repeating-linear-gradient(
161
+ 45deg,
162
+ var(--stsv-common__background-color1--disabled),
163
+ var(--stsv-common__background-color1--disabled) 3px,
164
+ var(--stsv-common__background-color2--disabled) 3px,
165
+ var(--stsv-common__background-color2--disabled) 6px
166
+ );
142
167
  bottom: 0;
143
168
  content: '';
144
169
  left: 0;
@@ -155,7 +180,7 @@ export const setRangeText = (replacement, start, end, selectionMode) => {
155
180
  }
156
181
 
157
182
  textarea::placeholder {
158
- color: var(--stsv-Display__color--faint);
183
+ color: var(--stsv-common__color--subtle);
159
184
  transition: background-color 250ms, color 250ms, border-color 250ms;
160
185
  }
161
186
 
@@ -3,8 +3,9 @@ declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
5
  autoHeight?: boolean | undefined;
6
+ colorful?: boolean | undefined;
6
7
  disabled?: boolean | undefined;
7
- resize?: "none" | "horizontal" | "vertical" | "both" | undefined;
8
+ resize?: "none" | "vertical" | "horizontal" | "both" | undefined;
8
9
  value?: string | undefined;
9
10
  blur?: (() => void) | undefined;
10
11
  click?: (() => void) | undefined;
@@ -60,7 +61,7 @@ export default class TextArea extends SvelteComponentTyped<TextAreaProps, TextAr
60
61
  get click(): () => void;
61
62
  get focus(): (options?: FocusOptions | undefined) => void;
62
63
  get select(): () => void;
63
- get setSelectionRange(): (start: number | null, end: number | null, direction?: "none" | "forward" | "backward" | undefined) => void;
64
+ get setSelectionRange(): (start: number | null, end: number | null, direction?: "forward" | "backward" | "none" | undefined) => void;
64
65
  get setRangeText(): (replacement: string, start?: number | undefined, end?: number | undefined, selectionMode?: SelectionMode | undefined) => void;
65
66
  }
66
67
  export {};
package/Tooltip.svelte CHANGED
@@ -114,6 +114,7 @@ const autoShowUpdate = () => {
114
114
  cleanupAutoShowUpdate = () => {
115
115
  };
116
116
  const element = reference;
117
+ open = false;
117
118
  if (element) {
118
119
  switch (showOn) {
119
120
  case "click":
@@ -171,12 +172,12 @@ onMount(() => {
171
172
  }
172
173
 
173
174
  .sterling-tooltip {
174
- background-color: var(--stsv-Common__background-color);
175
- border-color: var(--stsv-Common__border-color);
176
- border-radius: var(--stsv-Common__border-radius);
177
- border-style: var(--stsv-Common__border-style);
178
- border-width: var(--stsv-Common__border-width);
179
- color: var(--stsv-Common__color);
175
+ background-color: var(--stsv-common__background-color);
176
+ border-color: var(--stsv-common__border-color);
177
+ border-radius: var(--stsv-common__border-radius);
178
+ border-style: var(--stsv-common__border-style);
179
+ border-width: var(--stsv-common__border-width);
180
+ color: var(--stsv-common__color);
180
181
  position: absolute;
181
182
  overflow: visible;
182
183
  box-shadow: rgba(0, 0, 0, 0.4) 2px 2px 4px -1px;
@@ -187,11 +188,11 @@ onMount(() => {
187
188
  position: absolute;
188
189
  width: 10px;
189
190
  height: 10px;
190
- background-color: var(--stsv-Common__background-color);
191
- border-color: var(--stsv-Common__border-color);
192
- border-radius: var(--stsv-Common__border-radius);
193
- border-style: var(--stsv-Common__border-style);
194
- border-width: var(--stsv-Common__border-width);
191
+ background-color: var(--stsv-common__background-color);
192
+ border-color: var(--stsv-common__border-color);
193
+ border-radius: var(--stsv-common__border-radius);
194
+ border-style: var(--stsv-common__border-style);
195
+ border-width: var(--stsv-common__border-width);
195
196
  clip-path: polygon(0% 1%, 100% 1%, 100% 100%, 0% 1%);
196
197
  }
197
198
  </style>