milk-lib 0.0.7 → 0.0.9
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/components/Button/Button.svelte +3 -1
- package/dist/components/Button/Button.types.d.ts +1 -0
- package/dist/components/ButtonMilk/ButtonMilk.scss +84 -0
- package/dist/components/ButtonMilk/ButtonMilk.svelte +45 -0
- package/dist/components/ButtonMilk/ButtonMilk.svelte.d.ts +7 -0
- package/dist/components/ButtonMilk/ButtonMilk.types.d.ts +7 -0
- package/dist/components/ButtonMilk/ButtonMilk.types.js +1 -0
- package/dist/components/ButtonMilk/index.d.ts +2 -0
- package/dist/components/ButtonMilk/index.js +2 -0
- package/dist/components/ThemeProvider/ThemeDefault.js +1 -0
- package/dist/components/ThemeProvider/ThemeProvider.types.d.ts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/package.json +1 -1
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
children,
|
|
20
20
|
style,
|
|
21
21
|
iconButton,
|
|
22
|
+
dataVariant,
|
|
22
23
|
...rest
|
|
23
24
|
}: IButtonProps = $props();
|
|
24
25
|
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
class={`Button ${iconButton ? 'Button-icon' : ''} ${classNames ? classNames : ''}`}
|
|
34
35
|
class:block={block}
|
|
35
36
|
class:loading={loading}
|
|
37
|
+
{...(dataVariant ? { 'data-variant': dataVariant } : {})}
|
|
36
38
|
>
|
|
37
39
|
{@render children?.()}
|
|
38
40
|
<span class="loader">
|
|
@@ -67,7 +69,7 @@
|
|
|
67
69
|
--inner-gap: 4px;
|
|
68
70
|
--border-width: 1px;
|
|
69
71
|
--border-color: transparent;
|
|
70
|
-
--hover-border-color: var(--
|
|
72
|
+
--hover-border-color: var(--border-color);
|
|
71
73
|
--active-border-color: var(--border-color);
|
|
72
74
|
--disabled-border-color: var(--border-color);
|
|
73
75
|
--focus-color: var(--background-color);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
.Button.Button-base-emphasis[data-variant="milk"] {
|
|
2
|
+
--background-color: var(--bg-base-emp-100);
|
|
3
|
+
--hover-background: var(--bg-base-emp-200);
|
|
4
|
+
--active-background: var(--bg-base-emp-300);
|
|
5
|
+
--color: white
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.Button.Button-base-outlined[data-variant="milk"] {
|
|
9
|
+
--background-color: transparent;
|
|
10
|
+
--hover-background: var(--bg-base-200);
|
|
11
|
+
--active-background: var(--bg-base-300);
|
|
12
|
+
--color: var(--text-base-main);
|
|
13
|
+
--border-color: var(--line-control-100);
|
|
14
|
+
--focus-color: var(--line-base-emp);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.Button.Button-base-contained[data-variant="milk"] {
|
|
18
|
+
--background-color: var(--bg-base-100);
|
|
19
|
+
--hover-background: var(--bg-base-200);
|
|
20
|
+
--active-background: var(--bg-base-300);
|
|
21
|
+
--color: var(--text-base-main);
|
|
22
|
+
--focus-color: var(--line-base-emp);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.Button.Button-primary-contained[data-variant="milk"] {
|
|
26
|
+
--background-color: var(--bg-primary-100);
|
|
27
|
+
--hover-background: var(--bg-primary-200);
|
|
28
|
+
--active-background: var(--bg-primary-300);
|
|
29
|
+
--color: var(--text-base-main);
|
|
30
|
+
--focus-color: var(--line-primary-emp);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.Button.Button-primary-outlined[data-variant="milk"] {
|
|
34
|
+
--background-color: transparent;
|
|
35
|
+
--hover-background: var(--bg-primary-100);
|
|
36
|
+
--active-background: var(--bg-primary-200);
|
|
37
|
+
--color: var(--text-base-main);
|
|
38
|
+
--border-color: var(--line-primary);
|
|
39
|
+
--focus-color: var(--line-primary-emp);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.Button.Button-primary-emphasis[data-variant="milk"] {
|
|
43
|
+
--background-color: var(--bg-primary-emp-100);
|
|
44
|
+
--hover-background: var(--bg-primary-emp-200);
|
|
45
|
+
--active-background: var(--bg-primary-emp-300);
|
|
46
|
+
--color: var(--text-base-main);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.Button.Button-lg[data-variant="milk"] {
|
|
50
|
+
--padding-y: 7px;
|
|
51
|
+
--padding-x: 20px;
|
|
52
|
+
--font-size: 16px;
|
|
53
|
+
--line-height: 24px;
|
|
54
|
+
--border-radius: 8px;
|
|
55
|
+
--inner-gap: 6px;
|
|
56
|
+
&.Button-icon {
|
|
57
|
+
--padding-y: 11px;
|
|
58
|
+
--padding-x: 11px;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
.Button.Button-md[data-variant="milk"] {
|
|
62
|
+
--padding-y: 5px;
|
|
63
|
+
--padding-x: 16px;
|
|
64
|
+
--font-size: 14px;
|
|
65
|
+
--line-height: 20px;
|
|
66
|
+
--border-radius: 8px;
|
|
67
|
+
--inner-gap: 5px;
|
|
68
|
+
&.Button-icon {
|
|
69
|
+
--padding-y: 8px;
|
|
70
|
+
--padding-x: 8px;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
.Button.Button-sm[data-variant="milk"] {
|
|
74
|
+
--padding-y: 5px;
|
|
75
|
+
--padding-x: 10px;
|
|
76
|
+
--font-size: 12px;
|
|
77
|
+
--line-height: 14px;
|
|
78
|
+
--border-radius: 6px;
|
|
79
|
+
--inner-gap: 3px;
|
|
80
|
+
&.Button-icon {
|
|
81
|
+
--padding-y: 6px;
|
|
82
|
+
--padding-x: 6px;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Button, type ButtonInstance } from '../..';
|
|
3
|
+
import type { IButtonMilkProps } from './ButtonMilk.types';
|
|
4
|
+
import "./ButtonMilk.scss";
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
size = 'sm',
|
|
8
|
+
variant = 'primary-emphasis',
|
|
9
|
+
children,
|
|
10
|
+
...rest
|
|
11
|
+
}: IButtonMilkProps = $props();
|
|
12
|
+
|
|
13
|
+
// Прокидываем фокус примитива
|
|
14
|
+
let buttonRef: ButtonInstance;
|
|
15
|
+
export const focus = () => buttonRef.focus();
|
|
16
|
+
|
|
17
|
+
let sizeClassName =
|
|
18
|
+
size === "sm" ? "Button-sm"
|
|
19
|
+
: size === "md" ? "Button-md"
|
|
20
|
+
: size === "lg" ? "Button-lg"
|
|
21
|
+
: "";
|
|
22
|
+
|
|
23
|
+
let variantClassname =
|
|
24
|
+
variant === "primary-emphasis" ? "Button-primary-emphasis"
|
|
25
|
+
: variant === "primary-outlined" ? "Button-primary-outlined"
|
|
26
|
+
: variant === "primary-contained" ? "Button-primary-contained"
|
|
27
|
+
: variant === "base-contained" ? "Button-base-contained"
|
|
28
|
+
: variant === "base-outlined" ? "Button-base-outlined"
|
|
29
|
+
: variant === "base-emphasis" ? "Button-base-emphasis" : ""
|
|
30
|
+
|
|
31
|
+
let classNames = `${sizeClassName} ${variantClassname}`;
|
|
32
|
+
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<Button
|
|
36
|
+
bind:this={buttonRef}
|
|
37
|
+
dataVariant="milk"
|
|
38
|
+
{classNames}
|
|
39
|
+
|
|
40
|
+
{...rest}
|
|
41
|
+
>
|
|
42
|
+
{@render children?.()}
|
|
43
|
+
</Button>
|
|
44
|
+
|
|
45
|
+
<style></style>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IButtonMilkProps } from './ButtonMilk.types';
|
|
2
|
+
import "./ButtonMilk.scss";
|
|
3
|
+
declare const ButtonMilk: import("svelte").Component<IButtonMilkProps, {
|
|
4
|
+
focus: () => void;
|
|
5
|
+
}, "">;
|
|
6
|
+
type ButtonMilk = ReturnType<typeof ButtonMilk>;
|
|
7
|
+
export default ButtonMilk;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IButtonProps } from '../Button/Button.types';
|
|
2
|
+
export type ButtonMilkSizes = 'sm' | 'md' | 'lg';
|
|
3
|
+
export type ButtonMilkVariants = 'primary-emphasis' | 'primary-outlined' | 'primary-contained' | 'base-contained' | 'base-outlined' | 'base-emphasis';
|
|
4
|
+
export interface IButtonMilkProps extends IButtonProps {
|
|
5
|
+
size?: ButtonMilkSizes;
|
|
6
|
+
variant?: ButtonMilkVariants;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/components/index.js
CHANGED