fluent-svelte-extra 1.0.0

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.
Files changed (145) hide show
  1. package/.prettierignore +1 -0
  2. package/.prettierrc +7 -0
  3. package/CHANGELOG.md +7 -0
  4. package/LICENSE +21 -0
  5. package/README.md +33 -0
  6. package/package.json +83 -0
  7. package/src/app.html +12 -0
  8. package/src/global.d.ts +1 -0
  9. package/src/lib/AutoSuggestBox/AutoSuggestBox.scss +44 -0
  10. package/src/lib/AutoSuggestBox/AutoSuggestBox.svelte +173 -0
  11. package/src/lib/Button/Button.scss +94 -0
  12. package/src/lib/Button/Button.svelte +48 -0
  13. package/src/lib/CalendarDatePicker/CalendarDatePicker.scss +15 -0
  14. package/src/lib/CalendarDatePicker/CalendarDatePicker.svelte +86 -0
  15. package/src/lib/CalendarView/CalendarView.scss +156 -0
  16. package/src/lib/CalendarView/CalendarView.svelte +753 -0
  17. package/src/lib/CalendarView/CalendarViewItem.scss +130 -0
  18. package/src/lib/CalendarView/CalendarViewItem.svelte +33 -0
  19. package/src/lib/Checkbox/Checkbox.scss +117 -0
  20. package/src/lib/Checkbox/Checkbox.svelte +81 -0
  21. package/src/lib/ComboBox/ComboBox.scss +152 -0
  22. package/src/lib/ComboBox/ComboBox.svelte +360 -0
  23. package/src/lib/ComboBox/ComboBoxItem.scss +80 -0
  24. package/src/lib/ComboBox/ComboBoxItem.svelte +30 -0
  25. package/src/lib/ContentDialog/ContentDialog.scss +68 -0
  26. package/src/lib/ContentDialog/ContentDialog.svelte +123 -0
  27. package/src/lib/ContextMenu/ContextMenu.scss +11 -0
  28. package/src/lib/ContextMenu/ContextMenu.svelte +104 -0
  29. package/src/lib/Expander/Expander.scss +134 -0
  30. package/src/lib/Expander/Expander.svelte +123 -0
  31. package/src/lib/Flipper/Flipper.svelte +49 -0
  32. package/src/lib/Flyout/FlyoutSurface.scss +14 -0
  33. package/src/lib/Flyout/FlyoutSurface.svelte +21 -0
  34. package/src/lib/Flyout/FlyoutWrapper.scss +81 -0
  35. package/src/lib/Flyout/FlyoutWrapper.svelte +126 -0
  36. package/src/lib/IconButton/IconButton.scss +31 -0
  37. package/src/lib/IconButton/IconButton.svelte +49 -0
  38. package/src/lib/InfoBadge/InfoBadge.scss +39 -0
  39. package/src/lib/InfoBadge/InfoBadge.svelte +81 -0
  40. package/src/lib/InfoBar/InfoBar.scss +122 -0
  41. package/src/lib/InfoBar/InfoBar.svelte +133 -0
  42. package/src/lib/ListItem/ListItem.scss +74 -0
  43. package/src/lib/ListItem/ListItem.svelte +88 -0
  44. package/src/lib/MenuBar/MenuBar.scss +10 -0
  45. package/src/lib/MenuBar/MenuBar.svelte +49 -0
  46. package/src/lib/MenuBar/MenuBarItem.scss +38 -0
  47. package/src/lib/MenuBar/MenuBarItem.svelte +135 -0
  48. package/src/lib/MenuBar/flyoutState.ts +5 -0
  49. package/src/lib/MenuFlyout/MenuFlyoutDivider.scss +7 -0
  50. package/src/lib/MenuFlyout/MenuFlyoutDivider.svelte +14 -0
  51. package/src/lib/MenuFlyout/MenuFlyoutItem.scss +147 -0
  52. package/src/lib/MenuFlyout/MenuFlyoutItem.svelte +239 -0
  53. package/src/lib/MenuFlyout/MenuFlyoutSurface.scss +42 -0
  54. package/src/lib/MenuFlyout/MenuFlyoutSurface.svelte +28 -0
  55. package/src/lib/MenuFlyout/MenuFlyoutWrapper.scss +64 -0
  56. package/src/lib/MenuFlyout/MenuFlyoutWrapper.svelte +114 -0
  57. package/src/lib/NavigationView/NavigationView.scss +0 -0
  58. package/src/lib/NavigationView/NavigationView.svelte +82 -0
  59. package/src/lib/NumberBox/NumberBox.scss +31 -0
  60. package/src/lib/NumberBox/NumberBox.svelte +267 -0
  61. package/src/lib/PersonPicture/PersonPicture.scss +35 -0
  62. package/src/lib/PersonPicture/PersonPicture.svelte +62 -0
  63. package/src/lib/ProgressBar/ProgressBar.scss +83 -0
  64. package/src/lib/ProgressBar/ProgressBar.svelte +60 -0
  65. package/src/lib/ProgressRing/ProgressRing.scss +37 -0
  66. package/src/lib/ProgressRing/ProgressRing.svelte +73 -0
  67. package/src/lib/RadioButton/RadioButton.scss +114 -0
  68. package/src/lib/RadioButton/RadioButton.svelte +67 -0
  69. package/src/lib/RangeSlider/RangeSlider.svelte +91 -0
  70. package/src/lib/ScrollView/ScrollView.svelte +9 -0
  71. package/src/lib/Slider/Slider.scss +263 -0
  72. package/src/lib/Slider/Slider.svelte +261 -0
  73. package/src/lib/TextBlock/TextBlock.scss +62 -0
  74. package/src/lib/TextBlock/TextBlock.svelte +70 -0
  75. package/src/lib/TextBox/TextBox.scss +108 -0
  76. package/src/lib/TextBox/TextBox.svelte +225 -0
  77. package/src/lib/TextBox/TextBoxButton.scss +34 -0
  78. package/src/lib/TextBox/TextBoxButton.svelte +27 -0
  79. package/src/lib/ToggleSwitch/ToggleSwitch.scss +118 -0
  80. package/src/lib/ToggleSwitch/ToggleSwitch.svelte +55 -0
  81. package/src/lib/Tooltip/TooltipSurface.scss +16 -0
  82. package/src/lib/Tooltip/TooltipSurface.svelte +27 -0
  83. package/src/lib/Tooltip/TooltipWrapper.scss +66 -0
  84. package/src/lib/Tooltip/TooltipWrapper.svelte +117 -0
  85. package/src/lib/_mixins.scss +130 -0
  86. package/src/lib/index.ts +33 -0
  87. package/src/lib/internal.ts +213 -0
  88. package/src/lib/svelte-jsx.d.ts +14 -0
  89. package/src/lib/theme.css +414 -0
  90. package/src/routes/__layout.svelte +48 -0
  91. package/src/routes/docs/__layout.svelte +122 -0
  92. package/src/routes/docs/components/button.md +43 -0
  93. package/src/routes/docs/components/calendarview.md +188 -0
  94. package/src/routes/docs/components/checkbox.md +87 -0
  95. package/src/routes/docs/components/contentdialog.md +155 -0
  96. package/src/routes/docs/components/expander.md +115 -0
  97. package/src/routes/docs/components/flyout.md +107 -0
  98. package/src/routes/docs/components/iconbutton.md +39 -0
  99. package/src/routes/docs/components/infobadge.md +54 -0
  100. package/src/routes/docs/components/infobar.md +102 -0
  101. package/src/routes/docs/components/listitem.md +87 -0
  102. package/src/routes/docs/components/personpicture.md +125 -0
  103. package/src/routes/docs/components/progressring.md +83 -0
  104. package/src/routes/docs/components/radiobutton.md +88 -0
  105. package/src/routes/docs/components/slider.md +165 -0
  106. package/src/routes/docs/components/textblock.md +46 -0
  107. package/src/routes/docs/components/textbox.md +124 -0
  108. package/src/routes/docs/components/toggleswitch.md +73 -0
  109. package/src/routes/docs/getting-started.md +116 -0
  110. package/src/routes/docs/index.md +37 -0
  111. package/src/routes/docs/internals/index.md +0 -0
  112. package/src/routes/index.svelte +121 -0
  113. package/src/routes/test/__layout-test.svelte +1 -0
  114. package/src/routes/test/index.svelte +757 -0
  115. package/src/routes/test/nav.svelte +7 -0
  116. package/src/site/data/docs.ts +176 -0
  117. package/src/site/data/home.ts +12 -0
  118. package/src/site/lib/APIDocs/APIDocs.svelte +178 -0
  119. package/src/site/lib/APIDocs/ParsedComponent.d.ts +85 -0
  120. package/src/site/lib/CopyBox/CopyBox.svelte +23 -0
  121. package/src/site/lib/Example/Example.scss +33 -0
  122. package/src/site/lib/Example/Example.svelte +18 -0
  123. package/src/site/lib/HeroCard/HeroCard.scss +24 -0
  124. package/src/site/lib/HeroCard/HeroCard.svelte +36 -0
  125. package/src/site/lib/Metadata/Metadata.svelte +14 -0
  126. package/src/site/lib/Navbar/Navbar.scss +92 -0
  127. package/src/site/lib/Navbar/Navbar.svelte +47 -0
  128. package/src/site/lib/PageSection/PageSection.scss +57 -0
  129. package/src/site/lib/PageSection/PageSection.svelte +10 -0
  130. package/src/site/lib/Showcase/Showcase.scss +53 -0
  131. package/src/site/lib/Showcase/Showcase.svelte +67 -0
  132. package/src/site/lib/Toc/Toc.scss +18 -0
  133. package/src/site/lib/Toc/Toc.svelte +59 -0
  134. package/src/site/lib/TreeView/TreeView.svelte +89 -0
  135. package/src/site/lib/index.ts +9 -0
  136. package/src/site/styles/_markdown.scss +260 -0
  137. package/src/site/styles/_mixins.scss +319 -0
  138. package/src/site/styles/global.scss +40 -0
  139. package/src/site/styles/pages/docs.scss +74 -0
  140. package/src/site/styles/pages/home.scss +134 -0
  141. package/static/bloom-mica-dark.png +0 -0
  142. package/static/bloom-mica-light.png +0 -0
  143. package/static/logo.svg +11 -0
  144. package/svelte.config.js +57 -0
  145. package/tsconfig.json +38 -0
