@geoffcox/sterling-svelte 0.0.22 → 0.0.24

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 (58) hide show
  1. package/Button.svelte +24 -22
  2. package/Button.svelte.d.ts +8 -0
  3. package/Checkbox.svelte +54 -29
  4. package/Checkbox.svelte.d.ts +6 -1
  5. package/Dropdown.svelte +32 -7
  6. package/Dropdown.svelte.d.ts +6 -0
  7. package/Field.svelte +17 -12
  8. package/Field.svelte.d.ts +6 -0
  9. package/Input.svelte +78 -53
  10. package/Input.svelte.d.ts +7 -0
  11. package/Label.svelte +6 -0
  12. package/Label.svelte.d.ts +6 -0
  13. package/Link.svelte +6 -0
  14. package/Link.svelte.d.ts +6 -0
  15. package/List.svelte +52 -16
  16. package/List.svelte.d.ts +6 -0
  17. package/ListItem.svelte +36 -7
  18. package/ListItem.svelte.d.ts +6 -0
  19. package/Menu.svelte +7 -1
  20. package/Menu.svelte.d.ts +6 -0
  21. package/MenuBar.svelte +6 -0
  22. package/MenuBar.svelte.d.ts +6 -0
  23. package/MenuButton.svelte +6 -0
  24. package/MenuButton.svelte.d.ts +6 -0
  25. package/MenuItem.svelte +12 -7
  26. package/MenuItem.svelte.d.ts +6 -0
  27. package/MenuItemDisplay.svelte +33 -2
  28. package/MenuItemDisplay.svelte.d.ts +1 -0
  29. package/MenuSeparator.svelte +6 -0
  30. package/MenuSeparator.svelte.d.ts +12 -0
  31. package/Progress.svelte +6 -13
  32. package/Progress.svelte.d.ts +6 -1
  33. package/Radio.svelte +42 -25
  34. package/Radio.svelte.d.ts +6 -1
  35. package/Select.svelte +30 -4
  36. package/Select.svelte.d.ts +6 -0
  37. package/Slider.svelte +25 -10
  38. package/Slider.svelte.d.ts +6 -0
  39. package/Switch.svelte +37 -12
  40. package/Switch.svelte.d.ts +6 -1
  41. package/Tab.svelte +31 -3
  42. package/Tab.svelte.d.ts +6 -0
  43. package/TabList.svelte +8 -2
  44. package/TabList.svelte.d.ts +6 -0
  45. package/TextArea.svelte +81 -49
  46. package/TextArea.svelte.d.ts +8 -0
  47. package/Tooltip.svelte +0 -1
  48. package/Tree.svelte +50 -13
  49. package/Tree.svelte.d.ts +6 -0
  50. package/TreeChevron.svelte +6 -0
  51. package/TreeChevron.svelte.d.ts +6 -0
  52. package/TreeItem.svelte +14 -8
  53. package/TreeItem.svelte.d.ts +6 -1
  54. package/TreeItemDisplay.svelte +42 -11
  55. package/TreeItemDisplay.svelte.d.ts +6 -0
  56. package/package.json +3 -3
  57. package/theme/darkTheme.js +9 -0
  58. package/theme/lightTheme.js +9 -0
