reburn-ui 0.2.1 → 0.3.1
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/MantineProvider/color-functions/get-contrast-color.svelte.js +1 -1
- package/dist/core/MantineProvider/color-functions/index.d.ts +1 -1
- package/dist/core/MantineProvider/color-functions/index.js +1 -1
- package/dist/core/MantineProvider/color-functions/parse-theme-color.svelte.js +1 -1
- package/dist/core/MantineProvider/theme.svelte.js +1 -1
- package/dist/core/MantineProvider/theme.types.d.ts +5 -6
- package/dist/core/charts/ChartRoot/ChartContext.svelte.d.ts +64 -0
- package/dist/core/charts/ChartRoot/ChartContext.svelte.js +56 -0
- package/dist/core/charts/ChartRoot/ChartRoot.svelte +238 -0
- package/dist/core/charts/ChartRoot/ChartRoot.svelte.d.ts +87 -0
- package/dist/core/charts/ChartRoot/ChartXGrid.svelte +32 -0
- package/dist/core/charts/ChartRoot/ChartXGrid.svelte.d.ts +18 -0
- package/dist/core/charts/ChartRoot/ChartXLabels.svelte +26 -0
- package/dist/core/charts/ChartRoot/ChartXLabels.svelte.d.ts +18 -0
- package/dist/core/charts/ChartRoot/ChartYGrid.svelte +32 -0
- package/dist/core/charts/ChartRoot/ChartYGrid.svelte.d.ts +18 -0
- package/dist/core/charts/ChartRoot/ChartYLabels.svelte +31 -0
- package/dist/core/charts/ChartRoot/ChartYLabels.svelte.d.ts +18 -0
- package/dist/core/charts/ChartRoot/tickLabels.d.ts +8 -0
- package/dist/core/charts/ChartRoot/tickLabels.js +21 -0
- package/dist/core/charts/ChartTooltip/ChartTooltip.svelte +260 -0
- package/dist/core/charts/ChartTooltip/ChartTooltip.svelte.d.ts +34 -0
- package/dist/core/charts/ChartTooltip/ChartTooltipData.svelte +47 -0
- package/dist/core/charts/ChartTooltip/ChartTooltipData.svelte.d.ts +29 -0
- package/dist/core/charts/ChartTooltip/utils/findClosestElement.d.ts +2 -0
- package/dist/core/charts/ChartTooltip/utils/findClosestElement.js +21 -0
- package/dist/core/charts/ChartTooltip/utils/getTooltipPosition.d.ts +9 -0
- package/dist/core/charts/ChartTooltip/utils/getTooltipPosition.js +6 -0
- package/dist/core/charts/CompositeChart/CompositeChart.svelte +82 -0
- package/dist/core/charts/CompositeChart/CompositeChart.svelte.d.ts +60 -0
- package/dist/core/charts/LineChart/LineChart.svelte +30 -321
- package/dist/core/charts/LineChart/LineChart.svelte.d.ts +16 -64
- package/dist/core/charts/LineChart/LineChartInner.svelte +66 -0
- package/dist/core/charts/LineChart/LineChartInner.svelte.d.ts +34 -0
- package/dist/core/charts/ScatterChart/ScatterChart.svelte +33 -0
- package/dist/core/charts/ScatterChart/ScatterChart.svelte.d.ts +39 -0
- package/dist/core/charts/ScatterChart/ScatterChartInner.svelte +67 -0
- package/dist/core/charts/ScatterChart/ScatterChartInner.svelte.d.ts +32 -0
- package/dist/core/charts/d3/array/tick.d.ts +1 -0
- package/dist/core/charts/d3/array/tick.js +66 -0
- package/dist/core/charts/d3/scale/scaleLinear.d.ts +4 -0
- package/dist/core/charts/d3/scale/scaleLinear.js +14 -0
- package/dist/core/charts/d3/shape/curve/curveLinear.d.ts +2 -0
- package/dist/core/charts/d3/shape/curve/curveLinear.js +16 -0
- package/dist/core/charts/d3/shape/line.d.ts +7 -0
- package/dist/core/charts/d3/shape/line.js +6 -0
- package/dist/core/charts/d3/shape/toFixed.d.ts +1 -0
- package/dist/core/charts/d3/shape/toFixed.js +7 -0
- package/dist/core/charts/d3/shape/withPath.d.ts +1 -0
- package/dist/core/charts/d3/shape/withPath.js +18 -0
- package/dist/core/charts/index.d.ts +5 -0
- package/dist/core/charts/index.js +5 -0
- package/dist/core/charts/types.d.ts +10 -0
- package/dist/core/charts/utils/minMaxObject.d.ts +6 -0
- package/dist/core/charts/utils/minMaxObject.js +26 -0
- package/dist/core/components/Badge/Badge.svelte +1 -1
- package/dist/core/components/Burger/Burger.svelte +1 -1
- package/dist/core/components/Checkbox/Checkbox.svelte +1 -1
- package/dist/core/components/Checkbox/CheckboxCard/CheckboxCard.svelte +8 -6
- package/dist/core/components/Checkbox/CheckboxIndicator.svelte +4 -1
- package/dist/core/components/ColorPicker/ColorSlider.svelte +10 -14
- package/dist/core/components/ColorPicker/Saturation.svelte +8 -4
- package/dist/core/components/ColorPicker/converters/index.d.ts +2 -2
- package/dist/core/components/ColorPicker/converters/index.js +2 -2
- package/dist/core/components/Combobox/ComboboxChevron.svelte +4 -3
- package/dist/core/components/Combobox/ComboboxDropdown.svelte +0 -3
- package/dist/core/components/Dropzone/Dropzone.svelte +396 -0
- package/dist/core/components/Dropzone/Dropzone.svelte.d.ts +104 -0
- package/dist/core/components/Dropzone/DropzoneContext.svelte.js +3 -0
- package/dist/core/components/Dropzone/index.d.ts +3 -0
- package/dist/core/components/Dropzone/index.js +2 -0
- package/dist/core/components/Dropzone/mime-types.d.ts +30 -0
- package/dist/core/components/Dropzone/mime-types.js +41 -0
- package/dist/core/components/Dropzone/utils/acceptPropAsAccaptAttr.d.ts +5 -0
- package/dist/core/components/Dropzone/utils/acceptPropAsAccaptAttr.js +21 -0
- package/dist/core/components/Dropzone/utils/fromEvent.d.ts +6 -0
- package/dist/core/components/Dropzone/utils/fromEvent.js +45 -0
- package/dist/core/components/Dropzone/utils/getAllFilesAccepted.d.ts +35 -0
- package/dist/core/components/Dropzone/utils/getAllFilesAccepted.js +69 -0
- package/dist/core/components/Dropzone/utils/isEvtWithFiles.d.ts +1 -0
- package/dist/core/components/Dropzone/utils/isEvtWithFiles.js +8 -0
- package/dist/core/components/Dropzone/utils/isExt.d.ts +4 -0
- package/dist/core/components/Dropzone/utils/isExt.js +6 -0
- package/dist/core/components/Dropzone/utils/isMIMEType.d.ts +6 -0
- package/dist/core/components/Dropzone/utils/isMIMEType.js +8 -0
- package/dist/core/components/Dropzone/utils/isPropagationStopped.d.ts +1 -0
- package/dist/core/components/Dropzone/utils/isPropagationStopped.js +12 -0
- package/dist/core/components/Fieldset/Fieldset.svelte +76 -0
- package/dist/core/components/Fieldset/Fieldset.svelte.d.ts +15 -0
- package/dist/core/components/Floating/CreateFloating.svelte.js +0 -5
- package/dist/core/components/Group/Group.svelte +4 -9
- package/dist/core/components/Input/Input.svelte.d.ts +2 -2
- package/dist/core/components/InputBase/InputBase.svelte.d.ts +2 -2
- package/dist/core/components/Loader/Loader.svelte +1 -1
- package/dist/core/components/LoadingOverlay/LoadingOverlay.svelte +72 -0
- package/dist/core/components/LoadingOverlay/LoadingOverlay.svelte.d.ts +19 -0
- package/dist/core/components/Modal/ModalContent.svelte +4 -2
- package/dist/core/components/NavLink/NavLink.svelte +4 -3
- package/dist/core/components/Notification/Notification.svelte +5 -4
- package/dist/core/components/Pill/Pill.svelte +172 -0
- package/dist/core/components/Pill/Pill.svelte.d.ts +23 -0
- package/dist/core/components/Pill/PillGroup.svelte +47 -0
- package/dist/core/components/Pill/PillGroup.svelte.d.ts +13 -0
- package/dist/core/components/Pill/PillGroupContext.svelte.d.ts +15 -0
- package/dist/core/components/Pill/PillGroupContext.svelte.js +13 -0
- package/dist/core/components/Pill/index.d.ts +8 -0
- package/dist/core/components/Pill/index.js +5 -0
- package/dist/core/components/Progress/ProgressSection.svelte +3 -1
- package/dist/core/components/SegmentedControl/SegmentedControl.svelte +18 -7
- package/dist/core/components/Select/Select.svelte.d.ts +1 -1
- package/dist/core/components/Slider/SliderRoot.svelte +5 -1
- package/dist/core/components/Slider/Thumb.svelte +5 -1
- package/dist/core/components/Slider/Track.svelte +16 -6
- package/dist/core/components/Switch/Switch.svelte +1 -1
- package/dist/core/components/Table/Table.svelte +10 -12
- package/dist/core/components/Table/Table.svelte.d.ts +4 -1
- package/dist/core/components/Table/TableContext.svelte.d.ts +2 -0
- package/dist/core/components/Table/TableContext.svelte.js +1 -0
- package/dist/core/components/Table/TableTh.svelte +10 -1
- package/dist/core/components/Table/getTableDataAttr.d.ts +1 -0
- package/dist/core/components/Table/getTableDataAttr.js +3 -0
- package/dist/core/components/index.d.ts +4 -0
- package/dist/core/components/index.js +4 -0
- package/dist/core/hooks/use-id.d.ts +1 -0
- package/dist/core/hooks/use-id.js +4 -0
- package/dist/core/utils/get-default-z-index.d.ts +1 -1
- package/package.json +11 -9
- package/dist/core/charts/LineChart/LineChart.types.js +0 -1
- package/dist/core/charts/LineChart/types.d.ts +0 -68
- /package/dist/core/MantineProvider/color-functions/{get-primary-shade.d.ts → get-primary-shade.svelte.d.ts} +0 -0
- /package/dist/core/MantineProvider/color-functions/{get-primary-shade.js → get-primary-shade.svelte.js} +0 -0
- /package/dist/core/charts/{LineChart/types.js → types.js} +0 -0
- /package/dist/core/{charts/LineChart/LineChart.types.d.ts → components/Dropzone/DropzoneContext.svelte.d.ts} +0 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { DivElement } from '../../element-types.js';
|
|
3
|
+
import type { MantineRadius, MantineSize } from '../../MantineProvider/theme.types.js';
|
|
4
|
+
import { getRadius, getSize } from '../../utils/get-size.js';
|
|
5
|
+
import type { CloseButtonProps } from '../CloseButton/CloseButton.svelte';
|
|
6
|
+
import { CloseButton } from '../index.js';
|
|
7
|
+
import { getPillGroupContext } from './PillGroupContext.svelte.js';
|
|
8
|
+
|
|
9
|
+
export type PillVariant = 'default' | 'contrast';
|
|
10
|
+
|
|
11
|
+
export interface PillProps extends DivElement {
|
|
12
|
+
/** Controls pill `font-size` and `padding`, `'sm'` by default */
|
|
13
|
+
size?: MantineSize;
|
|
14
|
+
|
|
15
|
+
/** Determines whether the remove button should be displayed, `false` by default */
|
|
16
|
+
withRemoveButton?: boolean;
|
|
17
|
+
|
|
18
|
+
/** Called when the remove button is clicked */
|
|
19
|
+
onremove?: () => void;
|
|
20
|
+
|
|
21
|
+
/** Props passed down to the remove button */
|
|
22
|
+
removeButtonProps?: CloseButtonProps;
|
|
23
|
+
|
|
24
|
+
/** Key of `theme.radius` or any valid CSS value to set border-radius. Numbers are converted to rem. `'xl'` by default. */
|
|
25
|
+
radius?: MantineRadius;
|
|
26
|
+
|
|
27
|
+
/** If pill is disabled it has higher contrast to be visible on the disabled input background and the remove button is hidden */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
|
|
30
|
+
/** Variant of the pill */
|
|
31
|
+
variant?: PillVariant;
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<script lang="ts">
|
|
36
|
+
let { children, size, withRemoveButton, onremove, removeButtonProps, radius, disabled, variant = 'default', ...props }: PillProps = $props();
|
|
37
|
+
|
|
38
|
+
const ctx = getPillGroupContext();
|
|
39
|
+
|
|
40
|
+
const _size = $derived(size || ctx.size || undefined);
|
|
41
|
+
// TODO:
|
|
42
|
+
// const _variant = $derived(pillsInputCtx)
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<div
|
|
46
|
+
{...props}
|
|
47
|
+
class={['root', `root-${variant}`, props.class]}
|
|
48
|
+
data-with-remove={withRemoveButton && !disabled}
|
|
49
|
+
data-disabled={disabled}
|
|
50
|
+
data-size={_size}
|
|
51
|
+
style:--pill-fz={getSize(_size, 'pill-fs')}
|
|
52
|
+
style:--pill-height={getSize(_size, 'pill-height')}
|
|
53
|
+
style:--pill-radius={radius ? getRadius(radius) : undefined}
|
|
54
|
+
>
|
|
55
|
+
<span class="label">{@render children?.()}</span>
|
|
56
|
+
|
|
57
|
+
{#if withRemoveButton}
|
|
58
|
+
<CloseButton
|
|
59
|
+
class="remove"
|
|
60
|
+
variant="transparent"
|
|
61
|
+
{radius}
|
|
62
|
+
tabindex={-1}
|
|
63
|
+
aria-hidden
|
|
64
|
+
{...removeButtonProps}
|
|
65
|
+
onmousedown={(event) => {
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
event.stopPropagation();
|
|
68
|
+
removeButtonProps?.onmousedown?.(event);
|
|
69
|
+
}}
|
|
70
|
+
onclick={(event) => {
|
|
71
|
+
event.stopPropagation();
|
|
72
|
+
onremove?.();
|
|
73
|
+
removeButtonProps?.onclick?.(event);
|
|
74
|
+
}}
|
|
75
|
+
/>{/if}
|
|
76
|
+
</div>
|
|
77
|
+
|
|
78
|
+
<style>.root {
|
|
79
|
+
--pill-fz-xs: calc(0.625rem * var(--mantine-scale));
|
|
80
|
+
--pill-fz-sm: calc(0.75rem * var(--mantine-scale));
|
|
81
|
+
--pill-fz-md: calc(0.875rem * var(--mantine-scale));
|
|
82
|
+
--pill-fz-lg: calc(1rem * var(--mantine-scale));
|
|
83
|
+
--pill-fz-xl: calc(1.125rem * var(--mantine-scale));
|
|
84
|
+
--pill-height-xs: calc(1.125rem * var(--mantine-scale));
|
|
85
|
+
--pill-height-sm: calc(1.375rem * var(--mantine-scale));
|
|
86
|
+
--pill-height-md: calc(1.5625rem * var(--mantine-scale));
|
|
87
|
+
--pill-height-lg: calc(1.75rem * var(--mantine-scale));
|
|
88
|
+
--pill-height-xl: calc(2rem * var(--mantine-scale));
|
|
89
|
+
--pill-fz: var(--pill-fz-sm);
|
|
90
|
+
--pill-height: var(--pill-height-sm);
|
|
91
|
+
font-size: var(--pill-fz);
|
|
92
|
+
flex: 0;
|
|
93
|
+
height: var(--pill-height);
|
|
94
|
+
padding-inline: 0.8em;
|
|
95
|
+
display: inline-flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
border-radius: var(--pill-radius, 1000rem);
|
|
98
|
+
line-height: 1;
|
|
99
|
+
white-space: nowrap;
|
|
100
|
+
user-select: none;
|
|
101
|
+
-webkit-user-select: none;
|
|
102
|
+
max-width: 100%;
|
|
103
|
+
}
|
|
104
|
+
:global(:where([data-mantine-color-scheme="dark"])) .root {
|
|
105
|
+
background-color: var(--mantine-color-dark-7);
|
|
106
|
+
color: var(--mantine-color-dark-0);
|
|
107
|
+
}
|
|
108
|
+
:global(:where([data-mantine-color-scheme="light"])) .root {
|
|
109
|
+
color: var(--mantine-color-black);
|
|
110
|
+
}
|
|
111
|
+
.root:where([data-with-remove]:not(:has(button:disabled))) {
|
|
112
|
+
padding-inline-end: 0;
|
|
113
|
+
}
|
|
114
|
+
.root:where([data-disabled], :has(button:disabled)) {
|
|
115
|
+
cursor: not-allowed;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:global(:where([data-mantine-color-scheme="light"])) .root--default {
|
|
119
|
+
background-color: var(--mantine-color-gray-1);
|
|
120
|
+
}
|
|
121
|
+
:global(:where([data-mantine-color-scheme="light"])) .root--default:where([data-disabled], :has(button:disabled)) {
|
|
122
|
+
background-color: var(--mantine-color-disabled);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
:global(:where([data-mantine-color-scheme="light"])) .root--contrast {
|
|
126
|
+
background-color: var(--mantine-color-white);
|
|
127
|
+
}
|
|
128
|
+
:global(:where([data-mantine-color-scheme="light"])) .root--contrast:where([data-disabled], :has(button:disabled)) {
|
|
129
|
+
background-color: var(--mantine-color-disabled);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.label {
|
|
133
|
+
cursor: inherit;
|
|
134
|
+
overflow: hidden;
|
|
135
|
+
height: 100%;
|
|
136
|
+
line-height: var(--pill-height);
|
|
137
|
+
text-overflow: ellipsis;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
* :global(.remove) {
|
|
141
|
+
color: inherit;
|
|
142
|
+
font-size: inherit;
|
|
143
|
+
height: 100%;
|
|
144
|
+
min-height: unset;
|
|
145
|
+
min-width: 2em;
|
|
146
|
+
width: unset;
|
|
147
|
+
border-radius: 0;
|
|
148
|
+
padding-inline-start: 0.1em;
|
|
149
|
+
padding-inline-end: 0.3em;
|
|
150
|
+
flex: 0;
|
|
151
|
+
border-end-end-radius: var(--pill-radius, 50%);
|
|
152
|
+
border-start-end-radius: var(--pill-radius, 50%);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
* :global(.remove > svg) {
|
|
156
|
+
pointer-events: none;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
* :global(.root[data-disabled] .remove),
|
|
160
|
+
* :global(.remove:disabled) {
|
|
161
|
+
display: none;
|
|
162
|
+
background-color: transparent;
|
|
163
|
+
width: 0.8em;
|
|
164
|
+
min-width: 0.8em;
|
|
165
|
+
padding: 0;
|
|
166
|
+
cursor: not-allowed;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
* :global(.root[data-disabled] .remove > svg),
|
|
170
|
+
* :global(.remove:disabled > svg) {
|
|
171
|
+
display: none;
|
|
172
|
+
}</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DivElement } from '../../element-types.js';
|
|
2
|
+
import type { MantineRadius, MantineSize } from '../../MantineProvider/theme.types.js';
|
|
3
|
+
import type { CloseButtonProps } from '../CloseButton/CloseButton.svelte';
|
|
4
|
+
export type PillVariant = 'default' | 'contrast';
|
|
5
|
+
export interface PillProps extends DivElement {
|
|
6
|
+
/** Controls pill `font-size` and `padding`, `'sm'` by default */
|
|
7
|
+
size?: MantineSize;
|
|
8
|
+
/** Determines whether the remove button should be displayed, `false` by default */
|
|
9
|
+
withRemoveButton?: boolean;
|
|
10
|
+
/** Called when the remove button is clicked */
|
|
11
|
+
onremove?: () => void;
|
|
12
|
+
/** Props passed down to the remove button */
|
|
13
|
+
removeButtonProps?: CloseButtonProps;
|
|
14
|
+
/** Key of `theme.radius` or any valid CSS value to set border-radius. Numbers are converted to rem. `'xl'` by default. */
|
|
15
|
+
radius?: MantineRadius;
|
|
16
|
+
/** If pill is disabled it has higher contrast to be visible on the disabled input background and the remove button is hidden */
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
/** Variant of the pill */
|
|
19
|
+
variant?: PillVariant;
|
|
20
|
+
}
|
|
21
|
+
declare const Pill: import("svelte").Component<PillProps, {}, "">;
|
|
22
|
+
type Pill = ReturnType<typeof Pill>;
|
|
23
|
+
export default Pill;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import type { DivElement } from '../../element-types.js';
|
|
3
|
+
import type { MantineSize } from '../../MantineProvider/theme.types.js';
|
|
4
|
+
|
|
5
|
+
export interface PillGroupProps extends DivElement {
|
|
6
|
+
/** Controls spacing between pills, by default controlled by `size` */
|
|
7
|
+
gap?: MantineSize | (string & {}) | number;
|
|
8
|
+
|
|
9
|
+
/** Controls size of the child `Pill` components and gap between them, `'sm'` by default */
|
|
10
|
+
size?: MantineSize | (string & {});
|
|
11
|
+
|
|
12
|
+
/** Determines whether child `Pill` components should be disabled */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<script lang="ts">
|
|
18
|
+
import { getSize } from '../../utils/get-size.js';
|
|
19
|
+
import { setContext } from 'svelte';
|
|
20
|
+
import { PILL_GROUP_CONTEXT_KEY, PillGroupContext } from './PillGroupContext.svelte.js';
|
|
21
|
+
|
|
22
|
+
let { children, gap, size = 'sm', disabled = false, ...props }: PillGroupProps = $props();
|
|
23
|
+
|
|
24
|
+
const context = new PillGroupContext({
|
|
25
|
+
size: () => size,
|
|
26
|
+
disabled: () => disabled,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
setContext(PILL_GROUP_CONTEXT_KEY, context);
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<div {...props} class={['group', props.class]} style:--pg-gap={gap ? getSize(gap) : getSize(size, 'pg-gap')}>
|
|
33
|
+
{@render children?.()}
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<style>.group {
|
|
37
|
+
--pg-gap-xs: calc(0.375rem * var(--mantine-scale));
|
|
38
|
+
--pg-gap-sm: calc(0.5rem * var(--mantine-scale));
|
|
39
|
+
--pg-gap-md: calc(0.625rem * var(--mantine-scale));
|
|
40
|
+
--pg-gap-lg: calc(0.75rem * var(--mantine-scale));
|
|
41
|
+
--pg-gap-xl: calc(0.75rem * var(--mantine-scale));
|
|
42
|
+
--pg-gap: var(--pg-gap-sm);
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: var(--pg-gap);
|
|
46
|
+
flex-wrap: wrap;
|
|
47
|
+
}</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DivElement } from '../../element-types.js';
|
|
2
|
+
import type { MantineSize } from '../../MantineProvider/theme.types.js';
|
|
3
|
+
export interface PillGroupProps extends DivElement {
|
|
4
|
+
/** Controls spacing between pills, by default controlled by `size` */
|
|
5
|
+
gap?: MantineSize | (string & {}) | number;
|
|
6
|
+
/** Controls size of the child `Pill` components and gap between them, `'sm'` by default */
|
|
7
|
+
size?: MantineSize | (string & {});
|
|
8
|
+
/** Determines whether child `Pill` components should be disabled */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const PillGroup: import("svelte").Component<PillGroupProps, {}, "">;
|
|
12
|
+
type PillGroup = ReturnType<typeof PillGroup>;
|
|
13
|
+
export default PillGroup;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MaybeGetter } from '../../context/extract.js';
|
|
2
|
+
import type { PillGroupProps } from './PillGroup.svelte';
|
|
3
|
+
interface PillGroupContextProps {
|
|
4
|
+
size: MaybeGetter<PillGroupProps['size']>;
|
|
5
|
+
disabled: MaybeGetter<PillGroupProps['disabled']>;
|
|
6
|
+
}
|
|
7
|
+
export declare class PillGroupContext {
|
|
8
|
+
#private;
|
|
9
|
+
size: MaybeGetter<(string & {}) | import("../..").MantineSize | undefined>;
|
|
10
|
+
disabled: MaybeGetter<boolean | undefined>;
|
|
11
|
+
constructor(props: PillGroupContextProps);
|
|
12
|
+
}
|
|
13
|
+
export declare const PILL_GROUP_CONTEXT_KEY: unique symbol;
|
|
14
|
+
export declare function getPillGroupContext(): PillGroupContext;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { getContext } from 'svelte';
|
|
2
|
+
export class PillGroupContext {
|
|
3
|
+
#props;
|
|
4
|
+
size = $derived(this.#props.size);
|
|
5
|
+
disabled = $derived(this.#props.disabled);
|
|
6
|
+
constructor(props) {
|
|
7
|
+
this.#props = props;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export const PILL_GROUP_CONTEXT_KEY = Symbol();
|
|
11
|
+
export function getPillGroupContext() {
|
|
12
|
+
return getContext(PILL_GROUP_CONTEXT_KEY) || {};
|
|
13
|
+
}
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
<script lang="ts">
|
|
24
|
-
import { getAutoContrastValue
|
|
24
|
+
import { getAutoContrastValue } from '../../MantineProvider/color-functions/get-auto-contrast-value.svelte.js';
|
|
25
|
+
import { getContrastColor } from '../../MantineProvider/color-functions/get-contrast-color.svelte.js';
|
|
26
|
+
import { getThemeColor } from '../../MantineProvider/color-functions/get-theme-color.js';
|
|
25
27
|
import { getProgressContext } from './ProgressContext.svelte.js';
|
|
26
28
|
|
|
27
29
|
let { value, withAria = true, color, striped, animated, children, ...props }: ProgressSectionProps = $props();
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import type { DivElement } from '../../element-types.js';
|
|
4
4
|
import type { MantineColor, MantineRadius, MantineSize } from '../../MantineProvider/theme.types.js';
|
|
5
|
-
import FloatingIndicator from '../FloatingIndicator/FloatingIndicator.svelte';
|
|
6
5
|
|
|
7
6
|
export interface SegmentedControlItem {
|
|
8
7
|
value: string;
|
|
@@ -62,9 +61,16 @@
|
|
|
62
61
|
</script>
|
|
63
62
|
|
|
64
63
|
<script lang="ts">
|
|
65
|
-
import { getContrastColor
|
|
64
|
+
import { getContrastColor } from '../../MantineProvider/color-functions/get-contrast-color.svelte.js';
|
|
65
|
+
import { getThemeColor } from '../../MantineProvider/color-functions/get-theme-color.js';
|
|
66
|
+
import { theme } from '../../MantineProvider/theme.svelte.js';
|
|
66
67
|
import { getFontSize, getRadius, getSize } from '../../utils/get-size.js';
|
|
67
68
|
import { onMount } from 'svelte';
|
|
69
|
+
import FloatingIndicator from '../FloatingIndicator/FloatingIndicator.svelte';
|
|
70
|
+
|
|
71
|
+
function getDefaultValue(data: SegmentedControlProps['data']) {
|
|
72
|
+
return data.find((item) => typeof item !== 'string' && !item.disabled)?.value ?? (data[0] as any)?.value ?? data[0] ?? null;
|
|
73
|
+
}
|
|
68
74
|
|
|
69
75
|
let {
|
|
70
76
|
data,
|
|
@@ -74,7 +80,7 @@
|
|
|
74
80
|
fullWidth,
|
|
75
81
|
orientation = 'horizontal',
|
|
76
82
|
withItemsBorders = true,
|
|
77
|
-
value = $bindable(
|
|
83
|
+
value = $bindable(getDefaultValue(data)),
|
|
78
84
|
disabled,
|
|
79
85
|
readOnly,
|
|
80
86
|
color,
|
|
@@ -128,7 +134,7 @@
|
|
|
128
134
|
value={item.value}
|
|
129
135
|
disabled={disabled || item.disabled}
|
|
130
136
|
id={`${_id}-${item.value}`}
|
|
131
|
-
data-focus-ring=
|
|
137
|
+
data-focus-ring={theme.focusRing}
|
|
132
138
|
/>
|
|
133
139
|
|
|
134
140
|
<label
|
|
@@ -227,7 +233,7 @@
|
|
|
227
233
|
.label:where([data-read-only]) {
|
|
228
234
|
cursor: default;
|
|
229
235
|
}
|
|
230
|
-
|
|
236
|
+
.label:where([data-disabled]) {
|
|
231
237
|
cursor: not-allowed;
|
|
232
238
|
color: var(--mantine-color-disabled-color);
|
|
233
239
|
}
|
|
@@ -271,13 +277,18 @@ fieldset:disabled .label, .label:where([data-disabled]) {
|
|
|
271
277
|
color: var(--mantine-color-white);
|
|
272
278
|
}
|
|
273
279
|
}
|
|
280
|
+
|
|
281
|
+
:global(fieldset:disabled) .label {
|
|
282
|
+
cursor: not-allowed;
|
|
283
|
+
color: var(--mantine-color-disabled-color);
|
|
284
|
+
}
|
|
274
285
|
@media (hover: hover) {
|
|
275
|
-
fieldset:disabled .label:hover {
|
|
286
|
+
:global(fieldset:disabled) .label:hover {
|
|
276
287
|
color: var(--mantine-color-disabled-color) !important;
|
|
277
288
|
}
|
|
278
289
|
}
|
|
279
290
|
@media (hover: none) {
|
|
280
|
-
fieldset:disabled .label:active {
|
|
291
|
+
:global(fieldset:disabled) .label:active {
|
|
281
292
|
color: var(--mantine-color-disabled-color) !important;
|
|
282
293
|
}
|
|
283
294
|
}
|
|
@@ -44,6 +44,6 @@ export interface SelectProps extends __BaseInputProps, ComboboxLikeProps, Omit<H
|
|
|
44
44
|
chevronColor?: MantineColor;
|
|
45
45
|
ref?: HTMLInputAttributes;
|
|
46
46
|
}
|
|
47
|
-
declare const Select: import("svelte").Component<SelectProps, {}, "
|
|
47
|
+
declare const Select: import("svelte").Component<SelectProps, {}, "value" | "ref" | "searchValue" | "dropdownOpened">;
|
|
48
48
|
type Select = ReturnType<typeof Select>;
|
|
49
49
|
export default Select;
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<script lang="ts">
|
|
19
|
-
import { getThemeColor } from '../../MantineProvider/color-functions/
|
|
19
|
+
import { getThemeColor } from '../../MantineProvider/color-functions/get-theme-color.js';
|
|
20
20
|
import { getRadius, getSize } from '../../utils/get-size.js';
|
|
21
21
|
import { rem } from '../../utils/units-converters/rem.js';
|
|
22
22
|
|
|
@@ -62,4 +62,8 @@
|
|
|
62
62
|
}
|
|
63
63
|
:global([data-mantine-color-scheme="dark"]) .root {
|
|
64
64
|
--slider-track-bg: var(--mantine-color-dark-4);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:global(fieldset:disabled) .root {
|
|
68
|
+
pointer-events: none;
|
|
65
69
|
}</style>
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
left: auto;
|
|
110
110
|
right: calc(var(--slider-thumb-offset) - var(--slider-thumb-size));
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
.thumb:where([data-disabled]) {
|
|
113
113
|
display: none;
|
|
114
114
|
}
|
|
115
115
|
.thumb:where([data-dragging]) {
|
|
@@ -127,6 +127,10 @@ fieldset:disabled .thumb, .thumb:where([data-disabled]) {
|
|
|
127
127
|
background-color: var(--slider-color);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
:global(fieldset:disabled) .thumb {
|
|
131
|
+
display: none;
|
|
132
|
+
}
|
|
133
|
+
|
|
130
134
|
.label {
|
|
131
135
|
position: absolute;
|
|
132
136
|
top: calc(-2.25rem * var(--mantine-scale));
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
marksOffset,
|
|
28
28
|
children,
|
|
29
29
|
disabled,
|
|
30
|
-
inverted,
|
|
30
|
+
inverted = true,
|
|
31
31
|
containerProps,
|
|
32
32
|
marks,
|
|
33
33
|
min,
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
}: TrackProps = $props();
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
|
-
<div {...props} class="track-container" bind:this={ref}>
|
|
42
|
-
<div class="track">
|
|
41
|
+
<div {...props} class="track-container" bind:this={ref} data-disabled={disabled || undefined}>
|
|
42
|
+
<div class="track" data-disabled={disabled || undefined} data-inverted={inverted || undefined}>
|
|
43
43
|
<div
|
|
44
44
|
class="bar"
|
|
45
45
|
style:--slider-bar-width="calc({filled}% + 2 * var(--slider-size))"
|
|
@@ -61,10 +61,20 @@
|
|
|
61
61
|
height: calc(var(--slider-size) * 2);
|
|
62
62
|
cursor: pointer;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
.track-container:where([data-disabled]) {
|
|
65
65
|
cursor: not-allowed;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
:global(fieldset:disabled) .track-container {
|
|
69
|
+
cursor: not-allowed;
|
|
70
|
+
}
|
|
71
|
+
:global(fieldset:disabled) .track:where([data-inverted]) {
|
|
72
|
+
--track-bg: var(--slider-track-disabled-bg);
|
|
73
|
+
}
|
|
74
|
+
:global(fieldset:disabled) .bar:where(:not([data-inverted])) {
|
|
75
|
+
background-color: var(--mantine-color-disabled-color);
|
|
76
|
+
}
|
|
77
|
+
|
|
68
78
|
.track {
|
|
69
79
|
position: relative;
|
|
70
80
|
width: 100%;
|
|
@@ -73,7 +83,7 @@ fieldset:disabled .track-container, .track-container:where([data-disabled]) {
|
|
|
73
83
|
.track:where([data-inverted]:not([data-disabled])) {
|
|
74
84
|
--track-bg: var(--slider-color);
|
|
75
85
|
}
|
|
76
|
-
|
|
86
|
+
.track:where([data-inverted][data-disabled]) {
|
|
77
87
|
--track-bg: var(--slider-track-disabled-bg);
|
|
78
88
|
}
|
|
79
89
|
.track::before {
|
|
@@ -100,6 +110,6 @@ fieldset:disabled .track:where([data-inverted]), .track:where([data-inverted][da
|
|
|
100
110
|
.bar:where([data-inverted]) {
|
|
101
111
|
background-color: var(--slider-track-bg);
|
|
102
112
|
}
|
|
103
|
-
|
|
113
|
+
.bar:where([data-disabled]:not([data-inverted])) {
|
|
104
114
|
background-color: var(--mantine-color-disabled-color);
|
|
105
115
|
}</style>
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
|
|
55
55
|
<script lang="ts">
|
|
56
56
|
import InlineInput from '../InlineInput/InlineInput.svelte';
|
|
57
|
-
import { getThemeColor } from '../../MantineProvider/color-functions/
|
|
57
|
+
import { getThemeColor } from '../../MantineProvider/color-functions/get-theme-color.js';
|
|
58
58
|
import { getRadius, getSize } from '../../utils/get-size.js';
|
|
59
59
|
import { getSwitchGroupContext } from './SwitchGroup/SwitchGroupContext.svelte.js';
|
|
60
60
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { MantineColor, MantineSpacing } from '../../MantineProvider/theme.types.js';
|
|
3
3
|
import type { Properties } from 'csstype';
|
|
4
|
-
import {
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
5
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
6
6
|
|
|
7
|
+
export type TableVariant = 'default' | 'vertical';
|
|
8
|
+
|
|
7
9
|
type TableElement = SvelteHTMLElements['table'];
|
|
8
10
|
|
|
9
11
|
export interface TableData {
|
|
@@ -61,13 +63,16 @@
|
|
|
61
63
|
|
|
62
64
|
/** Determines whether `font-variant-numeric: tabular-nums` style should be set, `false` by default */
|
|
63
65
|
tabularNums?: boolean;
|
|
66
|
+
|
|
67
|
+
/** Determines the variant of the table */
|
|
68
|
+
variant?: TableVariant;
|
|
64
69
|
}
|
|
65
70
|
</script>
|
|
66
71
|
|
|
67
72
|
<script lang="ts">
|
|
68
|
-
import { getThemeColor } from '../../MantineProvider/
|
|
73
|
+
import { getThemeColor } from '../../MantineProvider/color-functions/get-theme-color.js';
|
|
69
74
|
import { getSpacing } from '../../utils/get-size.js';
|
|
70
|
-
import { rem } from '../../utils/
|
|
75
|
+
import { rem } from '../../utils/units-converters/rem.js';
|
|
71
76
|
import { setContext } from 'svelte';
|
|
72
77
|
import { TABLE_CONTEXT_KEY, TableContext } from './TableContext.svelte.js';
|
|
73
78
|
import TableDataRenderer from './TableDataRenderer.svelte';
|
|
@@ -89,6 +94,7 @@
|
|
|
89
94
|
borderColor,
|
|
90
95
|
withColumnBorders,
|
|
91
96
|
data,
|
|
97
|
+
variant = 'default',
|
|
92
98
|
...props
|
|
93
99
|
}: TableProps = $props();
|
|
94
100
|
|
|
@@ -99,6 +105,7 @@
|
|
|
99
105
|
withRowBorders: () => withRowBorders,
|
|
100
106
|
captionSide: () => captionSide,
|
|
101
107
|
stickyHeader: () => stickyHeader,
|
|
108
|
+
variant: () => variant,
|
|
102
109
|
});
|
|
103
110
|
|
|
104
111
|
setContext(TABLE_CONTEXT_KEY, context);
|
|
@@ -148,13 +155,4 @@
|
|
|
148
155
|
}
|
|
149
156
|
.table:where([data-tabular-nums]) {
|
|
150
157
|
font-variant-numeric: tabular-nums;
|
|
151
|
-
}
|
|
152
|
-
.table:where([data-variant=vertical]) :where(.th) {
|
|
153
|
-
font-weight: 500;
|
|
154
|
-
}
|
|
155
|
-
:global(:where([data-mantine-color-scheme="light"])) .table:where([data-variant=vertical]) :where(.th) {
|
|
156
|
-
background-color: var(--mantine-color-gray-0);
|
|
157
|
-
}
|
|
158
|
-
:global(:where([data-mantine-color-scheme="dark"])) .table:where([data-variant=vertical]) :where(.th) {
|
|
159
|
-
background-color: var(--mantine-color-dark-6);
|
|
160
158
|
}</style>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { MantineColor, MantineSpacing } from '../../MantineProvider/theme.types.js';
|
|
2
2
|
import type { Properties } from 'csstype';
|
|
3
|
-
import {
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
4
|
import type { SvelteHTMLElements } from 'svelte/elements';
|
|
5
|
+
export type TableVariant = 'default' | 'vertical';
|
|
5
6
|
type TableElement = SvelteHTMLElements['table'];
|
|
6
7
|
export interface TableData {
|
|
7
8
|
head?: (string | Snippet)[];
|
|
@@ -42,6 +43,8 @@ export interface TableProps extends TableElement {
|
|
|
42
43
|
stickyHeaderOffset?: number | string;
|
|
43
44
|
/** Determines whether `font-variant-numeric: tabular-nums` style should be set, `false` by default */
|
|
44
45
|
tabularNums?: boolean;
|
|
46
|
+
/** Determines the variant of the table */
|
|
47
|
+
variant?: TableVariant;
|
|
45
48
|
}
|
|
46
49
|
declare const Table: import("svelte").Component<TableProps, {}, "">;
|
|
47
50
|
type Table = ReturnType<typeof Table>;
|
|
@@ -7,6 +7,7 @@ interface TableContextProps {
|
|
|
7
7
|
withRowBorders: Getter<TableProps['withRowBorders']>;
|
|
8
8
|
captionSide: Getter<TableProps['captionSide']>;
|
|
9
9
|
stickyHeader: Getter<TableProps['stickyHeader']>;
|
|
10
|
+
variant: Getter<TableProps['variant']>;
|
|
10
11
|
}
|
|
11
12
|
export declare class TableContext {
|
|
12
13
|
#private;
|
|
@@ -16,6 +17,7 @@ export declare class TableContext {
|
|
|
16
17
|
withRowBorders: boolean | undefined;
|
|
17
18
|
captionSide: "bottom" | "top" | undefined;
|
|
18
19
|
stickyHeader: boolean | undefined;
|
|
20
|
+
variant: import("./Table.svelte").TableVariant | undefined;
|
|
19
21
|
constructor(props: TableContextProps);
|
|
20
22
|
}
|
|
21
23
|
export declare const TABLE_CONTEXT_KEY: unique symbol;
|
|
@@ -8,6 +8,7 @@ export class TableContext {
|
|
|
8
8
|
withRowBorders = $derived(extract(this.#props.withRowBorders));
|
|
9
9
|
captionSide = $derived(extract(this.#props.captionSide));
|
|
10
10
|
stickyHeader = $derived(extract(this.#props.stickyHeader));
|
|
11
|
+
variant = $derived(extract(this.#props.variant));
|
|
11
12
|
constructor(props) {
|
|
12
13
|
this.#props = props;
|
|
13
14
|
}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
let { children, ...props }: TableThProps = $props();
|
|
14
14
|
|
|
15
|
-
const data = $derived(getTableDataAttr(getTableContext(), { columnBorder: true, stickyHeader: true }));
|
|
15
|
+
const data = $derived(getTableDataAttr(getTableContext(), { columnBorder: true, stickyHeader: true, variant: true }));
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<th {...props} class={['th', props.class]} {...data}>
|
|
@@ -33,4 +33,13 @@
|
|
|
33
33
|
position: sticky;
|
|
34
34
|
top: var(--table-sticky-header-offset, 0);
|
|
35
35
|
background-color: var(--mantine-color-body);
|
|
36
|
+
}
|
|
37
|
+
.th:where([data-variant=vertical]) {
|
|
38
|
+
font-weight: 500;
|
|
39
|
+
}
|
|
40
|
+
:global(:where([data-mantine-color-scheme="light"])) .th:where([data-variant=vertical]) {
|
|
41
|
+
background-color: var(--mantine-color-gray-0);
|
|
42
|
+
}
|
|
43
|
+
:global(:where([data-mantine-color-scheme="dark"])) .th:where([data-variant=vertical]) {
|
|
44
|
+
background-color: var(--mantine-color-dark-6);
|
|
36
45
|
}</style>
|
|
@@ -6,6 +6,7 @@ interface TableElementOptions {
|
|
|
6
6
|
highlightOnHover?: true;
|
|
7
7
|
captionSide?: true;
|
|
8
8
|
stickyHeader?: true;
|
|
9
|
+
variant?: true;
|
|
9
10
|
}
|
|
10
11
|
export declare function getTableDataAttr(ctx: TableContext, options?: TableElementOptions): Record<string, string | boolean> | undefined;
|
|
11
12
|
export {};
|