reburn-ui 0.4.9 → 0.4.11
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/core/CodeHighlight/CodeHighlight.context.svelte.d.ts +2 -5
- package/dist/core/CodeHighlight/CodeHighlight.context.svelte.js +4 -3
- package/dist/core/CodeHighlight/CodeHighlight.svelte +6 -10
- package/dist/core/CodeHighlight/CodeHighlightControl.svelte +51 -1
- package/dist/core/CodeHighlight/CopyCodeButton/CopyCodeButton.svelte +2 -2
- package/dist/core/Notifications/NotificationContainer.svelte +4 -3
- package/dist/core/Notifications/Notifications.svelte +2 -2
- package/dist/core/Notifications/NotificationsStore.svelte.d.ts +1 -1
- package/dist/core/Notifications/NotificationsStore.svelte.js +1 -1
- package/dist/core/charts/ChartRoot/ChartContext.svelte.d.ts +2 -13
- package/dist/core/charts/ChartRoot/ChartContext.svelte.js +4 -3
- package/dist/core/charts/ChartRoot/ChartRoot.svelte +6 -8
- package/dist/core/charts/ChartTooltip/ChartTooltip.svelte +21 -6
- package/dist/core/charts/ScatterChart/ScatterChartInner.svelte +7 -5
- package/dist/core/charts/ScatterChart/ScatterChartInner.svelte.d.ts +1 -1
- package/dist/core/components/Anchor/Anchor.svelte +65 -0
- package/dist/core/components/Anchor/Anchor.svelte.d.ts +9 -0
- package/dist/core/components/AppShell/AppShell.svelte +2 -4
- package/dist/core/components/AppShell/AppShellContext.svelte.d.ts +7 -12
- package/dist/core/components/AppShell/AppShellContext.svelte.js +4 -3
- package/dist/core/components/Checkbox/Checkbox.svelte +37 -18
- package/dist/core/components/Checkbox/CheckboxCard/CheckboxCard.svelte +1 -4
- package/dist/core/components/Checkbox/CheckboxCard/CheckboxCardContext.svelte.d.ts +1 -2
- package/dist/core/components/Checkbox/CheckboxCard/CheckboxCardContext.svelte.js +4 -3
- package/dist/core/components/Checkbox/CheckboxGroup/CheckboxGroup.svelte +6 -7
- package/dist/core/components/Checkbox/CheckboxGroup/CheckboxGroup.svelte.d.ts +2 -2
- package/dist/core/components/Checkbox/CheckboxGroup/CheckboxGroupContext.svelte.d.ts +1 -2
- package/dist/core/components/Checkbox/CheckboxGroup/CheckboxGroupContext.svelte.js +4 -3
- package/dist/core/components/Checkbox/CheckboxIndicator.svelte +5 -7
- package/dist/core/components/Chip/ChipGroup/ChipGroup.svelte +1 -4
- package/dist/core/components/Chip/ChipGroup/ChipGroupContext.svelte.d.ts +1 -2
- package/dist/core/components/Chip/ChipGroup/ChipGroupContext.svelte.js +4 -3
- package/dist/core/components/Combobox/Combobox.svelte +3 -6
- package/dist/core/components/Combobox/Combobox.svelte.d.ts +1 -1
- package/dist/core/components/Combobox/ComboboxContext.svelte.d.ts +1 -2
- package/dist/core/components/Combobox/ComboboxContext.svelte.js +4 -3
- package/dist/core/components/CopyButton/CopyButton.svelte +2 -3
- package/dist/core/components/Floating/CreateFloating.svelte.d.ts +1 -1
- package/dist/core/components/Floating/CreateFloating.svelte.js +4 -4
- package/dist/core/components/Input/Input.context.svelte.d.ts +1 -2
- package/dist/core/components/Input/Input.context.svelte.js +4 -3
- package/dist/core/components/Input/Input.svelte +2 -4
- package/dist/core/components/Input/InputWrapper.context.svelte.d.ts +1 -2
- package/dist/core/components/Input/InputWrapper.context.svelte.js +4 -3
- package/dist/core/components/Input/InputWrapper.svelte +2 -4
- package/dist/core/components/ModalBase/CreateModal.svelte.js +2 -2
- package/dist/core/components/ModalBase/LockScroll.svelte.js +2 -2
- package/dist/core/components/Overlay/Overlay.svelte +2 -4
- package/dist/core/components/Pill/PillGroup.svelte +1 -4
- package/dist/core/components/Pill/PillGroupContext.svelte.d.ts +4 -8
- package/dist/core/components/Pill/PillGroupContext.svelte.js +3 -2
- package/dist/core/components/Popover/Popover.svelte +8 -10
- package/dist/core/components/Popover/PopoverContext.svelte.d.ts +7 -7
- package/dist/core/components/Popover/PopoverContext.svelte.js +33 -56
- package/dist/core/components/Popover/PopoverDropdown.svelte +5 -5
- package/dist/core/components/Progress/ProgressContext.svelte.d.ts +1 -2
- package/dist/core/components/Progress/ProgressContext.svelte.js +4 -3
- package/dist/core/components/Progress/ProgressRoot.svelte +3 -5
- package/dist/core/components/ScrollArea/ScrollAreaCorner.svelte +3 -3
- package/dist/core/components/ScrollArea/ScrollAreaScrollbar/ScrollAreaScrollbarAuto.svelte +3 -3
- package/dist/core/components/ScrollArea/ScrollAreaScrollbar/Scrollbar.svelte +3 -3
- package/dist/core/components/Select/Select.svelte +2 -2
- package/dist/core/components/Slider/CreateRangeSlider.svelte.d.ts +1 -1
- package/dist/core/components/Slider/CreateRangeSlider.svelte.js +1 -1
- package/dist/core/components/Slider/CreateSlider.svelte.d.ts +1 -1
- package/dist/core/components/Slider/CreateSlider.svelte.js +1 -1
- package/dist/core/components/Stack/Stack.svelte +33 -0
- package/dist/core/components/Stack/Stack.svelte.d.ts +14 -0
- package/dist/core/components/Switch/SwitchGroup/SwitchGroup.svelte +2 -5
- package/dist/core/components/Switch/SwitchGroup/SwitchGroupContext.svelte.d.ts +1 -2
- package/dist/core/components/Switch/SwitchGroup/SwitchGroupContext.svelte.js +4 -3
- package/dist/core/components/Table/Table.svelte +1 -4
- package/dist/core/components/Table/TableContext.svelte.d.ts +1 -2
- package/dist/core/components/Table/TableContext.svelte.js +4 -3
- package/dist/core/components/Tabs/Tabs.svelte +87 -0
- package/dist/core/components/Tabs/Tabs.svelte.d.ts +41 -0
- package/dist/core/components/Tooltip/CreateTooltip.svelte.d.ts +1 -1
- package/dist/core/components/Tooltip/Tooltip.svelte +4 -3
- package/dist/core/components/Tooltip/Tooltip.svelte.d.ts +1 -1
- package/dist/core/components/Transitions/transitions.d.ts +31 -11
- package/dist/core/components/Transitions/transitions.js +13 -12
- package/dist/core/components/index.d.ts +3 -0
- package/dist/core/components/index.js +3 -0
- package/dist/core/hooks/index.d.ts +1 -0
- package/dist/core/hooks/index.js +1 -0
- package/dist/core/hooks/use-click-outside.svelte.d.ts +3 -5
- package/dist/core/hooks/use-click-outside.svelte.js +18 -15
- package/dist/core/hooks/use-clipboard.svelte.d.ts +6 -5
- package/dist/core/hooks/use-clipboard.svelte.js +17 -11
- package/dist/core/hooks/use-color-scheme.svelte.d.ts +3 -1
- package/dist/core/hooks/use-color-scheme.svelte.js +4 -1
- package/dist/core/hooks/use-counter.svelte.d.ts +3 -1
- package/dist/core/hooks/use-counter.svelte.js +4 -1
- package/dist/core/hooks/use-disclosur.svelte.d.ts +2 -1
- package/dist/core/hooks/use-disclosur.svelte.js +4 -1
- package/dist/core/hooks/use-focus-return.svelte.d.ts +3 -1
- package/dist/core/hooks/use-focus-return.svelte.js +4 -1
- package/dist/core/hooks/use-previous.svelte.d.ts +3 -1
- package/dist/core/hooks/use-previous.svelte.js +4 -1
- package/dist/core/hooks/use-reduced-motion.svelte.d.ts +1 -1
- package/dist/core/hooks/use-reduced-motion.svelte.js +1 -1
- package/dist/core/hooks/use-resize-observer.svelte.d.ts +3 -1
- package/dist/core/hooks/use-resize-observer.svelte.js +4 -1
- package/dist/core/hooks/utils/random-id.d.ts +1 -0
- package/dist/core/hooks/utils/random-id.js +3 -0
- package/dist/core/utils/data-attr.d.ts +1 -0
- package/dist/core/utils/data-attr.js +3 -0
- package/dist/docs/CodeDemo.svelte +23 -0
- package/dist/docs/CodeDemo.svelte.d.ts +7 -0
- package/dist/docs/DocsNavbar.svelte +47 -0
- package/dist/docs/DocsNavbar.svelte.d.ts +18 -0
- package/dist/docs/DocsTitle.svelte +36 -0
- package/dist/docs/DocsTitle.svelte.d.ts +6 -0
- package/dist/docs/StaticDemo.svelte +62 -0
- package/dist/docs/StaticDemo.svelte.d.ts +11 -0
- package/dist/docs/UsageDemo.svelte +65 -17
- package/dist/docs/UsageDemo.svelte.d.ts +15 -7
- package/dist/docs/UsageDemoSizeSlider.svelte +41 -0
- package/dist/docs/UsageDemoSizeSlider.svelte.d.ts +14 -0
- package/dist/docs/formatProps.d.ts +6 -0
- package/dist/docs/formatProps.js +37 -0
- package/dist/dropzone/Child.svelte +11 -0
- package/dist/dropzone/Child.svelte.d.ts +18 -0
- package/dist/dropzone/Dropzone.svelte +141 -0
- package/dist/dropzone/Dropzone.svelte.d.ts +90 -0
- package/dist/dropzone/DropzoneContext.svelte.d.ts +7 -0
- package/dist/dropzone/DropzoneContext.svelte.js +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/ports/index.d.ts +1 -0
- package/dist/ports/index.js +1 -0
- package/dist/ports/svelte-dropzone/CreateDropzone.svelte.d.ts +23 -0
- package/dist/ports/svelte-dropzone/CreateDropzone.svelte.js +402 -0
- package/dist/ports/svelte-dropzone/types.d.ts +28 -0
- package/dist/ports/svelte-dropzone/types.js +1 -0
- package/dist/ports/svelte-dropzone/utils.d.ts +133 -0
- package/dist/ports/svelte-dropzone/utils.js +235 -0
- package/dist/styles/default-css-variables.css +14 -6
- package/dist/svelte-utils/CreateSvelteEvent.svelte.d.ts +20 -0
- package/dist/svelte-utils/CreateSvelteEvent.svelte.js +13 -0
- package/dist/{core/context → svelte-utils}/extract.d.ts +8 -1
- package/package.json +20 -18
- /package/dist/{core/context → svelte-utils}/extract.js +0 -0
|
@@ -25,9 +25,8 @@
|
|
|
25
25
|
|
|
26
26
|
<script lang="ts">
|
|
27
27
|
import { getRadius } from '../../../utils/get-size.js';
|
|
28
|
-
import { setContext } from 'svelte';
|
|
29
28
|
import { getCheckboxGroupContext } from '../CheckboxGroup/CheckboxGroupContext.svelte.js';
|
|
30
|
-
import {
|
|
29
|
+
import { CheckboxCardContext } from './CheckboxCardContext.svelte.js';
|
|
31
30
|
|
|
32
31
|
let {
|
|
33
32
|
checked = $bindable(false),
|
|
@@ -51,8 +50,6 @@
|
|
|
51
50
|
context?.change(value, !checkboxCardContext.checked);
|
|
52
51
|
checked = !checkboxCardContext.checked;
|
|
53
52
|
}
|
|
54
|
-
|
|
55
|
-
setContext(CHECKBOX_CARD_CONTEXT_KEY, checkboxCardContext);
|
|
56
53
|
</script>
|
|
57
54
|
|
|
58
55
|
<button
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type MaybeGetter } from '
|
|
2
|
-
export declare const CHECKBOX_CARD_CONTEXT_KEY: unique symbol;
|
|
1
|
+
import { type MaybeGetter } from '../../../../svelte-utils/extract.js';
|
|
3
2
|
export declare class CheckboxCardContext {
|
|
4
3
|
checked: boolean | undefined;
|
|
5
4
|
constructor(checked: MaybeGetter<boolean | undefined>);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { extract } from '
|
|
2
|
-
import { getContext } from 'svelte';
|
|
3
|
-
|
|
1
|
+
import { extract } from '../../../../svelte-utils/extract.js';
|
|
2
|
+
import { getContext, setContext } from 'svelte';
|
|
3
|
+
const CHECKBOX_CARD_CONTEXT_KEY = Symbol();
|
|
4
4
|
export class CheckboxCardContext {
|
|
5
5
|
checked;
|
|
6
6
|
constructor(checked) {
|
|
7
7
|
this.checked = $derived(extract(checked));
|
|
8
|
+
setContext(CHECKBOX_CARD_CONTEXT_KEY, this);
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
export function getCheckboxCardContext() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
+
import type { DivElement } from '../../../element-types.js';
|
|
2
3
|
import type { MantineSize } from '../../../MantineProvider/theme.types.js';
|
|
3
4
|
import { type Snippet } from 'svelte';
|
|
4
5
|
import type { InputWrapperProps } from '../../Input/InputWrapper.svelte';
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
onChange?: (value: string[]) => void;
|
|
18
19
|
|
|
19
20
|
/** Props passed down to the root element (`Input.Wrapper` component) */
|
|
20
|
-
wrapperProps?:
|
|
21
|
+
wrapperProps?: DivElement;
|
|
21
22
|
|
|
22
23
|
/** Controls size of the `Input.Wrapper`, `'sm'` by default */
|
|
23
24
|
size?: MantineSize | (string & {});
|
|
@@ -28,10 +29,8 @@
|
|
|
28
29
|
</script>
|
|
29
30
|
|
|
30
31
|
<script lang="ts">
|
|
31
|
-
import { setContext } from 'svelte';
|
|
32
|
-
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
33
32
|
import Input from '../../Input/index.js';
|
|
34
|
-
import {
|
|
33
|
+
import { CheckboxGroupContext } from './CheckboxGroupContext.svelte.js';
|
|
35
34
|
|
|
36
35
|
let {
|
|
37
36
|
children,
|
|
@@ -50,11 +49,11 @@
|
|
|
50
49
|
} else {
|
|
51
50
|
value = value.filter((v) => v !== name);
|
|
52
51
|
}
|
|
53
|
-
}
|
|
54
52
|
|
|
55
|
-
|
|
53
|
+
onChange?.(value);
|
|
54
|
+
}
|
|
56
55
|
|
|
57
|
-
|
|
56
|
+
new CheckboxGroupContext(() => value, handleChange);
|
|
58
57
|
</script>
|
|
59
58
|
|
|
60
59
|
<Input.Wrapper {...props} {size}>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DivElement } from '../../../element-types.js';
|
|
1
2
|
import type { MantineSize } from '../../../MantineProvider/theme.types.js';
|
|
2
3
|
import { type Snippet } from 'svelte';
|
|
3
4
|
import type { InputWrapperProps } from '../../Input/InputWrapper.svelte';
|
|
@@ -11,13 +12,12 @@ export interface CheckboxGroupProps extends InputWrapperProps {
|
|
|
11
12
|
/** Called with an array of selected checkboxes values when value changes */
|
|
12
13
|
onChange?: (value: string[]) => void;
|
|
13
14
|
/** Props passed down to the root element (`Input.Wrapper` component) */
|
|
14
|
-
wrapperProps?:
|
|
15
|
+
wrapperProps?: DivElement;
|
|
15
16
|
/** Controls size of the `Input.Wrapper`, `'sm'` by default */
|
|
16
17
|
size?: MantineSize | (string & {});
|
|
17
18
|
/** If set, value cannot be changed */
|
|
18
19
|
readOnly?: boolean;
|
|
19
20
|
}
|
|
20
|
-
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
21
21
|
declare const CheckboxGroup: import("svelte").Component<CheckboxGroupProps, {}, "value">;
|
|
22
22
|
type CheckboxGroup = ReturnType<typeof CheckboxGroup>;
|
|
23
23
|
export default CheckboxGroup;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { type NonNullableGetter } from '
|
|
1
|
+
import { type NonNullableGetter } from '../../../../svelte-utils/extract.js';
|
|
2
2
|
import type { CheckboxGroupProps } from './CheckboxGroup.svelte';
|
|
3
|
-
export declare const CHECKBOX_GROUP_CONTEXT_KEY: unique symbol;
|
|
4
3
|
export declare class CheckboxGroupContext {
|
|
5
4
|
value: string[];
|
|
6
5
|
change: (name: string, checked: boolean) => void;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { extract } from '
|
|
2
|
-
import { getContext } from 'svelte';
|
|
3
|
-
|
|
1
|
+
import { extract } from '../../../../svelte-utils/extract.js';
|
|
2
|
+
import { getContext, setContext } from 'svelte';
|
|
3
|
+
const CHECKBOX_GROUP_CONTEXT_KEY = Symbol();
|
|
4
4
|
export class CheckboxGroupContext {
|
|
5
5
|
value;
|
|
6
6
|
change;
|
|
7
7
|
constructor(value, change) {
|
|
8
8
|
this.value = $derived(extract(value));
|
|
9
9
|
this.change = change;
|
|
10
|
+
setContext(CHECKBOX_GROUP_CONTEXT_KEY, this);
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
export function getCheckboxGroupContext() {
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
const context = getCheckboxCardContext();
|
|
67
67
|
|
|
68
68
|
const _checked = $derived(
|
|
69
|
-
typeof checked === 'boolean' || typeof indeterminate === 'boolean' ? checked || indeterminate : context?.checked || false
|
|
69
|
+
typeof checked === 'boolean' || typeof indeterminate === 'boolean' ? checked || indeterminate : context?.checked || false,
|
|
70
70
|
);
|
|
71
71
|
|
|
72
72
|
const parsedColor = $derived(parseThemeColor({ color: color || theme.primaryColor }));
|
|
73
73
|
const outlineColor = $derived(
|
|
74
|
-
parsedColor.isThemeColor && parsedColor.shade === undefined ? `var(--mantine-color-${parsedColor.color}-outline)` : parsedColor.color
|
|
74
|
+
parsedColor.isThemeColor && parsedColor.shade === undefined ? `var(--mantine-color-${parsedColor.color}-outline)` : parsedColor.color,
|
|
75
75
|
);
|
|
76
76
|
|
|
77
77
|
const dataAttributes = $derived({
|
|
@@ -97,11 +97,9 @@
|
|
|
97
97
|
{...dataAttributes}
|
|
98
98
|
>
|
|
99
99
|
{#if _checked}
|
|
100
|
-
{
|
|
101
|
-
|
|
102
|
-
{
|
|
103
|
-
<IconCheck class={['icon', `icon--${variant}`]} {...dataAttributes} />
|
|
104
|
-
{/if}
|
|
100
|
+
<IconCheck class={['icon', `icon--${variant}`]} {...dataAttributes} />
|
|
101
|
+
{:else if indeterminate}
|
|
102
|
+
<IconMinus class={['icon', `icon--${variant}`]} {...dataAttributes} />
|
|
105
103
|
{/if}
|
|
106
104
|
</div>
|
|
107
105
|
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
</script>
|
|
23
23
|
|
|
24
24
|
<script lang="ts" generics="T extends boolean">
|
|
25
|
-
import {
|
|
26
|
-
import { CHIP_GROUP_CONTEXT_KEY, ChipGroupContext } from './ChipGroupContext.svelte.js';
|
|
25
|
+
import { ChipGroupContext } from './ChipGroupContext.svelte.js';
|
|
27
26
|
|
|
28
27
|
let {
|
|
29
28
|
children,
|
|
@@ -53,8 +52,6 @@
|
|
|
53
52
|
handleChange,
|
|
54
53
|
() => multiple
|
|
55
54
|
);
|
|
56
|
-
|
|
57
|
-
setContext(CHIP_GROUP_CONTEXT_KEY, context);
|
|
58
55
|
</script>
|
|
59
56
|
|
|
60
57
|
{@render children?.()}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { type NonNullableGetter } from '
|
|
1
|
+
import { type NonNullableGetter } from '../../../../svelte-utils/extract.js';
|
|
2
2
|
import type { ChipGroupProps } from './ChipGroup.svelte';
|
|
3
|
-
export declare const CHIP_GROUP_CONTEXT_KEY: unique symbol;
|
|
4
3
|
export declare class ChipGroupContext<T extends boolean = false> {
|
|
5
4
|
value: (T extends true ? string[] : string | null) & {};
|
|
6
5
|
change: (name: string, checked: boolean) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { extract } from '
|
|
2
|
-
import { getContext } from 'svelte';
|
|
3
|
-
|
|
1
|
+
import { extract } from '../../../../svelte-utils/extract.js';
|
|
2
|
+
import { getContext, setContext } from 'svelte';
|
|
3
|
+
const CHIP_GROUP_CONTEXT_KEY = Symbol();
|
|
4
4
|
export class ChipGroupContext {
|
|
5
5
|
value;
|
|
6
6
|
change;
|
|
@@ -9,6 +9,7 @@ export class ChipGroupContext {
|
|
|
9
9
|
this.value = $derived(extract(value));
|
|
10
10
|
this.change = change;
|
|
11
11
|
this.multiple = $derived(extract(multiple));
|
|
12
|
+
setContext(CHIP_GROUP_CONTEXT_KEY, this);
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
export function getChipGroupContext() {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { __PopoverProps } from '../Popover/Popover.svelte';
|
|
3
|
-
import Popover from '../Popover/Popover.svelte';
|
|
4
3
|
import type { MantineSize } from '../../MantineProvider/theme.types.js';
|
|
5
4
|
import type { Properties } from 'csstype';
|
|
6
5
|
import { type Snippet } from 'svelte';
|
|
7
6
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
8
|
-
import { COMBOBOX_CONTEXT_KEY, ComboboxContext } from './ComboboxContext.svelte.js';
|
|
9
7
|
import type { ComboboxOptionProps } from './ComboboxOption.svelte';
|
|
10
|
-
import { ComboboxStore } from './ComboboxStore.svelte.js';
|
|
11
8
|
|
|
12
9
|
export type ComboboxDropdownEventSource = 'keyboard' | 'mouse' | 'unknown';
|
|
13
10
|
|
|
@@ -36,7 +33,9 @@
|
|
|
36
33
|
</script>
|
|
37
34
|
|
|
38
35
|
<script lang="ts">
|
|
39
|
-
import
|
|
36
|
+
import Popover from '../Popover/Popover.svelte';
|
|
37
|
+
import { ComboboxContext } from './ComboboxContext.svelte.js';
|
|
38
|
+
import { ComboboxStore } from './ComboboxStore.svelte.js';
|
|
40
39
|
|
|
41
40
|
let {
|
|
42
41
|
keepMounted = true,
|
|
@@ -64,8 +63,6 @@
|
|
|
64
63
|
() => readOnly
|
|
65
64
|
);
|
|
66
65
|
|
|
67
|
-
setContext(COMBOBOX_CONTEXT_KEY, context);
|
|
68
|
-
|
|
69
66
|
function onDropdownClose() {
|
|
70
67
|
onclose?.();
|
|
71
68
|
comboboxStore.closeDropdown();
|
|
@@ -4,7 +4,6 @@ import type { Properties } from 'csstype';
|
|
|
4
4
|
import { type Snippet } from 'svelte';
|
|
5
5
|
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
6
6
|
import type { ComboboxOptionProps } from './ComboboxOption.svelte';
|
|
7
|
-
import { ComboboxStore } from './ComboboxStore.svelte.js';
|
|
8
7
|
export type ComboboxDropdownEventSource = 'keyboard' | 'mouse' | 'unknown';
|
|
9
8
|
export interface ComboboxProps extends __PopoverProps {
|
|
10
9
|
/** Combobox content */
|
|
@@ -22,6 +21,7 @@ export interface ComboboxProps extends __PopoverProps {
|
|
|
22
21
|
/** Determines whether Combobox value can be changed */
|
|
23
22
|
readOnly?: HTMLInputAttributes['readonly'];
|
|
24
23
|
}
|
|
24
|
+
import { ComboboxStore } from './ComboboxStore.svelte.js';
|
|
25
25
|
declare const Combobox: import("svelte").Component<ComboboxProps, {}, "">;
|
|
26
26
|
type Combobox = ReturnType<typeof Combobox>;
|
|
27
27
|
export default Combobox;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { type Getter, type NonNullableGetter } from '
|
|
1
|
+
import { type Getter, type NonNullableGetter } from '../../../svelte-utils/extract.js';
|
|
2
2
|
import type { ComboboxProps } from './Combobox.svelte';
|
|
3
|
-
export declare const COMBOBOX_CONTEXT_KEY: unique symbol;
|
|
4
3
|
export declare class ComboboxContext {
|
|
5
4
|
store: import("./ComboboxStore.svelte.js").ComboboxStore;
|
|
6
5
|
onoptionsubmit: ((value: string, optionProps: import("./ComboboxOption.svelte.js").ComboboxOptionProps) => void) | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { extract } from '
|
|
2
|
-
import { getContext } from 'svelte';
|
|
3
|
-
|
|
1
|
+
import { extract } from '../../../svelte-utils/extract.js';
|
|
2
|
+
import { getContext, setContext } from 'svelte';
|
|
3
|
+
const COMBOBOX_CONTEXT_KEY = Symbol();
|
|
4
4
|
export class ComboboxContext {
|
|
5
5
|
store;
|
|
6
6
|
onoptionsubmit;
|
|
@@ -13,6 +13,7 @@ export class ComboboxContext {
|
|
|
13
13
|
this.size = $derived(extract(size));
|
|
14
14
|
this.resetSelectionOnOptionHover = $derived(extract(resetSelectionOnOptionHover));
|
|
15
15
|
this.readOnly = $derived(extract(readOnly));
|
|
16
|
+
setContext(COMBOBOX_CONTEXT_KEY, this);
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
export function getComboboxContext() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
+
import { useClipboard } from '../../hooks/use-clipboard.svelte.js';
|
|
2
3
|
import type { Snippet } from 'svelte';
|
|
3
4
|
|
|
4
5
|
export interface CopyButtonProps {
|
|
@@ -14,11 +15,9 @@
|
|
|
14
15
|
</script>
|
|
15
16
|
|
|
16
17
|
<script lang="ts">
|
|
17
|
-
import { Clipboard } from '../../hooks/use-clipboard.svelte.js';
|
|
18
|
-
|
|
19
18
|
let { children, value, timeout = 1000 }: CopyButtonProps = $props();
|
|
20
19
|
|
|
21
|
-
const clipboard =
|
|
20
|
+
const clipboard = useClipboard({ timeout: () => timeout });
|
|
22
21
|
|
|
23
22
|
$effect(() => {
|
|
24
23
|
clipboard.options.timeout = timeout;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Getter, type MaybeGetter } from '
|
|
1
|
+
import { type Getter, type MaybeGetter } from '../../../svelte-utils/extract.js';
|
|
2
2
|
import type { Middleware } from '@floating-ui/dom';
|
|
3
3
|
import { type MiddlewareData } from '@floating-ui/dom';
|
|
4
4
|
import type { FloatingPosition, FloatingStrategy } from './types.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { extract } from '
|
|
1
|
+
import { extract } from '../../../svelte-utils/extract.js';
|
|
2
2
|
import { autoUpdate, computePosition } from '@floating-ui/dom';
|
|
3
3
|
export class CreateFloating {
|
|
4
4
|
#props;
|
|
@@ -31,12 +31,12 @@ export class CreateFloating {
|
|
|
31
31
|
strategy: this.#strategy,
|
|
32
32
|
placement: this.#placement,
|
|
33
33
|
middleware: this.#middleware,
|
|
34
|
-
}).then(({ x, y, middlewareData
|
|
34
|
+
}).then(({ x, y, middlewareData, placement }) => {
|
|
35
35
|
this.x = x;
|
|
36
36
|
this.y = y;
|
|
37
|
-
this.middlewareData =
|
|
37
|
+
this.middlewareData = middlewareData;
|
|
38
38
|
this.#onpositionchange?.(placement);
|
|
39
|
-
this.#onupdate?.({ x, y, middlewareData
|
|
39
|
+
this.#onupdate?.({ x, y, middlewareData });
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { type NonNullableGetter } from '
|
|
1
|
+
import { type NonNullableGetter } from '../../../svelte-utils/extract.js';
|
|
2
2
|
import type { __InputProps } from './Input.svelte';
|
|
3
3
|
export declare class InputContext {
|
|
4
4
|
size: string;
|
|
5
5
|
constructor(size: NonNullableGetter<__InputProps['size']>);
|
|
6
6
|
}
|
|
7
|
-
export declare const INPUT_CONTEXT_KEY: unique symbol;
|
|
8
7
|
export declare function getInputContext(): InputContext;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { extract } from '
|
|
2
|
-
import { getContext } from 'svelte';
|
|
1
|
+
import { extract } from '../../../svelte-utils/extract.js';
|
|
2
|
+
import { getContext, setContext } from 'svelte';
|
|
3
3
|
export class InputContext {
|
|
4
4
|
size;
|
|
5
5
|
constructor(size) {
|
|
6
6
|
this.size = $derived(extract(size));
|
|
7
|
+
setContext(INPUT_CONTEXT_KEY, this);
|
|
7
8
|
}
|
|
8
9
|
}
|
|
9
|
-
|
|
10
|
+
const INPUT_CONTEXT_KEY = Symbol();
|
|
10
11
|
export function getInputContext() {
|
|
11
12
|
return getContext(INPUT_CONTEXT_KEY);
|
|
12
13
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import type { DivElement } from '../../element-types.js';
|
|
4
4
|
import type { MantineRadius, MantineSize } from '../../MantineProvider/theme.types.js';
|
|
5
5
|
import type { Properties } from 'csstype';
|
|
6
|
-
import {
|
|
6
|
+
import { type Snippet } from 'svelte';
|
|
7
7
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
8
|
-
import {
|
|
8
|
+
import { InputContext } from './Input.context.svelte.js';
|
|
9
9
|
import type { __InputWrapperProps } from './InputWrapper.svelte';
|
|
10
10
|
|
|
11
11
|
export interface __BaseInputProps extends __InputWrapperProps, Omit<__InputProps, 'wrapperProps'> {
|
|
@@ -146,8 +146,6 @@
|
|
|
146
146
|
|
|
147
147
|
const context = new InputContext(() => size);
|
|
148
148
|
|
|
149
|
-
setContext(INPUT_CONTEXT_KEY, context);
|
|
150
|
-
|
|
151
149
|
const withRightSection = $derived(rightSection || (__clearable && __clearSection) || __defaultRightSection);
|
|
152
150
|
</script>
|
|
153
151
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { type Getter } from '
|
|
2
|
-
export declare const INPUT_WRAPPER_CONTEXT_KEY: unique symbol;
|
|
1
|
+
import { type Getter } from '../../../svelte-utils/extract.js';
|
|
3
2
|
export declare class InputWrapperContext {
|
|
4
3
|
describedBy: string | undefined;
|
|
5
4
|
inputId: string | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { extract } from '
|
|
2
|
-
import { getContext } from 'svelte';
|
|
3
|
-
|
|
1
|
+
import { extract } from '../../../svelte-utils/extract.js';
|
|
2
|
+
import { getContext, setContext } from 'svelte';
|
|
3
|
+
const INPUT_WRAPPER_CONTEXT_KEY = Symbol();
|
|
4
4
|
export class InputWrapperContext {
|
|
5
5
|
describedBy;
|
|
6
6
|
inputId;
|
|
@@ -13,6 +13,7 @@ export class InputWrapperContext {
|
|
|
13
13
|
this.labelId = $derived(extract(labelId));
|
|
14
14
|
this.offsetBottom = $derived(extract(offsetBottom));
|
|
15
15
|
this.offsetTop = $derived(extract(offsetTop));
|
|
16
|
+
setContext(INPUT_WRAPPER_CONTEXT_KEY, this);
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
export function getInputWrapperContext() {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { DivElement } from '../../element-types.js';
|
|
3
3
|
import type { MantineFontSize } from '../../MantineProvider/theme.types.js';
|
|
4
|
-
import {
|
|
4
|
+
import { type Snippet } from 'svelte';
|
|
5
5
|
import { getInputOffsets } from './get-input-offsets.js';
|
|
6
6
|
import InputDescription from './InputDescription.svelte';
|
|
7
7
|
import InputError from './InputError.svelte';
|
|
8
8
|
import InputLabel from './InputLabel.svelte';
|
|
9
|
-
import {
|
|
9
|
+
import { InputWrapperContext } from './InputWrapper.context.svelte.js';
|
|
10
10
|
|
|
11
11
|
export interface __InputWrapperProps {
|
|
12
12
|
/** Contents of `Input.Label` component. If not set, label is not rendered. */
|
|
@@ -99,8 +99,6 @@
|
|
|
99
99
|
() => offset.offsetBottom,
|
|
100
100
|
() => offset.offsetTop
|
|
101
101
|
);
|
|
102
|
-
|
|
103
|
-
setContext<InputWrapperContext>(INPUT_WRAPPER_CONTEXT_KEY, context);
|
|
104
102
|
</script>
|
|
105
103
|
|
|
106
104
|
<div {...props} class={['root', props.class]}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FocusReturn } from '../../hooks/use-focus-return.svelte.js';
|
|
2
1
|
import { on } from 'svelte/events';
|
|
3
2
|
import { LockScroll } from './LockScroll.svelte.js';
|
|
3
|
+
import { useFocusReturn } from '../../hooks/index.js';
|
|
4
4
|
export class CreateModal {
|
|
5
5
|
titleMounted = $state(false);
|
|
6
6
|
bodyMounted = $state(false);
|
|
@@ -35,6 +35,6 @@ export class CreateModal {
|
|
|
35
35
|
cleanup();
|
|
36
36
|
};
|
|
37
37
|
});
|
|
38
|
-
|
|
38
|
+
useFocusReturn(() => this.opened, () => Boolean(this.trapFocus && this.returnFocus));
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useReducedMotion } from '../../hooks/use-reduced-motion.svelte.js';
|
|
2
2
|
export class LockScroll {
|
|
3
3
|
current = $state(false);
|
|
4
4
|
#timeout = $state(-1);
|
|
@@ -6,7 +6,7 @@ export class LockScroll {
|
|
|
6
6
|
#transitionDuration;
|
|
7
7
|
constructor(input) {
|
|
8
8
|
this.#opened = $derived(input.opened());
|
|
9
|
-
this.#transitionDuration = $derived(
|
|
9
|
+
this.#transitionDuration = $derived(useReducedMotion ? 0 : input.transitionDuration());
|
|
10
10
|
$effect(() => {
|
|
11
11
|
if (this.#opened) {
|
|
12
12
|
this.current = true;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import type { Properties } from 'csstype';
|
|
8
8
|
import type { Snippet } from 'svelte';
|
|
9
9
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
10
|
-
import {
|
|
10
|
+
import { fade, type TransitionOverrides } from '../Transitions/transitions.js';
|
|
11
11
|
|
|
12
12
|
export type OverlayProps<T extends keyof SvelteHTMLElements = 'div'> = SvelteHTMLElements[T] & {
|
|
13
13
|
/** Controls overlay `background-color` opacity 0–1, disregarded when `gradient` prop is set, `0.6` by default */
|
|
@@ -60,8 +60,6 @@
|
|
|
60
60
|
transitionProps = {},
|
|
61
61
|
...props
|
|
62
62
|
}: OverlayProps<T> = $props();
|
|
63
|
-
|
|
64
|
-
const fadeTransition = transitions.fade;
|
|
65
63
|
</script>
|
|
66
64
|
|
|
67
65
|
<!-- TODO: maybe remove the background thingy for a css class, since the rgba function is pretty big -->
|
|
@@ -77,7 +75,7 @@
|
|
|
77
75
|
style:--overlay-filter={blur ? `blur(${rem(blur)})` : undefined}
|
|
78
76
|
style:--overlay-radius={radius ? getRadius(radius) : undefined}
|
|
79
77
|
style:--overlay-z-index={zIndex?.toString()}
|
|
80
|
-
transition:
|
|
78
|
+
transition:fade={transitionProps}
|
|
81
79
|
>
|
|
82
80
|
{@render children?.()}
|
|
83
81
|
</svelte:element>
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
<script lang="ts">
|
|
18
18
|
import { getSize } from '../../utils/get-size.js';
|
|
19
|
-
import {
|
|
20
|
-
import { PILL_GROUP_CONTEXT_KEY, PillGroupContext } from './PillGroupContext.svelte.js';
|
|
19
|
+
import { PillGroupContext } from './PillGroupContext.svelte.js';
|
|
21
20
|
|
|
22
21
|
let { children, gap, size = 'sm', disabled = false, ...props }: PillGroupProps = $props();
|
|
23
22
|
|
|
@@ -25,8 +24,6 @@
|
|
|
25
24
|
size: () => size,
|
|
26
25
|
disabled: () => disabled,
|
|
27
26
|
});
|
|
28
|
-
|
|
29
|
-
setContext(PILL_GROUP_CONTEXT_KEY, context);
|
|
30
27
|
</script>
|
|
31
28
|
|
|
32
29
|
<div {...props} class={['group', props.class]} style:--pg-gap={gap ? getSize(gap) : getSize(size, 'pg-gap')}>
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { WithGetters } from '../../../svelte-utils/extract.js';
|
|
2
2
|
import type { PillGroupProps } from './PillGroup.svelte';
|
|
3
|
-
|
|
4
|
-
size: MaybeGetter<PillGroupProps['size']>;
|
|
5
|
-
disabled: MaybeGetter<PillGroupProps['disabled']>;
|
|
6
|
-
}
|
|
3
|
+
type PillGroupContextProps = Pick<WithGetters<PillGroupProps>, 'size' | 'disabled'>;
|
|
7
4
|
export declare class PillGroupContext {
|
|
8
5
|
#private;
|
|
9
|
-
size:
|
|
10
|
-
disabled:
|
|
6
|
+
size: import("../../../svelte-utils/extract.js").Getter<(string & {}) | import("../../index.js").MantineSize | undefined> | undefined;
|
|
7
|
+
disabled: import("../../../svelte-utils/extract.js").Getter<boolean | undefined> | undefined;
|
|
11
8
|
constructor(props: PillGroupContextProps);
|
|
12
9
|
}
|
|
13
|
-
export declare const PILL_GROUP_CONTEXT_KEY: unique symbol;
|
|
14
10
|
export declare function getPillGroupContext(): PillGroupContext;
|
|
15
11
|
export {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { getContext } from 'svelte';
|
|
1
|
+
import { getContext, setContext } from 'svelte';
|
|
2
2
|
export class PillGroupContext {
|
|
3
3
|
#props;
|
|
4
4
|
size = $derived(this.#props.size);
|
|
5
5
|
disabled = $derived(this.#props.disabled);
|
|
6
6
|
constructor(props) {
|
|
7
7
|
this.#props = props;
|
|
8
|
+
setContext(PILL_GROUP_CONTEXT_KEY, this);
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
+
const PILL_GROUP_CONTEXT_KEY = Symbol();
|
|
11
12
|
export function getPillGroupContext() {
|
|
12
13
|
return getContext(PILL_GROUP_CONTEXT_KEY) || {};
|
|
13
14
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { MantineRadius, MantineShadow } from '../../MantineProvider/theme.types.js';
|
|
3
|
-
import {
|
|
3
|
+
import { useClickOutside, type ClickOutsideEvents } from '../../hooks/use-click-outside.svelte.js';
|
|
4
4
|
import { getDefaultZIndex } from '../../utils/get-default-z-index.js';
|
|
5
5
|
import { type Middleware } from '@floating-ui/dom';
|
|
6
|
-
import {
|
|
6
|
+
import { type Snippet } from 'svelte';
|
|
7
7
|
import type { ArrowPosition, FloatingAxesOffsets, FloatingPosition, FloatingStrategy } from '../Floating/types.js';
|
|
8
8
|
import Overlay, { type OverlayProps } from '../Overlay/Overlay.svelte';
|
|
9
9
|
import OptionalPortal from '../Portal/OptionalPortal.svelte';
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
|
|
146
146
|
<script lang="ts">
|
|
147
147
|
import { CreateFloating, type UpdatePositionProps } from '../Floating/CreateFloating.svelte.js';
|
|
148
|
-
import {
|
|
148
|
+
import { PopoverContext } from './PopoverContext.svelte.js';
|
|
149
149
|
|
|
150
150
|
let _id = $props.id();
|
|
151
151
|
|
|
@@ -203,10 +203,10 @@
|
|
|
203
203
|
arrowSize: () => arrowSize,
|
|
204
204
|
disabled: () => disabled,
|
|
205
205
|
floatingStrategy: () => floatingStrategy,
|
|
206
|
-
onclose,
|
|
207
|
-
ondismiss,
|
|
208
|
-
onopen,
|
|
209
|
-
onpositionchange,
|
|
206
|
+
onclose: () => onclose,
|
|
207
|
+
ondismiss: () => ondismiss,
|
|
208
|
+
onopen: () => onopen,
|
|
209
|
+
onpositionchange: () => onpositionchange,
|
|
210
210
|
opened: () => opened,
|
|
211
211
|
portalProps: () => portalProps,
|
|
212
212
|
width: () => width,
|
|
@@ -225,9 +225,7 @@
|
|
|
225
225
|
transitionProps: () => transitionProps,
|
|
226
226
|
});
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
new ClickOutside({
|
|
228
|
+
useClickOutside({
|
|
231
229
|
callback: handleClickOutside,
|
|
232
230
|
events: clickOutsideEvents,
|
|
233
231
|
refs: [() => context.referenceElement, () => context.floatingElement],
|