noph-ui 0.21.7 → 0.21.9

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.
@@ -136,7 +136,7 @@
136
136
  bind:element={menuElement}
137
137
  >
138
138
  {#if useVirtualList}
139
- <VirtualList height="250px" itemHeight={56} items={displayOptions}>
139
+ <VirtualList height="250px" itemHeight={48} items={displayOptions}>
140
140
  {#snippet row(option)}
141
141
  {@render item(option)}
142
142
  {/snippet}
@@ -151,9 +151,10 @@
151
151
  text-align: start;
152
152
  overflow: hidden;
153
153
  width: 100%;
154
- padding: 0.75rem 1rem;
155
- min-height: 3.5rem;
156
- gap: 1rem;
154
+ padding-block: 0.75rem;
155
+ padding-inline: 1rem;
156
+ min-height: 3rem;
157
+ gap: 0.75rem;
157
158
  text-decoration: none;
158
159
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
159
160
  color: var(--np-item-label-text-color, var(--np-color-on-surface));
@@ -15,7 +15,7 @@
15
15
  </script>
16
16
 
17
17
  <label {style} class={['np-host', attributes.class]} bind:this={element}>
18
- <div class="np-container" aria-hidden="true">
18
+ <div class="np-container">
19
19
  {#if !attributes.disabled}
20
20
  <Ripple forElement={inputEl} class="np-radio-ripple" />
21
21
  {/if}
@@ -27,6 +27,7 @@
27
27
  position: relative;
28
28
  vertical-align: top;
29
29
  width: 18px;
30
+ padding: 3px;
30
31
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
31
32
  cursor: pointer;
32
33
  }
@@ -336,37 +336,64 @@
336
336
  </div>
337
337
 
338
338
  {#snippet item(option: SelectOption)}
339
- <Item
340
- onclick={(event) => {
341
- handleOptionSelect(event, option)
342
- field?.focus()
343
- }}
344
- disabled={option.disabled}
345
- onkeydown={(event) => {
346
- if (event.key === 'ArrowDown') {
347
- ;(event.currentTarget?.nextElementSibling as HTMLElement)?.focus()
348
- event.preventDefault()
349
- }
350
- if (event.key === 'ArrowUp') {
351
- ;(event.currentTarget?.previousElementSibling as HTMLElement)?.focus()
352
- event.preventDefault()
353
- }
354
- if (event.key === 'Enter') {
339
+ {#if Array.isArray(value) && multiple}
340
+ <Item
341
+ onclick={(event) => {
355
342
  handleOptionSelect(event, option)
356
- }
357
- if (event.key === 'Tab') {
358
- menuElement?.hidePopover()
359
- }
360
- }}
361
- variant="button"
362
- selected={Array.isArray(value) ? value.includes(option.value) : value === option.value}
363
- >{option.label}
364
- {#snippet start()}
365
- {#if Array.isArray(value) && multiple}
343
+ field?.focus()
344
+ }}
345
+ disabled={option.disabled}
346
+ onkeydown={(event) => {
347
+ if (event.key === 'ArrowDown') {
348
+ ;(event.currentTarget?.nextElementSibling as HTMLElement)?.focus()
349
+ event.preventDefault()
350
+ }
351
+ if (event.key === 'ArrowUp') {
352
+ ;(event.currentTarget?.previousElementSibling as HTMLElement)?.focus()
353
+ event.preventDefault()
354
+ }
355
+ if (event.key === 'Enter') {
356
+ handleOptionSelect(event, option)
357
+ }
358
+ if (event.key === 'Tab') {
359
+ menuElement?.hidePopover()
360
+ }
361
+ }}
362
+ variant="button"
363
+ selected={Array.isArray(value) ? value.includes(option.value) : value === option.value}
364
+ >{option.label}
365
+ {#snippet start()}
366
366
  <Check disabled={option.disabled} checked={value.includes(option.value)} />
367
- {/if}
368
- {/snippet}
369
- </Item>
367
+ {/snippet}
368
+ </Item>
369
+ {:else}
370
+ <Item
371
+ onclick={(event) => {
372
+ handleOptionSelect(event, option)
373
+ field?.focus()
374
+ }}
375
+ disabled={option.disabled}
376
+ onkeydown={(event) => {
377
+ if (event.key === 'ArrowDown') {
378
+ ;(event.currentTarget?.nextElementSibling as HTMLElement)?.focus()
379
+ event.preventDefault()
380
+ }
381
+ if (event.key === 'ArrowUp') {
382
+ ;(event.currentTarget?.previousElementSibling as HTMLElement)?.focus()
383
+ event.preventDefault()
384
+ }
385
+ if (event.key === 'Enter') {
386
+ handleOptionSelect(event, option)
387
+ }
388
+ if (event.key === 'Tab') {
389
+ menuElement?.hidePopover()
390
+ }
391
+ }}
392
+ variant="button"
393
+ selected={Array.isArray(value) ? value.includes(option.value) : value === option.value}
394
+ >{option.label}
395
+ </Item>
396
+ {/if}
370
397
  {/snippet}
371
398
 
372
399
  <Menu
@@ -391,7 +418,7 @@
391
418
  bind:element={menuElement}
392
419
  >
393
420
  {#if useVirtualList}
394
- <VirtualList height="250px" itemHeight={56} items={options}>
421
+ <VirtualList height="250px" itemHeight={48} items={options}>
395
422
  {#snippet row(option)}
396
423
  {@render item(option)}
397
424
  {/snippet}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noph-ui",
3
- "version": "0.21.7",
3
+ "version": "0.21.9",
4
4
  "license": "MIT",
5
5
  "homepage": "https://noph.dev",
6
6
  "repository": {