package/Link.svelte CHANGED
@@ -23,6 +23,12 @@ export const focus = (options) => {
23
23
  on:blur
24
24
  on:click
25
25
  on:dblclick
26
+ on:dragend
27
+ on:dragenter
28
+ on:dragleave
29
+ on:dragover
30
+ on:dragstart
31
+ on:drop
26
32
  on:focus
27
33
  on:focusin
28
34
  on:focusout
package/Link.svelte.d.ts CHANGED
@@ -13,6 +13,12 @@ declare const __propDef: {
13
13
  blur: FocusEvent;
14
14
  click: MouseEvent;
15
15
  dblclick: MouseEvent;
16
+ dragend: DragEvent;
17
+ dragenter: DragEvent;
18
+ dragleave: DragEvent;
19
+ dragover: DragEvent;
20
+ dragstart: DragEvent;
21
+ drop: DragEvent;
16
22
  focus: FocusEvent;
17
23
  focusin: FocusEvent;
18
24
  focusout: FocusEvent;
package/List.svelte CHANGED
@@ -206,6 +206,12 @@ A list of items where a single item can be selected.
206
206
  on:copy
207
207
  on:cut
208
208
  on:dblclick
209
+ on:dragend
210
+ on:dragenter
211
+ on:dragleave
212
+ on:dragover
213
+ on:dragstart
214
+ on:drop
209
215
  on:focus
210
216
  on:focusin
211
217
  on:focusout
@@ -225,7 +231,9 @@ A list of items where a single item can be selected.
225
231
  on:paste
226
232
  {...$$restProps}
227
233
  >
228
- <slot {composed} {disabled} {horizontal} {selectedValue} />
234
+ <div class="container">
235
+ <slot {composed} {disabled} {horizontal} {selectedValue} />
236
+ </div>
229
237
  </div>
230
238
 
231
239
  <style>
@@ -237,13 +245,10 @@ A list of items where a single item can be selected.
237
245
  border-width: var(--stsv-Common__border-width);
238
246
  box-sizing: border-box;
239
247
  color: var(--stsv-Common__color);
240
- display: flex;
241
- flex-direction: column;
242
- flex-wrap: nowrap;
243
248
  height: 100%;
244
- margin: 0;
245
249
  overflow-x: hidden;
246
- overflow-y: scroll;
250
+ overflow-y: auto;
251
+ margin: 0;
247
252
  outline: none;
248
253
  padding: 0;
249
254
  position: relative;
@@ -251,9 +256,8 @@ A list of items where a single item can be selected.
251
256
  }
252
257
 
253
258
  .sterling-list.horizontal {
254
- flex-direction: row;
255
259
  height: unset;
256
- overflow-x: scroll;
260
+ overflow-x: auto;
257
261
  overflow-y: hidden;
258
262
  width: 100%;
259
263
  }
@@ -272,13 +276,6 @@ A list of items where a single item can be selected.
272
276
  outline-width: var(--stsv-Common__outline-width);
273
277
  }
274
278
 
275
- .sterling-list.disabled {
276
- background-color: var(--stsv-Common__background-color--disabled);
277
- border-color: var(--stsv--Common__border-color--disabled);
278
- color: var(--stsv-Common__color--disabled);
279
- cursor: not-allowed;
280
- }
281
-
282
279
  .sterling-list.composed,
283
280
  .sterling-list.composed:hover,
284
281
  .sterling-list.composed.using-keyboard:focus-within,
@@ -288,8 +285,47 @@ A list of items where a single item can be selected.
288
285
  outline: none;
289
286
  }
290
287
 
