noph-ui 0.12.9 → 0.12.11
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/README.md +1 -1
- package/dist/button/Button.svelte +2 -1
- package/dist/button/types.d.ts +2 -0
- package/dist/menu/Menu.svelte +4 -3
- package/dist/select/Select.svelte +18 -9
- package/dist/select/types.d.ts +0 -1
- package/dist/text-field/TextField.svelte +1 -1
- package/dist/tooltip/Tooltip.svelte +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,6 +64,7 @@ Beta (No breaking changes expected)
|
|
|
64
64
|
- Radio
|
|
65
65
|
- Ripple
|
|
66
66
|
- Segmented buttons
|
|
67
|
+
- Select
|
|
67
68
|
- Snackbar
|
|
68
69
|
- Text fields
|
|
69
70
|
|
|
@@ -75,7 +76,6 @@ In progress (Breaking changes expected)
|
|
|
75
76
|
- Navigation Drawer (Docs missing)
|
|
76
77
|
- Navigation Rail (Badge is missing + Docs missing)
|
|
77
78
|
- Tooltips (Positioning missing)
|
|
78
|
-
- Select (Docs missing)
|
|
79
79
|
|
|
80
80
|
Pending
|
|
81
81
|
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
disabled = false,
|
|
16
16
|
loading = false,
|
|
17
17
|
keepTooltipOnClick,
|
|
18
|
+
loadingAriaLabel,
|
|
18
19
|
...attributes
|
|
19
20
|
}: ButtonProps = $props()
|
|
20
21
|
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
{/if}
|
|
35
36
|
{#if loading}
|
|
36
37
|
<div class="circular-progress">
|
|
37
|
-
<CircularProgress indeterminate />
|
|
38
|
+
<CircularProgress aria-label={loadingAriaLabel} indeterminate />
|
|
38
39
|
</div>
|
|
39
40
|
{/if}
|
|
40
41
|
<div class="button-icon">
|
package/dist/button/types.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ interface ButtonButtonProps extends HTMLButtonAttributes {
|
|
|
7
7
|
element?: HTMLElement;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
loading?: boolean;
|
|
10
|
+
loadingAriaLabel?: string;
|
|
10
11
|
keepTooltipOnClick?: boolean;
|
|
11
12
|
}
|
|
12
13
|
interface ButtonAnchorProps extends HTMLAnchorAttributes {
|
|
@@ -17,6 +18,7 @@ interface ButtonAnchorProps extends HTMLAnchorAttributes {
|
|
|
17
18
|
keepTooltipOnClick?: boolean;
|
|
18
19
|
disabled?: boolean;
|
|
19
20
|
loading?: boolean;
|
|
21
|
+
loadingAriaLabel?: string;
|
|
20
22
|
}
|
|
21
23
|
interface IconButtonButtonProps extends HTMLButtonAttributes {
|
|
22
24
|
variant?: 'text' | 'filled' | 'outlined' | 'tonal';
|
package/dist/menu/Menu.svelte
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
maxHeight > innerHeight - anchorRect.height
|
|
37
37
|
? `${innerHeight - anchorRect.height - 4}px`
|
|
38
38
|
: `${maxHeight - 4}px`
|
|
39
|
-
if (!('
|
|
39
|
+
if (!('positionArea' in document.documentElement.style)) {
|
|
40
40
|
const docClientWidth = document.documentElement.clientWidth
|
|
41
41
|
if (anchorRect.bottom + clientHeight > innerHeight && anchorRect.top - clientHeight > 0) {
|
|
42
42
|
element.style.top = `${anchorRect.top - clientHeight - 2}px`
|
|
@@ -101,6 +101,7 @@
|
|
|
101
101
|
|
|
102
102
|
<svelte:window bind:innerHeight onresize={refreshValues} />
|
|
103
103
|
<div
|
|
104
|
+
role="menu"
|
|
104
105
|
{...attributes}
|
|
105
106
|
bind:this={element}
|
|
106
107
|
bind:clientWidth
|
|
@@ -108,10 +109,10 @@
|
|
|
108
109
|
ontoggle={(event) => {
|
|
109
110
|
let { newState } = event
|
|
110
111
|
menuOpen = newState === 'open'
|
|
112
|
+
attributes.ontoggle?.(event)
|
|
111
113
|
}}
|
|
112
114
|
popover="auto"
|
|
113
115
|
class={['np-menu-container', attributes.class]}
|
|
114
|
-
role="menu"
|
|
115
116
|
>
|
|
116
117
|
<div class="np-menu">
|
|
117
118
|
{@render children()}
|
|
@@ -142,7 +143,7 @@
|
|
|
142
143
|
opacity: 0;
|
|
143
144
|
justify-self: var(--np-menu-justify-self, anchor-center);
|
|
144
145
|
position-area: var(--np-menu-position-area, bottom center);
|
|
145
|
-
position-try:
|
|
146
|
+
position-try: normal flip-block;
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
.np-menu-container:popover-open {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
let errorRaw = $state(error)
|
|
34
34
|
let selectElement: HTMLSelectElement | undefined = $state()
|
|
35
35
|
let menuElement: HTMLDivElement | undefined = $state()
|
|
36
|
+
let anchorElement: HTMLDivElement | undefined = $state()
|
|
36
37
|
let field: HTMLDivElement | undefined = $state()
|
|
37
38
|
let clientWidth = $state(0)
|
|
38
39
|
let menuId = $state(`--select-${crypto.randomUUID()}`)
|
|
@@ -87,6 +88,7 @@
|
|
|
87
88
|
aria-controls="listbox"
|
|
88
89
|
aria-expanded={menuOpen}
|
|
89
90
|
aria-label={attributes['aria-label'] || label}
|
|
91
|
+
aria-disabled={disabled}
|
|
90
92
|
data-testid={attributes['data-testid']}
|
|
91
93
|
bind:this={field}
|
|
92
94
|
bind:clientWidth
|
|
@@ -102,7 +104,7 @@
|
|
|
102
104
|
event.preventDefault()
|
|
103
105
|
if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === 'Enter') {
|
|
104
106
|
menuElement?.showPopover()
|
|
105
|
-
;(menuElement?.firstElementChild as HTMLElement)?.focus()
|
|
107
|
+
;(menuElement?.firstElementChild?.firstElementChild as HTMLElement)?.focus()
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
}}
|
|
@@ -129,10 +131,10 @@
|
|
|
129
131
|
<div class="outline-end"></div>
|
|
130
132
|
</div>
|
|
131
133
|
{/if}
|
|
132
|
-
<div class="np-container" style="anchor-name:{menuId};">
|
|
134
|
+
<div class="np-container" bind:this={anchorElement} style="anchor-name:{menuId};">
|
|
133
135
|
{#if start}
|
|
134
136
|
<div class="start">
|
|
135
|
-
<span class="icon
|
|
137
|
+
<span class="icon">{@render start()}</span>
|
|
136
138
|
</div>
|
|
137
139
|
{/if}
|
|
138
140
|
<div class="middle">
|
|
@@ -175,8 +177,6 @@
|
|
|
175
177
|
<div class="input">
|
|
176
178
|
{#if selectedLabel}
|
|
177
179
|
{selectedLabel}
|
|
178
|
-
{:else}
|
|
179
|
-
|
|
180
180
|
{/if}
|
|
181
181
|
</div>
|
|
182
182
|
</div>
|
|
@@ -201,13 +201,14 @@
|
|
|
201
201
|
<Menu
|
|
202
202
|
style="position-anchor:{menuId};min-width:{clientWidth}px;"
|
|
203
203
|
popover="manual"
|
|
204
|
+
role="listbox"
|
|
204
205
|
--np-menu-justify-self="none"
|
|
205
206
|
--np-menu-position-area="bottom span-right"
|
|
206
207
|
--np-menu-margin="2px 0"
|
|
207
208
|
--np-menu-container-shape={variant === 'outlined'
|
|
208
209
|
? 'var(--np-outlined-select-text-field-container-shape)'
|
|
209
210
|
: 'var(--np-filled-select-text-field-container-shape)'}
|
|
210
|
-
anchor={
|
|
211
|
+
anchor={anchorElement}
|
|
211
212
|
ontoggle={({ newState }) => {
|
|
212
213
|
if (newState === 'open') {
|
|
213
214
|
menuOpen = true
|
|
@@ -319,8 +320,9 @@
|
|
|
319
320
|
flex: 1;
|
|
320
321
|
max-height: 100%;
|
|
321
322
|
min-height: 100%;
|
|
322
|
-
min-width:
|
|
323
|
+
min-width: 0;
|
|
323
324
|
position: relative;
|
|
325
|
+
user-select: none;
|
|
324
326
|
}
|
|
325
327
|
.outlined .container-overflow {
|
|
326
328
|
border-start-start-radius: var(
|
|
@@ -424,13 +426,18 @@
|
|
|
424
426
|
align-items: stretch;
|
|
425
427
|
align-self: baseline;
|
|
426
428
|
flex: 1;
|
|
429
|
+
min-width: 0;
|
|
427
430
|
}
|
|
428
431
|
|
|
429
432
|
.input {
|
|
430
433
|
caret-color: var(--np-color-primary);
|
|
431
|
-
overflow
|
|
434
|
+
overflow: hidden;
|
|
435
|
+
text-overflow: ellipsis;
|
|
436
|
+
white-space: nowrap;
|
|
432
437
|
text-align: inherit;
|
|
433
|
-
|
|
438
|
+
flex: 1;
|
|
439
|
+
min-width: 0;
|
|
440
|
+
height: 1.5rem;
|
|
434
441
|
|
|
435
442
|
&::placeholder {
|
|
436
443
|
color: currentColor;
|
|
@@ -475,6 +482,7 @@
|
|
|
475
482
|
display: flex;
|
|
476
483
|
flex: 1 1 0%;
|
|
477
484
|
opacity: 1;
|
|
485
|
+
min-width: 0;
|
|
478
486
|
transition: opacity 83ms cubic-bezier(0.2, 0, 0, 1);
|
|
479
487
|
}
|
|
480
488
|
.disabled .content {
|
|
@@ -599,6 +607,7 @@
|
|
|
599
607
|
}
|
|
600
608
|
|
|
601
609
|
.with-start.menu-open .label,
|
|
610
|
+
.with-start:focus .label,
|
|
602
611
|
.with-start:has(select:focus-visible option:checked:not([value=''])) .label,
|
|
603
612
|
.with-start:has(select option:checked:not([value=''])) .label,
|
|
604
613
|
.with-start:has(select:focus-visible) .label {
|
package/dist/select/types.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
let anchor: HTMLElement | undefined = $state()
|
|
15
15
|
|
|
16
16
|
const refreshValues = () => {
|
|
17
|
-
if (element && anchor && !('
|
|
17
|
+
if (element && anchor && !('positionArea' in document.documentElement.style)) {
|
|
18
18
|
const docClientWidth = document.documentElement.clientWidth
|
|
19
19
|
const anchorRect = anchor.getBoundingClientRect()
|
|
20
20
|
if (anchorRect.bottom + clientHeight > innerHeight && anchorRect.top - clientHeight > 0) {
|