@mekari/pixel3-broadcast 0.0.1-dev.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/broadcast.d.mts +81 -0
- package/dist/broadcast.d.ts +81 -0
- package/dist/broadcast.js +201 -0
- package/dist/broadcast.mjs +11 -0
- package/dist/chunk-2MCZAW3F.mjs +44 -0
- package/dist/chunk-5IQVO6NS.mjs +40 -0
- package/dist/chunk-JP4CQC7M.mjs +90 -0
- package/dist/chunk-P5REXKKG.mjs +17 -0
- package/dist/chunk-PTIK2HZP.mjs +20 -0
- package/dist/chunk-QZ7VFGWC.mjs +6 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +203 -0
- package/dist/index.mjs +11 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/modules/broadcast.connects.d.mts +10 -0
- package/dist/modules/broadcast.connects.d.ts +10 -0
- package/dist/modules/broadcast.connects.js +111 -0
- package/dist/modules/broadcast.connects.mjs +7 -0
- package/dist/modules/broadcast.hooks.d.mts +7 -0
- package/dist/modules/broadcast.hooks.d.ts +7 -0
- package/dist/modules/broadcast.hooks.js +123 -0
- package/dist/modules/broadcast.hooks.mjs +8 -0
- package/dist/modules/broadcast.props.d.mts +39 -0
- package/dist/modules/broadcast.props.d.ts +39 -0
- package/dist/modules/broadcast.props.js +65 -0
- package/dist/modules/broadcast.props.mjs +9 -0
- package/dist/modules/broadcast.types.d.mts +50 -0
- package/dist/modules/broadcast.types.d.ts +50 -0
- package/dist/modules/broadcast.types.js +18 -0
- package/dist/modules/broadcast.types.mjs +0 -0
- package/dist/modules/broadcast.utils.d.mts +6 -0
- package/dist/modules/broadcast.utils.d.ts +6 -0
- package/dist/modules/broadcast.utils.js +38 -0
- package/dist/modules/broadcast.utils.mjs +7 -0
- package/package.json +44 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
2
|
+
import { BroadcastVariant } from './modules/broadcast.types.mjs';
|
|
3
|
+
import * as vue from 'vue';
|
|
4
|
+
import '@mekari/pixel3-utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* MpBroadcast component used to global information for users in the app.
|
|
8
|
+
*/
|
|
9
|
+
declare const MpBroadcast: vue.DefineComponent<{
|
|
10
|
+
id: {
|
|
11
|
+
type: vue.PropType<string | undefined>;
|
|
12
|
+
};
|
|
13
|
+
variant: {
|
|
14
|
+
type: vue.PropType<BroadcastVariant | undefined>;
|
|
15
|
+
default: string;
|
|
16
|
+
};
|
|
17
|
+
content: {
|
|
18
|
+
type: vue.PropType<string | undefined>;
|
|
19
|
+
};
|
|
20
|
+
textLink: {
|
|
21
|
+
type: vue.PropType<string | undefined>;
|
|
22
|
+
};
|
|
23
|
+
textLinkHref: {
|
|
24
|
+
type: vue.PropType<string | undefined>;
|
|
25
|
+
};
|
|
26
|
+
iconName: {
|
|
27
|
+
type: vue.PropType<string | undefined>;
|
|
28
|
+
};
|
|
29
|
+
textAdditionalAction: {
|
|
30
|
+
type: vue.PropType<string | undefined>;
|
|
31
|
+
};
|
|
32
|
+
hasAdditionalAction: {
|
|
33
|
+
type: vue.PropType<boolean | undefined>;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
isClosable: {
|
|
37
|
+
type: vue.PropType<boolean | undefined>;
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
40
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("click-additional-action" | "click-text-link" | "click-close-button")[], "click-additional-action" | "click-text-link" | "click-close-button", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
41
|
+
id: {
|
|
42
|
+
type: vue.PropType<string | undefined>;
|
|
43
|
+
};
|
|
44
|
+
variant: {
|
|
45
|
+
type: vue.PropType<BroadcastVariant | undefined>;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
content: {
|
|
49
|
+
type: vue.PropType<string | undefined>;
|
|
50
|
+
};
|
|
51
|
+
textLink: {
|
|
52
|
+
type: vue.PropType<string | undefined>;
|
|
53
|
+
};
|
|
54
|
+
textLinkHref: {
|
|
55
|
+
type: vue.PropType<string | undefined>;
|
|
56
|
+
};
|
|
57
|
+
iconName: {
|
|
58
|
+
type: vue.PropType<string | undefined>;
|
|
59
|
+
};
|
|
60
|
+
textAdditionalAction: {
|
|
61
|
+
type: vue.PropType<string | undefined>;
|
|
62
|
+
};
|
|
63
|
+
hasAdditionalAction: {
|
|
64
|
+
type: vue.PropType<boolean | undefined>;
|
|
65
|
+
default: boolean;
|
|
66
|
+
};
|
|
67
|
+
isClosable: {
|
|
68
|
+
type: vue.PropType<boolean | undefined>;
|
|
69
|
+
default: boolean;
|
|
70
|
+
};
|
|
71
|
+
}>> & {
|
|
72
|
+
"onClick-additional-action"?: ((...args: any[]) => any) | undefined;
|
|
73
|
+
"onClick-text-link"?: ((...args: any[]) => any) | undefined;
|
|
74
|
+
"onClick-close-button"?: ((...args: any[]) => any) | undefined;
|
|
75
|
+
}, {
|
|
76
|
+
variant: BroadcastVariant | undefined;
|
|
77
|
+
hasAdditionalAction: boolean | undefined;
|
|
78
|
+
isClosable: boolean | undefined;
|
|
79
|
+
}, {}>;
|
|
80
|
+
|
|
81
|
+
export { MpBroadcast };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as vue_jsx_runtime from 'vue/jsx-runtime';
|
|
2
|
+
import { BroadcastVariant } from './modules/broadcast.types.js';
|
|
3
|
+
import * as vue from 'vue';
|
|
4
|
+
import '@mekari/pixel3-utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* MpBroadcast component used to global information for users in the app.
|
|
8
|
+
*/
|
|
9
|
+
declare const MpBroadcast: vue.DefineComponent<{
|
|
10
|
+
id: {
|
|
11
|
+
type: vue.PropType<string | undefined>;
|
|
12
|
+
};
|
|
13
|
+
variant: {
|
|
14
|
+
type: vue.PropType<BroadcastVariant | undefined>;
|
|
15
|
+
default: string;
|
|
16
|
+
};
|
|
17
|
+
content: {
|
|
18
|
+
type: vue.PropType<string | undefined>;
|
|
19
|
+
};
|
|
20
|
+
textLink: {
|
|
21
|
+
type: vue.PropType<string | undefined>;
|
|
22
|
+
};
|
|
23
|
+
textLinkHref: {
|
|
24
|
+
type: vue.PropType<string | undefined>;
|
|
25
|
+
};
|
|
26
|
+
iconName: {
|
|
27
|
+
type: vue.PropType<string | undefined>;
|
|
28
|
+
};
|
|
29
|
+
textAdditionalAction: {
|
|
30
|
+
type: vue.PropType<string | undefined>;
|
|
31
|
+
};
|
|
32
|
+
hasAdditionalAction: {
|
|
33
|
+
type: vue.PropType<boolean | undefined>;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
isClosable: {
|
|
37
|
+
type: vue.PropType<boolean | undefined>;
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
40
|
+
}, () => vue_jsx_runtime.JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("click-additional-action" | "click-text-link" | "click-close-button")[], "click-additional-action" | "click-text-link" | "click-close-button", vue.PublicProps, Readonly<vue.ExtractPropTypes<{
|
|
41
|
+
id: {
|
|
42
|
+
type: vue.PropType<string | undefined>;
|
|
43
|
+
};
|
|
44
|
+
variant: {
|
|
45
|
+
type: vue.PropType<BroadcastVariant | undefined>;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
content: {
|
|
49
|
+
type: vue.PropType<string | undefined>;
|
|
50
|
+
};
|
|
51
|
+
textLink: {
|
|
52
|
+
type: vue.PropType<string | undefined>;
|
|
53
|
+
};
|
|
54
|
+
textLinkHref: {
|
|
55
|
+
type: vue.PropType<string | undefined>;
|
|
56
|
+
};
|
|
57
|
+
iconName: {
|
|
58
|
+
type: vue.PropType<string | undefined>;
|
|
59
|
+
};
|
|
60
|
+
textAdditionalAction: {
|
|
61
|
+
type: vue.PropType<string | undefined>;
|
|
62
|
+
};
|
|
63
|
+
hasAdditionalAction: {
|
|
64
|
+
type: vue.PropType<boolean | undefined>;
|
|
65
|
+
default: boolean;
|
|
66
|
+
};
|
|
67
|
+
isClosable: {
|
|
68
|
+
type: vue.PropType<boolean | undefined>;
|
|
69
|
+
default: boolean;
|
|
70
|
+
};
|
|
71
|
+
}>> & {
|
|
72
|
+
"onClick-additional-action"?: ((...args: any[]) => any) | undefined;
|
|
73
|
+
"onClick-text-link"?: ((...args: any[]) => any) | undefined;
|
|
74
|
+
"onClick-close-button"?: ((...args: any[]) => any) | undefined;
|
|
75
|
+
}, {
|
|
76
|
+
variant: BroadcastVariant | undefined;
|
|
77
|
+
hasAdditionalAction: boolean | undefined;
|
|
78
|
+
isClosable: boolean | undefined;
|
|
79
|
+
}, {}>;
|
|
80
|
+
|
|
81
|
+
export { MpBroadcast };
|
|
@@ -0,0 +1,201 @@
|
|
|
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/broadcast.tsx
|
|
22
|
+
var broadcast_exports = {};
|
|
23
|
+
__export(broadcast_exports, {
|
|
24
|
+
MpBroadcast: () => MpBroadcast
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(broadcast_exports);
|
|
27
|
+
var import_vue2 = require("vue");
|
|
28
|
+
var import_vue3 = require("vue");
|
|
29
|
+
|
|
30
|
+
// src/modules/broadcast.props.ts
|
|
31
|
+
var import_pixel3_utils = require("@mekari/pixel3-utils");
|
|
32
|
+
var broadcastProps = {
|
|
33
|
+
id: {
|
|
34
|
+
type: String
|
|
35
|
+
},
|
|
36
|
+
variant: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "announcement"
|
|
39
|
+
},
|
|
40
|
+
content: {
|
|
41
|
+
type: String
|
|
42
|
+
},
|
|
43
|
+
textLink: {
|
|
44
|
+
type: String
|
|
45
|
+
},
|
|
46
|
+
textLinkHref: {
|
|
47
|
+
type: String
|
|
48
|
+
},
|
|
49
|
+
iconName: {
|
|
50
|
+
type: String
|
|
51
|
+
},
|
|
52
|
+
textAdditionalAction: {
|
|
53
|
+
type: String
|
|
54
|
+
},
|
|
55
|
+
hasAdditionalAction: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
59
|
+
isClosable: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var broadcastEmits = (0, import_pixel3_utils.declareEmit)(["click-additional-action", "click-text-link", "click-close-button"]);
|
|
65
|
+
|
|
66
|
+
// src/modules/broadcast.hooks.ts
|
|
67
|
+
var import_vue = require("vue");
|
|
68
|
+
var import_recipes = require("@mekari/pixel3-styled-system/recipes");
|
|
69
|
+
|
|
70
|
+
// src/modules/broadcast.connects.ts
|
|
71
|
+
var import_pixel3_utils2 = require("@mekari/pixel3-utils");
|
|
72
|
+
function broadcastConnect(state, emit, classes) {
|
|
73
|
+
const {
|
|
74
|
+
id,
|
|
75
|
+
variant,
|
|
76
|
+
iconName,
|
|
77
|
+
content,
|
|
78
|
+
hasAdditionalAction,
|
|
79
|
+
isClosable,
|
|
80
|
+
textLink,
|
|
81
|
+
textLinkHref,
|
|
82
|
+
textAdditionalAction
|
|
83
|
+
} = state;
|
|
84
|
+
const idx = id != null ? id : `mp-broadcast-${(0, import_pixel3_utils2.useId)()}`;
|
|
85
|
+
return {
|
|
86
|
+
variant,
|
|
87
|
+
iconName,
|
|
88
|
+
content,
|
|
89
|
+
textLink,
|
|
90
|
+
textAdditionalAction,
|
|
91
|
+
hasAdditionalAction,
|
|
92
|
+
isClosable,
|
|
93
|
+
rootProps: {
|
|
94
|
+
id: idx,
|
|
95
|
+
class: classes.root,
|
|
96
|
+
"data-pixel-component": "MpBroadcast"
|
|
97
|
+
},
|
|
98
|
+
containerProps: {
|
|
99
|
+
id: `${idx}-container`,
|
|
100
|
+
class: classes.container,
|
|
101
|
+
"data-pixel-component": "MpBroadcastContainer"
|
|
102
|
+
},
|
|
103
|
+
wrapperProps: {
|
|
104
|
+
id: `${idx}-wrapper`,
|
|
105
|
+
class: classes.wrapper,
|
|
106
|
+
"data-pixel-component": "MpBroadcastWrapper"
|
|
107
|
+
},
|
|
108
|
+
iconProps: {
|
|
109
|
+
id: `${idx}-icon`,
|
|
110
|
+
name: iconName,
|
|
111
|
+
size: "md",
|
|
112
|
+
variant: "fill",
|
|
113
|
+
class: classes.icon,
|
|
114
|
+
"data-pixel-component": "MpBroadcastIcon"
|
|
115
|
+
},
|
|
116
|
+
contentProps: {
|
|
117
|
+
id: `${idx}-content`,
|
|
118
|
+
class: classes.content,
|
|
119
|
+
"data-pixel-component": "MpBroadcastContent"
|
|
120
|
+
},
|
|
121
|
+
textLinkProps: {
|
|
122
|
+
id: `${idx}-text-link`,
|
|
123
|
+
as: "a",
|
|
124
|
+
href: textLinkHref,
|
|
125
|
+
weight: "semiBold",
|
|
126
|
+
onClick: (evt) => emit("click-text-link", evt),
|
|
127
|
+
class: classes.textLink,
|
|
128
|
+
"data-pixel-component": "MpBroadcastTextLink"
|
|
129
|
+
},
|
|
130
|
+
actionProps: {
|
|
131
|
+
id: `${idx}-action`,
|
|
132
|
+
variant: "secondary",
|
|
133
|
+
size: "sm",
|
|
134
|
+
"aria-labelledby": textAdditionalAction,
|
|
135
|
+
onClick: (evt) => emit("click-additional-action", evt),
|
|
136
|
+
class: classes.action,
|
|
137
|
+
"data-pixel-component": "MpBroadcastAction"
|
|
138
|
+
},
|
|
139
|
+
closeProps: {
|
|
140
|
+
id: `${idx}-close`,
|
|
141
|
+
leftIcon: "close",
|
|
142
|
+
variant: "ghost",
|
|
143
|
+
size: "sm",
|
|
144
|
+
"aria-label": "Close button",
|
|
145
|
+
onClick: (evt) => emit("click-close-button", evt),
|
|
146
|
+
class: classes.close,
|
|
147
|
+
"data-pixel-component": "MpBroadcastClose"
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
__name(broadcastConnect, "broadcastConnect");
|
|
152
|
+
|
|
153
|
+
// src/modules/broadcast.hooks.ts
|
|
154
|
+
var useBroadcast = /* @__PURE__ */ __name((props, emit) => {
|
|
155
|
+
const context = (0, import_vue.ref)(props);
|
|
156
|
+
const [value] = import_recipes.broadcastSlotRecipe.splitVariantProps(context.value);
|
|
157
|
+
const classes = (0, import_recipes.broadcastSlotRecipe)(value);
|
|
158
|
+
return (0, import_vue.computed)(() => broadcastConnect(context.value, emit, classes));
|
|
159
|
+
}, "useBroadcast");
|
|
160
|
+
|
|
161
|
+
// src/modules/broadcast.utils.ts
|
|
162
|
+
var getMaxWidthContent = /* @__PURE__ */ __name((hasAdditionalAction, isClosable) => {
|
|
163
|
+
let actionWidth = 0;
|
|
164
|
+
if (hasAdditionalAction)
|
|
165
|
+
actionWidth += 112;
|
|
166
|
+
if (isClosable)
|
|
167
|
+
actionWidth += 42;
|
|
168
|
+
return `calc(100% - ${actionWidth}px)`;
|
|
169
|
+
}, "getMaxWidthContent");
|
|
170
|
+
|
|
171
|
+
// src/broadcast.tsx
|
|
172
|
+
var import_pixel3_button = require("@mekari/pixel3-button");
|
|
173
|
+
var import_pixel3_icon = require("@mekari/pixel3-icon");
|
|
174
|
+
var import_pixel3_text = require("@mekari/pixel3-text");
|
|
175
|
+
var MpBroadcast = (0, import_vue3.defineComponent)({
|
|
176
|
+
name: "MpBroadcast",
|
|
177
|
+
props: broadcastProps,
|
|
178
|
+
emits: broadcastEmits,
|
|
179
|
+
setup(props, {
|
|
180
|
+
emit
|
|
181
|
+
}) {
|
|
182
|
+
const api = useBroadcast(props, emit);
|
|
183
|
+
return () => (0, import_vue2.createVNode)("div", api.value.rootProps, [(0, import_vue2.createVNode)("div", api.value.containerProps, [(0, import_vue2.createVNode)("div", (0, import_vue2.mergeProps)({
|
|
184
|
+
"style": {
|
|
185
|
+
"--mp-broadcast--width": getMaxWidthContent(api.value.hasAdditionalAction, api.value.isClosable)
|
|
186
|
+
}
|
|
187
|
+
}, api.value.wrapperProps), [api.value.variant !== "announcement" && api.value.iconName && (0, import_vue2.createVNode)(import_pixel3_icon.MpIcon, api.value.iconProps, null), (0, import_vue2.createVNode)(import_pixel3_text.MpText, (0, import_vue2.mergeProps)(api.value.contentProps, {
|
|
188
|
+
"is-truncated": true
|
|
189
|
+
}), {
|
|
190
|
+
default: () => [api.value.content]
|
|
191
|
+
}), api.value.textLink && (0, import_vue2.createVNode)(import_pixel3_text.MpText, api.value.textLinkProps, {
|
|
192
|
+
default: () => [api.value.textLink]
|
|
193
|
+
})]), (0, import_vue2.createVNode)("div", api.value.wrapperProps, [api.value.hasAdditionalAction && (0, import_vue2.createVNode)(import_pixel3_button.MpButton, api.value.actionProps, {
|
|
194
|
+
default: () => [api.value.textAdditionalAction]
|
|
195
|
+
}), api.value.isClosable && (0, import_vue2.createVNode)(import_pixel3_button.MpButton, api.value.closeProps, null)])])]);
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
199
|
+
0 && (module.exports = {
|
|
200
|
+
MpBroadcast
|
|
201
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useBroadcast
|
|
3
|
+
} from "./chunk-PTIK2HZP.mjs";
|
|
4
|
+
import {
|
|
5
|
+
broadcastEmits,
|
|
6
|
+
broadcastProps
|
|
7
|
+
} from "./chunk-5IQVO6NS.mjs";
|
|
8
|
+
import {
|
|
9
|
+
getMaxWidthContent
|
|
10
|
+
} from "./chunk-P5REXKKG.mjs";
|
|
11
|
+
|
|
12
|
+
// src/broadcast.tsx
|
|
13
|
+
import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
|
|
14
|
+
import { defineComponent } from "vue";
|
|
15
|
+
import { MpButton } from "@mekari/pixel3-button";
|
|
16
|
+
import { MpIcon } from "@mekari/pixel3-icon";
|
|
17
|
+
import { MpText } from "@mekari/pixel3-text";
|
|
18
|
+
var MpBroadcast = defineComponent({
|
|
19
|
+
name: "MpBroadcast",
|
|
20
|
+
props: broadcastProps,
|
|
21
|
+
emits: broadcastEmits,
|
|
22
|
+
setup(props, {
|
|
23
|
+
emit
|
|
24
|
+
}) {
|
|
25
|
+
const api = useBroadcast(props, emit);
|
|
26
|
+
return () => _createVNode("div", api.value.rootProps, [_createVNode("div", api.value.containerProps, [_createVNode("div", _mergeProps({
|
|
27
|
+
"style": {
|
|
28
|
+
"--mp-broadcast--width": getMaxWidthContent(api.value.hasAdditionalAction, api.value.isClosable)
|
|
29
|
+
}
|
|
30
|
+
}, api.value.wrapperProps), [api.value.variant !== "announcement" && api.value.iconName && _createVNode(MpIcon, api.value.iconProps, null), _createVNode(MpText, _mergeProps(api.value.contentProps, {
|
|
31
|
+
"is-truncated": true
|
|
32
|
+
}), {
|
|
33
|
+
default: () => [api.value.content]
|
|
34
|
+
}), api.value.textLink && _createVNode(MpText, api.value.textLinkProps, {
|
|
35
|
+
default: () => [api.value.textLink]
|
|
36
|
+
})]), _createVNode("div", api.value.wrapperProps, [api.value.hasAdditionalAction && _createVNode(MpButton, api.value.actionProps, {
|
|
37
|
+
default: () => [api.value.textAdditionalAction]
|
|
38
|
+
}), api.value.isClosable && _createVNode(MpButton, api.value.closeProps, null)])])]);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export {
|
|
43
|
+
MpBroadcast
|
|
44
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/modules/broadcast.props.ts
|
|
2
|
+
import { declareEmit } from "@mekari/pixel3-utils";
|
|
3
|
+
var broadcastProps = {
|
|
4
|
+
id: {
|
|
5
|
+
type: String
|
|
6
|
+
},
|
|
7
|
+
variant: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: "announcement"
|
|
10
|
+
},
|
|
11
|
+
content: {
|
|
12
|
+
type: String
|
|
13
|
+
},
|
|
14
|
+
textLink: {
|
|
15
|
+
type: String
|
|
16
|
+
},
|
|
17
|
+
textLinkHref: {
|
|
18
|
+
type: String
|
|
19
|
+
},
|
|
20
|
+
iconName: {
|
|
21
|
+
type: String
|
|
22
|
+
},
|
|
23
|
+
textAdditionalAction: {
|
|
24
|
+
type: String
|
|
25
|
+
},
|
|
26
|
+
hasAdditionalAction: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
},
|
|
30
|
+
isClosable: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var broadcastEmits = declareEmit(["click-additional-action", "click-text-link", "click-close-button"]);
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
broadcastProps,
|
|
39
|
+
broadcastEmits
|
|
40
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-QZ7VFGWC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/modules/broadcast.connects.ts
|
|
6
|
+
import { useId } from "@mekari/pixel3-utils";
|
|
7
|
+
function broadcastConnect(state, emit, classes) {
|
|
8
|
+
const {
|
|
9
|
+
id,
|
|
10
|
+
variant,
|
|
11
|
+
iconName,
|
|
12
|
+
content,
|
|
13
|
+
hasAdditionalAction,
|
|
14
|
+
isClosable,
|
|
15
|
+
textLink,
|
|
16
|
+
textLinkHref,
|
|
17
|
+
textAdditionalAction
|
|
18
|
+
} = state;
|
|
19
|
+
const idx = id != null ? id : `mp-broadcast-${useId()}`;
|
|
20
|
+
return {
|
|
21
|
+
variant,
|
|
22
|
+
iconName,
|
|
23
|
+
content,
|
|
24
|
+
textLink,
|
|
25
|
+
textAdditionalAction,
|
|
26
|
+
hasAdditionalAction,
|
|
27
|
+
isClosable,
|
|
28
|
+
rootProps: {
|
|
29
|
+
id: idx,
|
|
30
|
+
class: classes.root,
|
|
31
|
+
"data-pixel-component": "MpBroadcast"
|
|
32
|
+
},
|
|
33
|
+
containerProps: {
|
|
34
|
+
id: `${idx}-container`,
|
|
35
|
+
class: classes.container,
|
|
36
|
+
"data-pixel-component": "MpBroadcastContainer"
|
|
37
|
+
},
|
|
38
|
+
wrapperProps: {
|
|
39
|
+
id: `${idx}-wrapper`,
|
|
40
|
+
class: classes.wrapper,
|
|
41
|
+
"data-pixel-component": "MpBroadcastWrapper"
|
|
42
|
+
},
|
|
43
|
+
iconProps: {
|
|
44
|
+
id: `${idx}-icon`,
|
|
45
|
+
name: iconName,
|
|
46
|
+
size: "md",
|
|
47
|
+
variant: "fill",
|
|
48
|
+
class: classes.icon,
|
|
49
|
+
"data-pixel-component": "MpBroadcastIcon"
|
|
50
|
+
},
|
|
51
|
+
contentProps: {
|
|
52
|
+
id: `${idx}-content`,
|
|
53
|
+
class: classes.content,
|
|
54
|
+
"data-pixel-component": "MpBroadcastContent"
|
|
55
|
+
},
|
|
56
|
+
textLinkProps: {
|
|
57
|
+
id: `${idx}-text-link`,
|
|
58
|
+
as: "a",
|
|
59
|
+
href: textLinkHref,
|
|
60
|
+
weight: "semiBold",
|
|
61
|
+
onClick: (evt) => emit("click-text-link", evt),
|
|
62
|
+
class: classes.textLink,
|
|
63
|
+
"data-pixel-component": "MpBroadcastTextLink"
|
|
64
|
+
},
|
|
65
|
+
actionProps: {
|
|
66
|
+
id: `${idx}-action`,
|
|
67
|
+
variant: "secondary",
|
|
68
|
+
size: "sm",
|
|
69
|
+
"aria-labelledby": textAdditionalAction,
|
|
70
|
+
onClick: (evt) => emit("click-additional-action", evt),
|
|
71
|
+
class: classes.action,
|
|
72
|
+
"data-pixel-component": "MpBroadcastAction"
|
|
73
|
+
},
|
|
74
|
+
closeProps: {
|
|
75
|
+
id: `${idx}-close`,
|
|
76
|
+
leftIcon: "close",
|
|
77
|
+
variant: "ghost",
|
|
78
|
+
size: "sm",
|
|
79
|
+
"aria-label": "Close button",
|
|
80
|
+
onClick: (evt) => emit("click-close-button", evt),
|
|
81
|
+
class: classes.close,
|
|
82
|
+
"data-pixel-component": "MpBroadcastClose"
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
__name(broadcastConnect, "broadcastConnect");
|
|
87
|
+
|
|
88
|
+
export {
|
|
89
|
+
broadcastConnect
|
|
90
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-QZ7VFGWC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/modules/broadcast.utils.ts
|
|
6
|
+
var getMaxWidthContent = /* @__PURE__ */ __name((hasAdditionalAction, isClosable) => {
|
|
7
|
+
let actionWidth = 0;
|
|
8
|
+
if (hasAdditionalAction)
|
|
9
|
+
actionWidth += 112;
|
|
10
|
+
if (isClosable)
|
|
11
|
+
actionWidth += 42;
|
|
12
|
+
return `calc(100% - ${actionWidth}px)`;
|
|
13
|
+
}, "getMaxWidthContent");
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
getMaxWidthContent
|
|
17
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
broadcastConnect
|
|
3
|
+
} from "./chunk-JP4CQC7M.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__name
|
|
6
|
+
} from "./chunk-QZ7VFGWC.mjs";
|
|
7
|
+
|
|
8
|
+
// src/modules/broadcast.hooks.ts
|
|
9
|
+
import { computed, ref } from "vue";
|
|
10
|
+
import { broadcastSlotRecipe } from "@mekari/pixel3-styled-system/recipes";
|
|
11
|
+
var useBroadcast = /* @__PURE__ */ __name((props, emit) => {
|
|
12
|
+
const context = ref(props);
|
|
13
|
+
const [value] = broadcastSlotRecipe.splitVariantProps(context.value);
|
|
14
|
+
const classes = broadcastSlotRecipe(value);
|
|
15
|
+
return computed(() => broadcastConnect(context.value, emit, classes));
|
|
16
|
+
}, "useBroadcast");
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
useBroadcast
|
|
20
|
+
};
|
package/dist/index.d.mts
ADDED