fluent-svelte-extra 1.2.3 → 1.2.5

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 CHANGED
@@ -1,7 +1,11 @@
1
1
  # fluent-svelte-extra
2
2
 
3
- like fluent-svelte but with more components lol.
3
+ A fork of fluent-svelte which is in active development.
4
+
5
+ # Undocumented Components
6
+
7
+ Components that we develop won't be in docs. But you can view the detailed usage [here](https://github.com/OpenAnime/fluent-svelte-extra/blob/main/src/routes/test/index.svelte)
4
8
 
5
9
  # Note
6
10
 
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.
11
+ Thanks to the [creator](https://github.com/Tropix126) of [fluent-svelte](https://github.com/tropix126/fluent-svelte) library for making such an awesome library!
@@ -0,0 +1,112 @@
1
+ @use "../mixins" as *;
2
+
3
+ .text-area {
4
+ @include typography-body;
5
+ box-sizing: border-box;
6
+ word-break: break-all;
7
+ flex-grow: 1;
8
+ overflow-y: auto;
9
+ overflow-x: hidden;
10
+ border: none;
11
+ outline: none;
12
+ cursor: unset;
13
+ margin: 0;
14
+ flex: 1 1 auto;
15
+ inline-size: 100%;
16
+ min-block-size: 30px;
17
+ padding: 6px 12px;
18
+ border-radius: var(--control-corner-radius);
19
+ color: var(--text-primary);
20
+ background-color: transparent;
21
+ &::placeholder {
22
+ user-select: none;
23
+ color: var(--text-secondary);
24
+ }
25
+ &::-webkit-search-decoration,
26
+ &::-webkit-search-cancel-button,
27
+ &::-webkit-search-results-button,
28
+ &::-webkit-search-results-decoration {
29
+ -webkit-appearance: none;
30
+ }
31
+ &::-ms-reveal {
32
+ display: none;
33
+ }
34
+ &:disabled {
35
+ color: var(--text-disabled);
36
+
37
+ &::placeholder {
38
+ color: var(--text-disabled);
39
+ }
40
+ }
41
+ &-container {
42
+ @include flex($align: center);
43
+ cursor: text;
44
+ position: relative;
45
+ inline-size: 100%;
46
+ border-radius: var(--control-corner-radius);
47
+ background-clip: padding-box;
48
+ background-color: var(--control-fill-default);
49
+ border: 1px solid var(--control-stroke-default);
50
+ &:hover {
51
+ background-color: var(--control-fill-secondary);
52
+ }
53
+ &.disabled {
54
+ cursor: default;
55
+ background-color: var(--control-fill-disabled);
56
+ .text-area-underline {
57
+ display: none;
58
+ }
59
+ }
60
+ &:focus-within {
61
+ background-color: var(--control-fill-input-active);
62
+ .text-area::placeholder {
63
+ color: var(--text-tertiary);
64
+ }
65
+ .text-area-underline::after {
66
+ border-bottom: 2px solid var(--accent-default);
67
+ }
68
+ :global(.text-area-clear-button) {
69
+ display: flex;
70
+ }
71
+ }
72
+ }
73
+ &-underline {
74
+ position: absolute;
75
+ inset-inline-start: -1px;
76
+ inset-block-start: -1px;
77
+ inline-size: calc(100% + 2px);
78
+ block-size: calc(100% + 2px);
79
+ pointer-events: none;
80
+ border-radius: var(--control-corner-radius);
81
+ overflow: hidden;
82
+ &::after {
83
+ content: "";
84
+ box-sizing: border-box;
85
+ position: absolute;
86
+ inset-block-end: 0;
87
+ inset-inline-start: 0;
88
+ inline-size: 100%;
89
+ block-size: 100%;
90
+ border-bottom: var(--bottom-border);
91
+ }
92
+ }
93
+ &-buttons {
94
+ @include flex($align: center);
95
+ cursor: default;
96
+ flex: 0 0 auto;
97
+ :global {
98
+ > .text-area-button {
99
+ margin-inline-start: 6px;
100
+ &:first-of-type {
101
+ margin-inline-start: 0;
102
+ }
103
+ &:last-of-type {
104
+ margin-inline-end: 4px;
105
+ }
106
+ }
107
+ .text-area-clear-button {
108
+ display: none;
109
+ }
110
+ }
111
+ }
112
+ }
@@ -0,0 +1,54 @@
1
+ <script >import { createEventDispatcher } from "svelte";
2
+ import { get_current_component } from "svelte/internal";
3
+ import { externalMouseEvents, createEventForwarder } from "../internal";
4
+ /** The input's current value. */
5
+ export let value = "dsads";
6
+ export let disableBottomBorder = false;
7
+ export let spellcheck = false;
8
+ /** The initial placeholder text displayed if no value is present. */
9
+ export let placeholder = undefined;
10
+ /** Determines whether the textarea can be typed in or not. */
11
+ export let readonly = false;
12
+ /** Controls whether the TextArea is intended for user interaction, and styles it accordingly. */
13
+ export let disabled = false;
14
+ /** Specifies a custom class name for the TextArea container. */
15
+ let className = "";
16
+ export { className as class };
17
+ /** Obtains a bound DOM reference to the TextArea's input element. */
18
+ export let textAreaElement = null;
19
+ /** Obtains a bound DOM reference to the TextArea's container element. */
20
+ export let containerElement = null;
21
+ const dispatch = createEventDispatcher();
22
+ const forwardEvents = createEventForwarder(get_current_component(), [
23
+ "lineBreak"
24
+ ]);
25
+ const inputProps = {
26
+ class: "text-area",
27
+ disabled: disabled || undefined,
28
+ readonly: readonly || undefined,
29
+ placeholder: placeholder || undefined,
30
+ ...$$restProps
31
+ };
32
+ </script>
33
+
34
+ <!--
35
+ @component
36
+ textarea.
37
+ - Usage:
38
+ ```tsx
39
+ <TextArea />
40
+ ```
41
+ -->
42
+ <div
43
+ class="text-area-container {className}"
44
+ class:disabled
45
+ bind:this={containerElement}
46
+ use:externalMouseEvents={{ type: "mousedown" }}
47
+ on:outermousedown
48
+ >
49
+
50
+ <div role="textbox" spellcheck={spellcheck} contenteditable="true" bind:this={textAreaElement} use:forwardEvents {...inputProps} bind:textContent={value}></div>
51
+ <div class="text-area-underline" style={disableBottomBorder ? "--fds-bottom-border: none;" : "--fds-bottom-border: 1px solid var(--fds-control-strong-stroke-default);"} />
52
+ </div>
53
+
54
+ <style >.text-area{background-color:transparent;border:none;border-radius:var(--fds-control-corner-radius);box-sizing:border-box;color:var(--fds-text-primary);cursor:unset;flex-grow:1;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;overflow-x:hidden;overflow-y:auto;padding:6px 12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;word-break:break-all}.text-area::-moz-placeholder{color:var(--fds-text-secondary);-moz-user-select:none;user-select:none}.text-area:-ms-input-placeholder{color:var(--fds-text-secondary);-ms-user-select:none;user-select:none}.text-area::placeholder{color:var(--fds-text-secondary);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.text-area::-webkit-search-cancel-button,.text-area::-webkit-search-decoration,.text-area::-webkit-search-results-button,.text-area::-webkit-search-results-decoration{-webkit-appearance:none}.text-area::-ms-reveal{display:none}.text-area:disabled{color:var(--fds-text-disabled)}.text-area:disabled::-moz-placeholder{color:var(--fds-text-disabled)}.text-area:disabled:-ms-input-placeholder{color:var(--fds-text-disabled)}.text-area:disabled::placeholder{color:var(--fds-text-disabled)}.text-area-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-area-container:hover{background-color:var(--fds-control-fill-secondary)}.text-area-container.disabled{background-color:var(--fds-control-fill-disabled);cursor:default}.text-area-container.disabled .text-area-underline{display:none}.text-area-container:focus-within{background-color:var(--fds-control-fill-input-active)}.text-area-container:focus-within .text-area::-moz-placeholder{color:var(--fds-text-tertiary)}.text-area-container:focus-within .text-area:-ms-input-placeholder{color:var(--fds-text-tertiary)}.text-area-container:focus-within .text-area::placeholder{color:var(--fds-text-tertiary)}.text-area-container:focus-within .text-area-underline:after{border-bottom:2px solid var(--fds-accent-default)}.text-area-container:focus-within :global(.text-area-clear-button){display:flex}.text-area-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-area-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-area-buttons{align-items:center;cursor:default;display:flex;flex:0 0 auto}.text-area-buttons >:global(.text-area-button){-webkit-margin-start:6px;margin-inline-start:6px}.text-area-buttons >:global(.text-area-button:first-of-type){-webkit-margin-start:0;margin-inline-start:0}.text-area-buttons >:global(.text-area-button:last-of-type){-webkit-margin-end:4px;margin-inline-end:4px}.text-area-buttons :global(.text-area-clear-button){display:none}</style>
@@ -0,0 +1,34 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ value?: any;
6
+ disableBottomBorder?: boolean;
7
+ spellcheck?: boolean;
8
+ placeholder?: string;
9
+ readonly?: boolean;
10
+ disabled?: boolean;
11
+ class?: string;
12
+ textAreaElement?: HTMLDivElement;
13
+ containerElement?: HTMLDivElement;
14
+ };
15
+ events: {
16
+ outermousedown: MouseEvent | UIEvent | Event | KeyboardEvent | ClipboardEvent | AnimationEvent | InputEvent | FocusEvent | CompositionEvent | DragEvent | ErrorEvent | FormDataEvent | PointerEvent | ProgressEvent<EventTarget> | SecurityPolicyViolationEvent | SubmitEvent | TouchEvent | TransitionEvent | WheelEvent;
17
+ } & {
18
+ [evt: string]: CustomEvent<any>;
19
+ };
20
+ slots: {};
21
+ };
22
+ export declare type TextAreaProps = typeof __propDef.props;
23
+ export declare type TextAreaEvents = typeof __propDef.events;
24
+ export declare type TextAreaSlots = typeof __propDef.slots;
25
+ /**
26
+ * textarea.
27
+ * - Usage:
28
+ * ```tsx
29
+ * <TextArea />
30
+ * ```
31
+ */
32
+ export default class TextArea extends SvelteComponentTyped<TextAreaProps, TextAreaEvents, TextAreaSlots> {
33
+ }
34
+ export {};
package/index.d.ts CHANGED
@@ -32,3 +32,4 @@ export { default as NavigationView } from "./NavigationView/NavigationView.svelt
32
32
  export { default as RangeSlider } from "./RangeSlider/RangeSlider.svelte";
