@geoffcox/sterling-svelte 2.0.5 → 2.0.7
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/Autocomplete.svelte +154 -0
- package/dist/Autocomplete.svelte.d.ts +4 -0
- package/dist/Autocomplete.types.d.ts +7 -0
- package/dist/Autocomplete.types.js +1 -0
- package/dist/Button.svelte +2 -4
- package/dist/Button.svelte.d.ts +1 -2
- package/dist/Button.types.d.ts +2 -0
- package/dist/Button.types.js +1 -0
- package/dist/Callout.svelte +2 -11
- package/dist/Callout.svelte.d.ts +2 -12
- package/dist/Checkbox.svelte +2 -4
- package/dist/Checkbox.svelte.d.ts +1 -2
- package/dist/Checkbox.types.d.ts +2 -0
- package/dist/Checkbox.types.js +1 -0
- package/dist/Dialog.svelte +4 -14
- package/dist/Dialog.svelte.d.ts +2 -12
- package/dist/Dialog.types.d.ts +11 -0
- package/dist/Dialog.types.js +1 -0
- package/dist/Dropdown.svelte +3 -20
- package/dist/Dropdown.svelte.d.ts +2 -17
- package/dist/Dropdown.types.d.ts +17 -0
- package/dist/Dropdown.types.js +1 -0
- package/dist/Input.svelte +2 -4
- package/dist/Input.svelte.d.ts +1 -2
- package/dist/Input.types.d.ts +2 -0
- package/dist/Input.types.js +1 -0
- package/dist/Label.svelte +109 -24
- package/dist/Label.svelte.d.ts +2 -11
- package/dist/Label.types.d.ts +18 -0
- package/dist/Label.types.js +1 -0
- package/dist/Link.svelte +2 -6
- package/dist/Link.svelte.d.ts +2 -5
- package/dist/Link.types.d.ts +4 -0
- package/dist/Link.types.js +1 -0
- package/dist/List.svelte +3 -10
- package/dist/List.svelte.d.ts +2 -8
- package/dist/List.types.d.ts +7 -0
- package/dist/ListItem.svelte +2 -7
- package/dist/ListItem.svelte.d.ts +2 -6
- package/dist/ListItem.types.d.ts +5 -0
- package/dist/ListItem.types.js +1 -0
- package/dist/Menu.svelte +2 -4
- package/dist/Menu.svelte.d.ts +2 -3
- package/dist/Menu.types.d.ts +2 -0
- package/dist/Menu.types.js +1 -0
- package/dist/MenuBar.svelte +2 -9
- package/dist/MenuBar.svelte.d.ts +2 -7
- package/dist/MenuBar.types.d.ts +6 -0
- package/dist/MenuButton.svelte +2 -12
- package/dist/MenuButton.svelte.d.ts +2 -14
- package/dist/MenuButton.types.d.ts +13 -0
- package/dist/MenuButton.types.js +1 -0
- package/dist/MenuItem.svelte +4 -21
- package/dist/MenuItem.svelte.d.ts +2 -16
- package/dist/MenuItem.types.d.ts +14 -0
- package/dist/MenuSeparator.svelte +2 -4
- package/dist/MenuSeparator.svelte.d.ts +2 -3
- package/dist/MenuSeparator.types.d.ts +2 -0
- package/dist/MenuSeparator.types.js +1 -0
- package/dist/Popover.svelte +3 -13
- package/dist/Popover.svelte.d.ts +2 -12
- package/dist/Popover.types.d.ts +10 -0
- package/dist/Progress.svelte +2 -10
- package/dist/Progress.svelte.d.ts +2 -9
- package/dist/Progress.types.d.ts +8 -0
- package/dist/Radio.svelte +2 -6
- package/dist/Radio.svelte.d.ts +2 -5
- package/dist/Radio.types.d.ts +4 -0
- package/dist/Radio.types.js +1 -0
- package/dist/Select.svelte +4 -23
- package/dist/Select.svelte.d.ts +2 -19
- package/dist/Select.types.d.ts +19 -0
- package/dist/Select.types.js +1 -0
- package/dist/Slider.svelte +24 -29
- package/dist/Slider.svelte.d.ts +2 -12
- package/dist/Slider.types.d.ts +11 -0
- package/dist/Slider.types.js +1 -0
- package/dist/Switch.svelte +2 -13
- package/dist/Switch.svelte.d.ts +2 -15
- package/dist/Switch.types.d.ts +14 -0
- package/dist/Switch.types.js +1 -0
- package/dist/Tab.svelte +2 -6
- package/dist/Tab.svelte.d.ts +2 -5
- package/dist/Tab.types.d.ts +4 -0
- package/dist/Tab.types.js +1 -0
- package/dist/TabList.svelte +3 -10
- package/dist/TabList.svelte.d.ts +2 -8
- package/dist/TabList.types.d.ts +7 -0
- package/dist/TextArea.svelte +3 -10
- package/dist/TextArea.svelte.d.ts +3 -10
- package/dist/TextArea.types.d.ts +7 -0
- package/dist/Tooltip.svelte +8 -9
- package/dist/Tooltip.svelte.d.ts +2 -8
- package/dist/Tooltip.types.d.ts +8 -0
- package/dist/Tooltip.types.js +1 -0
- package/dist/Tree.svelte +2 -11
- package/dist/Tree.svelte.d.ts +2 -9
- package/dist/Tree.types.d.ts +8 -0
- package/dist/TreeChevron.svelte +8 -8
- package/dist/TreeChevron.svelte.d.ts +2 -6
- package/dist/TreeChevron.types.d.ts +5 -0
- package/dist/TreeChevron.types.js +1 -0
- package/dist/TreeItem.svelte +4 -11
- package/dist/TreeItem.svelte.d.ts +2 -9
- package/dist/TreeItem.types.d.ts +8 -0
- package/dist/index.d.ts +32 -10
- package/dist/index.js +4 -3
- package/package.json +5 -6
package/dist/Popover.svelte
CHANGED
|
@@ -10,24 +10,14 @@
|
|
|
10
10
|
type Placement
|
|
11
11
|
} from '@floating-ui/dom';
|
|
12
12
|
import { getContext, tick } from 'svelte';
|
|
13
|
-
import type {
|
|
13
|
+
import type { KeyboardEventHandler } from 'svelte/elements';
|
|
14
14
|
import { portal } from './actions/portal';
|
|
15
|
-
import type { PopoverPlacement } from './Popover.types';
|
|
16
15
|
import { STERLING_PORTAL_CONTEXT_ID, STERLING_PORTAL_HOST_ID } from './Portal.constants';
|
|
17
16
|
import type { PortalContext } from './Portal.types';
|
|
17
|
+
import type { PopoverProps } from './Popover.types';
|
|
18
18
|
|
|
19
19
|
// ----- Props ----- //
|
|
20
20
|
|
|
21
|
-
type Props = HTMLAttributes<HTMLDivElement> & {
|
|
22
|
-
conditionalRender?: boolean;
|
|
23
|
-
crossAxisOffset?: number;
|
|
24
|
-
mainAxisOffset?: number;
|
|
25
|
-
open?: boolean | null;
|
|
26
|
-
placement?: PopoverPlacement;
|
|
27
|
-
portalHost?: HTMLElement;
|
|
28
|
-
reference?: HTMLElement;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
21
|
let {
|
|
32
22
|
children,
|
|
33
23
|
conditionalRender = $bindable(true),
|
|
@@ -39,7 +29,7 @@
|
|
|
39
29
|
reference,
|
|
40
30
|
class: _class,
|
|
41
31
|
...rest
|
|
42
|
-
}:
|
|
32
|
+
}: PopoverProps = $props();
|
|
43
33
|
|
|
44
34
|
let popupRef: HTMLDivElement | undefined = $state(undefined);
|
|
45
35
|
let popupPosition: Partial<ComputePositionReturn> = $state({ x: 0, y: 0 });
|
package/dist/Popover.svelte.d.ts
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
type Props = HTMLAttributes<HTMLDivElement> & {
|
|
4
|
-
conditionalRender?: boolean;
|
|
5
|
-
crossAxisOffset?: number;
|
|
6
|
-
mainAxisOffset?: number;
|
|
7
|
-
open?: boolean | null;
|
|
8
|
-
placement?: PopoverPlacement;
|
|
9
|
-
portalHost?: HTMLElement;
|
|
10
|
-
reference?: HTMLElement;
|
|
11
|
-
};
|
|
12
|
-
declare const Popover: import("svelte").Component<Props, {}, "conditionalRender" | "crossAxisOffset" | "mainAxisOffset" | "open" | "placement">;
|
|
1
|
+
import type { PopoverProps } from './Popover.types';
|
|
2
|
+
declare const Popover: import("svelte").Component<PopoverProps, {}, "conditionalRender" | "crossAxisOffset" | "mainAxisOffset" | "open" | "placement">;
|
|
13
3
|
type Popover = ReturnType<typeof Popover>;
|
|
14
4
|
export default Popover;
|
package/dist/Popover.types.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
1
2
|
import type { POPOVER_PLACEMENTS } from './Popover.constants';
|
|
2
3
|
type PopoverPlacementTuple = typeof POPOVER_PLACEMENTS;
|
|
3
4
|
export type PopoverPlacement = PopoverPlacementTuple[number];
|
|
5
|
+
export type PopoverProps = HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
conditionalRender?: boolean;
|
|
7
|
+
crossAxisOffset?: number;
|
|
8
|
+
mainAxisOffset?: number;
|
|
9
|
+
open?: boolean | null;
|
|
10
|
+
placement?: PopoverPlacement;
|
|
11
|
+
portalHost?: HTMLElement;
|
|
12
|
+
reference?: HTMLElement;
|
|
13
|
+
};
|
|
4
14
|
export {};
|
package/dist/Progress.svelte
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
<svelte:options runes={true} />
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
type Props = HTMLAttributes<HTMLDivElement> & {
|
|
7
|
-
disabled?: boolean | null;
|
|
8
|
-
max?: number;
|
|
9
|
-
percent?: number;
|
|
10
|
-
value?: number;
|
|
11
|
-
vertical?: boolean | null;
|
|
12
|
-
};
|
|
4
|
+
import type { ProgressProps } from './Progress.types';
|
|
13
5
|
|
|
14
6
|
let {
|
|
15
7
|
class: _class,
|
|
@@ -19,7 +11,7 @@
|
|
|
19
11
|
value = $bindable(0),
|
|
20
12
|
vertical,
|
|
21
13
|
...rest
|
|
22
|
-
}:
|
|
14
|
+
}: ProgressProps = $props();
|
|
23
15
|
|
|
24
16
|
//----- State ----- //
|
|
25
17
|
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
disabled?: boolean | null;
|
|
4
|
-
max?: number;
|
|
5
|
-
percent?: number;
|
|
6
|
-
value?: number;
|
|
7
|
-
vertical?: boolean | null;
|
|
8
|
-
};
|
|
9
|
-
declare const Progress: import("svelte").Component<Props, {}, "value" | "percent">;
|
|
1
|
+
import type { ProgressProps } from './Progress.types';
|
|
2
|
+
declare const Progress: import("svelte").Component<ProgressProps, {}, "value" | "percent">;
|
|
10
3
|
type Progress = ReturnType<typeof Progress>;
|
|
11
4
|
export default Progress;
|
package/dist/Progress.types.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { PROGRESS_ORIENTATIONS } from './Progress.constants';
|
|
2
2
|
type ProgressOrientationTuple = typeof PROGRESS_ORIENTATIONS;
|
|
3
3
|
export type ProgressOrientation = ProgressOrientationTuple[number];
|
|
4
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
export type ProgressProps = HTMLAttributes<HTMLDivElement> & {
|
|
6
|
+
disabled?: boolean | null;
|
|
7
|
+
max?: number;
|
|
8
|
+
percent?: number;
|
|
9
|
+
value?: number;
|
|
10
|
+
vertical?: boolean | null;
|
|
11
|
+
};
|
|
4
12
|
export {};
|
package/dist/Radio.svelte
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
<svelte:options runes={true} />
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
|
-
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
5
4
|
import { usingKeyboard } from './mediaQueries/usingKeyboard';
|
|
5
|
+
import type { RadioProps } from './Radio.types';
|
|
6
6
|
|
|
7
7
|
const uuid = $props.id();
|
|
8
8
|
|
|
9
|
-
type Props = HTMLInputAttributes & {
|
|
10
|
-
group?: any | null;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
9
|
let {
|
|
14
10
|
id,
|
|
15
11
|
children,
|
|
@@ -18,7 +14,7 @@
|
|
|
18
14
|
disabled = false,
|
|
19
15
|
group = $bindable(),
|
|
20
16
|
...rest
|
|
21
|
-
}:
|
|
17
|
+
}: RadioProps = $props();
|
|
22
18
|
|
|
23
19
|
let inputRef: HTMLInputElement;
|
|
24
20
|
|
package/dist/Radio.svelte.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
type Props = HTMLInputAttributes & {
|
|
3
|
-
group?: any | null;
|
|
4
|
-
};
|
|
1
|
+
import type { RadioProps } from './Radio.types';
|
|
5
2
|
/** A styled HTML input type=radio element with optional label. */
|
|
6
|
-
declare const Radio: import("svelte").Component<
|
|
3
|
+
declare const Radio: import("svelte").Component<RadioProps, {
|
|
7
4
|
blur: () => void;
|
|
8
5
|
click: () => void;
|
|
9
6
|
focus: (options?: FocusOptions) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Select.svelte
CHANGED
|
@@ -1,34 +1,15 @@
|
|
|
1
1
|
<svelte:options runes={true} />
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
|
-
import { tick
|
|
5
|
-
import type {
|
|
4
|
+
import { tick } from 'svelte';
|
|
5
|
+
import type { KeyboardEventHandler, MouseEventHandler } from 'svelte/elements';
|
|
6
6
|
import { clickOutside } from './actions/clickOutside';
|
|
7
7
|
import List from './List.svelte';
|
|
8
8
|
import Popover from './Popover.svelte';
|
|
9
|
+
import type { SelectProps } from './Select.types';
|
|
9
10
|
|
|
10
11
|
const uuid = $props.id();
|
|
11
12
|
|
|
12
|
-
type DeprecatedProps = {
|
|
13
|
-
/** @deprecated Use icon instead */
|
|
14
|
-
buttonSnippet?: Snippet;
|
|
15
|
-
|
|
16
|
-
/** @deprecated Use value instead */
|
|
17
|
-
valueSnippet?: Snippet<[string | undefined]>;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
type Props = HTMLAttributes<HTMLDivElement> &
|
|
21
|
-
DeprecatedProps & {
|
|
22
|
-
disabled?: boolean | null;
|
|
23
|
-
icon?: Snippet;
|
|
24
|
-
listClass?: string;
|
|
25
|
-
onPending?: (value?: string) => void;
|
|
26
|
-
onSelect?: (value?: string) => void;
|
|
27
|
-
open?: boolean | null;
|
|
28
|
-
selectedValue?: string;
|
|
29
|
-
value?: string | Snippet<[string | undefined]>;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
13
|
let {
|
|
33
14
|
children,
|
|
34
15
|
class: _class,
|
|
@@ -43,7 +24,7 @@
|
|
|
43
24
|
buttonSnippet,
|
|
44
25
|
valueSnippet,
|
|
45
26
|
...rest
|
|
46
|
-
}:
|
|
27
|
+
}: SelectProps = $props();
|
|
47
28
|
|
|
48
29
|
// backwards compatibility
|
|
49
30
|
icon = icon || buttonSnippet;
|
package/dist/Select.svelte.d.ts
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type DeprecatedProps = {
|
|
4
|
-
/** @deprecated Use icon instead */
|
|
5
|
-
buttonSnippet?: Snippet;
|
|
6
|
-
/** @deprecated Use value instead */
|
|
7
|
-
valueSnippet?: Snippet<[string | undefined]>;
|
|
8
|
-
};
|
|
9
|
-
type Props = HTMLAttributes<HTMLDivElement> & DeprecatedProps & {
|
|
10
|
-
disabled?: boolean | null;
|
|
11
|
-
icon?: Snippet;
|
|
12
|
-
listClass?: string;
|
|
13
|
-
onPending?: (value?: string) => void;
|
|
14
|
-
onSelect?: (value?: string) => void;
|
|
15
|
-
open?: boolean | null;
|
|
16
|
-
selectedValue?: string;
|
|
17
|
-
value?: string | Snippet<[string | undefined]>;
|
|
18
|
-
};
|
|
19
|
-
declare const Select: import("svelte").Component<Props, {
|
|
1
|
+
import type { SelectProps } from './Select.types';
|
|
2
|
+
declare const Select: import("svelte").Component<SelectProps, {
|
|
20
3
|
blur: () => void;
|
|
21
4
|
click: () => void;
|
|
22
5
|
focus: (options?: FocusOptions) => void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
type DeprecatedProps = {
|
|
4
|
+
/** @deprecated Use icon instead */
|
|
5
|
+
buttonSnippet?: Snippet;
|
|
6
|
+
/** @deprecated Use value instead */
|
|
7
|
+
valueSnippet?: Snippet<[string | undefined]>;
|
|
8
|
+
};
|
|
9
|
+
export type SelectProps = HTMLAttributes<HTMLDivElement> & DeprecatedProps & {
|
|
10
|
+
disabled?: boolean | null;
|
|
11
|
+
icon?: Snippet;
|
|
12
|
+
listClass?: string;
|
|
13
|
+
onPending?: (value?: string) => void;
|
|
14
|
+
onSelect?: (value?: string) => void;
|
|
15
|
+
open?: boolean | null;
|
|
16
|
+
selectedValue?: string;
|
|
17
|
+
value?: string | Snippet<[string | undefined]>;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Slider.svelte
CHANGED
|
@@ -2,18 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import { round } from 'lodash-es';
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
type Props = HTMLAttributes<HTMLDivElement> & {
|
|
8
|
-
disabled?: boolean | null;
|
|
9
|
-
min?: number;
|
|
10
|
-
max?: number;
|
|
11
|
-
precision?: number;
|
|
12
|
-
step?: number;
|
|
13
|
-
value?: number;
|
|
14
|
-
vertical?: boolean | null;
|
|
15
|
-
onChange?: (value: number) => void;
|
|
16
|
-
};
|
|
5
|
+
import type { KeyboardEventHandler, PointerEventHandler } from 'svelte/elements';
|
|
6
|
+
import type { SliderProps } from './Slider.types';
|
|
17
7
|
|
|
18
8
|
let {
|
|
19
9
|
class: _class,
|
|
@@ -26,7 +16,22 @@
|
|
|
26
16
|
value = $bindable(0),
|
|
27
17
|
vertical,
|
|
28
18
|
...rest
|
|
29
|
-
}:
|
|
19
|
+
}: SliderProps = $props();
|
|
20
|
+
|
|
21
|
+
const ensureValueValid = () => {
|
|
22
|
+
const clamped = Math.max(min, Math.min(max, value));
|
|
23
|
+
const newValue = precision !== undefined ? round(clamped, precision) : clamped;
|
|
24
|
+
if (value !== newValue) {
|
|
25
|
+
value = newValue;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// ensure incoming value is valid to avoid effect lag
|
|
30
|
+
if (min > max) {
|
|
31
|
+
console.warn('The slider min is greater than max.');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
ensureValueValid();
|
|
30
35
|
|
|
31
36
|
let sliderRef: HTMLDivElement;
|
|
32
37
|
|
|
@@ -42,28 +47,14 @@
|
|
|
42
47
|
sliderRef?.parentElement?.focus(options);
|
|
43
48
|
};
|
|
44
49
|
|
|
45
|
-
let ratio = $derived((value - min) / (max - min));
|
|
50
|
+
let ratio = $derived(max - min > 0 ? (value - min) / (max - min) : 0);
|
|
46
51
|
|
|
52
|
+
// when value changes, ensure it is valid right away
|
|
47
53
|
const setValue = (newValue: number) => {
|
|
48
54
|
const clamped = Math.max(min, Math.min(max, newValue));
|
|
49
55
|
value = precision !== undefined ? round(clamped, precision) : clamped;
|
|
50
56
|
};
|
|
51
57
|
|
|
52
|
-
// ensure min <= max
|
|
53
|
-
$effect(() => {
|
|
54
|
-
if (min > max) {
|
|
55
|
-
min = max;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
$effect(() => {
|
|
60
|
-
const clamped = Math.max(min, Math.min(max, value));
|
|
61
|
-
const newValue = precision !== undefined ? round(clamped, precision) : clamped;
|
|
62
|
-
if (value !== newValue) {
|
|
63
|
-
value = newValue;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
58
|
const setValueByOffset = (offset: number) => {
|
|
68
59
|
if (sliderSize > 0) {
|
|
69
60
|
const positionRatio = Math.max(0, Math.min(1, offset / sliderSize));
|
|
@@ -72,6 +63,10 @@
|
|
|
72
63
|
}
|
|
73
64
|
};
|
|
74
65
|
|
|
66
|
+
$effect(() => {
|
|
67
|
+
ensureValueValid();
|
|
68
|
+
});
|
|
69
|
+
|
|
75
70
|
// Raise change event when value changes
|
|
76
71
|
$effect(() => {
|
|
77
72
|
onChange?.(value);
|
package/dist/Slider.svelte.d.ts
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
disabled?: boolean | null;
|
|
4
|
-
min?: number;
|
|
5
|
-
max?: number;
|
|
6
|
-
precision?: number;
|
|
7
|
-
step?: number;
|
|
8
|
-
value?: number;
|
|
9
|
-
vertical?: boolean | null;
|
|
10
|
-
onChange?: (value: number) => void;
|
|
11
|
-
};
|
|
12
|
-
declare const Slider: import("svelte").Component<Props, {
|
|
1
|
+
import type { SliderProps } from './Slider.types';
|
|
2
|
+
declare const Slider: import("svelte").Component<SliderProps, {
|
|
13
3
|
blur: () => void;
|
|
14
4
|
click: () => void;
|
|
15
5
|
focus: (options?: FocusOptions) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
export type SliderProps = HTMLAttributes<HTMLDivElement> & {
|
|
3
|
+
disabled?: boolean | null;
|
|
4
|
+
min?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
precision?: number;
|
|
7
|
+
step?: number;
|
|
8
|
+
value?: number;
|
|
9
|
+
vertical?: boolean | null;
|
|
10
|
+
onChange?: (value: number) => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Switch.svelte
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
<svelte:options runes={true} />
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
|
-
import type { Snippet } from 'svelte';
|
|
5
|
-
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
6
4
|
import { usingKeyboard } from './mediaQueries/usingKeyboard';
|
|
5
|
+
import type { SwitchProps } from './Switch.types';
|
|
7
6
|
|
|
8
7
|
const uuid = $props.id();
|
|
9
8
|
|
|
10
|
-
type LabelSnippet = Snippet<
|
|
11
|
-
[{ checked: boolean | null | undefined; disabled: boolean | null | undefined; inputId: string }]
|
|
12
|
-
>;
|
|
13
|
-
|
|
14
|
-
type Props = HTMLInputAttributes & {
|
|
15
|
-
offLabel?: string | LabelSnippet;
|
|
16
|
-
onLabel?: string | LabelSnippet;
|
|
17
|
-
vertical?: boolean | null | undefined;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
9
|
let {
|
|
21
10
|
checked = $bindable(false),
|
|
22
11
|
class: _class,
|
|
@@ -26,7 +15,7 @@
|
|
|
26
15
|
onLabel,
|
|
27
16
|
vertical,
|
|
28
17
|
...rest
|
|
29
|
-
}:
|
|
18
|
+
}: SwitchProps = $props();
|
|
30
19
|
|
|
31
20
|
const inputId = id || `Switch-${uuid}`;
|
|
32
21
|
|
package/dist/Switch.svelte.d.ts
CHANGED
|
@@ -1,18 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
type LabelSnippet = Snippet<[
|
|
4
|
-
{
|
|
5
|
-
checked: boolean | null | undefined;
|
|
6
|
-
disabled: boolean | null | undefined;
|
|
7
|
-
inputId: string;
|
|
8
|
-
}
|
|
9
|
-
]>;
|
|
10
|
-
type Props = HTMLInputAttributes & {
|
|
11
|
-
offLabel?: string | LabelSnippet;
|
|
12
|
-
onLabel?: string | LabelSnippet;
|
|
13
|
-
vertical?: boolean | null | undefined;
|
|
14
|
-
};
|
|
15
|
-
declare const Switch: import("svelte").Component<Props, {
|
|
1
|
+
import type { SwitchProps } from './Switch.types';
|
|
2
|
+
declare const Switch: import("svelte").Component<SwitchProps, {
|
|
16
3
|
blur: () => void;
|
|
17
4
|
click: () => void;
|
|
18
5
|
focus: (options?: FocusOptions) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
+
export type SwitchLabelSnippet = Snippet<[
|
|
4
|
+
{
|
|
5
|
+
checked: boolean | null | undefined;
|
|
6
|
+
disabled: boolean | null | undefined;
|
|
7
|
+
inputId: string;
|
|
8
|
+
}
|
|
9
|
+
]>;
|
|
10
|
+
export type SwitchProps = HTMLInputAttributes & {
|
|
11
|
+
offLabel?: string | SwitchLabelSnippet;
|
|
12
|
+
onLabel?: string | SwitchLabelSnippet;
|
|
13
|
+
vertical?: boolean | null | undefined;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/Tab.svelte
CHANGED
|
@@ -2,16 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import { getContext } from 'svelte';
|
|
5
|
-
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
6
5
|
import { TAB_LIST_CONTEXT_KEY } from './TabList.constants';
|
|
7
6
|
import type { TabListContext } from './TabList.types';
|
|
8
7
|
import { usingKeyboard } from './mediaQueries/usingKeyboard';
|
|
8
|
+
import type { TabProps } from './Tab.types';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
value: string;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
let { children, class: _class, disabled = false, value, ...rest }: Props = $props();
|
|
10
|
+
let { children, class: _class, disabled = false, value, ...rest }: TabProps = $props();
|
|
15
11
|
|
|
16
12
|
let tabRef: HTMLButtonElement;
|
|
17
13
|
|
package/dist/Tab.svelte.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
value: string;
|
|
4
|
-
};
|
|
5
|
-
declare const Tab: import("svelte").Component<Props, {
|
|
1
|
+
import type { TabProps } from './Tab.types';
|
|
2
|
+
declare const Tab: import("svelte").Component<TabProps, {
|
|
6
3
|
click: () => void;
|
|
7
4
|
blur: () => void;
|
|
8
5
|
focus: (options?: FocusOptions) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/TabList.svelte
CHANGED
|
@@ -2,16 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import { setContext } from 'svelte';
|
|
5
|
-
import type {
|
|
5
|
+
import type { KeyboardEventHandler, MouseEventHandler } from 'svelte/elements';
|
|
6
6
|
import { TAB_LIST_CONTEXT_KEY } from './TabList.constants';
|
|
7
|
-
import type { TabListContext } from './TabList.types';
|
|
8
|
-
|
|
9
|
-
type Props = HTMLAttributes<HTMLDivElement> & {
|
|
10
|
-
disabled?: boolean | null;
|
|
11
|
-
selectedValue?: string;
|
|
12
|
-
vertical?: boolean | null;
|
|
13
|
-
onSelect?: (value?: string) => void;
|
|
14
|
-
};
|
|
7
|
+
import type { TabListContext, TabListProps } from './TabList.types';
|
|
15
8
|
|
|
16
9
|
let {
|
|
17
10
|
children,
|
|
@@ -21,7 +14,7 @@
|
|
|
21
14
|
selectedValue = $bindable(),
|
|
22
15
|
vertical = false,
|
|
23
16
|
...rest
|
|
24
|
-
}:
|
|
17
|
+
}: TabListProps = $props();
|
|
25
18
|
|
|
26
19
|
let tabListRef: HTMLDivElement;
|
|
27
20
|
let lastSelectedTabRef: HTMLElement;
|
package/dist/TabList.svelte.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
disabled?: boolean | null;
|
|
4
|
-
selectedValue?: string;
|
|
5
|
-
vertical?: boolean | null;
|
|
6
|
-
onSelect?: (value?: string) => void;
|
|
7
|
-
};
|
|
8
|
-
declare const TabList: import("svelte").Component<Props, {
|
|
1
|
+
import type { TabListProps } from './TabList.types';
|
|
2
|
+
declare const TabList: import("svelte").Component<TabListProps, {
|
|
9
3
|
blur: () => void;
|
|
10
4
|
focus: (options?: FocusOptions) => void;
|
|
11
5
|
selectFirstTab: () => boolean;
|
package/dist/TabList.types.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
1
2
|
export type TabListContext = {
|
|
2
3
|
disabled?: boolean | null | undefined;
|
|
3
4
|
selectedValue?: string | undefined;
|
|
4
5
|
vertical?: boolean | null | undefined;
|
|
5
6
|
};
|
|
7
|
+
export type TabListProps = HTMLAttributes<HTMLDivElement> & {
|
|
8
|
+
disabled?: boolean | null;
|
|
9
|
+
selectedValue?: string;
|
|
10
|
+
vertical?: boolean | null;
|
|
11
|
+
onSelect?: (value?: string) => void;
|
|
12
|
+
};
|
package/dist/TextArea.svelte
CHANGED
|
@@ -2,15 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import { tick } from 'svelte';
|
|
5
|
-
import type { FormEventHandler
|
|
6
|
-
import type {
|
|
7
|
-
|
|
8
|
-
type Props = HTMLTextareaAttributes & {
|
|
9
|
-
autoHeight?: boolean | null | undefined;
|
|
10
|
-
disabled?: boolean | null | undefined;
|
|
11
|
-
value?: string;
|
|
12
|
-
resize?: TextAreaResize;
|
|
13
|
-
};
|
|
5
|
+
import type { FormEventHandler } from 'svelte/elements';
|
|
6
|
+
import type { TextAreaProps } from './TextArea.types';
|
|
14
7
|
|
|
15
8
|
let {
|
|
16
9
|
class: _class,
|
|
@@ -20,7 +13,7 @@
|
|
|
20
13
|
resize = $bindable('none'),
|
|
21
14
|
style,
|
|
22
15
|
...rest
|
|
23
|
-
}:
|
|
16
|
+
}: TextAreaProps = $props();
|
|
24
17
|
|
|
25
18
|
let textAreaRef: HTMLTextAreaElement;
|
|
26
19
|
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
type Props = HTMLTextareaAttributes & {
|
|
4
|
-
autoHeight?: boolean | null | undefined;
|
|
5
|
-
disabled?: boolean | null | undefined;
|
|
6
|
-
value?: string;
|
|
7
|
-
resize?: TextAreaResize;
|
|
8
|
-
};
|
|
9
|
-
declare const TextArea: import("svelte").Component<Props, {
|
|
1
|
+
import type { TextAreaProps } from './TextArea.types';
|
|
2
|
+
declare const TextArea: import("svelte").Component<TextAreaProps, {
|
|
10
3
|
blur: () => void;
|
|
11
4
|
click: () => void;
|
|
12
5
|
focus: (options?: FocusOptions) => void;
|
|
13
6
|
select: () => void;
|
|
14
7
|
setSelectionRange: (start: number | null, end: number | null, direction?: "forward" | "backward" | "none") => void;
|
|
15
8
|
setRangeText: (replacement: string, start?: number, end?: number, selectionMode?: SelectionMode) => void;
|
|
16
|
-
}, "
|
|
9
|
+
}, "resize" | "value">;
|
|
17
10
|
type TextArea = ReturnType<typeof TextArea>;
|
|
18
11
|
export default TextArea;
|
package/dist/TextArea.types.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
1
2
|
import type { TEXT_AREA_RESIZES } from './TextArea.constants';
|
|
2
3
|
type TextAreaResizeTuple = typeof TEXT_AREA_RESIZES;
|
|
3
4
|
export type TextAreaResize = TextAreaResizeTuple[number];
|
|
5
|
+
export type TextAreaProps = HTMLTextareaAttributes & {
|
|
6
|
+
autoHeight?: boolean | null | undefined;
|
|
7
|
+
disabled?: boolean | null | undefined;
|
|
8
|
+
value?: string;
|
|
9
|
+
resize?: TextAreaResize;
|
|
10
|
+
};
|
|
4
11
|
export {};
|