@geoffcox/sterling-svelte 0.0.16 → 0.0.18

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 (119) hide show
  1. package/{buttons/Button.svelte → Button.svelte} +27 -27
  2. package/{inputs/Checkbox.svelte → Checkbox.svelte} +26 -21
  3. package/{inputs/Checkbox.svelte.d.ts → Checkbox.svelte.d.ts} +2 -1
  4. package/{surfaces/Dialog.svelte → Dialog.svelte} +34 -21
  5. package/Field.svelte +257 -0
  6. package/Field.svelte.d.ts +63 -0
  7. package/Field.types.d.ts +1 -0
  8. package/Input.svelte +115 -0
  9. package/{inputs/Input.svelte.d.ts → Input.svelte.d.ts} +8 -3
  10. package/Label.svelte +51 -0
  11. package/Label.svelte.d.ts +41 -0
  12. package/List.constants.d.ts +1 -0
  13. package/List.constants.js +1 -0
  14. package/List.svelte +293 -0
  15. package/List.svelte.d.ts +63 -0
  16. package/List.types.d.ts +6 -0
  17. package/ListItem.svelte +89 -0
  18. package/ListItem.svelte.d.ts +51 -0
  19. package/{containers/Menu.svelte → Menu.svelte} +42 -27
  20. package/{containers/MenuBar.svelte → MenuBar.svelte} +13 -13
  21. package/{buttons/MenuButton.svelte → MenuButton.svelte} +17 -17
  22. package/{buttons/MenuButton.svelte.d.ts → MenuButton.svelte.d.ts} +1 -1
  23. package/{containers/MenuItem.svelte → MenuItem.svelte} +42 -54
  24. package/{containers/MenuItem.svelte.d.ts → MenuItem.svelte.d.ts} +2 -2
  25. package/{containers/MenuSeparator.svelte → MenuSeparator.svelte} +2 -2
  26. package/Menus.types.d.ts +22 -0
  27. package/{containers/Menus.utils.d.ts → Menus.utils.d.ts} +2 -2
  28. package/{containers/Menus.utils.js → Menus.utils.js} +6 -6
  29. package/{display/Progress.svelte → Progress.svelte} +28 -52
  30. package/{display/Progress.svelte.d.ts → Progress.svelte.d.ts} +1 -3
  31. package/Progress.types.d.ts +1 -0
  32. package/{inputs/Radio.svelte → Radio.svelte} +34 -29
  33. package/{inputs/Radio.svelte.d.ts → Radio.svelte.d.ts} +7 -2
  34. package/{inputs/Select.svelte → Select.svelte} +112 -130
  35. package/Select.svelte.d.ts +53 -0
  36. package/{inputs/Slider.svelte → Slider.svelte} +90 -86
  37. package/Slider.svelte.d.ts +51 -0
  38. package/{inputs/Switch.svelte → Switch.svelte} +43 -41
  39. package/Tab.svelte +181 -0
  40. package/{containers/Tab.svelte.d.ts → Tab.svelte.d.ts} +12 -15
  41. package/TabList.svelte +247 -0
  42. package/{containers/TabList.svelte.d.ts → TabList.svelte.d.ts} +21 -21
  43. package/TabList.types.d.ts +7 -0
  44. package/TextArea.svelte +113 -0
  45. package/{inputs/TextArea.svelte.d.ts → TextArea.svelte.d.ts} +3 -6
  46. package/TextArea.types.js +1 -0
  47. package/Tooltip.svelte +182 -0
  48. package/Tooltip.svelte.d.ts +24 -0
  49. package/Tooltip.types.d.ts +3 -0
  50. package/Tooltip.types.js +1 -0
  51. package/Tree.constants.d.ts +2 -0
  52. package/Tree.constants.js +2 -0
  53. package/Tree.svelte +114 -0
  54. package/Tree.svelte.d.ts +24 -0
  55. package/Tree.types.d.ts +28 -0
  56. package/Tree.types.js +1 -0
  57. package/{containers/TreeChevron.svelte → TreeChevron.svelte} +3 -3
  58. package/TreeItem.svelte +276 -0
  59. package/TreeItem.svelte.d.ts +65 -0
  60. package/{containers/TreeItem.svelte → TreeItemDisplay.svelte} +18 -18
  61. package/{containers/TreeItem.svelte.d.ts → TreeItemDisplay.svelte.d.ts} +11 -14
  62. package/{forwardEvents.js → actions/forwardEvents.js} +0 -2
  63. package/index.d.ts +44 -31
  64. package/index.js +40 -25
  65. package/package.json +45 -41
  66. package/theme/darkTheme.js +73 -74
  67. package/theme/lightTheme.js +76 -77
  68. package/containers/List.svelte +0 -249
  69. package/containers/List.svelte.d.ts +0 -68
  70. package/containers/ListItem.svelte +0 -48
  71. package/containers/ListItem.svelte.d.ts +0 -26
  72. package/containers/Menus.types.d.ts +0 -22
  73. package/containers/Tab.svelte +0 -327
  74. package/containers/TabList.svelte +0 -126
  75. package/containers/Tabs.types.d.ts +0 -12
  76. package/containers/Tree.constants.d.ts +0 -2
  77. package/containers/Tree.constants.js +0 -2
  78. package/containers/Tree.svelte +0 -222
  79. package/containers/Tree.svelte.d.ts +0 -50
  80. package/containers/Tree.types.d.ts +0 -47
  81. package/containers/TreeNode.svelte +0 -266
  82. package/containers/TreeNode.svelte.d.ts +0 -43
  83. package/display/Label.svelte +0 -27
  84. package/display/Label.svelte.d.ts +0 -20
  85. package/display/Progress.types.d.ts +0 -1
  86. package/inputs/Input.svelte +0 -129
  87. package/inputs/Select.svelte.d.ts +0 -62
  88. package/inputs/Slider.svelte.d.ts +0 -28
  89. package/inputs/TextArea.svelte +0 -154
  90. package/surfaces/CloseX.svelte +0 -5
  91. package/surfaces/CloseX.svelte.d.ts +0 -23
  92. package/surfaces/Portal.svelte +0 -14
  93. package/surfaces/Portal.svelte.d.ts +0 -21
  94. /package/{buttons/Button.svelte.d.ts → Button.svelte.d.ts} +0 -0
  95. /package/{buttons/Button.types.d.ts → Button.types.d.ts} +0 -0
  96. /package/{buttons/Button.types.js → Button.types.js} +0 -0
  97. /package/{surfaces/Dialog.svelte.d.ts → Dialog.svelte.d.ts} +0 -0
  98. /package/{containers/Menus.types.js → Field.types.js} +0 -0
  99. /package/{containers/Tabs.types.js → List.types.js} +0 -0
  100. /package/{containers/Menu.svelte.d.ts → Menu.svelte.d.ts} +0 -0
  101. /package/{containers/MenuBar.svelte.d.ts → MenuBar.svelte.d.ts} +0 -0
  102. /package/{containers/MenuItemDisplay.svelte → MenuItemDisplay.svelte} +0 -0
  103. /package/{containers/MenuItemDisplay.svelte.d.ts → MenuItemDisplay.svelte.d.ts} +0 -0
  104. /package/{containers/MenuSeparator.svelte.d.ts → MenuSeparator.svelte.d.ts} +0 -0
  105. /package/{containers/Menus.constants.d.ts → Menus.constants.d.ts} +0 -0
  106. /package/{containers/Menus.constants.js → Menus.constants.js} +0 -0
  107. /package/{containers/Tree.types.js → Menus.types.js} +0 -0
  108. /package/{display/Progress.types.js → Progress.types.js} +0 -0
  109. /package/{inputs/Switch.svelte.d.ts → Switch.svelte.d.ts} +0 -0
  110. /package/{containers/Tabs.constants.d.ts → TabList.constants.d.ts} +0 -0
  111. /package/{containers/Tabs.constants.js → TabList.constants.js} +0 -0
  112. /package/{inputs/TextArea.types.js → TabList.types.js} +0 -0
  113. /package/{inputs/TextArea.types.d.ts → TextArea.types.d.ts} +0 -0
  114. /package/{containers/TreeChevron.svelte.d.ts → TreeChevron.svelte.d.ts} +0 -0
  115. /package/{clickOutside.d.ts → actions/clickOutside.d.ts} +0 -0
  116. /package/{clickOutside.js → actions/clickOutside.js} +0 -0
  117. /package/{forwardEvents.d.ts → actions/forwardEvents.d.ts} +0 -0
  118. /package/{portal.d.ts → actions/portal.d.ts} +0 -0
  119. /package/{portal.js → actions/portal.js} +0 -0
