@scalar/components 0.14.36 → 0.14.38

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.
Files changed (73) hide show
  1. package/dist/components/ScalarCheckboxInput/ScalarCheckbox.vue.d.ts +23 -0
  2. package/dist/components/ScalarCheckboxInput/ScalarCheckbox.vue.d.ts.map +1 -0
  3. package/dist/components/ScalarCheckboxInput/ScalarCheckbox.vue.js +27 -0
  4. package/dist/components/ScalarCheckboxInput/ScalarCheckbox.vue2.js +4 -0
  5. package/dist/components/ScalarCheckboxInput/ScalarCheckboxGroup.vue.d.ts +21 -0
  6. package/dist/components/ScalarCheckboxInput/ScalarCheckboxGroup.vue.d.ts.map +1 -0
  7. package/dist/components/ScalarCheckboxInput/ScalarCheckboxGroup.vue.js +37 -0
  8. package/dist/components/ScalarCheckboxInput/ScalarCheckboxGroup.vue2.js +4 -0
  9. package/dist/components/ScalarCheckboxInput/ScalarCheckboxInput.vue.d.ts +33 -0
  10. package/dist/components/ScalarCheckboxInput/ScalarCheckboxInput.vue.d.ts.map +1 -0
  11. package/dist/components/ScalarCheckboxInput/ScalarCheckboxInput.vue.js +45 -0
  12. package/dist/components/ScalarCheckboxInput/ScalarCheckboxInput.vue2.js +4 -0
  13. package/dist/components/ScalarCheckboxInput/ScalarCheckboxRadioGroup.vue.d.ts +21 -0
  14. package/dist/components/ScalarCheckboxInput/ScalarCheckboxRadioGroup.vue.d.ts.map +1 -0
  15. package/dist/components/ScalarCheckboxInput/ScalarCheckboxRadioGroup.vue.js +38 -0
  16. package/dist/components/ScalarCheckboxInput/ScalarCheckboxRadioGroup.vue2.js +4 -0
  17. package/dist/components/ScalarCheckboxInput/index.d.ts +6 -0
  18. package/dist/components/ScalarCheckboxInput/index.d.ts.map +1 -0
  19. package/dist/components/ScalarCheckboxInput/types.d.ts +7 -0
  20. package/dist/components/ScalarCheckboxInput/types.d.ts.map +1 -0
  21. package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.vue.js +11 -13
  22. package/dist/components/ScalarFileUpload/ScalarFileUpload.vue.d.ts +1 -1
  23. package/dist/components/ScalarForm/ScalarFormInput.vue.d.ts +28 -0
  24. package/dist/components/ScalarForm/ScalarFormInput.vue.d.ts.map +1 -0
  25. package/dist/components/ScalarForm/ScalarFormInput.vue.js +39 -0
  26. package/dist/components/ScalarForm/ScalarFormInput.vue2.js +4 -0
  27. package/dist/components/ScalarForm/ScalarFormInputGroup.vue.d.ts +39 -0
  28. package/dist/components/ScalarForm/ScalarFormInputGroup.vue.d.ts.map +1 -0
  29. package/dist/components/ScalarForm/ScalarFormInputGroup.vue.js +23 -0
  30. package/dist/components/ScalarForm/ScalarFormInputGroup.vue2.js +4 -0
  31. package/dist/components/ScalarForm/ScalarFormSection.vue.js +5 -5
  32. package/dist/components/ScalarForm/index.d.ts +3 -1
  33. package/dist/components/ScalarForm/index.d.ts.map +1 -1
  34. package/dist/components/ScalarForm/useFormGroups.d.ts +18 -0
  35. package/dist/components/ScalarForm/useFormGroups.d.ts.map +1 -0
  36. package/dist/components/ScalarForm/useFormGroups.js +9 -0
  37. package/dist/components/ScalarListbox/ScalarListboxInput.vue.d.ts +24 -0
  38. package/dist/components/ScalarListbox/ScalarListboxInput.vue.d.ts.map +1 -0
  39. package/dist/components/ScalarListbox/ScalarListboxInput.vue.js +26 -0
  40. package/dist/components/ScalarListbox/ScalarListboxInput.vue2.js +4 -0
  41. package/dist/components/ScalarListbox/index.d.ts +2 -1
  42. package/dist/components/ScalarListbox/index.d.ts.map +1 -1
  43. package/dist/components/ScalarMarkdown/ScalarMarkdown.vue.d.ts.map +1 -1
  44. package/dist/components/ScalarMarkdown/samples/index.d.ts +1 -1
  45. package/dist/components/ScalarMarkdown/samples/tables.d.ts +1 -1
  46. package/dist/components/ScalarMarkdown/samples/tables.d.ts.map +1 -1
  47. package/dist/components/ScalarTextArea/ScalarTextArea.vue.d.ts.map +1 -1
  48. package/dist/components/ScalarTextArea/ScalarTextArea.vue.js +27 -28
  49. package/dist/components/ScalarTextInput/ScalarTextInput.vue.d.ts +4 -0
  50. package/dist/components/ScalarTextInput/ScalarTextInput.vue.d.ts.map +1 -1
  51. package/dist/components/ScalarTextInput/ScalarTextInput.vue.js +53 -44
  52. package/dist/components/ScalarToggle/ScalarToggle.vue.d.ts +5 -3
  53. package/dist/components/ScalarToggle/ScalarToggle.vue.d.ts.map +1 -1
  54. package/dist/components/ScalarToggle/ScalarToggle.vue.js +24 -22
  55. package/dist/components/ScalarToggle/ScalarToggleGroup.vue.d.ts +21 -0
  56. package/dist/components/ScalarToggle/ScalarToggleGroup.vue.d.ts.map +1 -0
  57. package/dist/components/ScalarToggle/ScalarToggleGroup.vue.js +35 -0
  58. package/dist/components/ScalarToggle/ScalarToggleGroup.vue2.js +4 -0
  59. package/dist/components/ScalarToggle/ScalarToggleInput.vue.d.ts +28 -0
  60. package/dist/components/ScalarToggle/ScalarToggleInput.vue.d.ts.map +1 -0
  61. package/dist/components/ScalarToggle/ScalarToggleInput.vue.js +36 -0
  62. package/dist/components/ScalarToggle/ScalarToggleInput.vue2.js +4 -0
  63. package/dist/components/ScalarToggle/index.d.ts +2 -0
  64. package/dist/components/ScalarToggle/index.d.ts.map +1 -1
  65. package/dist/index.d.ts +2 -1
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +184 -166
  68. package/dist/style.css +1 -1
  69. package/package.json +6 -6
  70. package/dist/components/ScalarCheckbox/ScalarCheckbox.vue.d.ts +0 -26
  71. package/dist/components/ScalarCheckbox/ScalarCheckbox.vue.d.ts.map +0 -1
  72. package/dist/components/ScalarCheckbox/index.d.ts +0 -2
  73. package/dist/components/ScalarCheckbox/index.d.ts.map +0 -1
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Scalar Listbox Input component
3
+ *
4
+ * Provides a standard button for opening a listbox.
5
+ *
6
+ * @example
7
+ * <ScalarListbox v-model="selected" :options v-slot="{ open }">
8
+ * <ScalarListboxInput :open>{{ selected.label }}</ScalarListboxInput>
9
+ * </ScalarListbox>
10
+ */
11
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
12
+ open?: Boolean;
13
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
14
+ open?: Boolean;
15
+ }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
16
+ default?: (props: {}) => any;
17
+ }>;
18
+ export default _default;
19
+ type __VLS_WithSlots<T, S> = T & {
20
+ new (): {
21
+ $slots: S;
22
+ };
23
+ };
24
+ //# sourceMappingURL=ScalarListboxInput.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScalarListboxInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarListbox/ScalarListboxInput.vue"],"names":[],"mappings":"AAmCA;;;;;;;;;GASG;;WAEyB,OAAO;;WAAP,OAAO;;cA+CrB,CAAC,KAAK,IAAgB,KAAK,GAAG;;AAhD5C,wBA8EC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { defineComponent as o, createBlock as n, openBlock as r, unref as t, withCtx as a, createElementVNode as s, createVNode as l, renderSlot as c, normalizeClass as i } from "vue";
2
+ import { ScalarIconCaretDown as _ } from "@scalar/icons";
3
+ import f from "../ScalarForm/ScalarFormInput.vue.js";
4
+ const m = { class: "flex-1 text-left min-w-0 truncate" }, p = {}, w = /* @__PURE__ */ o({
5
+ ...p,
6
+ __name: "ScalarListboxInput",
7
+ props: {
8
+ open: {}
9
+ },
10
+ setup(u) {
11
+ return (e, d) => (r(), n(t(f), null, {
12
+ default: a(() => [
13
+ s("div", m, [
14
+ c(e.$slots, "default")
15
+ ]),
16
+ l(t(_), {
17
+ class: i(["transition-transform size-3.5", { "rotate-180": e.open }])
18
+ }, null, 8, ["class"])
19
+ ]),
20
+ _: 3
21
+ }));
22
+ }
23
+ });
24
+ export {
25
+ w as default
26
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ScalarListboxInput.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -1,5 +1,6 @@
1
1
  export { default as ScalarListbox } from './ScalarListbox.vue.js';
2
- export { default as ScalarListboxItem } from './ScalarListboxItem.vue.js';
3
2
  export { default as ScalarListboxCheckbox } from './ScalarListboxCheckbox.vue.js';
3
+ export { default as ScalarListboxInput } from './ScalarListboxInput.vue.js';
4
+ export { default as ScalarListboxItem } from './ScalarListboxItem.vue.js';
4
5
  export type { Option as ScalarListboxOption } from './types';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarListbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAE9E,YAAY,EAAE,MAAM,IAAI,mBAAmB,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarListbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACtE,YAAY,EAAE,MAAM,IAAI,mBAAmB,EAAE,MAAM,SAAS,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarMarkdown.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarMarkdown/ScalarMarkdown.vue"],"names":[],"mappings":"AAgrBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;;;;AA+FlD,wBAOG"}
1
+ {"version":3,"file":"ScalarMarkdown.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarMarkdown/ScalarMarkdown.vue"],"names":[],"mappings":"AAirBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;;;;AA+FlD,wBAOG"}
@@ -27,6 +27,6 @@ export declare const samples: readonly [{
27
27
  readonly value: "\nA paragraph is simply one or more consecutive lines of text, separated\nby one or more blank lines. (A blank line is any line that looks like a\nblank line -- a line containing nothing but spaces or tabs is considered\nblank.) Normal paragraphs should not be indented with spaces or tabs.\n\n---\n\nLine with a soft break\n...following line.\n\nLine with a hard break \n...following line.\n\n--- \n\nLine with several blank lines after...\n\n\n\n...following paragraph.\n";
28
28
  }, {
29
29
  readonly label: "Tables";
30
- readonly value: "\nBasic Table\n\n| Syntax | Description |\n| ----------- | ----------- |\n| Header | Title |\n| Paragraph | Text |\n\n\n---\n\nTable with alignment\n\n| Syntax | Description | Test Text |\n| :--- | :----: | ---: |\n| Header | Title | Here's this |\n| Paragraph | Text | And more |\n";
30
+ readonly value: "\nBasic Table\n\n| Syntax | Description |\n| ------------------------------------------------- | ----------- |\n| Header | Title |\n| Paragraph | Text |\n| Superlongtextinasinglecolumnshouldwrapatsomepoint | Text |\n\n\n---\n\nTable with alignment\n\n| Syntax | Description | Test Text |\n| :--- | :----: | ---: |\n| Header | Title | Here's this |\n| Paragraph | Text | And more |\n";
31
31
  }];
