@x33025/sveltely 0.0.31 → 0.0.32

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.
@@ -157,86 +157,87 @@
157
157
  });
158
158
  </script>
159
159
 
160
- <div class="w-full max-w-lg">
161
- <div class="tag-row flex flex-wrap items-center">
162
- {#each tags as tag (tag)}
163
- {#if editingTag === tag}
164
- <input
165
- bind:this={editingEl}
166
- bind:value={editingValue}
167
- class="tag-surface tag-input-field min-w-20 outline-none"
168
- onblur={() => commitEdit('blur', tag)}
169
- onkeydown={(event) => onEditKeydown(event, tag)}
170
- />
171
- {:else if selectionEnabled}
172
- <button
173
- type="button"
174
- class="tag-surface inline-flex items-center gap-2"
175
- class:tag-selected={selection?.includes(tag)}
176
- onclick={() => toggleSelected(tag)}
177
- ondblclick={() => startEditing(tag)}
178
- aria-pressed={selection?.includes(tag)}
179
- >
180
- {tag}
181
- </button>
182
- {:else}
183
- <button
184
- type="button"
185
- class="tag-surface inline-flex items-center gap-2"
186
- ondblclick={() => startEditing(tag)}>{tag}</button
187
- >
188
- {/if}
189
- {/each}
190
-
191
- {#if showInput}
160
+ <div class="chip-row flex w-full flex-wrap items-center">
161
+ {#each tags as tag (tag)}
162
+ {#if editingTag === tag}
192
163
  <input
193
- bind:this={inputEl}
194
- bind:value={inputValue}
195
- class="tag-surface tag-input-field min-w-36 outline-none"
196
- {placeholder}
197
- onkeydown={onKeydown}
198
- onblur={onBlur}
164
+ bind:this={editingEl}
165
+ bind:value={editingValue}
166
+ size={Math.max(editingValue.length, 1)}
167
+ class="chip-surface chip-input-field outline-none"
168
+ onblur={() => commitEdit('blur', tag)}
169
+ onkeydown={(event) => onEditKeydown(event, tag)}
199
170
  />
200
- {:else}
171
+ {:else if selectionEnabled}
201
172
  <button
202
173
  type="button"
203
- class="tag-surface chip-input-action inline-flex items-center justify-center font-semibold"
204
- aria-label="Add tag"
205
- onclick={openInput}
174
+ class="chip-surface inline-flex items-center gap-2"
175
+ class:chip-selected={selection?.includes(tag)}
176
+ onclick={() => toggleSelected(tag)}
177
+ ondblclick={() => startEditing(tag)}
178
+ aria-pressed={selection?.includes(tag)}
206
179
  >
207
- <Plus style="width: var(--chip-input-font-size); height: var(--chip-input-font-size);" />
180
+ {tag}
208
181
  </button>
182
+ {:else}
183
+ <button
184
+ type="button"
185
+ class="chip-surface inline-flex items-center gap-2"
186
+ ondblclick={() => startEditing(tag)}>{tag}</button
187
+ >
209
188
  {/if}
210
-
211
- {#if action}
212
- {@render action()}
213
- {/if}
214
- </div>
189
+ {/each}
190
+
191
+ {#if showInput}
192
+ <input
193
+ bind:this={inputEl}
194
+ bind:value={inputValue}
195
+ size={Math.max(inputValue.length, placeholder.length, 1)}
196
+ class="chip-surface chip-input-field outline-none"
197
+ {placeholder}
198
+ onkeydown={onKeydown}
199
+ onblur={onBlur}
200
+ />
201
+ {:else}
202
+ <button
203
+ type="button"
204
+ class="chip-surface chip-input-action inline-flex items-center justify-center font-semibold"
205
+ aria-label="Add tag"
206
+ onclick={openInput}
207
+ >
208
+ <Plus style="width: var(--chip-input-font-size); height: var(--chip-input-font-size);" />
209
+ </button>
210
+ {/if}
211
+
212
+ {#if action}
213
+ {@render action()}
214
+ {/if}
215
215
  </div>
216
216
 
217
217
  <style>
218
- .tag-row {
218
+ .chip-row {
219
219
  gap: var(--chip-input-gap);
220
220
  }
221
221
 
222
- .tag-surface {
222
+ .chip-surface {
223
223
  background: var(--chip-input-background);
224
224
  color: var(--chip-input-text);
225
225
  font-size: var(--chip-input-font-size);
226
226
  border-radius: var(--chip-input-border-radius);
227
227
  padding: var(--chip-input-padding);
228
228
  border: 1px solid var(--chip-input-border-color);
229
+ white-space: nowrap;
229
230
  }
230
231
 
231
- .tag-selected {
232
+ .chip-selected {
232
233
  border-color: var(--chip-input-highlight);
233
234
  }
234
235
 
235
- .tag-surface:hover {
236
+ .chip-surface:hover {
236
237
  background: var(--chip-input-hover);
237
238
  }
238
239
 
239
- .tag-input-field:hover {
240
+ .chip-input-field:hover {
240
241
  background: var(--chip-input-background);
241
242
  }
242
243
  </style>
package/dist/style.css CHANGED
@@ -22,7 +22,6 @@
22
22
  --color-black: #000;
23
23
  --color-white: #fff;
24
24
  --spacing: 0.25rem;
25
- --container-lg: 32rem;
26
25
  --text-sm: 0.875rem;
27
26
  --text-sm--line-height: calc(1.25 / 0.875);
28
27
  --font-weight-medium: 500;
@@ -269,15 +268,6 @@
269
268
  .w-full {
270
269
  width: 100%;
271
270
  }
272
- .max-w-lg {
273
- max-width: var(--container-lg);
274
- }
275
- .min-w-20 {
276
- min-width: calc(var(--spacing) * 20);
277
- }
278
- .min-w-36 {
279
- min-width: calc(var(--spacing) * 36);
280
- }
281
271
  .flex-1 {
282
272
  flex: 1;
283
273
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x33025/sveltely",
3
- "version": "0.0.31",
3
+ "version": "0.0.32",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",