@mekari/pixel3-tag 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.
@@ -0,0 +1,19 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-QZ7VFGWC.mjs";
4
+
5
+ // src/modules/tag.machines.ts
6
+ import { createMachine } from "xstate";
7
+ function tagMachine(context) {
8
+ return createMachine({
9
+ /** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgBcBDKfEABy1gEsDqsMyAPRARgCZ0BPN95f5EA */
10
+ id: "tag",
11
+ context,
12
+ predictableActionArguments: true
13
+ });
14
+ }
15
+ __name(tagMachine, "tagMachine");
16
+
17
+ export {
18
+ tagMachine
19
+ };
@@ -0,0 +1,45 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-QZ7VFGWC.mjs";
4
+
5
+ // src/modules/tag.connects.ts
6
+ import { computed, getCurrentInstance } from "vue";
7
+ import { cx } from "@mekari/pixel3-styled-system/css";
8
+ function tagConnect(state, send, classes) {
9
+ const {
10
+ id,
11
+ isClosable,
12
+ onClick,
13
+ onClose
14
+ } = state.context;
15
+ const isClickable = computed(() => {
16
+ var _a, _b;
17
+ return !!((_b = (_a = getCurrentInstance()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
18
+ }).value;
19
+ return {
20
+ isClosable,
21
+ rootProps: {
22
+ id,
23
+ onClick,
24
+ class: cx(classes.root, "group"),
25
+ style: {
26
+ "--mp-tag--cursor": isClickable ? "pointer" : void 0
27
+ },
28
+ "data-pixel-component": "MpTag"
29
+ },
30
+ closeProps: {
31
+ id: `${id}-close`,
32
+ variant: "ghost",
33
+ size: "sm",
34
+ leftIcon: "remove-tag",
35
+ onClick: onClose,
36
+ class: classes.close,
37
+ "data-pixel-component": "MpTagClose"
38
+ }
39
+ };
40
+ }
41
+ __name(tagConnect, "tagConnect");
42
+
43
+ export {
44
+ tagConnect
45
+ };
@@ -0,0 +1,36 @@
1
+ import {
2
+ useTag
3
+ } from "./chunk-J6ICIHXS.mjs";
4
+ import {
5
+ tagEmits,
6
+ tagProps
7
+ } from "./chunk-Q6L3MIBC.mjs";
8
+
9
+ // src/tag.tsx
10
+ import { createVNode as _createVNode } from "vue";
11
+ import { defineComponent, reactive } from "vue";
12
+ import { MpButton } from "@mekari/pixel3-button";
13
+ var MpTag = defineComponent({
14
+ name: "MpTag",
15
+ props: tagProps,
16
+ emits: tagEmits,
17
+ setup(props, {
18
+ slots,
19
+ emit
20
+ }) {
21
+ const {
22
+ as: Component
23
+ } = reactive(props);
24
+ const api = useTag(props, emit);
25
+ return () => _createVNode(Component, api.value.rootProps, {
26
+ default: () => {
27
+ var _a;
28
+ return [(_a = slots.default) == null ? void 0 : _a.call(slots), api.value.isClosable && _createVNode(MpButton, api.value.closeProps, null)];
29
+ }
30
+ });
31
+ }
32
+ });
33
+
34
+ export {
35
+ MpTag
36
+ };
@@ -0,0 +1,38 @@
1
+ import {
2
+ tagConnect
3
+ } from "./chunk-ETUG5QZG.mjs";
4
+ import {
5
+ tagMachine
6
+ } from "./chunk-AGP5VIAA.mjs";
7
+ import {
8
+ __name
9
+ } from "./chunk-QZ7VFGWC.mjs";
10
+
11
+ // src/modules/tag.hooks.ts
12
+ import { computed, ref } from "vue";
13
+ import { useMachine } from "@xstate/vue";
14
+ import { useId } from "@mekari/pixel3-utils";
15
+ import { tagSlotRecipe } from "@mekari/pixel3-styled-system/recipes";
16
+ var useTag = /* @__PURE__ */ __name((props, emit) => {
17
+ var _a;
18
+ const context = ref(props);
19
+ const {
20
+ state,
21
+ send
22
+ } = useMachine(tagMachine({
23
+ ...context.value,
24
+ id: (_a = context.value.id) != null ? _a : `mp-tag-${useId()}`,
25
+ onClick: (evt) => emit("click", evt),
26
+ onClose: (evt) => {
27
+ evt.stopPropagation();
28
+ emit("close", evt);
29
+ }
30
+ }));
31
+ const [tagProps] = tagSlotRecipe.splitVariantProps(context.value);
32
+ const classes = tagSlotRecipe(tagProps);
33
+ return computed(() => tagConnect(state.value, send, classes));
34
+ }, "useTag");
35
+
36
+ export {
37
+ useTag
38
+ };
@@ -0,0 +1,29 @@
1
+ // src/modules/tag.props.ts
2
+ import { declareEmit } from "@mekari/pixel3-utils";
3
+ var tagProps = {
4
+ as: {
5
+ type: String,
6
+ default: "button"
7
+ },
8
+ id: {
9
+ type: String
10
+ },
11
+ size: {
12
+ type: String,
13
+ default: "md"
14
+ },
15
+ variant: {
16
+ type: String,
17
+ default: "gray"
18
+ },
19
+ isClosable: {
20
+ type: Boolean,
21
+ default: false
22
+ }
23
+ };
24
+ var tagEmits = declareEmit(["click", "close"]);
25
+
26
+ export {
27
+ tagProps,
28
+ tagEmits
29
+ };
@@ -0,0 +1,6 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ export {
5
+ __name
6
+ };
@@ -0,0 +1,4 @@
1
+ export { MpTag } from './tag.mjs';
2
+ import './modules/tag.types.mjs';
3
+ import '@mekari/pixel3-utils';
4
+ import 'vue';
@@ -0,0 +1,4 @@
1
+ export { MpTag } from './tag.js';
2
+ import './modules/tag.types.js';
3
+ import '@mekari/pixel3-utils';
4
+ import 'vue';
package/dist/index.js ADDED
@@ -0,0 +1,159 @@
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.ts
22
+ var src_exports = {};
23
+ __export(src_exports, {
24
+ MpTag: () => MpTag
25
+ });
26
+ module.exports = __toCommonJS(src_exports);
27
+
28
+ // src/tag.tsx
29
+ var import_vue4 = require("vue");
30
+ var import_vue5 = require("vue");
31
+
32
+ // src/modules/tag.props.ts
33
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
34
+ var tagProps = {
35
+ as: {
36
+ type: String,
37
+ default: "button"
38
+ },
39
+ id: {
40
+ type: String
41
+ },
42
+ size: {
43
+ type: String,
44
+ default: "md"
45
+ },
46
+ variant: {
47
+ type: String,
48
+ default: "gray"
49
+ },
50
+ isClosable: {
51
+ type: Boolean,
52
+ default: false
53
+ }
54
+ };
55
+ var tagEmits = (0, import_pixel3_utils.declareEmit)(["click", "close"]);
56
+
57
+ // src/modules/tag.hooks.ts
58
+ var import_vue2 = require("vue");
59
+ var import_vue3 = require("@xstate/vue");
60
+ var import_pixel3_utils2 = require("@mekari/pixel3-utils");
61
+ var import_recipes = require("@mekari/pixel3-styled-system/recipes");
62
+
63
+ // src/modules/tag.machines.ts
64
+ var import_xstate = require("xstate");
65
+ function tagMachine(context) {
66
+ return (0, import_xstate.createMachine)({
67
+ /** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgBcBDKfEABy1gEsDqsMyAPRARgCZ0BPN95f5EA */
68
+ id: "tag",
69
+ context,
70
+ predictableActionArguments: true
71
+ });
72
+ }
73
+ __name(tagMachine, "tagMachine");
74
+
75
+ // src/modules/tag.connects.ts
76
+ var import_vue = require("vue");
77
+ var import_css = require("@mekari/pixel3-styled-system/css");
78
+ function tagConnect(state, send, classes) {
79
+ const {
80
+ id,
81
+ isClosable,
82
+ onClick,
83
+ onClose
84
+ } = state.context;
85
+ const isClickable = (0, import_vue.computed)(() => {
86
+ var _a, _b;
87
+ return !!((_b = (_a = (0, import_vue.getCurrentInstance)()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
88
+ }).value;
89
+ return {
90
+ isClosable,
91
+ rootProps: {
92
+ id,
93
+ onClick,
94
+ class: (0, import_css.cx)(classes.root, "group"),
95
+ style: {
96
+ "--mp-tag--cursor": isClickable ? "pointer" : void 0
97
+ },
98
+ "data-pixel-component": "MpTag"
99
+ },
100
+ closeProps: {
101
+ id: `${id}-close`,
102
+ variant: "ghost",
103
+ size: "sm",
104
+ leftIcon: "remove-tag",
105
+ onClick: onClose,
106
+ class: classes.close,
107
+ "data-pixel-component": "MpTagClose"
108
+ }
109
+ };
110
+ }
111
+ __name(tagConnect, "tagConnect");
112
+
113
+ // src/modules/tag.hooks.ts
114
+ var useTag = /* @__PURE__ */ __name((props, emit) => {
115
+ var _a;
116
+ const context = (0, import_vue2.ref)(props);
117
+ const {
118
+ state,
119
+ send
120
+ } = (0, import_vue3.useMachine)(tagMachine({
121
+ ...context.value,
122
+ id: (_a = context.value.id) != null ? _a : `mp-tag-${(0, import_pixel3_utils2.useId)()}`,
123
+ onClick: (evt) => emit("click", evt),
124
+ onClose: (evt) => {
125
+ evt.stopPropagation();
126
+ emit("close", evt);
127
+ }
128
+ }));
129
+ const [tagProps2] = import_recipes.tagSlotRecipe.splitVariantProps(context.value);
130
+ const classes = (0, import_recipes.tagSlotRecipe)(tagProps2);
131
+ return (0, import_vue2.computed)(() => tagConnect(state.value, send, classes));
132
+ }, "useTag");
133
+
134
+ // src/tag.tsx
135
+ var import_pixel3_button = require("@mekari/pixel3-button");
136
+ var MpTag = (0, import_vue5.defineComponent)({
137
+ name: "MpTag",
138
+ props: tagProps,
139
+ emits: tagEmits,
140
+ setup(props, {
141
+ slots,
142
+ emit
143
+ }) {
144
+ const {
145
+ as: Component
146
+ } = (0, import_vue5.reactive)(props);
147
+ const api = useTag(props, emit);
148
+ return () => (0, import_vue4.createVNode)(Component, api.value.rootProps, {
149
+ default: () => {
150
+ var _a;
151
+ return [(_a = slots.default) == null ? void 0 : _a.call(slots), api.value.isClosable && (0, import_vue4.createVNode)(import_pixel3_button.MpButton, api.value.closeProps, null)];
152
+ }
153
+ });
154
+ }
155
+ });
156
+ // Annotate the CommonJS export names for ESM import in node:
157
+ 0 && (module.exports = {
158
+ MpTag
159
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,11 @@
1
+ import {
2
+ MpTag
3
+ } from "./chunk-GRJUHSTY.mjs";
4
+ import "./chunk-J6ICIHXS.mjs";
5
+ import "./chunk-ETUG5QZG.mjs";
6
+ import "./chunk-AGP5VIAA.mjs";
7
+ import "./chunk-Q6L3MIBC.mjs";
8
+ import "./chunk-QZ7VFGWC.mjs";
9
+ export {
10
+ MpTag
11
+ };
@@ -0,0 +1 @@
1
+ {"inputs":{"src/modules/tag.props.ts":{"bytes":777,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"./tag.types","kind":"import-statement","external":true}],"format":"esm"},"src/modules/tag.machines.ts":{"bytes":461,"imports":[{"path":"xstate","kind":"import-statement","external":true},{"path":"./tag.types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/modules/tag.connects.ts":{"bytes":1039,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"import-statement","external":true},{"path":"./tag.types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/modules/tag.hooks.ts":{"bytes":1004,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@xstate/vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"src/modules/tag.machines.ts","kind":"import-statement","original":"./tag.machines"},{"path":"src/modules/tag.connects.ts","kind":"import-statement","original":"./tag.connects"},{"path":"./tag.types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/tag.tsx":{"bytes":876,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"src/modules/tag.props.ts","kind":"import-statement","original":"./modules/tag.props"},{"path":"src/modules/tag.hooks.ts","kind":"import-statement","original":"./modules/tag.hooks"},{"path":"@mekari/pixel3-button","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":163,"imports":[{"path":"src/tag.tsx","kind":"import-statement","original":"./tag"}],"format":"esm"},"src/modules/tag.types.ts":{"bytes":837,"imports":[{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@xstate/vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"xstate","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"require-call","external":true},{"path":"@mekari/pixel3-button","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":115},"src/tag.tsx":{"bytesInOutput":715},"src/modules/tag.props.ts":{"bytesInOutput":400},"src/modules/tag.hooks.ts":{"bytesInOutput":890},"src/modules/tag.machines.ts":{"bytesInOutput":314},"src/modules/tag.connects.ts":{"bytesInOutput":945}},"bytes":4567},"dist/tag.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@xstate/vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"xstate","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"require-call","external":true},{"path":"@mekari/pixel3-button","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/tag.tsx","inputs":{"src/tag.tsx":{"bytesInOutput":830},"src/modules/tag.props.ts":{"bytesInOutput":400},"src/modules/tag.hooks.ts":{"bytesInOutput":890},"src/modules/tag.machines.ts":{"bytesInOutput":314},"src/modules/tag.connects.ts":{"bytesInOutput":945}},"bytes":4550},"dist/modules/tag.connects.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/tag.connects.ts","inputs":{"src/modules/tag.connects.ts":{"bytesInOutput":1097}},"bytes":2122},"dist/modules/tag.hooks.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"@xstate/vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-utils","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true},{"path":"xstate","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/tag.hooks.ts","inputs":{"src/modules/tag.hooks.ts":{"bytesInOutput":1021},"src/modules/tag.machines.ts":{"bytesInOutput":314},"src/modules/tag.connects.ts":{"bytesInOutput":945}},"bytes":3391},"dist/modules/tag.machines.js":{"imports":[{"path":"xstate","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/tag.machines.ts","inputs":{"src/modules/tag.machines.ts":{"bytesInOutput":466}},"bytes":1491},"dist/modules/tag.props.js":{"imports":[{"path":"@mekari/pixel3-utils","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/modules/tag.props.ts","inputs":{"src/modules/tag.props.ts":{"bytesInOutput":567}},"bytes":1509},"dist/modules/tag.types.js":{"imports":[],"exports":[],"entryPoint":"src/modules/tag.types.ts","inputs":{"src/modules/tag.types.ts":{"bytesInOutput":78}},"bytes":778}}}
@@ -0,0 +1 @@
1
+ {"inputs":{"src/modules/tag.props.ts":{"bytes":777,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"./tag.types","kind":"import-statement","external":true}],"format":"esm"},"src/modules/tag.machines.ts":{"bytes":461,"imports":[{"path":"xstate","kind":"import-statement","external":true},{"path":"./tag.types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/modules/tag.connects.ts":{"bytes":1039,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"import-statement","external":true},{"path":"./tag.types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/modules/tag.hooks.ts":{"bytes":1004,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"@xstate/vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"src/modules/tag.machines.ts","kind":"import-statement","original":"./tag.machines"},{"path":"src/modules/tag.connects.ts","kind":"import-statement","original":"./tag.connects"},{"path":"./tag.types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/tag.tsx":{"bytes":876,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"src/modules/tag.props.ts","kind":"import-statement","original":"./modules/tag.props"},{"path":"src/modules/tag.hooks.ts","kind":"import-statement","original":"./modules/tag.hooks"},{"path":"@mekari/pixel3-button","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":163,"imports":[{"path":"src/tag.tsx","kind":"import-statement","original":"./tag"}],"format":"esm"},"src/modules/tag.types.ts":{"bytes":837,"imports":[{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.mjs":{"imports":[{"path":"dist/chunk-GRJUHSTY.mjs","kind":"import-statement"},{"path":"dist/chunk-J6ICIHXS.mjs","kind":"import-statement"},{"path":"dist/chunk-ETUG5QZG.mjs","kind":"import-statement"},{"path":"dist/chunk-AGP5VIAA.mjs","kind":"import-statement"},{"path":"dist/chunk-Q6L3MIBC.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpTag"],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":0}},"bytes":223},"dist/tag.mjs":{"imports":[{"path":"dist/chunk-GRJUHSTY.mjs","kind":"import-statement"},{"path":"dist/chunk-J6ICIHXS.mjs","kind":"import-statement"},{"path":"dist/chunk-ETUG5QZG.mjs","kind":"import-statement"},{"path":"dist/chunk-AGP5VIAA.mjs","kind":"import-statement"},{"path":"dist/chunk-Q6L3MIBC.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["MpTag"],"entryPoint":"src/tag.tsx","inputs":{},"bytes":223},"dist/chunk-GRJUHSTY.mjs":{"imports":[{"path":"dist/chunk-J6ICIHXS.mjs","kind":"import-statement"},{"path":"dist/chunk-Q6L3MIBC.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-button","kind":"import-statement","external":true}],"exports":["MpTag"],"inputs":{"src/tag.tsx":{"bytesInOutput":649}},"bytes":798},"dist/modules/tag.connects.mjs":{"imports":[{"path":"dist/chunk-ETUG5QZG.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["tagConnect"],"entryPoint":"src/modules/tag.connects.ts","inputs":{},"bytes":111},"dist/modules/tag.hooks.mjs":{"imports":[{"path":"dist/chunk-J6ICIHXS.mjs","kind":"import-statement"},{"path":"dist/chunk-ETUG5QZG.mjs","kind":"import-statement"},{"path":"dist/chunk-AGP5VIAA.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["useTag"],"entryPoint":"src/modules/tag.hooks.ts","inputs":{},"bytes":167},"dist/chunk-J6ICIHXS.mjs":{"imports":[{"path":"dist/chunk-ETUG5QZG.mjs","kind":"import-statement"},{"path":"dist/chunk-AGP5VIAA.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"@xstate/vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true}],"exports":["useTag"],"inputs":{"src/modules/tag.hooks.ts":{"bytesInOutput":765}},"bytes":971},"dist/chunk-ETUG5QZG.mjs":{"imports":[{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/css","kind":"import-statement","external":true}],"exports":["tagConnect"],"inputs":{"src/modules/tag.connects.ts":{"bytesInOutput":909}},"bytes":1016},"dist/modules/tag.machines.mjs":{"imports":[{"path":"dist/chunk-AGP5VIAA.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["tagMachine"],"entryPoint":"src/modules/tag.machines.ts","inputs":{},"bytes":111},"dist/chunk-AGP5VIAA.mjs":{"imports":[{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"},{"path":"xstate","kind":"import-statement","external":true}],"exports":["tagMachine"],"inputs":{"src/modules/tag.machines.ts":{"bytesInOutput":296}},"bytes":403},"dist/modules/tag.props.mjs":{"imports":[{"path":"dist/chunk-Q6L3MIBC.mjs","kind":"import-statement"},{"path":"dist/chunk-QZ7VFGWC.mjs","kind":"import-statement"}],"exports":["tagEmits","tagProps"],"entryPoint":"src/modules/tag.props.ts","inputs":{},"bytes":131},"dist/chunk-Q6L3MIBC.mjs":{"imports":[{"path":"@mekari/pixel3-utils","kind":"import-statement","external":true}],"exports":["tagEmits","tagProps"],"inputs":{"src/modules/tag.props.ts":{"bytesInOutput":368}},"bytes":432},"dist/chunk-QZ7VFGWC.mjs":{"imports":[],"exports":["__name"],"inputs":{},"bytes":151},"dist/modules/tag.types.mjs":{"imports":[],"exports":[],"entryPoint":"src/modules/tag.types.ts","inputs":{"src/modules/tag.types.ts":{"bytesInOutput":0}},"bytes":0}}}
@@ -0,0 +1,10 @@
1
+ import { TagState, TagSend, TagClasses, TagApiMachine } from './tag.types.mjs';
2
+ import '@mekari/pixel3-utils';
3
+
4
+ /**
5
+ * Exported tag connects.
6
+ */
7
+
8
+ declare function tagConnect(state: TagState, send: TagSend, classes: TagClasses): TagApiMachine;
9
+
10
+ export { tagConnect };
@@ -0,0 +1,10 @@
1
+ import { TagState, TagSend, TagClasses, TagApiMachine } from './tag.types.js';
2
+ import '@mekari/pixel3-utils';
3
+
4
+ /**
5
+ * Exported tag connects.
6
+ */
7
+
8
+ declare function tagConnect(state: TagState, send: TagSend, classes: TagClasses): TagApiMachine;
9
+
10
+ export { tagConnect };
@@ -0,0 +1,66 @@
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/modules/tag.connects.ts
22
+ var tag_connects_exports = {};
23
+ __export(tag_connects_exports, {
24
+ tagConnect: () => tagConnect
25
+ });
26
+ module.exports = __toCommonJS(tag_connects_exports);
27
+ var import_vue = require("vue");
28
+ var import_css = require("@mekari/pixel3-styled-system/css");
29
+ function tagConnect(state, send, classes) {
30
+ const {
31
+ id,
32
+ isClosable,
33
+ onClick,
34
+ onClose
35
+ } = state.context;
36
+ const isClickable = (0, import_vue.computed)(() => {
37
+ var _a, _b;
38
+ return !!((_b = (_a = (0, import_vue.getCurrentInstance)()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
39
+ }).value;
40
+ return {
41
+ isClosable,
42
+ rootProps: {
43
+ id,
44
+ onClick,
45
+ class: (0, import_css.cx)(classes.root, "group"),
46
+ style: {
47
+ "--mp-tag--cursor": isClickable ? "pointer" : void 0
48
+ },
49
+ "data-pixel-component": "MpTag"
50
+ },
51
+ closeProps: {
52
+ id: `${id}-close`,
53
+ variant: "ghost",
54
+ size: "sm",
55
+ leftIcon: "remove-tag",
56
+ onClick: onClose,
57
+ class: classes.close,
58
+ "data-pixel-component": "MpTagClose"
59
+ }
60
+ };
61
+ }
62
+ __name(tagConnect, "tagConnect");
63
+ // Annotate the CommonJS export names for ESM import in node:
64
+ 0 && (module.exports = {
65
+ tagConnect
66
+ });
@@ -0,0 +1,7 @@
1
+ import {
2
+ tagConnect
3
+ } from "../chunk-ETUG5QZG.mjs";
4
+ import "../chunk-QZ7VFGWC.mjs";
5
+ export {
6
+ tagConnect
7
+ };
@@ -0,0 +1,7 @@
1
+ import * as vue from 'vue';
2
+ import { TagDefinedContext, TagApiMachine } from './tag.types.mjs';
3
+ import * as _mekari_pixel3_utils from '@mekari/pixel3-utils';
4
+
5
+ declare const useTag: (props: TagDefinedContext, emit: CallableFunction) => vue.ComputedRef<TagApiMachine<_mekari_pixel3_utils.PropTypes>>;
6
+
7
+ export { useTag };
@@ -0,0 +1,7 @@
1
+ import * as vue from 'vue';
2
+ import { TagDefinedContext, TagApiMachine } from './tag.types.js';
3
+ import * as _mekari_pixel3_utils from '@mekari/pixel3-utils';
4
+
5
+ declare const useTag: (props: TagDefinedContext, emit: CallableFunction) => vue.ComputedRef<TagApiMachine<_mekari_pixel3_utils.PropTypes>>;
6
+
7
+ export { useTag };
@@ -0,0 +1,105 @@
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/modules/tag.hooks.ts
22
+ var tag_hooks_exports = {};
23
+ __export(tag_hooks_exports, {
24
+ useTag: () => useTag
25
+ });
26
+ module.exports = __toCommonJS(tag_hooks_exports);
27
+ var import_vue2 = require("vue");
28
+ var import_vue3 = require("@xstate/vue");
29
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
30
+ var import_recipes = require("@mekari/pixel3-styled-system/recipes");
31
+
32
+ // src/modules/tag.machines.ts
33
+ var import_xstate = require("xstate");
34
+ function tagMachine(context) {
35
+ return (0, import_xstate.createMachine)({
36
+ /** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgBcBDKfEABy1gEsDqsMyAPRARgCZ0BPN95f5EA */
37
+ id: "tag",
38
+ context,
39
+ predictableActionArguments: true
40
+ });
41
+ }
42
+ __name(tagMachine, "tagMachine");
43
+
44
+ // src/modules/tag.connects.ts
45
+ var import_vue = require("vue");
46
+ var import_css = require("@mekari/pixel3-styled-system/css");
47
+ function tagConnect(state, send, classes) {
48
+ const {
49
+ id,
50
+ isClosable,
51
+ onClick,
52
+ onClose
53
+ } = state.context;
54
+ const isClickable = (0, import_vue.computed)(() => {
55
+ var _a, _b;
56
+ return !!((_b = (_a = (0, import_vue.getCurrentInstance)()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
57
+ }).value;
58
+ return {
59
+ isClosable,
60
+ rootProps: {
61
+ id,
62
+ onClick,
63
+ class: (0, import_css.cx)(classes.root, "group"),
64
+ style: {
65
+ "--mp-tag--cursor": isClickable ? "pointer" : void 0
66
+ },
67
+ "data-pixel-component": "MpTag"
68
+ },
69
+ closeProps: {
70
+ id: `${id}-close`,
71
+ variant: "ghost",
72
+ size: "sm",
73
+ leftIcon: "remove-tag",
74
+ onClick: onClose,
75
+ class: classes.close,
76
+ "data-pixel-component": "MpTagClose"
77
+ }
78
+ };
79
+ }
80
+ __name(tagConnect, "tagConnect");
81
+
82
+ // src/modules/tag.hooks.ts
83
+ var useTag = /* @__PURE__ */ __name((props, emit) => {
84
+ var _a;
85
+ const context = (0, import_vue2.ref)(props);
86
+ const {
87
+ state,
88
+ send
89
+ } = (0, import_vue3.useMachine)(tagMachine({
90
+ ...context.value,
91
+ id: (_a = context.value.id) != null ? _a : `mp-tag-${(0, import_pixel3_utils.useId)()}`,
92
+ onClick: (evt) => emit("click", evt),
93
+ onClose: (evt) => {
94
+ evt.stopPropagation();
95
+ emit("close", evt);
96
+ }
97
+ }));
98
+ const [tagProps] = import_recipes.tagSlotRecipe.splitVariantProps(context.value);
99
+ const classes = (0, import_recipes.tagSlotRecipe)(tagProps);
100
+ return (0, import_vue2.computed)(() => tagConnect(state.value, send, classes));
101
+ }, "useTag");
102
+ // Annotate the CommonJS export names for ESM import in node:
103
+ 0 && (module.exports = {
104
+ useTag
105
+ });
@@ -0,0 +1,9 @@
1
+ import {
2
+ useTag
3
+ } from "../chunk-J6ICIHXS.mjs";
4
+ import "../chunk-ETUG5QZG.mjs";
5
+ import "../chunk-AGP5VIAA.mjs";
6
+ import "../chunk-QZ7VFGWC.mjs";
7
+ export {
8
+ useTag
9
+ };
@@ -0,0 +1,10 @@
1
+ import * as xstate from 'xstate';
2
+ import { TagDefinedContext, TagProps } from './tag.types.mjs';
3
+ import '@mekari/pixel3-utils';
4
+
5
+ declare function tagMachine(context: TagDefinedContext): xstate.StateMachine<Pick<Partial<TagProps>, "id"> & Omit<TagProps, "id">, any, xstate.AnyEventObject, {
6
+ value: any;
7
+ context: Pick<Partial<TagProps>, "id"> & Omit<TagProps, "id">;
8
+ }, xstate.BaseActionObject, xstate.ServiceMap, xstate.ResolveTypegenMeta<xstate.TypegenDisabled, xstate.AnyEventObject, xstate.BaseActionObject, xstate.ServiceMap>>;
9
+
10
+ export { tagMachine };
@@ -0,0 +1,10 @@
1
+ import * as xstate from 'xstate';
2
+ import { TagDefinedContext, TagProps } from './tag.types.js';
3
+ import '@mekari/pixel3-utils';
4
+
5
+ declare function tagMachine(context: TagDefinedContext): xstate.StateMachine<Pick<Partial<TagProps>, "id"> & Omit<TagProps, "id">, any, xstate.AnyEventObject, {
6
+ value: any;
7
+ context: Pick<Partial<TagProps>, "id"> & Omit<TagProps, "id">;
8
+ }, xstate.BaseActionObject, xstate.ServiceMap, xstate.ResolveTypegenMeta<xstate.TypegenDisabled, xstate.AnyEventObject, xstate.BaseActionObject, xstate.ServiceMap>>;
9
+
10
+ export { tagMachine };
@@ -0,0 +1,40 @@
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/modules/tag.machines.ts
22
+ var tag_machines_exports = {};
23
+ __export(tag_machines_exports, {
24
+ tagMachine: () => tagMachine
25
+ });
26
+ module.exports = __toCommonJS(tag_machines_exports);
27
+ var import_xstate = require("xstate");
28
+ function tagMachine(context) {
29
+ return (0, import_xstate.createMachine)({
30
+ /** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgBcBDKfEABy1gEsDqsMyAPRARgCZ0BPN95f5EA */
31
+ id: "tag",
32
+ context,
33
+ predictableActionArguments: true
34
+ });
35
+ }
36
+ __name(tagMachine, "tagMachine");
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ tagMachine
40
+ });
@@ -0,0 +1,7 @@
1
+ import {
2
+ tagMachine
3
+ } from "../chunk-AGP5VIAA.mjs";
4
+ import "../chunk-QZ7VFGWC.mjs";
5
+ export {
6
+ tagMachine
7
+ };
@@ -0,0 +1,28 @@
1
+ import { TagSize, TagVariant } from './tag.types.mjs';
2
+ import { PropType } from 'vue';
3
+ import '@mekari/pixel3-utils';
4
+
5
+ declare const tagProps: {
6
+ as: {
7
+ type: PropType<keyof HTMLElementTagNameMap>;
8
+ default: string;
9
+ };
10
+ id: {
11
+ type: PropType<string | undefined>;
12
+ };
13
+ size: {
14
+ type: PropType<TagSize | undefined>;
15
+ default: string;
16
+ };
17
+ variant: {
18
+ type: PropType<TagVariant | undefined>;
19
+ default: string;
20
+ };
21
+ isClosable: {
22
+ type: PropType<boolean | undefined>;
23
+ default: boolean;
24
+ };
25
+ };
26
+ declare const tagEmits: ("click" | "close")[];
27
+
28
+ export { tagEmits, tagProps };
@@ -0,0 +1,28 @@
1
+ import { TagSize, TagVariant } from './tag.types.js';
2
+ import { PropType } from 'vue';
3
+ import '@mekari/pixel3-utils';
4
+
5
+ declare const tagProps: {
6
+ as: {
7
+ type: PropType<keyof HTMLElementTagNameMap>;
8
+ default: string;
9
+ };
10
+ id: {
11
+ type: PropType<string | undefined>;
12
+ };
13
+ size: {
14
+ type: PropType<TagSize | undefined>;
15
+ default: string;
16
+ };
17
+ variant: {
18
+ type: PropType<TagVariant | undefined>;
19
+ default: string;
20
+ };
21
+ isClosable: {
22
+ type: PropType<boolean | undefined>;
23
+ default: boolean;
24
+ };
25
+ };
26
+ declare const tagEmits: ("click" | "close")[];
27
+
28
+ export { tagEmits, tagProps };
@@ -0,0 +1,54 @@
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/tag.props.ts
21
+ var tag_props_exports = {};
22
+ __export(tag_props_exports, {
23
+ tagEmits: () => tagEmits,
24
+ tagProps: () => tagProps
25
+ });
26
+ module.exports = __toCommonJS(tag_props_exports);
27
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
28
+ var tagProps = {
29
+ as: {
30
+ type: String,
31
+ default: "button"
32
+ },
33
+ id: {
34
+ type: String
35
+ },
36
+ size: {
37
+ type: String,
38
+ default: "md"
39
+ },
40
+ variant: {
41
+ type: String,
42
+ default: "gray"
43
+ },
44
+ isClosable: {
45
+ type: Boolean,
46
+ default: false
47
+ }
48
+ };
49
+ var tagEmits = (0, import_pixel3_utils.declareEmit)(["click", "close"]);
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ tagEmits,
53
+ tagProps
54
+ });
@@ -0,0 +1,9 @@
1
+ import {
2
+ tagEmits,
3
+ tagProps
4
+ } from "../chunk-Q6L3MIBC.mjs";
5
+ import "../chunk-QZ7VFGWC.mjs";
6
+ export {
7
+ tagEmits,
8
+ tagProps
9
+ };
@@ -0,0 +1,32 @@
1
+ import { Optional, PropTypes } from '@mekari/pixel3-utils';
2
+
3
+ /**
4
+ * Exported tag types.
5
+ */
6
+
7
+ type TagVariant = 'gray' | 'red';
8
+ type TagSize = 'sm' | 'md';
9
+ interface TagProps {
10
+ id?: string;
11
+ size?: TagSize;
12
+ variant?: TagVariant;
13
+ isClosable?: boolean;
14
+ onClick?: (evt: MouseEvent | TouchEvent) => void;
15
+ onClose?: (evt: MouseEvent | TouchEvent) => void;
16
+ }
17
+ type TagDefinedContext = Optional<TagProps, 'id'>;
18
+ interface TagApiMachine<T extends PropTypes = PropTypes> {
19
+ isClosable?: boolean;
20
+ rootProps?: T['element'];
21
+ closeProps?: T['element'];
22
+ }
23
+ interface TagClasses {
24
+ root?: string;
25
+ close?: string;
26
+ }
27
+ interface TagState {
28
+ context: TagProps;
29
+ }
30
+ type TagSend = CallableFunction;
31
+
32
+ export { TagApiMachine, TagClasses, TagDefinedContext, TagProps, TagSend, TagSize, TagState, TagVariant };
@@ -0,0 +1,32 @@
1
+ import { Optional, PropTypes } from '@mekari/pixel3-utils';
2
+
3
+ /**
4
+ * Exported tag types.
5
+ */
6
+
7
+ type TagVariant = 'gray' | 'red';
8
+ type TagSize = 'sm' | 'md';
9
+ interface TagProps {
10
+ id?: string;
11
+ size?: TagSize;
12
+ variant?: TagVariant;
13
+ isClosable?: boolean;
14
+ onClick?: (evt: MouseEvent | TouchEvent) => void;
15
+ onClose?: (evt: MouseEvent | TouchEvent) => void;
16
+ }
17
+ type TagDefinedContext = Optional<TagProps, 'id'>;
18
+ interface TagApiMachine<T extends PropTypes = PropTypes> {
19
+ isClosable?: boolean;
20
+ rootProps?: T['element'];
21
+ closeProps?: T['element'];
22
+ }
23
+ interface TagClasses {
24
+ root?: string;
25
+ close?: string;
26
+ }
27
+ interface TagState {
28
+ context: TagProps;
29
+ }
30
+ type TagSend = CallableFunction;
31
+
32
+ export { TagApiMachine, TagClasses, TagDefinedContext, TagProps, TagSend, TagSize, TagState, TagVariant };
@@ -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/tag.types.ts
17
+ var tag_types_exports = {};
18
+ module.exports = __toCommonJS(tag_types_exports);
File without changes
package/dist/tag.d.mts ADDED
@@ -0,0 +1,58 @@
1
+ import { TagSize, TagVariant } from './modules/tag.types.mjs';
2
+ import * as vue from 'vue';
3
+ import '@mekari/pixel3-utils';
4
+
5
+ /**
6
+ * MpTag component used to display label that can optionally be selected and unselected or removed.
7
+ */
8
+ declare const MpTag: vue.DefineComponent<{
9
+ as: {
10
+ type: vue.PropType<keyof HTMLElementTagNameMap>;
11
+ default: string;
12
+ };
13
+ id: {
14
+ type: vue.PropType<string | undefined>;
15
+ };
16
+ size: {
17
+ type: vue.PropType<TagSize | undefined>;
18
+ default: string;
19
+ };
20
+ variant: {
21
+ type: vue.PropType<TagVariant | undefined>;
22
+ default: string;
23
+ };
24
+ isClosable: {
25
+ type: vue.PropType<boolean | undefined>;
26
+ default: boolean;
27
+ };
28
+ }, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("click" | "close")[], "click" | "close", vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
29
+ as: {
30
+ type: vue.PropType<keyof HTMLElementTagNameMap>;
31
+ default: string;
32
+ };
33
+ id: {
34
+ type: vue.PropType<string | undefined>;
35
+ };
36
+ size: {
37
+ type: vue.PropType<TagSize | undefined>;
38
+ default: string;
39
+ };
40
+ variant: {
41
+ type: vue.PropType<TagVariant | undefined>;
42
+ default: string;
43
+ };
44
+ isClosable: {
45
+ type: vue.PropType<boolean | undefined>;
46
+ default: boolean;
47
+ };
48
+ }>> & {
49
+ onClick?: ((...args: any[]) => any) | undefined;
50
+ onClose?: ((...args: any[]) => any) | undefined;
51
+ }, {
52
+ size: TagSize | undefined;
53
+ variant: TagVariant | undefined;
54
+ isClosable: boolean | undefined;
55
+ as: keyof HTMLElementTagNameMap;
56
+ }, {}>;
57
+
58
+ export { MpTag };
package/dist/tag.d.ts ADDED
@@ -0,0 +1,58 @@
1
+ import { TagSize, TagVariant } from './modules/tag.types.js';
2
+ import * as vue from 'vue';
3
+ import '@mekari/pixel3-utils';
4
+
5
+ /**
6
+ * MpTag component used to display label that can optionally be selected and unselected or removed.
7
+ */
8
+ declare const MpTag: vue.DefineComponent<{
9
+ as: {
10
+ type: vue.PropType<keyof HTMLElementTagNameMap>;
11
+ default: string;
12
+ };
13
+ id: {
14
+ type: vue.PropType<string | undefined>;
15
+ };
16
+ size: {
17
+ type: vue.PropType<TagSize | undefined>;
18
+ default: string;
19
+ };
20
+ variant: {
21
+ type: vue.PropType<TagVariant | undefined>;
22
+ default: string;
23
+ };
24
+ isClosable: {
25
+ type: vue.PropType<boolean | undefined>;
26
+ default: boolean;
27
+ };
28
+ }, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("click" | "close")[], "click" | "close", vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
29
+ as: {
30
+ type: vue.PropType<keyof HTMLElementTagNameMap>;
31
+ default: string;
32
+ };
33
+ id: {
34
+ type: vue.PropType<string | undefined>;
35
+ };
36
+ size: {
37
+ type: vue.PropType<TagSize | undefined>;
38
+ default: string;
39
+ };
40
+ variant: {
41
+ type: vue.PropType<TagVariant | undefined>;
42
+ default: string;
43
+ };
44
+ isClosable: {
45
+ type: vue.PropType<boolean | undefined>;
46
+ default: boolean;
47
+ };
48
+ }>> & {
49
+ onClick?: ((...args: any[]) => any) | undefined;
50
+ onClose?: ((...args: any[]) => any) | undefined;
51
+ }, {
52
+ size: TagSize | undefined;
53
+ variant: TagVariant | undefined;
54
+ isClosable: boolean | undefined;
55
+ as: keyof HTMLElementTagNameMap;
56
+ }, {}>;
57
+
58
+ export { MpTag };
package/dist/tag.js ADDED
@@ -0,0 +1,157 @@
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/tag.tsx
22
+ var tag_exports = {};
23
+ __export(tag_exports, {
24
+ MpTag: () => MpTag
25
+ });
26
+ module.exports = __toCommonJS(tag_exports);
27
+ var import_vue4 = require("vue");
28
+ var import_vue5 = require("vue");
29
+
30
+ // src/modules/tag.props.ts
31
+ var import_pixel3_utils = require("@mekari/pixel3-utils");
32
+ var tagProps = {
33
+ as: {
34
+ type: String,
35
+ default: "button"
36
+ },
37
+ id: {
38
+ type: String
39
+ },
40
+ size: {
41
+ type: String,
42
+ default: "md"
43
+ },
44
+ variant: {
45
+ type: String,
46
+ default: "gray"
47
+ },
48
+ isClosable: {
49
+ type: Boolean,
50
+ default: false
51
+ }
52
+ };
53
+ var tagEmits = (0, import_pixel3_utils.declareEmit)(["click", "close"]);
54
+
55
+ // src/modules/tag.hooks.ts
56
+ var import_vue2 = require("vue");
57
+ var import_vue3 = require("@xstate/vue");
58
+ var import_pixel3_utils2 = require("@mekari/pixel3-utils");
59
+ var import_recipes = require("@mekari/pixel3-styled-system/recipes");
60
+
61
+ // src/modules/tag.machines.ts
62
+ var import_xstate = require("xstate");
63
+ function tagMachine(context) {
64
+ return (0, import_xstate.createMachine)({
65
+ /** @xstate-layout N4IgpgJg5mDOIC5gF8A0IB2B7CdGgBcBDKfEABy1gEsDqsMyAPRARgCZ0BPN95f5EA */
66
+ id: "tag",
67
+ context,
68
+ predictableActionArguments: true
69
+ });
70
+ }
71
+ __name(tagMachine, "tagMachine");
72
+
73
+ // src/modules/tag.connects.ts
74
+ var import_vue = require("vue");
75
+ var import_css = require("@mekari/pixel3-styled-system/css");
76
+ function tagConnect(state, send, classes) {
77
+ const {
78
+ id,
79
+ isClosable,
80
+ onClick,
81
+ onClose
82
+ } = state.context;
83
+ const isClickable = (0, import_vue.computed)(() => {
84
+ var _a, _b;
85
+ return !!((_b = (_a = (0, import_vue.getCurrentInstance)()) == null ? void 0 : _a.vnode.props) == null ? void 0 : _b.onClick);
86
+ }).value;
87
+ return {
88
+ isClosable,
89
+ rootProps: {
90
+ id,
91
+ onClick,
92
+ class: (0, import_css.cx)(classes.root, "group"),
93
+ style: {
94
+ "--mp-tag--cursor": isClickable ? "pointer" : void 0
95
+ },
96
+ "data-pixel-component": "MpTag"
97
+ },
98
+ closeProps: {
99
+ id: `${id}-close`,
100
+ variant: "ghost",
101
+ size: "sm",
102
+ leftIcon: "remove-tag",
103
+ onClick: onClose,
104
+ class: classes.close,
105
+ "data-pixel-component": "MpTagClose"
106
+ }
107
+ };
108
+ }
109
+ __name(tagConnect, "tagConnect");
110
+
111
+ // src/modules/tag.hooks.ts
112
+ var useTag = /* @__PURE__ */ __name((props, emit) => {
113
+ var _a;
114
+ const context = (0, import_vue2.ref)(props);
115
+ const {
116
+ state,
117
+ send
118
+ } = (0, import_vue3.useMachine)(tagMachine({
119
+ ...context.value,
120
+ id: (_a = context.value.id) != null ? _a : `mp-tag-${(0, import_pixel3_utils2.useId)()}`,
121
+ onClick: (evt) => emit("click", evt),
122
+ onClose: (evt) => {
123
+ evt.stopPropagation();
124
+ emit("close", evt);
125
+ }
126
+ }));
127
+ const [tagProps2] = import_recipes.tagSlotRecipe.splitVariantProps(context.value);
128
+ const classes = (0, import_recipes.tagSlotRecipe)(tagProps2);
129
+ return (0, import_vue2.computed)(() => tagConnect(state.value, send, classes));
130
+ }, "useTag");
131
+
132
+ // src/tag.tsx
133
+ var import_pixel3_button = require("@mekari/pixel3-button");
134
+ var MpTag = (0, import_vue5.defineComponent)({
135
+ name: "MpTag",
136
+ props: tagProps,
137
+ emits: tagEmits,
138
+ setup(props, {
139
+ slots,
140
+ emit
141
+ }) {
142
+ const {
143
+ as: Component
144
+ } = (0, import_vue5.reactive)(props);
145
+ const api = useTag(props, emit);
146
+ return () => (0, import_vue4.createVNode)(Component, api.value.rootProps, {
147
+ default: () => {
148
+ var _a;
149
+ return [(_a = slots.default) == null ? void 0 : _a.call(slots), api.value.isClosable && (0, import_vue4.createVNode)(import_pixel3_button.MpButton, api.value.closeProps, null)];
150
+ }
151
+ });
152
+ }
153
+ });
154
+ // Annotate the CommonJS export names for ESM import in node:
155
+ 0 && (module.exports = {
156
+ MpTag
157
+ });
package/dist/tag.mjs ADDED
@@ -0,0 +1,11 @@
1
+ import {
2
+ MpTag
3
+ } from "./chunk-GRJUHSTY.mjs";
4
+ import "./chunk-J6ICIHXS.mjs";
5
+ import "./chunk-ETUG5QZG.mjs";
6
+ import "./chunk-AGP5VIAA.mjs";
7
+ import "./chunk-Q6L3MIBC.mjs";
8
+ import "./chunk-QZ7VFGWC.mjs";
9
+ export {
10
+ MpTag
11
+ };
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@mekari/pixel3-tag",
3
+ "description": "Mekari Pixel 3 | Tag component is used to display label that can optionally be selected and unselected or removed",
4
+ "version": "0.0.0",
5
+ "license": "LGPL-3.0",
6
+ "author": "Dirga Prakesha <dirga.prakesha@mekari.com>",
7
+ "sideEffects": false,
8
+ "main": "dist/index.js",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "dependencies": {
13
+ "@xstate/vue": "2.0.0",
14
+ "xstate": "4.35.0",
15
+ "@mekari/pixel3-button": "0.0.0",
16
+ "@mekari/pixel3-styled-system": "0.0.0",
17
+ "@mekari/pixel3-utils": "0.0.0"
18
+ },
19
+ "peerDependencies": {
20
+ "vue": "^3.3.7"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "devDependencies": {
26
+ "vue": "^3.3.7",
27
+ "@pandacss/dev": "0.10.0"
28
+ },
29
+ "module": "dist/index.mjs",
30
+ "types": "dist/index.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "require": "./dist/index.js",
35
+ "default": "./dist/index.mjs"
36
+ }
37
+ },
38
+ "scripts": {
39
+ "clean": "rimraf dist .turbo",
40
+ "build": "tsup && pnpm build:types",
41
+ "build:css": "pnpm build && pnpm css:gen",
42
+ "build:fast": "tsup",
43
+ "build:types": "tsup src --dts-only",
44
+ "build:external": "tsup src/index.tsx --external @acme-org/styled-system",
45
+ "types:check": "tsc --noEmit",
46
+ "css:gen": "panda cssgen --outfile dist/styles.css",
47
+ "replace-config": "clean-package",
48
+ "restore-config": "clean-package restore"
49
+ }
50
+ }