@scalar/components 0.13.15 → 0.13.17

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 (49) 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/ScalarListboxItem.vue.d.ts.map +1 -1
  35. package/dist/components/ScalarListbox/ScalarListboxItem.vue.js +8 -9
  36. package/dist/components/ScalarMenu/ScalarMenuResources.vue.js +4 -4
  37. package/dist/components/ScalarMenu/ScalarMenuTeamPicker.vue.d.ts.map +1 -1
  38. package/dist/components/ScalarMenu/ScalarMenuTeamPicker.vue.js +33 -33
  39. package/dist/components/ScalarMenu/ScalarMenuTeamProfile.vue.d.ts.map +1 -1
  40. package/dist/components/ScalarMenu/ScalarMenuTeamProfile.vue.js +14 -12
  41. package/dist/components/ScalarPopover/ScalarPopover.stories.d.ts +1 -0
  42. package/dist/components/ScalarPopover/ScalarPopover.stories.d.ts.map +1 -1
  43. package/dist/components/ScalarPopover/ScalarPopover.vue.d.ts.map +1 -1
  44. package/dist/components/ScalarPopover/ScalarPopover.vue.js +26 -22
  45. package/dist/components/ScalarPopover/types.d.ts +7 -3
  46. package/dist/components/ScalarPopover/types.d.ts.map +1 -1
  47. package/dist/index.js +50 -48
  48. package/dist/style.css +1 -1
  49. package/package.json +4 -4
package/README.md CHANGED
@@ -1,6 +1,24 @@
1
1
  # Scalar Components
2
2
 
