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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type MaybeGetter, type NonNullableGetter } from '
|
|
1
|
+
import { type Getter, type MaybeGetter, type NonNullableGetter } from '../../../svelte-utils/extract.js';
|
|
2
2
|
import type { PopoverProps } from './Popover.svelte';
|
|
3
3
|
interface PopoverContextProps {
|
|
4
4
|
opened: NonNullableGetter<PopoverProps['opened']>;
|
|
@@ -17,10 +17,10 @@ interface PopoverContextProps {
|
|
|
17
17
|
closeOnEscape: NonNullableGetter<PopoverProps['closeOnEscape']>;
|
|
18
18
|
returnFocus: NonNullableGetter<PopoverProps['returnFocus']>;
|
|
19
19
|
position: NonNullableGetter<PopoverProps['position']>;
|
|
20
|
-
onclose: PopoverProps['onclose']
|
|
21
|
-
ondismiss: PopoverProps['ondismiss']
|
|
22
|
-
onopen: PopoverProps['onopen']
|
|
23
|
-
onpositionchange: PopoverProps['onpositionchange']
|
|
20
|
+
onclose: Getter<PopoverProps['onclose']>;
|
|
21
|
+
ondismiss: Getter<PopoverProps['ondismiss']>;
|
|
22
|
+
onopen: Getter<PopoverProps['onopen']>;
|
|
23
|
+
onpositionchange: MaybeGetter<PopoverProps['onpositionchange']>;
|
|
24
24
|
withRoles: NonNullableGetter<PopoverProps['withRoles']>;
|
|
25
25
|
id: NonNullableGetter<PopoverProps['id']>;
|
|
26
26
|
toggle: () => void;
|
|
@@ -28,9 +28,9 @@ interface PopoverContextProps {
|
|
|
28
28
|
shadow: MaybeGetter<PopoverProps['shadow']>;
|
|
29
29
|
transitionProps: NonNullableGetter<PopoverProps['transitionProps']>;
|
|
30
30
|
}
|
|
31
|
-
export declare const POPOVER_CONTEXT_KEY: unique symbol;
|
|
32
31
|
export declare function getPopoverContext(): PopoverContext;
|
|
33
32
|
export declare class PopoverContext {
|
|
33
|
+
#private;
|
|
34
34
|
readonly opened: NonNullable<boolean | undefined>;
|
|
35
35
|
readonly disabled: boolean | undefined;
|
|
36
36
|
readonly width: import("./Popover.types.js").PopoverWidth;
|
|
@@ -68,6 +68,6 @@ export declare class PopoverContext {
|
|
|
68
68
|
arrowRef: HTMLDivElement | undefined;
|
|
69
69
|
floatingElement: HTMLElement | undefined;
|
|
70
70
|
referenceElement: HTMLElement | undefined;
|
|
71
|
-
constructor(
|
|
71
|
+
constructor(props: PopoverContextProps);
|
|
72
72
|
}
|
|
73
73
|
export {};
|
|
@@ -1,36 +1,37 @@
|
|
|
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 POPOVER_CONTEXT_KEY = Symbol();
|
|
4
4
|
export function getPopoverContext() {
|
|
5
5
|
return getContext(POPOVER_CONTEXT_KEY);
|
|
6
6
|
}
|
|
7
7
|
export class PopoverContext {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
8
|
+
#props;
|
|
9
|
+
opened = $derived(extract(this.#props.opened));
|
|
10
|
+
disabled = $derived(extract(this.#props.disabled));
|
|
11
|
+
width = $derived(extract(this.#props.width));
|
|
12
|
+
withArrow = $derived(extract(this.#props.withArrow));
|
|
13
|
+
arrowOffset = $derived(extract(this.#props.arrowOffset));
|
|
14
|
+
arrowSize = $derived(extract(this.#props.arrowSize));
|
|
15
|
+
arrowRadius = $derived(extract(this.#props.arrowRadius));
|
|
16
|
+
arrowPosition = $derived(extract(this.#props.arrowPosition));
|
|
17
|
+
trapFocus = $derived(extract(this.#props.trapFocus));
|
|
18
|
+
withinPortal = $derived(extract(this.#props.withinPortal));
|
|
19
|
+
portalProps = $derived(extract(this.#props.portalProps));
|
|
20
|
+
floatingStrategy = $derived(extract(this.#props.floatingStrategy));
|
|
21
|
+
zIndex = $derived(extract(this.#props.zIndex));
|
|
22
|
+
closeOnEscape = $derived(extract(this.#props.closeOnEscape));
|
|
23
|
+
returnFocus = $derived(extract(this.#props.returnFocus));
|
|
24
|
+
position = $derived(extract(this.#props.position));
|
|
25
|
+
onclose = $derived(extract(this.#props.onclose));
|
|
26
|
+
ondismiss = $derived(extract(this.#props.ondismiss));
|
|
27
|
+
onopen = $derived(extract(this.#props.onopen));
|
|
28
|
+
onpositionchange = $derived(extract(this.#props.onpositionchange));
|
|
29
|
+
withRoles = $derived(extract(this.#props.withRoles));
|
|
30
|
+
id = $derived(extract(this.#props.id));
|
|
31
|
+
toggle = $derived(this.#props.toggle);
|
|
32
|
+
radius = $derived(extract(this.#props.radius));
|
|
33
|
+
shadow = $derived(extract(this.#props.shadow));
|
|
34
|
+
transitionProps = $derived(extract(this.#props.transitionProps));
|
|
34
35
|
x = $state(0);
|
|
35
36
|
y = $state(0);
|
|
36
37
|
arrowX = $state(0);
|
|
@@ -38,32 +39,8 @@ export class PopoverContext {
|
|
|
38
39
|
arrowRef = $state(undefined);
|
|
39
40
|
floatingElement = $state(undefined);
|
|
40
41
|
referenceElement = $state(undefined);
|
|
41
|
-
constructor(
|
|
42
|
-
this
|
|
43
|
-
this
|
|
44
|
-
this.width = $derived(extract(width));
|
|
45
|
-
this.withArrow = $derived(extract(withArrow));
|
|
46
|
-
this.arrowOffset = $derived(extract(arrowOffset));
|
|
47
|
-
this.arrowSize = $derived(extract(arrowSize));
|
|
48
|
-
this.arrowRadius = $derived(extract(arrowRadius));
|
|
49
|
-
this.arrowPosition = $derived(extract(arrowPosition));
|
|
50
|
-
this.trapFocus = $derived(extract(trapFocus));
|
|
51
|
-
this.withinPortal = $derived(extract(withinPortal));
|
|
52
|
-
this.portalProps = $derived(extract(portalProps));
|
|
53
|
-
this.floatingStrategy = $derived(extract(floatingStrategy));
|
|
54
|
-
this.zIndex = $derived(extract(zIndex));
|
|
55
|
-
this.closeOnEscape = $derived(extract(closeOnEscape));
|
|
56
|
-
this.returnFocus = $derived(extract(returnFocus));
|
|
57
|
-
this.position = $derived(extract(position));
|
|
58
|
-
this.onclose = $derived(onclose);
|
|
59
|
-
this.ondismiss = $derived(ondismiss);
|
|
60
|
-
this.onopen = $derived(onopen);
|
|
61
|
-
this.onpositionchange = $derived(onpositionchange);
|
|
62
|
-
this.withRoles = $derived(extract(withRoles));
|
|
63
|
-
this.id = $derived(extract(id));
|
|
64
|
-
this.toggle = $derived(toggle);
|
|
65
|
-
this.radius = $derived(extract(radius));
|
|
66
|
-
this.shadow = $derived(extract(shadow));
|
|
67
|
-
this.transitionProps = $derived(extract(transitionProps));
|
|
42
|
+
constructor(props) {
|
|
43
|
+
this.#props = $derived(props);
|
|
44
|
+
setContext(POPOVER_CONTEXT_KEY, this);
|
|
68
45
|
}
|
|
69
46
|
}
|
|
@@ -6,20 +6,20 @@
|
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
8
8
|
import { focusTrap } from '../../attachments/use-focus-trap/use-focus-trap.svelte.js';
|
|
9
|
-
import {
|
|
9
|
+
import { useFocusReturn } from '../../hooks/use-focus-return.svelte.js';
|
|
10
10
|
import { closeOnEscape } from '../../utils/close-on-escape.js';
|
|
11
11
|
import { getRadius, getShadow } from '../../utils/get-size.js';
|
|
12
12
|
import { rem } from '../../utils/units-converters/rem.js';
|
|
13
13
|
import FloatingArrow from '../Floating/FloatingArrow.svelte';
|
|
14
14
|
import OptionalPortal from '../Portal/OptionalPortal.svelte';
|
|
15
|
-
import {
|
|
15
|
+
import { fade } from '../Transitions/transitions.js';
|
|
16
16
|
import { getPopoverContext } from './PopoverContext.svelte.js';
|
|
17
17
|
|
|
18
18
|
let { children, ...props }: PopoverDropdownProps = $props();
|
|
19
19
|
|
|
20
20
|
const ctx = getPopoverContext();
|
|
21
21
|
|
|
22
|
-
const shouldReturnFocus =
|
|
22
|
+
const shouldReturnFocus = useFocusReturn(
|
|
23
23
|
() => ctx.opened,
|
|
24
24
|
() => ctx.returnFocus
|
|
25
25
|
);
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
data-position={ctx.position}
|
|
54
54
|
bind:this={ctx.floatingElement}
|
|
55
55
|
style:z-index={ctx.zIndex}
|
|
56
|
-
in:
|
|
57
|
-
out:
|
|
56
|
+
in:fade={{ duration: ctx.transitionProps?.duration || 250 }}
|
|
57
|
+
out:fade={{ duration: ctx.transitionProps?.exitDuration || ctx.transitionProps?.duration || 250 }}
|
|
58
58
|
onkeydowncapture={handleKeyDownCapture}
|
|
59
59
|
{@attach focusTrap(ctx.trapFocus)}
|
|
60
60
|
>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Getter } from '
|
|
1
|
+
import type { Getter } from '../../../svelte-utils/extract.js';
|
|
2
2
|
import type { __ProgressRootProps } from './ProgressRoot.svelte';
|
|
3
|
-
export declare const PROGRESS_CONTEXT_KEY: unique symbol;
|
|
4
3
|
export declare class ProgressContext {
|
|
5
4
|
autoContrast: boolean | undefined;
|
|
6
5
|
constructor(autoContrast: Getter<__ProgressRootProps['autoContrast']>);
|
|
@@ -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 PROGRESS_CONTEXT_KEY = Symbol();
|
|
4
4
|
export class ProgressContext {
|
|
5
5
|
autoContrast;
|
|
6
6
|
constructor(autoContrast) {
|
|
7
7
|
this.autoContrast = $derived(extract(autoContrast));
|
|
8
|
+
setContext(PROGRESS_CONTEXT_KEY, this);
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
export function getProgressContext() {
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { DivElement } from '../../element-types.js';
|
|
3
3
|
import type { MantineRadius, MantineSize } from '../../MantineProvider/theme.types.js';
|
|
4
|
-
import {
|
|
5
|
-
import { setContext } from 'svelte';
|
|
6
|
-
import { PROGRESS_CONTEXT_KEY, ProgressContext } from './ProgressContext.svelte.js';
|
|
4
|
+
import { ProgressContext } from './ProgressContext.svelte.js';
|
|
7
5
|
|
|
8
6
|
export interface __ProgressRootProps extends DivElement {
|
|
9
7
|
/** Controls track height, `'md'` by default */
|
|
@@ -24,6 +22,8 @@
|
|
|
24
22
|
</script>
|
|
25
23
|
|
|
26
24
|
<script lang="ts">
|
|
25
|
+
import { getRadius, getSize } from '../../utils/get-size.js';
|
|
26
|
+
|
|
27
27
|
let {
|
|
28
28
|
transitionDuration = 100,
|
|
29
29
|
size = 'md',
|
|
@@ -35,8 +35,6 @@
|
|
|
35
35
|
}: __ProgressRootProps = $props();
|
|
36
36
|
|
|
37
37
|
const context = new ProgressContext(() => autoContrast);
|
|
38
|
-
|
|
39
|
-
setContext(PROGRESS_CONTEXT_KEY, context);
|
|
40
38
|
</script>
|
|
41
39
|
|
|
42
40
|
<div
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { DivElement } from '../../element-types.js';
|
|
3
|
-
import {
|
|
3
|
+
import { useResizeObserver } from '../../hooks/use-resize-observer.svelte.js';
|
|
4
4
|
import { getScrollAreaContext } from './getScrollAreaContext.js';
|
|
5
5
|
|
|
6
6
|
interface ScrollAreaCornerProps extends DivElement {}
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
ctx.cornerWidth = ctx.scrollbarY?.offsetWidth || 0;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
useResizeObserver(() => ctx.scrollbarX, handleScrollbarXResize);
|
|
23
|
+
useResizeObserver(() => ctx.scrollbarY, handleScrollbarYResize);
|
|
24
24
|
</script>
|
|
25
25
|
|
|
26
26
|
{#if hasSize}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<script lang="ts">
|
|
10
|
-
import {
|
|
10
|
+
import { useResizeObserver } from '../../../hooks/use-resize-observer.svelte.js';
|
|
11
11
|
import { debounce } from 'es-toolkit';
|
|
12
12
|
import { getScrollAreaContext } from '../getScrollAreaContext.js';
|
|
13
13
|
import ScrollAreaScrollbarVisible from './ScrollAreaScrollbarVisible.svelte';
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
}
|
|
29
29
|
}, 10);
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
useResizeObserver(() => context.viewport, handleResize);
|
|
32
|
+
useResizeObserver(() => context.content, handleResize);
|
|
33
33
|
</script>
|
|
34
34
|
|
|
35
35
|
{#if forceMount || visible}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
<script lang="ts">
|
|
24
|
-
import {
|
|
24
|
+
import { useResizeObserver } from '../../../hooks/use-resize-observer.svelte.js';
|
|
25
25
|
import { debounce } from 'es-toolkit';
|
|
26
26
|
import { setContext } from 'svelte';
|
|
27
27
|
import { on } from 'svelte/events';
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
return cleanup;
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
useResizeObserver(() => ref, handleResize);
|
|
96
|
+
useResizeObserver(() => context.content, handleResize);
|
|
97
97
|
</script>
|
|
98
98
|
|
|
99
99
|
<div
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
</script>
|
|
71
71
|
|
|
72
72
|
<script lang="ts">
|
|
73
|
-
import {
|
|
73
|
+
import { usePrevious } from '../../hooks/use-previous.svelte.js';
|
|
74
74
|
import Combobox from '../Combobox/index.js';
|
|
75
75
|
import OptionsDropdown from '../Combobox/OptionsDropdown/OptionsDropdown.svelte';
|
|
76
76
|
import InputBase from '../InputBase/InputBase.svelte';
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
const optionsLockup = $derived(getOptionsLockup(parsedData));
|
|
129
129
|
|
|
130
130
|
const selectedOption = $derived(typeof value === 'string' ? optionsLockup[value] : undefined);
|
|
131
|
-
const previousSelectedOption =
|
|
131
|
+
const previousSelectedOption = usePrevious(() => selectedOption);
|
|
132
132
|
|
|
133
133
|
const combobox = new ComboboxStore({
|
|
134
134
|
opened: () => dropdownOpened,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type MaybeGetter } from '
|
|
1
|
+
import { type MaybeGetter } from '../../../svelte-utils/extract.js';
|
|
2
2
|
import type { RangeSliderProps, RangeSliderValue } from './RangeSlider.svelte';
|
|
3
3
|
type ThumbIndex = 0 | 1 | -1;
|
|
4
4
|
interface CreateRangeSliderProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { move } from '../../attachments/attach-move.svelte.js';
|
|
2
|
-
import { extract } from '../../context/extract.js';
|
|
3
2
|
import { getDirection } from '../../DirectionProvider/direction.svelte.js';
|
|
3
|
+
import { extract } from '../../../svelte-utils/extract.js';
|
|
4
4
|
import { findClosestNumber } from './utils/find-closest-number.js';
|
|
5
5
|
import { getChangeValue } from './utils/get-change-value.js';
|
|
6
6
|
import { getClientPosition } from './utils/get-client-position.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type UseMovePosition } from '../../attachments/attach-move.svelte.js';
|
|
2
|
-
import { type MaybeGetter } from '
|
|
2
|
+
import { type MaybeGetter } from '../../../svelte-utils/extract.js';
|
|
3
3
|
import type { SliderProps } from './Slider.svelte';
|
|
4
4
|
interface CreateSliderProps {
|
|
5
5
|
disabled?: MaybeGetter<SliderProps['disabled']>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { move } from '../../attachments/attach-move.svelte.js';
|
|
2
|
-
import { extract } from '../../context/extract.js';
|
|
3
2
|
import { getDirection } from '../../DirectionProvider/direction.svelte.js';
|
|
3
|
+
import { extract } from '../../../svelte-utils/extract.js';
|
|
4
4
|
import { findClosestNumber } from './utils/find-closest-number.js';
|
|
5
5
|
import { getChangeValue } from './utils/get-change-value.js';
|
|
6
6
|
import { getFloatingValue } from './utils/get-floating-value.js';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { DivElement } from '../../element-types.js';
|
|
3
|
+
import type { MantineSpacing } from '../../MantineProvider/theme.types.js';
|
|
4
|
+
import { getSpacing } from '../../utils/get-size.js';
|
|
5
|
+
import type { Properties } from 'csstype';
|
|
6
|
+
|
|
7
|
+
export interface StackProps extends DivElement {
|
|
8
|
+
/** Key of `theme.spacing` or any valid CSS value to set `gap` property, numbers are converted to rem, `'md'` by default */
|
|
9
|
+
gap?: MantineSpacing;
|
|
10
|
+
|
|
11
|
+
/** Controls `align-items` CSS property, `'stretch'` by default */
|
|
12
|
+
align?: Properties['alignItems'];
|
|
13
|
+
|
|
14
|
+
/** Controls `justify-content` CSS property, `'flex-start'` by default */
|
|
15
|
+
justify?: Properties['justifyContent'];
|
|
16
|
+
}
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<script lang="ts">
|
|
20
|
+
let { children, gap = 'md', align = 'stretch', justify = 'flex-start', ...props }: StackProps = $props();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<div {...props} class={['root', props.class]} style:--stack-gap={getSpacing(gap)} style:--stack-align={align} style:--stack-justify={justify}>
|
|
24
|
+
{@render children?.()}
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<style>.root {
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
align-items: var(--stack-align, stretch);
|
|
31
|
+
justify-content: var(--stack-justify, flex-start);
|
|
32
|
+
gap: var(--stack-gap, var(--mantine-spacing-md));
|
|
33
|
+
}</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DivElement } from '../../element-types.js';
|
|
2
|
+
import type { MantineSpacing } from '../../MantineProvider/theme.types.js';
|
|
3
|
+
import type { Properties } from 'csstype';
|
|
4
|
+
export interface StackProps extends DivElement {
|
|
5
|
+
/** Key of `theme.spacing` or any valid CSS value to set `gap` property, numbers are converted to rem, `'md'` by default */
|
|
6
|
+
gap?: MantineSpacing;
|
|
7
|
+
/** Controls `align-items` CSS property, `'stretch'` by default */
|
|
8
|
+
align?: Properties['alignItems'];
|
|
9
|
+
/** Controls `justify-content` CSS property, `'flex-start'` by default */
|
|
10
|
+
justify?: Properties['justifyContent'];
|
|
11
|
+
}
|
|
12
|
+
declare const Stack: import("svelte").Component<StackProps, {}, "">;
|
|
13
|
+
type Stack = ReturnType<typeof Stack>;
|
|
14
|
+
export default Stack;
|
|
@@ -26,9 +26,8 @@
|
|
|
26
26
|
</script>
|
|
27
27
|
|
|
28
28
|
<script lang="ts">
|
|
29
|
-
import { setContext } from 'svelte';
|
|
30
29
|
import Input from '../../Input/index.js';
|
|
31
|
-
import {
|
|
30
|
+
import { SwitchGroupContext } from './SwitchGroupContext.svelte.js';
|
|
32
31
|
|
|
33
32
|
let { children, defaultValue = [], value = $bindable(defaultValue), wrapperProps, size, readOnly, ...props }: SwitchGroupProps = $props();
|
|
34
33
|
|
|
@@ -40,9 +39,7 @@
|
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
setContext<SwitchGroupContext>(SWITCH_GROUP_CONTEXT_KEY, context);
|
|
42
|
+
new SwitchGroupContext(() => value, handleChange);
|
|
46
43
|
</script>
|
|
47
44
|
|
|
48
45
|
<!-- TODO: see why we need InputsGroupFieldset: SwitchGroup.tsx line:71 -->
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { type NonNullableGetter } from '
|
|
1
|
+
import { type NonNullableGetter } from '../../../../svelte-utils/extract.js';
|
|
2
2
|
import type { SwitchGroupProps } from './SwitchGroup.svelte';
|
|
3
|
-
export declare const SWITCH_GROUP_CONTEXT_KEY: unique symbol;
|
|
4
3
|
export declare class SwitchGroupContext {
|
|
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 SWITCH_GROUP_CONTEXT_KEY = Symbol();
|
|
4
4
|
export class SwitchGroupContext {
|
|
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(SWITCH_GROUP_CONTEXT_KEY, this);
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
export function getSwitchGroupContext() {
|
|
@@ -73,8 +73,7 @@
|
|
|
73
73
|
import { getThemeColor } from '../../MantineProvider/color-functions/get-theme-color.js';
|
|
74
74
|
import { getSpacing } from '../../utils/get-size.js';
|
|
75
75
|
import { rem } from '../../utils/units-converters/rem.js';
|
|
76
|
-
import {
|
|
77
|
-
import { TABLE_CONTEXT_KEY, TableContext } from './TableContext.svelte.js';
|
|
76
|
+
import { TableContext } from './TableContext.svelte.js';
|
|
78
77
|
import TableDataRenderer from './TableDataRenderer.svelte';
|
|
79
78
|
|
|
80
79
|
let {
|
|
@@ -107,8 +106,6 @@
|
|
|
107
106
|
stickyHeader: () => stickyHeader,
|
|
108
107
|
variant: () => variant,
|
|
109
108
|
});
|
|
110
|
-
|
|
111
|
-
setContext(TABLE_CONTEXT_KEY, context);
|
|
112
109
|
</script>
|
|
113
110
|
|
|
114
111
|
<table
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Getter } from '
|
|
1
|
+
import { type Getter } from '../../../svelte-utils/extract.js';
|
|
2
2
|
import type { TableProps } from './Table.svelte';
|
|
3
3
|
interface TableContextProps {
|
|
4
4
|
striped: Getter<TableProps['striped']>;
|
|
@@ -20,6 +20,5 @@ export declare class TableContext {
|
|
|
20
20
|
variant: import("./Table.svelte").TableVariant | undefined;
|
|
21
21
|
constructor(props: TableContextProps);
|
|
22
22
|
}
|
|
23
|
-
export declare const TABLE_CONTEXT_KEY: unique symbol;
|
|
24
23
|
export declare function getTableContext(): TableContext;
|
|
25
24
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
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 TableContext {
|
|
4
4
|
#props;
|
|
5
5
|
striped = $derived(extract(this.#props.striped));
|
|
@@ -11,9 +11,10 @@ export class TableContext {
|
|
|
11
11
|
variant = $derived(extract(this.#props.variant));
|
|
12
12
|
constructor(props) {
|
|
13
13
|
this.#props = props;
|
|
14
|
+
setContext(TABLE_CONTEXT_KEY, this);
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
+
const TABLE_CONTEXT_KEY = Symbol();
|
|
17
18
|
export function getTableContext() {
|
|
18
19
|
return getContext(TABLE_CONTEXT_KEY);
|
|
19
20
|
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { DivElement } from '../../element-types.js';
|
|
3
|
+
import { getContrastColor, getThemeColor } from '../../MantineProvider/index.js';
|
|
4
|
+
import type { MantineColor, MantineRadius } from '../../MantineProvider/theme.types.js';
|
|
5
|
+
import { getRadius } from '../../utils/get-size.js';
|
|
6
|
+
import type { Snippet } from 'svelte';
|
|
7
|
+
|
|
8
|
+
export type TabsVariant = 'default' | 'outline' | 'pills';
|
|
9
|
+
|
|
10
|
+
export interface TabsProps extends Omit<DivElement, 'defaultValue' | 'value' | 'onChange'> {
|
|
11
|
+
/** Uncontrolled component default value */
|
|
12
|
+
defaultValue?: string | null;
|
|
13
|
+
|
|
14
|
+
/** Controlled component value */
|
|
15
|
+
value?: string | null;
|
|
16
|
+
|
|
17
|
+
/** Called when value changes */
|
|
18
|
+
onChange?: (value: string | null) => void;
|
|
19
|
+
|
|
20
|
+
/** Tabs orientation @default `'horizontal'` */
|
|
21
|
+
orientation?: 'vertical' | 'horizontal';
|
|
22
|
+
|
|
23
|
+
/** `Tabs.List` placement relative to `Tabs.Panel`, applicable only when `orientation="vertical"` @default `'left'` */
|
|
24
|
+
placement?: 'left' | 'right';
|
|
25
|
+
|
|
26
|
+
/** Base id, used to generate ids to connect labels with controls, generated randomly by default */
|
|
27
|
+
id?: string;
|
|
28
|
+
|
|
29
|
+
/** If set, arrow key presses loop though items (first to last and last to first) @default `true` */
|
|
30
|
+
loop?: boolean;
|
|
31
|
+
|
|
32
|
+
/** If set, tab is activated with arrow key press @default `true` */
|
|
33
|
+
activateTabWithKeyboard?: boolean;
|
|
34
|
+
|
|
35
|
+
/** If set, tab can be deactivated @default `false` */
|
|
36
|
+
allowTabDeactivation?: boolean;
|
|
37
|
+
|
|
38
|
+
/** Tabs content */
|
|
39
|
+
children?: Snippet;
|
|
40
|
+
|
|
41
|
+
/** Changes colors of `Tabs.Tab` components when variant is `pills` or `default`, does nothing for other variants */
|
|
42
|
+
color?: MantineColor;
|
|
43
|
+
|
|
44
|
+
/** Key of `theme.radius` or any valid CSS value to set `border-radius`@default `theme.defaultRadius` */
|
|
45
|
+
radius?: MantineRadius;
|
|
46
|
+
|
|
47
|
+
/** Determines whether tabs should have inverted styles @default `false` */
|
|
48
|
+
inverted?: boolean;
|
|
49
|
+
|
|
50
|
+
/** If set to `false`, `Tabs.Panel` content will be unmounted when the associated tab is not active @default `true` */
|
|
51
|
+
keepMounted?: boolean;
|
|
52
|
+
|
|
53
|
+
/** If set, adjusts text color based on background color for `pills` variant */
|
|
54
|
+
autoContrast?: boolean;
|
|
55
|
+
|
|
56
|
+
/** Determines the variant of the tabs */
|
|
57
|
+
variant?: TabsVariant;
|
|
58
|
+
}
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
<script lang="ts">
|
|
62
|
+
const _id = $props.id();
|
|
63
|
+
|
|
64
|
+
let {
|
|
65
|
+
id = _id,
|
|
66
|
+
keepMounted = true,
|
|
67
|
+
orientation = 'horizontal',
|
|
68
|
+
loop = true,
|
|
69
|
+
activateTabWithKeyboard = true,
|
|
70
|
+
variant = 'default',
|
|
71
|
+
placement = 'left',
|
|
72
|
+
children,
|
|
73
|
+
defaultValue = null,
|
|
74
|
+
value = $bindable(defaultValue),
|
|
75
|
+
...props
|
|
76
|
+
}: TabsProps = $props();
|
|
77
|
+
|
|
78
|
+
const VALUE_ERROR = 'Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value';
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<div
|
|
82
|
+
style:--tabs-radius={getRadius(radius)}
|
|
83
|
+
style:--tabs-color={getThemeColor(color)}
|
|
84
|
+
style:--tabs-text-color={getContrastColor(autoContract) ? getContrastColor({ color, autoContrast }) : undefined}
|
|
85
|
+
></div>
|
|
86
|
+
|
|
87
|
+
<style></style>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { DivElement } from '../../element-types.js';
|
|
2
|
+
import type { MantineColor, MantineRadius } from '../../MantineProvider/theme.types.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
export type TabsVariant = 'default' | 'outline' | 'pills';
|
|
5
|
+
export interface TabsProps extends Omit<DivElement, 'defaultValue' | 'value' | 'onChange'> {
|
|
6
|
+
/** Uncontrolled component default value */
|
|
7
|
+
defaultValue?: string | null;
|
|
8
|
+
/** Controlled component value */
|
|
9
|
+
value?: string | null;
|
|
10
|
+
/** Called when value changes */
|
|
11
|
+
onChange?: (value: string | null) => void;
|
|
12
|
+
/** Tabs orientation @default `'horizontal'` */
|
|
13
|
+
orientation?: 'vertical' | 'horizontal';
|
|
14
|
+
/** `Tabs.List` placement relative to `Tabs.Panel`, applicable only when `orientation="vertical"` @default `'left'` */
|
|
15
|
+
placement?: 'left' | 'right';
|
|
16
|
+
/** Base id, used to generate ids to connect labels with controls, generated randomly by default */
|
|
17
|
+
id?: string;
|
|
18
|
+
/** If set, arrow key presses loop though items (first to last and last to first) @default `true` */
|
|
19
|
+
loop?: boolean;
|
|
20
|
+
/** If set, tab is activated with arrow key press @default `true` */
|
|
21
|
+
activateTabWithKeyboard?: boolean;
|
|
22
|
+
/** If set, tab can be deactivated @default `false` */
|
|
23
|
+
allowTabDeactivation?: boolean;
|
|
24
|
+
/** Tabs content */
|
|
25
|
+
children?: Snippet;
|
|
26
|
+
/** Changes colors of `Tabs.Tab` components when variant is `pills` or `default`, does nothing for other variants */
|
|
27
|
+
color?: MantineColor;
|
|
28
|
+
/** Key of `theme.radius` or any valid CSS value to set `border-radius`@default `theme.defaultRadius` */
|
|
29
|
+
radius?: MantineRadius;
|
|
30
|
+
/** Determines whether tabs should have inverted styles @default `false` */
|
|
31
|
+
inverted?: boolean;
|
|
32
|
+
/** If set to `false`, `Tabs.Panel` content will be unmounted when the associated tab is not active @default `true` */
|
|
33
|
+
keepMounted?: boolean;
|
|
34
|
+
/** If set, adjusts text color based on background color for `pills` variant */
|
|
35
|
+
autoContrast?: boolean;
|
|
36
|
+
/** Determines the variant of the tabs */
|
|
37
|
+
variant?: TabsVariant;
|
|
38
|
+
}
|
|
39
|
+
declare const Tabs: import("svelte").Component<TabsProps, {}, "value">;
|
|
40
|
+
type Tabs = ReturnType<typeof Tabs>;
|
|
41
|
+
export default Tabs;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MaybeGetter } from '
|
|
1
|
+
import type { MaybeGetter } from '../../../svelte-utils/extract.js';
|
|
2
2
|
import type { TooltipProps } from './Tooltip.svelte';
|
|
3
3
|
export declare class CreateTooltip {
|
|
4
4
|
position: MaybeGetter<TooltipProps['position']>;
|