@@ -1,92 +1,91 @@
1
1
  import { neutrals } from './colors';
2
2
  export const darkTheme = {
3
3
  // ----- Common ---- //
4
- '--Common__background-color': neutrals.neutral15,
5
- '--Common__border-color': neutrals.neutral92,
6
- '--Common__border-radius': '0',
7
- '--Common__border-style': 'solid',
8
- '--Common__border-width': '2px',
9
- '--Common__color': neutrals.neutral100,
4
+ '--stsv-Common__background-color': neutrals.neutral15,
5
+ '--stsv-Common__border-color': neutrals.neutral92,
6
+ '--stsv-Common__border-radius': '0',
7
+ '--stsv-Common__border-style': 'solid',
8
+ '--stsv-Common__border-width': '2px',
9
+ '--stsv-Common__color': neutrals.neutral100,
10
10
  // hover
11
- '--Common__background-color--hover': neutrals.neutral15,
12
- '--Common__border-color--hover': neutrals.neutral96,
13
- '--Common__color--hover': neutrals.neutral100,
11
+ '--stsv-Common__background-color--hover': neutrals.neutral15,
12
+ '--stsv-Common__border-color--hover': neutrals.neutral96,
13
+ '--stsv-Common__color--hover': neutrals.neutral100,
14
14
  // focus
15
- '--Common__background-color--focus': neutrals.neutral45,
16
- '--Common__border-color--focus': neutrals.neutral100,
17
- '--Common__color--focus': neutrals.neutral100,
15
+ '--stsv-Common__background-color--focus': neutrals.neutral45,
16
+ '--stsv-Common__border-color--focus': neutrals.neutral100,
17
+ '--stsv-Common__color--focus': neutrals.neutral100,
18
18
  // outline
19
- '--Common__outline-color': neutrals.neutral100,
20
- '--Common__outline-offset': '0',
21
- '--Common__outline-style': 'solid',
22
- '--Common__outline-width': '2px',
19
+ '--stsv-Common__outline-color': neutrals.neutral100,
20
+ '--stsv-Common__outline-offset': '0',
21
+ '--stsv-Common__outline-style': 'solid',
22
+ '--stsv-Common__outline-width': '2px',
23
23
  // disabled
24
- '--Common__background-color--disabled': neutrals.neutral45,
25
- '--Common__border-color--disabled': neutrals.neutral92,
26
- '--Common__color--disabled': neutrals.neutral92,
24
+ '--stsv-Common__background-color--disabled': neutrals.neutral45,
25
+ '--stsv-Common__border-color--disabled': neutrals.neutral92,
26
+ '--stsv-Common__color--disabled': neutrals.neutral60,
27
27
  // ----- Layer ---- //
28
- '--Layer__background-color--1': neutrals.neutral20,
29
- '--Layer__color--1': neutrals.neutral100,
30
- '--Layer__background-color--2': neutrals.neutral10,
31
- '--Layer__color--2': neutrals.neutral100,
32
- '--Layer__background-color--3': neutrals.neutral45,
33
- '--Layer__color--3': neutrals.neutral100,
28
+ '--stsv-Layer__background-color--1': neutrals.neutral20,
29
+ '--stsv-Layer__color--1': neutrals.neutral100,
30
+ '--stsv-Layer__background-color--2': neutrals.neutral10,
31
+ '--stsv-Layer__color--2': neutrals.neutral100,
32
+ '--stsv-Layer__background-color--3': neutrals.neutral45,
33
+ '--stsv-Layer__color--3': neutrals.neutral100,
34
34
  // ----- Button ----- //
35
- '--Button__background-color': neutrals.neutral45,
36
- '--Button__border-color': neutrals.neutral92,
37
- '--Button__border-radius': '8px',
38
- '--Button__border-style': 'solid',
39
- '--Button__border-width': '2px',
40
- '--Button__color': neutrals.neutral100,
35
+ '--stsv-Button__background-color': neutrals.neutral30,
36
+ '--stsv-Button__border-color': neutrals.neutral92,
37
+ '--stsv-Button__border-radius': '8px',
38
+ '--stsv-Button__border-style': 'solid',
39
+ '--stsv-Button__border-width': '2px',
40
+ '--stsv-Button__color': neutrals.neutral100,
41
41
  // hover
42
- '--Button__background-color--hover': neutrals.neutral45,
43
- '--Button__border-color--hover': neutrals.neutral96,
44
- '--Button__color--hover': neutrals.neutral100,
42
+ '--stsv-Button__background-color--hover': neutrals.neutral45,
43
+ '--stsv-Button__border-color--hover': neutrals.neutral96,
44
+ '--stsv-Button__color--hover': neutrals.neutral100,
45
45
  // active
46
- '--Button__background-color--active': neutrals.neutral60,
47
- '--Button__border-color--active': neutrals.neutral98,
48
- '--Button__color--active': neutrals.neutral98,
46
+ '--stsv-Button__background-color--active': neutrals.neutral60,
47
+ '--stsv-Button__border-color--active': neutrals.neutral98,
48
+ '--stsv-Button__color--active': neutrals.neutral98,
49
49
  // focus
50
- '--Button__background-color--focus': neutrals.neutral45,
51
- '--Button__border-color--focus': neutrals.neutral100,
52
- '--Button__color--focus': neutrals.neutral100,
53
- // disabled
54
- '--Button__background-color--disabled': neutrals.neutral75,
55
- '--Button__border-color--disabled': neutrals.neutral92,
56
- '--Button__color--disabled': neutrals.neutral92,
50
+ '--stsv-Button__background-color--focus': neutrals.neutral45,
51
+ '--stsv-Button__border-color--focus': neutrals.neutral100,
52
+ '--stsv-Button__color--focus': neutrals.neutral100,
57
53
  // ----- Input ----- //
58
- '--Input__background-color': neutrals.neutral30,
59
- '--Input__border-color': neutrals.neutral92,
60
- '--Input__border-radius': '3px',
61
- '--Input__border-style': 'solid',
62
- '--Input__border-width': '2px',
63
- '--Input__color': neutrals.neutral100,
54
+ '--stsv-Input__background-color': neutrals.neutral30,
55
+ '--stsv-Input__border-color': neutrals.neutral92,
56
+ '--stsv-Input__border-radius': '3px',
57
+ '--stsv-Input__border-style': 'solid',
58
+ '--stsv-Input__border-width': '2px',
59
+ '--stsv-Input__color': neutrals.neutral100,
64
60
  // hover
65
- '--Input__background-color--hover': neutrals.neutral15,
66
- '--Input__border-color--hover': neutrals.neutral96,
67
- '--Input__color--hover': neutrals.neutral100,
61
+ '--stsv-Input__background-color--hover': neutrals.neutral15,
62
+ '--stsv-Input__border-color--hover': neutrals.neutral96,
63
+ '--stsv-Input__color--hover': neutrals.neutral100,
68
64
  // focus
69
- '--Input__background-color--focus': neutrals.neutral15,
70
- '--Input__border-color--focus': neutrals.neutral100,
71
- '--Input__color--focus': neutrals.neutral100,
65
+ '--stsv-Input__background-color--focus': neutrals.neutral15,
66
+ '--stsv-Input__border-color--focus': neutrals.neutral100,
67
+ '--stsv-Input__color--focus': neutrals.neutral100,
72
68
  // selected
73
- '--Input__background-color--selected': neutrals.neutral60,
74
- '--Input__border-color--selected': neutrals.neutral98,
75
- '--Input__color--selected': neutrals.neutral100,
76
- // disabled
77
- '--Input__background-color--disabled': neutrals.neutral45,
78
- '--Input__border-color--disabled': neutrals.neutral85,
79
- '--Input__color--disabled': neutrals.neutral85,
69
+ '--stsv-Input__background-color--selected': neutrals.neutral60,
70
+ '--stsv-Input__border-color--selected': neutrals.neutral98,
71
+ '--stsv-Input__color--selected': neutrals.neutral100,
80
72
  // ----- Display ----- //
81
- '--Display__background-color': neutrals.neutral30,
82
- '--Display__border-color': neutrals.neutral92,
83
- '--Display__color': neutrals.neutral100,
84
- '--Display__color--subtle': neutrals.neutral96,
85
- '--Display__color--faint': neutrals.neutral45,
86
- '--Display__color--disabled': neutrals.neutral45,
87
- '--Display__color--info': '#025E73',
88
- '--Display__color--progress': '#0099DD',
89
- '--Display__color--success': '#03A64A',
90
- '--Display__color--warning': '#F2A71B',
91
- '--Display__color--error': '#A62B1F'
73
+ '--stsv-Display__background-color': neutrals.neutral20,
74
+ '--stsv-Display__border-color': neutrals.neutral92,
75
+ '--stsv-Display__color': neutrals.neutral80,
76
+ '--stsv-Display__color--subtle': neutrals.neutral96,
77
+ '--stsv-Display__color--faint': neutrals.neutral45,
78
+ '--stsv-Display__color--disabled': neutrals.neutral45,
79
+ '--stsv-Info__background-color': 'hsl(198, 100%, 10%)',
80
+ '--stsv-Info__border-color': 'hsl(198, 100%, 40%)',
81
+ '--stsv-Info__color': 'hsl(198, 80%, 50%)',
82
+ '--stsv-Success__background-color': 'hsl(146, 100%, 10%)',
83
+ '--stsv-Success__border-color': 'hsl(146, 100%, 30%)',
84
+ '--stsv-Success__color': 'hsl(146, 100%, 40%)',
85
+ '--stsv-Warning__background-color': 'hsl(39, 100%, 10%)',
86
+ '--stsv-Warning__border-color': 'hsl(39, 100%, 45%)',
87
+ '--stsv-Warning__color': 'hsl(39, 100%, 50%)',
88
+ '--stsv-Error__background-color': 'hsl(5, 100%, 10%)',
89
+ '--stsv-Error__border-color': 'hsl(5, 100%, 40%)',
90
+ '--stsv-Error__color': 'hsl(5, 100%, 50%)'
92
91
  };