@@ -0,0 +1 @@
1
+ src/routes/docs/**
package/.prettierrc ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "useTabs": true,
3
+ "tabWidth": 4,
4
+ "trailingComma": "none",
5
+ "arrowParens": "avoid",
6
+ "printWidth": 100
7
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # fluent-svelte-extra
2
+
3
+ like fluent-svelte but with more components lol.
4
+
5
+ # Note
6
+
7
+ this is a fork of the fluent-svelte package. The difference between is this package has more components. Thanks to the creator of fluent-svelte package.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021-2022 Fluent Svelte Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,33 @@
1
+ <h1 align="center">
2
+ <img src="https://raw.githubusercontent.com/Tropix126/fluent-svelte/e78982fb9fa48a6ea0b7cc61f4ff8fae9df88db3/static/logo.svg" width="72" height="128" />
3
+ <br />
4
+ Fluent Svelte
5
+ </h1>
6
+
7
+ > Warning: This project is still in alpha stages; I would not consider it production ready _yet_. Assume any undocumented component to be in the 0.x. phase of development and therefore unstable.
8
+
9
+ ### What is this?
10
+
11
+ `fluent-svelte` is an experimental [Svelte](http://svelte.dev/) component UI library that emulates the look and feel of [Microsoft's Windows UI Controls](https://github.com/microsoft/microsoft-ui-xaml/) which conform to the Fluent Design System.
12
+
13
+ ### Features
14
+
15
+ - [SvelteKit](https://kit.svelte.dev/) and SSR Compatible
16
+ - [TypeScript](https://typescriptlang.org/) and type definitions are supported, but optional.
17
+ - Full RTL support with no additional configuration.
18
+ - All components are accessible according to [WAI-ARIA](https://www.w3.org/WAI/standards-guidelines/aria/) standards.
19
+ - Theming support using CSS custom properties.
20
+ - Minimal third-party dependency usage.
21
+ - Reduced motion support.
22
+ - Easy setup. Just install the library, add some base styles, and you're ready to go.
23
+ - Minimal CSS overhead. Styles are included and scoped alongside their respective components, only bundling the CSS you need.
24
+
25
+ ### Undocumented Components
26
+
27
+ The documentation site (https://fluent-svelte.vercel.app/) is still not entirely finished. Many components exported in the library are not yet documented. That progress can be tracked [here](https://github.com/Tropix126/fluent-svelte/issues/13). For now, i've setup a testing page with every component included in the library that is viewable [here](https://fluent-svelte.vercel.app/test). It's source can be viewed [here](https://github.com/Tropix126/fluent-svelte/blob/main/src/routes/test/index.svelte).
28
+
29
+ Please keep in mind that any undocumented component is _considered to be in the 0.x phase of development_. This means that they could potentially recieve breaking API changes or be heavily updated before being finalized.
30
+
31
+ ### Changelog
32
+
33
+ See [CHANGELOG.md](https://github.com/Tropix126/fluent-svelte/blob/main/CHANGELOG.md).
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "fluent-svelte-extra",
3
+ "version": "1.0.0",
4
+ "description": "A faithful implementation of Microsoft's Fluent Design System in Svelte.",
5
+ "homepage": "https://github.com/OpenAnime/fluent-svelte-extra",
6
+ "license": "MIT",
7
+ "author": {
8
+ "name": "SpongeBed",
9
+ "url": "https://github.com/SpongeBed81"
10
+ },
11
+ "keywords": [
12
+ "design",
13
+ "design-system",
14
+ "design-language",
15
+ "microsoft",
16
+ "fluent",
17
+ "fluentui",
18
+ "fluent-design",
19
+ "fluent-design-system",
20
+ "svelte",
21
+ "svelte3",
22
+ "sveltejs",
23
+ "svelte-component",
24
+ "svelte-components",
25
+ "ui-components",
26
+ "winui",
27
+ "windows"
28
+ ],
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/OpenAnime/fluent-svelte-extra.git"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/OpenAnime/fluent-svelte-extra/issues"
35
+ },
36
+ "scripts": {
37
+ "dev": "svelte-kit dev",
38
+ "build": "svelte-kit build",
39
+ "package": "svelte-kit package",
40
+ "preview": "svelte-kit preview",
41
+ "check": "svelte-check --tsconfig ./tsconfig.json",
42
+ "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
43
+ "lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. .",
44
+ "format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
45
+ },
46
+ "devDependencies": {
47
+ "@fec/remark-a11y-emoji": "^3.1.0",
48
+ "@fluentui/svg-icons": "^1.1.166",
49
+ "@sveltejs/adapter-vercel": "next",
50
+ "@sveltejs/kit": "^1.0.0-next.310",
51
+ "@sveltejs/svelte-repl": "^0.2.2",
52
+ "@types/prismjs": "^1.26.0",
53
+ "autoprefixer": "^10.4.4",
54
+ "cssnano": "^5.1.7",
55
+ "mdsvex": "^0.9.8",
56
+ "mdsvexamples": "0.2.3",
57
+ "panzoom": "^9.4.2",
58
+ "postcss": "^8.4.12",
59
+ "postcss-variables-prefixer": "^1.1.1",
60
+ "prettier": "^2.6.2",
61
+ "prettier-plugin-svelte": "^2.7.0",
62
+ "prism-svelte": "^0.4.7",
63
+ "prismjs": "^1.27.0",
64
+ "rehype-slug": "^5.0.1",
65
+ "remark-github": "^11.2.2",
66
+ "sass": "^1.50.0",
67
+ "svelte": "^3.47.0",
68
+ "svelte-check": "^2.6.0",
69
+ "svelte-codesandbox": "^1.0.0",
70
+ "svelte-preprocess": "^4.10.5",
71
+ "svelte2tsx": "^0.4.14",
72
+ "tslib": "^2.3.1",
73
+ "typescript": "^4.6.3",
74
+ "vite-node": "^0.1.27",
75
+ "vite-plugin-sveld": "^1.0.3"
76
+ },
77
+ "dependencies": {
78
+ "@bulatdashiev/svelte-slider": "^1.0.3",
79
+ "focus-trap": "^6.7.3",
80
+ "tabbable": "^5.2.1"
81
+ },
82
+ "type": "module"
83
+ }
package/src/app.html ADDED
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="/logo.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ %svelte.head%
8
+ </head>
9
+ <body>
10
+ <div id="svelte">%svelte.body%</div>
11
+ </body>
12
+ </html>
@@ -0,0 +1 @@
1
+ /// <reference types="@sveltejs/kit" />
@@ -0,0 +1,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
+ }
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
+ }
@@ -0,0 +1,173 @@
1
+ <script lang="ts">
2
+ import { createEventDispatcher } from "svelte";
3
+ import { uid } from "$lib/internal";
4
+
5
+ import TextBox from "../TextBox/TextBox.svelte";
6
+ import ListItem from "../ListItem/ListItem.svelte";
7
+
8
+ /** @extends {"../TextBox/TextBox.svelte"} */
9
+ /** The input's current value. */
10
+ export let value: any = "";
11
+
12
+ /** Array of strings that will be suggested to the user as options. */
13
+ export let items: string[] = [];
14
+
15
+ /** The current visibility state of the suggestion flyout. */
16
+ export let open = false;
17
+
18
+ /** Bindable index of the currently selected item. */
19
+ export let selection = 0;
20
+
21
+ /** Bindable array of currently suggested items. */
22
+ export let matches: string[] = [];
23
+
24
+ /** Specifies a custom class name for the component. */
25
+ let className = "";
26
+ export { className as class };
27
+
28
+ /** Obtains a bound DOM reference to the input element. */
29
+ export let inputElement: HTMLInputElement = null;
30
+
31
+ /** Obtains a bound DOM reference to the AutoSuggestBox's container element. */
32
+ export let containerElement: HTMLDivElement = null;
33
+
34
+ /** Obtains a bound DOM reference to the AutoSuggestBox's buttons container element. */
35
+ export let buttonsContainerElement: HTMLDivElement = null;
36
+
37
+ /** Obtains a bound DOM reference to the AutoSuggestBox's clear button element. Only available if `clearButton` is set to true, `readonly` is set to false, and a `value` is present. */
38
+ export let clearButtonElement: HTMLButtonElement = null;
39
+
40
+ /** Obtains a bound DOM reference to the AutoSuggestBox's search button element. Only available if `type` is set to `search`. */
41
+ export let searchButtonElement: HTMLButtonElement = null;
42
+
43
+ export let flyoutElement: HTMLUListElement = null;
44
+
45
+ let focused = false;
46
+ let typedValue = "";
47
+
48
+ const dispatch = createEventDispatcher();
49
+ const flyoutId = uid("fds-auto-suggest-flyout-");
50
+
51
+ $: matches = items.filter(item => item.toLowerCase().includes(typedValue.toLowerCase()));
52
+ $: selection, dispatchSelect();
53
+
54
+ function dispatchSelect() {
55
+ dispatch("select", {
56
+ item: items[selection],
57
+ index: selection
58
+ });
59
+ }
60
+
61
+ function handleInput() {
62
+ typedValue = inputElement.value;
63
+ if (focused && value && items.length > 0) open = true;
64
+ }
65
+
66
+ function handleKeyDown(event: KeyboardEvent) {
67
+ const { key } = event;
68
+ if (open && matches.length > 0) {
69
+ if (key === "ArrowDown") {
70
+ selection++;
71
+ if (selection > matches.length - 1) selection = 0;
72
+ } else if (key === "ArrowUp") {
73
+ selection--;
74
+ if (selection < 0) selection = matches.length - 1;
75
+ } else if (key === "Enter" || key === "Escape") {
76
+ open = false;
77
+ }
78
+ if (key === "Enter" || key === "ArrowDown" || key === "ArrowUp") {
79
+ event.preventDefault();
80
+ value = matches[selection];
81
+ flyoutElement?.children[selection].scrollIntoView({ block: "nearest" });
82
+ }
83
+ } else if (!open && matches.length > 0 && (key === "ArrowDown" || key === "ArrowUp")) {
84
+ open = true;
85
+ }
86
+ }
87
+ </script>
88
+
89
+ <TextBox
90
+ type="search"
91
+ class="auto-suggest-box {open && matches.length > 0 ? 'open' : ''} {className}"
92
+ aria-autocomplete="list"
93
+ aria-activedescendant={open && matches.length > 0
94
+ ? `${flyoutId}-item-${items.indexOf(matches[selection])}`
95
+ : ""}
96
+ aria-expanded={open && matches.length > 0}
97
+ aria-controls={flyoutId}
98
+ on:search={() => {
99
+ if (open && matches.length > 0) value = matches[selection];
100
+ }}
101
+ on:search
102
+ on:input
103
+ on:input={handleInput}
104
+ on:outermousedown={() => (open = false)}
105
+ on:focus={() => (focused = true)}
106
+ on:focus
107
+ on:blur={() => (focused = false)}
108
+ on:blur
109
+ on:keydown={handleKeyDown}
110
+ on:keydown
111
+ on:change
112
+ on:beforeinput
113
+ on:click
114
+ on:dblclick
115
+ on:contextmenu
116
+ on:mousedown
117
+ on:mouseup
118
+ on:mouseover
119
+ on:mouseout
120
+ on:mouseenter
121
+ on:mouseleave
122
+ on:keypress
123
+ on:keyup
124
+ on:clear={() => {
125
+ typedValue = "";
126
+ if (items.length > 0) open = true;
127
+ }}
128
+ on:clear
129
+ bind:inputElement
130
+ bind:containerElement
131
+ bind:clearButtonElement
132
+ bind:searchButtonElement
133
+ bind:buttonsContainerElement
134
+ bind:value
135
+ {...$$restProps}
136
+ >
137
+ {#if open && matches.length > 0}
138
+ <ul id={flyoutId} role="listbox" class="auto-suggest-box-flyout" bind:this={flyoutElement}>
139
+ {#each matches as item, index (item)}
140
+ <div class="auto-suggest-item-wrapper">
141
+ <slot
142
+ name="item-template"
143
+ id="{flyoutId}-item-{index}"
144
+ {value}
145
+ {matches}
146
+ {selection}
147
+ {item}
148
+ {index}
149
+ >
150
+ <ListItem
151
+ tabindex={-1}
152
+ id="{flyoutId}-item-{index}"
153
+ role="option"
154
+ on:click={() => {
155
+ value = matches[selection];
156
+ selection = index;
157
+ open = false;
158
+ }}
159
+ selected={selection === index}>{item}</ListItem
160
+ >
161
+ </slot>
162
+ </div>
163
+ {/each}
164
+ </ul>
165
+ {/if}
166
+
167
+ <slot />
168
+ <slot name="buttons" slot="buttons" />
169
+ </TextBox>
170
+
171
+ <style lang="scss">
172
+ @use "./AutoSuggestBox";
173
+ </style>
@@ -0,0 +1,94 @@
1
+ @use "../mixins" as *;
2
+
3
+ .button {
4
+ @include flex($inline: true, $align: center, $justify: center);
5
+ @include typography-body;
6
+
7
+ position: relative;
8
+ box-sizing: border-box;
9
+ padding-block: 4px 6px;
10
+ padding-inline: 11px;
11
+ text-decoration: none;
12
+ border: none;
13
+ outline: none;
14
+ cursor: default;
15
+ border-radius: var(--control-corner-radius);
16
+ transition: var(--control-faster-duration) ease background;
17
+
18
+ &:focus-visible {
19
+ box-shadow: var(--focus-stroke);
20
+ }
21
+
22
+ &.style- {
23
+ &standard {
24
+ border: 1px solid;
25
+ border-color: var(--control-border-default);
26
+ background-color: var(--control-fill-default);
27
+ color: var(--text-primary);
28
+ background-clip: padding-box;
29
+
30
+ &:hover {
31
+ background-color: var(--control-fill-secondary);
32
+ }
33
+
34
+ &:active {
35
+ border-color: var(--control-stroke-default);
36
+ background-color: var(--control-fill-tertiary);
37
+ color: var(--text-secondary);
38
+ }
39
+
40
+ &.disabled {
41
+ border-color: var(--control-stroke-default);
42
+ background-color: var(--control-fill-disabled);
43
+ color: var(--text-disabled);
44
+ }
45
+ }
46
+
47
+ &accent {
48
+ border: 1px solid var(--control-stroke-on-accent-default);
49
+ border-bottom-color: var(--control-stroke-on-accent-secondary);
50
+ background-color: var(--accent-default);
51
+ color: var(--text-on-accent-primary);
52
+ transition: var(--control-faster-duration) ease border-color;
53
+
54
+ &:hover {
55
+ background-color: var(--accent-secondary);
56
+ }
57
+
58
+ &:active {
59
+ border-color: transparent;
60
+ background-color: var(--accent-tertiary);
61
+ color: var(--text-on-accent-secondary);
62
+ }
63
+
64
+ &.disabled {
65
+ border-color: transparent;
66
+ background-color: var(--accent-disabled);
67
+ color: var(--text-on-accent-disabled);
68
+ }
69
+ }
70
+
71
+ &hyperlink {
72
+ background-color: var(--subtle-fill-transparent);
73
+ color: var(--accent-text-primary);
74
+ cursor: pointer;
75
+
76
+ &:hover {
77
+ background-color: var(--subtle-fill-secondary);
78
+ }
79
+
80
+ &:active {
81
+ background-color: var(--subtle-fill-tertiary);
82
+ color: var(--accent-text-tertiary);
83
+ }
84
+
85
+ &.disabled {
86
+ color: var(--accent-text-disabled);
87
+ }
88
+ }
89
+ }
90
+
91
+ &.disabled {
92
+ pointer-events: none;
93
+ }
94
+ }
@@ -0,0 +1,48 @@
1
+ <script lang="ts">
2
+ import { get_current_component } from "svelte/internal";
3
+ import { createEventForwarder } from "$lib/internal";
4
+
5
+ /** @restProps {button | a} */
6
+ /** Specifies the visual styling of the button. */
7
+ export let variant: "standard" | "accent" | "hyperlink" = "standard";
8
+
9
+ /** Sets an href value and converts the button element into an anchor/ */
10
+ export let href = "";
11
+
12
+ /** Controls whether the button is intended for user interaction, and styles it accordingly. */
13
+ export let disabled = false;
14
+
15
+ /** Specifies a custom class name for the button. */
16
+ let className = "";
17
+ export { className as class };
18
+
19
+ /** Obtains a bound DOM reference to the button or anchor element. */
20
+ export let element: HTMLElement = null;
21
+
22
+ const forwardEvents = createEventForwarder(get_current_component());
23
+ </script>
24
+
25
+ <!--
26
+ @component
27
+ A button gives the user a way to trigger an immediate action. Some buttons are specialized for particular tasks, such as navigation, repeated actions, or presenting menus. [Docs](https://fluent-svelte.vercel.app/docs/components/button)
28
+ - Usage:
29
+ ```tsx
30
+ <Button>Click me!</Button>
31
+ ```
32
+ -->
33
+ <svelte:element
34
+ this={href && !disabled ? "a" : "button"}
35
+ use:forwardEvents
36
+ bind:this={element}
37
+ role={href && !disabled ? "button" : undefined}
38
+ href={href && !disabled ? href : undefined}
39
+ class="button style-{variant} {className}"
40
+ class:disabled
41
+ {...$$restProps}
42
+ >
43
+ <slot />
44
+ </svelte:element>
45
+
46
+ <style lang="scss">
47
+ @use "./Button";
48
+ </style>
@@ -0,0 +1,15 @@
1
+ @use "../mixins" as *;
2
+
3
+ .calendar-date-picker- {
4
+ &label {
5
+ padding-inline-end: 2px;
6
+ &.placeholder:not(.disabled) {
7
+ color: var(--text-secondary);
8
+ }
9
+ }
10
+ &icon {
11
+ @include icon($size: 12px);
12
+ margin-inline-start: 8px;
13
+ color: currentColor;
14
+ }
15
+ }
@@ -0,0 +1,86 @@
1
+ <script lang="ts">
2
+ import CalendarView from "../CalendarView/CalendarView.svelte";
3
+ import Flyout from "../Flyout/FlyoutWrapper.svelte";
4
+ import Button from "../Button/Button.svelte";
5
+
6
+ /** The currently selected calendar date. */
7
+ export let value: Date | null;
8
+
9
+ /** Determines the calendar's flyout's visibility. */
10
+ export let open = false;
11
+
12
+ /** Locale code used for specifying the language of the calendar. If unset, the locale will be automatically inferred from `navigator.language`. */
13
+ export let locale: string = undefined;
14
+
15
+ /** Placeholder text that will be displayed on the calendar's input field if no value is specified. This string is not localized and will be displayed in english if no property is set. */
16
+ export let placeholder = "Pick a date";
17
+
18
+ /** Controls whether the picker is intended for user interaction, and styles it accordingly. */
19
+ export let disabled = false;
20
+
21
+ /** Determines if the flyout can be closed using conventional user interaction. */
22
+ export let closable = true;
23
+
24
+ /** Direction that the flyout will be opened from. */
25
+ export let placement: "top" | "bottom" | "left" | "right" = "bottom";
26
+
27
+ /** Alignment of the menu along the clickable target's given axis. */
28
+ export let alignment: "start" | "center" | "end" = "center";
29
+
30
+ /** Distance of the flyout from the control button in pixels. */
31
+ export let offset = 4;
32
+
33
+ /** Determines if keyboard focus should be locked to the flyout's contents. */
34
+ export let trapFocus = true;
35
+
36
+ function handleKeyDown(event) {
37
+ event.stopPropagation();
38
+ if (event.key === "Escape") open = false;
39
+ }
40
+ </script>
41
+
42
+ <Flyout
43
+ class="calendar-date-picker-container"
44
+ bind:open
45
+ {closable}
46
+ {placement}
47
+ {alignment}
48
+ {offset}
49
+ {trapFocus}
50
+ >
51
+ <Button class="calendar-date-picker-button" {disabled}>
52
+ <span
53
+ class="calendar-date-picker-label"
54
+ class:disabled
55
+ class:placeholder={typeof value === "undefined" || value === null}
56
+ >
57
+ {value?.toLocaleDateString(locale) ?? placeholder}
58
+ </span>
59
+ <svg
60
+ class="calendar-date-picker-icon"
61
+ width="12"
62
+ height="12"
63
+ viewBox="0 0 11 12"
64
+ fill="none"
65
+ xmlns="http://www.w3.org/2000/svg"
66
+ >
67
+ <path
68
+ d="M9.2793 0.75C9.47461 0.75 9.66016 0.791016 9.83594 0.873047C10.0156 0.951172 10.1719 1.05859 10.3047 1.19531C10.4414 1.32813 10.5488 1.48437 10.627 1.66406C10.709 1.83984 10.75 2.02539 10.75 2.2207V9.7793C10.75 9.97461 10.709 10.1621 10.627 10.3418C10.5488 10.5176 10.4414 10.6738 10.3047 10.8105C10.1719 10.9434 10.0156 11.0508 9.83594 11.1328C9.66016 11.2109 9.47461 11.25 9.2793 11.25H1.7207C1.52539 11.25 1.33789 11.2109 1.1582 11.1328C0.982422 11.0508 0.826172 10.9434 0.689453 10.8105C0.556641 10.6738 0.449219 10.5176 0.367188 10.3418C0.289062 10.1621 0.25 9.97461 0.25 9.7793V2.2207C0.25 2.02539 0.289062 1.83984 0.367188 1.66406C0.449219 1.48437 0.556641 1.32813 0.689453 1.19531C0.826172 1.05859 0.982422 0.951172 1.1582 0.873047C1.33789 0.791016 1.52539 0.75 1.7207 0.75H9.2793ZM1.75 1.5C1.64453 1.5 1.54688 1.51953 1.45703 1.55859C1.36719 1.59766 1.28711 1.65234 1.2168 1.72266C1.15039 1.78906 1.09766 1.86719 1.05859 1.95703C1.01953 2.04688 1 2.14453 1 2.25V3H10V2.25C10 2.14844 9.98047 2.05273 9.94141 1.96289C9.90234 1.86914 9.84766 1.78906 9.77734 1.72266C9.71094 1.65234 9.63086 1.59766 9.53711 1.55859C9.44727 1.51953 9.35156 1.5 9.25 1.5H1.75ZM9.25 10.5C9.35547 10.5 9.45312 10.4805 9.54297 10.4414C9.63281 10.4023 9.71094 10.3496 9.77734 10.2832C9.84766 10.2129 9.90234 10.1328 9.94141 10.043C9.98047 9.95312 10 9.85547 10 9.75V3.75H1V9.75C1 9.85547 1.01953 9.95508 1.05859 10.0488C1.09766 10.1387 1.15039 10.2168 1.2168 10.2832C1.2832 10.3496 1.36133 10.4023 1.45117 10.4414C1.54492 10.4805 1.64453 10.5 1.75 10.5H9.25ZM2.5 6C2.5 5.89453 2.51953 5.79688 2.55859 5.70703C2.59766 5.61719 2.65039 5.53906 2.7168 5.47266C2.78711 5.40234 2.86719 5.34766 2.95703 5.30859C3.05078 5.26953 3.15039 5.25 3.25586 5.25C3.36133 5.25 3.45898 5.26953 3.54883 5.30859C3.63867 5.34766 3.7168 5.40039 3.7832 5.4668C3.84961 5.5332 3.90234 5.61133 3.94141 5.70117C3.98047 5.79102 4 5.88867 4 5.99414C4 6.09961 3.98047 6.19922 3.94141 6.29297C3.90234 6.38281 3.84766 6.46289 3.77734 6.5332C3.71094 6.59961 3.63281 6.65234 3.54297 6.69141C3.45312 6.73047 3.35547 6.75 3.25 6.75C3.14453 6.75 3.04492 6.73047 2.95117 6.69141C2.86133 6.65234 2.7832 6.59961 2.7168 6.5332C2.65039 6.4668 2.59766 6.38867 2.55859 6.29883C2.51953 6.20508 2.5 6.10547 2.5 6ZM4.75 6C4.75 5.89453 4.76953 5.79688 4.80859 5.70703C4.84766 5.61719 4.90039 5.53906 4.9668 5.47266C5.03711 5.40234 5.11719 5.34766 5.20703 5.30859C5.30078 5.26953 5.40039 5.25 5.50586 5.25C5.61133 5.25 5.70898 5.26953 5.79883 5.30859C5.88867 5.34766 5.9668 5.40039 6.0332 5.4668C6.09961 5.5332 6.15234 5.61133 6.19141 5.70117C6.23047 5.79102 6.25 5.88867 6.25 5.99414C6.25 6.09961 6.23047 6.19922 6.19141 6.29297C6.15234 6.38281 6.09766 6.46289 6.02734 6.5332C5.96094 6.59961 5.88281 6.65234 5.79297 6.69141C5.70312 6.73047 5.60547 6.75 5.5 6.75C5.39453 6.75 5.29492 6.73047 5.20117 6.69141C5.11133 6.65234 5.0332 6.59961 4.9668 6.5332C4.90039 6.4668 4.84766 6.38867 4.80859 6.29883C4.76953 6.20508 4.75 6.10547 4.75 6ZM8.5 5.99414C8.5 6.09961 8.48047 6.19922 8.44141 6.29297C8.40234 6.38281 8.34766 6.46289 8.27734 6.5332C8.21094 6.59961 8.13281 6.65234 8.04297 6.69141C7.95312 6.73047 7.85547 6.75 7.75 6.75C7.64453 6.75 7.54492 6.73047 7.45117 6.69141C7.36133 6.65234 7.2832 6.59961 7.2168 6.5332C7.15039 6.4668 7.09766 6.38867 7.05859 6.29883C7.01953 6.20508 7 6.10547 7 6C7 5.89453 7.01953 5.79688 7.05859 5.70703C7.09766 5.61719 7.15039 5.53906 7.2168 5.47266C7.28711 5.40234 7.36719 5.34766 7.45703 5.30859C7.55078 5.26953 7.65039 5.25 7.75586 5.25C7.86133 5.25 7.95898 5.26953 8.04883 5.30859C8.13867 5.34766 8.2168 5.40039 8.2832 5.4668C8.34961 5.5332 8.40234 5.61133 8.44141 5.70117C8.48047 5.79102 8.5 5.88867 8.5 5.99414ZM4 8.25C4 8.35547 3.98047 8.45312 3.94141 8.54297C3.90234 8.63281 3.84766 8.71289 3.77734 8.7832C3.71094 8.84961 3.63086 8.90234 3.53711 8.94141C3.44727 8.98047 3.34961 9 3.24414 9C3.13867 9 3.04102 8.98047 2.95117 8.94141C2.86133 8.90234 2.7832 8.84961 2.7168 8.7832C2.65039 8.7168 2.59766 8.63867 2.55859 8.54883C2.51953 8.45898 2.5 8.36133 2.5 8.25586C2.5 8.15039 2.51953 8.05273 2.55859 7.96289C2.59766 7.86914 2.65039 7.78906 2.7168 7.72266C2.78711 7.65234 2.86719 7.59766 2.95703 7.55859C3.04688 7.51953 3.14453 7.5 3.25 7.5C3.35547 7.5 3.45312 7.51953 3.54297 7.55859C3.63672 7.59766 3.7168 7.65039 3.7832 7.7168C3.84961 7.7832 3.90234 7.86328 3.94141 7.95703C3.98047 8.04688 4 8.14453 4 8.25ZM6.25 8.25C6.25 8.35547 6.23047 8.45312 6.19141 8.54297C6.15234 8.63281 6.09766 8.71289 6.02734 8.7832C5.96094 8.84961 5.88086 8.90234 5.78711 8.94141C5.69727 8.98047 5.59961 9 5.49414 9C5.38867 9 5.29102 8.98047 5.20117 8.94141C5.11133 8.90234 5.0332 8.84961 4.9668 8.7832C4.90039 8.7168 4.84766 8.63867 4.80859 8.54883C4.76953 8.45898 4.75 8.36133 4.75 8.25586C4.75 8.15039 4.76953 8.05273 4.80859 7.96289C4.84766 7.86914 4.90039 7.78906 4.9668 7.72266C5.03711 7.65234 5.11719 7.59766 5.20703 7.55859C5.29688 7.51953 5.39453 7.5 5.5 7.5C5.60547 7.5 5.70312 7.51953 5.79297 7.55859C5.88672 7.59766 5.9668 7.65039 6.0332 7.7168C6.09961 7.7832 6.15234 7.86328 6.19141 7.95703C6.23047 8.04688 6.25 8.14453 6.25 8.25Z"
69
+ />
70
+ </svg>
71
+ </Button>
72
+ <CalendarView
73
+ slot="override"
74
+ class="calendar-date-picker-calendar"
75
+ multiple={false}
76
+ __floating
77
+ on:keydown={handleKeyDown}
78
+ on:change={() => (open = false)}
79
+ bind:value
80
+ {...$$restProps}
81
+ />
82
+ </Flyout>
83
+
84
+ <style lang="scss">
85
+ @use "./CalendarDatePicker";
86
+ </style>