@everchron/ec-shards 7.2.5 → 7.2.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everchron/ec-shards",
3
- "version": "7.2.5",
3
+ "version": "7.2.6",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -4,12 +4,17 @@
4
4
  :class="typeClass" tabindex="0"
5
5
  @keydown.delete="$emit('remove', $event)">
6
6
 
7
- <div v-if="icon || operator" class="symbol">
7
+ <div v-if="icon || operator || operatorSwitch" class="symbol">
8
8
  <ecs-icon :type="icon" size="20" color="#FFF" />
9
- <div v-if="operator && !operatorSelect" class="operator">{{ operator }}</div>
9
+ <div v-if="operator && !operatorSelect && !operatorSwitch" class="operator">{{ operator }}</div>
10
10
  <ecs-select-text v-if="operatorSelect" @change="handleOperatorChange" size="xsml" :value="operator" class="operator-select">
11
11
  <option v-for="option in operatorSelectOptions" :value="option" :key="option">{{ option }}</option>
12
12
  </ecs-select-text>
13
+ <button v-if="operatorSwitch" @click="handleOperatorToggle" title="Toggle operator" aria-label="Toggle operator" :class="type === 'default' ? 'has' : 'not'" class="toggle">
14
+ <ecs-icon :class="type === 'default' ? 'show' : ''" class="check" type="check" size="8" color="#7896B4" />
15
+ <ecs-icon :class="type === 'not' ? 'show' : ''" class="cross" type="close" size="8" color="#AC4949" />
16
+ <ecs-focus-ring :radius="12" />
17
+ </button>
13
18
  </div>
14
19
  <div class="query">
15
20
  <div v-if="descriptor" class="descriptor">{{ descriptor }}</div>
@@ -56,6 +61,11 @@
56
61
  return ['and','or','not']
57
62
  }
58
63
  },
64
+ /** Adds an operator toggle to the search token. This should never be used together with `operatorSelect`. */
65
+ operatorSwitch: {
66
+ type: Boolean,
67
+ default: false
68
+ },
59
69
  /** Allows to add a descriptor label to the token. This can be used for e.g. different date like "Document Date", "Sent Date", "Added Date", etc. */
60
70
  descriptor: {
61
71
  type: String
@@ -80,6 +90,11 @@
80
90
  const newValue = event.target.value.toLowerCase();
81
91
  /** Emitted when the operator type is changed via the `operatorSelect` dropdown. Returns the selected value. */
82
92
  this.$emit('operatorChange', newValue);
93
+ },
94
+
95
+ handleOperatorToggle(event) {
96
+ /** Emitted when the operator is toggled via the `operatorToggle` button. */
97
+ this.$emit('operatorToggle', event);
83
98
  }
84
99
  }
85
100
  }
@@ -150,6 +165,67 @@
150
165
  padding: 2px;
151
166
  }
152
167
 
168
+ .toggle{
169
+ padding: 0;
170
+ width: $spacing-25;
171
+ height: $spacing-20;
172
+ border-radius: 24px;
173
+ margin: 0 0 0 2px;
174
+ position: relative;
175
+
176
+ &:focus-visible{
177
+ .ecs-focus-ring{
178
+ display: block;
179
+ }
180
+ }
181
+
182
+ &:before{
183
+ content: '';
184
+ position: absolute;
185
+ inset: 2px;
186
+ width: $spacing-20;
187
+ height: $spacing-15;
188
+ border-radius: 24px;
189
+ border: 1px solid $color-white;
190
+ }
191
+
192
+ &:after{
193
+ content: '';
194
+ background: $color-white;
195
+ border-radius: 100%;
196
+ width: $spacing-10;
197
+ height: $spacing-10;
198
+ position: absolute;
199
+ left: 4px;
200
+ top: 4px;
201
+ transition: transform .2s ease-in-out;
202
+ }
203
+
204
+ &.has:after{
205
+ transform: translateX(4px);
206
+ }
207
+
208
+ .icon{
209
+ position: absolute;
210
+ opacity: 0;
211
+ top: 4px;
212
+ transition: opacity .2s ease-in-out;
213
+ z-index: 1;
214
+
215
+ &.show{
216
+ opacity: 1;
217
+ }
218
+ }
219
+
220
+ .check{
221
+ right: 4px;
222
+ }
223
+
224
+ .cross{
225
+ left: 4px;
226
+ }
227
+ }
228
+
153
229
  .operator{
154
230
  color: #FFF;
155
231
  font-size: 8px;
@@ -6,6 +6,12 @@ import { Meta } from '@storybook/addon-docs/blocks';
6
6
  Changelog
7
7
  </h1>
8
8
 
9
+ ## Version 7.2.6 (6 June 2023)
10
+
11
+ ### Features
12
+
13
+ - Added operator switch to search token component
14
+
9
15
  ## Version 7.2.3 (5 June 2023)
10
16
 
11
17
  ### Features
@@ -29,6 +29,14 @@ export const searchTokenOperatorDropdown = () => ({
29
29
  </main>`,
30
30
  });
31
31
 
32
+ export const searchTokenOperatorToggle = () => ({
33
+ components: { EcsMultiselectSearchToken },
34
+ template: `<main>
35
+ <ecs-multiselect-search-token icon="person" operator-switch>Amanda Clark</ecs-multiselect-search-token>
36
+ <ecs-multiselect-search-token type="not" icon="person" operator-switch>Profiles</ecs-multiselect-search-token>
37
+ </main>`,
38
+ });
39
+
32
40
  export const searchTokenAddons = () => ({
33
41
  components: { EcsMultiselectSearchToken },
34
42
  template: `<main>