@@ -1,92 +1,91 @@
1
1
  import { neutrals } from './colors';
2
2
  export const lightTheme = {
3
- // ----- Common ---- //
4
- '--Common__background-color': neutrals.neutral100,
5
- '--Common__border-color': neutrals.neutral60,
6
- '--Common__border-radius': '0',
7
- '--Common__border-style': 'solid',
8
- '--Common__border-width': '2px',
9
- '--Common__color': neutrals.neutral15,
3
+ // ----- Common (18) ---- //
4
+ '--stsv-Common__background-color': neutrals.neutral100,
5
+ '--stsv-Common__border-color': neutrals.neutral60,
6
+ '--stsv-Common__border-radius': '0',
7
+ '--stsv-Common__border-style': 'solid',
8
+ '--stsv-Common__border-width': '2px',
9
+ '--stsv-Common__color': neutrals.neutral15,
10
10
  // hover
11
- '--Common__background-color--hover': neutrals.neutral100,
12
- '--Common__border-color--hover': neutrals.neutral45,
13
- '--Common__color--hover': neutrals.neutral15,
11
+ '--stsv-Common__background-color--hover': neutrals.neutral100,
12
+ '--stsv-Common__border-color--hover': neutrals.neutral45,
13
+ '--stsv-Common__color--hover': neutrals.neutral15,
14
14
  // focus
15
- '--Common__background-color--focus': neutrals.neutral96,
16
- '--Common__border-color--focus': neutrals.neutral0,
17
- '--Common__color--focus': neutrals.neutral15,
15
+ '--stsv-Common__background-color--focus': neutrals.neutral96,
16
+ '--stsv-Common__border-color--focus': neutrals.neutral0,
17
+ '--stsv-Common__color--focus': neutrals.neutral15,
18
18
  // outline
19
- '--Common__outline-color': neutrals.neutral15,
20
- '--Common__outline-offset': '0',
21
- '--Common__outline-style': 'solid',
22
- '--Common__outline-width': '2px',
19
+ '--stsv-Common__outline-color': neutrals.neutral15,
20
+ '--stsv-Common__outline-offset': '0',
21
+ '--stsv-Common__outline-style': 'solid',
22
+ '--stsv-Common__outline-width': '2px',
23
23
  // disabled
24
- '--Common__background-color--disabled': neutrals.neutral96,
25
- '--Common__border-color--disabled': neutrals.neutral75,
26
- '--Common__color--disabled': neutrals.neutral75,
24
+ '--stsv-Common__background-color--disabled': neutrals.neutral96,
25
+ '--stsv-Common__border-color--disabled': neutrals.neutral75,
26
+ '--stsv-Common__color--disabled': neutrals.neutral75,
27
27
  // ----- Layer ---- //
28
- '--Layer__background-color--1': neutrals.neutral98,
29
- '--Layer__color--1': neutrals.neutral15,
30
- '--Layer__background-color--2': neutrals.neutral96,
31
- '--Layer__color--2': neutrals.neutral15,
32
- '--Layer__background-color--3': neutrals.neutral92,
33
- '--Layer__color--3': neutrals.neutral15,
34
- // ----- Button ----- //
35
- '--Button__background-color': neutrals.neutral96,
36
- '--Button__border-color': neutrals.neutral60,
37
- '--Button__border-radius': '8px',
38
- '--Button__border-style': 'solid',
39
- '--Button__border-width': '2px',
40
- '--Button__color': neutrals.neutral15,
28
+ '--stsv-Layer__background-color--1': neutrals.neutral98,
29
+ '--stsv-Layer__color--1': neutrals.neutral15,
30
+ '--stsv-Layer__background-color--2': neutrals.neutral96,
31
+ '--stsv-Layer__color--2': neutrals.neutral15,
32
+ '--stsv-Layer__background-color--3': neutrals.neutral92,
33
+ '--stsv-Layer__color--3': neutrals.neutral15,
34
+ // ----- Button (15) ----- //
35
+ '--stsv-Button__background-color': neutrals.neutral96,
36
+ '--stsv-Button__border-color': neutrals.neutral60,
37
+ '--stsv-Button__border-radius': '8px',
38
+ '--stsv-Button__border-style': 'solid',
39
+ '--stsv-Button__border-width': '2px',
40
+ '--stsv-Button__color': neutrals.neutral15,
41
41
  // hover
42
- '--Button__background-color--hover': neutrals.neutral96,
43
- '--Button__border-color--hover': neutrals.neutral45,
44
- '--Button__color--hover': neutrals.neutral15,
42
+ '--stsv-Button__background-color--hover': neutrals.neutral96,
43
+ '--stsv-Button__border-color--hover': neutrals.neutral45,
44
+ '--stsv-Button__color--hover': neutrals.neutral15,
45
45
  // active
46
- '--Button__background-color--active': neutrals.neutral92,
47
- '--Button__border-color--active': neutrals.neutral30,
48
- '--Button__color--active': neutrals.neutral30,
46
+ '--stsv-Button__background-color--active': neutrals.neutral92,
47
+ '--stsv-Button__border-color--active': neutrals.neutral30,
48
+ '--stsv-Button__color--active': neutrals.neutral30,
49
49
  // focus
50
- '--Button__background-color--focus': neutrals.neutral96,
51
- '--Button__border-color--focus': neutrals.neutral0,
52
- '--Button__color--focus': neutrals.neutral15,
53
- // disabled
54
- '--Button__background-color--disabled': neutrals.neutral85,
55
- '--Button__border-color--disabled': neutrals.neutral60,
56
- '--Button__color--disabled': neutrals.neutral60,
57
- // ----- Input ----- //
58
- '--Input__background-color': neutrals.neutral98,
59
- '--Input__border-color': neutrals.neutral60,
60
- '--Input__border-radius': '3px',
61
- '--Input__border-style': 'solid',
62
- '--Input__border-width': '2px',
63
- '--Input__color': neutrals.neutral15,
50
+ '--stsv-Button__background-color--focus': neutrals.neutral96,
51
+ '--stsv-Button__border-color--focus': neutrals.neutral0,
52
+ '--stsv-Button__color--focus': neutrals.neutral15,
53
+ // ----- Input (15) ----- //
54
+ '--stsv-Input__background-color': neutrals.neutral98,
55
+ '--stsv-Input__border-color': neutrals.neutral60,
56
+ '--stsv-Input__border-radius': '3px',
57
+ '--stsv-Input__border-style': 'solid',
58
+ '--stsv-Input__border-width': '2px',
59
+ '--stsv-Input__color': neutrals.neutral15,
64
60
  // hover
65
- '--Input__background-color--hover': neutrals.neutral100,
66
- '--Input__border-color--hover': neutrals.neutral45,
67
- '--Input__color--hover': neutrals.neutral15,
61
+ '--stsv-Input__background-color--hover': neutrals.neutral100,
62
+ '--stsv-Input__border-color--hover': neutrals.neutral45,
63
+ '--stsv-Input__color--hover': neutrals.neutral15,
68
64
  // focus
69
- '--Input__background-color--focus': neutrals.neutral100,
70
- '--Input__border-color--focus': neutrals.neutral15,
71
- '--Input__color--focus': neutrals.neutral15,
65
+ '--stsv-Input__background-color--focus': neutrals.neutral100,
66
+ '--stsv-Input__border-color--focus': neutrals.neutral15,
67
+ '--stsv-Input__color--focus': neutrals.neutral15,
72
68
  // selected
73
- '--Input__background-color--selected': neutrals.neutral92,
74
- '--Input__border-color--selected': neutrals.neutral30,
75
- '--Input__color--selected': neutrals.neutral15,
76
- // disabled
77
- '--Input__background-color--disabled': neutrals.neutral96,
78
- '--Input__border-color--disabled': neutrals.neutral75,
79
- '--Input__color--disabled': neutrals.neutral75,
69
+ '--stsv-Input__background-color--selected': neutrals.neutral92,
70
+ '--stsv-Input__border-color--selected': neutrals.neutral30,
71
+ '--stsv-Input__color--selected': neutrals.neutral15,
80
72
  // ----- Display ----- //
81
- '--Display__background-color': neutrals.neutral92,
82
- '--Display__border-color': neutrals.neutral60,
83
- '--Display__color': neutrals.neutral15,
84
- '--Display__color--subtle': neutrals.neutral30,
85
- '--Display__color--faint': neutrals.neutral85,
86
- '--Display__color--disabled': neutrals.neutral85,
87
- '--Display__color--info': '#025E73',
88
- '--Display__color--progress': '#0099DD',
89
- '--Display__color--success': '#03A64A',
90
- '--Display__color--warning': '#F2A71B',
91
- '--Display__color--error': '#A62B1F'
73
+ '--stsv-Display__background-color': neutrals.neutral92,
74
+ '--stsv-Display__border-color': neutrals.neutral30,
75
+ '--stsv-Display__color': neutrals.neutral15,
76
+ '--stsv-Display__color--subtle': neutrals.neutral45,
77
+ '--stsv-Display__color--faint': neutrals.neutral85,
78
+ '--stsv-Display__color--disabled': neutrals.neutral85,
79
+ '--stsv-Info__background-color': 'hsl(198, 100%, 90%)',
80
+ '--stsv-Info__border-color': 'hsl(198, 100%, 40%)',
81
+ '--stsv-Info__color': 'hsl(198, 80%, 33%)',
82
+ '--stsv-Success__background-color': 'hsl(146, 100%, 90%)',
83
+ '--stsv-Success__border-color': 'hsl(146, 100%, 30%)',
84
+ '--stsv-Success__color': 'hsl(146, 80%, 25%)',
85
+ '--stsv-Warning__background-color': 'hsl(39, 100%, 80%)',
86
+ '--stsv-Warning__border-color': 'hsl(39, 100%, 45%)',
87
+ '--stsv-Warning__color': 'hsl(39, 100%, 25%)',
88
+ '--stsv-Error__background-color': 'hsl(5, 100%, 90%)',
89
+ '--stsv-Error__border-color': 'hsl(5, 100%, 40%)',
90
+ '--stsv-Error__color': 'hsl(5, 80%, 40%)'
92
91
  };
