@cypress-design/vue-checkbox 0.1.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/CHANGELOG.md +11 -0
- package/Checkbox.stories.tsx +12 -0
- package/Checkbox.vue +48 -0
- package/dist/Checkbox.vue.d.ts +40 -0
- package/dist/Checkbox.vue.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +51 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.map +1 -0
- package/index.ts +1 -0
- package/package.json +22 -0
- package/tsconfig.build.json +7 -0
- package/tsconfig.json +4 -0
- package/vite.config.ts +7 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @cypress-design/vue-checkbox
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#7](https://github.com/cypress-io/cypress-design/pull/7) [`04ae342`](https://github.com/cypress-io/cypress-design/commit/04ae342db01cf9db0eb6a3a99f8c0539d31ede04) Thanks [@elevatebart](https://github.com/elevatebart)! - Initial release of CSS:
|
|
8
|
+
|
|
9
|
+
Initial release of the following components
|
|
10
|
+
|
|
11
|
+
- Checkbox
|
package/Checkbox.vue
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="relative flex items-center">
|
|
3
|
+
<div class="flex items-center h-5">
|
|
4
|
+
<input :id="id" :checked="modelValue" :aria-describedby="`${id}-description`" :name="id" type="checkbox"
|
|
5
|
+
class="border-1 rounded border-gray-200 bg-white h-4 w-4 text-indigo-500 disabled:bg-gray-100 checked:bg-indigo-500"
|
|
6
|
+
:class="{
|
|
7
|
+
'text-indigo-500 checked:border-indigo-300 checked:bg-indigo-600 checked:text-indigo-600':
|
|
8
|
+
state === 'default',
|
|
9
|
+
'checked:border-jade-300 checked:bg-jade-600 checked:text-jade-600':
|
|
10
|
+
state === 'success',
|
|
11
|
+
'checked:border-red-300 checked:bg-red-600 checked:text-red-600':
|
|
12
|
+
state === 'danger',
|
|
13
|
+
}" @click="updated()" />
|
|
14
|
+
</div>
|
|
15
|
+
<div class="ml-2 text-16px leading-normal">
|
|
16
|
+
<slot name="label">
|
|
17
|
+
<label v-if="label" :for="id" class="disabled:text-gray-500 text-gray-800 font-light select-none">
|
|
18
|
+
{{ label }}
|
|
19
|
+
</label>
|
|
20
|
+
</slot>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script lang="ts" setup>
|
|
26
|
+
type InputState = 'success' | 'danger' | 'default';
|
|
27
|
+
|
|
28
|
+
const props = withDefaults(
|
|
29
|
+
defineProps<{
|
|
30
|
+
id: string;
|
|
31
|
+
modelValue: boolean;
|
|
32
|
+
state?: InputState;
|
|
33
|
+
label?: string;
|
|
34
|
+
}>(),
|
|
35
|
+
{
|
|
36
|
+
state: 'default',
|
|
37
|
+
label: undefined,
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const emit = defineEmits<{
|
|
42
|
+
(event: 'update:modelValue', value: boolean): void;
|
|
43
|
+
}>();
|
|
44
|
+
|
|
45
|
+
function updated() {
|
|
46
|
+
emit('update:modelValue', !props.modelValue)
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
id: string;
|
|
3
|
+
modelValue: boolean;
|
|
4
|
+
state?: ("default" | "success" | "danger") | undefined;
|
|
5
|
+
label?: string | undefined;
|
|
6
|
+
}>, {
|
|
7
|
+
state: string;
|
|
8
|
+
label: undefined;
|
|
9
|
+
}>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
"update:modelValue": (value: boolean) => void;
|
|
11
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
12
|
+
id: string;
|
|
13
|
+
modelValue: boolean;
|
|
14
|
+
state?: ("default" | "success" | "danger") | undefined;
|
|
15
|
+
label?: string | undefined;
|
|
16
|
+
}>, {
|
|
17
|
+
state: string;
|
|
18
|
+
label: undefined;
|
|
19
|
+
}>>> & {
|
|
20
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
state: "default" | "success" | "danger";
|
|
23
|
+
label: string;
|
|
24
|
+
}>;
|
|
25
|
+
export default _default;
|
|
26
|
+
declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
27
|
+
declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
28
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
29
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
30
|
+
} : {
|
|
31
|
+
type: import('vue').PropType<T[K]>;
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
declare type __VLS_WithDefaults<P, D> = {
|
|
36
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
37
|
+
default: D[K];
|
|
38
|
+
} : P[K];
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=Checkbox.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.vue.d.ts","sourceRoot":"","sources":["../Checkbox.vue.ts"],"names":[],"mappings":";QA8BQ,MAAM;gBACE,OAAO;;;;;;;;;QADf,MAAM;gBACE,OAAO;;;;;;;;;;;;AA9BvB,wBAwFK;AACL,aAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,aAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC;AAC9M,aAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAE5B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG;QACzD,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KACb,GAAG,CAAC,CAAC,CAAC,CAAC;CACR,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, createElementVNode, normalizeClass, renderSlot, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
+
const _hoisted_1 = { class: "relative flex items-center" };
|
|
3
|
+
const _hoisted_2 = { class: "flex items-center h-5" };
|
|
4
|
+
const _hoisted_3 = ["id", "checked", "aria-describedby", "name"];
|
|
5
|
+
const _hoisted_4 = { class: "ml-2 text-16px leading-normal" };
|
|
6
|
+
const _hoisted_5 = ["for"];
|
|
7
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
+
props: {
|
|
9
|
+
id: null,
|
|
10
|
+
modelValue: { type: Boolean },
|
|
11
|
+
state: { default: "default" },
|
|
12
|
+
label: { default: void 0 }
|
|
13
|
+
},
|
|
14
|
+
emits: ["update:modelValue"],
|
|
15
|
+
setup(__props, { emit }) {
|
|
16
|
+
const props = __props;
|
|
17
|
+
function updated() {
|
|
18
|
+
emit("update:modelValue", !props.modelValue);
|
|
19
|
+
}
|
|
20
|
+
return (_ctx, _cache) => {
|
|
21
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
22
|
+
createElementVNode("div", _hoisted_2, [
|
|
23
|
+
createElementVNode("input", {
|
|
24
|
+
id: __props.id,
|
|
25
|
+
checked: __props.modelValue,
|
|
26
|
+
"aria-describedby": `${__props.id}-description`,
|
|
27
|
+
name: __props.id,
|
|
28
|
+
type: "checkbox",
|
|
29
|
+
class: normalizeClass(["border-1 rounded border-gray-200 bg-white h-4 w-4 text-indigo-500 disabled:bg-gray-100 checked:bg-indigo-500", {
|
|
30
|
+
"text-indigo-500 checked:border-indigo-300 checked:bg-indigo-600 checked:text-indigo-600": __props.state === "default",
|
|
31
|
+
"checked:border-jade-300 checked:bg-jade-600 checked:text-jade-600": __props.state === "success",
|
|
32
|
+
"checked:border-red-300 checked:bg-red-600 checked:text-red-600": __props.state === "danger"
|
|
33
|
+
}]),
|
|
34
|
+
onClick: _cache[0] || (_cache[0] = ($event) => updated())
|
|
35
|
+
}, null, 10, _hoisted_3)
|
|
36
|
+
]),
|
|
37
|
+
createElementVNode("div", _hoisted_4, [
|
|
38
|
+
renderSlot(_ctx.$slots, "label", {}, () => [
|
|
39
|
+
__props.label ? (openBlock(), createElementBlock("label", {
|
|
40
|
+
key: 0,
|
|
41
|
+
for: __props.id,
|
|
42
|
+
class: "disabled:text-gray-500 text-gray-800 font-light select-none"
|
|
43
|
+
}, toDisplayString(__props.label), 9, _hoisted_5)) : createCommentVNode("", true)
|
|
44
|
+
])
|
|
45
|
+
])
|
|
46
|
+
]);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
export { _sfc_main as default };
|
|
51
|
+
//# sourceMappingURL=index.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../Checkbox.vue"],"sourcesContent":["<template>\n <div class=\"relative flex items-center\">\n <div class=\"flex items-center h-5\">\n <input :id=\"id\" :checked=\"modelValue\" :aria-describedby=\"`${id}-description`\" :name=\"id\" type=\"checkbox\"\n class=\"border-1 rounded border-gray-200 bg-white h-4 w-4 text-indigo-500 disabled:bg-gray-100 checked:bg-indigo-500\"\n :class=\"{\n 'text-indigo-500 checked:border-indigo-300 checked:bg-indigo-600 checked:text-indigo-600':\n state === 'default',\n 'checked:border-jade-300 checked:bg-jade-600 checked:text-jade-600':\n state === 'success',\n 'checked:border-red-300 checked:bg-red-600 checked:text-red-600':\n state === 'danger',\n }\" @click=\"updated()\" />\n </div>\n <div class=\"ml-2 text-16px leading-normal\">\n <slot name=\"label\">\n <label v-if=\"label\" :for=\"id\" class=\"disabled:text-gray-500 text-gray-800 font-light select-none\">\n {{ label }}\n </label>\n </slot>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\ntype InputState = 'success' | 'danger' | 'default';\n\nconst props = withDefaults(\n defineProps<{\n id: string;\n modelValue: boolean;\n state?: InputState;\n label?: string;\n }>(),\n {\n state: 'default',\n label: undefined,\n }\n);\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', value: boolean): void;\n}>();\n\nfunction updated() {\n emit('update:modelValue', !props.modelValue)\n}\n</script>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA4CmB,uBAAA;AACZ,WAAA,qBAAqB,CAAC,MAAM,UAAU;AAAA,IAC7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(function(e,d){typeof exports=="object"&&typeof module!="undefined"?module.exports=d(require("vue")):typeof define=="function"&&define.amd?define(["vue"],d):(e=typeof globalThis!="undefined"?globalThis:e||self,e.Checkbox=d(e.Vue))})(this,function(e){"use strict";const d={class:"relative flex items-center"},n={class:"flex items-center h-5"},c=["id","checked","aria-describedby","name"],l={class:"ml-2 text-16px leading-normal"},o=["for"];return e.defineComponent({props:{id:null,modelValue:{type:Boolean},state:{default:"default"},label:{default:void 0}},emits:["update:modelValue"],setup(t,{emit:a}){const s=t;function r(){a("update:modelValue",!s.modelValue)}return(m,i)=>(e.openBlock(),e.createElementBlock("div",d,[e.createElementVNode("div",n,[e.createElementVNode("input",{id:t.id,checked:t.modelValue,"aria-describedby":`${t.id}-description`,name:t.id,type:"checkbox",class:e.normalizeClass(["border-1 rounded border-gray-200 bg-white h-4 w-4 text-indigo-500 disabled:bg-gray-100 checked:bg-indigo-500",{"text-indigo-500 checked:border-indigo-300 checked:bg-indigo-600 checked:text-indigo-600":t.state==="default","checked:border-jade-300 checked:bg-jade-600 checked:text-jade-600":t.state==="success","checked:border-red-300 checked:bg-red-600 checked:text-red-600":t.state==="danger"}]),onClick:i[0]||(i[0]=b=>r())},null,10,c)]),e.createElementVNode("div",l,[e.renderSlot(m.$slots,"label",{},()=>[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.id,class:"disabled:text-gray-500 text-gray-800 font-light select-none"},e.toDisplayString(t.label),9,o)):e.createCommentVNode("",!0)])])]))}})});
|
|
2
|
+
//# sourceMappingURL=index.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../Checkbox.vue"],"sourcesContent":["<template>\n <div class=\"relative flex items-center\">\n <div class=\"flex items-center h-5\">\n <input :id=\"id\" :checked=\"modelValue\" :aria-describedby=\"`${id}-description`\" :name=\"id\" type=\"checkbox\"\n class=\"border-1 rounded border-gray-200 bg-white h-4 w-4 text-indigo-500 disabled:bg-gray-100 checked:bg-indigo-500\"\n :class=\"{\n 'text-indigo-500 checked:border-indigo-300 checked:bg-indigo-600 checked:text-indigo-600':\n state === 'default',\n 'checked:border-jade-300 checked:bg-jade-600 checked:text-jade-600':\n state === 'success',\n 'checked:border-red-300 checked:bg-red-600 checked:text-red-600':\n state === 'danger',\n }\" @click=\"updated()\" />\n </div>\n <div class=\"ml-2 text-16px leading-normal\">\n <slot name=\"label\">\n <label v-if=\"label\" :for=\"id\" class=\"disabled:text-gray-500 text-gray-800 font-light select-none\">\n {{ label }}\n </label>\n </slot>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\ntype InputState = 'success' | 'danger' | 'default';\n\nconst props = withDefaults(\n defineProps<{\n id: string;\n modelValue: boolean;\n state?: InputState;\n label?: string;\n }>(),\n {\n state: 'default',\n label: undefined,\n }\n);\n\nconst emit = defineEmits<{\n (event: 'update:modelValue', value: boolean): void;\n}>();\n\nfunction updated() {\n emit('update:modelValue', !props.modelValue)\n}\n</script>\n"],"names":[],"mappings":"omBA4CmB,YAAA,CACZ,EAAA,oBAAqB,CAAC,EAAM,UAAU,CAC7C"}
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Checkbox.vue';
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cypress-design/vue-checkbox",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"files": [
|
|
5
|
+
"*"
|
|
6
|
+
],
|
|
7
|
+
"typings": "./dist/index.d.ts",
|
|
8
|
+
"main": "./dist/index.umd.js",
|
|
9
|
+
"module": "./dist/index.es.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.es.js",
|
|
13
|
+
"require": "./dist/index.umd.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "yarn build:module && yarn build:types",
|
|
18
|
+
"build:module": "yarn vite build",
|
|
19
|
+
"build:types": "yarn vue-tsc --project ./tsconfig.build.json"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT"
|
|
22
|
+
}
|
package/tsconfig.json
ADDED