288
+ .sterling-list.disabled * {
289
+ cursor: not-allowed;
290
+ }
291
+
292
+ /* ----- container - a layout panel that grows with the items ----- */
293
+
294
+ .container {
295
+ display: flex;
296
+ position: relative;
297
+ flex-direction: column;
298
+ flex-wrap: nowrap;
299
+ width: fit-content;
300
+ }
301
+
302
+ .sterling-list.horizontal .container {
303
+ flex-direction: row;
304
+ }
305
+
306
+ .container::after {
307
+ background: var(--stsv-Disabled__background);
308
+ content: '';
309
+ bottom: 0;
310
+ left: 0;
311
+ opacity: 0;
312
+ position: absolute;
313
+ right: 0;
314
+ top: 0;
315
+ height: 100%;
316
+ pointer-events: none;
317
+ transition: opacity 250ms;
318
+ }
319
+
320
+ .sterling-list.disabled .container::after {
321
+ opacity: 1;
322
+ }
323
+
324
+ /* ----- media queries ----- */
325
+
291
326
  @media (prefers-reduced-motion) {
292
- .sterling-list {
327
+ .sterling-list,
328
+ .container::after {
293
329
  transition: none;
294
330
  }
295
331
  }
package/List.svelte.d.ts CHANGED
@@ -21,6 +21,12 @@ declare const __propDef: {
21
21
  copy: ClipboardEvent;
22
22
  cut: ClipboardEvent;
23
23
  dblclick: MouseEvent;
24
+ dragend: DragEvent;
25
+ dragenter: DragEvent;
26
+ dragleave: DragEvent;
27
+ dragover: DragEvent;
28
+ dragstart: DragEvent;
29
+ drop: DragEvent;
24
30
  focus: FocusEvent;
25
31
  focusin: FocusEvent;
26
32
  focusout: FocusEvent;
package/ListItem.svelte CHANGED
@@ -1,15 +1,18 @@
1
1
  <script>import { getContext } from "svelte";
2
2
  import { LIST_CONTEXT_KEY } from "./List.constants";
3
+ import { readable } from "svelte/store";
3
4
  export let disabled = false;
4
5
  export let value;
5
6
  const {
6
7
  disabled: listDisabled,
7
8
  selectedValue,
8
9
  horizontal
9
- } = getContext(LIST_CONTEXT_KEY);
10
+ } = getContext(LIST_CONTEXT_KEY) || {
11
+ disabled: readable(false),
12
+ selectedValue: void 0,
13
+ horizontal: false
14
+ };
10
15
  let itemRef;
11
- $:
12
- _disabled = disabled || $listDisabled;
13
16
  $:
14
17
  selected = $selectedValue === value;
15
18
  export const click = () => {
@@ -27,13 +30,20 @@ export const focus = (options) => {
27
30
  aria-selected={selected}
28
31
  bind:this={itemRef}
29
32
  class="sterling-list-item"
30
- class:disabled={_disabled}
33
+ class:disabled={disabled || $listDisabled}
34
+ class:item-disabled={disabled && !$listDisabled}
31
35
  class:selected
32
36
  data-value={value}
33
37
  role="listitem"
34
38
  on:blur
35
39
  on:click
36
40
  on:dblclick
41
+ on:dragend
42
+ on:dragenter
43
+ on:dragleave
44
+ on:dragover
45
+ on:dragstart
46
+ on:drop
37
47
  on:focus
38
48
  on:focusin
39
49
  on:focusout
@@ -69,13 +79,14 @@ export const focus = (options) => {
69
79
  cursor: pointer;
70
80
  margin: 0;
71
81
  padding: 0.5em;
82
+ position: relative;
72
83
  outline: none;
73
84
  text-overflow: ellipsis;
74
85
  transition: background-color 250ms, color 250ms, border-color 250ms;
75
86
  white-space: nowrap;
76
87
  }
77
88
 
78
- .sterling-list-item:not(.disabled):hover {
89
+ .sterling-list-item:not(.disabled):not(.selected):hover {
79
90
  background-color: var(--stsv-Button__background-color--hover);
80
91
  color: var(--stsv-Button__color--hover);
81
92
  }
@@ -86,12 +97,30 @@ export const focus = (options) => {
86
97
  }
87
98
 
88
99
  .sterling-list-item.disabled {
89
- color: var(--stsv-Common__color--disabled);
90
100
  cursor: not-allowed;
101
+ outline: none;
102
+ }
103
+
104
+ .sterling-list-item::after {
105
+ background: var(--stsv-Disabled__background);
106
+ bottom: 0;
107
+ content: '';
108
+ left: 0;
109
+ opacity: 0;
110
+ position: absolute;
111
+ right: 0;
112
+ top: 0;
113
+ pointer-events: none;
114
+ transition: opacity 250ms;
115
+ }
116
+
117
+ .sterling-list-item.item-disabled::after {
118
+ opacity: 1;
91
119
  }
92
120
 
93
121
  @media (prefers-reduced-motion) {
94
- .sterling-list-item {
122
+ .sterling-list-item,
123
+ .sterling-list-item::after {
95
124
  transition: none;
96
125
  }
97
126
  }
@@ -12,6 +12,12 @@ declare const __propDef: {
12
12
  blur: FocusEvent;
13
13
  click: MouseEvent;
14
14
  dblclick: MouseEvent;
15
+ dragend: DragEvent;
16
+ dragenter: DragEvent;
17
+ dragleave: DragEvent;
18
+ dragover: DragEvent;
19
+ dragstart: DragEvent;
20
+ drop: DragEvent;
15
21
  focus: FocusEvent;
16
22
  focusin: FocusEvent;
17
23
  focusout: FocusEvent;
package/Menu.svelte CHANGED
@@ -80,6 +80,12 @@ onMount(() => {
80
80
  on:copy
81
81
  on:cut
82
82
  on:dblclick
83
+ on:dragend
84
+ on:dragenter
85
+ on:dragleave
86
+ on:dragover
87
+ on:dragstart
88
+ on:drop
83
89
  on:focus
84
90
  on:focusin
85
91
  on:focusout
@@ -127,7 +133,7 @@ onMount(() => {
127
133
  height: fit-content;
128
134
  left: 0;
129
135
  max-height: calc(50vh);
130
- overflow: scroll;
136
+ overflow: auto;
131
137
  overscroll-behavior: contain;
132
138
  padding: 0.25em;
133
139
  position: absolute;
package/Menu.svelte.d.ts CHANGED
@@ -13,6 +13,12 @@ declare const __propDef: {
13
13
  copy: ClipboardEvent;
14
14
  cut: ClipboardEvent;
15
15
  dblclick: MouseEvent;
16
+ dragend: DragEvent;
17
+ dragenter: DragEvent;
18
+ dragleave: DragEvent;
19
+ dragover: DragEvent;
20
+ dragstart: DragEvent;
21
+ drop: DragEvent;
16
22
  focus: FocusEvent;
17
23
  focusin: FocusEvent;
18
24
  focusout: FocusEvent;
package/MenuBar.svelte CHANGED
@@ -72,6 +72,12 @@ setContext(MENU_BAR_CONTEXT_KEY, {
72
72
  on:copy
73
73
  on:cut
74
74
  on:dblclick
75
+ on:dragend
76
+ on:dragenter
77
+ on:dragleave
78
+ on:dragover
79
+ on:dragstart
80
+ on:drop
75
81
  on:focus
76
82
  on:focusin
77
83
  on:focusout
@@ -11,6 +11,12 @@ declare const __propDef: {
11
11
  copy: ClipboardEvent;
12
12
  cut: ClipboardEvent;
13
13
  dblclick: MouseEvent;
14
+ dragend: DragEvent;
15
+ dragenter: DragEvent;
16
+ dragleave: DragEvent;
17
+ dragover: DragEvent;
18
+ dragstart: DragEvent;
19
+ drop: DragEvent;
14
20
  focus: FocusEvent;
15
21
  focusin: FocusEvent;
16
22
  focusout: FocusEvent;
package/MenuButton.svelte CHANGED
@@ -87,6 +87,12 @@ setContext(MENU_ITEM_CONTEXT_KEY, {
87
87
  on:click
88
88
  on:click={onClick}
89
89
  on:dblclick
90
+ on:dragend
91
+ on:dragenter
92
+ on:dragleave
93
+ on:dragover
94
+ on:dragstart
95
+ on:drop
90
96
  on:focus
91
97
  on:focusin
92
98
  on:focusout
@@ -14,6 +14,12 @@ declare const __propDef: {
14
14
  blur: FocusEvent;
15
15
  click: MouseEvent;
16
16
  dblclick: MouseEvent;
17
+ dragend: DragEvent;
18
+ dragenter: DragEvent;
19
+ dragleave: DragEvent;
20
+ dragover: DragEvent;
21
+ dragstart: DragEvent;
22
+ drop: DragEvent;
17
23
  focus: FocusEvent;
18
24
  focusin: FocusEvent;
19
25
  focusout: FocusEvent;
package/MenuItem.svelte CHANGED
@@ -110,7 +110,7 @@ afterUpdate(() => {
110
110
  prevOpen = open;
111
111
  });
112
112
  const onKeyDown = (event) => {
113
- if (!event.altKey && !event.ctrlKey && !event.shiftKey) {
113
+ if (!disabled && !event.altKey && !event.ctrlKey && !event.shiftKey) {
114
114
  switch (event.key) {
115
115
  case "ArrowDown":
116
116
  if (depth === 0 && hasChildren) {
@@ -241,6 +241,12 @@ setContext(MENU_ITEM_CONTEXT_KEY, {
241
241
  on:blur
242
242
  on:click
243
243
  on:dblclick
244
+ on:dragend
245
+ on:dragenter
246
+ on:dragleave
247
+ on:dragover
248
+ on:dragstart
249
+ on:drop
244
250
  on:focus
245
251
  on:focusin
246
252
  on:focusout
@@ -271,8 +277,11 @@ setContext(MENU_ITEM_CONTEXT_KEY, {
271
277
  >
272
278
  <div class="item" id={displayId}>
273
279
  <slot name="item" {checked} {depth} {disabled} {hasChildren} {open} {role} {text} {value}>
274
- <MenuItemDisplay {checked} hasChildren={depth > 0 && hasChildren} menuItemRole={role}
275
- >{text}</MenuItemDisplay
280
+ <MenuItemDisplay
281
+ {checked}
282
+ {disabled}
283
+ hasChildren={depth > 0 && hasChildren}
284
+ menuItemRole={role}>{text}</MenuItemDisplay
276
285
  >
277
286
  </slot>
278
287
  </div>
@@ -327,10 +336,6 @@ setContext(MENU_ITEM_CONTEXT_KEY, {
327
336
  background-color: var(--stsv-Input__background-color--selected);
328
337
  }
329
338
 
330
- .sterling-menu-item.disabled {
331
- color: var(--stsv-Common__color--disabled);
332
- }
333
-
334
339
  .sterling-menu-item.composed,
335
340
  .sterling-menu-item.composed:focus,
336
341
  .sterling-menu-item.composed:hover {
@@ -17,6 +17,12 @@ declare const __propDef: {
17
17
  blur: FocusEvent;
18
18
  click: MouseEvent;
19
19
  dblclick: MouseEvent;
20
+ dragend: DragEvent;
21
+ dragenter: DragEvent;
22
+ dragleave: DragEvent;
23
+ dragover: DragEvent;
24
+ dragstart: DragEvent;
25
+ drop: DragEvent;
20
26
  focus: FocusEvent;
21
27
  focusin: FocusEvent;
22
28
  focusout: FocusEvent;
@@ -1,9 +1,10 @@
1
1
  <script>export let checked = false;
2
+ export let disabled = false;
2
3
  export let hasChildren = false;
3
4
  export let menuItemRole = "menuitem";
4
5
  </script>
5
6
 
6
- <div class="menu-item-display">
7
+ <div class="sterling-menu-item-display" class:disabled>
7
8
  <div
8
9
  class="check"
9
10
  class:checkmark={menuItemRole === 'menuitemcheckbox'}
@@ -23,7 +24,7 @@ export let menuItemRole = "menuitem";
23
24
  </div>
24
25
 
25
26
  <style>
26
- .menu-item-display {
27
+ .sterling-menu-item-display {
27
28
  align-items: center;
28
29
  justify-items: flex-start;
29
30
  display: grid;
@@ -94,4 +95,34 @@ export let menuItemRole = "menuitem";
94
95
  border-top: 3px solid currentColor;
95
96
  transform: translate(-50%, -50%) rotate(45deg);
96
97
  }
98
+
99
+ .sterling-menu-item-display.disabled {
100
+ cursor: not-allowed;
101
+ outline: none;
102
+ }
103
+
104
+ .sterling-menu-item-display::after {
105
+ background: var(--stsv-Disabled__background);
106
+ bottom: 0;
107
+ content: '';
108
+ left: 0;
109
+ opacity: 0;
110
+ position: absolute;
111
+ right: 0;
112
+ top: 0;
113
+ pointer-events: none;
114
+ transition: opacity 250ms;
115
+ }
116
+
117
+ .sterling-menu-item-display.disabled::after {
118
+ opacity: 1;
119
+ }
120
+
121
+ @media (prefers-reduced-motion) {
122
+ .sterling-menu-item-display::after,
123
+ .check,
124
+ .check::after {
125
+ transition: none;
126
+ }
127
+ }
97
128
  </style>
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  checked?: boolean | undefined;
5
+ disabled?: boolean | undefined;
5
6
  hasChildren?: boolean | undefined;
6
7
  menuItemRole?: "menuitem" | "menuitemcheckbox" | "menuitemradio" | undefined;
7
8
  };
@@ -8,6 +8,12 @@ A styled line to visually separate menu items in a menu.
8
8
  on:blur
9
9
  on:click
10
10
  on:dblclick
11
+ on:dragend
12
+ on:dragenter
13
+ on:dragleave
14
+ on:dragover
15
+ on:dragstart
16
+ on:drop
11
17
  on:focus
12
18
  on:focusin
13
19
  on:focusout
@@ -8,6 +8,12 @@ export default class MenuSeparator extends SvelteComponentTyped<{
8
8
  blur: FocusEvent;
9
9
  click: MouseEvent;
10
10
  dblclick: MouseEvent;
11
+ dragend: DragEvent;
12
+ dragenter: DragEvent;
13
+ dragleave: DragEvent;
14
+ dragover: DragEvent;
15
+ dragstart: DragEvent;
16
+ drop: DragEvent;
11
17
  focus: FocusEvent;
12
18
  focusin: FocusEvent;
13
19
  focusout: FocusEvent;
@@ -46,6 +52,12 @@ declare const __propDef: {
46
52
  blur: FocusEvent;
47
53
  click: MouseEvent;
48
54
  dblclick: MouseEvent;
55
+ dragend: DragEvent;
56
+ dragenter: DragEvent;
57
+ dragleave: DragEvent;
58
+ dragover: DragEvent;
59
+ dragstart: DragEvent;
60
+ drop: DragEvent;
49
61
  focus: FocusEvent;
50
62
  focusin: FocusEvent;
51
63
  focusout: FocusEvent;
package/Progress.svelte CHANGED
@@ -3,7 +3,6 @@ export let max = 100;
3
3
  export let percent = 0;
4
4
  export let vertical = false;
5
5
  export let colorful = "none";
6
- export let disabled = false;
7
6
  let clientHeight;
8
7
  let clientWidth;
9
8
  $:
@@ -34,12 +33,17 @@ $:
34
33
 
35
34
  <div
36
35
  class="sterling-progress"
37
- class:disabled
38
36
  class:vertical
39
37
  role="progressbar"
40
38
  on:blur
41
39
  on:click
42
40
  on:dblclick
41
+ on:dragend
42
+ on:dragenter
43
+ on:dragleave
44
+ on:dragover
45
+ on:dragstart
46
+ on:drop
43
47
  on:focus
44
48
  on:focusin
45
49
  on:focusout
@@ -151,17 +155,6 @@ $:
151
155
  background-color: var(--stsv-Error__border-color);
152
156
  }
153
157
 
154
- /* ----- Disabled ----- */
155
-
156
- .sterling-progress.disabled {
157
- background: var(--stsv-Common__background-color--disabled);
158
- border-color: var(--stsv-Common__border-color--disabled);
159
- }
160
-
161
- .sterling-progress.disabled .indicator {
162
- background-color: var(--stsv-Display__color--disabled);
163
- }
164
-
165
158
  @media (prefers-reduced-motion) {
166
159
  .sterling-progress,
167
160
  .indicator {
@@ -7,12 +7,17 @@ declare const __propDef: {
7
7
  percent?: number | undefined;
8
8
  vertical?: boolean | undefined;
9
9
  colorful?: string | undefined;
10
- disabled?: boolean | undefined;
11
10
  };
12
11
  events: {
13
12
  blur: FocusEvent;
14
13
  click: MouseEvent;
15
14
  dblclick: MouseEvent;
15
+ dragend: DragEvent;
16
+ dragenter: DragEvent;
17
+ dragleave: DragEvent;
18
+ dragover: DragEvent;
19
+ dragstart: DragEvent;
20
+ drop: DragEvent;
16
21
  focus: FocusEvent;
17
22
  focusin: FocusEvent;
18
23
  focusout: FocusEvent;