noph-ui 0.44.0 → 0.45.1
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 +10 -1
- package/dist/animation.d.ts +2 -0
- package/dist/animation.js +33 -0
- package/dist/app-bar/AppBar.svelte +230 -0
- package/dist/app-bar/AppBar.svelte.d.ts +4 -0
- package/dist/app-bar/index.d.ts +1 -0
- package/dist/app-bar/index.js +1 -0
- package/dist/app-bar/types.d.ts +13 -0
- package/dist/app-bar/types.js +1 -0
- package/dist/autocomplete/AutoComplete.svelte +10 -11
- package/dist/autocomplete/AutoComplete.svelte.d.ts +1 -1
- package/dist/autocomplete/types.d.ts +1 -1
- package/dist/badge/Badge.svelte +6 -1
- package/dist/badge/types.d.ts +0 -1
- package/dist/button/Button.svelte +5 -15
- package/dist/button/IconButton.svelte +5 -15
- package/dist/button/SegmentedButton.svelte +15 -1
- package/dist/button/SplitButton.svelte +75 -0
- package/dist/button/SplitButton.svelte.d.ts +4 -0
- package/dist/button/index.d.ts +1 -0
- package/dist/button/index.js +1 -0
- package/dist/button/types.d.ts +17 -4
- package/dist/card/types.d.ts +1 -1
- package/dist/checkbox/Checkbox.svelte +47 -58
- package/dist/chip/AssistChip.svelte +5 -5
- package/dist/chip/ChipSet.svelte +3 -11
- package/dist/chip/FilterChip.svelte +33 -27
- package/dist/chip/InputChip.svelte +13 -2
- package/dist/chip/SuggestionChip.svelte +29 -0
- package/dist/chip/SuggestionChip.svelte.d.ts +4 -0
- package/dist/chip/index.d.ts +1 -0
- package/dist/chip/index.js +1 -0
- package/dist/chip/types.d.ts +16 -9
- package/dist/date-picker/Calendar.svelte +1 -1
- package/dist/date-picker/DatePickerDialog.svelte +23 -11
- package/dist/date-picker/DatePickerDialog.svelte.d.ts +4 -1
- package/dist/date-picker/DateRangePicker.svelte +40 -10
- package/dist/date-picker/DateRangePicker.svelte.d.ts +4 -1
- package/dist/date-picker/DockedDatePicker.svelte +13 -10
- package/dist/date-picker/DockedDatePicker.svelte.d.ts +4 -1
- package/dist/date-picker/DockedDateTimePicker.svelte +13 -7
- package/dist/date-picker/DockedDateTimePicker.svelte.d.ts +4 -1
- package/dist/date-picker/SelectionList.svelte +6 -32
- package/dist/date-picker/SelectionList.svelte.d.ts +2 -12
- package/dist/date-picker/TimeColumn.svelte +4 -29
- package/dist/date-picker/exitVisibility.svelte.d.ts +5 -0
- package/dist/date-picker/exitVisibility.svelte.js +23 -0
- package/dist/date-picker/optionList.d.ts +4 -0
- package/dist/date-picker/optionList.js +31 -0
- package/dist/date-picker/types.d.ts +11 -4
- package/dist/dialog/Dialog.svelte +55 -68
- package/dist/dialog/Dialog.svelte.d.ts +3 -3
- package/dist/dialog/types.d.ts +4 -3
- package/dist/fab/ExtendedFab.svelte +255 -0
- package/dist/fab/ExtendedFab.svelte.d.ts +5 -0
- package/dist/fab/Fab.svelte +211 -0
- package/dist/fab/Fab.svelte.d.ts +5 -0
- package/dist/fab/FabMenu.svelte +207 -0
- package/dist/fab/FabMenu.svelte.d.ts +7 -0
- package/dist/fab/index.d.ts +3 -0
- package/dist/fab/index.js +3 -0
- package/dist/fab/types.d.ts +34 -0
- package/dist/fab/types.js +1 -0
- package/dist/icons/ArrowBackIcon.svelte +13 -0
- package/dist/icons/ArrowBackIcon.svelte.d.ts +7 -0
- package/dist/icons/ChevronDownIcon.svelte +3 -0
- package/dist/icons/ChevronDownIcon.svelte.d.ts +26 -0
- package/dist/icons/SearchIcon.svelte +15 -0
- package/dist/icons/SearchIcon.svelte.d.ts +7 -0
- package/dist/icons/index.d.ts +3 -0
- package/dist/icons/index.js +3 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/internal/focus-ring.css +12 -0
- package/dist/loading-indicator/shapes.js +0 -7
- package/dist/menu/Menu.svelte +12 -7
- package/dist/menu/Menu.svelte.d.ts +2 -2
- package/dist/menu/types.d.ts +0 -2
- package/dist/navigation-bar/NavigationBar.svelte +59 -0
- package/dist/navigation-bar/NavigationBar.svelte.d.ts +4 -0
- package/dist/navigation-bar/NavigationBarItem.svelte +239 -0
- package/dist/navigation-bar/NavigationBarItem.svelte.d.ts +5 -0
- package/dist/navigation-bar/index.d.ts +2 -0
- package/dist/navigation-bar/index.js +2 -0
- package/dist/navigation-bar/types.d.ts +19 -0
- package/dist/navigation-bar/types.js +1 -0
- package/dist/navigation-drawer/NavigationDrawer.svelte +107 -76
- package/dist/navigation-drawer/NavigationDrawer.svelte.d.ts +4 -1
- package/dist/navigation-drawer/NavigationDrawerItem.svelte +10 -3
- package/dist/navigation-drawer/types.d.ts +3 -1
- package/dist/navigation-rail/NavigationRailItem.svelte +16 -0
- package/dist/navigation-rail/types.d.ts +3 -0
- package/dist/popover.svelte.d.ts +5 -0
- package/dist/popover.svelte.js +22 -0
- package/dist/press.svelte.d.ts +6 -0
- package/dist/press.svelte.js +32 -0
- package/dist/radio/Radio.svelte +26 -7
- package/dist/radio/types.d.ts +3 -0
- package/dist/search/Search.svelte +391 -0
- package/dist/search/Search.svelte.d.ts +5 -0
- package/dist/search/index.d.ts +1 -0
- package/dist/search/index.js +1 -0
- package/dist/search/types.d.ts +19 -0
- package/dist/search/types.js +1 -0
- package/dist/select/Select.svelte +48 -87
- package/dist/sheet/Sheet.svelte +235 -0
- package/dist/sheet/Sheet.svelte.d.ts +7 -0
- package/dist/sheet/index.d.ts +1 -0
- package/dist/sheet/index.js +1 -0
- package/dist/sheet/types.d.ts +11 -0
- package/dist/sheet/types.js +1 -0
- package/dist/slider/Slider.svelte +118 -30
- package/dist/slider/types.d.ts +3 -0
- package/dist/snackbar/Snackbar.svelte +32 -35
- package/dist/snackbar/Snackbar.svelte.d.ts +2 -2
- package/dist/snackbar/types.d.ts +3 -2
- package/dist/switch/Switch.svelte +51 -20
- package/dist/switch/types.d.ts +3 -0
- package/dist/tabs/Tab.svelte +4 -12
- package/dist/tabs/Tabs.svelte +5 -5
- package/dist/text-field/TextField.svelte +2 -4
- package/dist/toolbar/Toolbar.svelte +121 -0
- package/dist/toolbar/Toolbar.svelte.d.ts +4 -0
- package/dist/toolbar/index.d.ts +1 -0
- package/dist/toolbar/index.js +1 -0
- package/dist/toolbar/types.d.ts +8 -0
- package/dist/toolbar/types.js +1 -0
- package/dist/tooltip/RichTooltip.svelte +18 -12
- package/dist/tooltip/RichTooltip.svelte.d.ts +2 -2
- package/dist/tooltip/Tooltip.svelte +22 -11
- package/dist/tooltip/Tooltip.svelte.d.ts +4 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.js +6 -0
- package/package.json +13 -13
- package/dist/date-picker/enterAnimation.d.ts +0 -1
- package/dist/date-picker/enterAnimation.js +0 -10
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { onMount } from 'svelte';
|
|
2
|
+
export const PRESS_DURATION = 100;
|
|
3
|
+
export const pressMorph = () => {
|
|
4
|
+
let pressed = $state(false);
|
|
5
|
+
let timeout;
|
|
6
|
+
const cancel = () => {
|
|
7
|
+
clearTimeout(timeout);
|
|
8
|
+
pressed = false;
|
|
9
|
+
};
|
|
10
|
+
onMount(() => cancel);
|
|
11
|
+
return {
|
|
12
|
+
get pressed() {
|
|
13
|
+
return pressed;
|
|
14
|
+
},
|
|
15
|
+
press: () => {
|
|
16
|
+
clearTimeout(timeout);
|
|
17
|
+
pressed = true;
|
|
18
|
+
timeout = setTimeout(() => (pressed = false), PRESS_DURATION);
|
|
19
|
+
},
|
|
20
|
+
supersededBy: (shape) => {
|
|
21
|
+
let previous;
|
|
22
|
+
$effect(() => {
|
|
23
|
+
const next = shape();
|
|
24
|
+
const was = previous;
|
|
25
|
+
previous = next;
|
|
26
|
+
if (was === undefined || was === next)
|
|
27
|
+
return;
|
|
28
|
+
cancel();
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
};
|
package/dist/radio/Radio.svelte
CHANGED
|
@@ -9,14 +9,20 @@
|
|
|
9
9
|
element = $bindable(),
|
|
10
10
|
group = $bindable(),
|
|
11
11
|
style,
|
|
12
|
+
issues,
|
|
12
13
|
...attributes
|
|
13
14
|
}: RadioProps = $props()
|
|
14
15
|
|
|
15
16
|
let inputEl = $state<HTMLInputElement>()
|
|
16
17
|
const uid = $props.id()
|
|
18
|
+
let hasError = $derived(!!issues?.length)
|
|
17
19
|
</script>
|
|
18
20
|
|
|
19
|
-
<div
|
|
21
|
+
<div
|
|
22
|
+
{style}
|
|
23
|
+
class={['np-radio-container', hasError && !attributes.disabled && 'np-error', attributes.class]}
|
|
24
|
+
bind:this={element}
|
|
25
|
+
>
|
|
20
26
|
{#if !attributes.disabled}
|
|
21
27
|
<Ripple forElement={inputEl} class="np-radio-ripple" />
|
|
22
28
|
{/if}
|
|
@@ -70,7 +76,7 @@
|
|
|
70
76
|
-webkit-tap-highlight-color: transparent;
|
|
71
77
|
}
|
|
72
78
|
|
|
73
|
-
.np-container {
|
|
79
|
+
.np-radio-container {
|
|
74
80
|
margin: max(0px, (40px - var(--np-radio-icon-size, 20px))/2);
|
|
75
81
|
display: inline-flex;
|
|
76
82
|
vertical-align: top;
|
|
@@ -84,7 +90,7 @@
|
|
|
84
90
|
cursor: pointer;
|
|
85
91
|
}
|
|
86
92
|
|
|
87
|
-
.np-container:has(input:disabled) {
|
|
93
|
+
.np-radio-container:has(input:disabled) {
|
|
88
94
|
cursor: default;
|
|
89
95
|
}
|
|
90
96
|
|
|
@@ -94,11 +100,11 @@
|
|
|
94
100
|
position: absolute;
|
|
95
101
|
}
|
|
96
102
|
|
|
97
|
-
.np-container:has(input:checked) .np-radio-icon {
|
|
103
|
+
.np-radio-container:has(input:checked) .np-radio-icon {
|
|
98
104
|
fill: var(--np-radio-selected-icon-color, var(--np-color-primary));
|
|
99
105
|
}
|
|
100
106
|
|
|
101
|
-
.np-container:has(input:disabled) .np-radio-icon {
|
|
107
|
+
.np-radio-container:has(input:disabled) .np-radio-icon {
|
|
102
108
|
fill: var(--np-color-on-surface);
|
|
103
109
|
opacity: 0.38;
|
|
104
110
|
}
|
|
@@ -109,7 +115,7 @@
|
|
|
109
115
|
transition: opacity 50ms linear;
|
|
110
116
|
}
|
|
111
117
|
|
|
112
|
-
.np-container:has(input:checked) .inner.circle {
|
|
118
|
+
.np-radio-container:has(input:checked) .inner.circle {
|
|
113
119
|
animation: 300ms cubic-bezier(0.05, 0.7, 0.1, 1) 0s 1 normal none running inner-circle-grow;
|
|
114
120
|
opacity: 1;
|
|
115
121
|
}
|
|
@@ -123,7 +129,20 @@
|
|
|
123
129
|
}
|
|
124
130
|
}
|
|
125
131
|
|
|
126
|
-
.np-
|
|
132
|
+
.np-error .np-radio-icon {
|
|
133
|
+
fill: var(--np-color-error);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.np-error:has(input:checked) .np-radio-icon {
|
|
137
|
+
fill: var(--np-color-error);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.np-error {
|
|
141
|
+
--np-ripple-hover-color: var(--np-color-error);
|
|
142
|
+
--np-ripple-pressed-color: var(--np-color-error);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.np-radio-container:has(input:focus-visible) {
|
|
127
146
|
outline-style: solid;
|
|
128
147
|
outline-color: var(--np-color-secondary);
|
|
129
148
|
outline-width: 3px;
|
package/dist/radio/types.d.ts
CHANGED
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import '../internal/focus-ring.css'
|
|
3
|
+
import IconButton from '../button/IconButton.svelte'
|
|
4
|
+
import ArrowBackIcon from '../icons/ArrowBackIcon.svelte'
|
|
5
|
+
import CloseIcon from '../icons/CloseIcon.svelte'
|
|
6
|
+
import SearchIcon from '../icons/SearchIcon.svelte'
|
|
7
|
+
import type { SearchProps } from './types.js'
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
value = $bindable(''),
|
|
11
|
+
placeholder = '',
|
|
12
|
+
expanded = $bindable(false),
|
|
13
|
+
variant = 'contained',
|
|
14
|
+
view = 'docked',
|
|
15
|
+
leading,
|
|
16
|
+
trailing,
|
|
17
|
+
resultsAttributes,
|
|
18
|
+
label = 'Search',
|
|
19
|
+
clearLabel = 'Clear search',
|
|
20
|
+
backLabel = 'Close search',
|
|
21
|
+
onsearch,
|
|
22
|
+
inputAttributes,
|
|
23
|
+
children,
|
|
24
|
+
element = $bindable(),
|
|
25
|
+
inputElement = $bindable(),
|
|
26
|
+
...attributes
|
|
27
|
+
}: SearchProps = $props()
|
|
28
|
+
|
|
29
|
+
const uid = $props.id()
|
|
30
|
+
const resultsId = `np-search-results-${uid}`
|
|
31
|
+
|
|
32
|
+
const comboboxPopups = ['listbox', 'tree', 'grid', 'dialog']
|
|
33
|
+
const isCombobox = $derived(comboboxPopups.includes(String(resultsAttributes?.role)))
|
|
34
|
+
|
|
35
|
+
let pointerFocus = false
|
|
36
|
+
let focusRing = $state(false)
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<div
|
|
40
|
+
{...attributes}
|
|
41
|
+
bind:this={element}
|
|
42
|
+
class={[
|
|
43
|
+
'np-search',
|
|
44
|
+
`np-search-${variant}`,
|
|
45
|
+
`np-search-${view}`,
|
|
46
|
+
expanded && 'np-search-expanded',
|
|
47
|
+
attributes.class,
|
|
48
|
+
]}
|
|
49
|
+
onkeydown={(event) => {
|
|
50
|
+
pointerFocus = false
|
|
51
|
+
attributes.onkeydown?.(event)
|
|
52
|
+
}}
|
|
53
|
+
onfocusout={(event) => {
|
|
54
|
+
const next = event.relatedTarget
|
|
55
|
+
if (expanded && !(next instanceof Node && element?.contains(next))) expanded = false
|
|
56
|
+
attributes.onfocusout?.(event)
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
<div class="np-search-container">
|
|
60
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
61
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
62
|
+
<div
|
|
63
|
+
class={['np-search-bar', focusRing && 'np-search-focus-ring']}
|
|
64
|
+
onpointerdown={() => (pointerFocus = true)}
|
|
65
|
+
onclick={() => inputElement?.focus()}
|
|
66
|
+
>
|
|
67
|
+
<div class="np-search-state-layer"></div>
|
|
68
|
+
<span class="np-search-leading">
|
|
69
|
+
{#if leading}
|
|
70
|
+
{@render leading()}
|
|
71
|
+
{:else if expanded}
|
|
72
|
+
<IconButton
|
|
73
|
+
title={backLabel}
|
|
74
|
+
onclick={(event) => {
|
|
75
|
+
event.stopPropagation()
|
|
76
|
+
expanded = false
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
<ArrowBackIcon />
|
|
80
|
+
</IconButton>
|
|
81
|
+
{:else}
|
|
82
|
+
<span class="np-search-leading-icon"><SearchIcon /></span>
|
|
83
|
+
{/if}
|
|
84
|
+
</span>
|
|
85
|
+
|
|
86
|
+
<input
|
|
87
|
+
{...inputAttributes}
|
|
88
|
+
bind:this={inputElement}
|
|
89
|
+
bind:value
|
|
90
|
+
type="search"
|
|
91
|
+
class="np-search-input"
|
|
92
|
+
{placeholder}
|
|
93
|
+
aria-label={label}
|
|
94
|
+
role={isCombobox ? 'combobox' : undefined}
|
|
95
|
+
aria-expanded={isCombobox ? expanded : undefined}
|
|
96
|
+
aria-autocomplete={isCombobox ? 'list' : undefined}
|
|
97
|
+
aria-controls={resultsId}
|
|
98
|
+
autocomplete="off"
|
|
99
|
+
onpointerdown={(event) => {
|
|
100
|
+
pointerFocus = true
|
|
101
|
+
inputAttributes?.onpointerdown?.(event)
|
|
102
|
+
}}
|
|
103
|
+
onfocus={(event) => {
|
|
104
|
+
expanded = true
|
|
105
|
+
focusRing = !pointerFocus
|
|
106
|
+
pointerFocus = false
|
|
107
|
+
inputAttributes?.onfocus?.(event)
|
|
108
|
+
}}
|
|
109
|
+
onblur={(event) => {
|
|
110
|
+
focusRing = false
|
|
111
|
+
inputAttributes?.onblur?.(event)
|
|
112
|
+
}}
|
|
113
|
+
onkeydown={(event) => {
|
|
114
|
+
if (event.key === 'Enter') onsearch?.(value)
|
|
115
|
+
if (event.key === 'Escape' && expanded) {
|
|
116
|
+
expanded = false
|
|
117
|
+
inputElement?.blur()
|
|
118
|
+
}
|
|
119
|
+
inputAttributes?.onkeydown?.(event)
|
|
120
|
+
}}
|
|
121
|
+
/>
|
|
122
|
+
|
|
123
|
+
<span class="np-search-trailing">
|
|
124
|
+
{#if value}
|
|
125
|
+
<IconButton
|
|
126
|
+
title={clearLabel}
|
|
127
|
+
onclick={() => {
|
|
128
|
+
value = ''
|
|
129
|
+
pointerFocus = true
|
|
130
|
+
inputElement?.focus()
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
<CloseIcon />
|
|
134
|
+
</IconButton>
|
|
135
|
+
{/if}
|
|
136
|
+
{#if trailing}
|
|
137
|
+
{@render trailing()}
|
|
138
|
+
{/if}
|
|
139
|
+
</span>
|
|
140
|
+
</div>
|
|
141
|
+
|
|
142
|
+
<div
|
|
143
|
+
{...resultsAttributes}
|
|
144
|
+
id={resultsId}
|
|
145
|
+
class={['np-search-results', resultsAttributes?.class]}
|
|
146
|
+
>
|
|
147
|
+
{@render children?.()}
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
<style>
|
|
153
|
+
.np-search {
|
|
154
|
+
--_bar-height: 3.5rem;
|
|
155
|
+
--_pane-margin: var(--np-search-pane-margin, 1.5rem);
|
|
156
|
+
display: flex;
|
|
157
|
+
flex-direction: column;
|
|
158
|
+
box-sizing: border-box;
|
|
159
|
+
width: 100%;
|
|
160
|
+
min-width: 0;
|
|
161
|
+
padding-inline: var(--_pane-margin);
|
|
162
|
+
}
|
|
163
|
+
.np-search-contained.np-search-expanded {
|
|
164
|
+
--_pane-margin: var(--np-search-view-margin, 0.75rem);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
168
|
+
.np-search {
|
|
169
|
+
transition: padding var(--np-motion-expressive-default-spatial);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.np-search-docked {
|
|
174
|
+
position: relative;
|
|
175
|
+
block-size: var(--_bar-height);
|
|
176
|
+
padding-inline: 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.np-search-container {
|
|
180
|
+
display: flex;
|
|
181
|
+
flex-direction: column;
|
|
182
|
+
box-sizing: border-box;
|
|
183
|
+
gap: 0.125rem;
|
|
184
|
+
min-height: 0;
|
|
185
|
+
width: 100%;
|
|
186
|
+
min-width: min(22.5rem, 100%);
|
|
187
|
+
max-width: var(--np-search-width, 45rem);
|
|
188
|
+
margin-inline: auto;
|
|
189
|
+
}
|
|
190
|
+
.np-search-docked .np-search-container {
|
|
191
|
+
position: absolute;
|
|
192
|
+
inset-block-start: 0;
|
|
193
|
+
inset-inline: var(--_pane-margin);
|
|
194
|
+
width: calc(100% - 2 * var(--_pane-margin));
|
|
195
|
+
min-width: min(22.5rem, calc(100% - 2 * var(--_pane-margin)));
|
|
196
|
+
z-index: var(--np-search-z-index, 3);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
200
|
+
.np-search-docked .np-search-container {
|
|
201
|
+
transition:
|
|
202
|
+
inset-inline-start var(--np-motion-expressive-default-spatial),
|
|
203
|
+
inset-inline-end var(--np-motion-expressive-default-spatial),
|
|
204
|
+
width var(--np-motion-expressive-default-spatial),
|
|
205
|
+
min-width var(--np-motion-expressive-default-spatial);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.np-search-docked.np-search-expanded .np-search-container {
|
|
209
|
+
animation: unroll var(--np-motion-expressive-default-spatial);
|
|
210
|
+
}
|
|
211
|
+
.np-search-docked.np-search-expanded .np-search-results {
|
|
212
|
+
animation: fadeIn var(--np-motion-expressive-default-effects);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
@keyframes unroll {
|
|
216
|
+
from {
|
|
217
|
+
clip-path: inset(-1.5rem -1.5rem calc(100% - var(--_bar-height)) -1.5rem);
|
|
218
|
+
}
|
|
219
|
+
to {
|
|
220
|
+
clip-path: inset(-1.5rem);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
@keyframes fadeIn {
|
|
224
|
+
from {
|
|
225
|
+
opacity: 0;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.np-search-bar {
|
|
230
|
+
position: relative;
|
|
231
|
+
display: flex;
|
|
232
|
+
align-items: center;
|
|
233
|
+
box-sizing: border-box;
|
|
234
|
+
flex: none;
|
|
235
|
+
gap: 0.5rem;
|
|
236
|
+
padding-inline: 0.5rem;
|
|
237
|
+
height: var(--_bar-height);
|
|
238
|
+
border-radius: var(--np-search-shape, var(--np-shape-corner-full));
|
|
239
|
+
background-color: var(--np-search-container-color, var(--np-color-surface-container-high));
|
|
240
|
+
color: var(--np-color-on-surface);
|
|
241
|
+
}
|
|
242
|
+
.np-search:not(.np-search-expanded) .np-search-bar {
|
|
243
|
+
cursor: pointer;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
247
|
+
.np-search-bar {
|
|
248
|
+
transition:
|
|
249
|
+
height var(--np-motion-expressive-default-spatial),
|
|
250
|
+
background-color var(--np-motion-expressive-fast-effects);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.np-search-state-layer {
|
|
255
|
+
position: absolute;
|
|
256
|
+
inset: 0;
|
|
257
|
+
border-radius: inherit;
|
|
258
|
+
pointer-events: none;
|
|
259
|
+
background-color: var(--np-color-on-surface);
|
|
260
|
+
opacity: 0;
|
|
261
|
+
}
|
|
262
|
+
@media (hover: hover) {
|
|
263
|
+
.np-search:not(.np-search-expanded) .np-search-bar:hover .np-search-state-layer {
|
|
264
|
+
opacity: 0.08;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
.np-search:not(.np-search-expanded) .np-search-bar:active .np-search-state-layer {
|
|
268
|
+
opacity: 0.1;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.np-search-leading,
|
|
272
|
+
.np-search-trailing,
|
|
273
|
+
.np-search-input {
|
|
274
|
+
position: relative;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.np-search-leading,
|
|
278
|
+
.np-search-trailing {
|
|
279
|
+
display: flex;
|
|
280
|
+
align-items: center;
|
|
281
|
+
flex: none;
|
|
282
|
+
}
|
|
283
|
+
.np-search-trailing {
|
|
284
|
+
gap: 0;
|
|
285
|
+
}
|
|
286
|
+
.np-search-leading {
|
|
287
|
+
--np-icon-button-icon-color: var(--np-color-on-surface);
|
|
288
|
+
}
|
|
289
|
+
.np-search-trailing {
|
|
290
|
+
--np-icon-button-icon-color: var(--np-color-on-surface-variant);
|
|
291
|
+
}
|
|
292
|
+
.np-search-leading-icon {
|
|
293
|
+
display: flex;
|
|
294
|
+
align-items: center;
|
|
295
|
+
justify-content: center;
|
|
296
|
+
block-size: 2.5rem;
|
|
297
|
+
inline-size: 2.5rem;
|
|
298
|
+
fill: var(--np-color-on-surface);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.np-search-input {
|
|
302
|
+
flex: 1;
|
|
303
|
+
min-width: 0;
|
|
304
|
+
appearance: none;
|
|
305
|
+
border: none;
|
|
306
|
+
outline: none;
|
|
307
|
+
background: none;
|
|
308
|
+
font: inherit;
|
|
309
|
+
font-size: 1rem;
|
|
310
|
+
line-height: 1.5rem;
|
|
311
|
+
letter-spacing: 0.03125rem;
|
|
312
|
+
color: var(--np-color-on-surface);
|
|
313
|
+
padding: 0;
|
|
314
|
+
cursor: inherit;
|
|
315
|
+
}
|
|
316
|
+
.np-search-input::placeholder {
|
|
317
|
+
color: var(--np-color-on-surface-variant);
|
|
318
|
+
opacity: 1;
|
|
319
|
+
}
|
|
320
|
+
.np-search-input::-webkit-search-cancel-button {
|
|
321
|
+
appearance: none;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.np-search-focus-ring {
|
|
325
|
+
outline-style: solid;
|
|
326
|
+
outline-color: var(--np-search-focus-indicator-color, var(--np-color-secondary));
|
|
327
|
+
outline-width: 3px;
|
|
328
|
+
outline-offset: 2px;
|
|
329
|
+
}
|
|
330
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
331
|
+
.np-search-focus-ring {
|
|
332
|
+
animation: focusAnimation var(--np-motion-expressive-slow-effects) forwards;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.np-search-results {
|
|
337
|
+
display: none;
|
|
338
|
+
box-sizing: border-box;
|
|
339
|
+
overflow-y: auto;
|
|
340
|
+
overscroll-behavior: contain;
|
|
341
|
+
}
|
|
342
|
+
.np-search-expanded .np-search-results {
|
|
343
|
+
display: block;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.np-search-docked .np-search-results {
|
|
347
|
+
max-height: var(--np-search-results-max-height, 66.6667dvh);
|
|
348
|
+
}
|
|
349
|
+
.np-search-contained.np-search-docked .np-search-results {
|
|
350
|
+
border-radius: var(--np-search-results-shape, var(--np-shape-corner-medium));
|
|
351
|
+
background-color: var(--np-search-container-color, var(--np-color-surface-container-high));
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.np-search-divided.np-search-expanded .np-search-bar {
|
|
355
|
+
border-radius: 0;
|
|
356
|
+
background-color: transparent;
|
|
357
|
+
border-block-end: 1px solid var(--np-search-divider-color, var(--np-color-outline));
|
|
358
|
+
}
|
|
359
|
+
.np-search-divided.np-search-docked.np-search-expanded .np-search-container {
|
|
360
|
+
gap: 0;
|
|
361
|
+
border-radius: var(--np-search-results-shape, var(--np-shape-corner-extra-large));
|
|
362
|
+
background-color: var(--np-search-container-color, var(--np-color-surface-container-high));
|
|
363
|
+
}
|
|
364
|
+
.np-search-divided.np-search-docked.np-search-expanded .np-search-results {
|
|
365
|
+
border-end-start-radius: inherit;
|
|
366
|
+
border-end-end-radius: inherit;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.np-search-full-screen.np-search-expanded {
|
|
370
|
+
position: fixed;
|
|
371
|
+
inset: 0;
|
|
372
|
+
z-index: var(--np-search-z-index, 24);
|
|
373
|
+
padding-block-start: var(--_pane-margin);
|
|
374
|
+
background-color: var(--np-search-view-background-color, var(--np-color-surface-container-low));
|
|
375
|
+
}
|
|
376
|
+
.np-search-full-screen.np-search-expanded .np-search-container {
|
|
377
|
+
flex: 1;
|
|
378
|
+
max-width: none;
|
|
379
|
+
}
|
|
380
|
+
.np-search-full-screen.np-search-expanded .np-search-results {
|
|
381
|
+
flex: 1;
|
|
382
|
+
max-height: none;
|
|
383
|
+
}
|
|
384
|
+
.np-search-divided.np-search-full-screen.np-search-expanded {
|
|
385
|
+
padding: 0;
|
|
386
|
+
background-color: var(--np-search-container-color, var(--np-color-surface-container-high));
|
|
387
|
+
}
|
|
388
|
+
.np-search-divided.np-search-full-screen.np-search-expanded .np-search-bar {
|
|
389
|
+
height: 4.5rem;
|
|
390
|
+
}
|
|
391
|
+
</style>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import '../internal/focus-ring.css';
|
|
2
|
+
import type { SearchProps } from './types.ts';
|
|
3
|
+
declare const Search: import("svelte").Component<SearchProps, {}, "element" | "value" | "inputElement" | "expanded">;
|
|
4
|
+
type Search = ReturnType<typeof Search>;
|
|
5
|
+
export default Search;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Search } from './Search.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Search } from './Search.svelte';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes, HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
+
export interface SearchProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onsearch'> {
|
|
4
|
+
value?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
expanded?: boolean;
|
|
7
|
+
variant?: 'contained' | 'divided';
|
|
8
|
+
view?: 'docked' | 'full-screen';
|
|
9
|
+
leading?: Snippet;
|
|
10
|
+
trailing?: Snippet;
|
|
11
|
+
label?: string;
|
|
12
|
+
clearLabel?: string;
|
|
13
|
+
backLabel?: string;
|
|
14
|
+
onsearch?: (value: string) => void;
|
|
15
|
+
inputAttributes?: HTMLInputAttributes;
|
|
16
|
+
resultsAttributes?: HTMLAttributes<HTMLDivElement>;
|
|
17
|
+
element?: HTMLDivElement;
|
|
18
|
+
inputElement?: HTMLInputElement;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|