@@ -1,249 +0,0 @@
1
- <script>import { createEventDispatcher } from "svelte";
2
- import { v4 as uuid } from "uuid";
3
- import Label from "../display/Label.svelte";
4
- import ListItem from "./ListItem.svelte";
5
- export let disabled = false;
6
- export let items = [];
7
- export let horizontal = false;
8
- export let selectedIndex = -1;
9
- export let selectedItem = void 0;
10
- export let composed = false;
11
- $: {
12
- selectedItem = items[selectedIndex];
13
- }
14
- const inputId = uuid();
15
- let listRef;
16
- let itemRefs = {};
17
- const dispatch = createEventDispatcher();
18
- const raiseItemSelected = (index) => {
19
- dispatch("itemSelected", { index, item: items[index] });
20
- };
21
- export const focusSelectedItem = () => {
22
- listRef.focus();
23
- const selectedRef = itemRefs[selectedIndex];
24
- selectedRef?.focus();
25
- selectedRef?.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
26
- };
27
- $:
28
- canSelectPreviousItem = items.length > 0 && selectedIndex !== 0;
29
- $:
30
- canSelectNextItem = items.length > 0 && selectedIndex !== items.length - 1;
31
- export const selectPreviousItem = () => {
32
- if (canSelectPreviousItem) {
33
- selectedIndex = Math.max(0, selectedIndex - 1);
34
- }
35
- };
36
- export const selectNextItem = () => {
37
- if (canSelectNextItem) {
38
- selectedIndex = Math.min(items.length - 1, selectedIndex + 1);
39
- }
40
- };
41
- export const selectItem = (item) => {
42
- const index = items.indexOf(item);
43
- if (index !== -1) {
44
- selectedIndex = index;
45
- }
46
- };
47
- $: {
48
- raiseItemSelected(selectedIndex);
49
- }
50
- $: {
51
- const selectedRef = itemRefs[selectedIndex];
52
- selectedRef?.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
53
- }
54
- const onItemClick = (index) => {
55
- if (!disabled) {
56
- selectedIndex = index;
57
- }
58
- };
59
- const onArrowSelectPrevious = (event) => {
60
- event.preventDefault();
61
- event.stopPropagation();
62
- selectPreviousItem();
63
- };
64
- const onArrowSelectNext = (event) => {
65
- event.preventDefault();
66
- event.stopPropagation();
67
- selectNextItem();
68
- };
69
- const onKeydown = (event) => {
70
- if (!disabled && !event.ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey) {
71
- switch (event.key) {
72
- case "ArrowLeft":
73
- if (horizontal) {
74
- onArrowSelectPrevious(event);
75
- }
76
- break;
77
- case "ArrowRight":
78
- if (horizontal) {
79
- onArrowSelectNext(event);
80
- }
81
- break;
82
- case "ArrowUp":
83
- if (!horizontal) {
84
- onArrowSelectPrevious(event);
85
- }
86
- break;
87
- case "ArrowDown":
88
- if (!horizontal) {
89
- onArrowSelectNext(event);
90
- }
91
- break;
92
- default:
93
- break;
94
- }
95
- }
96
- };
97
- </script>
98
-
99
- <!--
100
- @component
101
- A list of items where a single item can be selected.
102
- -->
103
- <!-- svelte-ignore a11y-no-noninteractive-tabindex -->
104
- <div class="sterling-list" class:horizontal class:disabled class:composed tabindex={0}>
105
- {#if $$slots.label}
106
- <Label {disabled} for={inputId}>
107
- <slot name="label" />
108
- </Label>
109
- {/if}
110
- <div
111
- bind:this={listRef}
112
- class="list"
113
- class:disabled
114
- class:horizontal
115
- role="listbox"
116
- tabindex={!disabled ? 0 : undefined}
117
- on:blur
118
- on:click
119
- on:copy
120
- on:cut
121
- on:dblclick
122
- on:focus
123
- on:focusin
124
- on:focusout
125
- on:keydown
126
- on:keypress
127
- on:keyup
128
- on:mousedown
129
- on:mouseenter
130
- on:mouseleave
131
- on:mousemove
132
- on:mouseover
133
- on:mouseout
134
- on:mouseup
135
- on:scroll
136
- on:wheel
137
- on:paste
138
- on:keydown={onKeydown}
139
- {...$$restProps}
140
- >
141
- {#each items as item, index (item)}
142
- {@const selected = selectedIndex === index}
143
- <!-- svelte-ignore a11y-click-events-have-key-events -->
144
- <div
145
- bind:this={itemRefs[index]}
146
- aria-selected={disabled ? undefined : selected}
147
- class="list-item"
148
- data-index={index + 1}
149
- role="option"
150
- on:click={() => onItemClick(index)}
151
- >
152
- <slot name="item" {disabled} {index} {item} {selected}>
153
- <ListItem {disabled} {selected} {index} {item}>
154
- <slot {disabled} {index} {item} {selected}>
155
- {item}
156
- </slot>
157
- </ListItem>
158
- </slot>
159
- </div>
160
- {/each}
161
- </div>
162
- </div>
163
-
164
- <style>
165
- .sterling-list {
166
- background-color: var(--Common__background-color);
167
- border-color: var(--Common__border-color);
168
- border-radius: var(--Common__border-radius);
169
- border-style: var(--Common__border-style);
170
- border-width: var(--Common__border-width);
171
- box-sizing: border-box;
172
- color: var(--Common__color);
173
- display: grid;
174
- grid-template-columns: 1fr;
175
- grid-template-rows: auto 1fr;
176
- height: 100%;
177
- margin: 0;
178
- overflow: hidden;
179
- padding: 0;
180
- transition: background-color 250ms, color 250ms, border-color 250ms;
181
- }
182
-
183
- .sterling-list.horizontal {
184
- height: unset;
185
- width: 100%;
186
- }
187
-
188
- .sterling-list:hover {
189
- border-color: var(--Common__border-color--hover);
190
- color: var(--Common__color--hover);
191
- }
192
-
193
- .sterling-list:focus-within {
194
- border-color: var(--Common__border-color--focus);
195
- color: var(--Common__color--focus);
196
- outline-color: var(--Common__outline-color);
197
- outline-offset: var(--Common__outline-offset);
198
- outline-style: var(--Common__outline-style);
199
- outline-width: var(--Common__outline-width);
200
- }
201
-
202
- .sterling-list.disabled {
203
- background-color: var(--Common__background-color--disabled);
204
- border-color: var(---Common__border-color--disabled);
205
- color: var(--Common__color--disabled);
206
- cursor: not-allowed;
207
- }
208
-
209
- .sterling-list.composed,
210
- .sterling-list:hover.composed,
211
- .sterling-list:focus-visible.composed,
212
- .sterling-list.disabled.composed {
213
- background: none;
214
- border: none;
215
- outline: none;
216
- }
217
-
218
- .list {
219
- display: flex;
220
- flex-direction: column;
221
- flex-wrap: nowrap;
222
- grid-row: 2 / span 1;
223
- overflow-x: hidden;
224
- overflow-y: scroll;
225
- outline: none;
226
- position: relative;
227
- }
228
-
229
- .list.horizontal {
230
- flex-direction: row;
231
- overflow-x: scroll;
232
- overflow-y: hidden;
233
- }
234
-
235
- .sterling-list > :global(label) {
236
- font-size: 0.7em;
237
- margin: 0.5em 0.7em;
238
- }
239
-
240
- .sterling-list > :global(label):empty {
241
- margin: 0;
242
- }
243
-
244
- @media (prefers-reduced-motion) {
245
- .sterling-list {
246
- transition: none;
247
- }
248
- }
249
- </style>
@@ -1,68 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare class __sveltets_Render<T> {
3
- props(): {
4
- [x: string]: any;
5
- disabled?: boolean | undefined;
6
- items?: T[] | undefined;
7
- horizontal?: boolean | undefined;
8
- selectedIndex?: number | undefined;
9
- selectedItem?: T | undefined;
10
- composed?: boolean | undefined;
11
- focusSelectedItem?: (() => void) | undefined;
12
- selectPreviousItem?: (() => void) | undefined;
13
- selectNextItem?: (() => void) | undefined;
14
- selectItem?: ((item: T) => void) | undefined;
15
- };
16
- events(): {
17
- blur: FocusEvent;
18
- click: MouseEvent;
19
- copy: ClipboardEvent;
20
- cut: ClipboardEvent;
21
- dblclick: MouseEvent;
22
- focus: FocusEvent;
23
- focusin: FocusEvent;
24
- focusout: FocusEvent;
25
- keydown: KeyboardEvent;
26
- keypress: KeyboardEvent;
27
- keyup: KeyboardEvent;
28
- mousedown: MouseEvent;
29
- mouseenter: MouseEvent;
30
- mouseleave: MouseEvent;
31
- mousemove: MouseEvent;
32
- mouseover: MouseEvent;
33
- mouseout: MouseEvent;
34
- mouseup: MouseEvent;
35
- scroll: Event;
36
- wheel: WheelEvent;
37
- paste: ClipboardEvent;
38
- itemSelected: CustomEvent<any>;
39
- } & {
40
- [evt: string]: CustomEvent<any>;
41
- };
42
- slots(): {
43
- label: {};
44
- item: {
45
- disabled: boolean;
46
- index: any;
47
- item: T;
48
- selected: any;
49
- };
50
- default: {
51
- disabled: boolean;
52
- index: any;
53
- item: T;
54
- selected: any;
55
- };
56
- };
57
- }
58
- export type ListProps<T> = ReturnType<__sveltets_Render<T>['props']>;
59
- export type ListEvents<T> = ReturnType<__sveltets_Render<T>['events']>;
60
- export type ListSlots<T> = ReturnType<__sveltets_Render<T>['slots']>;
61
- /** A list of items where a single item can be selected. */
62
- export default class List<T> extends SvelteComponentTyped<ListProps<T>, ListEvents<T>, ListSlots<T>> {
63
- get focusSelectedItem(): () => void;
64
- get selectPreviousItem(): () => void;
65
- get selectNextItem(): () => void;
66
- get selectItem(): (item: T) => void;
67
- }
68
- export {};