@x33025/sveltely 0.1.18 → 0.1.19
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/actions/LoaderOverlay.svelte +33 -8
- package/dist/actions/LoaderOverlay.svelte.d.ts +3 -0
- package/dist/actions/loader.d.ts +3 -0
- package/dist/actions/loader.js +20 -7
- package/dist/components/Library/AnimatedNumber/AnimatedNumber.demo.svelte +3 -9
- package/dist/components/Library/ArticleEditor/ArticleEditor.svelte +1 -1
- package/dist/components/Library/ArticleEditor/ArticleEditorHeader.svelte +20 -30
- package/dist/components/Library/ArticleEditor/Blocks/Code.svelte +0 -1
- package/dist/components/Library/ArticleEditor/Blocks/FAQ.svelte +1 -1
- package/dist/components/Library/ArticleEditor/Blocks/Heading.svelte +7 -7
- package/dist/components/Library/ArticleEditor/Blocks/Image.svelte +20 -36
- package/dist/components/Library/ArticleEditor/Blocks/Image.svelte.d.ts +1 -0
- package/dist/components/Library/ArticleEditor/Blocks/List.svelte +2 -2
- package/dist/components/Library/ArticleEditor/Blocks/Paragraph.svelte +1 -1
- package/dist/components/Library/ArticleEditor/Blocks/index.d.ts +0 -1
- package/dist/components/Library/ArticleEditor/Blocks/index.js +0 -1
- package/dist/components/Library/AsyncButton/AsyncButton.demo.svelte +2 -6
- package/dist/components/Library/AsyncButton/AsyncButton.svelte +9 -5
- package/dist/components/Library/AsyncButton/AsyncButton.svelte.d.ts +2 -1
- package/dist/components/Library/Button/Button.demo.svelte +2 -17
- package/dist/components/Library/Button/Button.demo.svelte.d.ts +0 -1
- package/dist/components/Library/Button/Button.svelte +15 -16
- package/dist/components/Library/Button/Button.svelte.d.ts +2 -1
- package/dist/components/Library/Calendar/Calendar.svelte +17 -27
- package/dist/components/Library/Checkbox/Checkbox.demo.svelte +7 -4
- package/dist/components/Library/Checkbox/Checkbox.svelte +24 -61
- package/dist/components/Library/Checkbox/Checkbox.svelte.d.ts +2 -4
- package/dist/components/Library/ChipInput/ChipInput.demo.svelte +2 -2
- package/dist/components/Library/ChipInput/ChipInput.svelte +7 -11
- package/dist/components/Library/ChipInput/ChipInput.svelte.d.ts +3 -2
- package/dist/components/Library/Dropdown/Action.svelte +1 -1
- package/dist/components/Library/Dropdown/Dropdown.demo.svelte +10 -10
- package/dist/components/Library/Dropdown/Dropdown.svelte +2 -6
- package/dist/components/Library/Dropdown/Item.svelte +2 -2
- package/dist/components/Library/Dropdown/Section.svelte +1 -1
- package/dist/components/Library/Dropdown/Trigger.svelte +3 -7
- package/dist/components/Library/Image/Image.demo.svelte +3 -3
- package/dist/components/Library/Image/Image.svelte +57 -12
- package/dist/components/Library/Image/Image.svelte.d.ts +1 -2
- package/dist/components/Library/Image/ImagePlaceholder.demo.svelte +12 -0
- package/dist/components/Library/Image/ImagePlaceholder.demo.svelte.d.ts +23 -0
- package/dist/components/Library/Image/ImagePlaceholder.svelte +28 -4
- package/dist/components/Library/Image/ImagePlaceholder.svelte.d.ts +1 -1
- package/dist/components/Library/Image/index.d.ts +1 -0
- package/dist/components/Library/Image/index.js +1 -0
- package/dist/components/Library/ImageMask/BrushPreview.svelte +6 -6
- package/dist/components/Library/ImageMask/ImageMask.demo.svelte +10 -8
- package/dist/components/Library/ImageMask/ImageMask.svelte +14 -6
- package/dist/components/Library/ImageMask/ImageMask.svelte.d.ts +1 -2
- package/dist/components/Library/ImageMask/MaskLayer.svelte +12 -6
- package/dist/components/Library/Label/Label.demo.svelte +9 -3
- package/dist/components/Library/Label/Label.svelte +8 -2
- package/dist/components/Library/Link/Link.svelte +10 -22
- package/dist/components/Library/Link/Link.svelte.d.ts +2 -3
- package/dist/components/Library/Loader/Loader.demo.svelte +9 -3
- package/dist/components/Library/NavigationStack/Link.svelte +8 -12
- package/dist/components/Library/NavigationStack/Link.svelte.d.ts +1 -3
- package/dist/components/Library/NavigationStack/SidebarToggle.svelte +8 -2
- package/dist/components/Library/NumberField/NumberField.svelte +21 -17
- package/dist/components/Library/NumberField/NumberField.svelte.d.ts +4 -2
- package/dist/components/Library/Pagination/Pagination.svelte +3 -3
- package/dist/components/Library/Popover/Popover.svelte +2 -7
- package/dist/components/Library/ScrollView/ScrollView.demo.svelte +50 -0
- package/dist/components/Library/ScrollView/ScrollView.demo.svelte.d.ts +10 -0
- package/dist/components/Library/ScrollView/ScrollView.svelte +414 -67
- package/dist/components/Library/ScrollView/ScrollView.svelte.d.ts +17 -1
- package/dist/components/Library/ScrollView/index.d.ts +1 -1
- package/dist/components/Library/SearchField/SearchField.demo.svelte +2 -2
- package/dist/components/Library/SearchField/SearchField.svelte +9 -4
- package/dist/components/Library/SearchField/SearchField.svelte.d.ts +2 -1
- package/dist/components/Library/SegmentedPicker/SegmentedPicker.demo.svelte +2 -2
- package/dist/components/Library/SegmentedPicker/SegmentedPicker.svelte +7 -7
- package/dist/components/Library/Sheet/Sheet.demo.svelte +1 -1
- package/dist/components/Library/Sheet/Sheet.svelte +2 -7
- package/dist/components/Library/Slider/Slider.demo.svelte +1 -1
- package/dist/components/Library/Slider/Slider.svelte +11 -7
- package/dist/components/Library/Slider/Slider.svelte.d.ts +2 -1
- package/dist/components/Library/Spinner/Spinner.demo.svelte +1 -1
- package/dist/components/Library/Switch/Switch.demo.svelte +7 -4
- package/dist/components/Library/Switch/Switch.svelte +28 -68
- package/dist/components/Library/Switch/Switch.svelte.d.ts +2 -4
- package/dist/components/Library/Table/Column.svelte +81 -0
- package/dist/components/Library/Table/Column.svelte.d.ts +39 -0
- package/dist/components/Library/Table/Table.demo.svelte +148 -0
- package/dist/components/Library/Table/Table.demo.svelte.d.ts +10 -0
- package/dist/components/Library/Table/Table.svelte +624 -0
- package/dist/components/Library/Table/Table.svelte.d.ts +42 -0
- package/dist/components/Library/Table/context.d.ts +5 -0
- package/dist/components/Library/Table/context.js +2 -0
- package/dist/components/Library/Table/index.js +5 -0
- package/dist/components/Library/Table/types.d.ts +37 -0
- package/dist/components/Library/Table/types.js +1 -0
- package/dist/components/Library/Text/Text.demo.svelte +21 -0
- package/dist/components/Library/Text/Text.demo.svelte.d.ts +24 -0
- package/dist/components/Library/Text/Text.svelte +41 -0
- package/dist/components/Library/Text/Text.svelte.d.ts +9 -0
- package/dist/components/Library/Text/index.d.ts +1 -0
- package/dist/components/Library/Text/index.js +1 -0
- package/dist/components/Library/TextEditor/TextEditor.svelte +15 -9
- package/dist/components/Library/TextEditor/TextEditor.svelte.d.ts +2 -4
- package/dist/components/Library/TextField/TextField.demo.svelte +1 -1
- package/dist/components/Library/TextField/TextField.svelte +21 -18
- package/dist/components/Library/TextField/TextField.svelte.d.ts +4 -2
- package/dist/components/Library/TextShimmer/TextShimmer.demo.svelte +1 -1
- package/dist/components/Library/TimePicker/TimePicker.demo.svelte +10 -2
- package/dist/components/Library/TimePicker/TimePicker.svelte +10 -5
- package/dist/components/Library/TokenSearchField/TokenSearchField.demo.svelte +4 -2
- package/dist/components/Library/TokenSearchField/TokenSearchField.svelte +11 -11
- package/dist/components/Library/TokenSearchField/TokenSearchField.svelte.d.ts +2 -1
- package/dist/components/Library/WheelPicker/WheelColumn.svelte +183 -126
- package/dist/components/Library/WheelPicker/WheelPicker.svelte +4 -4
- package/dist/components/Library/WheelPicker/WheelPicker.svelte.d.ts +2 -2
- package/dist/components/Library/WheelPicker/index.d.ts +1 -1
- package/dist/components/Library/WheelPicker/types.d.ts +6 -0
- package/dist/components/Local/ColorStyleControls.svelte +201 -0
- package/dist/components/Local/ColorStyleControls.svelte.d.ts +13 -0
- package/dist/components/Local/HeroCard.svelte +3 -3
- package/dist/components/Local/LayoutStyleControls.svelte +67 -0
- package/dist/components/Local/LayoutStyleControls.svelte.d.ts +11 -0
- package/dist/components/Local/StyleControls.svelte +48 -124
- package/dist/components/Local/StyleControls.svelte.d.ts +7 -5
- package/dist/index.d.ts +9 -2
- package/dist/index.js +5 -1
- package/dist/style/index.css +7 -12
- package/dist/style/label.d.ts +2 -1
- package/dist/style/label.js +2 -1
- package/dist/style/surface.js +4 -0
- package/dist/style/text-editor.d.ts +2 -13
- package/dist/style/text-editor.js +1 -12
- package/dist/style/text.d.ts +26 -0
- package/dist/style/text.js +69 -0
- package/dist/style/tooltip.d.ts +4 -0
- package/dist/style/tooltip.js +1 -0
- package/dist/style.css +41 -111
- package/package.json +1 -1
- package/dist/components/Library/ArticleEditor/Blocks/ImagePreview.svelte +0 -71
- package/dist/components/Library/ArticleEditor/Blocks/ImagePreview.svelte.d.ts +0 -8
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
export type TableColumnAlignment = 'leading' | 'center' | 'trailing';
|
|
3
|
+
export type TableColumnHeaderVisibility = 'visible' | 'hidden';
|
|
4
|
+
export type TableSelectionMode = 'none' | 'single' | 'multiple';
|
|
5
|
+
export type TableSortDirection = 'ascending' | 'descending';
|
|
6
|
+
export type TableRowKey = string | number;
|
|
7
|
+
export type TableSelection = TableRowKey | TableRowKey[] | Set<TableRowKey> | null;
|
|
8
|
+
export type TableSpanValue<T> = number | ((row: T, index: number) => number | undefined);
|
|
9
|
+
export type TableSortDescriptor<T> = {
|
|
10
|
+
key: string;
|
|
11
|
+
direction: TableSortDirection;
|
|
12
|
+
compare?: (a: T, b: T) => number;
|
|
13
|
+
};
|
|
14
|
+
export type TableColumnCustomization = {
|
|
15
|
+
order?: string[];
|
|
16
|
+
hidden?: string[];
|
|
17
|
+
};
|
|
18
|
+
export type TableColumn<T> = {
|
|
19
|
+
key?: string;
|
|
20
|
+
label: string;
|
|
21
|
+
value?: keyof T | ((row: T) => unknown);
|
|
22
|
+
cell?: Snippet<[row: T, index: number]>;
|
|
23
|
+
width?: number | string;
|
|
24
|
+
minWidth?: number | string;
|
|
25
|
+
alignment?: TableColumnAlignment;
|
|
26
|
+
sortable?: boolean;
|
|
27
|
+
sortKey?: keyof T | string;
|
|
28
|
+
compare?: (a: T, b: T) => number;
|
|
29
|
+
colspan?: TableSpanValue<T>;
|
|
30
|
+
rowspan?: TableSpanValue<T>;
|
|
31
|
+
hidden?: boolean;
|
|
32
|
+
};
|
|
33
|
+
export type TableContext<T> = {
|
|
34
|
+
registerColumn: (column: TableColumn<T>) => symbol;
|
|
35
|
+
updateColumn: (id: symbol, column: TableColumn<T>) => void;
|
|
36
|
+
unregisterColumn: (id: symbol) => void;
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
export const demo = {
|
|
3
|
+
name: 'Text',
|
|
4
|
+
description: 'Semantic text component with shared heading and paragraph appearances.',
|
|
5
|
+
rowSpan: 2
|
|
6
|
+
};
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import VStack from '../VStack';
|
|
11
|
+
import Text from './Text.svelte';
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<VStack gap={5}>
|
|
15
|
+
<Text as="h1">Heading 1</Text>
|
|
16
|
+
<Text as="h2">Heading 2</Text>
|
|
17
|
+
<Text as="h3">Heading 3</Text>
|
|
18
|
+
<Text as="paragraph" color="var(--sveltely-text-secondary-color)">
|
|
19
|
+
Paragraph text uses the same appearance presets that TextField and TextEditor can opt into.
|
|
20
|
+
</Text>
|
|
21
|
+
</VStack>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const demo: {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
rowSpan: number;
|
|
5
|
+
};
|
|
6
|
+
import Text from './Text.svelte';
|
|
7
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
8
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
9
|
+
$$bindings?: Bindings;
|
|
10
|
+
} & Exports;
|
|
11
|
+
(internal: unknown, props: {
|
|
12
|
+
$$events?: Events;
|
|
13
|
+
$$slots?: Slots;
|
|
14
|
+
}): Exports & {
|
|
15
|
+
$set?: any;
|
|
16
|
+
$on?: any;
|
|
17
|
+
};
|
|
18
|
+
z_$$bindings?: Bindings;
|
|
19
|
+
}
|
|
20
|
+
declare const Text: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
}, {}, {}, string>;
|
|
23
|
+
type Text = InstanceType<typeof Text>;
|
|
24
|
+
export default Text;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import { extractStyleProps, surfaceStyle, type StyleProps } from '../../../style/surface';
|
|
4
|
+
import { textElementFor, textStyle, type TextProps } from '../../../style/text';
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
} & TextProps &
|
|
9
|
+
StyleProps &
|
|
10
|
+
Record<string, unknown>;
|
|
11
|
+
|
|
12
|
+
let { children, as, textAlign, ...restProps }: Props = $props();
|
|
13
|
+
|
|
14
|
+
const extractedStyleProps = $derived.by(() => extractStyleProps(restProps));
|
|
15
|
+
const styleProps = $derived(extractedStyleProps.styleProps);
|
|
16
|
+
const props = $derived(extractedStyleProps.restProps);
|
|
17
|
+
const element = $derived(textElementFor(as));
|
|
18
|
+
const rootStyle = $derived.by(() =>
|
|
19
|
+
[textStyle({ as, textAlign }, 'text'), surfaceStyle(styleProps, 'text')]
|
|
20
|
+
.filter(Boolean)
|
|
21
|
+
.join(' ')
|
|
22
|
+
);
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<svelte:element this={element} class="text" style={rootStyle} {...props}>
|
|
26
|
+
{#if children}
|
|
27
|
+
{@render children()}
|
|
28
|
+
{/if}
|
|
29
|
+
</svelte:element>
|
|
30
|
+
|
|
31
|
+
<style>
|
|
32
|
+
.text {
|
|
33
|
+
margin: 0;
|
|
34
|
+
min-width: 0;
|
|
35
|
+
color: var(--text-color, var(--sveltely-text-primary-color));
|
|
36
|
+
font-size: var(--text-font-size);
|
|
37
|
+
font-weight: var(--text-font-weight);
|
|
38
|
+
line-height: var(--text-line-height);
|
|
39
|
+
text-align: var(--text-text-align, start);
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import { type StyleProps } from '../../../style/surface';
|
|
3
|
+
import { type TextProps } from '../../../style/text';
|
|
4
|
+
type Props = {
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
} & TextProps & StyleProps & Record<string, unknown>;
|
|
7
|
+
declare const Text: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type Text = ReturnType<typeof Text>;
|
|
9
|
+
export default Text;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Text.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Text.svelte';
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
3
|
-
import {
|
|
3
|
+
import { textStyle, type TextProps } from '../../../style/text';
|
|
4
4
|
|
|
5
5
|
type Props = Omit<HTMLTextareaAttributes, 'value' | 'class'> & {
|
|
6
6
|
value?: string;
|
|
7
|
-
class?: HTMLTextareaAttributes['class'];
|
|
8
7
|
autosize?: boolean;
|
|
9
|
-
className?: string;
|
|
10
8
|
onInput?: (event: Event) => void;
|
|
11
9
|
onKeyDown?: (event: KeyboardEvent) => void;
|
|
12
10
|
shouldFocus?: boolean;
|
|
13
11
|
focusPosition?: number | null;
|
|
14
12
|
onFocused?: () => void;
|
|
15
|
-
} &
|
|
13
|
+
} & TextProps;
|
|
16
14
|
|
|
17
15
|
let {
|
|
18
16
|
value = $bindable(''),
|
|
19
17
|
rows = 1,
|
|
20
|
-
class: classProp = '',
|
|
21
18
|
autosize = false,
|
|
22
|
-
className = '',
|
|
23
19
|
onInput,
|
|
24
20
|
onKeyDown,
|
|
25
21
|
oninput,
|
|
@@ -27,12 +23,19 @@
|
|
|
27
23
|
shouldFocus = false,
|
|
28
24
|
focusPosition = null,
|
|
29
25
|
onFocused,
|
|
26
|
+
as,
|
|
30
27
|
textAlign,
|
|
31
28
|
...textareaProps
|
|
32
29
|
}: Props = $props();
|
|
33
30
|
|
|
34
31
|
let textarea: HTMLTextAreaElement | undefined;
|
|
35
|
-
const rootStyle = $derived(
|
|
32
|
+
const rootStyle = $derived(textStyle({ as, textAlign }, 'text-editor'));
|
|
33
|
+
const inputProps = $derived.by(() => {
|
|
34
|
+
const props = { ...textareaProps } as typeof textareaProps & Record<string, unknown>;
|
|
35
|
+
delete props.class;
|
|
36
|
+
delete props.style;
|
|
37
|
+
return props;
|
|
38
|
+
});
|
|
36
39
|
|
|
37
40
|
const resize = () => {
|
|
38
41
|
if (!autosize || !textarea) return;
|
|
@@ -61,7 +64,7 @@
|
|
|
61
64
|
bind:this={textarea}
|
|
62
65
|
{value}
|
|
63
66
|
{rows}
|
|
64
|
-
{...
|
|
67
|
+
{...inputProps}
|
|
65
68
|
style={rootStyle}
|
|
66
69
|
oninput={(event) => {
|
|
67
70
|
resize();
|
|
@@ -72,7 +75,7 @@
|
|
|
72
75
|
onkeydown?.(event);
|
|
73
76
|
onKeyDown?.(event);
|
|
74
77
|
}}
|
|
75
|
-
class=
|
|
78
|
+
class="text-editor"
|
|
76
79
|
></textarea>
|
|
77
80
|
|
|
78
81
|
<style>
|
|
@@ -85,6 +88,9 @@
|
|
|
85
88
|
overflow: hidden;
|
|
86
89
|
padding: 0;
|
|
87
90
|
resize: none;
|
|
91
|
+
font-size: var(--text-editor-font-size);
|
|
92
|
+
font-weight: var(--text-editor-font-weight);
|
|
93
|
+
line-height: var(--text-editor-line-height);
|
|
88
94
|
text-align: var(--text-editor-text-align, start);
|
|
89
95
|
}
|
|
90
96
|
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
2
|
-
import { type
|
|
2
|
+
import { type TextProps } from '../../../style/text';
|
|
3
3
|
type Props = Omit<HTMLTextareaAttributes, 'value' | 'class'> & {
|
|
4
4
|
value?: string;
|
|
5
|
-
class?: HTMLTextareaAttributes['class'];
|
|
6
5
|
autosize?: boolean;
|
|
7
|
-
className?: string;
|
|
8
6
|
onInput?: (event: Event) => void;
|
|
9
7
|
onKeyDown?: (event: KeyboardEvent) => void;
|
|
10
8
|
shouldFocus?: boolean;
|
|
11
9
|
focusPosition?: number | null;
|
|
12
10
|
onFocused?: () => void;
|
|
13
|
-
} &
|
|
11
|
+
} & TextProps;
|
|
14
12
|
declare const TextEditor: import("svelte").Component<Props, {}, "value">;
|
|
15
13
|
type TextEditor = ReturnType<typeof TextEditor>;
|
|
16
14
|
export default TextEditor;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
-
import { tooltip } from '../../../actions/tooltip';
|
|
3
|
+
import { tooltip as tooltipAction } from '../../../actions/tooltip';
|
|
4
4
|
import { surfaceStyle, type StyleProps } from '../../../style/surface';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type TextFieldType,
|
|
9
|
-
type TextInputMode
|
|
10
|
-
} from '../../../style/text-editor';
|
|
5
|
+
import { textStyle, type TextProps } from '../../../style/text';
|
|
6
|
+
import { type TextFieldType, type TextInputMode } from '../../../style/text-editor';
|
|
7
|
+
import type { TooltipProps } from '../../../style/tooltip';
|
|
11
8
|
|
|
12
9
|
type Props = {
|
|
13
10
|
value?: string;
|
|
@@ -22,7 +19,8 @@
|
|
|
22
19
|
readonly?: boolean;
|
|
23
20
|
inputmode?: TextInputMode;
|
|
24
21
|
} & StyleProps &
|
|
25
|
-
|
|
22
|
+
TextProps &
|
|
23
|
+
TooltipProps;
|
|
26
24
|
|
|
27
25
|
let {
|
|
28
26
|
value = $bindable(''),
|
|
@@ -36,6 +34,8 @@
|
|
|
36
34
|
required = false,
|
|
37
35
|
readonly = false,
|
|
38
36
|
inputmode,
|
|
37
|
+
tooltip,
|
|
38
|
+
as,
|
|
39
39
|
textAlign,
|
|
40
40
|
fontSize,
|
|
41
41
|
paddingX,
|
|
@@ -59,17 +59,18 @@
|
|
|
59
59
|
borderColor,
|
|
60
60
|
color
|
|
61
61
|
});
|
|
62
|
-
const
|
|
62
|
+
const textProps = $derived({ as, textAlign });
|
|
63
63
|
const rootStyle = $derived.by(() =>
|
|
64
|
-
[
|
|
64
|
+
[textStyle(textProps, 'text-field'), surfaceStyle(styleProps, 'text-field')]
|
|
65
65
|
.filter(Boolean)
|
|
66
66
|
.join(' ')
|
|
67
67
|
);
|
|
68
68
|
const describedBy = $derived(help ? 'text-field-message' : undefined);
|
|
69
|
+
const resolvedTooltip = $derived(error ? { label: error } : tooltip);
|
|
69
70
|
</script>
|
|
70
71
|
|
|
71
72
|
<div
|
|
72
|
-
use:
|
|
73
|
+
use:tooltipAction={resolvedTooltip}
|
|
73
74
|
class="text-field"
|
|
74
75
|
style={rootStyle}
|
|
75
76
|
data-disabled={disabled ? 'true' : 'false'}
|
|
@@ -102,8 +103,8 @@
|
|
|
102
103
|
min-width: 0;
|
|
103
104
|
flex-direction: column;
|
|
104
105
|
gap: var(--text-field-gap, calc(var(--sveltely-gap) * 0.75));
|
|
105
|
-
color: var(--text-field-color, var(--sveltely-primary-color));
|
|
106
|
-
font-size: var(--text-field-font-size,
|
|
106
|
+
color: var(--text-field-color, var(--sveltely-text-primary-color));
|
|
107
|
+
font-size: var(--text-field-font-size, var(--sveltely-font-size));
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
.text-field-input {
|
|
@@ -111,9 +112,11 @@
|
|
|
111
112
|
min-width: 0;
|
|
112
113
|
border: 1px solid var(--text-field-border-color, var(--sveltely-border-color));
|
|
113
114
|
border-radius: var(--text-field-border-radius, var(--sveltely-border-radius));
|
|
114
|
-
background: var(--text-field-background, var(--sveltely-background-color));
|
|
115
|
+
background: var(--text-field-background, var(--sveltely-control-background-color));
|
|
115
116
|
color: inherit;
|
|
116
|
-
|
|
117
|
+
font-size: var(--text-field-font-size);
|
|
118
|
+
font-weight: var(--text-field-font-weight);
|
|
119
|
+
line-height: var(--text-field-line-height);
|
|
117
120
|
outline: none;
|
|
118
121
|
padding: var(--text-field-padding-y, calc(var(--sveltely-padding-y) * 0.67))
|
|
119
122
|
var(--text-field-padding-x, var(--sveltely-padding-x));
|
|
@@ -126,15 +129,15 @@
|
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
.text-field-input:focus {
|
|
129
|
-
border-color: color-mix(in oklab, var(--sveltely-active-color) 50%, white);
|
|
132
|
+
border-color: color-mix(in oklab, var(--sveltely-control-active-color) 50%, white);
|
|
130
133
|
}
|
|
131
134
|
|
|
132
135
|
.text-field-input::placeholder {
|
|
133
|
-
color: var(--sveltely-secondary-color);
|
|
136
|
+
color: var(--sveltely-text-secondary-color);
|
|
134
137
|
}
|
|
135
138
|
|
|
136
139
|
.text-field-message {
|
|
137
|
-
color: var(--sveltely-secondary-color);
|
|
140
|
+
color: var(--sveltely-text-secondary-color);
|
|
138
141
|
font-size: calc(var(--text-field-font-size, 0.875rem) * 0.857);
|
|
139
142
|
line-height: 1.25;
|
|
140
143
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
2
|
import { type StyleProps } from '../../../style/surface';
|
|
3
|
-
import { type
|
|
3
|
+
import { type TextProps } from '../../../style/text';
|
|
4
|
+
import { type TextFieldType, type TextInputMode } from '../../../style/text-editor';
|
|
5
|
+
import type { TooltipProps } from '../../../style/tooltip';
|
|
4
6
|
type Props = {
|
|
5
7
|
value?: string;
|
|
6
8
|
help?: string;
|
|
@@ -13,7 +15,7 @@ type Props = {
|
|
|
13
15
|
required?: boolean;
|
|
14
16
|
readonly?: boolean;
|
|
15
17
|
inputmode?: TextInputMode;
|
|
16
|
-
} & StyleProps &
|
|
18
|
+
} & StyleProps & TextProps & TooltipProps;
|
|
17
19
|
declare const TextField: import("svelte").Component<Props, {}, "value">;
|
|
18
20
|
type TextField = ReturnType<typeof TextField>;
|
|
19
21
|
export default TextField;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
export const demo = {
|
|
3
|
-
name: '
|
|
3
|
+
name: 'Time Picker',
|
|
4
4
|
description: 'Wheel-based time picker with hour, minute, and period columns.',
|
|
5
5
|
columnSpan: 1,
|
|
6
6
|
rowSpan: 2
|
|
@@ -13,6 +13,14 @@
|
|
|
13
13
|
let value = $state<Date | null>(new Date());
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
|
-
<div class="vstack gap-4">
|
|
16
|
+
<div class="time-picker-demo vstack gap-4">
|
|
17
17
|
<TimePicker bind:value />
|
|
18
18
|
</div>
|
|
19
|
+
|
|
20
|
+
<style>
|
|
21
|
+
.time-picker-demo {
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
min-height: 0;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import WheelPicker from '../WheelPicker';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AnyWheelColumn, WheelOption } from '../WheelPicker';
|
|
4
4
|
import { extractStyleProps, surfaceStyle, type StyleProps } from '../../../style/surface';
|
|
5
5
|
|
|
6
6
|
export type TimeMeridiem = 'AM' | 'PM';
|
|
@@ -97,24 +97,26 @@
|
|
|
97
97
|
0
|
|
98
98
|
);
|
|
99
99
|
};
|
|
100
|
-
const columns = $derived.by<
|
|
100
|
+
const columns = $derived.by<AnyWheelColumn[]>(() => [
|
|
101
101
|
{
|
|
102
102
|
label: hourLabel,
|
|
103
103
|
value: selectedHour,
|
|
104
104
|
options: hourOptions,
|
|
105
|
-
onChange: (hour
|
|
105
|
+
onChange: (hour: string | number) =>
|
|
106
|
+
updateTime(Number(hour), selectedMinute, selectedMeridiem)
|
|
106
107
|
},
|
|
107
108
|
{
|
|
108
109
|
label: minuteLabel,
|
|
109
110
|
value: selectedMinute,
|
|
110
111
|
options: minuteOptions,
|
|
111
|
-
onChange: (minute
|
|
112
|
+
onChange: (minute: string | number) =>
|
|
113
|
+
updateTime(selectedHour, Number(minute), selectedMeridiem)
|
|
112
114
|
},
|
|
113
115
|
{
|
|
114
116
|
label: periodLabel,
|
|
115
117
|
value: selectedMeridiem,
|
|
116
118
|
options: periodOptions,
|
|
117
|
-
onChange: (meridiem) =>
|
|
119
|
+
onChange: (meridiem: string | number) =>
|
|
118
120
|
updateTime(selectedHour, selectedMinute, meridiem as TimeMeridiem)
|
|
119
121
|
}
|
|
120
122
|
]);
|
|
@@ -133,7 +135,10 @@
|
|
|
133
135
|
(calc(var(--wheel-picker-font-size) * 0.875) * 1.2) +
|
|
134
136
|
(calc(var(--sveltely-padding-y) * 0.67 * var(--wheel-picker-scale)) * 2) + 2px
|
|
135
137
|
);
|
|
138
|
+
flex: 1 1 auto;
|
|
136
139
|
height: var(--time-picker-height, calc(var(--wheel-picker-option-height) * 10));
|
|
140
|
+
max-height: 100%;
|
|
141
|
+
min-height: 0;
|
|
137
142
|
}
|
|
138
143
|
|
|
139
144
|
:global(.time-picker .wheel-picker-label-column:last-child),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
export const demo = {
|
|
3
|
-
name: '
|
|
3
|
+
name: 'Token Search Field',
|
|
4
4
|
description: 'Search field that turns comma-separated entries into removable tokens.',
|
|
5
5
|
columnSpan: 2
|
|
6
6
|
};
|
|
@@ -15,5 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
<div class="vstack w-full max-w-md gap-2">
|
|
17
17
|
<TokenSearchField bind:tokens bind:value placeholder="Search keywords" />
|
|
18
|
-
<p class="text-xs text-[var(--sveltely-secondary-color)]">
|
|
18
|
+
<p class="text-xs text-[var(--sveltely-text-secondary-color)]">
|
|
19
|
+
Tokens: {tokens.join(', ') || 'empty'}
|
|
20
|
+
</p>
|
|
19
21
|
</div>
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { SearchIcon, X } from '@lucide/svelte';
|
|
3
3
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
4
|
+
import { tooltip as tooltipAction } from '../../../actions/tooltip';
|
|
4
5
|
import { extractStyleProps, surfaceStyle, type StyleProps } from '../../../style/surface';
|
|
6
|
+
import type { TooltipProps } from '../../../style/tooltip';
|
|
5
7
|
|
|
6
8
|
type Props = {
|
|
7
9
|
tokens?: string[];
|
|
@@ -12,6 +14,7 @@
|
|
|
12
14
|
normalizeToken?: (value: string) => string;
|
|
13
15
|
showIcon?: boolean;
|
|
14
16
|
} & StyleProps &
|
|
17
|
+
TooltipProps &
|
|
15
18
|
Omit<HTMLInputAttributes, 'children' | 'type' | 'value' | 'placeholder' | 'class' | 'style'>;
|
|
16
19
|
|
|
17
20
|
const defaultNormalizeToken = (value: string) => value.trim().replace(/\s+/g, ' ');
|
|
@@ -24,6 +27,7 @@
|
|
|
24
27
|
tokenPlaceholder = 'Add search token',
|
|
25
28
|
normalizeToken = defaultNormalizeToken,
|
|
26
29
|
showIcon = false,
|
|
30
|
+
tooltip,
|
|
27
31
|
disabled = false,
|
|
28
32
|
...restProps
|
|
29
33
|
}: Props = $props();
|
|
@@ -85,6 +89,7 @@
|
|
|
85
89
|
class:token-search-field-has-tokens={tokens.length > 0}
|
|
86
90
|
style={rootStyle}
|
|
87
91
|
data-disabled={disabled ? 'true' : 'false'}
|
|
92
|
+
use:tooltipAction={tooltip}
|
|
88
93
|
>
|
|
89
94
|
{#if showIcon}
|
|
90
95
|
<span class="token-search-field-icon" aria-hidden="true">
|
|
@@ -138,7 +143,7 @@
|
|
|
138
143
|
flex: 1 1 0;
|
|
139
144
|
border: 1px solid var(--sveltely-border-color);
|
|
140
145
|
border-radius: var(--sveltely-border-radius);
|
|
141
|
-
color: var(--sveltely-primary-color);
|
|
146
|
+
color: var(--sveltely-text-primary-color);
|
|
142
147
|
gap: var(--token-search-field-inset);
|
|
143
148
|
padding: calc(var(--sveltely-padding-y) * 0.67 * var(--token-search-field-scale))
|
|
144
149
|
calc(var(--sveltely-padding-x) * var(--token-search-field-scale));
|
|
@@ -153,7 +158,7 @@
|
|
|
153
158
|
}
|
|
154
159
|
|
|
155
160
|
.token-search-field:focus-within {
|
|
156
|
-
border-color: color-mix(in oklab, var(--sveltely-active-color) 50%, white);
|
|
161
|
+
border-color: color-mix(in oklab, var(--sveltely-control-active-color) 50%, white);
|
|
157
162
|
}
|
|
158
163
|
|
|
159
164
|
.token-search-field-has-tokens {
|
|
@@ -167,7 +172,7 @@
|
|
|
167
172
|
|
|
168
173
|
.token-search-field-icon {
|
|
169
174
|
flex-shrink: 0;
|
|
170
|
-
color: var(--sveltely-secondary-color);
|
|
175
|
+
color: var(--sveltely-text-secondary-color);
|
|
171
176
|
}
|
|
172
177
|
|
|
173
178
|
:global(.token-search-field-search-icon) {
|
|
@@ -193,8 +198,8 @@
|
|
|
193
198
|
align-items: center;
|
|
194
199
|
border: 1px solid var(--sveltely-border-color);
|
|
195
200
|
border-radius: var(--sveltely-border-radius-nested);
|
|
196
|
-
background: var(--sveltely-inactive-color);
|
|
197
|
-
color: var(--sveltely-primary-color);
|
|
201
|
+
background: var(--sveltely-control-inactive-color);
|
|
202
|
+
color: var(--sveltely-text-primary-color);
|
|
198
203
|
font-size: inherit;
|
|
199
204
|
line-height: inherit;
|
|
200
205
|
gap: calc(var(--sveltely-padding-x) * 0.66 * var(--token-search-field-scale));
|
|
@@ -213,11 +218,6 @@
|
|
|
213
218
|
height: var(--token-search-field-remove-icon-size);
|
|
214
219
|
}
|
|
215
220
|
|
|
216
|
-
.token-search-field-token:hover:not(:disabled) {
|
|
217
|
-
border-color: var(--sveltely-border-color);
|
|
218
|
-
background: var(--sveltely-hover-color);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
221
|
.token-search-field-token:disabled {
|
|
222
222
|
cursor: not-allowed;
|
|
223
223
|
opacity: 0.6;
|
|
@@ -225,7 +225,7 @@
|
|
|
225
225
|
|
|
226
226
|
.token-search-field-confirm {
|
|
227
227
|
flex-shrink: 0;
|
|
228
|
-
color: var(--sveltely-secondary-color);
|
|
228
|
+
color: var(--sveltely-text-secondary-color);
|
|
229
229
|
font-size: var(--token-search-field-confirm-font-size);
|
|
230
230
|
font-weight: 500;
|
|
231
231
|
line-height: calc(var(--token-search-field-confirm-font-size) * 1.333);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
2
|
import { type StyleProps } from '../../../style/surface';
|
|
3
|
+
import type { TooltipProps } from '../../../style/tooltip';
|
|
3
4
|
type Props = {
|
|
4
5
|
tokens?: string[];
|
|
5
6
|
value?: string;
|
|
@@ -8,7 +9,7 @@ type Props = {
|
|
|
8
9
|
tokenPlaceholder?: string;
|
|
9
10
|
normalizeToken?: (value: string) => string;
|
|
10
11
|
showIcon?: boolean;
|
|
11
|
-
} & StyleProps & Omit<HTMLInputAttributes, 'children' | 'type' | 'value' | 'placeholder' | 'class' | 'style'>;
|
|
12
|
+
} & StyleProps & TooltipProps & Omit<HTMLInputAttributes, 'children' | 'type' | 'value' | 'placeholder' | 'class' | 'style'>;
|
|
12
13
|
declare const TokenSearchField: import("svelte").Component<Props, {}, "value" | "tokens">;
|
|
13
14
|
type TokenSearchField = ReturnType<typeof TokenSearchField>;
|
|
14
15
|
export default TokenSearchField;
|