fluent-svelte-extra 2.0.2 → 2.0.3

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.
@@ -1,44 +1,50 @@
1
- @use "../mixins" as *;
2
-
3
- .auto-suggest-box-flyout {
4
- z-index: 100;
5
- overflow: auto;
6
- position: absolute;
7
- inset-inline-start: -1px;
8
- inset-block-start: calc(100% + 1px);
9
- inline-size: calc(100% + 2px);
10
- margin: 0;
11
- padding: 0;
12
- padding-block: 2px;
13
- box-sizing: border-box;
14
- color: var(--text-primary);
15
- border-radius: var(--overlay-corner-radius);
16
- border-end-start-radius: 0;
17
- border-end-end-radius: 0;
18
- border: 1px solid var(--surface-stroke-flyout);
19
- background-color: var(--solid-background-quarternary);
20
- background-clip: padding-box;
21
- box-shadow: var(--flyout-shadow);
22
- max-block-size: 472px;
23
- }
24
-
25
- .auto-suggest-item-wrapper {
26
- display: block;
27
- }
28
-
29
- :global {
30
- .auto-suggest-box.open {
31
- background-color: var(--control-fill-input-active) !important;
32
- .text-box-underline::after {
33
- content: "";
34
- border-bottom: 2px solid var(--fds-accent-default);
35
- }
36
- input::placeholder {
37
- color: var(--text-tertiary);
38
- }
39
- .text-box-underline {
40
- border-bottom-left-radius: 0;
41
- border-bottom-right-radius: 0;
42
- }
43
- }
44
- }
1
+ @use "../mixins" as *;
2
+
3
+ .auto-suggest-box-flyout {
4
+ z-index: 100;
5
+ overflow: auto;
6
+ position: absolute;
7
+ inset-inline-start: -1px;
8
+ inset-block-start: calc(100% + 1px);
9
+ inline-size: calc(100% + 2px);
10
+ margin: 0;
11
+ padding: 0;
12
+ padding-block: 2px;
13
+ box-sizing: border-box;
14
+ color: var(--text-primary);
15
+ border-radius: var(--overlay-corner-radius);
16
+ border-end-start-radius: 0;
17
+ border-end-end-radius: 0;
18
+ border: 1px solid var(--surface-stroke-flyout);
19
+ background-color: var(--solid-background-quarternary);
20
+ background-clip: padding-box;
21
+ box-shadow: var(--flyout-shadow);
22
+ max-block-size: 472px;
23
+ &.acrylic {
24
+ background-color: var(--acrylic-fallback-background-base);
25
+ background-image: var(--acrylic-noise-asset-alpha);
26
+ backdrop-filter: var(--acrylic-fallback-filter);
27
+ background-clip: border-box;
28
+ }
29
+ }
30
+
31
+ .auto-suggest-item-wrapper {
32
+ display: block;
33
+ }
34
+
35
+ :global {
36
+ .auto-suggest-box.open {
37
+ background-color: var(--control-fill-input-active) !important;
38
+ .text-box-underline::after {
39
+ content: "";
40
+ border-bottom: 2px solid var(--fds-accent-default);
41
+ }
42
+ input::placeholder {
43
+ color: var(--text-tertiary);
44
+ }
45
+ .text-box-underline {
46
+ border-bottom-left-radius: 0;
47
+ border-bottom-right-radius: 0;
48
+ }
49
+ }
50
+ }
@@ -1,5 +1,5 @@
1
- <svelte:options accessors />
2
-
1
+ <svelte:options accessors />
2
+
3
3
  <script >import { createEventDispatcher } from "svelte";
4
4
  import { uid } from "../internal";
5
5
  import TextBox from "../TextBox/TextBox.svelte";
@@ -12,6 +12,8 @@ export let maxSuggestions = 99999;
12
12
  export let items = [];
13
13
  /** The current visibility state of the suggestion flyout. */
14
14
  export let open = false;
15
+ /** Whether to use acryllic styling for the flyout. */
16
+ export let acrylic = true;
15
17
  /** Disables or enables AutoSuggest mode */
16
18
  export let autoSuggest = true;
17
19
  /** Bindable index of the currently selected item. */
@@ -123,86 +125,86 @@ function handleKeyDown(event) {
123
125
  open = true;
124
126
  }
125
127
  }
