@viasat/beam-styles 2.2.0 → 2.8.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.
@@ -0,0 +1,176 @@
1
+ @use 'sass:map';
2
+ @use '../utils/constants.scss';
3
+ @use '../utils/tokens.scss' as tokens;
4
+ @use '../utils/mixins.scss' as mixins;
5
+ @use '../utils/cursors.scss' as cursors;
6
+ @use './icon.vars.scss' as iconVars;
7
+
8
+ @import '@viasat/beam-tokens/components/Input';
9
+
10
+ $searchBaseClass: '#{constants.$prefix}search';
11
+
12
+ $labelSpaceBottom: '--#{constants.$prefix}label-space-bottom';
13
+
14
+ $searchCursor: '--#{constants.$prefix}text-field-cursor';
15
+ $searchInputCursor: '--#{constants.$prefix}text-field-input-cursor';
16
+
17
+ $searchInputMinWidth: 3rem;
18
+
19
+ $stateStyleTokens: (
20
+ error: (
21
+ textColor: tokens.$bm-comp-input-color-text,
22
+ backgroundColor: tokens.$bm-comp-input-color-bg,
23
+ borderColor: tokens.$bm-comp-input-color-border-error,
24
+ searchIconColor: tokens.$bm-comp-input-color-icon,
25
+ ),
26
+ read-only: (
27
+ textColor: tokens.$bm-comp-input-color-text,
28
+ backgroundColor: tokens.$bm-comp-input-color-bg-disabled,
29
+ svgColor: tokens.$bm-comp-input-color-icon,
30
+ borderColor: tokens.$bm-comp-input-color-border-disabled,
31
+ searchIconColor: tokens.$bm-comp-input-color-icon,
32
+ ),
33
+ disabled: (
34
+ textColor: tokens.$bm-comp-input-color-text-disabled,
35
+ svgColor: tokens.$bm-comp-input-color-text-disabled,
36
+ backgroundColor: tokens.$bm-comp-input-color-bg-disabled,
37
+ borderColor: tokens.$bm-comp-input-color-border-disabled,
38
+ searchIconColor: tokens.$bm-comp-input-color-icon-disabled,
39
+ ),
40
+ );
41
+
42
+ .#{$searchBaseClass} {
43
+ @include cursors.applyTextCursors();
44
+ max-width: tokens.$bm-comp-input-size-field-width;
45
+ position: relative;
46
+
47
+ #{$labelSpaceBottom}: #{tokens.$bm-comp-label-space-bottom};
48
+
49
+ &--fluid {
50
+ max-width: 100%;
51
+ }
52
+
53
+ &__field {
54
+ #{$searchInputCursor}: text;
55
+ display: flex;
56
+ flex-direction: row;
57
+ align-items: center;
58
+ position: relative;
59
+ cursor: var(#{$searchCursor}, pointer);
60
+ user-select: none;
61
+ font: tokens.$bm-comp-input-typo-default;
62
+ min-height: tokens.$bm-comp-input-size-field-md-height;
63
+ gap: tokens.$bm-comp-input-space-field-gap;
64
+ #{iconVars.$iconColor}: tokens.$bm-comp-input-color-icon;
65
+ #{iconVars.$iconSize}: tokens.$bm-comp-input-size-field-icon;
66
+
67
+ &__input {
68
+ display: flex;
69
+ align-items: center;
70
+ flex: 0 0 auto;
71
+ gap: tokens.$bm-comp-input-space-field-gap;
72
+ background: transparent;
73
+ min-height: calc(tokens.$bm-comp-input-size-field-md-height - 2 * tokens.$bm-comp-input-space-field-y);
74
+ line-height: calc(tokens.$bm-comp-input-size-field-md-height - 2 * tokens.$bm-comp-input-space-field-y);
75
+
76
+ &::-webkit-search-decoration,
77
+ &::-webkit-search-cancel-button,
78
+ &::-webkit-search-results-button,
79
+ &::-webkit-search-results-decoration {
80
+ -webkit-appearance:none;
81
+ }
82
+
83
+ &::placeholder {
84
+ color: tokens.$bm-comp-input-color-text-placeholder;
85
+ }
86
+
87
+ flex: 1;
88
+ cursor: var(#{$searchInputCursor}, pointer);
89
+
90
+ text-overflow: ellipsis;
91
+
92
+ border: 0;
93
+ outline: 0;
94
+ margin: 0;
95
+ padding: 0;
96
+ font: tokens.$bm-comp-input-typo-default;
97
+
98
+ width: 100%;
99
+ min-width: $searchInputMinWidth;
100
+ }
101
+ }
102
+
103
+ &--disabled, &--disabled &__field {
104
+ #{$searchCursor}: not-allowed;
105
+ #{$searchInputCursor}: not-allowed;
106
+ }
107
+
108
+ @each $state, $styleTokens in $stateStyleTokens {
109
+ &--#{$state} &__field {
110
+ color: map.get($styleTokens, textColor);
111
+ border-color: map.get($styleTokens, borderColor);
112
+ background-color: map.get($styleTokens, backgroundColor);
113
+ #{iconVars.$iconColor}: map.get($styleTokens, searchIconColor);
114
+ }
115
+
116
+ &--#{$state} &__field &__content {
117
+ @if ($state == disabled) {
118
+ opacity: tokens.$bm-sem-opacity-disabled;
119
+ }
120
+
121
+ svg,
122
+ ::slotted([slot*='content']) {
123
+ color: map.get($styleTokens, svgColor);
124
+ }
125
+ }
126
+ }
127
+
128
+ &--disabled &__field &__field__input {
129
+ color: tokens.$bm-comp-input-color-text-disabled;
130
+
131
+ &::placeholder {
132
+ color: tokens.$bm-comp-input-color-text-disabled;
133
+ }
134
+ }
135
+
136
+ &__field {
137
+ border: tokens.$bm-comp-input-border-width-field-default solid
138
+ tokens.$bm-comp-input-color-border;
139
+ border-radius: tokens.$bm-comp-input-radius-field;
140
+
141
+ cursor: var(#{$searchInputCursor}, pointer);
142
+ box-shadow: tokens.$bm-comp-input-shadow-field;
143
+ background-color: tokens.$bm-comp-input-color-bg;
144
+ transform: translate3d(
145
+ tokens.$bm-sem-space-0,
146
+ tokens.$bm-sem-space-0,
147
+ tokens.$bm-sem-space-0
148
+ );
149
+
150
+ padding-block: tokens.$bm-comp-input-space-field-y;
151
+ padding-inline: tokens.$bm-comp-input-space-field-x;
152
+
153
+ min-height: tokens.$bm-comp-input-size-field-md-height;
154
+
155
+ &:focus-within {
156
+ @include mixins.simulated-inset-outline(
157
+ tokens.$bm-sem-border-width-focus,
158
+ solid,
159
+ tokens.$bm-sem-color-border-focus,
160
+ calc(0px - #{tokens.$bm-sem-size-focus-offset})
161
+ );
162
+ }
163
+ }
164
+
165
+ &__field &__content {
166
+ display: flex;
167
+ align-items: center;
168
+
169
+ svg,
170
+ ::slotted([slot*='content']) {
171
+ color: tokens.$bm-comp-input-color-icon;
172
+ width: tokens.$bm-comp-input-size-field-icon;
173
+ height: tokens.$bm-comp-input-size-field-icon;
174
+ }
175
+ }
176
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viasat/beam-styles",
3
- "version": "2.2.0",
3
+ "version": "2.8.0",
4
4
  "description": "SCSS modules and component styles for the Beam Design System",
5
5
  "license": "MIT",
6
6
  "author": "Viasat",