@scalar/components 0.12.76 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ScalarButton/ScalarButton.stories.d.ts +3 -0
- package/dist/components/ScalarButton/ScalarButton.stories.d.ts.map +1 -1
- package/dist/components/ScalarButton/ScalarButton.vue.d.ts.map +1 -1
- package/dist/components/ScalarButton/ScalarButton.vue.js +29 -32
- package/dist/components/ScalarCombobox/ScalarCombobox.stories.d.ts +30 -5
- package/dist/components/ScalarCombobox/ScalarCombobox.stories.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/ScalarCombobox.vue.d.ts +24 -7
- package/dist/components/ScalarCombobox/ScalarCombobox.vue.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/ScalarCombobox.vue.js +34 -18
- package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.vue.d.ts +16 -82
- package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.vue.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.vue.js +23 -22
- package/dist/components/ScalarCombobox/ScalarComboboxOption.vue.d.ts +7 -2
- package/dist/components/ScalarCombobox/ScalarComboboxOption.vue.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/ScalarComboboxOption.vue.js +23 -28
- package/dist/components/ScalarCombobox/ScalarComboboxOptions.vue.d.ts +25 -1
- package/dist/components/ScalarCombobox/ScalarComboboxOptions.vue.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/ScalarComboboxOptions.vue.js +58 -56
- package/dist/components/ScalarCombobox/ScalarComboboxPopover.vue.d.ts +5 -11
- package/dist/components/ScalarCombobox/ScalarComboboxPopover.vue.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/ScalarComboboxPopover.vue.js +43 -43
- package/dist/components/ScalarCombobox/types.d.ts +4 -2
- package/dist/components/ScalarCombobox/types.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/types.js +8 -3
- package/dist/components/ScalarDropdown/ScalarDropdown.stories.d.ts +73 -105
- package/dist/components/ScalarDropdown/ScalarDropdown.stories.d.ts.map +1 -1
- package/dist/components/ScalarDropdown/ScalarDropdown.vue.d.ts +40 -22
- package/dist/components/ScalarDropdown/ScalarDropdown.vue.d.ts.map +1 -1
- package/dist/components/ScalarDropdown/ScalarDropdown.vue.js +32 -42
- package/dist/components/ScalarDropdown/ScalarDropdownButton.vue.d.ts +35 -0
- package/dist/components/ScalarDropdown/ScalarDropdownButton.vue.d.ts.map +1 -0
- package/dist/components/ScalarDropdown/ScalarDropdownButton.vue.js +7 -0
- package/dist/components/ScalarDropdown/ScalarDropdownButton.vue2.js +37 -0
- package/dist/components/ScalarDropdown/ScalarDropdownDivider.vue.d.ts +17 -1
- package/dist/components/ScalarDropdown/ScalarDropdownDivider.vue.d.ts.map +1 -1
- package/dist/components/ScalarDropdown/ScalarDropdownDivider.vue.js +7 -6
- package/dist/components/ScalarDropdown/ScalarDropdownDivider.vue2.js +4 -0
- package/dist/components/ScalarDropdown/ScalarDropdownItem.vue.d.ts +18 -15
- package/dist/components/ScalarDropdown/ScalarDropdownItem.vue.d.ts.map +1 -1
- package/dist/components/ScalarDropdown/ScalarDropdownItem.vue.js +2 -2
- package/dist/components/ScalarDropdown/ScalarDropdownItem.vue2.js +19 -29
- package/dist/components/ScalarDropdown/ScalarDropdownMenu.vue.d.ts +32 -0
- package/dist/components/ScalarDropdown/ScalarDropdownMenu.vue.d.ts.map +1 -0
- package/dist/components/ScalarDropdown/ScalarDropdownMenu.vue.js +28 -0
- package/dist/components/ScalarDropdown/ScalarDropdownMenu.vue2.js +4 -0
- package/dist/components/ScalarDropdown/index.d.ts +2 -0
- package/dist/components/ScalarDropdown/index.d.ts.map +1 -1
- package/dist/components/ScalarErrorBoundary/ScalarErrorBoundary.spec.d.ts +2 -0
- package/dist/components/ScalarErrorBoundary/ScalarErrorBoundary.spec.d.ts.map +1 -0
- package/dist/components/ScalarErrorBoundary/ScalarErrorBoundary.stories.d.ts +6 -0
- package/dist/components/ScalarErrorBoundary/ScalarErrorBoundary.stories.d.ts.map +1 -0
- package/dist/components/ScalarErrorBoundary/ScalarErrorBoundary.vue.d.ts +18 -0
- package/dist/components/ScalarErrorBoundary/ScalarErrorBoundary.vue.d.ts.map +1 -0
- package/dist/components/ScalarErrorBoundary/ScalarErrorBoundary.vue.js +23 -0
- package/dist/components/ScalarErrorBoundary/ScalarErrorBoundary.vue2.js +4 -0
- package/dist/components/ScalarErrorBoundary/index.d.ts +2 -0
- package/dist/components/ScalarErrorBoundary/index.d.ts.map +1 -0
- package/dist/components/ScalarFloating/ScalarFloating.stories.d.ts +4 -0
- package/dist/components/ScalarFloating/ScalarFloating.stories.d.ts.map +1 -1
- package/dist/components/ScalarFloating/ScalarFloating.vue.d.ts +5 -4
- package/dist/components/ScalarFloating/ScalarFloating.vue.d.ts.map +1 -1
- package/dist/components/ScalarFloating/ScalarFloating.vue.js +32 -29
- package/dist/components/ScalarFloating/index.d.ts +1 -1
- package/dist/components/ScalarFloating/index.d.ts.map +1 -1
- package/dist/components/ScalarFloating/types.d.ts +15 -7
- package/dist/components/ScalarFloating/types.d.ts.map +1 -1
- package/dist/components/ScalarFloating/useResizeWithTarget.d.ts +3 -0
- package/dist/components/ScalarFloating/useResizeWithTarget.d.ts.map +1 -1
- package/dist/components/ScalarIcon/ScalarIcon.stories.d.ts +1 -0
- package/dist/components/ScalarIcon/ScalarIcon.stories.d.ts.map +1 -1
- package/dist/components/ScalarIcon/ScalarIcon.vue.d.ts.map +1 -1
- package/dist/components/ScalarIcon/ScalarIcon.vue.js +2 -2
- package/dist/components/ScalarIcon/ScalarIcon.vue2.js +18 -15
- package/dist/components/ScalarIcon/icons/Hide.svg.js +10 -9
- package/dist/components/ScalarIcon/icons/Show.svg.js +7 -8
- package/dist/components/ScalarIconButton/ScalarIconButton.stories.d.ts +10 -7
- package/dist/components/ScalarIconButton/ScalarIconButton.stories.d.ts.map +1 -1
- package/dist/components/ScalarIconButton/ScalarIconButton.vue.d.ts +1 -1
- package/dist/components/ScalarIconButton/ScalarIconButton.vue.d.ts.map +1 -1
- package/dist/components/ScalarIconButton/ScalarIconButton.vue.js +19 -21
- package/dist/components/ScalarListbox/ScalarListbox.stories.d.ts +52 -25
- package/dist/components/ScalarListbox/ScalarListbox.stories.d.ts.map +1 -1
- package/dist/components/ScalarListbox/ScalarListbox.vue.d.ts +41 -22
- package/dist/components/ScalarListbox/ScalarListbox.vue.d.ts.map +1 -1
- package/dist/components/ScalarListbox/ScalarListbox.vue.js +46 -85
- package/dist/components/ScalarListbox/ScalarListboxCheckbox.vue.d.ts +8 -0
- package/dist/components/ScalarListbox/ScalarListboxCheckbox.vue.d.ts.map +1 -0
- package/dist/components/ScalarListbox/ScalarListboxCheckbox.vue.js +26 -0
- package/dist/components/ScalarListbox/ScalarListboxCheckbox.vue2.js +4 -0
- package/dist/components/ScalarListbox/ScalarListboxItem.vue.d.ts +8 -0
- package/dist/components/ScalarListbox/ScalarListboxItem.vue.d.ts.map +1 -0
- package/dist/components/ScalarListbox/ScalarListboxItem.vue.js +53 -0
- package/dist/components/ScalarListbox/ScalarListboxItem.vue2.js +4 -0
- package/dist/components/ScalarListbox/index.d.ts +3 -1
- package/dist/components/ScalarListbox/index.d.ts.map +1 -1
- package/dist/components/ScalarListbox/types.d.ts +1 -0
- package/dist/components/ScalarListbox/types.d.ts.map +1 -1
- package/dist/components/ScalarLoading/ScalarLoading.stories.d.ts +28 -6
- package/dist/components/ScalarLoading/ScalarLoading.stories.d.ts.map +1 -1
- package/dist/components/ScalarLoading/ScalarLoading.vue.d.ts +2 -2
- package/dist/components/ScalarLoading/ScalarLoading.vue.d.ts.map +1 -1
- package/dist/components/ScalarLoading/ScalarLoading.vue.js +3 -3
- package/dist/components/ScalarLoading/ScalarLoading.vue2.js +29 -30
- package/dist/components/ScalarMenu/ScalarMenu.stories.d.ts +133 -108
- package/dist/components/ScalarMenu/ScalarMenu.stories.d.ts.map +1 -1
- package/dist/components/ScalarMenu/ScalarMenu.vue.d.ts +34 -18
- package/dist/components/ScalarMenu/ScalarMenu.vue.d.ts.map +1 -1
- package/dist/components/ScalarMenu/ScalarMenu.vue.js +22 -20
- package/dist/components/ScalarMenu/ScalarMenuButton.vue.d.ts +2 -2
- package/dist/components/ScalarMenu/ScalarMenuButton.vue.d.ts.map +1 -1
- package/dist/components/ScalarMenu/ScalarMenuButton.vue.js +25 -17
- package/dist/components/ScalarMenu/ScalarMenuLink.vue.d.ts.map +1 -1
- package/dist/components/ScalarMenu/ScalarMenuLink.vue.js +17 -10
- package/dist/components/ScalarMenu/ScalarMenuProduct.vue.d.ts +2 -2
- package/dist/components/ScalarMenu/ScalarMenuProduct.vue.d.ts.map +1 -1
- package/dist/components/ScalarMenu/ScalarMenuProduct.vue.js +22 -16
- package/dist/components/ScalarMenu/ScalarMenuProducts.vue.d.ts +1 -1
- package/dist/components/ScalarMenu/ScalarMenuProducts.vue.d.ts.map +1 -1
- package/dist/components/ScalarMenu/ScalarMenuProducts.vue.js +25 -22
- package/dist/components/ScalarMenu/ScalarMenuResources.vue.d.ts +1 -1
- package/dist/components/ScalarMenu/ScalarMenuResources.vue.js +3 -3
- package/dist/components/ScalarMenu/ScalarMenuSection.vue.d.ts +2 -2
- package/dist/components/ScalarMenu/ScalarMenuSection.vue.d.ts.map +1 -1
- package/dist/components/ScalarMenu/ScalarMenuSection.vue.js +18 -15
- package/dist/components/ScalarMenu/ScalarMenuSection.vue2.js +4 -0
- package/dist/components/ScalarMenu/ScalarMenuTeamPicker.vue.d.ts +1 -1
- package/dist/components/ScalarMenu/ScalarMenuTeamPicker.vue.d.ts.map +1 -1
- package/dist/components/ScalarMenu/ScalarMenuTeamPicker.vue.js +18 -16
- package/dist/components/ScalarModal/ScalarModal.stories.d.ts +3 -3
- package/dist/components/ScalarModal/ScalarModal.vue.d.ts +2 -2
- package/dist/components/ScalarPopover/ScalarPopover.stories.d.ts +20 -116
- package/dist/components/ScalarPopover/ScalarPopover.stories.d.ts.map +1 -1
- package/dist/components/ScalarPopover/ScalarPopover.vue.d.ts +4 -11
- package/dist/components/ScalarPopover/ScalarPopover.vue.d.ts.map +1 -1
- package/dist/components/ScalarPopover/ScalarPopover.vue.js +23 -24
- package/dist/components/ScalarPopover/index.d.ts +1 -0
- package/dist/components/ScalarPopover/index.d.ts.map +1 -1
- package/dist/components/ScalarPopover/types.d.ts +15 -0
- package/dist/components/ScalarPopover/types.d.ts.map +1 -0
- package/dist/components/ScalarSearchInput/ScalarSearchInput.stories.d.ts +6 -1
- package/dist/components/ScalarSearchInput/ScalarSearchInput.stories.d.ts.map +1 -1
- package/dist/components/ScalarSearchInput/ScalarSearchInput.vue.js +3 -3
- package/dist/components/ScalarSearchInput/ScalarSearchInput.vue2.js +10 -10
- package/dist/components/ScalarSearchResults/ScalarSearchResultItem.vue.d.ts.map +1 -1
- package/dist/components/ScalarSearchResults/ScalarSearchResultItem.vue.js +31 -35
- package/dist/components/ScalarSearchResults/ScalarSearchResultList.vue.d.ts.map +1 -1
- package/dist/components/ScalarSearchResults/ScalarSearchResultList.vue.js +12 -18
- package/dist/components/ScalarToggle/ScalarToggle.stories.d.ts +26 -39
- package/dist/components/ScalarToggle/ScalarToggle.stories.d.ts.map +1 -1
- package/dist/components/ScalarToggle/ScalarToggle.vue.d.ts +3 -5
- package/dist/components/ScalarToggle/ScalarToggle.vue.d.ts.map +1 -1
- package/dist/components/ScalarToggle/ScalarToggle.vue.js +24 -35
- package/dist/hooks/useBindCx.d.ts +51 -0
- package/dist/hooks/useBindCx.d.ts.map +1 -0
- package/dist/hooks/useBindCx.js +34 -0
- package/dist/hooks/useBindCx.stories.d.ts +430 -0
- package/dist/hooks/useBindCx.stories.d.ts.map +1 -0
- package/dist/hooks/useBindCx.test.d.ts +2 -0
- package/dist/hooks/useBindCx.test.d.ts.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +80 -68
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
import { defineComponent as r,
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as r, openBlock as n, createElementBlock as a, mergeProps as m, unref as u, renderSlot as s, createElementVNode as t, createCommentVNode as f } from "vue";
|
|
2
|
+
import { useBindCx as p } from "../../hooks/useBindCx.js";
|
|
3
|
+
const x = /* @__PURE__ */ r({
|
|
4
4
|
inheritAttrs: !1,
|
|
5
5
|
__name: "ScalarSearchResultList",
|
|
6
6
|
props: {
|
|
7
7
|
noResults: { type: Boolean }
|
|
8
8
|
},
|
|
9
|
-
setup(
|
|
10
|
-
const l =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
role: "listbox"
|
|
17
|
-
}), [
|
|
18
|
-
e.noResults ? o(e.$slots, "noResults", { key: 0 }, () => [
|
|
19
|
-
t[0] || (t[0] = s("div", { class: "flex flex-col items-center gap-2 px-3 py-4" }, [
|
|
20
|
-
s("div", { class: "rotate-90 text-lg font-bold" }, ":("),
|
|
21
|
-
s("div", { class: "text-sm font-medium text-c-2" }, "No results found")
|
|
9
|
+
setup(c) {
|
|
10
|
+
const { cx: l } = p();
|
|
11
|
+
return (e, o) => (n(), a("ul", m({ role: "listbox" }, u(l)("flex flex-col")), [
|
|
12
|
+
e.noResults ? s(e.$slots, "noResults", { key: 0 }, () => [
|
|
13
|
+
o[0] || (o[0] = t("div", { class: "flex flex-col items-center gap-2 px-3 py-4" }, [
|
|
14
|
+
t("div", { class: "rotate-90 text-lg font-bold" }, ":("),
|
|
15
|
+
t("div", { class: "text-sm font-medium text-c-2" }, "No results found")
|
|
22
16
|
], -1))
|
|
23
17
|
]) : f("", !0),
|
|
24
|
-
|
|
18
|
+
s(e.$slots, "default")
|
|
25
19
|
], 16));
|
|
26
20
|
}
|
|
27
21
|
});
|
|
28
22
|
export {
|
|
29
|
-
|
|
23
|
+
x as default
|
|
30
24
|
};
|
|
@@ -1,86 +1,73 @@
|
|
|
1
1
|
import type { StoryObj } from '@storybook/vue3';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
component: import("vue").DefineComponent<{
|
|
4
|
-
modelValue
|
|
4
|
+
modelValue?: boolean;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
-
|
|
7
|
-
ariaLabel?: string;
|
|
8
|
-
ariaLabelledBy?: string;
|
|
6
|
+
label?: string;
|
|
9
7
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
10
8
|
"update:modelValue": (value: boolean) => any;
|
|
11
9
|
}, string, import("vue").PublicProps, Readonly<{
|
|
12
|
-
modelValue
|
|
10
|
+
modelValue?: boolean;
|
|
13
11
|
disabled?: boolean;
|
|
14
|
-
|
|
15
|
-
ariaLabel?: string;
|
|
16
|
-
ariaLabelledBy?: string;
|
|
12
|
+
label?: string;
|
|
17
13
|
}> & Readonly<{
|
|
18
14
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
19
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {},
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLButtonElement>;
|
|
20
16
|
tags: string[];
|
|
17
|
+
args: {
|
|
18
|
+
modelValue: false;
|
|
19
|
+
};
|
|
21
20
|
argTypes: {
|
|
22
|
-
|
|
23
|
-
control: "
|
|
21
|
+
label: {
|
|
22
|
+
control: "text";
|
|
24
23
|
};
|
|
25
24
|
disabled: {
|
|
26
25
|
control: "boolean";
|
|
27
26
|
};
|
|
28
27
|
};
|
|
29
28
|
render: (args: import("@storybook/vue3").ComponentPropsAndSlots<import("vue").DefineComponent<{
|
|
30
|
-
modelValue
|
|
29
|
+
modelValue?: boolean;
|
|
31
30
|
disabled?: boolean;
|
|
32
|
-
|
|
33
|
-
ariaLabel?: string;
|
|
34
|
-
ariaLabelledBy?: string;
|
|
31
|
+
label?: string;
|
|
35
32
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
36
33
|
"update:modelValue": (value: boolean) => any;
|
|
37
34
|
}, string, import("vue").PublicProps, Readonly<{
|
|
38
|
-
modelValue
|
|
35
|
+
modelValue?: boolean;
|
|
39
36
|
disabled?: boolean;
|
|
40
|
-
|
|
41
|
-
ariaLabel?: string;
|
|
42
|
-
ariaLabelledBy?: string;
|
|
37
|
+
label?: string;
|
|
43
38
|
}> & Readonly<{
|
|
44
39
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
45
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {},
|
|
40
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLButtonElement>>) => {
|
|
46
41
|
components: {
|
|
47
42
|
ScalarToggle: import("vue").DefineComponent<{
|
|
48
|
-
modelValue
|
|
43
|
+
modelValue?: boolean;
|
|
49
44
|
disabled?: boolean;
|
|
50
|
-
|
|
51
|
-
ariaLabel?: string;
|
|
52
|
-
ariaLabelledBy?: string;
|
|
45
|
+
label?: string;
|
|
53
46
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
54
47
|
"update:modelValue": (value: boolean) => any;
|
|
55
48
|
}, string, import("vue").PublicProps, Readonly<{
|
|
56
|
-
modelValue
|
|
49
|
+
modelValue?: boolean;
|
|
57
50
|
disabled?: boolean;
|
|
58
|
-
|
|
59
|
-
ariaLabel?: string;
|
|
60
|
-
ariaLabelledBy?: string;
|
|
51
|
+
label?: string;
|
|
61
52
|
}> & Readonly<{
|
|
62
53
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
63
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {},
|
|
54
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLButtonElement>;
|
|
64
55
|
};
|
|
65
56
|
setup(this: void): {
|
|
66
57
|
args: import("@storybook/vue3").ComponentPropsAndSlots<import("vue").DefineComponent<{
|
|
67
|
-
modelValue
|
|
58
|
+
modelValue?: boolean;
|
|
68
59
|
disabled?: boolean;
|
|
69
|
-
|
|
70
|
-
ariaLabel?: string;
|
|
71
|
-
ariaLabelledBy?: string;
|
|
60
|
+
label?: string;
|
|
72
61
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
73
62
|
"update:modelValue": (value: boolean) => any;
|
|
74
63
|
}, string, import("vue").PublicProps, Readonly<{
|
|
75
|
-
modelValue
|
|
64
|
+
modelValue?: boolean;
|
|
76
65
|
disabled?: boolean;
|
|
77
|
-
|
|
78
|
-
ariaLabel?: string;
|
|
79
|
-
ariaLabelledBy?: string;
|
|
66
|
+
label?: string;
|
|
80
67
|
}> & Readonly<{
|
|
81
68
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
82
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {},
|
|
83
|
-
model: import("vue").Ref<boolean, boolean>;
|
|
69
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLButtonElement>>;
|
|
70
|
+
model: import("vue").Ref<boolean | undefined, boolean | undefined>;
|
|
84
71
|
};
|
|
85
72
|
template: string;
|
|
86
73
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarToggle.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/ScalarToggle.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAKrD,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"ScalarToggle.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/ScalarToggle.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAKrD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgB2B,CAAA;AAErC,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,IAAI,EAAE,KAAwC,CAAA;AAE3D,eAAO,MAAM,QAAQ,EAAE,KAEtB,CAAA"}
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
|
-
modelValue
|
|
2
|
+
modelValue?: boolean;
|
|
3
3
|
disabled?: boolean;
|
|
4
|
-
|
|
5
|
-
ariaLabel?: string;
|
|
6
|
-
ariaLabelledBy?: string;
|
|
4
|
+
label?: string;
|
|
7
5
|
};
|
|
8
6
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
7
|
"update:modelValue": (value: boolean) => any;
|
|
10
8
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
11
9
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
12
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {},
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLButtonElement>;
|
|
13
11
|
export default _default;
|
|
14
12
|
//# sourceMappingURL=ScalarToggle.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScalarToggle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/ScalarToggle.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScalarToggle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/ScalarToggle.vue"],"names":[],"mappings":"AAkDA,KAAK,WAAW,GAAG;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC;;;;;;AAgGF,wBAQG"}
|
|
@@ -1,54 +1,43 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { cva as
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as u, openBlock as t, createElementBlock as l, normalizeClass as o, unref as n, createElementVNode as m, toDisplayString as p, createCommentVNode as b } from "vue";
|
|
2
|
+
import { cva as f, cx as h } from "../../cva.js";
|
|
3
|
+
const V = ["aria-checked", "aria-disabled"], g = {
|
|
4
|
+
key: 0,
|
|
5
|
+
class: "sr-only"
|
|
6
|
+
}, w = /* @__PURE__ */ u({
|
|
4
7
|
__name: "ScalarToggle",
|
|
5
8
|
props: {
|
|
6
9
|
modelValue: { type: Boolean },
|
|
7
10
|
disabled: { type: Boolean },
|
|
8
|
-
|
|
9
|
-
ariaLabel: {},
|
|
10
|
-
ariaLabelledBy: {}
|
|
11
|
+
label: {}
|
|
11
12
|
},
|
|
12
13
|
emits: ["update:modelValue"],
|
|
13
|
-
setup(
|
|
14
|
-
const a =
|
|
15
|
-
function
|
|
16
|
-
a.disabled ||
|
|
14
|
+
setup(r, { emit: s }) {
|
|
15
|
+
const a = r, d = s;
|
|
16
|
+
function i() {
|
|
17
|
+
a.disabled || d("update:modelValue", !a.modelValue);
|
|
17
18
|
}
|
|
18
|
-
const
|
|
19
|
+
const c = f({
|
|
19
20
|
base: "relative h-3.5 w-6 cursor-pointer rounded-full bg-b-3 transition-colors duration-300",
|
|
20
21
|
variants: {
|
|
21
22
|
checked: { true: "bg-c-accent" },
|
|
22
23
|
disabled: { true: "cursor-not-allowed opacity-40" }
|
|
23
24
|
}
|
|
24
25
|
});
|
|
25
|
-
return (e, k) => (
|
|
26
|
-
|
|
26
|
+
return (e, k) => (t(), l("button", {
|
|
27
|
+
"aria-checked": e.modelValue,
|
|
28
|
+
"aria-disabled": e.disabled,
|
|
29
|
+
class: o(n(h)(n(c)({ checked: e.modelValue, disabled: e.disabled }))),
|
|
27
30
|
role: "switch",
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
i(t(l, ["prevent"]), ["enter"]),
|
|
31
|
-
i(t(l, ["prevent"]), ["space"])
|
|
32
|
-
]
|
|
31
|
+
type: "button",
|
|
32
|
+
onClick: i
|
|
33
33
|
}, [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"aria-labelledby": a.ariaLabelledBy,
|
|
40
|
-
checked: e.modelValue,
|
|
41
|
-
class: "hidden",
|
|
42
|
-
disabled: e.disabled,
|
|
43
|
-
type: "checkbox",
|
|
44
|
-
onChange: l
|
|
45
|
-
}, null, 40, g),
|
|
46
|
-
r("div", {
|
|
47
|
-
class: d(["absolute left-px top-px flex h-3 w-3 items-center justify-center rounded-full bg-white text-c-accent transition-transform duration-300", { "translate-x-2.5": e.modelValue }])
|
|
48
|
-
}, null, 2)
|
|
49
|
-
], 42, y));
|
|
34
|
+
m("div", {
|
|
35
|
+
class: o(["absolute left-px top-px flex h-3 w-3 items-center justify-center rounded-full bg-white text-c-accent transition-transform duration-300", { "translate-x-2.5": e.modelValue }])
|
|
36
|
+
}, null, 2),
|
|
37
|
+
e.label ? (t(), l("span", g, p(e.label), 1)) : b("", !0)
|
|
38
|
+
], 10, V));
|
|
50
39
|
}
|
|
51
40
|
});
|
|
52
41
|
export {
|
|
53
|
-
|
|
42
|
+
w as default
|
|
54
43
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { CXOptions } from 'cva';
|
|
2
|
+
/**
|
|
3
|
+
* Provides a wrapper around the `cx` function that merges the
|
|
4
|
+
* component's class attribute with the provided classes and binds the
|
|
5
|
+
* remaining attributes
|
|
6
|
+
*
|
|
7
|
+
* @see https://beta.cva.style/api-reference#cx
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <script setup>
|
|
11
|
+
* import { useBindCx, cva } from '@scalar/components'
|
|
12
|
+
*
|
|
13
|
+
* defineProps<{ active?: boolean }>()
|
|
14
|
+
*
|
|
15
|
+
* // Important: disable inheritance of attributes
|
|
16
|
+
* defineOptions({ inheritAttrs: false })
|
|
17
|
+
*
|
|
18
|
+
* const { cx } = useBindCx()
|
|
19
|
+
*
|
|
20
|
+
* const variants = cva({
|
|
21
|
+
* base: 'border rounded p-2 bg-b-1',
|
|
22
|
+
* variants: { active: { true: 'bg-b-2' } },
|
|
23
|
+
* })
|
|
24
|
+
* </script>
|
|
25
|
+
* <template>
|
|
26
|
+
* <div v-bind="cx(variants({ active }))">MockComponent</div>
|
|
27
|
+
* </template>
|
|
28
|
+
*/
|
|
29
|
+
export declare function useBindCx(): {
|
|
30
|
+
/**
|
|
31
|
+
* Provides a wrapper around the `cx` function that merges the
|
|
32
|
+
* component's class attribute with the provided classes and binds the
|
|
33
|
+
* remaining attributes
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* <script setup>
|
|
37
|
+
* ...
|
|
38
|
+
* const { cx } = useBindCx()
|
|
39
|
+
* </script>
|
|
40
|
+
* <template>
|
|
41
|
+
* <div v-bind="cx(...)">...</div>
|
|
42
|
+
* </template>
|
|
43
|
+
*/
|
|
44
|
+
cx: (...args: CXOptions) => {
|
|
45
|
+
/** The merged class attribute */
|
|
46
|
+
class: string;
|
|
47
|
+
/** The remaining attributes */
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=useBindCx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBindCx.d.ts","sourceRoot":"","sources":["../../src/hooks/useBindCx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAKpC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,SAAS;IAmBrB;;;;;;;;;;;;;OAaG;kBA1BoB,SAAS,KAAG;QACnC,iCAAiC;QACjC,KAAK,EAAE,MAAM,CAAA;QACb,+BAA+B;QAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACnB;EAwBF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { computed as e, useAttrs as n } from "vue";
|
|
2
|
+
import { cx as o } from "../cva.js";
|
|
3
|
+
function l() {
|
|
4
|
+
const t = e(() => {
|
|
5
|
+
const { class: s, ...c } = n();
|
|
6
|
+
return { class: s || "", rest: c };
|
|
7
|
+
});
|
|
8
|
+
function r(...s) {
|
|
9
|
+
return {
|
|
10
|
+
class: o(...s, t.value.class),
|
|
11
|
+
...t.value.rest
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
/**
|
|
16
|
+
* Provides a wrapper around the `cx` function that merges the
|
|
17
|
+
* component's class attribute with the provided classes and binds the
|
|
18
|
+
* remaining attributes
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* <script setup>
|
|
22
|
+
* ...
|
|
23
|
+
* const { cx } = useBindCx()
|
|
24
|
+
* <\/script>
|
|
25
|
+
* <template>
|
|
26
|
+
* <div v-bind="cx(...)">...</div>
|
|
27
|
+
* </template>
|
|
28
|
+
*/
|
|
29
|
+
cx: r
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
l as useBindCx
|
|
34
|
+
};
|