3
- This library is designed to work seamlessly with our theming system, but it’s also flexible enough for standalone use by setting CSS variables manually. For a list of available variables, please refer to the variable legend below.
3
+ <!-- Hide badges on Storybook -->
4
+ <div class="sb-hide">
5
+
6
+ [![Storybook](https://img.shields.io/badge/storybook-%23e1618c?logo=storybook&logoColor=%23fff)](https://scalar-components.netlify.app/)
7
+ [![Version](https://img.shields.io/npm/v/%40scalar/components)](https://www.npmjs.com/package/@scalar/components)
8
+ [![Downloads](https://img.shields.io/npm/dm/%40scalar/components)](https://www.npmjs.com/package/@scalar/components)
9
+ [![License](https://img.shields.io/npm/l/%40scalar%2Fcomponents)](https://www.npmjs.com/package/@scalar/components)
10
+ [![Discord](https://img.shields.io/discord/1135330207960678410?style=flat&color=5865F2)](https://discord.gg/scalar)
11
+
12
+ </div>
13
+
14
+ Scalar Components provides a library of components used across Scalar products. The library is designed to work seamlessly with our [theming system](https://github.com/scalar/scalar/tree/main/packages/themes) and includes a scoped copy of the themes reset, base variables and colors.
15
+
16
+ <!-- Hide the storybook link on Storybook -->
17
+ <div class="sb-hide">
18
+
19
+ Want to explore the components? Check out the [Storybook](https://scalar-components.netlify.app/) for a live demo.
20
+
21
+ </div>
4
22
 
5
23
  ## Installation
6
24
 
@@ -8,6 +26,16 @@ This library is designed to work seamlessly with our theming system, but it’s
8
26
  pnpm i @scalar/components
9
27
  ```
10
28
 
29
+ ## Scoping
30
+
31
+ Because many Scalar applications are embedded into other websites the components reset and styles are scoped to the `scalar-app` class. This means you need to add this class to the root element of your application where you want the to use the components. If you are using the components in a standalone application, you can just add this class to the `body` element.
32
+
33
+ ```html
34
+ <body class="scalar-app">
35
+ <!-- Use components in here -->
36
+ </body>
37
+ ```
38
+
11
39
  ## Usage
12
40
 
13
41
  To get started, import the CSS styles in your main setup file (e.g., main.ts, index.ts, or App.vue):
@@ -16,35 +44,72 @@ To get started, import the CSS styles in your main setup file (e.g., main.ts, in
16
44
  import '@scalar/components/style.css'
17
45
  ```
18
46
 
19
- Then, you can use the components in your Vue components. Here’s an example:
47
+ Then, you can use the components in your Vue components. For example:
20
48
 
21
- ```vue
22
- <script setup lang="ts">
23
- import { ScalarButton, ScalarTextField } from '@scalar/components'
49
+ ```html
50
+ <script
51
+ setup
52
+ lang="ts">
53
+ import { ScalarIcon } from '@scalar/components'
24
54
  </script>
25
-
26
55
  <template>
27
- <main class="col-1 items-center justify-center">
28
- <div
29
- class="col w-full max-w-md items-center gap-4 rounded-lg bg-b-3 p-8 shadow">
30
- <h1 className="text-lg font-bold">Sign in to your account</h1>
31
-
32
- <ScalarTextField
33
- class="w-full"
34
- label="Email Address" />
35
- <ScalarButton fullWidth>Login</ScalarButton>
36
- </div>
37
- </main>
56
+ <ScalarIcon
57
+ icon="Logo"
58
+ size="lg" />
38
59
  </template>
39
60
  ```
40
61
 
41
- ## CSS Layers
62
+ ## Customizing Components
63
+
64
+ Most components can be customized using props. For example, the `ScalarIcon` component can be customized with the `size` prop to change the size of the icon.
65
+
66
+ ```html
67
+ <ScalarIcon
68
+ icon="Logo"
69
+ size="lg" />
70
+ ```
71
+
72
+ However, sometimes you need to override the default styles. Most components (soon to be all) use the `useBindCx` function to apply the Tailwind classes to the component. The function intelligently merges the component's classes with the provided classes allowing you to override preset classes.
73
+
74
+ ```html
75
+ <!-- An icon you need to be really big -->
76
+ <ScalarIcon
77
+ icon="Logo"
78
+ class="size-24" />
79
+ ```
80
+
81
+ This will apply the `size-24` class to the icon and remove the `size-full` class that would normally be applied by default. For more information see the [useBindCx](https://github.com/scalar/scalar/blob/main/packages/components/src/hooks/useBindCx.ts) function.
82
+
83
+ ## Floating Components
84
+
85
+ The component library includes a number of floating components including the `ScalarPopover`, `ScalarDropdown`, and `ScalarListbox` as well as a `ScalarFloating` primitive. All of the components use [Floating UI](https://floating-ui.com/docs/vue) under the hood and provide the same for interacting with the Floating UI API.
42
86
 
43
- This package exports its Tailwind styles using CSS cascade layers to avoid any conflicts with existing CSS. The layers are organized as follows:
87
+ When using the floating components the default slot renders reference / target element (e.g. a button) and a named slot renders the floating element (e.g. a menu). For example:
88
+
89
+ ```html
90
+ <ScalarPopover>
91
+ <!-- Reference element -->
92
+ <ScalarButton>Open</ScalarButton>
93
+ <template #popover>
94
+ <!-- Floating element -->
95
+ </template>
96
+ </ScalarPopover>
97
+ ```
98
+
99
+ Since you can directly target the reference element with Tailwind classes any classes applied to the base component will be applied to the floating element (using useBindCx under the hood). For example:
100
+
101
+ ```html
102
+ <!-- Will apply the class `w-48` to the floating element (the popover) -->
103
+ <ScalarPopover class="w-48">
104
+ <!-- Will apply the class `w-full` to the reference element (the button) -->
105
+ <ScalarButton class="w-full">Open</ScalarButton>
106
+ <template #popover> ... </template>
107
+ </ScalarPopover>
108
+ ```
109
+
110
+ ## CSS Layers
44
111
 
45
- - `scalar-base`: reset and normalize
46
- - `scalar-components`: complex component styles
47
- - `scalar-utilities`: utility styles like `flex`
112
+ The components package uses the same [CSS Layers](https://developer.mozilla.org/en-US/docs/Web/CSS/@layer) as the themes package to apply the theme styles. For more information see the [themes README](https://github.com/scalar/scalar/tree/main/packages/themes).
48
113
 
49
114
  ## Contributing
50
115
 
@@ -254,6 +254,7 @@ type Story = StoryObj<typeof meta>;
254
254
  export declare const Base: Story;
255
255
  export declare const FullWidth: Story;
256
256
  export declare const Ghost: Story;
257
+ export declare const Danger: Story;
257
258
  export declare const Disabled: Story;
258
259
  export declare const Loading: Story;
259
260
  export declare const LoadingFullWidth: Story;
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarButton.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarButton/ScalarButton.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAMrD;;;GAGG;AACH,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAK,EAAE,KAAsC,CAAA;AAE1D,eAAO,MAAM,MAAM,EAAE,KAUpB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAAoC,CAAA;AAE3D,eAAO,MAAM,OAAO,EAAE,KASrB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAS9B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAetB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAK3B,CAAA"}
@@ -14,10 +14,10 @@ const e = {
14
14
  ],
15
15
  danger: [
16
16
  "scalar-button-danger",
17
- "bg-red text-white active:brightness-90 hocus:brightness-90"
17
+ "bg-c-danger text-white active:brightness-90 hocus:brightness-90"
18
18
  ]
19
19
  }, s = t({
20
- base: "scalar-button scalar-row cursor-pointer items-center justify-center rounded font-medium",
20
+ base: "scalar-button scalar-row cursor-pointer items-center justify-center rounded font-medium -outline-offset-1",
21
21
  variants: {
22
22
  disabled: {
23
23
  true: "bg-background-2 text-color-3 shadow-none"
@@ -8,6 +8,7 @@ const h = /* @__PURE__ */ m({
8
8
  modelValue: {},
9
9
  placeholder: {},
10
10
  placement: {},
11
+ offset: {},
11
12
  resize: { type: Boolean },
12
13
  target: {},
13
14
  middleware: {},
@@ -18,6 +18,7 @@ declare function __VLS_template(): {
18
18
  $data: {};
19
19
  $props: {
20
20
  readonly placement?: import("@floating-ui/vue").Placement | undefined;
21
+ readonly offset?: import("@floating-ui/vue").OffsetOptions | undefined;
21
22
  readonly resize?: boolean | undefined;
22
23
  readonly target?: (string | HTMLElement) | undefined;
23
24
  readonly middleware?: import("@floating-ui/vue").Middleware[] | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarComboboxMultiselect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarCombobox/ScalarComboboxMultiselect.vue"],"names":[],"mappings":"AA6DA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAG9D,OAAO,KAAK,EAAE,MAAM,EAAE,WA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AYD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;4BApJrB,KApBgB,eAoBhB,KApBoC,uBAoBpC,KAnBqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAmBrB,KApBgB,eAoBhB,KApBoC,uBAoBpC,KAnBqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kFAgLnB,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"}
@@ -12,6 +12,7 @@ const v = { class: "divide-1 divide-y" }, y = {
12
12
  placeholder: {},
13
13
  isDeletable: { type: Boolean },
14
14
  placement: {},
15
+ offset: {},
15
16
  resize: { type: Boolean },
16
17
  target: {},
17
18
  middleware: {},
@@ -7,6 +7,7 @@ const K = /* @__PURE__ */ m({
7
7
  __name: "ScalarComboboxPopover",
8
8
  props: {
9
9
  placement: {},
10
+ offset: {},
10
11
  resize: { type: Boolean },
11
12
  target: {},
12
13
  middleware: {},
@@ -16,17 +16,17 @@ declare const meta: {
16
16
  $slots: Readonly<{
17
17
  default(props: {
18
18
  open: boolean;
19
- }): import("vue").Slot;
19
+ }): any;
20
20
  items(props: {
21
21
  open: boolean;
22
- }): import("vue").Slot;
22
+ }): any;
23
23
  }> & {
24
24
  default(props: {
25
25
  open: boolean;
26
- }): import("vue").Slot;
26
+ }): any;
27
27
  items(props: {
28
28
  open: boolean;
29
- }): import("vue").Slot;
29
+ }): any;
30
30
  };
31
31
  });
32
32
  tags: string[];
@@ -58,17 +58,17 @@ declare const meta: {
58
58
  $slots: Readonly<{
59
59
  default(props: {
60
60
  open: boolean;
61
- }): import("vue").Slot;
61
+ }): any;
62
62
  items(props: {
63
63
  open: boolean;
64
- }): import("vue").Slot;
64
+ }): any;
65
65
  }> & {
66
66
  default(props: {
67
67
  open: boolean;
68
- }): import("vue").Slot;
68
+ }): any;
69
69
  items(props: {
70
70
  open: boolean;
71
- }): import("vue").Slot;
71
+ }): any;
72
72
  };
73
73
  })>) => {
74
74
  components: {
@@ -88,17 +88,17 @@ declare const meta: {
88
88
  $slots: Readonly<{
89
89
  default(props: {
90
90
  open: boolean;
91
- }): import("vue").Slot;
91
+ }): any;
92
92
  items(props: {
93
93
  open: boolean;
94
- }): import("vue").Slot;
94
+ }): any;
95
95
  }> & {
96
96
  default(props: {
97
97
  open: boolean;
98
- }): import("vue").Slot;
98
+ }): any;
99
99
  items(props: {
100
100
  open: boolean;
101
- }): import("vue").Slot;
101
+ }): any;
102
102
  };
103
103
  });
104
104
  ScalarDropdownItem: {
@@ -208,17 +208,17 @@ declare const meta: {
208
208
  $slots: Readonly<{
209
209
  default(props: {
210
210
  open: boolean;
211
- }): import("vue").Slot;
211
+ }): any;
212
212
  items(props: {
213
213
  open: boolean;
214
- }): import("vue").Slot;
214
+ }): any;
215
215
  }> & {
216
216
  default(props: {
217
217
  open: boolean;
218
- }): import("vue").Slot;
218
+ }): any;
219
219
  items(props: {
220
220
  open: boolean;
221
- }): import("vue").Slot;
221
+ }): any;
222
222
  };
223
223
  })>;
224
224
  };
@@ -1,4 +1,3 @@
1
- import type { Slot } from 'vue';
2
1
  import { type ScalarFloatingOptions } from '../ScalarFloating';
3
2
  /**
4
3
  * Scalar dropdown component
@@ -20,23 +19,23 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<Sc
20
19
  default(props: {
21
20
  /** Whether or not the dropdown is open */
22
21
  open: boolean;
23
- }): Slot;
22
+ }): any;
24
23
  /** The list of dropdown items */
25
24
  items(props: {
26
25
  /** Whether or not the dropdown is open */
27
26
  open: boolean;
28
- }): Slot;
27
+ }): any;
29
28
  }> & {
30
29
  /** The reference element for the element in the #floating slot */
31
30
  default(props: {
32
31
  /** Whether or not the dropdown is open */
33
32
  open: boolean;
34
- }): Slot;
33
+ }): any;
35
34
  /** The list of dropdown items */
36
35
  items(props: {
37
36
  /** Whether or not the dropdown is open */
38
37
  open: boolean;
39
- }): Slot;
38
+ }): any;
40
39
  }>;
41
40
  export default _default;
42
41
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarDropdown.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarDropdown/ScalarDropdown.vue"],"names":[],"mappings":"AAwEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAG/B,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAK9E;;;;;;;;;;;;;;GAcG;;IAOD,kEAAkE;mBACnD;QACb,0CAA0C;QAC1C,IAAI,EAAE,OAAO,CAAA;KACd,GAAG,IAAI;IACR,iCAAiC;iBACpB;QACX,0CAA0C;QAC1C,IAAI,EAAE,OAAO,CAAA;KACd,GAAG,IAAI;;IATR,kEAAkE;mBACnD;QACb,0CAA0C;QAC1C,IAAI,EAAE,OAAO,CAAA;KACd,GAAG,IAAI;IACR,iCAAiC;iBACpB;QACX,0CAA0C;QAC1C,IAAI,EAAE,OAAO,CAAA;KACd,GAAG,IAAI;;AAfV,wBA+HC;AAWD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ScalarDropdown.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarDropdown/ScalarDropdown.vue"],"names":[],"mappings":"AAsEA,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,mBAAmB,CAAA;AAK9E;;;;;;;;;;;;;;GAcG;;IAOD,kEAAkE;mBACnD;QACb,0CAA0C;QAC1C,IAAI,EAAE,OAAO,CAAA;KACd,GAAG,GAAG;IACP,iCAAiC;iBACpB;QACX,0CAA0C;QAC1C,IAAI,EAAE,OAAO,CAAA;KACd,GAAG,GAAG;;IATP,kEAAkE;mBACnD;QACb,0CAA0C;QAC1C,IAAI,EAAE,OAAO,CAAA;KACd,GAAG,GAAG;IACP,iCAAiC;iBACpB;QACX,0CAA0C;QAC1C,IAAI,EAAE,OAAO,CAAA;KACd,GAAG,GAAG;;AAfT,wBA+HC;AAWD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,56 +1,53 @@
1
- import { defineComponent as m, openBlock as i, createBlock as p, unref as t, withCtx as r, createVNode as o, mergeProps as d, renderSlot as l } from "vue";
2
- import { Menu as f, MenuItems as u, MenuButton as _ } from "@headlessui/vue";
3
- import { useBindCx as c } from "../../hooks/useBindCx.js";
4
- import g from "./ScalarDropdownMenu.vue.js";
5
- import w from "../ScalarFloating/ScalarFloating.vue.js";
6
- const B = {}, k = /* @__PURE__ */ m({
7
- ...B,
1
+ import { defineComponent as p, openBlock as i, createBlock as f, unref as e, withCtx as t, createVNode as r, mergeProps as n, renderSlot as s } from "vue";
2
+ import { Menu as u, MenuItems as _, MenuButton as c } from "@headlessui/vue";
3
+ import { useBindCx as d } from "../../hooks/useBindCx.js";
4
+ import B from "./ScalarDropdownMenu.vue.js";
5
+ import h from "../ScalarFloating/ScalarFloating.vue.js";
6
+ const $ = {}, x = /* @__PURE__ */ p({
7
+ ...$,
8
8
  inheritAttrs: !1,
9
9
  __name: "ScalarDropdown",
10
10
  props: {
11
11
  placement: {},
12
+ offset: {},
12
13
  resize: { type: Boolean },
13
14
  target: {},
14
15
  middleware: {},
15
16
  teleport: { type: [Boolean, String] }
16
17
  },
17
- setup(h) {
18
- const { cx: n } = c();
19
- return (e, y) => (i(), p(t(f), null, {
20
- default: r(({ open: a }) => [
21
- o(t(w), {
22
- middleware: e.middleware,
23
- placement: e.placement ?? "bottom-start",
24
- resize: e.resize,
25
- target: e.target,
26
- teleport: e.teleport
27
- }, {
28
- floating: r(({ width: s }) => [
29
- o(g, d({
30
- is: t(u),
31
- style: { width: s }
32
- }, t(n)("max-h-[inherit]")), {
33
- default: r(() => [
34
- l(e.$slots, "items", { open: a })
18
+ setup(g) {
19
+ const { cx: l } = d();
20
+ return (o, y) => (i(), f(e(u), null, {
21
+ default: t(({ open: a }) => [
22
+ r(e(h), n(o.$props, {
23
+ placement: o.placement ?? "bottom-start"
24
+ }), {
25
+ floating: t(({ width: m }) => [
26
+ r(B, n({
27
+ is: e(_),
28
+ style: { width: m }
29
+ }, e(l)("max-h-[inherit]")), {
30
+ default: t(() => [
31
+ s(o.$slots, "items", { open: a })
35
32
  ]),
36
33
  _: 2
37
34
  }, 1040, ["is", "style"])
38
35
  ]),
39
- default: r(() => [
40
- o(t(_), { as: "template" }, {
41
- default: r(() => [
42
- l(e.$slots, "default", { open: a })
36
+ default: t(() => [
37
+ r(e(c), { as: "template" }, {
38
+ default: t(() => [
39
+ s(o.$slots, "default", { open: a })
43
40
  ]),
44
41
  _: 2
45
42
  }, 1024)
46
43
  ]),
47
44
  _: 2
48
- }, 1032, ["middleware", "placement", "resize", "target", "teleport"])
45
+ }, 1040, ["placement"])
49
46
  ]),
50
47
  _: 3
51
48
  }));
52
49
  }
53
50
  });
54
51
  export {
55
- k as default
52
+ x as default
56
53
  };
@@ -20,8 +20,16 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
20
20
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
21
21
  /** The component to render */
22
22
  is?: string | Component;
23
- }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
24
- default?(_: {}): any;
23
+ }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, Readonly<{
24
+ /** The menu contents */
25
+ default(): any;
26
+ /** Overrides the backdrop for the dropdown */
27
+ backdrop?(): any;
28
+ }> & {
29
+ /** The menu contents */
30
+ default(): any;
31
+ /** Overrides the backdrop for the dropdown */
32
+ backdrop?(): any;
25
33
  }>;
26
34
  export default _default;
27
35
  type __VLS_WithTemplateSlots<T, S> = T & {
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarDropdownMenu.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarDropdown/ScalarDropdownMenu.vue"],"names":[],"mappings":"AA8CA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAIpC;;;;;;;;;;;;;;GAcG;;IAID,8BAA8B;SACzB,MAAM,GAAG,SAAS;;IADvB,8BAA8B;SACzB,MAAM,GAAG,SAAS;;qBA6DI,GAAG;;AAjEhC,wBAgGC;AAWD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ScalarDropdownMenu.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarDropdown/ScalarDropdownMenu.vue"],"names":[],"mappings":"AA6DA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAIpC;;;;;;;;;;;;;;GAcG;;IAID,8BAA8B;SACzB,MAAM,GAAG,SAAS;;IADvB,8BAA8B;SACzB,MAAM,GAAG,SAAS;;IAKvB,wBAAwB;eACb,GAAG;IACd,8CAA8C;iBACjC,GAAG;;IAHhB,wBAAwB;eACb,GAAG;IACd,8CAA8C;iBACjC,GAAG;;AAZlB,wBAqGC;AAWD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,28 +1,33 @@
1
- import { defineComponent as t, openBlock as l, createBlock as n, resolveDynamicComponent as r, withCtx as d, createElementVNode as e, renderSlot as a } from "vue";
2
- const i = { class: "custom-scroll min-h-0 flex-1" }, c = { class: "flex flex-col p-0.75" }, u = {}, p = /* @__PURE__ */ t({
3
- ...u,
1
+ import { defineComponent as n, openBlock as l, createBlock as a, resolveDynamicComponent as c, mergeProps as i, unref as o, withCtx as d, createElementVNode as t, renderSlot as r, createVNode as m } from "vue";
2
+ import { useBindCx as f } from "../../hooks/useBindCx.js";
3
+ import p from "../ScalarFloating/ScalarFloatingBackdrop.vue.js";
4
+ const _ = { class: "custom-scroll min-h-0 flex-1" }, u = { class: "flex flex-col p-0.75" }, x = {}, B = /* @__PURE__ */ n({
5
+ ...x,
6
+ inheritAttrs: !1,
4
7
  __name: "ScalarDropdownMenu",
5
8
  props: {
6
9
  is: {}
7
10
  },
8
- setup(_) {
9
- return (o, s) => (l(), n(r(o.is ?? "div"), {
10
- class: "relative flex w-56 rounded border",
11
+ setup(h) {
12
+ const { cx: s } = f();
13
+ return (e, v) => (l(), a(c(e.is ?? "div"), i({
11
14
  role: "menu",
12
15
  tabindex: "0"
13
- }, {
16
+ }, o(s)("relative flex w-56")), {
14
17
  default: d(() => [
15
- e("div", i, [
16
- e("div", c, [
17
- a(o.$slots, "default")
18
+ t("div", _, [
19
+ t("div", u, [
20
+ r(e.$slots, "default")
18
21
  ]),
19
- s[0] || (s[0] = e("div", { class: "absolute inset-0 -z-1 rounded bg-b-1 shadow-lg brightness-lifted" }, null, -1))
22
+ r(e.$slots, "backdrop", {}, () => [
23
+ m(o(p))
24
+ ])
20
25
  ])
21
26
  ]),
22
27
  _: 3
23
- }));
28
+ }, 16));
24
29
  }
25
30
  });
26
31
  export {
27
- p as default
32
+ B as default
28
33
  };
@@ -3,8 +3,4 @@ declare const meta: Meta;
3
3
  export default meta;
4
4
  type Story = StoryObj<typeof meta>;
5
5
  export declare const Base: Story;
6
- /**
7
- * You can override the offset (or other middleware) by passing a custom middleware array
8
- */
9
- export declare const CustomOffset: Story;
10
6
  //# sourceMappingURL=ScalarFloating.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarFloating.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarFloating/ScalarFloating.stories.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAIrD,QAAA,MAAM,IAAI,EAAE,IA6B2B,CAAA;AAEvC,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,IAAI,EAAE,KAAU,CAAA;AAE7B;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,KAsB1B,CAAA"}
1
+ {"version":3,"file":"ScalarFloating.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarFloating/ScalarFloating.stories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAIrD,QAAA,MAAM,IAAI,EAAE,IA8B2B,CAAA;AAEvC,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,IAAI,EAAE,KAAU,CAAA"}
@@ -7,7 +7,7 @@ declare function __VLS_template(): {
7
7
  /** The reference element for the element in the #floating slot */
8
8
  default(): Slot;
9
9
  /** The floating element */
10
- floating(props: {
10
+ floating?(props: {
11
11
  /** The width of the reference element if `resize` is true and placement is on the y axis */
12
12
  width?: string;
13
13
  /** The height of the reference element if `resize` is true and placement is on the x axis */
@@ -19,7 +19,7 @@ declare function __VLS_template(): {
19
19
  /** The reference element for the element in the #floating slot */
20
20
  default(): Slot;
21
21
  /** The floating element */
22
- floating(props: {
22
+ floating?(props: {
23
23
  /** The width of the reference element if `resize` is true and placement is on the y axis */
24
24
  width?: string;
25
25
  /** The height of the reference element if `resize` is true and placement is on the x axis */
@@ -1 +1 @@
1
- {"version":3,"file":"ScalarFloating.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarFloating/ScalarFloating.vue"],"names":[],"mappings":"AAyHA,OAAO,EACL,KAAK,cAAc,EAOpB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAY,KAAK,IAAI,EAAiB,MAAM,KAAK,CAAA;AAGxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AA0F9C,iBAAS,cAAc;WAqDT,OAAO,IAA6B;;QAtIhD,kEAAkE;mBACvD,IAAI;QACf,2BAA2B;wBACX;YACd,4FAA4F;YAC5F,KAAK,CAAC,EAAE,MAAM,CAAA;YACd,6FAA6F;YAC7F,MAAM,CAAC,EAAE,MAAM,CAAA;YACf,gDAAgD;YAChD,IAAI,CAAC,EAAE,cAAc,CAAA;SACtB,GAAG,IAAI;;QAVR,kEAAkE;mBACvD,IAAI;QACf,2BAA2B;wBACX;YACd,4FAA4F;YAC5F,KAAK,CAAC,EAAE,MAAM,CAAA;YACd,6FAA6F;YAC7F,MAAM,CAAC,EAAE,MAAM,CAAA;YACf,gDAAgD;YAChD,IAAI,CAAC,EAAE,cAAc,CAAA;SACtB,GAAG,IAAI;;;;;;;EAiIT;AAeD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,0SAMnB,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":"ScalarFloating.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ScalarFloating/ScalarFloating.vue"],"names":[],"mappings":"AAuHA,OAAO,EACL,KAAK,cAAc,EAOpB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAY,KAAK,IAAI,EAAiB,MAAM,KAAK,CAAA;AAGxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAyF9C,iBAAS,cAAc;WAqDT,OAAO,IAA6B;;QA7HhD,kEAAkE;mBACvD,IAAI;QACf,2BAA2B;yBACV;YACf,4FAA4F;YAC5F,KAAK,CAAC,EAAE,MAAM,CAAA;YACd,6FAA6F;YAC7F,MAAM,CAAC,EAAE,MAAM,CAAA;YACf,gDAAgD;YAChD,IAAI,CAAC,EAAE,cAAc,CAAA;SACtB,GAAG,IAAI;;QAVR,kEAAkE;mBACvD,IAAI;QACf,2BAA2B;yBACV;YACf,4FAA4F;YAC5F,KAAK,CAAC,EAAE,MAAM,CAAA;YACd,6FAA6F;YAC7F,MAAM,CAAC,EAAE,MAAM,CAAA;YACf,gDAAgD;YAChD,IAAI,CAAC,EAAE,cAAc,CAAA;SACtB,GAAG,IAAI;;;;;;;EAwHT;AAeD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,0SAMnB,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"}