126
- </script>
127
-
128
- <TextBox
129
- type="search"
130
- class="auto-suggest-box {open && matches.length > 0 ? 'open' : ''} {className}"
131
- on:search={() => {
132
- if (open && matches.length > 0) value = matches[selection];
133
- }}
134
- on:search
135
- on:input
136
- on:input={handleInput}
137
- on:outermousedown={() => (open = false)}
138
- on:focus={() => (focused = true)}
139
- on:focus
140
- on:blur={() => (focused = false)}
141
- on:blur
142
- on:keydown={handleKeyDown}
143
- on:keydown
144
- on:change
145
- on:beforeinput
146
- on:click
147
- on:dblclick
148
- on:contextmenu
149
- on:mousedown
150
- on:mouseup
151
- on:mouseover
152
- on:mouseout
153
- on:mouseenter
154
- on:mouseleave
155
- on:keypress
156
- on:keyup
157
- on:clear={() => {
158
- typedValue = "";
159
- if (items.length > 0) open = true;
160
- }}
161
- on:clear
162
- bind:inputElement
163
- bind:containerElement
164
- bind:clearButtonElement
165
- bind:searchButtonElement
166
- bind:buttonsContainerElement
167
- bind:value
168
- {...$$restProps}
169
- >
170
- {#if open && matches.length > 0}
171
- <ul id={flyoutId} role="listbox" class="auto-suggest-box-flyout" bind:this={flyoutElement}>
172
- {#each matches as item, index (item)}
173
- <div class="auto-suggest-item-wrapper">
174
- <slot
175
- name="item-template"
176
- id="{flyoutId}-item-{index}"
177
- {value}
178
- {matches}
179
- {selection}
180
- {item}
181
- {index}
182
- >
183
- <ListItem
184
- tabindex={-1}
185
- id="{flyoutId}-item-{index}"
186
- role="option"
187
- on:click={() => {
188
- value = matches[selection];
189
- selection = index;
190
- dispatch("itemSelectedOnPurpose", {
191
- item: matches[selection],
192
- index: selection
193
- });
194
- open = false;
195
- }}
196
- selected={selection === index}>{item}</ListItem
197
- >
198
- </slot>
199
- </div>
200
- {/each}
201
- </ul>
202
- {/if}
203
-
204
- <slot />
205
- <slot name="buttons" slot="buttons" />
206
- </TextBox>
207
-
208
- <style >.auto-suggest-box-flyout{background-clip:padding-box;background-color:var(--fds-solid-background-quarternary);border:1px solid var(--fds-surface-stroke-flyout);border-end-end-radius:0;border-end-start-radius:0;border-radius:var(--fds-overlay-corner-radius);box-shadow:var(--fds-flyout-shadow);box-sizing:border-box;color:var(--fds-text-primary);inline-size:calc(100% + 2px);inset-block-start:calc(100% + 1px);inset-inline-start:-1px;margin:0;max-block-size:472px;overflow:auto;padding:0;padding-block:2px;position:absolute;z-index:100}.auto-suggest-item-wrapper{display:block}:global(.auto-suggest-box.open){background-color:var(--fds-control-fill-input-active)!important}:global(.auto-suggest-box.open) :global(.text-box-underline:after){border-bottom:2px solid var(--fds-accent-default);content:""}:global(.auto-suggest-box.open) :global(input::-moz-placeholder){color:var(--fds-text-tertiary)}:global(.auto-suggest-box.open) :global(input:-ms-input-placeholder){color:var(--fds-text-tertiary)}:global(.auto-suggest-box.open) :global(input::placeholder){color:var(--fds-text-tertiary)}:global(.auto-suggest-box.open) :global(.text-box-underline){border-bottom-left-radius:0;border-bottom-right-radius:0}</style>
128
+ </script>
129
+
130
+ <TextBox
131
+ type="search"
132
+ class="auto-suggest-box {open && matches.length > 0 ? 'open' : ''} {className}"
133
+ on:search={() => {
134
+ if (open && matches.length > 0) value = matches[selection];
135
+ }}
136
+ on:search
137
+ on:input
138
+ on:input={handleInput}
139
+ on:outermousedown={() => (open = false)}
140
+ on:focus={() => (focused = true)}
141
+ on:focus
142
+ on:blur={() => (focused = false)}
143
+ on:blur
144
+ on:keydown={handleKeyDown}
145
+ on:keydown
146
+ on:change
147
+ on:beforeinput
148
+ on:click
149
+ on:dblclick
150
+ on:contextmenu
151
+ on:mousedown
152
+ on:mouseup
153
+ on:mouseover
154
+ on:mouseout
155
+ on:mouseenter
156
+ on:mouseleave
157
+ on:keypress
158
+ on:keyup
159
+ on:clear={() => {
160
+ typedValue = "";
161
+ if (items.length > 0) open = true;
162
+ }}
163
+ on:clear
164
+ bind:inputElement
165
+ bind:containerElement
166
+ bind:clearButtonElement
167
+ bind:searchButtonElement
168
+ bind:buttonsContainerElement
169
+ bind:value
170
+ {...$$restProps}
171
+ >
172
+ {#if open && matches.length > 0}
173
+ <ul id={flyoutId} role="listbox" class="auto-suggest-box-flyout" bind:this={flyoutElement} class:acrylic>
174
+ {#each matches as item, index (item)}
175
+ <div class="auto-suggest-item-wrapper">
176
+ <slot
177
+ name="item-template"
178
+ id="{flyoutId}-item-{index}"
179
+ {value}
180
+ {matches}
181
+ {selection}
182
+ {item}
183
+ {index}
184
+ >
185
+ <ListItem
186
+ tabindex={-1}
187
+ id="{flyoutId}-item-{index}"
188
+ role="option"
189
+ on:click={() => {
190
+ value = matches[selection];
191
+ selection = index;
192
+ dispatch("itemSelectedOnPurpose", {
193
+ item: matches[selection],
194
+ index: selection
195
+ });
196
+ open = false;
197
+ }}
198
+ selected={selection === index}>{item}</ListItem
199
+ >
200
+ </slot>
201
+ </div>
202
+ {/each}
203
+ </ul>
204
+ {/if}
205
+
206
+ <slot />
207
+ <slot name="buttons" slot="buttons" />
208
+ </TextBox>
209
+
210
+ <style >.auto-suggest-box-flyout{background-clip:padding-box;background-color:var(--fds-solid-background-quarternary);border:1px solid var(--fds-surface-stroke-flyout);border-end-end-radius:0;border-end-start-radius:0;border-radius:var(--fds-overlay-corner-radius);box-shadow:var(--fds-flyout-shadow);box-sizing:border-box;color:var(--fds-text-primary);inline-size:calc(100% + 2px);inset-block-start:calc(100% + 1px);inset-inline-start:-1px;margin:0;max-block-size:472px;overflow:auto;padding:0;padding-block:2px;position:absolute;z-index:100}.auto-suggest-box-flyout.acrylic{-webkit-backdrop-filter:var(--fds-acrylic-fallback-filter);backdrop-filter:var(--fds-acrylic-fallback-filter);background-clip:border-box;background-color:var(--fds-acrylic-fallback-background-base);background-image:var(--fds-acrylic-noise-asset-alpha)}.auto-suggest-item-wrapper{display:block}:global(.auto-suggest-box.open){background-color:var(--fds-control-fill-input-active)!important}:global(.auto-suggest-box.open) :global(.text-box-underline:after){border-bottom:2px solid var(--fds-accent-default);content:""}:global(.auto-suggest-box.open) :global(input::-moz-placeholder){color:var(--fds-text-tertiary)}:global(.auto-suggest-box.open) :global(input:-ms-input-placeholder){color:var(--fds-text-tertiary)}:global(.auto-suggest-box.open) :global(input::placeholder){color:var(--fds-text-tertiary)}:global(.auto-suggest-box.open) :global(.text-box-underline){border-bottom-left-radius:0;border-bottom-right-radius:0}</style>
@@ -6,6 +6,7 @@ declare const __propDef: {
6
6
  maxSuggestions?: number;
7
7
  items?: string[];
8
8
  open?: boolean;
9
+ acrylic?: boolean;
9
10
  autoSuggest?: boolean;
10
11
  selection?: number;
11
12
  matches?: string[];
@@ -89,6 +90,9 @@ export default class AutoSuggestBox extends SvelteComponentTyped<AutoSuggestBoxP
89
90
  get open(): boolean;
90
91
  /**accessor*/
91
92
  set open(_: boolean);
93
+ get acrylic(): boolean;
94
+ /**accessor*/
95
+ set acrylic(_: boolean);
92
96
  get autoSuggest(): boolean;
93
97
  /**accessor*/
94
98
  set autoSuggest(_: boolean);
@@ -1,152 +1,158 @@
1
- @use "../mixins" as *;
2
-
3
- @keyframes menu-in {
4
- 0% {
5
- clip-path: var(--grow-clip-path);
6
- }
7
- 100% {
8
- clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
9
- }
10
- }
11
-
12
- @keyframes shadow-in {
13
- 0% {
14
- box-shadow: none;
15
- }
16
- 100% {
17
- box-shadow: var(--flyout-shadow);
18
- }
19
- }
20
-
21
- .combo-box {
22
- position: relative;
23
- display: inline-flex;
24
- user-select: none;
25
-
26
- :global {
27
- .button,
28
- .text-box {
29
- flex: 1 1 auto;
30
- }
31
-
32
- .text-box {
33
- border-color: var(--control-border-default);
34
- &-underline::after {
35
- border-color: transparent;
36
- }
37
- &-container {
38
- cursor: default;
39
- &:focus-visible {
40
- cursor: text;
41
- }
42
- }
43
- }
44
- }
45
-
46
- &.editable {
47
- :global {
48
- .combo-box-textbox:not(:focus-within) {
49
- cursor: default;
50
- border-color: var(--control-border-default);
51
- .text-box-underline::after {
52
- content: none;
53
- }
54
- }
55
- &.combo-box-textbox.disabled {
56
- border-color: var(--control-stroke-default);
57
- }
58
- }
59
- &.open {
60
- :global {
61
- .combo-box-textbox {
62
- cursor: text;
63
- background-color: var(--control-fill-input-active);
64
- .text-box-underline::after {
65
- content: "";
66
- border-bottom: 2px solid var(--fds-accent-default);
67
- }
68
- input::placeholder {
69
- color: var(--text-tertiary);
70
- }
71
- }
72
- .text-box-underline {
73
- border-end-start-radius: 0;
74
- border-end-end-radius: 0;
75
- }
76
- }
77
- }
78
- .combo-box-dropdown {
79
- margin: 0;
80
- inset-inline-start: 0;
81
- inset-block-start: 100%;
82
- inline-size: 100%;
83
- border-radius: var(--overlay-corner-radius);
84
- border-start-start-radius: 0;
85
- border-start-end-radius: 0;
86
- }
87
- .combo-box-icon {
88
- margin: 0;
89
- }
90
- }
91
-
92
- &-label {
93
- flex: 1 1 auto;
94
- text-align: start;
95
- min-block-size: 20px;
96
-
97
- &.placeholder {
98
- color: var(--text-secondary);
99
- }
100
- }
101
-
102
- &.disabled .placeholder {
103
- color: var(--text-disabled);
104
- }
105
-
106
- &-icon {
107
- margin-inline-start: 8px;
108
- inline-size: 12px;
109
- block-size: 12px;
110
- }
111
-
112
- &-dropdown {
113
- z-index: 100;
114
- position: absolute;
115
- box-sizing: border-box;
116
- margin: 0;
117
- margin-block-start: -6px;
118
- margin-inline-start: -5px;
119
- padding: 1px;
120
- border: 1px solid var(--surface-stroke-flyout);
121
- border-radius: var(--overlay-corner-radius);
122
- background-color: var(--solid-background-quarternary);
123
- background-clip: padding-box;
124
- box-shadow: var(--flyout-shadow);
125
- animation: menu-in var(--control-normal-duration) var(--control-fast-out-slow-in-easing),
126
- shadow-in var(--control-normal-duration) var(--control-fast-out-slow-in-easing)
127
- var(--control-normal-duration);
128
- overflow: auto;
129
- inline-size: calc(100% + 8px);
130
- max-block-size: 504px;
131
- inset-block-start: var(--menu-offset, 0);
132
- inset-inline-start: 0;
133
-
134
- @supports (overflow: overlay) {
135
- overflow: overlay;
136
- }
137
-
138
- &.direction- {
139
- &top {
140
- --grow-clip-path: polygon(0 0, 100% 0, 100% 25%, 0 25%);
141
- }
142
-
143
- &center {
144
- --grow-clip-path: polygon(0 25%, 100% 24%, 100% 75%, 0 75%);
145
- }
146
-
147
- &bottom {
148
- --grow-clip-path: polygon(0 75%, 100% 75%, 100% 100%, 0 100%);
149
- }
150
- }
151
- }
152
- }
1
+ @use "../mixins" as *;
2
+
3
+ @keyframes menu-in {
4
+ 0% {
5
+ clip-path: var(--grow-clip-path);
6
+ }
7
+ 100% {
8
+ clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
9
+ }
10
+ }
11
+
12
+ @keyframes shadow-in {
13
+ 0% {
14
+ box-shadow: none;
15
+ }
16
+ 100% {
17
+ box-shadow: var(--flyout-shadow);
18
+ }
19
+ }
20
+
21
+ .combo-box {
22
+ position: relative;
23
+ display: inline-flex;
24
+ user-select: none;
25
+
26
+ :global {
27
+ .button,
28
+ .text-box {
29
+ flex: 1 1 auto;
30
+ }
31
+
32
+ .text-box {
33
+ border-color: var(--control-border-default);
34
+ &-underline::after {
35
+ border-color: transparent;
36
+ }
37
+ &-container {
38
+ cursor: default;
39
+ &:focus-visible {
40
+ cursor: text;
41
+ }
42
+ }
43
+ }
44
+ }
45
+
46
+ &.editable {
47
+ :global {
48
+ .combo-box-textbox:not(:focus-within) {
49
+ cursor: default;
50
+ border-color: var(--control-border-default);
51
+ .text-box-underline::after {
52
+ content: none;
53
+ }
54
+ }
55
+ &.combo-box-textbox.disabled {
56
+ border-color: var(--control-stroke-default);
57
+ }
58
+ }
59
+ &.open {
60
+ :global {
61
+ .combo-box-textbox {
62
+ cursor: text;
63
+ background-color: var(--control-fill-input-active);
64
+ .text-box-underline::after {
65
+ content: "";
66
+ border-bottom: 2px solid var(--fds-accent-default);
67
+ }
68
+ input::placeholder {
69
+ color: var(--text-tertiary);
70
+ }
71
+ }
72
+ .text-box-underline {
73
+ border-end-start-radius: 0;
74
+ border-end-end-radius: 0;
75
+ }
76
+ }
77
+ }
78
+ .combo-box-dropdown {
79
+ margin: 0;
80
+ inset-inline-start: 0;
81
+ inset-block-start: 100%;
82
+ inline-size: 100%;
83
+ border-radius: var(--overlay-corner-radius);
84
+ border-start-start-radius: 0;
85
+ border-start-end-radius: 0;
86
+ }
87
+ .combo-box-icon {
88
+ margin: 0;
89
+ }
90
+ }
91
+
92
+ &-label {
93
+ flex: 1 1 auto;
94
+ text-align: start;
95
+ min-block-size: 20px;
96
+
97
+ &.placeholder {
98
+ color: var(--text-secondary);
99
+ }
100
+ }
101
+
102
+ &.disabled .placeholder {
103
+ color: var(--text-disabled);
104
+ }
105
+
106
+ &-icon {
107
+ margin-inline-start: 8px;
108
+ inline-size: 12px;
109
+ block-size: 12px;
110
+ }
111
+
112
+ &-dropdown {
113
+ z-index: 100;
114
+ position: absolute;
115
+ box-sizing: border-box;
116
+ margin: 0;
117
+ margin-block-start: -6px;
118
+ margin-inline-start: -5px;
119
+ padding: 1px;
120
+ border: 1px solid var(--surface-stroke-flyout);
121
+ border-radius: var(--overlay-corner-radius);
122
+ background-color: var(--solid-background-quarternary);
123
+ background-clip: padding-box;
124
+ box-shadow: var(--flyout-shadow);
125
+ animation: menu-in var(--control-normal-duration) var(--control-fast-out-slow-in-easing),
126
+ shadow-in var(--control-normal-duration) var(--control-fast-out-slow-in-easing)
127
+ var(--control-normal-duration);
128
+ overflow: auto;
129
+ inline-size: calc(100% + 8px);
130
+ max-block-size: 504px;
131
+ inset-block-start: var(--menu-offset, 0);
132
+ inset-inline-start: 0;
133
+
134
+ &.acrylic {
135
+ background-color: var(--acrylic-fallback-background-base);
136
+ background-image: var(--acrylic-noise-asset-alpha);
137
+ backdrop-filter: var(--acrylic-fallback-filter);
138
+ background-clip: border-box;
139
+ }
140
+ @supports (overflow: overlay) {
141
+ overflow: overlay;
142
+ }
143
+
144
+ &.direction- {
145
+ &top {
146
+ --grow-clip-path: polygon(0 0, 100% 0, 100% 25%, 0 25%);
147
+ }
148
+
149
+ &center {
150
+ --grow-clip-path: polygon(0 25%, 100% 24%, 100% 75%, 0 75%);
151
+ }
152
+
153
+ &bottom {
154
+ --grow-clip-path: polygon(0 75%, 100% 75%, 100% 100%, 0 100%);
155
+ }
156
+ }
157
+ }
158
+ }