@scalar/components 0.13.16 → 0.13.18

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 (47) hide show
  1. package/README.md +87 -22
  2. package/dist/components/ScalarButton/ScalarButton.stories.d.ts +1 -0
  3. package/dist/components/ScalarButton/ScalarButton.stories.d.ts.map +1 -1
  4. package/dist/components/ScalarButton/variants.js +2 -2
  5. package/dist/components/ScalarCombobox/ScalarCombobox.vue.js +1 -0
  6. package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.vue.d.ts +1 -0
  7. package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.vue.d.ts.map +1 -1
  8. package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.vue.js +1 -0
  9. package/dist/components/ScalarCombobox/ScalarComboboxPopover.vue.js +1 -0
  10. package/dist/components/ScalarDropdown/ScalarDropdown.stories.d.ts +16 -16
  11. package/dist/components/ScalarDropdown/ScalarDropdown.vue.d.ts +4 -5
  12. package/dist/components/ScalarDropdown/ScalarDropdown.vue.d.ts.map +1 -1
  13. package/dist/components/ScalarDropdown/ScalarDropdown.vue.js +28 -31
  14. package/dist/components/ScalarDropdown/ScalarDropdownMenu.vue.d.ts +10 -2
  15. package/dist/components/ScalarDropdown/ScalarDropdownMenu.vue.d.ts.map +1 -1
  16. package/dist/components/ScalarDropdown/ScalarDropdownMenu.vue.js +18 -13
  17. package/dist/components/ScalarFloating/ScalarFloating.stories.d.ts +0 -4
  18. package/dist/components/ScalarFloating/ScalarFloating.stories.d.ts.map +1 -1
  19. package/dist/components/ScalarFloating/ScalarFloating.vue.d.ts +2 -2
  20. package/dist/components/ScalarFloating/ScalarFloating.vue.d.ts.map +1 -1
  21. package/dist/components/ScalarFloating/ScalarFloating.vue.js +38 -40
  22. package/dist/components/ScalarFloating/ScalarFloatingBackdrop.vue.d.ts +28 -0
  23. package/dist/components/ScalarFloating/ScalarFloatingBackdrop.vue.d.ts.map +1 -0
  24. package/dist/components/ScalarFloating/ScalarFloatingBackdrop.vue.js +18 -0
  25. package/dist/components/ScalarFloating/ScalarFloatingBackdrop.vue2.js +4 -0
  26. package/dist/components/ScalarFloating/index.d.ts +1 -0
  27. package/dist/components/ScalarFloating/index.d.ts.map +1 -1
  28. package/dist/components/ScalarFloating/types.d.ts +8 -1
  29. package/dist/components/ScalarFloating/types.d.ts.map +1 -1
  30. package/dist/components/ScalarListbox/ScalarListbox.stories.d.ts +2 -2
  31. package/dist/components/ScalarListbox/ScalarListbox.vue.d.ts +2 -3
  32. package/dist/components/ScalarListbox/ScalarListbox.vue.d.ts.map +1 -1
  33. package/dist/components/ScalarListbox/ScalarListbox.vue.js +32 -37
  34. package/dist/components/ScalarListbox/ScalarListboxCheckbox.vue.d.ts.map +1 -1
  35. package/dist/components/ScalarListbox/ScalarListboxCheckbox.vue.js +12 -11
  36. package/dist/components/ScalarListbox/ScalarListboxItem.vue.d.ts.map +1 -1
  37. package/dist/components/ScalarListbox/ScalarListboxItem.vue.js +8 -9
  38. package/dist/components/ScalarMenu/ScalarMenuResources.vue.js +4 -4
  39. package/dist/components/ScalarPopover/ScalarPopover.stories.d.ts +1 -0
  40. package/dist/components/ScalarPopover/ScalarPopover.stories.d.ts.map +1 -1
  41. package/dist/components/ScalarPopover/ScalarPopover.vue.d.ts.map +1 -1
  42. package/dist/components/ScalarPopover/ScalarPopover.vue.js +26 -22
  43. package/dist/components/ScalarPopover/types.d.ts +7 -3
  44. package/dist/components/ScalarPopover/types.d.ts.map +1 -1
  45. package/dist/index.js +50 -48
  46. package/dist/style.css +1 -1
  47. package/package.json +5 -5
@@ -1,65 +1,63 @@
1
- import { defineComponent as z, ref as f, computed as a, openBlock as d, createElementBlock as S, Fragment as $, createElementVNode as m, normalizeClass as b, renderSlot as p, createBlock as k, unref as l, withCtx as B, normalizeStyle as R, createCommentVNode as E } from "vue";
1
+ import { defineComponent as w, ref as d, computed as a, openBlock as s, createElementBlock as z, Fragment as S, createElementVNode as m, normalizeClass as $, renderSlot as u, createBlock as k, unref as o, withCtx as B, normalizeStyle as R, createCommentVNode as b } from "vue";
2
2
  import { getSideAxis as g } from "@floating-ui/utils";
