@mekari/pixel3-radio 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,36 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/modules/radio.props.ts
5
+ var radioProps = {
6
+ id: {
7
+ type: String,
8
+ default: ""
9
+ },
10
+ name: {
11
+ type: String
12
+ },
13
+ value: {
14
+ type: String
15
+ },
16
+ modelValue: {
17
+ type: String
18
+ },
19
+ isChecked: {
20
+ type: Boolean
21
+ },
22
+ isDisabled: {
23
+ type: Boolean
24
+ },
25
+ isInvalid: {
26
+ type: Boolean
27
+ },
28
+ isReadonly: {
29
+ type: Boolean
30
+ }
31
+ };
32
+
33
+ export {
34
+ __name,
35
+ radioProps
36
+ };
@@ -0,0 +1,97 @@
1
+ import {
2
+ __name,
3
+ radioProps
4
+ } from "./chunk-ISKDJ7UA.mjs";
5
+
6
+ // src/radio.tsx
7
+ import { isVNode as _isVNode, createVNode as _createVNode } from "vue";
8
+ import { defineComponent } from "vue";
9
+ import { MpText } from "@mekari/pixel3-text";
10
+ import { radioSlotRecipe, sharedSlotRecipe } from "@mekari/pixel3-styled-system/recipes";
11
+ function _isSlot(s) {
12
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !_isVNode(s);
13
+ }
14
+ __name(_isSlot, "_isSlot");
15
+ var MpRadio = defineComponent({
16
+ name: "MpRadio",
17
+ props: radioProps,
18
+ emits: ["click", "change", "update:isChecked", "update:modelValue"],
19
+ setup(props, {
20
+ slots,
21
+ emit
22
+ }) {
23
+ const classes = radioSlotRecipe();
24
+ const sharedClasses = sharedSlotRecipe();
25
+ const handleChecked = /* @__PURE__ */ __name(() => {
26
+ if (props.modelValue) {
27
+ return props.modelValue === props.value;
28
+ }
29
+ return props.isChecked;
30
+ }, "handleChecked");
31
+ const onChange = /* @__PURE__ */ __name(() => {
32
+ if (!props.isDisabled || !props.isReadonly) {
33
+ emit("change", !props.isChecked, props.value);
34
+ emit("update:modelValue", props.value);
35
+ emit("update:isChecked", !props.isChecked);
36
+ }
37
+ }, "onChange");
38
+ const onClick = /* @__PURE__ */ __name((event) => {
39
+ emit("click", event);
40
+ }, "onClick");
41
+ return () => {
42
+ const children = slots.default && slots.default();
43
+ const description = slots.description && slots.description();
44
+ const {
45
+ id,
46
+ name,
47
+ value,
48
+ isDisabled,
49
+ isInvalid,
50
+ isReadonly
51
+ } = props;
52
+ return _createVNode("label", {
53
+ "for": id,
54
+ "role": "radio",
55
+ "class": classes.root,
56
+ "data-pixel-component": "MpRadio",
57
+ "data-has-description": Boolean(description),
58
+ "aria-checked": handleChecked(),
59
+ "aria-disabled": isDisabled,
60
+ "aria-invalid": isInvalid,
61
+ "aria-readonly": isReadonly
62
+ }, [_createVNode("input", {
63
+ "id": id,
64
+ "class": sharedClasses.hidden,
65
+ "type": "radio",
66
+ "name": name,
67
+ "value": value,
68
+ "checked": handleChecked(),
69
+ "disabled": isDisabled ? true : void 0,
70
+ "onChange": onChange,
71
+ "onClick": onClick
72
+ }, null), _createVNode("div", {
73
+ "class": classes.control
74
+ }, [_createVNode("div", {
75
+ "style": {
76
+ visibility: handleChecked() ? "visible" : "hidden"
77
+ }
78
+ }, null)]), _createVNode("div", {
79
+ "class": classes.label
80
+ }, [_createVNode(MpText, {
81
+ "as": "span",
82
+ "size": "label",
83
+ "color": isDisabled ? "gray.400" : "dark"
84
+ }, _isSlot(children) ? children : {
85
+ default: () => [children]
86
+ }), description && _createVNode(MpText, {
87
+ "color": isDisabled ? "gray.400" : "gray.600"
88
+ }, _isSlot(description) ? description : {
89
+ default: () => [description]
90
+ })])]);
91
+ };
92
+ }
93
+ });
94
+
95
+ export {
96
+ MpRadio
97
+ };
@@ -0,0 +1,2 @@
1
+ export { MpRadio } from './radio.mjs';
2
+ import 'vue';
@@ -0,0 +1,2 @@
1
+ export { MpRadio } from './radio.js';
2
+ import 'vue';
package/dist/index.js ADDED
@@ -0,0 +1,150 @@
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
+ MpRadio: () => MpRadio
25
+ });
26
+ module.exports = __toCommonJS(src_exports);
27
+
28
+ // src/radio.tsx
29
+ var import_vue = require("vue");
30
+ var import_vue2 = require("vue");
31
+ var import_pixel3_text = require("@mekari/pixel3-text");
32
+ var import_recipes = require("@mekari/pixel3-styled-system/recipes");
33
+
34
+ // src/modules/radio.props.ts
35
+ var radioProps = {
36
+ id: {
37
+ type: String,
38
+ default: ""
39
+ },
40
+ name: {
41
+ type: String
42
+ },
43
+ value: {
44
+ type: String
45
+ },
46
+ modelValue: {
47
+ type: String
48
+ },
49
+ isChecked: {
50
+ type: Boolean
51
+ },
52
+ isDisabled: {
53
+ type: Boolean
54
+ },
55
+ isInvalid: {
56
+ type: Boolean
57
+ },
58
+ isReadonly: {
59
+ type: Boolean
60
+ }
61
+ };
62
+
63
+ // src/radio.tsx
64
+ function _isSlot(s) {
65
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, import_vue.isVNode)(s);
66
+ }
67
+ __name(_isSlot, "_isSlot");
68
+ var MpRadio = (0, import_vue2.defineComponent)({
69
+ name: "MpRadio",
70
+ props: radioProps,
71
+ emits: ["click", "change", "update:isChecked", "update:modelValue"],
72
+ setup(props, {
73
+ slots,
74
+ emit
75
+ }) {
76
+ const classes = (0, import_recipes.radioSlotRecipe)();
77
+ const sharedClasses = (0, import_recipes.sharedSlotRecipe)();
78
+ const handleChecked = /* @__PURE__ */ __name(() => {
79
+ if (props.modelValue) {
80
+ return props.modelValue === props.value;
81
+ }
82
+ return props.isChecked;
83
+ }, "handleChecked");
84
+ const onChange = /* @__PURE__ */ __name(() => {
85
+ if (!props.isDisabled || !props.isReadonly) {
86
+ emit("change", !props.isChecked, props.value);
87
+ emit("update:modelValue", props.value);
88
+ emit("update:isChecked", !props.isChecked);
89
+ }
90
+ }, "onChange");
91
+ const onClick = /* @__PURE__ */ __name((event) => {
92
+ emit("click", event);
93
+ }, "onClick");
94
+ return () => {
95
+ const children = slots.default && slots.default();
96
+ const description = slots.description && slots.description();
97
+ const {
98
+ id,
99
+ name,
100
+ value,
101
+ isDisabled,
102
+ isInvalid,
103
+ isReadonly
104
+ } = props;
105
+ return (0, import_vue.createVNode)("label", {
106
+ "for": id,
107
+ "role": "radio",
108
+ "class": classes.root,
109
+ "data-pixel-component": "MpRadio",
110
+ "data-has-description": Boolean(description),
111
+ "aria-checked": handleChecked(),
112
+ "aria-disabled": isDisabled,
113
+ "aria-invalid": isInvalid,
114
+ "aria-readonly": isReadonly
115
+ }, [(0, import_vue.createVNode)("input", {
116
+ "id": id,
117
+ "class": sharedClasses.hidden,
118
+ "type": "radio",
119
+ "name": name,
120
+ "value": value,
121
+ "checked": handleChecked(),
122
+ "disabled": isDisabled ? true : void 0,
123
+ "onChange": onChange,
124
+ "onClick": onClick
125
+ }, null), (0, import_vue.createVNode)("div", {
126
+ "class": classes.control
127
+ }, [(0, import_vue.createVNode)("div", {
128
+ "style": {
129
+ visibility: handleChecked() ? "visible" : "hidden"
130
+ }
131
+ }, null)]), (0, import_vue.createVNode)("div", {
132
+ "class": classes.label
133
+ }, [(0, import_vue.createVNode)(import_pixel3_text.MpText, {
134
+ "as": "span",
135
+ "size": "label",
136
+ "color": isDisabled ? "gray.400" : "dark"
137
+ }, _isSlot(children) ? children : {
138
+ default: () => [children]
139
+ }), description && (0, import_vue.createVNode)(import_pixel3_text.MpText, {
140
+ "color": isDisabled ? "gray.400" : "gray.600"
141
+ }, _isSlot(description) ? description : {
142
+ default: () => [description]
143
+ })])]);
144
+ };
145
+ }
146
+ });
147
+ // Annotate the CommonJS export names for ESM import in node:
148
+ 0 && (module.exports = {
149
+ MpRadio
150
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,7 @@
1
+ import {
2
+ MpRadio
3
+ } from "./chunk-N5I6KEUN.mjs";
4
+ import "./chunk-ISKDJ7UA.mjs";
5
+ export {
6
+ MpRadio
7
+ };
@@ -0,0 +1 @@
1
+ {"inputs":{"src/modules/radio.props.ts":{"bytes":434,"imports":[],"format":"esm"},"src/radio.tsx":{"bytes":2944,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-text","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"src/modules/radio.props.ts","kind":"import-statement","original":"./modules/radio.props"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.tsx":{"bytes":119,"imports":[{"path":"src/radio.tsx","kind":"import-statement","original":"./radio"}],"format":"esm"}},"outputs":{"dist/index.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-text","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.tsx","inputs":{"src/index.tsx":{"bytesInOutput":119},"src/radio.tsx":{"bytesInOutput":3052},"src/modules/radio.props.ts":{"bytesInOutput":325}},"bytes":4571},"dist/radio.js":{"imports":[{"path":"vue","kind":"require-call","external":true},{"path":"vue","kind":"require-call","external":true},{"path":"@mekari/pixel3-text","kind":"require-call","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/radio.tsx","inputs":{"src/radio.tsx":{"bytesInOutput":3177},"src/modules/radio.props.ts":{"bytesInOutput":325}},"bytes":4559},"dist/modules/radio.props.js":{"imports":[],"exports":[],"entryPoint":"src/modules/radio.props.ts","inputs":{"src/modules/radio.props.ts":{"bytesInOutput":474}},"bytes":1408}}}
@@ -0,0 +1 @@
1
+ {"inputs":{"src/modules/radio.props.ts":{"bytes":434,"imports":[],"format":"esm"},"src/radio.tsx":{"bytes":2944,"imports":[{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-text","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true},{"path":"src/modules/radio.props.ts","kind":"import-statement","original":"./modules/radio.props"},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.tsx":{"bytes":119,"imports":[{"path":"src/radio.tsx","kind":"import-statement","original":"./radio"}],"format":"esm"}},"outputs":{"dist/index.mjs":{"imports":[{"path":"dist/chunk-N5I6KEUN.mjs","kind":"import-statement"},{"path":"dist/chunk-ISKDJ7UA.mjs","kind":"import-statement"}],"exports":["MpRadio"],"entryPoint":"src/index.tsx","inputs":{"src/index.tsx":{"bytesInOutput":0}},"bytes":103},"dist/radio.mjs":{"imports":[{"path":"dist/chunk-N5I6KEUN.mjs","kind":"import-statement"},{"path":"dist/chunk-ISKDJ7UA.mjs","kind":"import-statement"}],"exports":["MpRadio"],"entryPoint":"src/radio.tsx","inputs":{},"bytes":103},"dist/chunk-N5I6KEUN.mjs":{"imports":[{"path":"dist/chunk-ISKDJ7UA.mjs","kind":"import-statement"},{"path":"vue","kind":"import-statement","external":true},{"path":"vue","kind":"import-statement","external":true},{"path":"@mekari/pixel3-text","kind":"import-statement","external":true},{"path":"@mekari/pixel3-styled-system/recipes","kind":"import-statement","external":true}],"exports":["MpRadio"],"inputs":{"src/radio.tsx":{"bytesInOutput":2890}},"bytes":2994},"dist/modules/radio.props.mjs":{"imports":[{"path":"dist/chunk-ISKDJ7UA.mjs","kind":"import-statement"}],"exports":["radioProps"],"entryPoint":"src/modules/radio.props.ts","inputs":{},"bytes":79},"dist/chunk-ISKDJ7UA.mjs":{"imports":[],"exports":["__name","radioProps"],"inputs":{"src/modules/radio.props.ts":{"bytesInOutput":325}},"bytes":521}}}
@@ -0,0 +1,29 @@
1
+ declare const radioProps: {
2
+ id: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ name: {
7
+ type: StringConstructor;
8
+ };
9
+ value: {
10
+ type: StringConstructor;
11
+ };
12
+ modelValue: {
13
+ type: StringConstructor;
14
+ };
15
+ isChecked: {
16
+ type: BooleanConstructor;
17
+ };
18
+ isDisabled: {
19
+ type: BooleanConstructor;
20
+ };
21
+ isInvalid: {
22
+ type: BooleanConstructor;
23
+ };
24
+ isReadonly: {
25
+ type: BooleanConstructor;
26
+ };
27
+ };
28
+
29
+ export { radioProps };
@@ -0,0 +1,29 @@
1
+ declare const radioProps: {
2
+ id: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ name: {
7
+ type: StringConstructor;
8
+ };
9
+ value: {
10
+ type: StringConstructor;
11
+ };
12
+ modelValue: {
13
+ type: StringConstructor;
14
+ };
15
+ isChecked: {
16
+ type: BooleanConstructor;
17
+ };
18
+ isDisabled: {
19
+ type: BooleanConstructor;
20
+ };
21
+ isInvalid: {
22
+ type: BooleanConstructor;
23
+ };
24
+ isReadonly: {
25
+ type: BooleanConstructor;
26
+ };
27
+ };
28
+
29
+ export { radioProps };
@@ -0,0 +1,56 @@
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/radio.props.ts
21
+ var radio_props_exports = {};
22
+ __export(radio_props_exports, {
23
+ radioProps: () => radioProps
24
+ });
25
+ module.exports = __toCommonJS(radio_props_exports);
26
+ var radioProps = {
27
+ id: {
28
+ type: String,
29
+ default: ""
30
+ },
31
+ name: {
32
+ type: String
33
+ },
34
+ value: {
35
+ type: String
36
+ },
37
+ modelValue: {
38
+ type: String
39
+ },
40
+ isChecked: {
41
+ type: Boolean
42
+ },
43
+ isDisabled: {
44
+ type: Boolean
45
+ },
46
+ isInvalid: {
47
+ type: Boolean
48
+ },
49
+ isReadonly: {
50
+ type: Boolean
51
+ }
52
+ };
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
55
+ radioProps
56
+ });
@@ -0,0 +1,6 @@
1
+ import {
2
+ radioProps
3
+ } from "../chunk-ISKDJ7UA.mjs";
4
+ export {
5
+ radioProps
6
+ };
@@ -0,0 +1,68 @@
1
+ import * as vue from 'vue';
2
+
3
+ declare const MpRadio: vue.DefineComponent<{
4
+ id: {
5
+ type: StringConstructor;
6
+ default: string;
7
+ };
8
+ name: {
9
+ type: StringConstructor;
10
+ };
11
+ value: {
12
+ type: StringConstructor;
13
+ };
14
+ modelValue: {
15
+ type: StringConstructor;
16
+ };
17
+ isChecked: {
18
+ type: BooleanConstructor;
19
+ };
20
+ isDisabled: {
21
+ type: BooleanConstructor;
22
+ };
23
+ isInvalid: {
24
+ type: BooleanConstructor;
25
+ };
26
+ isReadonly: {
27
+ type: BooleanConstructor;
28
+ };
29
+ }, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("click" | "change" | "update:isChecked" | "update:modelValue")[], "click" | "change" | "update:isChecked" | "update:modelValue", vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
30
+ id: {
31
+ type: StringConstructor;
32
+ default: string;
33
+ };
34
+ name: {
35
+ type: StringConstructor;
36
+ };
37
+ value: {
38
+ type: StringConstructor;
39
+ };
40
+ modelValue: {
41
+ type: StringConstructor;
42
+ };
43
+ isChecked: {
44
+ type: BooleanConstructor;
45
+ };
46
+ isDisabled: {
47
+ type: BooleanConstructor;
48
+ };
49
+ isInvalid: {
50
+ type: BooleanConstructor;
51
+ };
52
+ isReadonly: {
53
+ type: BooleanConstructor;
54
+ };
55
+ }>> & {
56
+ onChange?: ((...args: any[]) => any) | undefined;
57
+ onClick?: ((...args: any[]) => any) | undefined;
58
+ "onUpdate:isChecked"?: ((...args: any[]) => any) | undefined;
59
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
60
+ }, {
61
+ id: string;
62
+ isChecked: boolean;
63
+ isDisabled: boolean;
64
+ isInvalid: boolean;
65
+ isReadonly: boolean;
66
+ }, {}>;
67
+
68
+ export { MpRadio };
@@ -0,0 +1,68 @@
1
+ import * as vue from 'vue';
2
+
3
+ declare const MpRadio: vue.DefineComponent<{
4
+ id: {
5
+ type: StringConstructor;
6
+ default: string;
7
+ };
8
+ name: {
9
+ type: StringConstructor;
10
+ };
11
+ value: {
12
+ type: StringConstructor;
13
+ };
14
+ modelValue: {
15
+ type: StringConstructor;
16
+ };
17
+ isChecked: {
18
+ type: BooleanConstructor;
19
+ };
20
+ isDisabled: {
21
+ type: BooleanConstructor;
22
+ };
23
+ isInvalid: {
24
+ type: BooleanConstructor;
25
+ };
26
+ isReadonly: {
27
+ type: BooleanConstructor;
28
+ };
29
+ }, () => JSX.Element, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, ("click" | "change" | "update:isChecked" | "update:modelValue")[], "click" | "change" | "update:isChecked" | "update:modelValue", vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{
30
+ id: {
31
+ type: StringConstructor;
32
+ default: string;
33
+ };
34
+ name: {
35
+ type: StringConstructor;
36
+ };
37
+ value: {
38
+ type: StringConstructor;
39
+ };
40
+ modelValue: {
41
+ type: StringConstructor;
42
+ };
43
+ isChecked: {
44
+ type: BooleanConstructor;
45
+ };
46
+ isDisabled: {
47
+ type: BooleanConstructor;
48
+ };
49
+ isInvalid: {
50
+ type: BooleanConstructor;
51
+ };
52
+ isReadonly: {
53
+ type: BooleanConstructor;
54
+ };
55
+ }>> & {
56
+ onChange?: ((...args: any[]) => any) | undefined;
57
+ onClick?: ((...args: any[]) => any) | undefined;
58
+ "onUpdate:isChecked"?: ((...args: any[]) => any) | undefined;
59
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
60
+ }, {
61
+ id: string;
62
+ isChecked: boolean;
63
+ isDisabled: boolean;
64
+ isInvalid: boolean;
65
+ isReadonly: boolean;
66
+ }, {}>;
67
+
68
+ export { MpRadio };
package/dist/radio.js ADDED
@@ -0,0 +1,148 @@
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/radio.tsx
22
+ var radio_exports = {};
23
+ __export(radio_exports, {
24
+ MpRadio: () => MpRadio
25
+ });
26
+ module.exports = __toCommonJS(radio_exports);
27
+ var import_vue = require("vue");
28
+ var import_vue2 = require("vue");
29
+ var import_pixel3_text = require("@mekari/pixel3-text");
30
+ var import_recipes = require("@mekari/pixel3-styled-system/recipes");
31
+
32
+ // src/modules/radio.props.ts
33
+ var radioProps = {
34
+ id: {
35
+ type: String,
36
+ default: ""
37
+ },
38
+ name: {
39
+ type: String
40
+ },
41
+ value: {
42
+ type: String
43
+ },
44
+ modelValue: {
45
+ type: String
46
+ },
47
+ isChecked: {
48
+ type: Boolean
49
+ },
50
+ isDisabled: {
51
+ type: Boolean
52
+ },
53
+ isInvalid: {
54
+ type: Boolean
55
+ },
56
+ isReadonly: {
57
+ type: Boolean
58
+ }
59
+ };
60
+
61
+ // src/radio.tsx
62
+ function _isSlot(s) {
63
+ return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !(0, import_vue.isVNode)(s);
64
+ }
65
+ __name(_isSlot, "_isSlot");
66
+ var MpRadio = (0, import_vue2.defineComponent)({
67
+ name: "MpRadio",
68
+ props: radioProps,
69
+ emits: ["click", "change", "update:isChecked", "update:modelValue"],
70
+ setup(props, {
71
+ slots,
72
+ emit
73
+ }) {
74
+ const classes = (0, import_recipes.radioSlotRecipe)();
75
+ const sharedClasses = (0, import_recipes.sharedSlotRecipe)();
76
+ const handleChecked = /* @__PURE__ */ __name(() => {
77
+ if (props.modelValue) {
78
+ return props.modelValue === props.value;
79
+ }
80
+ return props.isChecked;
81
+ }, "handleChecked");
82
+ const onChange = /* @__PURE__ */ __name(() => {
83
+ if (!props.isDisabled || !props.isReadonly) {
84
+ emit("change", !props.isChecked, props.value);
85
+ emit("update:modelValue", props.value);
86
+ emit("update:isChecked", !props.isChecked);
87
+ }
88
+ }, "onChange");
89
+ const onClick = /* @__PURE__ */ __name((event) => {
90
+ emit("click", event);
91
+ }, "onClick");
92
+ return () => {
93
+ const children = slots.default && slots.default();
94
+ const description = slots.description && slots.description();
95
+ const {
96
+ id,
97
+ name,
98
+ value,
99
+ isDisabled,
100
+ isInvalid,
101
+ isReadonly
102
+ } = props;
103
+ return (0, import_vue.createVNode)("label", {
104
+ "for": id,
105
+ "role": "radio",
106
+ "class": classes.root,
107
+ "data-pixel-component": "MpRadio",
108
+ "data-has-description": Boolean(description),
109
+ "aria-checked": handleChecked(),
110
+ "aria-disabled": isDisabled,
111
+ "aria-invalid": isInvalid,
112
+ "aria-readonly": isReadonly
113
+ }, [(0, import_vue.createVNode)("input", {
114
+ "id": id,
115
+ "class": sharedClasses.hidden,
116
+ "type": "radio",
117
+ "name": name,
118
+ "value": value,
119
+ "checked": handleChecked(),
120
+ "disabled": isDisabled ? true : void 0,
121
+ "onChange": onChange,
122
+ "onClick": onClick
123
+ }, null), (0, import_vue.createVNode)("div", {
124
+ "class": classes.control
125
+ }, [(0, import_vue.createVNode)("div", {
126
+ "style": {
127
+ visibility: handleChecked() ? "visible" : "hidden"
128
+ }
129
+ }, null)]), (0, import_vue.createVNode)("div", {
130
+ "class": classes.label
131
+ }, [(0, import_vue.createVNode)(import_pixel3_text.MpText, {
132
+ "as": "span",
133
+ "size": "label",
134
+ "color": isDisabled ? "gray.400" : "dark"
135
+ }, _isSlot(children) ? children : {
136
+ default: () => [children]
137
+ }), description && (0, import_vue.createVNode)(import_pixel3_text.MpText, {
138
+ "color": isDisabled ? "gray.400" : "gray.600"
139
+ }, _isSlot(description) ? description : {
140
+ default: () => [description]
141
+ })])]);
142
+ };
143
+ }
144
+ });
145
+ // Annotate the CommonJS export names for ESM import in node:
146
+ 0 && (module.exports = {
147
+ MpRadio
148
+ });
package/dist/radio.mjs ADDED
@@ -0,0 +1,7 @@
1
+ import {
2
+ MpRadio
3
+ } from "./chunk-N5I6KEUN.mjs";
4
+ import "./chunk-ISKDJ7UA.mjs";
5
+ export {
6
+ MpRadio
7
+ };
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@mekari/pixel3-radio",
3
+ "description": "Radio 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-text": "0.0.0",
12
+ "@mekari/pixel3-styled-system": "0.0.0"
13
+ },
14
+ "peerDependencies": {
15
+ "vue": "^3.3.7"
16
+ },
17
+ "devDependencies": {
18
+ "vue": "^3.3.7"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "module": "dist/index.mjs",
24
+ "types": "dist/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "require": "./dist/index.js",
29
+ "default": "./dist/index.mjs"
30
+ }
31
+ },
32
+ "scripts": {
33
+ "clean": "rimraf dist .turbo",
34
+ "build": "tsup && pnpm build:types",
35
+ "build:fast": "tsup",
36
+ "build:types": "tsup src --dts-only",
37
+ "build:external": "tsup src/index.tsx --external",
38
+ "types:check": "tsc --noEmit",
39
+ "replace-config": "clean-package",
40
+ "restore-config": "clean-package restore"
41
+ }
42
+ }