33
33
  export { default as Flipper } from "./Flipper/Flipper.svelte";
34
34
  export { default as ExpandMenu } from "./ExpandMenu/ExpandMenu.svelte";
35
+ export { default as TextArea } from "./TextArea/TextArea.svelte";
package/index.js CHANGED
@@ -32,3 +32,4 @@ export { default as NavigationView } from "./NavigationView/NavigationView.svelt
32
32
  export { default as RangeSlider } from "./RangeSlider/RangeSlider.svelte";
33
33
  export { default as Flipper } from "./Flipper/Flipper.svelte";
34
34
  export { default as ExpandMenu } from "./ExpandMenu/ExpandMenu.svelte";
35
+ export { default as TextArea } from "./TextArea/TextArea.svelte";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluent-svelte-extra",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
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",
@@ -140,6 +140,8 @@
140
140
  "./ScrollView/ScrollView.svelte": "./ScrollView/ScrollView.svelte",
141
141
  "./Slider/Slider.scss": "./Slider/Slider.scss",
142
142
  "./Slider/Slider.svelte": "./Slider/Slider.svelte",
143
+ "./TextArea/TextArea.scss": "./TextArea/TextArea.scss",
144
+ "./TextArea/TextArea.svelte": "./TextArea/TextArea.svelte",
143
145
  "./TextBlock/TextBlock.scss": "./TextBlock/TextBlock.scss",
144
146
  "./TextBlock/TextBlock.svelte": "./TextBlock/TextBlock.svelte",
145
147
  "./TextBox/TextBox.scss": "./TextBox/TextBox.scss",