@crystal-neuo/vue 0.0.0-stage → 4.0.1
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/LICENSE +21 -0
- package/README.md +6 -2
- package/dist/Alert.d.ts +24 -0
- package/dist/Alert.d.ts.map +1 -0
- package/dist/Alert.js +6 -0
- package/dist/Alert.js.map +1 -0
- package/dist/Alert.vue_vue_type_script_setup_true_lang.js +41 -0
- package/dist/Alert.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Avatar.d.ts +16 -0
- package/dist/Avatar.d.ts.map +1 -0
- package/dist/Avatar.js +6 -0
- package/dist/Avatar.js.map +1 -0
- package/dist/Avatar.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/Avatar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Badge.d.ts +24 -0
- package/dist/Badge.d.ts.map +1 -0
- package/dist/Badge.js +6 -0
- package/dist/Badge.js.map +1 -0
- package/dist/Badge.vue_vue_type_script_setup_true_lang.js +23 -0
- package/dist/Badge.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Breadcrumb.d.ts +17 -0
- package/dist/Breadcrumb.d.ts.map +1 -0
- package/dist/Breadcrumb.js +6 -0
- package/dist/Breadcrumb.js.map +1 -0
- package/dist/Breadcrumb.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/Breadcrumb.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Button.d.ts +34 -0
- package/dist/Button.d.ts.map +1 -0
- package/dist/Button.js +6 -0
- package/dist/Button.js.map +1 -0
- package/dist/Button.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/Button.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Card.d.ts +24 -0
- package/dist/Card.d.ts.map +1 -0
- package/dist/Card.js +6 -0
- package/dist/Card.js.map +1 -0
- package/dist/Card.vue_vue_type_script_setup_true_lang.js +23 -0
- package/dist/Card.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Checkbox.d.ts +24 -0
- package/dist/Checkbox.d.ts.map +1 -0
- package/dist/Checkbox.js +6 -0
- package/dist/Checkbox.js.map +1 -0
- package/dist/Checkbox.vue_vue_type_script_setup_true_lang.js +55 -0
- package/dist/Checkbox.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/DatePicker.d.ts +25 -0
- package/dist/DatePicker.d.ts.map +1 -0
- package/dist/DatePicker.js +6 -0
- package/dist/DatePicker.js.map +1 -0
- package/dist/DatePicker.vue_vue_type_script_setup_true_lang.js +62 -0
- package/dist/DatePicker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Dialog.d.ts +40 -0
- package/dist/Dialog.d.ts.map +1 -0
- package/dist/Dialog.js +6 -0
- package/dist/Dialog.js.map +1 -0
- package/dist/Dialog.vue_vue_type_script_setup_true_lang.js +75 -0
- package/dist/Dialog.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Drawer.d.ts +33 -0
- package/dist/Drawer.d.ts.map +1 -0
- package/dist/Drawer.js +6 -0
- package/dist/Drawer.js.map +1 -0
- package/dist/Drawer.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/Drawer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/FileUpload.d.ts +33 -0
- package/dist/FileUpload.d.ts.map +1 -0
- package/dist/FileUpload.js +6 -0
- package/dist/FileUpload.js.map +1 -0
- package/dist/FileUpload.vue_vue_type_script_setup_true_lang.js +108 -0
- package/dist/FileUpload.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Input.d.ts +27 -0
- package/dist/Input.d.ts.map +1 -0
- package/dist/Input.js +6 -0
- package/dist/Input.js.map +1 -0
- package/dist/Input.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/Input.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/List.d.ts +24 -0
- package/dist/List.d.ts.map +1 -0
- package/dist/List.js +6 -0
- package/dist/List.js.map +1 -0
- package/dist/List.vue_vue_type_script_setup_true_lang.js +23 -0
- package/dist/List.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/ListItem.d.ts +19 -0
- package/dist/ListItem.d.ts.map +1 -0
- package/dist/ListItem.js +6 -0
- package/dist/ListItem.js.map +1 -0
- package/dist/ListItem.vue_vue_type_script_setup_true_lang.js +21 -0
- package/dist/ListItem.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Menu.d.ts +25 -0
- package/dist/Menu.d.ts.map +1 -0
- package/dist/Menu.js +6 -0
- package/dist/Menu.js.map +1 -0
- package/dist/Menu.vue_vue_type_script_setup_true_lang.js +94 -0
- package/dist/Menu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Modal.d.ts +31 -0
- package/dist/Modal.d.ts.map +1 -0
- package/dist/Modal.js +6 -0
- package/dist/Modal.js.map +1 -0
- package/dist/Modal.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/Modal.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Nav.d.ts +23 -0
- package/dist/Nav.d.ts.map +1 -0
- package/dist/Nav.js +6 -0
- package/dist/Nav.js.map +1 -0
- package/dist/Nav.vue_vue_type_script_setup_true_lang.js +24 -0
- package/dist/Nav.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/NavLink.d.ts +21 -0
- package/dist/NavLink.d.ts.map +1 -0
- package/dist/NavLink.js +6 -0
- package/dist/NavLink.js.map +1 -0
- package/dist/NavLink.vue_vue_type_script_setup_true_lang.js +29 -0
- package/dist/NavLink.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Pagination.d.ts +24 -0
- package/dist/Pagination.d.ts.map +1 -0
- package/dist/Pagination.js +6 -0
- package/dist/Pagination.js.map +1 -0
- package/dist/Pagination.vue_vue_type_script_setup_true_lang.js +84 -0
- package/dist/Pagination.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Progress.d.ts +19 -0
- package/dist/Progress.d.ts.map +1 -0
- package/dist/Progress.js +6 -0
- package/dist/Progress.js.map +1 -0
- package/dist/Progress.vue_vue_type_script_setup_true_lang.js +40 -0
- package/dist/Progress.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Radio.d.ts +29 -0
- package/dist/Radio.d.ts.map +1 -0
- package/dist/Radio.js +6 -0
- package/dist/Radio.js.map +1 -0
- package/dist/Radio.vue_vue_type_script_setup_true_lang.js +51 -0
- package/dist/Radio.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/SegmentedControl.d.ts +32 -0
- package/dist/SegmentedControl.d.ts.map +1 -0
- package/dist/SegmentedControl.js +6 -0
- package/dist/SegmentedControl.js.map +1 -0
- package/dist/SegmentedControl.vue_vue_type_script_setup_true_lang.js +47 -0
- package/dist/SegmentedControl.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Select.d.ts +29 -0
- package/dist/Select.d.ts.map +1 -0
- package/dist/Select.js +6 -0
- package/dist/Select.js.map +1 -0
- package/dist/Select.vue_vue_type_script_setup_true_lang.js +69 -0
- package/dist/Select.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Sheet.d.ts +28 -0
- package/dist/Sheet.d.ts.map +1 -0
- package/dist/Sheet.js +6 -0
- package/dist/Sheet.js.map +1 -0
- package/dist/Sheet.vue_vue_type_script_setup_true_lang.js +52 -0
- package/dist/Sheet.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Skeleton.d.ts +14 -0
- package/dist/Skeleton.d.ts.map +1 -0
- package/dist/Skeleton.js +6 -0
- package/dist/Skeleton.js.map +1 -0
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang.js +24 -0
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Slider.d.ts +29 -0
- package/dist/Slider.d.ts.map +1 -0
- package/dist/Slider.js +6 -0
- package/dist/Slider.js.map +1 -0
- package/dist/Slider.vue_vue_type_script_setup_true_lang.js +61 -0
- package/dist/Slider.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/TabBar.d.ts +27 -0
- package/dist/TabBar.d.ts.map +1 -0
- package/dist/TabBar.js +6 -0
- package/dist/TabBar.js.map +1 -0
- package/dist/TabBar.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/TabBar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Table.d.ts +32 -0
- package/dist/Table.d.ts.map +1 -0
- package/dist/Table.js +6 -0
- package/dist/Table.js.map +1 -0
- package/dist/Table.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/Table.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Tabs.d.ts +39 -0
- package/dist/Tabs.d.ts.map +1 -0
- package/dist/Tabs.js +6 -0
- package/dist/Tabs.js.map +1 -0
- package/dist/Tabs.vue_vue_type_script_setup_true_lang.js +82 -0
- package/dist/Tabs.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Textarea.d.ts +26 -0
- package/dist/Textarea.d.ts.map +1 -0
- package/dist/Textarea.js +6 -0
- package/dist/Textarea.js.map +1 -0
- package/dist/Textarea.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/Textarea.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Toast.d.ts +31 -0
- package/dist/Toast.d.ts.map +1 -0
- package/dist/Toast.js +6 -0
- package/dist/Toast.js.map +1 -0
- package/dist/Toast.vue_vue_type_script_setup_true_lang.js +75 -0
- package/dist/Toast.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Toggle.d.ts +22 -0
- package/dist/Toggle.d.ts.map +1 -0
- package/dist/Toggle.js +6 -0
- package/dist/Toggle.js.map +1 -0
- package/dist/Toggle.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/Toggle.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/Tooltip.d.ts +22 -0
- package/dist/Tooltip.d.ts.map +1 -0
- package/dist/Tooltip.js +6 -0
- package/dist/Tooltip.js.map +1 -0
- package/dist/Tooltip.vue_vue_type_script_setup_true_lang.js +36 -0
- package/dist/Tooltip.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/cn.d.ts +2 -0
- package/dist/cn.d.ts.map +1 -0
- package/dist/cn.js +7 -0
- package/dist/cn.js.map +1 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/useControlAttrs.d.ts +16 -0
- package/dist/useControlAttrs.d.ts.map +1 -0
- package/dist/useControlAttrs.js +18 -0
- package/dist/useControlAttrs.js.map +1 -0
- package/dist/useFocusTrap.d.ts +10 -0
- package/dist/useFocusTrap.d.ts.map +1 -0
- package/dist/useFocusTrap.js +37 -0
- package/dist/useFocusTrap.js.map +1 -0
- package/dist/useModalDialog.d.ts +12 -0
- package/dist/useModalDialog.d.ts.map +1 -0
- package/dist/useModalDialog.js +29 -0
- package/dist/useModalDialog.js.map +1 -0
- package/package.json +42 -4
- package/src/Alert.vue +31 -0
- package/src/Avatar.vue +35 -0
- package/src/Badge.vue +21 -0
- package/src/Breadcrumb.vue +34 -0
- package/src/Button.vue +38 -0
- package/src/Card.vue +21 -0
- package/src/Checkbox.vue +56 -0
- package/src/DatePicker.vue +51 -0
- package/src/Dialog.vue +73 -0
- package/src/Drawer.vue +55 -0
- package/src/FileUpload.vue +107 -0
- package/src/Input.vue +58 -0
- package/src/List.vue +23 -0
- package/src/ListItem.vue +12 -0
- package/src/Menu.vue +132 -0
- package/src/Modal.vue +44 -0
- package/src/Nav.vue +18 -0
- package/src/NavLink.vue +20 -0
- package/src/Pagination.vue +69 -0
- package/src/Progress.vue +41 -0
- package/src/Radio.vue +53 -0
- package/src/SegmentedControl.vue +53 -0
- package/src/Select.vue +62 -0
- package/src/Sheet.vue +40 -0
- package/src/Skeleton.vue +18 -0
- package/src/Slider.vue +49 -0
- package/src/TabBar.vue +39 -0
- package/src/Table.vue +47 -0
- package/src/Tabs.vue +95 -0
- package/src/Textarea.vue +58 -0
- package/src/Toast.vue +83 -0
- package/src/Toggle.vue +45 -0
- package/src/Tooltip.vue +39 -0
- package/src/cn.ts +5 -0
- package/src/index.ts +47 -0
- package/src/shims-vue.d.ts +5 -0
- package/src/useControlAttrs.ts +18 -0
- package/src/useFocusTrap.ts +74 -0
- package/src/useModalDialog.ts +65 -0
package/dist/Input.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { InputSize, Material } from "@crystal-neuo/contract";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
material?: Material;
|
|
4
|
+
size?: InputSize;
|
|
5
|
+
label?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
hint?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
type?: string;
|
|
12
|
+
};
|
|
13
|
+
type __VLS_ModelProps = {
|
|
14
|
+
modelValue?: string;
|
|
15
|
+
};
|
|
16
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
17
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
+
"update:modelValue": (value: string) => any;
|
|
19
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
20
|
+
"onUpdate:modelValue"?: (value: string) => any;
|
|
21
|
+
}>, {
|
|
22
|
+
size: "sm" | "md" | "lg";
|
|
23
|
+
type: string;
|
|
24
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
27
|
+
//# sourceMappingURL=Input.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.vue.d.ts","sourceRoot":"","sources":["../src/Input.vue"],"names":[],"mappings":"AA8DA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAOlE,KAAK,WAAW,GAAG;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAyBJ,KAAK,gBAAgB,GAAG;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAOF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AA2DxD,QAAA,MAAM,YAAY;;;;;;;6EAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
package/dist/Input.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.js","names":["_sfc_main","Input_vue_vue_type_script_setup_true_lang_default","Input_default"],"sources":["../src/Input.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useId } from \"vue\";\nimport type { InputSize, Material } from \"@crystal-neuo/contract\";\nimport { cn } from \"./cn.ts\";\nimport { useControlAttrs } from \"./useControlAttrs.ts\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(\n defineProps<{\n material?: Material;\n size?: InputSize;\n label?: string;\n error?: string;\n hint?: string;\n id?: string;\n placeholder?: string;\n disabled?: boolean;\n type?: string;\n }>(),\n { size: \"md\", type: \"text\" },\n);\n\nconst model = defineModel<string>({ default: \"\" });\n\nconst autoId = useId();\nconst inputId = computed(() => props.id ?? autoId);\nconst msgId = computed(() => `${inputId.value}-msg`);\nconst hintId = computed(() => `${inputId.value}-hint`);\nconst describedBy = computed(\n () =>\n [props.error ? msgId.value : null, props.hint ? hintId.value : null].filter(Boolean).join(\" \") ||\n undefined,\n);\nconst inputClass = computed(() =>\n cn(\"cn-input\", `cn-input--size-${props.size}`, props.error && \"cn-input--error\"),\n);\nconst { rootAttrs, controlAttrs } = useControlAttrs();\n</script>\n\n<template>\n <div v-bind=\"rootAttrs\" class=\"cn-field\" data-slot=\"input-field\" :data-material=\"props.material\">\n <label v-if=\"label\" class=\"cn-field__label\" :for=\"inputId\">{{ label }}</label>\n <input\n v-bind=\"controlAttrs\"\n :id=\"inputId\"\n v-model=\"model\"\n :class=\"inputClass\"\n :type=\"type\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :aria-invalid=\"error ? true : undefined\"\n :aria-describedby=\"describedBy\"\n />\n <span v-if=\"hint && !error\" class=\"cn-field__hint\" :id=\"hintId\">{{ hint }}</span>\n <span v-if=\"error\" class=\"cn-field__message\" :id=\"msgId\">{{ error }}</span>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { cn as e } from "./cn.js";
|
|
2
|
+
import { useControlAttrs as t } from "./useControlAttrs.js";
|
|
3
|
+
import { computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, mergeModels as s, mergeProps as c, openBlock as l, toDisplayString as u, unref as d, useId as f, useModel as p, vModelDynamic as m, withDirectives as h } from "vue";
|
|
4
|
+
// src/Input.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var g = ["data-material"], _ = ["for"], v = [
|
|
6
|
+
"id",
|
|
7
|
+
"type",
|
|
8
|
+
"placeholder",
|
|
9
|
+
"disabled",
|
|
10
|
+
"aria-invalid",
|
|
11
|
+
"aria-describedby"
|
|
12
|
+
], y = ["id"], b = ["id"], x = /*@__PURE__*/ o({
|
|
13
|
+
inheritAttrs: !1,
|
|
14
|
+
__name: "Input",
|
|
15
|
+
props: /*@__PURE__*/ s({
|
|
16
|
+
material: {},
|
|
17
|
+
size: { default: "md" },
|
|
18
|
+
label: {},
|
|
19
|
+
error: {},
|
|
20
|
+
hint: {},
|
|
21
|
+
id: {},
|
|
22
|
+
placeholder: {},
|
|
23
|
+
disabled: { type: Boolean },
|
|
24
|
+
type: { default: "text" }
|
|
25
|
+
}, {
|
|
26
|
+
modelValue: { default: "" },
|
|
27
|
+
modelModifiers: {}
|
|
28
|
+
}),
|
|
29
|
+
emits: ["update:modelValue"],
|
|
30
|
+
setup(o) {
|
|
31
|
+
let s = o, x = p(o, "modelValue"), S = f(), C = n(() => s.id ?? S), w = n(() => `${C.value}-msg`), T = n(() => `${C.value}-hint`), E = n(() => [s.error ? w.value : null, s.hint ? T.value : null].filter(Boolean).join(" ") || void 0), D = n(() => e("cn-input", `cn-input--size-${s.size}`, s.error && "cn-input--error")), { rootAttrs: O, controlAttrs: k } = t();
|
|
32
|
+
return (e, t) => (l(), i("div", c(d(O), {
|
|
33
|
+
class: "cn-field",
|
|
34
|
+
"data-slot": "input-field",
|
|
35
|
+
"data-material": s.material
|
|
36
|
+
}), [
|
|
37
|
+
o.label ? (l(), i("label", {
|
|
38
|
+
key: 0,
|
|
39
|
+
class: "cn-field__label",
|
|
40
|
+
for: C.value
|
|
41
|
+
}, u(o.label), 9, _)) : r("", !0),
|
|
42
|
+
h(a("input", c(d(k), {
|
|
43
|
+
id: C.value,
|
|
44
|
+
"onUpdate:modelValue": t[0] ||= (e) => x.value = e,
|
|
45
|
+
class: D.value,
|
|
46
|
+
type: o.type,
|
|
47
|
+
placeholder: o.placeholder,
|
|
48
|
+
disabled: o.disabled,
|
|
49
|
+
"aria-invalid": o.error ? !0 : void 0,
|
|
50
|
+
"aria-describedby": E.value
|
|
51
|
+
}), null, 16, v), [[m, x.value]]),
|
|
52
|
+
o.hint && !o.error ? (l(), i("span", {
|
|
53
|
+
key: 1,
|
|
54
|
+
class: "cn-field__hint",
|
|
55
|
+
id: T.value
|
|
56
|
+
}, u(o.hint), 9, y)) : r("", !0),
|
|
57
|
+
o.error ? (l(), i("span", {
|
|
58
|
+
key: 2,
|
|
59
|
+
class: "cn-field__message",
|
|
60
|
+
id: w.value
|
|
61
|
+
}, u(o.error), 9, b)) : r("", !0)
|
|
62
|
+
], 16, g));
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
export { x as default };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=Input.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createElementBlock","_mergeProps","_unref","_toDisplayString","_createCommentVNode","_withDirectives","_createElementVNode","_vModelDynamic","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","Input_vue_vue_type_script_setup_true_lang_default","\"modelValue\"","\"modelModifiers\"","props","__props","model","useModel","autoId","useId","inputId","computed","msgId","hintId","describedBy","inputClass","cn","useControlAttrs","openBlock","createElementBlock","mergeProps","unref","rootAttrs","toDisplayString","createCommentVNode","withDirectives","createElementVNode","controlAttrs","_cache","$event","vModelDynamic"],"sources":["../src/Input.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useId } from \"vue\";\nimport type { InputSize, Material } from \"@crystal-neuo/contract\";\nimport { cn } from \"./cn.ts\";\nimport { useControlAttrs } from \"./useControlAttrs.ts\";\n\ndefineOptions({ inheritAttrs: false });\n\nconst props = withDefaults(\n defineProps<{\n material?: Material;\n size?: InputSize;\n label?: string;\n error?: string;\n hint?: string;\n id?: string;\n placeholder?: string;\n disabled?: boolean;\n type?: string;\n }>(),\n { size: \"md\", type: \"text\" },\n);\n\nconst model = defineModel<string>({ default: \"\" });\n\nconst autoId = useId();\nconst inputId = computed(() => props.id ?? autoId);\nconst msgId = computed(() => `${inputId.value}-msg`);\nconst hintId = computed(() => `${inputId.value}-hint`);\nconst describedBy = computed(\n () =>\n [props.error ? msgId.value : null, props.hint ? hintId.value : null].filter(Boolean).join(\" \") ||\n undefined,\n);\nconst inputClass = computed(() =>\n cn(\"cn-input\", `cn-input--size-${props.size}`, props.error && \"cn-input--error\"),\n);\nconst { rootAttrs, controlAttrs } = useControlAttrs();\n</script>\n\n<template>\n <div v-bind=\"rootAttrs\" class=\"cn-field\" data-slot=\"input-field\" :data-material=\"props.material\">\n <label v-if=\"label\" class=\"cn-field__label\" :for=\"inputId\">{{ label }}</label>\n <input\n v-bind=\"controlAttrs\"\n :id=\"inputId\"\n v-model=\"model\"\n :class=\"inputClass\"\n :type=\"type\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :aria-invalid=\"error ? true : undefined\"\n :aria-describedby=\"describedBy\"\n />\n <span v-if=\"hint && !error\" class=\"cn-field__hint\" :id=\"hintId\">{{ hint }}</span>\n <span v-if=\"error\" class=\"cn-field__message\" :id=\"msgId\">{{ error }}</span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQA,IAAMkB,IAAQC,GAeRC,IAAQpB,EAAmBmB,GAAA,YAAgB,GAE3CG,IAASC,EAAM,GACfC,IAAUC,QAAeP,EAAM,MAAMI,CAAM,GAC3CI,IAAQD,QAAe,GAAGD,EAAQ,MAAM,KAAK,GAC7CG,IAASF,QAAe,GAAGD,EAAQ,MAAM,MAAM,GAC/CI,IAAcH,QAEhB,CAACP,EAAM,QAAQQ,EAAM,QAAQ,MAAMR,EAAM,OAAOS,EAAO,QAAQ,IAAI,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,KAC7F,KAAA,CACJ,GACME,IAAaJ,QACjBK,EAAG,YAAY,kBAAkBZ,EAAM,QAAQA,EAAM,SAAS,iBAAiB,CACjF,GACM,EAAE,cAAW,oBAAiBa,EAAgB;E,kBAIlD9B,EAAA,GAAAC,EAeM,OAfNC,EAAaC,EAePgC,CAAA,GAfgB;GAAE,OAAM;GAAW,aAAU;GAAe,iBAAelB,EAAM;;GACxEC,EAAA,SAAblB,EAAA,GAAAC,EAA8E,SAAA;;IAA1D,OAAM;IAAmB,KAAKsB,EAAA;GAAY,GAAAnB,EAAAc,EAAA,KAAK,GAAA,GAAAR,CAAA,K;GACnEJ,EAAAC,EAUE,SAVFL,EACUC,EASRqC,CAAA,GAToB;IACnB,IAAIjB,EAAA;IACI,uBAAA,AAAAkB,EAAA,QAAA,MAAA,EAAK,QAAAC;IACb,OAAOd,EAAA;IACP,MAAMV,EAAA;IACN,aAAaA,EAAA;IACb,UAAUA,EAAA;IACV,gBAAcA,EAAA,QAAK,KAAU,KAAA;IAC7B,oBAAkBS,EAAA;G,mBANV,CAAAnB,GAAAW,EAAA,KAAK,C;GAQJD,EAAA,QAAI,CAAKA,EAAA,SAArBlB,EAAA,GAAAC,EAAiF,QAAA;;IAArD,OAAM;IAAkB,IAAIyB,EAAA;GAAW,GAAAtB,EAAAc,EAAA,IAAI,GAAA,GAAAN,CAAA,K;GAC3DM,EAAA,SAAZlB,EAAA,GAAAC,EAA2E,QAAA;;IAAxD,OAAM;IAAqB,IAAIwB,EAAA;GAAU,GAAArB,EAAAc,EAAA,KAAK,GAAA,GAAAL,CAAA,K"}
|
package/dist/List.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ListVariant, ListSize, Material } from "@crystal-neuo/contract";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
material?: Material;
|
|
4
|
+
variant?: ListVariant;
|
|
5
|
+
size?: ListSize;
|
|
6
|
+
class?: string;
|
|
7
|
+
};
|
|
8
|
+
declare var __VLS_1: {};
|
|
9
|
+
type __VLS_Slots = {} & {
|
|
10
|
+
default?: (props: typeof __VLS_1) => any;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
13
|
+
variant: "plain" | "bordered";
|
|
14
|
+
size: "sm" | "md";
|
|
15
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
17
|
+
declare const _default: typeof __VLS_export;
|
|
18
|
+
export default _default;
|
|
19
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
20
|
+
new (): {
|
|
21
|
+
$slots: S;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=List.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.vue.d.ts","sourceRoot":"","sources":["../src/List.vue"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAI9E,KAAK,WAAW,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAAC,OAAO,CAAC,EAAE,WAAW,CAAC;IAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAqCnG,QAAA,IAAI,OAAO,IAAW,CAAC;AACvB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,QAAA,MAAM,UAAU;;;6EAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
package/dist/List.js
ADDED
package/dist/List.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.js","names":["_sfc_main","List_vue_vue_type_script_setup_true_lang_default","List_default"],"sources":["../src/List.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport type { ListVariant, ListSize, Material } from \"@crystal-neuo/contract\";\nimport { cn } from \"./cn.ts\";\n\nconst props = withDefaults(\n defineProps<{ material?: Material; variant?: ListVariant; size?: ListSize; class?: string }>(),\n {\n variant: \"plain\",\n size: \"md\",\n },\n);\n\nconst classes = computed(() =>\n cn(\"cn-list\", `cn-list--${props.variant}`, `cn-list--size-${props.size}`, props.class),\n);\n</script>\n\n<template>\n <ul data-slot=\"list\" :data-material=\"props.material\" :class=\"classes\">\n <slot />\n </ul>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { cn as e } from "./cn.js";
|
|
2
|
+
import { computed as t, createElementBlock as n, defineComponent as r, normalizeClass as i, openBlock as a, renderSlot as o } from "vue";
|
|
3
|
+
// src/List.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var s = ["data-material"], c = /*@__PURE__*/ r({
|
|
5
|
+
__name: "List",
|
|
6
|
+
props: {
|
|
7
|
+
material: {},
|
|
8
|
+
variant: { default: "plain" },
|
|
9
|
+
size: { default: "md" },
|
|
10
|
+
class: {}
|
|
11
|
+
},
|
|
12
|
+
setup(r) {
|
|
13
|
+
let c = r, l = t(() => e("cn-list", `cn-list--${c.variant}`, `cn-list--size-${c.size}`, c.class));
|
|
14
|
+
return (e, t) => (a(), n("ul", {
|
|
15
|
+
"data-slot": "list",
|
|
16
|
+
"data-material": c.material,
|
|
17
|
+
class: i(l.value)
|
|
18
|
+
}, [o(e.$slots, "default")], 10, s));
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
export { c as default };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=List.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_hoisted_1","List_vue_vue_type_script_setup_true_lang_default","props","__props","classes","computed","cn","openBlock","createElementBlock","normalizeClass","renderSlot","_ctx"],"sources":["../src/List.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport type { ListVariant, ListSize, Material } from \"@crystal-neuo/contract\";\nimport { cn } from \"./cn.ts\";\n\nconst props = withDefaults(\n defineProps<{ material?: Material; variant?: ListVariant; size?: ListSize; class?: string }>(),\n {\n variant: \"plain\",\n size: \"md\",\n },\n);\n\nconst classes = computed(() =>\n cn(\"cn-list\", `cn-list--${props.variant}`, `cn-list--size-${props.size}`, props.class),\n);\n</script>\n\n<template>\n <ul data-slot=\"list\" :data-material=\"props.material\" :class=\"classes\">\n <slot />\n </ul>\n</template>\n"],"mappings":";;;;;;;;;;;;EAKA,IAAMM,IAAQC,GAQRC,IAAUC,QACdC,EAAG,WAAW,YAAYJ,EAAM,WAAW,iBAAiBA,EAAM,QAAQA,EAAM,KAAK,CACvF;E,kBAIEN,EAAA,GAAAC,EAEK,MAAA;GAFD,aAAU;GAAQ,iBAAeK,EAAM;GAAW,OAAKJ,EAAEM,EAAA,KAAO;E,IAClEL,EAAQY,EAAA,QAAA,SAAA,C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Material } from "@crystal-neuo/contract";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
material?: Material;
|
|
4
|
+
class?: string;
|
|
5
|
+
};
|
|
6
|
+
declare var __VLS_1: {};
|
|
7
|
+
type __VLS_Slots = {} & {
|
|
8
|
+
default?: (props: typeof __VLS_1) => any;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=ListItem.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListItem.vue.d.ts","sourceRoot":"","sources":["../src/ListItem.vue"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAKvD,KAAK,WAAW,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAuB3D,QAAA,IAAI,OAAO,IAAW,CAAC;AACvB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,QAAA,MAAM,UAAU,kSAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
package/dist/ListItem.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListItem.js","names":["_sfc_main","ListItem_vue_vue_type_script_setup_true_lang_default","ListItem_default"],"sources":["../src/ListItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Material } from \"@crystal-neuo/contract\";\nimport { computed } from \"vue\";\nimport { cn } from \"./cn.ts\";\n\nconst props = defineProps<{ material?: Material; class?: string }>();\nconst classes = computed(() => cn(\"cn-list__item\", props.class));\n</script>\n\n<template>\n <li data-slot=\"list-item\" :data-material=\"props.material\" :class=\"classes\"><slot /></li>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { cn as e } from "./cn.js";
|
|
2
|
+
import { computed as t, createElementBlock as n, defineComponent as r, normalizeClass as i, openBlock as a, renderSlot as o } from "vue";
|
|
3
|
+
// src/ListItem.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var s = ["data-material"], c = /*@__PURE__*/ r({
|
|
5
|
+
__name: "ListItem",
|
|
6
|
+
props: {
|
|
7
|
+
material: {},
|
|
8
|
+
class: {}
|
|
9
|
+
},
|
|
10
|
+
setup(r) {
|
|
11
|
+
let c = r, l = t(() => e("cn-list__item", c.class));
|
|
12
|
+
return (e, t) => (a(), n("li", {
|
|
13
|
+
"data-slot": "list-item",
|
|
14
|
+
"data-material": c.material,
|
|
15
|
+
class: i(l.value)
|
|
16
|
+
}, [o(e.$slots, "default")], 10, s));
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export { c as default };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=ListItem.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListItem.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_hoisted_1","ListItem_vue_vue_type_script_setup_true_lang_default","props","__props","classes","computed","cn","openBlock","createElementBlock","normalizeClass","renderSlot","_ctx"],"sources":["../src/ListItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Material } from \"@crystal-neuo/contract\";\nimport { computed } from \"vue\";\nimport { cn } from \"./cn.ts\";\n\nconst props = defineProps<{ material?: Material; class?: string }>();\nconst classes = computed(() => cn(\"cn-list__item\", props.class));\n</script>\n\n<template>\n <li data-slot=\"list-item\" :data-material=\"props.material\" :class=\"classes\"><slot /></li>\n</template>\n"],"mappings":";;;;;;;;;;EAKA,IAAMM,IAAQC,GACRC,IAAUC,QAAeC,EAAG,iBAAiBJ,EAAM,KAAK,CAAC;E,kBAI7DN,EAAA,GAAAC,EAAwF,MAAA;GAApF,aAAU;GAAa,iBAAeK,EAAM;GAAW,OAAKJ,EAAEM,EAAA,KAAO;E,IAAEL,EAAQY,EAAA,QAAA,SAAA,C"}
|
package/dist/Menu.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ButtonVariant, type MenuEntry, type Material } from "@crystal-neuo/contract";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
material?: Material;
|
|
4
|
+
/** Trigger button text; use the `trigger` slot for richer content. */
|
|
5
|
+
label?: string;
|
|
6
|
+
items: MenuEntry[];
|
|
7
|
+
triggerVariant?: ButtonVariant;
|
|
8
|
+
class?: string;
|
|
9
|
+
};
|
|
10
|
+
declare var __VLS_1: {};
|
|
11
|
+
type __VLS_Slots = {} & {
|
|
12
|
+
trigger?: (props: typeof __VLS_1) => any;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
15
|
+
triggerVariant: "primary" | "secondary" | "ghost" | "danger";
|
|
16
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
18
|
+
declare const _default: typeof __VLS_export;
|
|
19
|
+
export default _default;
|
|
20
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
21
|
+
new (): {
|
|
22
|
+
$slots: S;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=Menu.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.vue.d.ts","sourceRoot":"","sources":["../src/Menu.vue"],"names":[],"mappings":"AAwIA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,QAAQ,EACd,MAAM,wBAAwB,CAAC;AAIhC,KAAK,WAAW,GAAG;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AA+JJ,QAAA,IAAI,OAAO,IAAW,CAAC;AACvB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,QAAA,MAAM,UAAU;;6EAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
package/dist/Menu.js
ADDED
package/dist/Menu.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.js","names":["_sfc_main","Menu_vue_vue_type_script_setup_true_lang_default","Menu_default"],"sources":["../src/Menu.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, useId } from \"vue\";\nimport {\n menuNavigation,\n supportsAnchorPositioning,\n type ButtonVariant,\n type MenuEntry,\n type Material,\n} from \"@crystal-neuo/contract\";\nimport { cn } from \"./cn.ts\";\n\nconst props = withDefaults(\n defineProps<{\n material?: Material;\n /** Trigger button text; use the `trigger` slot for richer content. */\n label?: string;\n items: MenuEntry[];\n triggerVariant?: ButtonVariant;\n class?: string;\n }>(),\n { triggerVariant: \"secondary\" },\n);\n\nconst id = useId();\nconst menuId = `${id}-menu`;\nconst anchor = `--cn-menu-${id.replace(/[^a-zA-Z0-9-]/g, \"\")}`;\nconst trigger = ref<HTMLButtonElement | null>(null);\nconst menu = ref<HTMLDivElement | null>(null);\nconst itemEls = ref<Array<HTMLButtonElement | null>>([]);\nconst open = ref(false);\nconst actionable = computed(() =>\n props.items.map((it, i) => ({ it, i })).filter(({ it }) => !(\"separator\" in it) && !it.disabled),\n);\n\nfunction place() {\n const m = menu.value;\n const t = trigger.value;\n if (!m || !t || supportsAnchorPositioning()) return;\n // Fallback where CSS anchor positioning is unavailable.\n const r = t.getBoundingClientRect();\n m.style.position = \"fixed\";\n m.style.inset = \"auto\";\n m.style.top = `${r.bottom}px`;\n m.style.left = `${Math.min(r.left, window.innerWidth - m.offsetWidth - 8)}px`;\n}\nfunction show(focus: \"first\" | \"last\") {\n const m = menu.value;\n if (!m) return;\n if (!m.matches(\":popover-open\")) m.showPopover();\n place();\n const list = actionable.value;\n const target = focus === \"first\" ? list[0] : list[list.length - 1];\n if (target) itemEls.value[target.i]?.focus();\n}\nfunction hide(returnFocus = true) {\n menu.value?.hidePopover();\n if (returnFocus) trigger.value?.focus();\n}\nfunction onToggle(e: Event) {\n const isOpen = (e as ToggleEvent).newState === \"open\";\n open.value = isOpen;\n if (!isOpen && menu.value?.contains(document.activeElement)) trigger.value?.focus();\n}\nonMounted(() => menu.value?.addEventListener(\"toggle\", onToggle));\nonBeforeUnmount(() => menu.value?.removeEventListener(\"toggle\", onToggle));\n\nfunction onTriggerKey(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n show(\"first\");\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n show(\"last\");\n }\n}\nfunction onMenuKey(e: KeyboardEvent) {\n if (e.key === \"Tab\") return hide(false);\n const current = itemEls.value.findIndex((el) => el === document.activeElement);\n const next = menuNavigation(props.items, current, e.key);\n if (next !== null) {\n e.preventDefault();\n itemEls.value[next]?.focus();\n }\n}\nfunction activate(entry: MenuEntry) {\n if (!(\"separator\" in entry)) entry.onSelect?.();\n hide();\n}\n</script>\n\n<template>\n <div data-slot=\"menu\" :data-material=\"props.material\" :class=\"cn('cn-menu-root', props.class)\">\n <button\n ref=\"trigger\"\n type=\"button\"\n :class=\"cn('cn-button', `cn-button--${triggerVariant}`, 'cn-button--size-md')\"\n aria-haspopup=\"menu\"\n :aria-expanded=\"open\"\n :aria-controls=\"menuId\"\n :style=\"{ anchorName: anchor }\"\n @click=\"open ? hide() : show('first')\"\n @keydown=\"onTriggerKey\"\n >\n <slot name=\"trigger\">{{ label }}</slot>\n </button>\n <div\n :id=\"menuId\"\n ref=\"menu\"\n popover=\"auto\"\n role=\"menu\"\n class=\"cn-menu\"\n :style=\"{ positionAnchor: anchor }\"\n @keydown=\"onMenuKey\"\n >\n <template v-for=\"(it, i) in items\" :key=\"i\">\n <div v-if=\"'separator' in it\" role=\"separator\" class=\"cn-menu__separator\" />\n <button\n v-else\n :ref=\"(el) => (itemEls[i] = el as HTMLButtonElement | null)\"\n type=\"button\"\n role=\"menuitem\"\n tabindex=\"-1\"\n :disabled=\"it.disabled\"\n :class=\"cn('cn-menu__item', it.danger && 'cn-menu__item--danger')\"\n @click=\"activate(it)\"\n >\n {{ it.label }}\n </button>\n </template>\n </div>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { cn as e } from "./cn.js";
|
|
2
|
+
import { Fragment as t, computed as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, defineComponent as o, normalizeClass as s, normalizeStyle as c, onBeforeUnmount as l, onMounted as u, openBlock as d, ref as f, renderList as p, renderSlot as m, toDisplayString as h, unref as g, useId as _ } from "vue";
|
|
3
|
+
import { menuNavigation as v, supportsAnchorPositioning as y } from "@crystal-neuo/contract";
|
|
4
|
+
// src/Menu.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var b = ["data-material"], x = ["aria-expanded"], S = {
|
|
6
|
+
key: 0,
|
|
7
|
+
role: "separator",
|
|
8
|
+
class: "cn-menu__separator"
|
|
9
|
+
}, C = ["disabled", "onClick"], w = /*@__PURE__*/ o({
|
|
10
|
+
__name: "Menu",
|
|
11
|
+
props: {
|
|
12
|
+
material: {},
|
|
13
|
+
label: {},
|
|
14
|
+
items: {},
|
|
15
|
+
triggerVariant: { default: "secondary" },
|
|
16
|
+
class: {}
|
|
17
|
+
},
|
|
18
|
+
setup(o) {
|
|
19
|
+
let w = o, T = _(), E = `${T}-menu`, D = `--cn-menu-${T.replace(/[^a-zA-Z0-9-]/g, "")}`, O = f(null), k = f(null), A = f([]), j = f(!1), M = n(() => w.items.map((e, t) => ({
|
|
20
|
+
it: e,
|
|
21
|
+
i: t
|
|
22
|
+
})).filter(({ it: e }) => !("separator" in e) && !e.disabled));
|
|
23
|
+
function N() {
|
|
24
|
+
let e = k.value, t = O.value;
|
|
25
|
+
if (!e || !t || y()) return;
|
|
26
|
+
let n = t.getBoundingClientRect();
|
|
27
|
+
e.style.position = "fixed", e.style.inset = "auto", e.style.top = `${n.bottom}px`, e.style.left = `${Math.min(n.left, window.innerWidth - e.offsetWidth - 8)}px`;
|
|
28
|
+
}
|
|
29
|
+
function P(e) {
|
|
30
|
+
let t = k.value;
|
|
31
|
+
if (!t) return;
|
|
32
|
+
t.matches(":popover-open") || t.showPopover(), N();
|
|
33
|
+
let n = M.value, r = e === "first" ? n[0] : n[n.length - 1];
|
|
34
|
+
r && A.value[r.i]?.focus();
|
|
35
|
+
}
|
|
36
|
+
function F(e = !0) {
|
|
37
|
+
k.value?.hidePopover(), e && O.value?.focus();
|
|
38
|
+
}
|
|
39
|
+
function I(e) {
|
|
40
|
+
let t = e.newState === "open";
|
|
41
|
+
j.value = t, !t && k.value?.contains(document.activeElement) && O.value?.focus();
|
|
42
|
+
}
|
|
43
|
+
u(() => k.value?.addEventListener("toggle", I)), l(() => k.value?.removeEventListener("toggle", I));
|
|
44
|
+
function L(e) {
|
|
45
|
+
e.key === "ArrowDown" || e.key === "Enter" || e.key === " " ? (e.preventDefault(), P("first")) : e.key === "ArrowUp" && (e.preventDefault(), P("last"));
|
|
46
|
+
}
|
|
47
|
+
function R(e) {
|
|
48
|
+
if (e.key === "Tab") return F(!1);
|
|
49
|
+
let t = A.value.findIndex((e) => e === document.activeElement), n = v(w.items, t, e.key);
|
|
50
|
+
n !== null && (e.preventDefault(), A.value[n]?.focus());
|
|
51
|
+
}
|
|
52
|
+
function z(e) {
|
|
53
|
+
"separator" in e || e.onSelect?.(), F();
|
|
54
|
+
}
|
|
55
|
+
return (n, l) => (d(), r("div", {
|
|
56
|
+
"data-slot": "menu",
|
|
57
|
+
"data-material": w.material,
|
|
58
|
+
class: s(g(e)("cn-menu-root", w.class))
|
|
59
|
+
}, [i("button", {
|
|
60
|
+
ref_key: "trigger",
|
|
61
|
+
ref: O,
|
|
62
|
+
type: "button",
|
|
63
|
+
class: s(g(e)("cn-button", `cn-button--${o.triggerVariant}`, "cn-button--size-md")),
|
|
64
|
+
"aria-haspopup": "menu",
|
|
65
|
+
"aria-expanded": j.value,
|
|
66
|
+
"aria-controls": E,
|
|
67
|
+
style: c({ anchorName: D }),
|
|
68
|
+
onClick: l[0] ||= (e) => j.value ? F() : P("first"),
|
|
69
|
+
onKeydown: L
|
|
70
|
+
}, [m(n.$slots, "trigger", {}, () => [a(h(o.label), 1)])], 46, x), i("div", {
|
|
71
|
+
id: E,
|
|
72
|
+
ref_key: "menu",
|
|
73
|
+
ref: k,
|
|
74
|
+
popover: "auto",
|
|
75
|
+
role: "menu",
|
|
76
|
+
class: "cn-menu",
|
|
77
|
+
style: c({ positionAnchor: D }),
|
|
78
|
+
onKeydown: R
|
|
79
|
+
}, [(d(!0), r(t, null, p(o.items, (n, i) => (d(), r(t, { key: i }, ["separator" in n ? (d(), r("div", S)) : (d(), r("button", {
|
|
80
|
+
key: 1,
|
|
81
|
+
ref_for: !0,
|
|
82
|
+
ref: (e) => A.value[i] = e,
|
|
83
|
+
type: "button",
|
|
84
|
+
role: "menuitem",
|
|
85
|
+
tabindex: "-1",
|
|
86
|
+
disabled: n.disabled,
|
|
87
|
+
class: s(g(e)("cn-menu__item", n.danger && "cn-menu__item--danger")),
|
|
88
|
+
onClick: (e) => z(n)
|
|
89
|
+
}, h(n.label), 11, C))], 64))), 128))], 36)], 10, b));
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
export { w as default };
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=Menu.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_unref","_createElementVNode","_normalizeStyle","_renderSlot","_createTextVNode","_toDisplayString","_Fragment","_renderList","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","Menu_vue_vue_type_script_setup_true_lang_default","props","__props","id","useId","menuId","anchor","trigger","ref","menu","itemEls","open","actionable","computed","it","place","m","supportsAnchorPositioning","r","show","list","target","focus","hide","returnFocus","onToggle","isOpen","onMounted","onBeforeUnmount","onTriggerKey","onMenuKey","current","el","next","menuNavigation","activate","entry","openBlock","createElementBlock","normalizeClass","unref","cn","createElementVNode","normalizeStyle","_cache","renderSlot","_ctx","createTextVNode","toDisplayString","Fragment","renderList"],"sources":["../src/Menu.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref, useId } from \"vue\";\nimport {\n menuNavigation,\n supportsAnchorPositioning,\n type ButtonVariant,\n type MenuEntry,\n type Material,\n} from \"@crystal-neuo/contract\";\nimport { cn } from \"./cn.ts\";\n\nconst props = withDefaults(\n defineProps<{\n material?: Material;\n /** Trigger button text; use the `trigger` slot for richer content. */\n label?: string;\n items: MenuEntry[];\n triggerVariant?: ButtonVariant;\n class?: string;\n }>(),\n { triggerVariant: \"secondary\" },\n);\n\nconst id = useId();\nconst menuId = `${id}-menu`;\nconst anchor = `--cn-menu-${id.replace(/[^a-zA-Z0-9-]/g, \"\")}`;\nconst trigger = ref<HTMLButtonElement | null>(null);\nconst menu = ref<HTMLDivElement | null>(null);\nconst itemEls = ref<Array<HTMLButtonElement | null>>([]);\nconst open = ref(false);\nconst actionable = computed(() =>\n props.items.map((it, i) => ({ it, i })).filter(({ it }) => !(\"separator\" in it) && !it.disabled),\n);\n\nfunction place() {\n const m = menu.value;\n const t = trigger.value;\n if (!m || !t || supportsAnchorPositioning()) return;\n // Fallback where CSS anchor positioning is unavailable.\n const r = t.getBoundingClientRect();\n m.style.position = \"fixed\";\n m.style.inset = \"auto\";\n m.style.top = `${r.bottom}px`;\n m.style.left = `${Math.min(r.left, window.innerWidth - m.offsetWidth - 8)}px`;\n}\nfunction show(focus: \"first\" | \"last\") {\n const m = menu.value;\n if (!m) return;\n if (!m.matches(\":popover-open\")) m.showPopover();\n place();\n const list = actionable.value;\n const target = focus === \"first\" ? list[0] : list[list.length - 1];\n if (target) itemEls.value[target.i]?.focus();\n}\nfunction hide(returnFocus = true) {\n menu.value?.hidePopover();\n if (returnFocus) trigger.value?.focus();\n}\nfunction onToggle(e: Event) {\n const isOpen = (e as ToggleEvent).newState === \"open\";\n open.value = isOpen;\n if (!isOpen && menu.value?.contains(document.activeElement)) trigger.value?.focus();\n}\nonMounted(() => menu.value?.addEventListener(\"toggle\", onToggle));\nonBeforeUnmount(() => menu.value?.removeEventListener(\"toggle\", onToggle));\n\nfunction onTriggerKey(e: KeyboardEvent) {\n if (e.key === \"ArrowDown\" || e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n show(\"first\");\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n show(\"last\");\n }\n}\nfunction onMenuKey(e: KeyboardEvent) {\n if (e.key === \"Tab\") return hide(false);\n const current = itemEls.value.findIndex((el) => el === document.activeElement);\n const next = menuNavigation(props.items, current, e.key);\n if (next !== null) {\n e.preventDefault();\n itemEls.value[next]?.focus();\n }\n}\nfunction activate(entry: MenuEntry) {\n if (!(\"separator\" in entry)) entry.onSelect?.();\n hide();\n}\n</script>\n\n<template>\n <div data-slot=\"menu\" :data-material=\"props.material\" :class=\"cn('cn-menu-root', props.class)\">\n <button\n ref=\"trigger\"\n type=\"button\"\n :class=\"cn('cn-button', `cn-button--${triggerVariant}`, 'cn-button--size-md')\"\n aria-haspopup=\"menu\"\n :aria-expanded=\"open\"\n :aria-controls=\"menuId\"\n :style=\"{ anchorName: anchor }\"\n @click=\"open ? hide() : show('first')\"\n @keydown=\"onTriggerKey\"\n >\n <slot name=\"trigger\">{{ label }}</slot>\n </button>\n <div\n :id=\"menuId\"\n ref=\"menu\"\n popover=\"auto\"\n role=\"menu\"\n class=\"cn-menu\"\n :style=\"{ positionAnchor: anchor }\"\n @keydown=\"onMenuKey\"\n >\n <template v-for=\"(it, i) in items\" :key=\"i\">\n <div v-if=\"'separator' in it\" role=\"separator\" class=\"cn-menu__separator\" />\n <button\n v-else\n :ref=\"(el) => (itemEls[i] = el as HTMLButtonElement | null)\"\n type=\"button\"\n role=\"menuitem\"\n tabindex=\"-1\"\n :disabled=\"it.disabled\"\n :class=\"cn('cn-menu__item', it.danger && 'cn-menu__item--danger')\"\n @click=\"activate(it)\"\n >\n {{ it.label }}\n </button>\n </template>\n </div>\n </div>\n</template>\n"],"mappings":"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"}
|
package/dist/Modal.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ModalSize, Material } from "@crystal-neuo/contract";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
material?: Material;
|
|
4
|
+
title: string;
|
|
5
|
+
size?: ModalSize;
|
|
6
|
+
class?: string;
|
|
7
|
+
};
|
|
8
|
+
type __VLS_ModelProps = {
|
|
9
|
+
"open"?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
12
|
+
declare var __VLS_1: {};
|
|
13
|
+
type __VLS_Slots = {} & {
|
|
14
|
+
default?: (props: typeof __VLS_1) => any;
|
|
15
|
+
};
|
|
16
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
17
|
+
"update:open": (value: boolean) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
19
|
+
"onUpdate:open"?: (value: boolean) => any;
|
|
20
|
+
}>, {
|
|
21
|
+
size: "sm" | "md" | "lg";
|
|
22
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
26
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=Modal.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.vue.d.ts","sourceRoot":"","sources":["../src/Modal.vue"],"names":[],"mappings":"AAgDA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAKlE,KAAK,WAAW,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AA0B5F,KAAK,gBAAgB,GAAG;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AASF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAuCxD,QAAA,IAAI,OAAO,IAAW,CAAC;AACvB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,QAAA,MAAM,UAAU;;;;;;6EAId,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
package/dist/Modal.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.js","names":["_sfc_main","Modal_vue_vue_type_script_setup_true_lang_default","Modal_default"],"sources":["../src/Modal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, useId } from \"vue\";\nimport type { ModalSize, Material } from \"@crystal-neuo/contract\";\nimport { cn } from \"./cn.ts\";\nimport { useModalDialog } from \"./useModalDialog.ts\";\n\nconst props = withDefaults(\n defineProps<{ material?: Material; title: string; size?: ModalSize; class?: string }>(),\n {\n size: \"md\",\n },\n);\n\nconst open = defineModel<boolean>(\"open\", { default: false });\n\nconst dialog = ref<HTMLDialogElement | null>(null);\nconst titleId = useId();\nuseModalDialog(dialog, open);\n\nconst classes = computed(() => cn(\"cn-modal\", `cn-modal--size-${props.size}`, props.class));\n\nfunction onScrim(e: MouseEvent) {\n if (e.target !== e.currentTarget) return;\n // Keep the press from moving focus to the closing dialog, so focus returns to the opener.\n e.preventDefault();\n open.value = false;\n}\n</script>\n\n<template>\n <dialog\n ref=\"dialog\"\n class=\"cn-scrim\"\n data-slot=\"modal-scrim\"\n :data-material=\"props.material\"\n :aria-labelledby=\"titleId\"\n @mousedown=\"onScrim\"\n >\n <div v-if=\"open\" :class=\"classes\">\n <h2 :id=\"titleId\" class=\"cn-modal__title\">{{ title }}</h2>\n <slot />\n </div>\n </dialog>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { cn as e } from "./cn.js";
|
|
2
|
+
import { useModalDialog as t } from "./useModalDialog.js";
|
|
3
|
+
import { computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, mergeModels as s, normalizeClass as c, openBlock as l, ref as u, renderSlot as d, toDisplayString as f, unref as p, useId as m, useModel as h } from "vue";
|
|
4
|
+
// src/Modal.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var g = ["data-material", "aria-labelledby"], _ = ["id"], v = /*@__PURE__*/ o({
|
|
6
|
+
__name: "Modal",
|
|
7
|
+
props: /*@__PURE__*/ s({
|
|
8
|
+
material: {},
|
|
9
|
+
title: {},
|
|
10
|
+
size: { default: "md" },
|
|
11
|
+
class: {}
|
|
12
|
+
}, {
|
|
13
|
+
open: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: !1
|
|
16
|
+
},
|
|
17
|
+
openModifiers: {}
|
|
18
|
+
}),
|
|
19
|
+
emits: ["update:open"],
|
|
20
|
+
setup(o) {
|
|
21
|
+
let s = o, v = h(o, "open"), y = u(null), b = m();
|
|
22
|
+
t(y, v);
|
|
23
|
+
let x = n(() => e("cn-modal", `cn-modal--size-${s.size}`, s.class));
|
|
24
|
+
function S(e) {
|
|
25
|
+
e.target === e.currentTarget && (e.preventDefault(), v.value = !1);
|
|
26
|
+
}
|
|
27
|
+
return (e, t) => (l(), i("dialog", {
|
|
28
|
+
ref_key: "dialog",
|
|
29
|
+
ref: y,
|
|
30
|
+
class: "cn-scrim",
|
|
31
|
+
"data-slot": "modal-scrim",
|
|
32
|
+
"data-material": s.material,
|
|
33
|
+
"aria-labelledby": p(b),
|
|
34
|
+
onMousedown: S
|
|
35
|
+
}, [v.value ? (l(), i("div", {
|
|
36
|
+
key: 0,
|
|
37
|
+
class: c(x.value)
|
|
38
|
+
}, [a("h2", {
|
|
39
|
+
id: p(b),
|
|
40
|
+
class: "cn-modal__title"
|
|
41
|
+
}, f(o.title), 9, _), d(e.$slots, "default")], 2)) : r("", !0)], 40, g));
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export { v as default };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=Modal.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createElementBlock","_unref","_normalizeClass","_createElementVNode","_toDisplayString","_renderSlot","_createCommentVNode","_hoisted_1","_hoisted_2","Modal_vue_vue_type_script_setup_true_lang_default","\"open\"","\"openModifiers\"","props","__props","open","useModel","dialog","ref","titleId","useId","classes","computed","cn","onScrim","openBlock","createElementBlock","unref","normalizeClass","createElementVNode","toDisplayString","renderSlot","_ctx","createCommentVNode"],"sources":["../src/Modal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, useId } from \"vue\";\nimport type { ModalSize, Material } from \"@crystal-neuo/contract\";\nimport { cn } from \"./cn.ts\";\nimport { useModalDialog } from \"./useModalDialog.ts\";\n\nconst props = withDefaults(\n defineProps<{ material?: Material; title: string; size?: ModalSize; class?: string }>(),\n {\n size: \"md\",\n },\n);\n\nconst open = defineModel<boolean>(\"open\", { default: false });\n\nconst dialog = ref<HTMLDialogElement | null>(null);\nconst titleId = useId();\nuseModalDialog(dialog, open);\n\nconst classes = computed(() => cn(\"cn-modal\", `cn-modal--size-${props.size}`, props.class));\n\nfunction onScrim(e: MouseEvent) {\n if (e.target !== e.currentTarget) return;\n // Keep the press from moving focus to the closing dialog, so focus returns to the opener.\n e.preventDefault();\n open.value = false;\n}\n</script>\n\n<template>\n <dialog\n ref=\"dialog\"\n class=\"cn-scrim\"\n data-slot=\"modal-scrim\"\n :data-material=\"props.material\"\n :aria-labelledby=\"titleId\"\n @mousedown=\"onScrim\"\n >\n <div v-if=\"open\" :class=\"classes\">\n <h2 :id=\"titleId\" class=\"cn-modal__title\">{{ title }}</h2>\n <slot />\n </div>\n </dialog>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAMA,IAAMc,IAAQC,GAORC,IAAOhB,EAAoBe,GAAC,MAA0B,GAEtDG,IAASC,EAA8B,IAAI,GAC3CC,IAAUC,EAAM;EACtB,EAAeH,GAAQF,CAAI;EAE3B,IAAMM,IAAUC,QAAeC,EAAG,YAAY,kBAAkBV,EAAM,QAAQA,EAAM,KAAK,CAAC;EAE1F,SAASW,EAAQ,GAAe;GAC9B,AAAI,EAAE,WAAW,EAAE,kBAEnB,EAAE,eAAe,GACjB,EAAK,QAAQ;EACf;E,kBAIExB,EAAA,GAAAC,EAYS,UAAA;GAXH,SAAA;GAAJ,KAAIgB;GACJ,OAAM;GACN,aAAU;GACT,iBAAeJ,EAAM;GACrB,mBAAiBX,EAAAiB,CAAA;GACjB,aAAWK;E,IAEDT,EAAA,SAAXf,EAAA,GAAAC,EAGM,OAAA;;GAHY,OAAKE,EAAEkB,EAAA,KAAO;E,IAC9BjB,EAA0D,MAAA;GAArD,IAAIF,EAAAiB,CAAA;GAAS,OAAM;EAAqB,GAAAd,EAAAS,EAAA,KAAK,GAAA,GAAAL,CAAA,GAClDH,EAAQ0B,EAAA,QAAA,SAAA,C"}
|
package/dist/Nav.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { NavVariant, Material } from "@crystal-neuo/contract";
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
material?: Material;
|
|
4
|
+
variant?: NavVariant;
|
|
5
|
+
label: string;
|
|
6
|
+
class?: string;
|
|
7
|
+
};
|
|
8
|
+
declare var __VLS_1: {};
|
|
9
|
+
type __VLS_Slots = {} & {
|
|
10
|
+
default?: (props: typeof __VLS_1) => any;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
13
|
+
variant: "glass" | "solid";
|
|
14
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
18
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
19
|
+
new (): {
|
|
20
|
+
$slots: S;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=Nav.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Nav.vue.d.ts","sourceRoot":"","sources":["../src/Nav.vue"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAInE,KAAK,WAAW,GAAG;IAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAAC,OAAO,CAAC,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAkChG,QAAA,IAAI,OAAO,IAAW,CAAC;AACvB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAG/C,QAAA,MAAM,UAAU;;6EAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
package/dist/Nav.js
ADDED
package/dist/Nav.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Nav.js","names":["_sfc_main","Nav_vue_vue_type_script_setup_true_lang_default","Nav_default"],"sources":["../src/Nav.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport type { NavVariant, Material } from \"@crystal-neuo/contract\";\nimport { cn } from \"./cn.ts\";\n\nconst props = withDefaults(\n defineProps<{ material?: Material; variant?: NavVariant; label: string; class?: string }>(),\n {\n variant: \"glass\",\n },\n);\n\nconst classes = computed(() => cn(\"cn-nav\", `cn-nav--${props.variant}`, props.class));\n</script>\n\n<template>\n <nav data-slot=\"nav\" :data-material=\"props.material\" :aria-label=\"label\" :class=\"classes\"><slot /></nav>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { cn as e } from "./cn.js";
|
|
2
|
+
import { computed as t, createElementBlock as n, defineComponent as r, normalizeClass as i, openBlock as a, renderSlot as o } from "vue";
|
|
3
|
+
// src/Nav.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var s = ["data-material", "aria-label"], c = /*@__PURE__*/ r({
|
|
5
|
+
__name: "Nav",
|
|
6
|
+
props: {
|
|
7
|
+
material: {},
|
|
8
|
+
variant: { default: "glass" },
|
|
9
|
+
label: {},
|
|
10
|
+
class: {}
|
|
11
|
+
},
|
|
12
|
+
setup(r) {
|
|
13
|
+
let c = r, l = t(() => e("cn-nav", `cn-nav--${c.variant}`, c.class));
|
|
14
|
+
return (e, t) => (a(), n("nav", {
|
|
15
|
+
"data-slot": "nav",
|
|
16
|
+
"data-material": c.material,
|
|
17
|
+
"aria-label": r.label,
|
|
18
|
+
class: i(l.value)
|
|
19
|
+
}, [o(e.$slots, "default")], 10, s));
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export { c as default };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=Nav.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Nav.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_hoisted_1","Nav_vue_vue_type_script_setup_true_lang_default","props","__props","classes","computed","cn","openBlock","createElementBlock","normalizeClass","renderSlot","_ctx"],"sources":["../src/Nav.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport type { NavVariant, Material } from \"@crystal-neuo/contract\";\nimport { cn } from \"./cn.ts\";\n\nconst props = withDefaults(\n defineProps<{ material?: Material; variant?: NavVariant; label: string; class?: string }>(),\n {\n variant: \"glass\",\n },\n);\n\nconst classes = computed(() => cn(\"cn-nav\", `cn-nav--${props.variant}`, props.class));\n</script>\n\n<template>\n <nav data-slot=\"nav\" :data-material=\"props.material\" :aria-label=\"label\" :class=\"classes\"><slot /></nav>\n</template>\n"],"mappings":";;;;;;;;;;;;EAKA,IAAMM,IAAQC,GAORC,IAAUC,QAAeC,EAAG,UAAU,WAAWJ,EAAM,WAAWA,EAAM,KAAK,CAAC;E,kBAIlFN,EAAA,GAAAC,EAAwG,OAAA;GAAnG,aAAU;GAAO,iBAAeK,EAAM;GAAW,cAAYC,EAAA;GAAQ,OAAKL,EAAEM,EAAA,KAAO;E,IAAEL,EAAQY,EAAA,QAAA,SAAA,C"}
|