fluent-svelte-extra 1.1.1 → 1.1.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.
@@ -5,6 +5,7 @@ import ListItem from "../ListItem/ListItem.svelte";
5
5
  /** @extends {"../TextBox/TextBox.svelte"} */
6
6
  /** The input's current value. */
7
7
  export let value = "";
8
+ export let maxSuggestions = 99999;
8
9
  /** Array of strings that will be suggested to the user as options. */
9
10
  export let items = [];
10
11
  /** The current visibility state of the suggestion flyout. */
@@ -31,7 +32,13 @@ let focused = false;
31
32
  let typedValue = "";
32
33
  const dispatch = createEventDispatcher();
33
34
  const flyoutId = uid("fds-auto-suggest-flyout-");
34
- $: matches = items.filter(item => item.toLowerCase().includes(typedValue.toLowerCase()));
35
+ $: {
36
+ const filter = items.filter(item => item.toLowerCase().includes(typedValue.toLowerCase()));
37
+ if (filter.length > maxSuggestions) {
38
+ filter.length = maxSuggestions; //slice it
39
+ }
40
+ matches = filter;
41
+ }
35
42
  $: selection, dispatchSelect();
36
43
  function dispatchSelect() {
37
44
  dispatch("select", {
@@ -3,6 +3,7 @@ declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
5
  value?: any;
6
+ maxSuggestions?: number;
6
7
  items?: string[];
7
8
  open?: boolean;
8
9
  selection?: number;
@@ -83,7 +83,7 @@
83
83
  inset-inline-start: 0;
84
84
  inline-size: 100%;
85
85
  block-size: 100%;
86
- border-bottom: 1px solid var(--control-strong-stroke-default);
86
+ border-bottom: var(--bottom-border);
87
87
  }
88
88
  }
89
89
  &-buttons {
@@ -4,6 +4,7 @@ import { externalMouseEvents, createEventForwarder } from "../internal";
4
4
  import TextBoxButton from "../TextBox/TextBoxButton.svelte";
5
5
  /** The input's current value. */
6
6
  export let value = "";
7
+ export let disableBottomBorder = false;
7
8
  /** Determiness the input type of the textbox. */
8
9
  export let type = "text";
9
10
  /** The initial placeholder text displayed if no value is present. */
@@ -115,7 +116,7 @@ The TextBox control lets a user type text into an app. The text displays on the
115
116
  {:else if type === "week"}
116
117
  <input type="week" bind:value bind:this={inputElement} use:forwardEvents {...inputProps} />
117
118
  {/if}
118
- <div class="text-box-underline" />
119
+ <div class="text-box-underline" style={disableBottomBorder ? "--fds-bottom-border: none;" : "--fds-bottom-border: 1px solid var(--fds-control-strong-stroke-default);"} />
119
120
  <div class="text-box-buttons" bind:this={buttonsContainerElement}>
120
121
  {#if !disabled}
121
122
  {#if clearButton && value && !readonly}
@@ -185,4 +186,4 @@ The TextBox control lets a user type text into an app. The text displays on the
185
186
  <slot />
186
187
  </div>
187
188
 
188
- <style >.text-box{background-color:transparent;border:none;border-radius:var(--fds-control-corner-radius);box-sizing:border-box;color:var(--fds-text-primary);cursor:unset;flex:1 1 auto;font-family:var(--fds-font-family-text);font-size:var(--fds-body-font-size);font-weight:400;inline-size:100%;line-height:20px;margin:0;min-block-size:30px;outline:none;padding-inline:10px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.text-box::-moz-placeholder{color:var(--fds-text-secondary);-moz-user-select:none;user-select:none}.text-box:-ms-input-placeholder{color:var(--fds-text-secondary);-ms-user-select:none;user-select:none}.text-box::placeholder{color:var(--fds-text-secondary);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.text-box::-webkit-search-cancel-button,.text-box::-webkit-search-decoration,.text-box::-webkit-search-results-button,.text-box::-webkit-search-results-decoration{-webkit-appearance:none}.text-box::-ms-reveal{display:none}.text-box:disabled{color:var(--fds-text-disabled)}.text-box:disabled::-moz-placeholder{color:var(--fds-text-disabled)}.text-box:disabled:-ms-input-placeholder{color:var(--fds-text-disabled)}.text-box:disabled::placeholder{color:var(--fds-text-disabled)}.text-box-container{align-items:center;background-clip:padding-box;background-color:var(--fds-control-fill-default);border:1px solid var(--fds-control-stroke-default);border-radius:var(--fds-control-corner-radius);cursor:text;display:flex;inline-size:100%;position:relative}.text-box-container:hover{background-color:var(--fds-control-fill-secondary)}.text-box-container.disabled{background-color:var(--fds-control-fill-disabled);cursor:default}.text-box-container.disabled .text-box-underline{display:none}.text-box-container:focus-within{background-color:var(--fds-control-fill-input-active)}.text-box-container:focus-within .text-box::-moz-placeholder{color:var(--fds-text-tertiary)}.text-box-container:focus-within .text-box:-ms-input-placeholder{color:var(--fds-text-tertiary)}.text-box-container:focus-within .text-box::placeholder{color:var(--fds-text-tertiary)}.text-box-container:focus-within .text-box-underline:after{border-bottom:2px solid var(--fds-accent-default)}.text-box-container:focus-within :global(.text-box-clear-button){display:flex}.text-box-underline{block-size:calc(100% + 2px);border-radius:var(--fds-control-corner-radius);inline-size:calc(100% + 2px);inset-block-start:-1px;inset-inline-start:-1px;overflow:hidden;pointer-events:none;position:absolute}.text-box-underline:after{block-size:100%;border-bottom:1px solid var(--fds-control-strong-stroke-default);box-sizing:border-box;content:"";inline-size:100%;inset-block-end:0;inset-inline-start:0;position:absolute}.text-box-buttons{align-items:center;cursor:default;display:flex;flex:0 0 auto}.text-box-buttons >:global(.text-box-button){-webkit-margin-start:6px;margin-inline-start:6px}.text-box-buttons >:global(.text-box-button:first-of-type){-webkit-margin-start:0;margin-inline-start:0}.text-box-buttons >:global(.text-box-button:last-of-type){-webkit-margin-end:4px;margin-inline-end:4px}.text-box-buttons :global(.text-box-clear-button){display:none}</style>
189
+ <style >.text-box{background-color:transparent;border:none;border-radius:var(--fds-control-corner-radius);box-sizing:border-box;color:var(--fds-text-primary);cursor:unset;flex:1 1 auto;font-family:var(--fds-font-family-text);font-size:var(--fds-body-font-size);font-weight:400;inline-size:100%;line-height:20px;margin:0;min-block-size:30px;outline:none;padding-inline:10px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.text-box::-moz-placeholder{color:var(--fds-text-secondary);-moz-user-select:none;user-select:none}.text-box:-ms-input-placeholder{color:var(--fds-text-secondary);-ms-user-select:none;user-select:none}.text-box::placeholder{color:var(--fds-text-secondary);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.text-box::-webkit-search-cancel-button,.text-box::-webkit-search-decoration,.text-box::-webkit-search-results-button,.text-box::-webkit-search-results-decoration{-webkit-appearance:none}.text-box::-ms-reveal{display:none}.text-box:disabled{color:var(--fds-text-disabled)}.text-box:disabled::-moz-placeholder{color:var(--fds-text-disabled)}.text-box:disabled:-ms-input-placeholder{color:var(--fds-text-disabled)}.text-box:disabled::placeholder{color:var(--fds-text-disabled)}.text-box-container{align-items:center;background-clip:padding-box;background-color:var(--fds-control-fill-default);border:1px solid var(--fds-control-stroke-default);border-radius:var(--fds-control-corner-radius);cursor:text;display:flex;inline-size:100%;position:relative}.text-box-container:hover{background-color:var(--fds-control-fill-secondary)}.text-box-container.disabled{background-color:var(--fds-control-fill-disabled);cursor:default}.text-box-container.disabled .text-box-underline{display:none}.text-box-container:focus-within{background-color:var(--fds-control-fill-input-active)}.text-box-container:focus-within .text-box::-moz-placeholder{color:var(--fds-text-tertiary)}.text-box-container:focus-within .text-box:-ms-input-placeholder{color:var(--fds-text-tertiary)}.text-box-container:focus-within .text-box::placeholder{color:var(--fds-text-tertiary)}.text-box-container:focus-within .text-box-underline:after{border-bottom:2px solid var(--fds-accent-default)}.text-box-container:focus-within :global(.text-box-clear-button){display:flex}.text-box-underline{block-size:calc(100% + 2px);border-radius:var(--fds-control-corner-radius);inline-size:calc(100% + 2px);inset-block-start:-1px;inset-inline-start:-1px;overflow:hidden;pointer-events:none;position:absolute}.text-box-underline:after{block-size:100%;border-bottom:var(--fds-bottom-border);box-sizing:border-box;content:"";inline-size:100%;inset-block-end:0;inset-inline-start:0;position:absolute}.text-box-buttons{align-items:center;cursor:default;display:flex;flex:0 0 auto}.text-box-buttons >:global(.text-box-button){-webkit-margin-start:6px;margin-inline-start:6px}.text-box-buttons >:global(.text-box-button:first-of-type){-webkit-margin-start:0;margin-inline-start:0}.text-box-buttons >:global(.text-box-button:last-of-type){-webkit-margin-end:4px;margin-inline-end:4px}.text-box-buttons :global(.text-box-clear-button){display:none}</style>
@@ -3,6 +3,7 @@ declare const __propDef: {
3
3
  props: {
4
4
  [x: string]: any;
5
5
  value?: any;
6
+ disableBottomBorder?: boolean;
6
7
  type?: "number" | "search" | "text" | "password" | "email" | "tel" | "url" | "date" | "datetime-local" | "month" | "time" | "week";
7
8
  placeholder?: string;
8
9
  clearButton?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluent-svelte-extra",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "A faithful implementation of Microsoft's Fluent Design System in Svelte.",
5
5
  "homepage": "https://github.com/OpenAnime/fluent-svelte-extra",
6
6
  "license": "MIT",
package/theme.css CHANGED
@@ -23,7 +23,7 @@
23
23
  var(--fds-font-family-fallback);
24
24
  --fds-font-family-display: "Segoe UI Variable Display", "Seoge UI Variable Static Display",
25
25
  var(--fds-font-family-fallback);
26
- --fds-font-family-variable: "Segoe UI"
26
+ --fds-font-family-variable: "Segoe UI Variable";
27
27
 
28
28
  /* Font Size */
29
29
  --fds-caption-font-size: 12px;