@mekari/pixel3-button 0.0.0
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/button.d.mts +81 -0
- package/dist/button.d.ts +81 -0
- package/dist/button.js +153 -0
- package/dist/button.mjs +9 -0
- package/dist/chunk-5JNYXGFY.mjs +44 -0
- package/dist/chunk-P5BDBLJN.mjs +95 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +155 -0
- package/dist/index.mjs +9 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/modules/button.props.d.mts +39 -0
- package/dist/modules/button.props.d.ts +39 -0
- package/dist/modules/button.props.js +65 -0
- package/dist/modules/button.props.mjs +8 -0
- package/dist/modules/button.type.d.mts +4 -0
- package/dist/modules/button.type.d.ts +4 -0
- package/dist/modules/button.type.js +18 -0
- package/dist/modules/button.type.mjs +0 -0
- package/package.json +43 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ButtonSize, ButtonVariant } from './modules/button.type.mjs';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
|
|
4
|
+
declare const MpButton: vue.DefineComponent<{
|
|
5
|
+
as: {
|
|
6
|
+
type: vue.PropType<keyof HTMLElementTagNameMap>;
|
|
7
|
+
default: string;
|
|
8
|
+
};
|
|
9
|
+
size: {
|
|
10
|
+
type: vue.PropType<ButtonSize>;
|
|
11
|
+
default: string;
|
|
12
|
+
};
|
|
13
|
+
variant: {
|
|
14
|
+
type: vue.PropType<ButtonVariant>;
|
|
15
|
+
};
|
|
16
|
+
isDisabled: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
};
|
|
19
|
+
isLoading: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
};
|
|
22
|
+
leftIcon: {
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
};
|
|
25
|
+
rightIcon: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
};
|
|
28
|
+
}, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "click"[], "click", vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
29
|
+
as: {
|
|
30
|
+
type: vue.PropType<keyof HTMLElementTagNameMap>;
|
|
31
|
+
default: string;
|
|
32
|
+
};
|
|
33
|
+
size: {
|
|
34
|
+
type: vue.PropType<ButtonSize>;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
variant: {
|
|
38
|
+
type: vue.PropType<ButtonVariant>;
|
|
39
|
+
};
|
|
40
|
+
isDisabled: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
};
|
|
43
|
+
isLoading: {
|
|
44
|
+
type: BooleanConstructor;
|
|
45
|
+
};
|
|
46
|
+
leftIcon: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
};
|
|
49
|
+
rightIcon: {
|
|
50
|
+
type: StringConstructor;
|
|
51
|
+
};
|
|
52
|
+
}>> & {
|
|
53
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
size: ButtonSize;
|
|
56
|
+
as: keyof HTMLElementTagNameMap;
|
|
57
|
+
isDisabled: boolean;
|
|
58
|
+
isLoading: boolean;
|
|
59
|
+
}, {}>;
|
|
60
|
+
declare const MpButtonGroup: vue.DefineComponent<{
|
|
61
|
+
spacing: {
|
|
62
|
+
type: vue.PropType<string>;
|
|
63
|
+
default: string;
|
|
64
|
+
};
|
|
65
|
+
isSplit: {
|
|
66
|
+
type: BooleanConstructor;
|
|
67
|
+
};
|
|
68
|
+
}, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
69
|
+
spacing: {
|
|
70
|
+
type: vue.PropType<string>;
|
|
71
|
+
default: string;
|
|
72
|
+
};
|
|
73
|
+
isSplit: {
|
|
74
|
+
type: BooleanConstructor;
|
|
75
|
+
};
|
|
76
|
+
}>>, {
|
|
77
|
+
spacing: string;
|
|
78
|
+
isSplit: boolean;
|
|
79
|
+
}, {}>;
|
|
80
|
+
|
|
81
|
+
export { MpButton, MpButtonGroup };
|
package/dist/button.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ButtonSize, ButtonVariant } from './modules/button.type.js';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
|
|
4
|
+
declare const MpButton: vue.DefineComponent<{
|
|
5
|
+
as: {
|
|
6
|
+
type: vue.PropType<keyof HTMLElementTagNameMap>;
|
|
7
|
+
default: string;
|
|
8
|
+
};
|
|
9
|
+
size: {
|
|
10
|
+
type: vue.PropType<ButtonSize>;
|
|
11
|
+
default: string;
|
|
12
|
+
};
|
|
13
|
+
variant: {
|
|
14
|
+
type: vue.PropType<ButtonVariant>;
|
|
15
|
+
};
|
|
16
|
+
isDisabled: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
};
|
|
19
|
+
isLoading: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
};
|
|
22
|
+
leftIcon: {
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
};
|
|
25
|
+
rightIcon: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
};
|
|
28
|
+
}, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, "click"[], "click", vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
29
|
+
as: {
|
|
30
|
+
type: vue.PropType<keyof HTMLElementTagNameMap>;
|
|
31
|
+
default: string;
|
|
32
|
+
};
|
|
33
|
+
size: {
|
|
34
|
+
type: vue.PropType<ButtonSize>;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
variant: {
|
|
38
|
+
type: vue.PropType<ButtonVariant>;
|
|
39
|
+
};
|
|
40
|
+
isDisabled: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
};
|
|
43
|
+
isLoading: {
|
|
44
|
+
type: BooleanConstructor;
|
|
45
|
+
};
|
|
46
|
+
leftIcon: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
};
|
|
49
|
+
rightIcon: {
|
|
50
|
+
type: StringConstructor;
|
|
51
|
+
};
|
|
52
|
+
}>> & {
|
|
53
|
+
onClick?: ((...args: any[]) => any) | undefined;
|
|
54
|
+
}, {
|
|
55
|
+
size: ButtonSize;
|
|
56
|
+
as: keyof HTMLElementTagNameMap;
|
|
57
|
+
isDisabled: boolean;
|
|
58
|
+
isLoading: boolean;
|
|
59
|
+
}, {}>;
|
|
60
|
+
declare const MpButtonGroup: vue.DefineComponent<{
|
|
61
|
+
spacing: {
|
|
62
|
+
type: vue.PropType<string>;
|
|
63
|
+
default: string;
|
|
64
|
+
};
|
|
65
|
+
isSplit: {
|
|
66
|
+
type: BooleanConstructor;
|
|
67
|
+
};
|
|
68
|
+
}, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
|
|
69
|
+
spacing: {
|
|
70
|
+
type: vue.PropType<string>;
|
|
71
|
+
default: string;
|
|
72
|
+
};
|
|
73
|
+
isSplit: {
|
|
74
|
+
type: BooleanConstructor;
|
|
75
|
+
};
|
|
76
|
+
}>>, {
|
|
77
|
+
spacing: string;
|
|
78
|
+
isSplit: boolean;
|
|
79
|
+
}, {}>;
|
|
80
|
+
|
|
81
|
+
export { MpButton, MpButtonGroup };
|
package/dist/button.js
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/button.tsx
|
|
22
|
+
var button_exports = {};
|
|
23
|
+
__export(button_exports, {
|
|
24
|
+
MpButton: () => MpButton,
|
|
25
|
+
MpButtonGroup: () => MpButtonGroup
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(button_exports);
|
|
28
|
+
var import_vue = require("vue");
|
|
29
|
+
var import_vue2 = require("vue");
|
|
30
|
+
var import_tokens = require("@mekari/pixel3-styled-system/tokens");
|
|
31
|
+
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
32
|
+
var import_pixel3_icon = require("@mekari/pixel3-icon");
|
|
33
|
+
var import_pixel3_spinner = require("@mekari/pixel3-spinner");
|
|
34
|
+
|
|
35
|
+
// src/modules/button.props.ts
|
|
36
|
+
var buttonProps = {
|
|
37
|
+
as: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "button"
|
|
40
|
+
},
|
|
41
|
+
size: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "md"
|
|
44
|
+
},
|
|
45
|
+
variant: {
|
|
46
|
+
type: String
|
|
47
|
+
},
|
|
48
|
+
isDisabled: {
|
|
49
|
+
type: Boolean
|
|
50
|
+
},
|
|
51
|
+
isLoading: {
|
|
52
|
+
type: Boolean
|
|
53
|
+
},
|
|
54
|
+
leftIcon: {
|
|
55
|
+
type: String
|
|
56
|
+
},
|
|
57
|
+
rightIcon: {
|
|
58
|
+
type: String
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var buttonGroupProps = {
|
|
62
|
+
spacing: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: "2"
|
|
65
|
+
},
|
|
66
|
+
isSplit: {
|
|
67
|
+
type: Boolean
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// src/button.tsx
|
|
72
|
+
var MpButton = (0, import_vue2.defineComponent)({
|
|
73
|
+
name: "MpButton",
|
|
74
|
+
props: buttonProps,
|
|
75
|
+
emits: ["click"],
|
|
76
|
+
setup(props, {
|
|
77
|
+
slots,
|
|
78
|
+
emit
|
|
79
|
+
}) {
|
|
80
|
+
const classes = (0, import_recipes.buttonRecipe)({
|
|
81
|
+
size: props.size,
|
|
82
|
+
variant: props.variant
|
|
83
|
+
});
|
|
84
|
+
const onClick = /* @__PURE__ */ __name((event) => {
|
|
85
|
+
if (props.isLoading) {
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
} else if (!props.isDisabled) {
|
|
88
|
+
emit("click", event);
|
|
89
|
+
}
|
|
90
|
+
}, "onClick");
|
|
91
|
+
return () => {
|
|
92
|
+
const children = slots.default && slots.default();
|
|
93
|
+
const {
|
|
94
|
+
as: Component,
|
|
95
|
+
variant,
|
|
96
|
+
isDisabled,
|
|
97
|
+
isLoading,
|
|
98
|
+
leftIcon,
|
|
99
|
+
rightIcon
|
|
100
|
+
} = props;
|
|
101
|
+
return (0, import_vue.createVNode)(Component, {
|
|
102
|
+
"class": classes,
|
|
103
|
+
"data-pixel-component": "MpButton",
|
|
104
|
+
"data-has-icon": children ? void 0 : true,
|
|
105
|
+
"disabled": isDisabled ? true : void 0,
|
|
106
|
+
"aria-disabled": isDisabled,
|
|
107
|
+
"onClick": onClick
|
|
108
|
+
}, {
|
|
109
|
+
default: () => [isLoading && !isDisabled && (0, import_vue.createVNode)("span", {
|
|
110
|
+
"data-loading": "true"
|
|
111
|
+
}, [(0, import_vue.createVNode)(import_pixel3_spinner.MpSpinner, null, null)]), leftIcon && (0, import_vue.createVNode)(import_pixel3_icon.MpIcon, {
|
|
112
|
+
"name": leftIcon,
|
|
113
|
+
"variant": variant === "secondary" || variant === "textLink" ? "duotone" : "outline",
|
|
114
|
+
"size": "sm",
|
|
115
|
+
"color": "currentcolor"
|
|
116
|
+
}, null), children, rightIcon && (0, import_vue.createVNode)(import_pixel3_icon.MpIcon, {
|
|
117
|
+
"name": rightIcon,
|
|
118
|
+
"size": "sm",
|
|
119
|
+
"color": "currentcolor"
|
|
120
|
+
}, null)]
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
var MpButtonGroup = (0, import_vue2.defineComponent)({
|
|
126
|
+
name: "MpButtonGroup",
|
|
127
|
+
props: buttonGroupProps,
|
|
128
|
+
setup(props, {
|
|
129
|
+
slots
|
|
130
|
+
}) {
|
|
131
|
+
const classes = (0, import_recipes.buttonGroupRecipe)();
|
|
132
|
+
return () => {
|
|
133
|
+
const children = slots.default && slots.default();
|
|
134
|
+
const {
|
|
135
|
+
spacing,
|
|
136
|
+
isSplit
|
|
137
|
+
} = props;
|
|
138
|
+
return (0, import_vue.createVNode)("div", {
|
|
139
|
+
"class": classes,
|
|
140
|
+
"data-pixel-component": "MpButtonGroup",
|
|
141
|
+
"data-split-button": isSplit ? true : void 0,
|
|
142
|
+
"style": {
|
|
143
|
+
"--mp-button-group-spacing": (0, import_tokens.token)(`spacing.${spacing}`) || spacing
|
|
144
|
+
}
|
|
145
|
+
}, [children]);
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
150
|
+
0 && (module.exports = {
|
|
151
|
+
MpButton,
|
|
152
|
+
MpButtonGroup
|
|
153
|
+
});
|
package/dist/button.mjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/modules/button.props.ts
|
|
5
|
+
var buttonProps = {
|
|
6
|
+
as: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: "button"
|
|
9
|
+
},
|
|
10
|
+
size: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: "md"
|
|
13
|
+
},
|
|
14
|
+
variant: {
|
|
15
|
+
type: String
|
|
16
|
+
},
|
|
17
|
+
isDisabled: {
|
|
18
|
+
type: Boolean
|
|
19
|
+
},
|
|
20
|
+
isLoading: {
|
|
21
|
+
type: Boolean
|
|
22
|
+
},
|
|
23
|
+
leftIcon: {
|
|
24
|
+
type: String
|
|
25
|
+
},
|
|
26
|
+
rightIcon: {
|
|
27
|
+
type: String
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var buttonGroupProps = {
|
|
31
|
+
spacing: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: "2"
|
|
34
|
+
},
|
|
35
|
+
isSplit: {
|
|
36
|
+
type: Boolean
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
__name,
|
|
42
|
+
buttonProps,
|
|
43
|
+
buttonGroupProps
|
|
44
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name,
|
|
3
|
+
buttonGroupProps,
|
|
4
|
+
buttonProps
|
|
5
|
+
} from "./chunk-5JNYXGFY.mjs";
|
|
6
|
+
|
|
7
|
+
// src/button.tsx
|
|
8
|
+
import { createVNode as _createVNode } from "vue";
|
|
9
|
+
import { defineComponent } from "vue";
|
|
10
|
+
import { token } from "@mekari/pixel3-styled-system/tokens";
|
|
11
|
+
import { buttonRecipe, buttonGroupRecipe } from "@mekari/pixel3-styled-system/recipes";
|
|
12
|
+
import { MpIcon } from "@mekari/pixel3-icon";
|
|
13
|
+
import { MpSpinner } from "@mekari/pixel3-spinner";
|
|
14
|
+
var MpButton = defineComponent({
|
|
15
|
+
name: "MpButton",
|
|
16
|
+
props: buttonProps,
|
|
17
|
+
emits: ["click"],
|
|
18
|
+
setup(props, {
|
|
19
|
+
slots,
|
|
20
|
+
emit
|
|
21
|
+
}) {
|
|
22
|
+
const classes = buttonRecipe({
|
|
23
|
+
size: props.size,
|
|
24
|
+
variant: props.variant
|
|
25
|
+
});
|
|
26
|
+
const onClick = /* @__PURE__ */ __name((event) => {
|
|
27
|
+
if (props.isLoading) {
|
|
28
|
+
event.preventDefault();
|
|
29
|
+
} else if (!props.isDisabled) {
|
|
30
|
+
emit("click", event);
|
|
31
|
+
}
|
|
32
|
+
}, "onClick");
|
|
33
|
+
return () => {
|
|
34
|
+
const children = slots.default && slots.default();
|
|
35
|
+
const {
|
|
36
|
+
as: Component,
|
|
37
|
+
variant,
|
|
38
|
+
isDisabled,
|
|
39
|
+
isLoading,
|
|
40
|
+
leftIcon,
|
|
41
|
+
rightIcon
|
|
42
|
+
} = props;
|
|
43
|
+
return _createVNode(Component, {
|
|
44
|
+
"class": classes,
|
|
45
|
+
"data-pixel-component": "MpButton",
|
|
46
|
+
"data-has-icon": children ? void 0 : true,
|
|
47
|
+
"disabled": isDisabled ? true : void 0,
|
|
48
|
+
"aria-disabled": isDisabled,
|
|
49
|
+
"onClick": onClick
|
|
50
|
+
}, {
|
|
51
|
+
default: () => [isLoading && !isDisabled && _createVNode("span", {
|
|
52
|
+
"data-loading": "true"
|
|
53
|
+
}, [_createVNode(MpSpinner, null, null)]), leftIcon && _createVNode(MpIcon, {
|
|
54
|
+
"name": leftIcon,
|
|
55
|
+
"variant": variant === "secondary" || variant === "textLink" ? "duotone" : "outline",
|
|
56
|
+
"size": "sm",
|
|
57
|
+
"color": "currentcolor"
|
|
58
|
+
}, null), children, rightIcon && _createVNode(MpIcon, {
|
|
59
|
+
"name": rightIcon,
|
|
60
|
+
"size": "sm",
|
|
61
|
+
"color": "currentcolor"
|
|
62
|
+
}, null)]
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
var MpButtonGroup = defineComponent({
|
|
68
|
+
name: "MpButtonGroup",
|
|
69
|
+
props: buttonGroupProps,
|
|
70
|
+
setup(props, {
|
|
71
|
+
slots
|
|
72
|
+
}) {
|
|
73
|
+
const classes = buttonGroupRecipe();
|
|
74
|
+
return () => {
|
|
75
|
+
const children = slots.default && slots.default();
|
|
76
|
+
const {
|
|
77
|
+
spacing,
|
|
78
|
+
isSplit
|
|
79
|
+
} = props;
|
|
80
|
+
return _createVNode("div", {
|
|
81
|
+
"class": classes,
|
|
82
|
+
"data-pixel-component": "MpButtonGroup",
|
|
83
|
+
"data-split-button": isSplit ? true : void 0,
|
|
84
|
+
"style": {
|
|
85
|
+
"--mp-button-group-spacing": token(`spacing.${spacing}`) || spacing
|
|
86
|
+
}
|
|
87
|
+
}, [children]);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
MpButton,
|
|
94
|
+
MpButtonGroup
|
|
95
|
+
};
|
package/dist/index.d.mts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.tsx
|
|
22
|
+
var src_exports = {};
|
|
23
|
+
__export(src_exports, {
|
|
24
|
+
MpButton: () => MpButton,
|
|
25
|
+
MpButtonGroup: () => MpButtonGroup
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(src_exports);
|
|
28
|
+
|
|
29
|
+
// src/button.tsx
|
|
30
|
+
var import_vue = require("vue");
|
|
31
|
+
var import_vue2 = require("vue");
|
|
32
|
+
var import_tokens = require("@mekari/pixel3-styled-system/tokens");
|
|
33
|
+
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
34
|
+
var import_pixel3_icon = require("@mekari/pixel3-icon");
|
|
35
|
+
var import_pixel3_spinner = require("@mekari/pixel3-spinner");
|
|
36
|
+
|
|
37
|
+
// src/modules/button.props.ts
|
|
38
|
+
var buttonProps = {
|
|
39
|
+
as: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: "button"
|
|
42
|
+
},
|
|
43
|
+
size: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: "md"
|
|
46
|
+
},
|
|
47
|
+
variant: {
|
|
48
|
+
type: String
|
|
49
|
+
},
|
|
50
|
+
isDisabled: {
|
|
51
|
+
type: Boolean
|
|
52
|
+
},
|
|
53
|
+
isLoading: {
|
|
54
|
+
type: Boolean
|
|
55
|
+
},
|
|
56
|
+
leftIcon: {
|
|
57
|
+
type: String
|
|
58
|
+
},
|
|
59
|
+
rightIcon: {
|
|
60
|
+
type: String
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var buttonGroupProps = {
|
|
64
|
+
spacing: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: "2"
|
|
67
|
+
},
|
|
68
|
+
isSplit: {
|
|
69
|
+
type: Boolean
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// src/button.tsx
|
|
74
|
+
var MpButton = (0, import_vue2.defineComponent)({
|
|
75
|
+
name: "MpButton",
|
|
76
|
+
props: buttonProps,
|
|
77
|
+
emits: ["click"],
|
|
78
|
+
setup(props, {
|
|
79
|
+
slots,
|
|
80
|
+
emit
|
|
81
|
+
}) {
|
|
82
|
+
const classes = (0, import_recipes.buttonRecipe)({
|
|
83
|
+
size: props.size,
|
|
84
|
+
variant: props.variant
|
|
85
|
+
});
|
|
86
|
+
const onClick = /* @__PURE__ */ __name((event) => {
|
|
87
|
+
if (props.isLoading) {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
} else if (!props.isDisabled) {
|
|
90
|
+
emit("click", event);
|
|
91
|
+
}
|
|
92
|
+
}, "onClick");
|
|
93
|
+
return () => {
|
|
94
|
+
const children = slots.default && slots.default();
|
|
95
|
+
const {
|
|
96
|
+
as: Component,
|
|
97
|
+
variant,
|
|
98
|
+
isDisabled,
|
|
99
|
+
isLoading,
|
|
100
|
+
leftIcon,
|
|
101
|
+
rightIcon
|
|
102
|
+
} = props;
|
|
103
|
+
return (0, import_vue.createVNode)(Component, {
|
|
104
|
+
"class": classes,
|
|
105
|
+
"data-pixel-component": "MpButton",
|
|
106
|
+
"data-has-icon": children ? void 0 : true,
|
|
107
|
+
"disabled": isDisabled ? true : void 0,
|
|
108
|
+
"aria-disabled": isDisabled,
|
|
109
|
+
"onClick": onClick
|
|
110
|
+
}, {
|
|
111
|
+
default: () => [isLoading && !isDisabled && (0, import_vue.createVNode)("span", {
|
|
112
|
+
"data-loading": "true"
|
|
113
|
+
}, [(0, import_vue.createVNode)(import_pixel3_spinner.MpSpinner, null, null)]), leftIcon && (0, import_vue.createVNode)(import_pixel3_icon.MpIcon, {
|
|
114
|
+
"name": leftIcon,
|
|
115
|
+
"variant": variant === "secondary" || variant === "textLink" ? "duotone" : "outline",
|
|
116
|
+
"size": "sm",
|
|
117
|
+
"color": "currentcolor"
|
|
118
|
+
}, null), children, rightIcon && (0, import_vue.createVNode)(import_pixel3_icon.MpIcon, {
|
|
119
|
+
"name": rightIcon,
|
|
120
|
+
"size": "sm",
|
|
121
|
+
"color": "currentcolor"
|
|
122
|
+
}, null)]
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
var MpButtonGroup = (0, import_vue2.defineComponent)({
|
|
128
|
+
name: "MpButtonGroup",
|
|
129
|
+
props: buttonGroupProps,
|
|
130
|
+
setup(props, {
|
|
131
|
+
slots
|
|
132
|
+
}) {
|
|
133
|
+
const classes = (0, import_recipes.buttonGroupRecipe)();
|
|
134
|
+
return () => {
|
|
135
|
+
const children = slots.default && slots.default();
|
|
136
|
+
const {
|
|
137
|
+
spacing,
|
|
138
|
+
isSplit
|
|
139
|
+
} = props;
|
|
140
|
+
return (0, import_vue.createVNode)("div", {
|
|
141
|
+
"class": classes,
|
|
142
|
+
"data-pixel-component": "MpButtonGroup",
|
|
143
|
+
"data-split-button": isSplit ? true : void 0,
|
|
144
|
+
"style": {
|
|
145
|
+
"--mp-button-group-spacing": (0, import_tokens.token)(`spacing.${spacing}`) || spacing
|
|
146
|
+
}
|
|
147
|
+
}, [children]);
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
152
|
+
0 && (module.exports = {
|
|
153
|
+
MpButton,
|
|
154
|
+
MpButtonGroup
|
|
155
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/modules/button.props.ts":{"bytes":861,"imports":[{"path":"./button.type","kind":"import-statement","external":true}],"format":"esm"},"src/button.tsx":{"bytes":2751,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/tokens","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"@mekari/pixel3-icon","kind":"import-statement","external":true},{"path":"@mekari/pixel3-spinner","kind":"import-statement","external":true},{"path":"src/modules/button.props.ts","kind":"import-statement","original":"./modules/button.props"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.tsx":{"bytes":136,"imports":[{"path":"src/button.tsx","kind":"import-statement","original":"./button"}],"format":"esm"},"src/modules/button.type.ts":{"bytes":209,"imports":[],"format":"esm"}},"outputs":{"dist/button.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/tokens","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"@mekari/pixel3-icon","kind":"require-call","external":true},{"path":"@mekari/pixel3-spinner","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/button.tsx","inputs":{"src/button.tsx":{"bytesInOutput":2871},"src/modules/button.props.ts":{"bytesInOutput":427}},"bytes":4376},"dist/index.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/tokens","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"@mekari/pixel3-icon","kind":"require-call","external":true},{"path":"@mekari/pixel3-spinner","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.tsx","inputs":{"src/index.tsx":{"bytesInOutput":159},"src/button.tsx":{"bytesInOutput":2703},"src/modules/button.props.ts":{"bytesInOutput":427}},"bytes":4385},"dist/modules/button.props.js":{"imports":[],"exports":[],"entryPoint":"src/modules/button.props.ts","inputs":{"src/modules/button.props.ts":{"bytesInOutput":625}},"bytes":1581},"dist/modules/button.type.js":{"imports":[],"exports":[],"entryPoint":"src/modules/button.type.ts","inputs":{"src/modules/button.type.ts":{"bytesInOutput":82}},"bytes":784}}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"inputs":{"src/modules/button.props.ts":{"bytes":861,"imports":[{"path":"./button.type","kind":"import-statement","external":true}],"format":"esm"},"src/button.tsx":{"bytes":2751,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/tokens","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"@mekari/pixel3-icon","kind":"import-statement","external":true},{"path":"@mekari/pixel3-spinner","kind":"import-statement","external":true},{"path":"src/modules/button.props.ts","kind":"import-statement","original":"./modules/button.props"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.tsx":{"bytes":136,"imports":[{"path":"src/button.tsx","kind":"import-statement","original":"./button"}],"format":"esm"},"src/modules/button.type.ts":{"bytes":209,"imports":[],"format":"esm"}},"outputs":{"dist/button.mjs":{"imports":[{"path":"dist/chunk-P5BDBLJN.mjs","kind":"import-statement"},{"path":"dist/chunk-5JNYXGFY.mjs","kind":"import-statement"}],"exports":["MpButton","MpButtonGroup"],"entryPoint":"src/button.tsx","inputs":{},"bytes":139},"dist/index.mjs":{"imports":[{"path":"dist/chunk-P5BDBLJN.mjs","kind":"import-statement"},{"path":"dist/chunk-5JNYXGFY.mjs","kind":"import-statement"}],"exports":["MpButton","MpButtonGroup"],"entryPoint":"src/index.tsx","inputs":{"src/index.tsx":{"bytesInOutput":0}},"bytes":139},"dist/chunk-P5BDBLJN.mjs":{"imports":[{"path":"dist/chunk-5JNYXGFY.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/tokens","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"@mekari/pixel3-icon","kind":"import-statement","external":true},{"path":"@mekari/pixel3-spinner","kind":"import-statement","external":true}],"exports":["MpButton","MpButtonGroup"],"inputs":{"src/button.tsx":{"bytesInOutput":2472}},"bytes":2616},"dist/modules/button.props.mjs":{"imports":[{"path":"dist/chunk-5JNYXGFY.mjs","kind":"import-statement"}],"exports":["buttonGroupProps","buttonProps"],"entryPoint":"src/modules/button.props.ts","inputs":{},"bytes":121},"dist/chunk-5JNYXGFY.mjs":{"imports":[],"exports":["__name","buttonGroupProps","buttonProps"],"inputs":{"src/modules/button.props.ts":{"bytesInOutput":427}},"bytes":645},"dist/modules/button.type.mjs":{"imports":[],"exports":[],"entryPoint":"src/modules/button.type.ts","inputs":{"src/modules/button.type.ts":{"bytesInOutput":0}},"bytes":0}}}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { ButtonSize, ButtonVariant } from './button.type.mjs';
|
|
3
|
+
|
|
4
|
+
declare const buttonProps: {
|
|
5
|
+
as: {
|
|
6
|
+
type: PropType<keyof HTMLElementTagNameMap>;
|
|
7
|
+
default: string;
|
|
8
|
+
};
|
|
9
|
+
size: {
|
|
10
|
+
type: PropType<ButtonSize>;
|
|
11
|
+
default: string;
|
|
12
|
+
};
|
|
13
|
+
variant: {
|
|
14
|
+
type: PropType<ButtonVariant>;
|
|
15
|
+
};
|
|
16
|
+
isDisabled: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
};
|
|
19
|
+
isLoading: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
};
|
|
22
|
+
leftIcon: {
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
};
|
|
25
|
+
rightIcon: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
declare const buttonGroupProps: {
|
|
30
|
+
spacing: {
|
|
31
|
+
type: PropType<string>;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
isSplit: {
|
|
35
|
+
type: BooleanConstructor;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { buttonGroupProps, buttonProps };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { ButtonSize, ButtonVariant } from './button.type.js';
|
|
3
|
+
|
|
4
|
+
declare const buttonProps: {
|
|
5
|
+
as: {
|
|
6
|
+
type: PropType<keyof HTMLElementTagNameMap>;
|
|
7
|
+
default: string;
|
|
8
|
+
};
|
|
9
|
+
size: {
|
|
10
|
+
type: PropType<ButtonSize>;
|
|
11
|
+
default: string;
|
|
12
|
+
};
|
|
13
|
+
variant: {
|
|
14
|
+
type: PropType<ButtonVariant>;
|
|
15
|
+
};
|
|
16
|
+
isDisabled: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
};
|
|
19
|
+
isLoading: {
|
|
20
|
+
type: BooleanConstructor;
|
|
21
|
+
};
|
|
22
|
+
leftIcon: {
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
};
|
|
25
|
+
rightIcon: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
declare const buttonGroupProps: {
|
|
30
|
+
spacing: {
|
|
31
|
+
type: PropType<string>;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
isSplit: {
|
|
35
|
+
type: BooleanConstructor;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export { buttonGroupProps, buttonProps };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/modules/button.props.ts
|
|
21
|
+
var button_props_exports = {};
|
|
22
|
+
__export(button_props_exports, {
|
|
23
|
+
buttonGroupProps: () => buttonGroupProps,
|
|
24
|
+
buttonProps: () => buttonProps
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(button_props_exports);
|
|
27
|
+
var buttonProps = {
|
|
28
|
+
as: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "button"
|
|
31
|
+
},
|
|
32
|
+
size: {
|
|
33
|
+
type: String,
|
|
34
|
+
default: "md"
|
|
35
|
+
},
|
|
36
|
+
variant: {
|
|
37
|
+
type: String
|
|
38
|
+
},
|
|
39
|
+
isDisabled: {
|
|
40
|
+
type: Boolean
|
|
41
|
+
},
|
|
42
|
+
isLoading: {
|
|
43
|
+
type: Boolean
|
|
44
|
+
},
|
|
45
|
+
leftIcon: {
|
|
46
|
+
type: String
|
|
47
|
+
},
|
|
48
|
+
rightIcon: {
|
|
49
|
+
type: String
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var buttonGroupProps = {
|
|
53
|
+
spacing: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: "2"
|
|
56
|
+
},
|
|
57
|
+
isSplit: {
|
|
58
|
+
type: Boolean
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
buttonGroupProps,
|
|
64
|
+
buttonProps
|
|
65
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/modules/button.type.ts
|
|
17
|
+
var button_type_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(button_type_exports);
|
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mekari/pixel3-button",
|
|
3
|
+
"description": "Button component for mekari pixel 3",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@mekari/pixel3-icon": "0.0.0",
|
|
12
|
+
"@mekari/pixel3-spinner": "0.0.0",
|
|
13
|
+
"@mekari/pixel3-styled-system": "0.0.0"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"vue": "^3.3.7"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"vue": "^3.3.7"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"module": "dist/index.mjs",
|
|
25
|
+
"types": "dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"require": "./dist/index.js",
|
|
30
|
+
"default": "./dist/index.mjs"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"clean": "rimraf dist .turbo",
|
|
35
|
+
"build": "tsup && pnpm build:types",
|
|
36
|
+
"build:fast": "tsup",
|
|
37
|
+
"build:types": "tsup src --dts-only",
|
|
38
|
+
"build:external": "tsup src/index.tsx --external",
|
|
39
|
+
"types:check": "tsc --noEmit",
|
|
40
|
+
"replace-config": "clean-package",
|
|
41
|
+
"restore-config": "clean-package restore"
|
|
42
|
+
}
|
|
43
|
+
}
|