32
32
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- declare const _default: "\nBasic Table\n\n| Syntax | Description |\n| ----------- | ----------- |\n| Header | Title |\n| Paragraph | Text |\n\n\n---\n\nTable with alignment\n\n| Syntax | Description | Test Text |\n| :--- | :----: | ---: |\n| Header | Title | Here's this |\n| Paragraph | Text | And more |\n";
1
+ declare const _default: "\nBasic Table\n\n| Syntax | Description |\n| ------------------------------------------------- | ----------- |\n| Header | Title |\n| Paragraph | Text |\n| Superlongtextinasinglecolumnshouldwrapatsomepoint | Text |\n\n\n---\n\nTable with alignment\n\n| Syntax | Description | Test Text |\n| :--- | :----: | ---: |\n| Header | Title | Here's this |\n| Paragraph | Text | And more |\n";
2
2
  export default _default;
3
3
  //# sourceMappingURL=tables.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../../src/components/ScalarMarkdown/samples/tables.ts"],"names":[],"mappings":";AAAA,wBAiBC"}
1
+ {"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../../src/components/ScalarMarkdown/samples/tables.ts"],"names":[],"mappings":";AAAA,wBAkBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarTextArea.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTextArea/ScalarTextArea.vue"],"names":[],"mappings":"AAsDA;;;;;;;GAOG;;iBAuBU,MAAM;;;;iBAAN,MAAM;;;;AAtBnB,wBA0FC"}
1
+ {"version":3,"file":"ScalarTextArea.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTextArea/ScalarTextArea.vue"],"names":[],"mappings":"AAuDA;;;;;;;GAOG;;iBAuBU,MAAM;;;;iBAAN,MAAM;;;;AAtBnB,wBAwGC"}
@@ -1,8 +1,9 @@
1
- import { defineComponent as a, useModel as m, onMounted as d, createElementBlock as f, openBlock as c, mergeProps as l, unref as n, withDirectives as p, createElementVNode as x, vModelText as v } from "vue";
2
- import { useBindCx as b } from "@scalar/use-hooks/useBindCx";
3
- import { useTextareaAutosize as _ } from "@vueuse/core";
4
- const g = {}, A = /* @__PURE__ */ a({
5
- ...g,
1
+ import { defineComponent as u, useModel as m, onMounted as f, createBlock as d, openBlock as c, unref as t, mergeProps as l, withCtx as p, withDirectives as x, createElementVNode as _, vModelText as v } from "vue";
2
+ import { useBindCx as h } from "@scalar/use-hooks/useBindCx";
3
+ import { useTextareaAutosize as k } from "@vueuse/core";
4
+ import C from "../ScalarForm/ScalarFormInput.vue.js";
5
+ const V = {}, T = /* @__PURE__ */ u({
6
+ ...V,
6
7
  inheritAttrs: !1,
7
8
  __name: "ScalarTextArea",
8
9
  props: {
@@ -10,32 +11,30 @@ const g = {}, A = /* @__PURE__ */ a({
10
11
  modelModifiers: {}
11
12
  },
12
13
  emits: ["update:modelValue"],
13
- setup(u) {
14
- const t = m(u, "modelValue"), { textarea: o } = _({
14
+ setup(a) {
15
+ const o = m(a, "modelValue"), { textarea: r } = k({
15
16
  // @ts-expect-error - unexpected type mismatch
16
- input: t,
17
+ input: o,
17
18
  styleProp: "minHeight"
18
- }), { classCx: i, otherAttrs: r } = b();
19
- return d(() => {
20
- "autofocus" in r.value && o.value?.focus();
21
- }), (h, e) => (c(), f("div", l(
22
- n(i)(
23
- "bg-b-1.5 custom-scroll flex min-h-0 shrink cursor-text items-center gap-0.75 rounded-md border px-3 py-2.5 outline-offset-[-1px] focus-within:bg-b-1 has-[input:focus-visible]:outline"
24
- ),
25
- {
26
- onClick: e[1] || (e[1] = (s) => n(o)?.focus())
27
- }
28
- ), [
29
- p(x("textarea", l({
30
- ref_key: "textarea",
31
- ref: o,
32
- "onUpdate:modelValue": e[0] || (e[0] = (s) => t.value = s)
33
- }, n(r), { class: "w-full resize-none border-none bg-transparent text-sm focus-within:outline-none" }), null, 16), [
34
- [v, t.value]
35
- ])
36
- ], 16));
19
+ }), { classCx: i, otherAttrs: n } = h();
20
+ return f(() => {
21
+ "autofocus" in n.value && r.value?.focus();
22
+ }), (w, e) => (c(), d(t(C), l({ is: "div" }, t(i)("custom-scroll flex text-c-1 min-h-0 shrink cursor-text"), {
23
+ onClick: e[1] || (e[1] = (s) => t(r)?.focus())
24
+ }), {
25
+ default: p(() => [
26
+ x(_("textarea", l({
27
+ ref_key: "textarea",
28
+ ref: r,
29
+ "onUpdate:modelValue": e[0] || (e[0] = (s) => o.value = s)
30
+ }, t(n), { class: "w-full resize-none border-none bg-transparent text-sm focus-within:outline-none" }), null, 16), [
31
+ [v, o.value]
32
+ ])
33
+ ]),
34
+ _: 1
35
+ }, 16));
37
36
  }
38
37
  });
39
38
  export {
40
- A as default
39
+ T as default
41
40
  };
@@ -7,10 +7,14 @@
7
7
  * <ScalarTextInput v-model="model" />
8
8
  */
9
9
  declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
10
+ readonly?: boolean;
11
+ } & {
10
12
  modelValue?: string;
11
13
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
14
  "update:modelValue": (value: string | undefined) => any;
13
15
  }, string, import("vue").PublicProps, Readonly<{
16
+ readonly?: boolean;
17
+ } & {
14
18
  modelValue?: string;
15
19
  }> & Readonly<{
16
20
  "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarTextInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTextInput/ScalarTextInput.vue"],"names":[],"mappings":"AAuEA;;;;;;;GAOG;;iBAmBU,MAAM;;;;iBAAN,MAAM;;;;aA0FN,CAAC,KAAK,IAAgB,KAAK,GAAG;;aAC9B,CAAC,KAAK,IAAgB,KAAK,GAAG;;aAC9B,CAAC,KAAK,IAAgB,KAAK,GAAG;;YAC/B,CAAC,KAAK,IAAgB,KAAK,GAAG;;AA/G1C,wBAkJC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ScalarTextInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarTextInput/ScalarTextInput.vue"],"names":[],"mappings":"AAwFA;;;;;;;GAOG;;eAGU,OAAO;;iBA6BP,MAAM;;;;eA7BN,OAAO;;iBA6BP,MAAM;;;;aA2GN,CAAC,KAAK,IAAiB,KAAK,GAAG;;aAC/B,CAAC,KAAK,IAAiB,KAAK,GAAG;;aAC/B,CAAC,KAAK,IAAiB,KAAK,GAAG;;YAChC,CAAC,KAAK,IAAiB,KAAK,GAAG;;AA7I3C,wBAkLC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,64 +1,73 @@
1
- import { defineComponent as x, useModel as h, ref as v, onMounted as $, createElementBlock as t, openBlock as s, mergeProps as d, unref as f, createElementVNode as a, renderSlot as n, createCommentVNode as l, withDirectives as b, vModelDynamic as w, toDisplayString as _ } from "vue";
2
- import { useBindCx as k } from "@scalar/use-hooks/useBindCx";
3
- const y = { class: "flex flex-1 relative" }, g = {
1
+ import { defineComponent as y, mergeModels as v, useModel as x, ref as _, onMounted as $, createBlock as k, openBlock as t, unref as r, mergeProps as c, withCtx as w, createElementVNode as i, renderSlot as o, createElementBlock as n, createCommentVNode as l, withDirectives as C, vModelDynamic as V, toDisplayString as b } from "vue";
2
+ import { useBindCx as g } from "@scalar/use-hooks/useBindCx";
3
+ import B from "../ScalarForm/ScalarFormInput.vue.js";
4
+ const M = { class: "flex flex-1 relative" }, D = {
4
5
  key: 0,
5
6
  class: "select-none whitespace-nowrap text-sm text-transparent"
6
- }, V = {
7
+ }, S = ["readonly", "aria-readonly"], A = {
7
8
  key: 1,
8
9
  class: "absolute inset-0 select-none overflow-hidden whitespace-nowrap text-sm"
9
- }, C = {
10
+ }, E = {
10
11
  key: 0,
11
12
  class: "text-c-2"
12
- }, M = { class: "text-transparent" }, B = {
13
+ }, N = { class: "text-transparent" }, z = {
13
14
  key: 1,
14
15
  class: "text-c-2"
15
- }, D = {}, E = /* @__PURE__ */ x({
16
- ...D,
16
+ }, I = {}, j = /* @__PURE__ */ y({
17
+ ...I,
17
18
  inheritAttrs: !1,
18
19
  __name: "ScalarTextInput",
19
- props: {
20
+ props: /* @__PURE__ */ v({
21
+ readonly: { type: Boolean }
22
+ }, {
20
23
  modelValue: {},
21
24
  modelModifiers: {}
22
- },
25
+ }),
23
26
  emits: ["update:modelValue"],
24
- setup(c) {
25
- const r = h(c, "modelValue"), i = v(), { classCx: m, otherAttrs: u } = k();
26
- return $(() => {
27
- "autofocus" in u.value && i.value?.focus();
28
- }), (e, o) => (s(), t("div", d(
29
- f(m)(
30
- "bg-b-1.5 flex cursor-text items-center gap-0.75 rounded-md border px-3 py-2.5 outline-offset-[-1px] focus-within:bg-b-1 has-[input:focus-visible]:outline"
31
- ),
32
- {
33
- onClick: o[1] || (o[1] = (p) => i.value?.focus())
34
- }
35
- ), [
36
- a("div", y, [
37
- e.$slots.prefix ? (s(), t("span", g, [
38
- n(e.$slots, "prefix")
39
- ])) : l("", !0),
40
- b(a("input", d({
41
- ref_key: "input",
42
- ref: i,
43
- "onUpdate:modelValue": o[0] || (o[0] = (p) => r.value = p),
44
- class: "z-1 min-w-0 flex-1 border-none bg-transparent text-sm placeholder:font-[inherit] focus-within:outline-none"
45
- }, f(u)), null, 16), [
46
- [w, r.value]
47
- ]),
48
- e.$slots.prefix || e.$slots.suffix ? (s(), t("div", V, [
49
- e.$slots.prefix ? (s(), t("span", C, [
50
- n(e.$slots, "prefix")
27
+ setup(d) {
28
+ const a = x(d, "modelValue"), s = _(), { classCx: p, otherAttrs: u } = g();
29
+ $(() => {
30
+ "autofocus" in u.value && s.value?.focus();
31
+ });
32
+ function m() {
33
+ d.readonly ? s.value?.select() : s.value?.focus();
34
+ }
35
+ return (e, f) => (t(), k(r(B), c(
36
+ { is: "div" },
37
+ r(p)("cursor-text text-c-1", e.readonly ? "" : "focus-within:bg-b-1"),
38
+ { onClick: m }
39
+ ), {
40
+ default: w(() => [
41
+ i("div", M, [
42
+ e.$slots.prefix ? (t(), n("span", D, [
43
+ o(e.$slots, "prefix")
51
44
  ])) : l("", !0),
52
- a("span", M, _(r.value || e.$attrs.placeholder), 1),
53
- e.$slots.suffix ? (s(), t("span", B, [
54
- n(e.$slots, "suffix")
45
+ C(i("input", c({
46
+ ref_key: "input",
47
+ ref: s,
48
+ "onUpdate:modelValue": f[0] || (f[0] = (h) => a.value = h),
49
+ readonly: e.readonly,
50
+ "aria-readonly": e.readonly || void 0,
51
+ class: "z-1 min-w-0 flex-1 border-none bg-transparent text-sm placeholder:font-[inherit] focus-within:outline-none"
52
+ }, r(u)), null, 16, S), [
53
+ [V, a.value]
54
+ ]),
55
+ e.$slots.prefix || e.$slots.suffix ? (t(), n("div", A, [
56
+ e.$slots.prefix ? (t(), n("span", E, [
57
+ o(e.$slots, "prefix")
58
+ ])) : l("", !0),
59
+ i("span", N, b(a.value || e.$attrs.placeholder), 1),
60
+ e.$slots.suffix ? (t(), n("span", z, [
61
+ o(e.$slots, "suffix")
62
+ ])) : l("", !0)
55
63
  ])) : l("", !0)
56
- ])) : l("", !0)
64
+ ]),
65
+ o(e.$slots, "aside")
57
66
  ]),
58
- n(e.$slots, "aside")
59
- ], 16));
67
+ _: 3
68
+ }, 16));
60
69
  }
61
70
  });
62
71
  export {
63
- E as default
72
+ j as default
64
73
  };
@@ -1,11 +1,13 @@
1
1
  type __VLS_Props = {
2
- modelValue?: boolean;
3
2
  disabled?: boolean;
4
3
  label?: string;
5
4
  };
6
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
5
+ type __VLS_PublicProps = __VLS_Props & {
6
+ modelValue?: boolean;
7
+ };
8
+ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
9
  "update:modelValue": (value: boolean) => any;
8
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
9
11
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
10
12
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
13
  export default _default;
@@ -1 +1 @@
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;;;;;;AAuFF,wBAOG"}
1
+ {"version":3,"file":"ScalarToggle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/ScalarToggle.vue"],"names":[],"mappings":"AA+CA,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC;AAyBF,KAAK,iBAAiB,GAAG,WAAW,GAAG;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;;;;;AAmEF,wBAOG"}
@@ -1,43 +1,45 @@
1
- import { defineComponent as u, createElementBlock as t, openBlock as l, normalizeClass as o, unref as n, createElementVNode as m, createCommentVNode as p, toDisplayString as b } from "vue";
2
- import { cva as f, cx as h } from "@scalar/use-hooks/useBindCx";
3
- const V = ["aria-checked", "aria-disabled"], g = {
1
+ import { defineComponent as c, mergeModels as u, useModel as m, createElementBlock as t, openBlock as o, normalizeClass as n, unref as r, createElementVNode as b, createCommentVNode as p, toDisplayString as f } from "vue";
2
+ import { cva as h, cx as v } from "@scalar/use-hooks/useBindCx";
3
+ const g = ["aria-checked", "aria-disabled"], k = {
4
4
  key: 0,
5
5
  class: "sr-only"
6
- }, w = /* @__PURE__ */ u({
6
+ }, x = /* @__PURE__ */ c({
7
7
  __name: "ScalarToggle",
8
- props: {
9
- modelValue: { type: Boolean },
8
+ props: /* @__PURE__ */ u({
10
9
  disabled: { type: Boolean },
11
10
  label: {}
12
- },
11
+ }, {
12
+ modelValue: { type: Boolean, default: !1 },
13
+ modelModifiers: {}
14
+ }),
13
15
  emits: ["update:modelValue"],
14
- setup(r, { emit: s }) {
15
- const a = r, d = s;
16
- function i() {
17
- a.disabled || d("update:modelValue", !a.modelValue);
16
+ setup(l) {
17
+ const s = l, e = m(l, "modelValue");
18
+ function d() {
19
+ s.disabled || (e.value = !e.value);
18
20
  }
19
- const c = f({
21
+ const i = h({
20
22
  base: "relative h-3.5 min-w-6 w-6 cursor-pointer rounded-full bg-b-3 transition-colors duration-300",
21
23
  variants: {
22
24
  checked: { true: "bg-c-accent" },
23
25
  disabled: { true: "cursor-not-allowed opacity-40" }
24
26
  }
25
27
  });
26
- return (e, k) => (l(), t("button", {
27
- "aria-checked": e.modelValue,
28
- "aria-disabled": e.disabled,
29
- class: o(n(h)(n(c)({ checked: e.modelValue, disabled: e.disabled }))),
28
+ return (a, y) => (o(), t("button", {
29
+ "aria-checked": e.value,
30
+ "aria-disabled": a.disabled,
31
+ class: n(r(v)(r(i)({ checked: e.value, disabled: a.disabled }))),
30
32
  role: "switch",
31
33
  type: "button",
32
- onClick: i
34
+ onClick: d
33
35
  }, [
34
- m("div", {
35
- class: o(["absolute left-px top-px flex h-3 w-3 items-center justify-center rounded-full bg-b-1 text-c-accent transition-transform duration-300", { "translate-x-2.5": e.modelValue }])
36
+ b("div", {
37
+ class: n(["absolute left-px top-px flex h-3 w-3 items-center justify-center rounded-full bg-b-1 text-c-accent transition-transform duration-300", { "translate-x-2.5": e.value }])
36
38
  }, null, 2),
37
- e.label ? (l(), t("span", g, b(e.label), 1)) : p("", !0)
38
- ], 10, V));
39
+ a.label ? (o(), t("span", k, f(a.label), 1)) : p("", !0)
40
+ ], 10, g));
39
41
  }
40
42
  });
41
43
  export {
42
- w as default
44
+ x as default
43
45
  };
@@ -0,0 +1,21 @@
1
+ import type { ScalarCheckboxOption } from '../ScalarCheckboxInput';
2
+ /**
3
+ * Scalar Toggle Group component
4
+ *
5
+ * A group of toggle inputs allowing for multiple selections.
6
+ */
7
+ declare const _default: import("vue").DefineComponent<{
8
+ options?: ScalarCheckboxOption[];
9
+ } & {
10
+ modelValue?: ScalarCheckboxOption[];
11
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ "update:modelValue": (value: ScalarCheckboxOption[]) => any;
13
+ }, string, import("vue").PublicProps, Readonly<{
14
+ options?: ScalarCheckboxOption[];
15
+ } & {
16
+ modelValue?: ScalarCheckboxOption[];
17
+ }> & Readonly<{
18
+ "onUpdate:modelValue"?: ((value: ScalarCheckboxOption[]) => any) | undefined;
19
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ export default _default;
21
+ //# sourceMappingURL=ScalarToggleGroup.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScalarToggleGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/ScalarToggleGroup.vue"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAKlE;;;;GAIG;;cAGS,oBAAoB,EAAE;;iBAYrB,oBAAoB,EAAE;;;;cAZvB,oBAAoB,EAAE;;iBAYrB,oBAAoB,EAAE;;;;AAdnC,wBA8FC"}
@@ -0,0 +1,35 @@
1
+ import { defineComponent as n, mergeModels as s, useModel as f, createBlock as o, openBlock as t, unref as c, withCtx as u, createElementBlock as _, Fragment as i, renderList as p, createTextVNode as V, toDisplayString as v } from "vue";
2
+ import g from "./ScalarToggleInput.vue.js";
3
+ import k from "../ScalarForm/ScalarFormInputGroup.vue.js";
4
+ const x = {}, C = /* @__PURE__ */ n({
5
+ ...x,
6
+ __name: "ScalarToggleGroup",
7
+ props: /* @__PURE__ */ s({
8
+ options: { default: () => [] }
9
+ }, {
10
+ modelValue: { default: [] },
11
+ modelModifiers: {}
12
+ }),
13
+ emits: ["update:modelValue"],
14
+ setup(r) {
15
+ const l = f(r, "modelValue");
16
+ return (m, B) => (t(), o(c(k), null, {
17
+ default: u(() => [
18
+ (t(!0), _(i, null, p(m.options, (e) => (t(), o(g, {
19
+ modelValue: l.value?.some(({ value: a }) => a === e.value),
20
+ "onUpdate:modelValue": (a) => l.value = a ? [...l.value, e] : l.value.filter(({ value: d }) => d !== e.value),
21
+ key: e.value
22
+ }, {
23
+ default: u(() => [
24
+ V(v(e.label), 1)
25
+ ]),
26
+ _: 2
27
+ }, 1032, ["modelValue", "onUpdate:modelValue"]))), 128))
28
+ ]),
29
+ _: 1
30
+ }));
31
+ }
32
+ });
33
+ export {
34
+ C as default
35
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ScalarToggleGroup.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Scalar Toggle Input component
3
+ *
4
+ * A create a toggle input component for use in forms.
5
+ *
6
+ * @example
7
+ * <ScalarToggleInput v-model="model" type="checkbox">
8
+ * Label
9
+ * </ScalarToggleInput>
10
+ */
11
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
12
+ modelValue?: boolean;
13
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ "update:modelValue": (value: boolean | undefined) => any;
15
+ }, string, import("vue").PublicProps, Readonly<{
16
+ modelValue?: boolean;
17
+ }> & Readonly<{
18
+ "onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
19
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
20
+ default?: (props: {}) => any;
21
+ }>;
22
+ export default _default;
23
+ type __VLS_WithSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
28
+ //# sourceMappingURL=ScalarToggleInput.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScalarToggleInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/ScalarToggleInput.vue"],"names":[],"mappings":"AA6CA;;;;;;;;;GASG;;iBAYU,OAAO;;;;iBAAP,OAAO;;;;cAsDN,CAAC,KAAK,IAAgB,KAAK,GAAG;;AAjE5C,wBAoGC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { defineComponent as u, useModel as d, createBlock as i, openBlock as c, unref as t, mergeProps as l, withCtx as f, createElementVNode as p, createVNode as _, renderSlot as V } from "vue";
2
+ import { useBindCx as x } from "@scalar/use-hooks/useBindCx";
3
+ import g from "./ScalarToggle.vue.js";
4
+ import h from "../ScalarForm/ScalarFormInput.vue.js";
5
+ const v = { class: "flex-1 text-left min-w-0 truncate" }, B = {}, w = /* @__PURE__ */ u({
6
+ ...B,
7
+ inheritAttrs: !1,
8
+ __name: "ScalarToggleInput",
9
+ props: {
10
+ modelValue: { type: Boolean },
11
+ modelModifiers: {}
12
+ },
13
+ emits: ["update:modelValue"],
14
+ setup(r) {
15
+ const e = d(r, "modelValue"), { classCx: a, otherAttrs: s } = x();
16
+ return (n, o) => (c(), i(t(h), l(
17
+ { is: "label" },
18
+ t(a)("cursor-pointer gap-2 hover:bg-b-2", { "text-c-1": e.value })
19
+ ), {
20
+ default: f(() => [
21
+ p("div", v, [
22
+ V(n.$slots, "default")
23
+ ]),
24
+ _(g, l({
25
+ modelValue: e.value,
26
+ "onUpdate:modelValue": o[0] || (o[0] = (m) => e.value = m),
27
+ class: "shrink-0"
28
+ }, t(s)), null, 16, ["modelValue"])
29
+ ]),
30
+ _: 3
31
+ }, 16));
32
+ }
33
+ });
34
+ export {
35
+ w as default
36
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ScalarToggleInput.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -1,2 +1,4 @@
1
1
  export { default as ScalarToggle } from './ScalarToggle.vue.js';
2
+ export { default as ScalarToggleGroup } from './ScalarToggleGroup.vue.js';
3
+ export { default as ScalarToggleInput } from './ScalarToggleInput.vue.js';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarToggle/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import './style.css';
2
+ export { compose, cva, cx, tw, useBindCx } from '@scalar/use-hooks/useBindCx';
2
3
  export * from './components/ScalarButton';
3
4
  export * from './components/ScalarCard';
5
+ export * from './components/ScalarCheckboxInput';
4
6
  export * from './components/ScalarCodeBlock';
5
7
  export * from './components/ScalarColorModeToggle';
6
8
  export * from './components/ScalarCombobox';
@@ -29,6 +31,5 @@ export * from './components/ScalarTextInput';
29
31
  export * from './components/ScalarToggle';
30
32
  export * from './components/ScalarTooltip';
31
33
  export * from './components/ScalarVirtualText';
32
- export { useBindCx, cva, cx, compose, tw } from '@scalar/use-hooks/useBindCx';
33
34
  export * from './helpers';
34
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oCAAoC,CAAA;AAClD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kCAAkC,CAAA;AAChD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kCAAkC,CAAA;AAChD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;AAE9C,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAA;AAC7E,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AAEpB,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAE7E,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kCAAkC,CAAA;AAChD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oCAAoC,CAAA;AAClD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kCAAkC,CAAA;AAChD,cAAc,+BAA+B,CAAA;AAC7C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,kCAAkC,CAAA;AAChD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,gCAAgC,CAAA;AAC9C,cAAc,WAAW,CAAA"}