3
- import { useFloating as x, autoUpdate as C, offset as F, flip as M, shift as _, size as H } from "@floating-ui/vue";
3
+ import { useFloating as x, autoUpdate as E, offset as C, flip as F, shift as M, size as H } from "@floating-ui/vue";
4
4
  import { useResizeWithTarget as T } from "./useResizeWithTarget.js";
5
5
  import W from "../ScalarTeleport/ScalarTeleport.vue.js";
6
- const I = /* @__PURE__ */ z({
6
+ const I = /* @__PURE__ */ w({
7
7
  inheritAttrs: !1,
8
8
  __name: "ScalarFloating",
9
9
  props: {
10
- placement: {},
11
- resize: { type: Boolean },
10
+ placement: { default: "bottom" },
11
+ offset: { default: 5 },
12
+ resize: { type: Boolean, default: !1 },
12
13
  target: {},
13
- middleware: {},
14
+ middleware: { default: () => [] },
14
15
  teleport: { type: [Boolean, String] }
15
16
  },
16
- setup(c) {
17
- const t = c, n = f(null), r = f(null), i = a(() => {
17
+ setup(t) {
18
+ const i = d(null), n = d(null), r = a(() => {
18
19
  var e;
19
- if (typeof window < "u") {
20
+ if (typeof window < "u" && n.value) {
20
21
  if (typeof t.target == "string") {
21
- const o = document.getElementById(t.target);
22
- if (o) return o;
23
- console.warn(
24
- `ScalarFloating: Target with id="${t.target}" not found`
25
- );
22
+ const l = document.getElementById(t.target);
23
+ if (l) return l;
24
+ console.warn(`ScalarFloating: Target with id="${t.target}" not found`);
26
25
  } else if (t.target instanceof HTMLElement) return t.target;
26
+ return ((e = n.value.children) == null ? void 0 : e[0]) || n.value;
27
27
  }
28
- if (r.value)
29
- return ((e = r.value.children) == null ? void 0 : e[0]) || r.value;
30
- }), s = T(i, {
28
+ }), f = T(r, {
31
29
  enabled: a(() => t.resize)
32
- }), u = a(
33
- () => g(t.placement || "bottom") === "y" ? s.width.value : void 0
30
+ }), c = a(
31
+ () => g(t.placement) === "y" ? f.width.value : void 0
34
32
  ), h = a(
35
- () => g(t.placement || "bottom") === "x" ? s.height.value : void 0
36
- ), { floatingStyles: y, middlewareData: v } = x(i, n, {
33
+ () => g(t.placement) === "x" ? f.height.value : void 0
34
+ ), { floatingStyles: p, middlewareData: y } = x(r, i, {
37
35
  placement: a(() => t.placement),
38
- whileElementsMounted: C,
36
+ whileElementsMounted: E,
39
37
  middleware: a(() => [
40
- F(5),
38
+ C(t.offset),
39
+ F(),
41
40
  M(),
42
- _(),
43
41
  H({
44
- apply({ availableWidth: e, availableHeight: o, elements: w }) {
45
- Object.assign(w.floating.style, {
42
+ apply({ availableWidth: e, availableHeight: l, elements: v }) {
43
+ Object.assign(v.floating.style, {
46
44
  maxWidth: `${Math.max(0, e) - 25}px`,
47
- maxHeight: `${Math.max(0, o) - 25}px`
45
+ maxHeight: `${Math.max(0, l) - 25}px`
48
46
  });
49
47
  }
50
48
  }),
51
- ...t.middleware ?? []
49
+ ...t.middleware
52
50
  ])
53
51
  });
54
- return (e, o) => (d(), S($, null, [
52
+ return (e, l) => (s(), z(S, null, [
55
53
  m("div", {
56
54
  ref_key: "wrapperRef",
57
- ref: r,
58
- class: b({ contents: !!e.$slots.default })
55
+ ref: n,
56
+ class: $({ contents: !!e.$slots.default })
59
57
  }, [
60
- p(e.$slots, "default")
58
+ u(e.$slots, "default")
61
59
  ], 2),
62
- e.$slots.floating ? (d(), k(l(W), {
60
+ e.$slots.floating ? (s(), k(o(W), {
63
61
  key: 0,
64
62
  disabled: !e.teleport,
65
63
  to: typeof e.teleport == "string" ? e.teleport : void 0
@@ -67,19 +65,19 @@ const I = /* @__PURE__ */ z({
67
65
  default: B(() => [
68
66
  m("div", {
69
67
  ref_key: "floatingRef",
70
- ref: n,
71
- class: "relative z-overlay",
72
- style: R(l(y))
68
+ ref: i,
69
+ class: "relative z-context",
70
+ style: R(o(p))
73
71
  }, [
74
- p(e.$slots, "floating", {
75
- data: l(v),
72
+ u(e.$slots, "floating", {
73
+ data: o(y),
76
74
  height: h.value,
77
- width: u.value
75
+ width: c.value
78
76
  })
79
77
  ], 4)
80
78
  ]),
81
79
  _: 3
82
- }, 8, ["disabled", "to"])) : E("", !0)
80
+ }, 8, ["disabled", "to"])) : b("", !0)
83
81
  ], 64));
84
82
  }
85
83
  });
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Scalar floating backdrop component
3
+ *
4
+ * Provides an absolutely positioned backdrop for the floating element
5
+ * This is used internally by a number of the Scalar floating components
6
+ * (e.g. Dropdown, Popover, Listbox)
7
+ *
8
+ * You can use this component directly if you need to customize the backdrop
9
+ * for a floating component
10
+ *
11
+ * @example
12
+ * <ScalarDropdown>
13
+ * <!-- Menu stuff -->
14
+ * <template #backdrop>
15
+ * <ScalarFloatingBackdrop />
16
+ * </template>
17
+ * </ScalarDropdown>
18
+ */
19
+ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
20
+ default?(_: {}): any;
21
+ }>;
22
+ export default _default;
23
+ type __VLS_WithTemplateSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
28
+ //# sourceMappingURL=ScalarFloatingBackdrop.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScalarFloatingBackdrop.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarFloating/ScalarFloatingBackdrop.vue"],"names":[],"mappings":"AAyCA;;;;;;;;;;;;;;;;;GAiBG;;qBAuC0B,GAAG;;AAtChC,wBAoEC;AAKD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { defineComponent as o, openBlock as r, createElementBlock as n, normalizeProps as s, guardReactiveProps as a, unref as l, renderSlot as i } from "vue";
2
+ import { useBindCx as c } from "../../hooks/useBindCx.js";
3
+ const d = {}, m = /* @__PURE__ */ o({
4
+ ...d,
5
+ inheritAttrs: !1,
6
+ __name: "ScalarFloatingBackdrop",
7
+ setup(p) {
8
+ const { cx: e } = c();
9
+ return (t, u) => (r(), n("div", s(a(
10
+ l(e)("absolute inset-0 -z-1 rounded bg-b-1 shadow-lg brightness-lifted")
11
+ )), [
12
+ i(t.$slots, "default")
13
+ ], 16));
14
+ }
15
+ });
16
+ export {
17
+ m as default
18
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ScalarFloatingBackdrop.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -1,3 +1,4 @@
1
1
  export { default as ScalarFloating } from './ScalarFloating.vue.js';
2
+ export { default as ScalarFloatingBackdrop } from './ScalarFloatingBackdrop.vue.js';
2
3
  export type { FloatingOptions as ScalarFloatingOptions } from './types';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarFloating/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAEhE,YAAY,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarFloating/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAEhF,YAAY,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,SAAS,CAAA"}
@@ -1,4 +1,4 @@
1
- import type { Middleware, Placement } from '@floating-ui/vue';
1
+ import type { Middleware, OffsetOptions, Placement } from '@floating-ui/vue';
2
2
  /** The props for the ScalarFloating component */
3
3
  export type FloatingOptions = {
4
4
  /**
@@ -8,6 +8,13 @@ export type FloatingOptions = {
8
8
  * @see https://floating-ui.com/docs/computePosition#placement
9
9
  */
10
10
  placement?: Placement;
11
+ /**
12
+ * The offset of the floating element relative to its reference element.
13
+ * @default 5 (5px)
14
+ *
15
+ * @see https://floating-ui.com/docs/offset
16
+ */
17
+ offset?: OffsetOptions;
11
18
  /**
12
19
  * Whether or not track the reference element's width
13
20
  * If enabled it will set `width` slot prop of the floating slot
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarFloating/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAI7D,iDAAiD;AACjD,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;IAC7B;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,UAAU,EAAE,CAAA;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAC5B,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarFloating/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAI5E,iDAAiD;AACjD,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;IAC7B;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,UAAU,EAAE,CAAA;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAC5B,CAAA"}
@@ -69,11 +69,11 @@ declare const meta: {
69
69
  $slots: Readonly<{
70
70
  default(props: {
71
71
  open: boolean;
72
- }): import("vue").Slot;
72
+ }): any;
73
73
  }> & {
74
74
  default(props: {
75
75
  open: boolean;
76
- }): import("vue").Slot;
76
+ }): any;
77
77
  };
78
78
  });
79
79
  tags: string[];
@@ -1,4 +1,3 @@
1
- import type { Slot } from 'vue';
2
1
  import { type ScalarFloatingOptions } from '../ScalarFloating';
3
2
  import type { Option } from './types';
4
3
  type SingleSelectListboxProps = {
@@ -16,13 +15,13 @@ declare function __VLS_template(): {
16
15
  default(props: {
17
16
  /** Whether or not the listbox is open */
18
17
  open: boolean;
19
- }): Slot;
18
+ }): any;
20
19
  }> & {
21
20
  /** The reference element for the listbox */
22
21
  default(props: {
23
22
  /** Whether or not the listbox is open */
24
23
  open: boolean;
25
- }): Slot;
24
+ }): any;
26
25
  };
27
26
  refs: {};
28
27
  rootEl: any;
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarListbox.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarListbox/ScalarListbox.vue"],"names":[],"mappings":"AAyGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAG/B,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAE9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAIrC,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,KAAK,0BAA0B,GAAG;IAChC,QAAQ,EAAE,IAAI,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB,CAAA;AAkCD,iBAAS,cAAc;WAgIT,OAAO,IAA6B;;QAhJhD,4CAA4C;uBAC7B;YACb,yCAAyC;YACzC,IAAI,EAAE,OAAO,CAAA;SACd,GAAG,IAAI;;QAJR,4CAA4C;uBAC7B;YACb,yCAAyC;YACzC,IAAI,EAAE,OAAO,CAAA;SACd,GAAG,IAAI;;;;EAiJT;AAgBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;aArLR,MAAM,EAAE;SACZ,MAAM;YACH,MAAM;;aAFL,MAAM,EAAE;SACZ,MAAM;YACH,MAAM;;;;aAFL,MAAM,EAAE;SACZ,MAAM;YACH,MAAM;;aAFL,MAAM,EAAE;SACZ,MAAM;YACH,MAAM;;;kFA0LhB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ScalarListbox.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarListbox/ScalarListbox.vue"],"names":[],"mappings":"AAwGA,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAA;AAE1B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAIrC,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,KAAK,0BAA0B,GAAG;IAChC,QAAQ,EAAE,IAAI,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB,CAAA;AAkCD,iBAAS,cAAc;WA6HT,OAAO,IAA6B;;QA7IhD,4CAA4C;uBAC7B;YACb,yCAAyC;YACzC,IAAI,EAAE,OAAO,CAAA;SACd,GAAG,GAAG;;QAJP,4CAA4C;uBAC7B;YACb,yCAAyC;YACzC,IAAI,EAAE,OAAO,CAAA;SACd,GAAG,GAAG;;;;EA8IR;AAiBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;aAnLR,MAAM,EAAE;SACZ,MAAM;YACH,MAAM;;aAFL,MAAM,EAAE;SACZ,MAAM;YACH,MAAM;;;;aAFL,MAAM,EAAE;SACZ,MAAM;YACH,MAAM;;aAFL,MAAM,EAAE;SACZ,MAAM;YACH,MAAM;;;kFAwLhB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,9 +1,10 @@
1
- import { defineComponent as b, openBlock as o, createBlock as a, unref as t, withCtx as l, createTextVNode as c, toDisplayString as g, createCommentVNode as d, createVNode as s, createElementBlock as m, mergeProps as y, createElementVNode as u, Fragment as V, renderList as B, normalizeStyle as k, renderSlot as w } from "vue";
2
- import { Listbox as L, ListboxLabel as h, ListboxOptions as v, ListboxButton as z } from "@headlessui/vue";
3
- import { useBindCx as S } from "../../hooks/useBindCx.js";
4
- import x from "./ScalarListboxItem.vue.js";
1
+ import { defineComponent as c, openBlock as o, createBlock as r, unref as t, withCtx as l, createTextVNode as b, toDisplayString as y, createCommentVNode as m, createVNode as i, mergeProps as u, createElementBlock as p, createElementVNode as V, Fragment as g, renderList as B, normalizeStyle as _, renderSlot as k } from "vue";
2
+ import { Listbox as x, ListboxLabel as L, ListboxOptions as h, ListboxButton as $ } from "@headlessui/vue";
3
+ import { useBindCx as v } from "../../hooks/useBindCx.js";
4
+ import S from "./ScalarListboxItem.vue.js";
5
5
  import C from "../ScalarFloating/ScalarFloating.vue.js";
6
- const N = { class: "custom-scroll min-h-0 flex-1" }, O = /* @__PURE__ */ b({
6
+ import N from "../ScalarFloating/ScalarFloatingBackdrop.vue.js";
7
+ const w = { class: "custom-scroll min-h-0 flex-1" }, P = /* @__PURE__ */ c({
7
8
  inheritAttrs: !1,
8
9
  __name: "ScalarListbox",
9
10
  props: {
@@ -13,78 +14,72 @@ const N = { class: "custom-scroll min-h-0 flex-1" }, O = /* @__PURE__ */ b({
13
14
  multiple: { type: Boolean },
14
15
  modelValue: {},
15
16
  placement: {},
17
+ offset: {},
16
18
  resize: { type: Boolean },
17
19
  target: {},
18
20
  middleware: {},
19
21
  teleport: { type: [Boolean, String] }
20
22
  },
21
23
  emits: ["update:modelValue"],
22
- setup($) {
23
- const { cx: p } = S();
24
- return (e, r) => (o(), a(t(L), {
24
+ setup(z) {
25
+ const { cx: d } = v();
26
+ return (e, s) => (o(), r(t(x), {
25
27
  modelValue: e.modelValue,
26
28
  multiple: e.multiple,
27
- "onUpdate:modelValue": r[0] || (r[0] = (i) => e.$emit("update:modelValue", i))
29
+ "onUpdate:modelValue": s[0] || (s[0] = (a) => e.$emit("update:modelValue", a))
28
30
  }, {
29
- default: l(({ open: i }) => [
30
- e.label ? (o(), a(t(h), {
31
+ default: l(({ open: a }) => [
32
+ e.label ? (o(), r(t(L), {
31
33
  key: 0,
32
34
  class: "sr-only"
33
35
  }, {
34
36
  default: l(() => [
35
- c(g(e.label), 1)
37
+ b(y(e.label), 1)
36
38
  ]),
37
39
  _: 1
38
- })) : d("", !0),
39
- s(t(C), {
40
- middleware: e.middleware,
41
- placement: e.placement ?? "bottom-start",
42
- resize: e.resize,
43
- target: e.target,
44
- teleport: e.teleport
45
- }, {
40
+ })) : m("", !0),
41
+ i(t(C), u(e.$props, {
42
+ placement: e.placement ?? "bottom-start"
43
+ }), {
46
44
  floating: l(({ width: f }) => [
47
- i ? (o(), m("div", y(
48
- {
49
- key: 0,
50
- style: { width: f }
51
- },
52
- t(p)("relative flex max-h-[inherit] w-40 rounded border text-sm")
53
- ), [
54
- u("div", N, [
55
- s(t(v), { class: "flex flex-col p-0.75" }, {
45
+ a ? (o(), p("div", u({
46
+ key: 0,
47
+ style: { width: f }
48
+ }, t(d)("relative flex max-h-[inherit] w-40 rounded text-sm")), [
49
+ V("div", w, [
50
+ i(t(h), { class: "flex flex-col gap-0.75 p-0.75" }, {
56
51
  default: l(() => [
57
- (o(!0), m(V, null, B(e.options, (n) => (o(), a(x, {
52
+ (o(!0), p(g, null, B(e.options, (n) => (o(), r(S, {
58
53
  key: n.id,
59
54
  option: n,
60
- style: k(e.multiple ? "checkbox" : "radio")
55
+ style: _(e.multiple ? "checkbox" : "radio")
61
56
  }, null, 8, ["option", "style"]))), 128))
62
57
  ]),
63
58
  _: 1
64
59
  })
65
60
  ]),
66
- r[1] || (r[1] = u("div", { class: "absolute inset-0 -z-1 rounded bg-b-1 shadow-md brightness-lifted" }, null, -1))
67
- ], 16)) : d("", !0)
61
+ i(t(N))
62
+ ], 16)) : m("", !0)
68
63
  ]),
69
64
  default: l(() => [
70
- s(t(z), {
65
+ i(t($), {
71
66
  id: e.id,
72
67
  as: "template",
73
68
  class: "justify-start focus:outline-none focus-visible:ring-1 focus-visible:ring-c-accent"
74
69
  }, {
75
70
  default: l(() => [
76
- w(e.$slots, "default", { open: i })
71
+ k(e.$slots, "default", { open: a })
77
72
  ]),
78
73
  _: 2
79
74
  }, 1032, ["id"])
80
75
  ]),
81
76
  _: 2
82
- }, 1032, ["middleware", "placement", "resize", "target", "teleport"])
77
+ }, 1040, ["placement"])
83
78
  ]),
84
79
  _: 3
85
80
  }, 8, ["modelValue", "multiple"]));
86
81
  }
87
82
  });
88
83
  export {
89
- O as default
84
+ P as default
90
85
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarListboxCheckbox.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarListbox/ScalarListboxCheckbox.vue"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAI1C,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,WAAW,CAAA;CACpB,CAAC;;AAyEF,wBAOG"}
1
+ {"version":3,"file":"ScalarListboxCheckbox.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarListbox/ScalarListboxCheckbox.vue"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAI1C,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,WAAW,CAAA;CACpB,CAAC;;AAyEF,wBAOG"}
@@ -1,26 +1,27 @@
1
- import { defineComponent as t, openBlock as o, createElementBlock as r, normalizeClass as c, createVNode as s, unref as n } from "vue";
2
- import a from "../ScalarIcon/ScalarIcon.vue.js";
3
- const m = /* @__PURE__ */ t({
1
+ import { defineComponent as o, openBlock as t, createElementBlock as r, normalizeClass as c, createBlock as s, unref as n, createCommentVNode as a } from "vue";
2
+ import l from "../ScalarIcon/ScalarIcon.vue.js";
3
+ const u = /* @__PURE__ */ o({
4
4
  __name: "ScalarListboxCheckbox",
5
5
  props: {
6
6
  selected: { type: Boolean },
7
7
  style: {}
8
8
  },
9
- setup(l) {
10
- return (e, p) => (o(), r("div", {
9
+ setup(p) {
10
+ return (e, i) => (t(), r("div", {
11
11
  class: c(["flex size-4 items-center justify-center p-0.75", [
12
- e.selected ? "bg-c-accent text-b-1" : "text-transparent group-hover/item:shadow-border",
12
+ e.selected ? "bg-c-accent text-b-1" : "text-transparent shadow-border",
13
13
  e.style === "checkbox" ? "rounded" : "rounded-full"
14
14
  ]])
15
15
  }, [
16
- s(n(a), {
17
- class: "relative top-[0.5px] size-2.5",
16
+ e.selected ? (t(), s(n(l), {
17
+ key: 0,
18
+ class: "relative top-[0.5px] size-3",
18
19
  icon: "Checkmark",
19
- thickness: "2.5"
20
- })
20
+ thickness: "3"
21
+ })) : a("", !0)
21
22
  ], 2));
22
23
  }
23
24
  });
24
25
  export {
25
- m as default
26
+ u as default
26
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarListboxItem.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarListbox/ScalarListboxItem.vue"],"names":[],"mappings":"AAsDA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAIlD,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,WAAW,CAAA;CACpB,CAAC;;AAoGF,wBAOG"}
1
+ {"version":3,"file":"ScalarListboxItem.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarListbox/ScalarListboxItem.vue"],"names":[],"mappings":"AAqDA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAIlD,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,WAAW,CAAA;CACpB,CAAC;;AAmGF,wBAOG"}
@@ -1,7 +1,7 @@
1
- import { defineComponent as l, openBlock as s, createBlock as p, unref as t, withCtx as c, createElementVNode as a, normalizeClass as n, createVNode as m, normalizeStyle as d, toDisplayString as b } from "vue";
2
- import { ListboxOption as u } from "@headlessui/vue";
3
- import { cva as f, cx as y } from "../../cva.js";
4
- import v from "./ScalarListboxCheckbox.vue.js";
1
+ import { defineComponent as l, openBlock as s, createBlock as p, unref as t, withCtx as c, createElementVNode as a, normalizeClass as n, createVNode as m, normalizeStyle as d, toDisplayString as u } from "vue";
2
+ import { ListboxOption as b } from "@headlessui/vue";
3
+ import { cva as f, cx as v } from "../../cva.js";
4
+ import y from "./ScalarListboxCheckbox.vue.js";
5
5
  const C = /* @__PURE__ */ l({
6
6
  __name: "ScalarListboxItem",
7
7
  props: {
@@ -14,7 +14,6 @@ const C = /* @__PURE__ */ l({
14
14
  // Layout
15
15
  "group/item",
16
16
  "flex min-w-0 items-center gap-1.5 rounded px-2 py-1.5 text-left",
17
- "first-of-type:mt-0.75 last-of-type:mb-0.75",
18
17
  // Text / background style
19
18
  "truncate bg-transparent text-c-1",
20
19
  // Interaction
@@ -26,22 +25,22 @@ const C = /* @__PURE__ */ l({
26
25
  disabled: { true: "pointer-events-none opacity-50" }
27
26
  }
28
27
  });
29
- return (e, x) => (s(), p(t(u), {
28
+ return (e, x) => (s(), p(t(b), {
30
29
  as: "template",
31
30
  disabled: e.option.disabled,
32
31
  value: e.option
33
32
  }, {
34
33
  default: c(({ active: i, selected: o }) => [
35
34
  a("li", {
36
- class: n(t(y)(t(r)({ active: i, selected: o, disabled: e.option.disabled })))
35
+ class: n(t(v)(t(r)({ active: i, selected: o, disabled: e.option.disabled })))
37
36
  }, [
38
- m(v, {
37
+ m(y, {
39
38
  selected: o,
40
39
  style: d(e.style)
41
40
  }, null, 8, ["selected", "style"]),
42
41
  a("span", {
43
42
  class: n(["inline-block min-w-0 flex-1 truncate", e.option.color ? e.option.color : "text-c-1"])
44
- }, b(e.option.label), 3)
43
+ }, u(e.option.label), 3)
45
44
  ], 2)
46
45
  ]),
47
46
  _: 1
@@ -1,16 +1,16 @@
1
- import { defineComponent as n, openBlock as l, createBlock as i, withCtx as o, createTextVNode as e, createVNode as r } from "vue";
1
+ import { defineComponent as n, openBlock as l, createBlock as s, withCtx as o, createTextVNode as e, createVNode as r } from "vue";
2
2
  import a from "./ScalarMenuLink.vue.js";
3
- import s from "./ScalarMenuSection.vue.js";
3
+ import i from "./ScalarMenuSection.vue.js";
4
4
  const d = /* @__PURE__ */ n({
5
5
  __name: "ScalarMenuResources",
6
6
  setup(m) {
7
- return (c, t) => (l(), i(s, null, {
7
+ return (p, t) => (l(), s(i, null, {
8
8
  title: o(() => t[0] || (t[0] = [
9
9
  e("Resources")
10
10
  ])),
11
11
  default: o(() => [
12
12
  r(a, {
13
- href: "mailto:marc@scalar.com",
13
+ href: "mailto:support@scalar.com",
14
14
  icon: "Email",
15
15
  target: "_blank"
16
16
  }, {
@@ -139,4 +139,5 @@ export default meta;
139
139
  type Story = StoryObj<typeof meta>;
140
140
  export declare const Base: Story;
141
141
  export declare const CustomClasses: Story;
142
+ export declare const CustomBackdrop: Story;
142
143
  //# sourceMappingURL=ScalarPopover.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarPopover.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarPopover/ScalarPopover.stories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAKrD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC4B,CAAA;AAEtC,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,IAAI,EAAE,KAAU,CAAA;AAE7B,eAAO,MAAM,aAAa,EAAE,KAE3B,CAAA"}
1
+ {"version":3,"file":"ScalarPopover.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarPopover/ScalarPopover.stories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAMrD,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoC4B,CAAA;AAEtC,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,IAAI,EAAE,KAAU,CAAA;AAE7B,eAAO,MAAM,aAAa,EAAE,KAE3B,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KA0B5B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarPopover.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarPopover/ScalarPopover.vue"],"names":[],"mappings":"AA2CA,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAC9E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAiBpC,iBAAS,cAAc;WAoFT,OAAO,IAA6B;;;;EAKjD;AAaD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,sTAMnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ScalarPopover.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarPopover/ScalarPopover.vue"],"names":[],"mappings":"AAkDA,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAiBpC,iBAAS,cAAc;WAqFT,OAAO,IAA6B;;;;EAKjD;AAcD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,sTAMnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,40 +1,44 @@
1
- import { defineComponent as f, openBlock as m, createBlock as u, unref as e, withCtx as t, createVNode as r, normalizeProps as c, guardReactiveProps as _, mergeProps as g, renderSlot as s, createElementVNode as v } from "vue";
2
- import { Popover as P, PopoverPanel as B, PopoverButton as b } from "@headlessui/vue";
3
- import { useBindCx as x } from "../../hooks/useBindCx.js";
4
- import y from "../ScalarFloating/ScalarFloating.vue.js";
5
- const S = /* @__PURE__ */ f({
1
+ import { defineComponent as m, openBlock as i, createBlock as c, unref as e, withCtx as o, createVNode as r, normalizeProps as d, guardReactiveProps as u, mergeProps as _, renderSlot as l } from "vue";
2
+ import { Popover as P, PopoverPanel as v, PopoverButton as B } from "@headlessui/vue";
3
+ import { useBindCx as $ } from "../../hooks/useBindCx.js";
4
+ import g from "../ScalarFloating/ScalarFloating.vue.js";
5
+ import y from "../ScalarFloating/ScalarFloatingBackdrop.vue.js";
6
+ const b = /* @__PURE__ */ m({
6
7
  inheritAttrs: !1,
7
8
  __name: "ScalarPopover",
8
9
  props: {
9
10
  placement: {},
11
+ offset: {},
10
12
  resize: { type: Boolean },
11
13
  target: {},
12
14
  middleware: {},
13
15
  teleport: { type: [Boolean, String] }
14
16
  },
15
- setup($) {
16
- const { cx: p } = x();
17
- return (o, l) => (m(), u(e(P), { as: "template" }, {
18
- default: t(({ open: a }) => [
19
- r(e(y), c(_(o.$props)), {
20
- floating: t(({ width: n, height: i }) => [
21
- r(e(B), g({
22
- style: { width: n, height: i }
17
+ setup(h) {
18
+ const { cx: p } = $();
19
+ return (t, k) => (i(), c(e(P), { as: "template" }, {
20
+ default: o(({ open: a }) => [
21
+ r(e(g), d(u(t.$props)), {
22
+ floating: o(({ width: s, height: f }) => [
23
+ r(e(v), _({
24
+ style: { width: s, height: f }
23
25
  }, e(p)("relative flex flex-col p-0.75")), {
24
- default: t(({ close: d }) => [
25
- s(o.$slots, "popover", {
26
- close: () => d(),
26
+ default: o(({ close: n }) => [
27
+ l(t.$slots, "popover", {
28
+ close: () => n(),
27
29
  open: a
28
30
  }),
29
- l[0] || (l[0] = v("div", { class: "absolute inset-0 -z-1 rounded bg-b-1 shadow-lg brightness-lifted" }, null, -1))
31
+ l(t.$slots, "backdrop", { open: a }, () => [
32
+ r(e(y))
33
+ ])
30
34
  ]),
31
35
  _: 2
32
36
  }, 1040, ["style"])
33
37
  ]),
34
- default: t(() => [
35
- r(e(b), { as: "template" }, {
36
- default: t(() => [
37
- s(o.$slots, "default", { open: a })
38
+ default: o(() => [
39
+ r(e(B), { as: "template" }, {
40
+ default: o(() => [
41
+ l(t.$slots, "default", { open: a })
38
42
  ]),
39
43
  _: 2
40
44
  }, 1024)
@@ -47,5 +51,5 @@ const S = /* @__PURE__ */ f({
47
51
  }
48
52
  });
49
53
  export {
50
- S as default
54
+ b as default
51
55
  };
@@ -1,15 +1,19 @@
1
- import type { Slot } from 'vue';
2
1
  export type Slots = {
3
2
  default(props: {
4
3
  /** Whether or not the popover is open */
5
4
  open: boolean;
6
- }): Slot;
5
+ }): any;
7
6
  /** The popover contents */
8
7
  popover(props: {
9
8
  /** Whether or not the popover is open */
10
9
  open: boolean;
11
10
  /** A callback to close the popover */
12
11
  close: () => void;
13
- }): Slot;
12
+ }): any;
13
+ /** Overrides the popover backdrop */
14
+ backdrop?(props: {
15
+ /** Whether or not the popover is open */
16
+ open: boolean;
17
+ }): any;
14
18
  };
15
19
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarPopover/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE/B,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,CAAC,KAAK,EAAE;QACb,yCAAyC;QACzC,IAAI,EAAE,OAAO,CAAA;KACd,GAAG,IAAI,CAAA;IACR,2BAA2B;IAC3B,OAAO,CAAC,KAAK,EAAE;QACb,yCAAyC;QACzC,IAAI,EAAE,OAAO,CAAA;QACb,sCAAsC;QACtC,KAAK,EAAE,MAAM,IAAI,CAAA;KAClB,GAAG,IAAI,CAAA;CACT,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarPopover/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IAClB,OAAO,CAAC,KAAK,EAAE;QACb,yCAAyC;QACzC,IAAI,EAAE,OAAO,CAAA;KACd,GAAG,GAAG,CAAA;IACP,2BAA2B;IAC3B,OAAO,CAAC,KAAK,EAAE;QACb,yCAAyC;QACzC,IAAI,EAAE,OAAO,CAAA;QACb,sCAAsC;QACtC,KAAK,EAAE,MAAM,IAAI,CAAA;KAClB,GAAG,GAAG,CAAA;IACP,qCAAqC;IACrC,QAAQ,CAAC,CAAC,KAAK,EAAE;QACf,yCAAyC;QACzC,IAAI,EAAE,OAAO,CAAA;KACd,GAAG,GAAG,CAAA;CACR,CAAA"}