@streamscloud/kit 0.2.1 → 0.2.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.
- package/dist/styles/_input.scss +98 -0
- package/dist/styles/_mixins.scss +2 -2
- package/dist/styles/reset.css +1 -1
- package/dist/ui/button/resources/button-base.svelte +2 -2
- package/dist/ui/button/resources/button-theme.svelte +18 -15
- package/dist/ui/color-picker/cmp.color-picker.svelte +3 -12
- package/dist/ui/color-picker/cmp.color-picker.svelte.d.ts +3 -9
- package/dist/ui/cropper/img-cropper/cmp.img-cropper-toolbar.svelte +1 -1
- package/dist/ui/dialog/cmp.dialog.svelte +1 -1
- package/dist/ui/dropdown/cmp.dropdown-item.svelte +93 -0
- package/dist/ui/dropdown/cmp.dropdown-item.svelte.d.ts +32 -0
- package/dist/ui/dropdown/cmp.dropdown-panel.svelte +29 -0
- package/dist/ui/dropdown/cmp.dropdown-panel.svelte.d.ts +18 -0
- package/dist/ui/dropdown/cmp.dropdown.svelte +72 -7
- package/dist/ui/dropdown/cmp.dropdown.svelte.d.ts +3 -1
- package/dist/ui/dropdown/index.d.ts +2 -0
- package/dist/ui/dropdown/index.js +2 -0
- package/dist/ui/dynamic-component/cmp.dynamic-component.svelte +0 -5
- package/dist/ui/dynamic-component/cmp.dynamic-component.svelte.d.ts +2 -8
- package/dist/ui/emoji-picker/cmp.emoji-panel.svelte +186 -0
- package/dist/ui/emoji-picker/cmp.emoji-panel.svelte.d.ts +21 -0
- package/dist/ui/emoji-picker/cmp.emoji-picker.svelte +35 -0
- package/dist/ui/emoji-picker/cmp.emoji-picker.svelte.d.ts +15 -0
- package/dist/ui/emoji-picker/emoji-list.d.ts +2 -0
- package/dist/ui/emoji-picker/emoji-list.js +1754 -0
- package/dist/ui/emoji-picker/emoji-picker-localization.d.ts +5 -0
- package/dist/ui/emoji-picker/emoji-picker-localization.js +40 -0
- package/dist/ui/emoji-picker/index.d.ts +2 -0
- package/dist/ui/emoji-picker/index.js +2 -0
- package/dist/ui/emoji-picker/types.d.ts +8 -0
- package/dist/ui/emoji-picker/types.js +1 -0
- package/dist/ui/form-group/cmp.form-group-label.svelte.d.ts +1 -0
- package/dist/ui/form-group/cmp.form-group.svelte.d.ts +1 -0
- package/dist/ui/icon-text/cmp.icon-text.svelte +34 -22
- package/dist/ui/icon-text/cmp.icon-text.svelte.d.ts +14 -13
- package/dist/ui/inputs/index.d.ts +6 -0
- package/dist/ui/inputs/index.js +5 -0
- package/dist/ui/inputs/input/cmp.input-validatable.svelte +57 -0
- package/dist/ui/inputs/input/cmp.input-validatable.svelte.d.ts +56 -0
- package/dist/ui/inputs/input/cmp.input.svelte +235 -0
- package/dist/ui/inputs/input/cmp.input.svelte.d.ts +60 -0
- package/dist/ui/inputs/input/index.d.ts +2 -0
- package/dist/ui/inputs/input/index.js +2 -0
- package/dist/ui/inputs/input-emoji-picker/cmp.input-emoji-picker.svelte +44 -0
- package/dist/ui/inputs/input-emoji-picker/cmp.input-emoji-picker.svelte.d.ts +9 -0
- package/dist/ui/inputs/input-emoji-picker/index.d.ts +2 -0
- package/dist/ui/inputs/input-emoji-picker/index.js +2 -0
- package/dist/ui/inputs/input-emoji-picker/input-emoji-picker-container.d.ts +2 -0
- package/dist/ui/inputs/input-emoji-picker/input-emoji-picker-container.js +16 -0
- package/dist/ui/inputs/numeral-input/cmp.numeral-input-validatable.svelte +55 -0
- package/dist/ui/inputs/numeral-input/cmp.numeral-input-validatable.svelte.d.ts +62 -0
- package/dist/ui/inputs/numeral-input/cmp.numeral-input.svelte +248 -0
- package/dist/ui/inputs/numeral-input/cmp.numeral-input.svelte.d.ts +66 -0
- package/dist/ui/inputs/numeral-input/index.d.ts +2 -0
- package/dist/ui/inputs/numeral-input/index.js +2 -0
- package/dist/ui/inputs/pin-input/cmp.pin-input.svelte +58 -0
- package/dist/ui/inputs/pin-input/cmp.pin-input.svelte.d.ts +23 -0
- package/dist/ui/inputs/pin-input/index.d.ts +1 -0
- package/dist/ui/inputs/pin-input/index.js +1 -0
- package/dist/ui/inputs/pin-input/pin-input-generator.d.ts +27 -0
- package/dist/ui/inputs/pin-input/pin-input-generator.js +114 -0
- package/dist/ui/inputs/rich-text-input/cmp.rich-text-input.svelte +55 -0
- package/dist/ui/inputs/rich-text-input/cmp.rich-text-input.svelte.d.ts +43 -0
- package/dist/ui/inputs/rich-text-input/index.d.ts +2 -0
- package/dist/ui/inputs/rich-text-input/index.js +1 -0
- package/dist/ui/inputs/rich-text-input/rich-text-input-localization.d.ts +12 -0
- package/dist/ui/inputs/rich-text-input/rich-text-input-localization.js +48 -0
- package/dist/ui/inputs/rich-text-input/tinymce-input.svelte +250 -0
- package/dist/ui/inputs/rich-text-input/tinymce-input.svelte.d.ts +25 -0
- package/dist/ui/inputs/rich-text-input/tinymce.declarations.d.ts +7 -0
- package/dist/ui/inputs/rich-text-input/types.d.ts +4 -0
- package/dist/ui/inputs/rich-text-input/types.js +1 -0
- package/dist/ui/inputs/rich-text-input/validated-link-button.d.ts +3 -0
- package/dist/ui/inputs/rich-text-input/validated-link-button.js +78 -0
- package/dist/ui/inputs/textarea/cmp.textarea-validatable.svelte +35 -0
- package/dist/ui/inputs/textarea/cmp.textarea-validatable.svelte.d.ts +53 -0
- package/dist/ui/inputs/textarea/cmp.textarea.svelte +247 -0
- package/dist/ui/inputs/textarea/cmp.textarea.svelte.d.ts +57 -0
- package/dist/ui/inputs/textarea/index.d.ts +2 -0
- package/dist/ui/inputs/textarea/index.js +2 -0
- package/dist/ui/media-viewer-dialog/cmp.media-viewer-dialog.svelte.d.ts +2 -0
- package/dist/ui/selects/_multiselect.scss +282 -0
- package/dist/ui/selects/_singleselect.scss +175 -0
- package/dist/ui/selects/cmp.multiselect.svelte +530 -0
- package/dist/ui/selects/cmp.multiselect.svelte.d.ts +85 -0
- package/dist/ui/selects/cmp.search-multiselect.svelte +532 -0
- package/dist/ui/selects/cmp.search-multiselect.svelte.d.ts +67 -0
- package/dist/ui/selects/cmp.singleselect.svelte +381 -0
- package/dist/ui/selects/cmp.singleselect.svelte.d.ts +78 -0
- package/dist/ui/selects/index.d.ts +5 -0
- package/dist/ui/selects/index.js +4 -0
- package/dist/ui/selects/select-localization.d.ts +6 -0
- package/dist/ui/selects/select-localization.js +27 -0
- package/dist/ui/selects/types.d.ts +29 -0
- package/dist/ui/selects/types.js +1 -0
- package/dist/ui/time-ago/cmp.time-ago.svelte +0 -6
- package/dist/ui/time-ago/cmp.time-ago.svelte.d.ts +2 -6
- package/dist/ui/validatable/_validatable.scss +34 -0
- package/dist/ui/validatable/cmp.validatable.svelte +57 -0
- package/dist/ui/validatable/cmp.validatable.svelte.d.ts +49 -0
- package/dist/ui/validatable/cmp.validation-error.svelte +52 -0
- package/dist/ui/validatable/cmp.validation-error.svelte.d.ts +42 -0
- package/dist/ui/validatable/index.d.ts +2 -0
- package/dist/ui/validatable/index.js +2 -0
- package/package.json +31 -5
- package/dist/ui/color-picker/cmp.input-stub.svelte +0 -98
- package/dist/ui/color-picker/cmp.input-stub.svelte.d.ts +0 -40
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script lang="ts" generics="T extends Record<string, unknown>">import { Utils } from '../../../core/utils';
|
|
2
|
+
import { FormValidationHandler } from '../../../core/validation';
|
|
3
|
+
import { Validatable } from '../../validatable';
|
|
4
|
+
import { default as Textarea } from './cmp.textarea.svelte';
|
|
5
|
+
let { name, handler, placeholder = '', debounce = 0, hidePlaceholderOnFocus = true, submitOnEnter = false, rows = 0, maxlength = 50000, id = '', disabled = false, autofocus = false, on } = $props();
|
|
6
|
+
const onChange = (value) => {
|
|
7
|
+
on?.change?.(value);
|
|
8
|
+
handler.updateValidateField(name, value);
|
|
9
|
+
};
|
|
10
|
+
const handleChangeDebounced = $derived(debounce ? Utils.debounce(onChange, debounce) : onChange);
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Validatable handler={handler} name={name}>
|
|
14
|
+
<Textarea
|
|
15
|
+
id={id}
|
|
16
|
+
autofocus={autofocus}
|
|
17
|
+
hidePlaceholderOnFocus={hidePlaceholderOnFocus}
|
|
18
|
+
submitOnEnter={submitOnEnter}
|
|
19
|
+
rows={rows}
|
|
20
|
+
maxlength={maxlength}
|
|
21
|
+
disabled={disabled}
|
|
22
|
+
placeholder={placeholder}
|
|
23
|
+
value={handler.formStringified[name]}
|
|
24
|
+
title={!!handler.touched[name] && !!handler.errors[name] ? handler.errors[name] : ''}
|
|
25
|
+
on={{
|
|
26
|
+
change: (e) => handleChangeDebounced(e),
|
|
27
|
+
submit: () => on?.submit?.(),
|
|
28
|
+
mounted: (e) => on?.mounted?.(e)
|
|
29
|
+
}} />
|
|
30
|
+
</Validatable>
|
|
31
|
+
|
|
32
|
+
<!--
|
|
33
|
+
@component
|
|
34
|
+
Textarea wrapped with form validation.
|
|
35
|
+
-->
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { FormValidationHandler } from '../../../core/validation';
|
|
2
|
+
declare function $$render<T extends Record<string, unknown>>(): {
|
|
3
|
+
props: {
|
|
4
|
+
/** Field name in the form handler */
|
|
5
|
+
name: keyof T & string;
|
|
6
|
+
/** Form validation handler instance */
|
|
7
|
+
handler: FormValidationHandler<T>;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
/** Debounce delay in ms @default 0 */
|
|
10
|
+
debounce?: number;
|
|
11
|
+
/** Hide placeholder text when focused @default true */
|
|
12
|
+
hidePlaceholderOnFocus?: boolean;
|
|
13
|
+
/** Fire submit callback on Enter key */
|
|
14
|
+
submitOnEnter?: boolean;
|
|
15
|
+
/** Minimum visible rows @default 0 */
|
|
16
|
+
rows?: number;
|
|
17
|
+
maxlength?: number;
|
|
18
|
+
id?: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
autofocus?: boolean;
|
|
21
|
+
on?: {
|
|
22
|
+
change?: (value: string) => void;
|
|
23
|
+
/** Fires on Enter when submitOnEnter is enabled */
|
|
24
|
+
submit?: () => void;
|
|
25
|
+
/** Fires after mount, provides the textarea element ref */
|
|
26
|
+
mounted?: (data: {
|
|
27
|
+
textarea: HTMLTextAreaElement;
|
|
28
|
+
}) => void;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
exports: {};
|
|
32
|
+
bindings: "";
|
|
33
|
+
slots: {};
|
|
34
|
+
events: {};
|
|
35
|
+
};
|
|
36
|
+
declare class __sveltets_Render<T extends Record<string, unknown>> {
|
|
37
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
38
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
39
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
40
|
+
bindings(): "";
|
|
41
|
+
exports(): {};
|
|
42
|
+
}
|
|
43
|
+
interface $$IsomorphicComponent {
|
|
44
|
+
new <T extends Record<string, unknown>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
45
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
46
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
47
|
+
<T extends Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
48
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
49
|
+
}
|
|
50
|
+
/** Textarea wrapped with form validation. */
|
|
51
|
+
declare const Cmp: $$IsomorphicComponent;
|
|
52
|
+
type Cmp<T extends Record<string, unknown>> = InstanceType<typeof Cmp<T>>;
|
|
53
|
+
export default Cmp;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
<script lang="ts">import { DomHelper, HtmlHelper, Utils } from '../../../core/utils';
|
|
2
|
+
import { InputEmojiPicker, inputEmojiPickerContainer } from '../input-emoji-picker';
|
|
3
|
+
import { untrack } from 'svelte';
|
|
4
|
+
let { value, placeholder = '', debounce = 0, hidePlaceholderOnFocus = true, submitOnEnter = false, singleLine = false, rows = 0, maxlength = 50000, id = '', disabled = false, autofocus = false, emoji = false, borderless = false, title = '', on } = $props();
|
|
5
|
+
let textareaRef = $state(undefined);
|
|
6
|
+
let placeholderInternal = $state(untrack(() => placeholder));
|
|
7
|
+
const initTextarea = (node) => {
|
|
8
|
+
textareaRef = node;
|
|
9
|
+
if (rows) {
|
|
10
|
+
node.style.minHeight = DomHelper.calcHeightBasedOnRows(node, rows);
|
|
11
|
+
}
|
|
12
|
+
on?.mounted?.({ textarea: node });
|
|
13
|
+
autoHeightTextArea();
|
|
14
|
+
if (autofocus) {
|
|
15
|
+
node.focus();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
const autoHeightTextArea = () => {
|
|
19
|
+
if (!textareaRef) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
textareaRef.style.overflow = 'hidden';
|
|
23
|
+
textareaRef.style.height = 'auto';
|
|
24
|
+
textareaRef.style.height = textareaRef.scrollHeight + 'px';
|
|
25
|
+
textareaRef.style.overflow = '';
|
|
26
|
+
};
|
|
27
|
+
$effect(() => {
|
|
28
|
+
if (value !== undefined) {
|
|
29
|
+
autoHeightTextArea();
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const onFocus = () => {
|
|
33
|
+
placeholderInternal = !hidePlaceholderOnFocus ? placeholder : '';
|
|
34
|
+
};
|
|
35
|
+
const onBlur = () => {
|
|
36
|
+
placeholderInternal = placeholder;
|
|
37
|
+
};
|
|
38
|
+
const sanitizeLineBreaks = (text) => text.replace(/[\r\n]+/g, ' ');
|
|
39
|
+
const textChanged = () => {
|
|
40
|
+
if (textareaRef) {
|
|
41
|
+
on?.change?.(textareaRef.value);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const onBeforeInput = (event) => {
|
|
45
|
+
if (!singleLine || !textareaRef) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (event.inputType === 'insertLineBreak' || event.inputType === 'insertParagraph') {
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (event.data && /[\r\n]/.test(event.data)) {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
const start = textareaRef.selectionStart;
|
|
55
|
+
const end = textareaRef.selectionEnd;
|
|
56
|
+
const clean = sanitizeLineBreaks(event.data);
|
|
57
|
+
textareaRef.setRangeText(clean, start, end, 'end');
|
|
58
|
+
textareaRef.dispatchEvent(new Event('input', { bubbles: true }));
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const onKeyDown = (event) => {
|
|
62
|
+
if (submitOnEnter && event.key === 'Enter' && !(event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)) {
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
on?.submit?.();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const handleChangeDebounced = $derived(debounce ? Utils.debounce(textChanged, debounce) : textChanged);
|
|
68
|
+
const onEmojiSelected = (emojiChar) => {
|
|
69
|
+
if (textareaRef) {
|
|
70
|
+
HtmlHelper.pasteIntoInput(emojiChar, textareaRef);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<div
|
|
76
|
+
class="textarea-input"
|
|
77
|
+
class:textarea-input--disabled={disabled}
|
|
78
|
+
class:textarea-input--borderless={borderless}
|
|
79
|
+
class:textarea-input--has-emoji={emoji}
|
|
80
|
+
use:inputEmojiPickerContainer>
|
|
81
|
+
<textarea
|
|
82
|
+
use:initTextarea
|
|
83
|
+
disabled={disabled}
|
|
84
|
+
placeholder={placeholderInternal}
|
|
85
|
+
maxlength={maxlength}
|
|
86
|
+
class="textarea-input__textarea"
|
|
87
|
+
class:textarea-input--disabled={disabled}
|
|
88
|
+
rows="1"
|
|
89
|
+
id={id}
|
|
90
|
+
title={title}
|
|
91
|
+
oninput={(e) => {
|
|
92
|
+
autoHeightTextArea();
|
|
93
|
+
handleChangeDebounced(e);
|
|
94
|
+
}}
|
|
95
|
+
onbeforeinput={onBeforeInput}
|
|
96
|
+
onfocus={onFocus}
|
|
97
|
+
onblur={onBlur}
|
|
98
|
+
onkeydown={onKeyDown}>{singleLine && value ? sanitizeLineBreaks(value) : value}</textarea>
|
|
99
|
+
{#if emoji}
|
|
100
|
+
<InputEmojiPicker on={{ select: onEmojiSelected }} />
|
|
101
|
+
{/if}
|
|
102
|
+
</div>
|
|
103
|
+
|
|
104
|
+
<!--
|
|
105
|
+
@component
|
|
106
|
+
Auto-resizing textarea with optional emoji picker, single-line mode, and submit-on-enter.
|
|
107
|
+
|
|
108
|
+
### CSS Custom Properties
|
|
109
|
+
| Property | Description | Default |
|
|
110
|
+
|---|---|---|
|
|
111
|
+
| `--sc-kit--textarea--root--font-size` | Root font size for em scaling | `1rem` |
|
|
112
|
+
| `--sc-kit--textarea--width` | Container width | `100%` |
|
|
113
|
+
| `--sc-kit--textarea--min-height` | Minimum height | `none` |
|
|
114
|
+
| `--sc-kit--textarea--max-height` | Maximum height | `none` |
|
|
115
|
+
| `--sc-kit--textarea--padding--block` | Block (vertical) padding | `0.5em` |
|
|
116
|
+
| `--sc-kit--textarea--padding--inline` | Inline (horizontal) padding | `0.5em` |
|
|
117
|
+
| `--sc-kit--textarea--accent-color` | Focus accent color | light-dark primary-500/primary-400 |
|
|
118
|
+
| `--sc-kit--textarea--background` | Background color | light-dark white/gray-900 |
|
|
119
|
+
| `--sc-kit--textarea--background--disabled` | Disabled background | light-dark neutral-50/neutral-800 |
|
|
120
|
+
| `--sc-kit--textarea--border-color` | Border color | light-dark neutral-300/neutral-600 |
|
|
121
|
+
| `--sc-kit--textarea--border-radius` | Border radius | `0.25em` |
|
|
122
|
+
| `--sc-kit--textarea--text--font-size` | Text font size | `0.875em` |
|
|
123
|
+
| `--sc-kit--textarea--text--color` | Text color | light-dark gray-800/white |
|
|
124
|
+
| `--sc-kit--textarea--text-align` | Text alignment | inherited |
|
|
125
|
+
| `--sc-kit--textarea--placeholder--color` | Placeholder text color | inherited from border |
|
|
126
|
+
-->
|
|
127
|
+
|
|
128
|
+
<style>.textarea-input {
|
|
129
|
+
--_textarea--padding-block: var(--sc-kit--textarea--padding--block, 0.5em);
|
|
130
|
+
--_textarea--text-align: var(--sc-kit--textarea--text-align);
|
|
131
|
+
--_textarea--max-height: var(--sc-kit--textarea--max-height);
|
|
132
|
+
--_textarea--min-height: var(--sc-kit--textarea--min-height, none);
|
|
133
|
+
--_--input--root--font-size: var(--sc-kit--textarea--root--font-size);
|
|
134
|
+
--_--input--height: auto;
|
|
135
|
+
--_--input--width: var(--sc-kit--textarea--width);
|
|
136
|
+
--_--input--background: var(--sc-kit--textarea--background);
|
|
137
|
+
--_--input--background--disabled: var(--sc-kit--textarea--background--disabled);
|
|
138
|
+
--_--input--border-color: var(--sc-kit--textarea--border-color);
|
|
139
|
+
--_--input--border-radius: var(--sc-kit--textarea--border-radius);
|
|
140
|
+
--_--input--text--font-size: var(--sc-kit--textarea--text--font-size);
|
|
141
|
+
--_--input--text--color: var(--sc-kit--textarea--text--color);
|
|
142
|
+
--_--input--placeholder--color: var(--sc-kit--textarea--placeholder--color);
|
|
143
|
+
--_--input--accent-color: var(--sc-kit--textarea--accent-color);
|
|
144
|
+
--_--input--padding--inline: var(--sc-kit--textarea--padding--inline);
|
|
145
|
+
--_--input--padding--block: var(--_textarea--padding-block);
|
|
146
|
+
--_input--root--font-size: var(--_--input--root--font-size, 1rem);
|
|
147
|
+
--_input--height: var(--_--input--height, 2em);
|
|
148
|
+
--_input--width: var(--_--input--width, 100%);
|
|
149
|
+
--_input--background: var(--_--input--background, light-dark(#ffffff, #1c1c1c));
|
|
150
|
+
--_input--background--disabled: var(--_--input--background--disabled, light-dark(#f9fafb, #1f2937));
|
|
151
|
+
--_input--border-color: var(--_--input--border-color, light-dark(#d1d5db, #4b5563));
|
|
152
|
+
--_input--border-radius: var(--_--input--border-radius, 0.25em);
|
|
153
|
+
--_input--icon--size: var(--_--input--icon--size, 1em);
|
|
154
|
+
--_input--icon--color: var(--_--input--icon--color, var(--_input--border-color));
|
|
155
|
+
--_input--text--font-size: var(--_--input--text--font-size, 0.875em);
|
|
156
|
+
--_input--text--color: var(--_--input--text--color, light-dark(#2e2e2e, #ffffff));
|
|
157
|
+
--_input--placeholder--color: var(--_--input--placeholder--color, var(--_input--border-color));
|
|
158
|
+
--_input--accent-color: var(--_--input--accent-color, light-dark(#144ab0, #5a8dec));
|
|
159
|
+
--_input--padding--inline: var(--_--input--padding--inline, 0.5em);
|
|
160
|
+
--_input--padding--block: var(--_--input--padding--block, 0);
|
|
161
|
+
--_input--padding-top: var(--_--input--padding-top, var(--_input--padding--block));
|
|
162
|
+
--_input--padding-right: var(--_--input--padding-right, var(--_input--padding--inline));
|
|
163
|
+
--_input--padding-bottom: var(--_--input--padding-bottom, var(--_input--padding--block));
|
|
164
|
+
--_input--padding-left: var(--_--input--padding-left, var(--_input--padding--inline));
|
|
165
|
+
font-size: var(--_input--root--font-size);
|
|
166
|
+
height: var(--_input--height);
|
|
167
|
+
color: var(--_input--text--color);
|
|
168
|
+
border: 1px solid var(--_input--border-color);
|
|
169
|
+
border-radius: var(--_input--border-radius);
|
|
170
|
+
width: var(--_input--width);
|
|
171
|
+
min-width: var(--_input--width);
|
|
172
|
+
background: var(--_input--background);
|
|
173
|
+
padding-top: var(--_input--padding-top);
|
|
174
|
+
padding-right: var(--_input--padding-right);
|
|
175
|
+
padding-bottom: var(--_input--padding-bottom);
|
|
176
|
+
padding-left: var(--_input--padding-left);
|
|
177
|
+
--_input--default-shadow-color: transparent;
|
|
178
|
+
--_input--accent-shadow: var(--_input--explicit-shadow-color, var(--_input--default-shadow-color));
|
|
179
|
+
position: relative;
|
|
180
|
+
box-shadow: inset 0 -0.13em var(--_input--accent-shadow);
|
|
181
|
+
transition: box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
182
|
+
}
|
|
183
|
+
.textarea-input:focus, .textarea-input:focus-within {
|
|
184
|
+
--_input--default-shadow-color: var(--_input--accent-color);
|
|
185
|
+
}
|
|
186
|
+
.textarea-input--disabled {
|
|
187
|
+
background-color: var(--_input--background--disabled);
|
|
188
|
+
cursor: default;
|
|
189
|
+
}
|
|
190
|
+
.textarea-input {
|
|
191
|
+
position: relative;
|
|
192
|
+
}
|
|
193
|
+
.textarea-input--borderless {
|
|
194
|
+
--_input--border-color: transparent;
|
|
195
|
+
--_input--background: transparent;
|
|
196
|
+
--_input--background--disabled: transparent;
|
|
197
|
+
--_input--accent-color: transparent;
|
|
198
|
+
--_input--explicit-shadow-color: transparent;
|
|
199
|
+
--_input--height: auto;
|
|
200
|
+
}
|
|
201
|
+
.textarea-input--has-emoji {
|
|
202
|
+
--_--input--padding-right: 1.5em;
|
|
203
|
+
}
|
|
204
|
+
.textarea-input__textarea {
|
|
205
|
+
min-height: var(--_textarea--min-height);
|
|
206
|
+
height: auto;
|
|
207
|
+
max-height: var(--_textarea--max-height);
|
|
208
|
+
width: 100%;
|
|
209
|
+
resize: none;
|
|
210
|
+
text-align: var(--_textarea--text-align);
|
|
211
|
+
padding: 0;
|
|
212
|
+
background-color: transparent !important;
|
|
213
|
+
font-size: var(--_input--text--font-size);
|
|
214
|
+
color: var(--_input--text--color);
|
|
215
|
+
}
|
|
216
|
+
.textarea-input__textarea::placeholder {
|
|
217
|
+
color: var(--_input--placeholder--color);
|
|
218
|
+
}
|
|
219
|
+
.textarea-input__textarea:-webkit-autofill {
|
|
220
|
+
-webkit-text-fill-color: var(--_input--text--color) !important;
|
|
221
|
+
}
|
|
222
|
+
.textarea-input__textarea {
|
|
223
|
+
--_cross-browser-scrollbar--thumb-color: transparent;
|
|
224
|
+
--_cross-browser-scrollbar--track-color: transparent;
|
|
225
|
+
}
|
|
226
|
+
.textarea-input__textarea:hover {
|
|
227
|
+
--_cross-browser-scrollbar--thumb-color: var(--scrollbar--thumb-color, light-dark(#d1d5db, #4b5563));
|
|
228
|
+
--_cross-browser-scrollbar--track-color: var(--scrollbar--track-color, transparent);
|
|
229
|
+
}
|
|
230
|
+
.textarea-input__textarea::-webkit-scrollbar {
|
|
231
|
+
width: 6px;
|
|
232
|
+
height: 6px;
|
|
233
|
+
}
|
|
234
|
+
.textarea-input__textarea::-webkit-scrollbar-track {
|
|
235
|
+
background: var(--_cross-browser-scrollbar--track-color);
|
|
236
|
+
border-radius: 100vw;
|
|
237
|
+
}
|
|
238
|
+
.textarea-input__textarea::-webkit-scrollbar-thumb {
|
|
239
|
+
background: var(--_cross-browser-scrollbar--thumb-color);
|
|
240
|
+
border-radius: 100vw;
|
|
241
|
+
}
|
|
242
|
+
@supports (scrollbar-color: transparent transparent) {
|
|
243
|
+
.textarea-input__textarea {
|
|
244
|
+
scrollbar-color: var(--_cross-browser-scrollbar--thumb-color) var(--_cross-browser-scrollbar--track-color);
|
|
245
|
+
scrollbar-width: thin;
|
|
246
|
+
}
|
|
247
|
+
}</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
value: string | null | undefined;
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
/** Debounce delay in ms for change events @default 0 */
|
|
5
|
+
debounce?: number;
|
|
6
|
+
/** Hide placeholder text when textarea is focused @default true */
|
|
7
|
+
hidePlaceholderOnFocus?: boolean;
|
|
8
|
+
/** Fire submit callback on Enter key @default false */
|
|
9
|
+
submitOnEnter?: boolean;
|
|
10
|
+
/** Prevent line breaks, sanitize pasted text @default false */
|
|
11
|
+
singleLine?: boolean;
|
|
12
|
+
/** Minimum visible rows (0 = auto height) @default 0 */
|
|
13
|
+
rows?: number;
|
|
14
|
+
maxlength?: number;
|
|
15
|
+
id?: string;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
autofocus?: boolean;
|
|
18
|
+
/** Show emoji picker trigger */
|
|
19
|
+
emoji?: boolean;
|
|
20
|
+
/** Remove border, background, and accent shadow */
|
|
21
|
+
borderless?: boolean;
|
|
22
|
+
title?: string;
|
|
23
|
+
on: {
|
|
24
|
+
change?: (value: string) => void;
|
|
25
|
+
/** Fires on Enter when submitOnEnter is enabled */
|
|
26
|
+
submit?: () => void;
|
|
27
|
+
/** Fires after mount, provides the textarea element ref */
|
|
28
|
+
mounted?: (data: {
|
|
29
|
+
textarea: HTMLTextAreaElement;
|
|
30
|
+
}) => void;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Auto-resizing textarea with optional emoji picker, single-line mode, and submit-on-enter.
|
|
35
|
+
*
|
|
36
|
+
* ### CSS Custom Properties
|
|
37
|
+
* | Property | Description | Default |
|
|
38
|
+
* |---|---|---|
|
|
39
|
+
* | `--sc-kit--textarea--root--font-size` | Root font size for em scaling | `1rem` |
|
|
40
|
+
* | `--sc-kit--textarea--width` | Container width | `100%` |
|
|
41
|
+
* | `--sc-kit--textarea--min-height` | Minimum height | `none` |
|
|
42
|
+
* | `--sc-kit--textarea--max-height` | Maximum height | `none` |
|
|
43
|
+
* | `--sc-kit--textarea--padding--block` | Block (vertical) padding | `0.5em` |
|
|
44
|
+
* | `--sc-kit--textarea--padding--inline` | Inline (horizontal) padding | `0.5em` |
|
|
45
|
+
* | `--sc-kit--textarea--accent-color` | Focus accent color | light-dark primary-500/primary-400 |
|
|
46
|
+
* | `--sc-kit--textarea--background` | Background color | light-dark white/gray-900 |
|
|
47
|
+
* | `--sc-kit--textarea--background--disabled` | Disabled background | light-dark neutral-50/neutral-800 |
|
|
48
|
+
* | `--sc-kit--textarea--border-color` | Border color | light-dark neutral-300/neutral-600 |
|
|
49
|
+
* | `--sc-kit--textarea--border-radius` | Border radius | `0.25em` |
|
|
50
|
+
* | `--sc-kit--textarea--text--font-size` | Text font size | `0.875em` |
|
|
51
|
+
* | `--sc-kit--textarea--text--color` | Text color | light-dark gray-800/white |
|
|
52
|
+
* | `--sc-kit--textarea--text-align` | Text alignment | inherited |
|
|
53
|
+
* | `--sc-kit--textarea--placeholder--color` | Placeholder text color | inherited from border |
|
|
54
|
+
*/
|
|
55
|
+
declare const Cmp: import("svelte").Component<Props, {}, "">;
|
|
56
|
+
type Cmp = ReturnType<typeof Cmp>;
|
|
57
|
+
export default Cmp;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type DialogController } from '../dialog';
|
|
2
2
|
import type { MediaViewerData } from './types';
|
|
3
3
|
type Props = {
|
|
4
|
+
/** Dialog controller instance */
|
|
4
5
|
controller: DialogController;
|
|
6
|
+
/** Media items and viewer configuration */
|
|
5
7
|
data: MediaViewerData;
|
|
6
8
|
};
|
|
7
9
|
declare const Cmp: import("svelte").Component<Props, {}, "">;
|