@scalar/components 0.13.16 → 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.
- package/README.md +87 -22
- package/dist/components/ScalarButton/ScalarButton.stories.d.ts +1 -0
- package/dist/components/ScalarButton/ScalarButton.stories.d.ts.map +1 -1
- package/dist/components/ScalarButton/variants.js +2 -2
- package/dist/components/ScalarCombobox/ScalarCombobox.vue.js +1 -0
- package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.vue.d.ts +1 -0
- package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.vue.d.ts.map +1 -1
- package/dist/components/ScalarCombobox/ScalarComboboxMultiselect.vue.js +1 -0
- package/dist/components/ScalarCombobox/ScalarComboboxPopover.vue.js +1 -0
- package/dist/components/ScalarDropdown/ScalarDropdown.stories.d.ts +16 -16
- package/dist/components/ScalarDropdown/ScalarDropdown.vue.d.ts +4 -5
- package/dist/components/ScalarDropdown/ScalarDropdown.vue.d.ts.map +1 -1
- package/dist/components/ScalarDropdown/ScalarDropdown.vue.js +28 -31
- package/dist/components/ScalarDropdown/ScalarDropdownMenu.vue.d.ts +10 -2
- package/dist/components/ScalarDropdown/ScalarDropdownMenu.vue.d.ts.map +1 -1
- package/dist/components/ScalarDropdown/ScalarDropdownMenu.vue.js +18 -13
- package/dist/components/ScalarFloating/ScalarFloating.stories.d.ts +0 -4
- package/dist/components/ScalarFloating/ScalarFloating.stories.d.ts.map +1 -1
- package/dist/components/ScalarFloating/ScalarFloating.vue.d.ts +2 -2
- package/dist/components/ScalarFloating/ScalarFloating.vue.d.ts.map +1 -1
- package/dist/components/ScalarFloating/ScalarFloating.vue.js +38 -40
- package/dist/components/ScalarFloating/ScalarFloatingBackdrop.vue.d.ts +28 -0
- package/dist/components/ScalarFloating/ScalarFloatingBackdrop.vue.d.ts.map +1 -0
- package/dist/components/ScalarFloating/ScalarFloatingBackdrop.vue.js +18 -0
- package/dist/components/ScalarFloating/ScalarFloatingBackdrop.vue2.js +4 -0
- package/dist/components/ScalarFloating/index.d.ts +1 -0
- package/dist/components/ScalarFloating/index.d.ts.map +1 -1
- package/dist/components/ScalarFloating/types.d.ts +8 -1
- package/dist/components/ScalarFloating/types.d.ts.map +1 -1
- package/dist/components/ScalarListbox/ScalarListbox.stories.d.ts +2 -2
- package/dist/components/ScalarListbox/ScalarListbox.vue.d.ts +2 -3
- package/dist/components/ScalarListbox/ScalarListbox.vue.d.ts.map +1 -1
- package/dist/components/ScalarListbox/ScalarListbox.vue.js +32 -37
- package/dist/components/ScalarListbox/ScalarListboxItem.vue.d.ts.map +1 -1
- package/dist/components/ScalarListbox/ScalarListboxItem.vue.js +8 -9
- package/dist/components/ScalarMenu/ScalarMenuResources.vue.js +4 -4
- package/dist/components/ScalarPopover/ScalarPopover.stories.d.ts +1 -0
- package/dist/components/ScalarPopover/ScalarPopover.stories.d.ts.map +1 -1
- package/dist/components/ScalarPopover/ScalarPopover.vue.d.ts.map +1 -1
- package/dist/components/ScalarPopover/ScalarPopover.vue.js +26 -22
- package/dist/components/ScalarPopover/types.d.ts +7 -3
- package/dist/components/ScalarPopover/types.d.ts.map +1 -1
- package/dist/index.js +50 -48
- package/dist/style.css +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
# Scalar Components
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<!-- Hide badges on Storybook -->
|
|
4
|
+
<div class="sb-hide">
|
|
5
|
+
|
|
6
|
+
[](https://scalar-components.netlify.app/)
|
|
7
|
+
[](https://www.npmjs.com/package/@scalar/components)
|
|
8
|
+
[](https://www.npmjs.com/package/@scalar/components)
|
|
9
|
+
[](https://www.npmjs.com/package/@scalar/components)
|
|
10
|
+
[](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.
|
|
47
|
+
Then, you can use the components in your Vue components. For example:
|
|
20
48
|
|
|
21
|
-
```
|
|
22
|
-
<script
|
|
23
|
-
|
|
49
|
+
```html
|
|
50
|
+
<script
|
|
51
|
+
setup
|
|
52
|
+
lang="ts">
|
|
53
|
+
import { ScalarIcon } from '@scalar/components'
|
|
24
54
|
</script>
|
|
25
|
-
|
|
26
55
|
<template>
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
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
|
-
|
|
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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C,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,IAAI,EAAE,KAAU,CAAA;AAE7B,eAAO,MAAM,SAAS,EAAE,KAAqC,CAAA;AAE7D,eAAO,MAAM,KAAK,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-
|
|
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"
|
|
@@ -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,WAAW,EAAE,MAAM,SAAS,CAAA;AAIlD,KAAK,WAAW,GAAG;IACf,OAAO,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACjC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,GAAG,qBAAqB,CAAC;AAuB5B,iBAAS,cAAc;WA6FT,OAAO,IAA6B;;yBAVrB,GAAG;yBACF,GAAG
|
|
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,WAAW,EAAE,MAAM,SAAS,CAAA;AAIlD,KAAK,WAAW,GAAG;IACf,OAAO,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACjC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,GAAG,qBAAqB,CAAC;AAuB5B,iBAAS,cAAc;WA6FT,OAAO,IAA6B;;yBAVrB,GAAG;yBACF,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAzHjC,KApBgB,eAoBhB,KApBoC,uBAoBpC,KAnBqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAkM6riB,GAAG,8CAA8C,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|
open: boolean;
|
|
22
|
-
}):
|
|
22
|
+
}): any;
|
|
23
23
|
}> & {
|
|
24
24
|
default(props: {
|
|
25
25
|
open: boolean;
|
|
26
|
-
}):
|
|
26
|
+
}): any;
|
|
27
27
|
items(props: {
|
|
28
28
|
open: boolean;
|
|
29
|
-
}):
|
|
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
|
-
}):
|
|
61
|
+
}): any;
|
|
62
62
|
items(props: {
|
|
63
63
|
open: boolean;
|
|
64
|
-
}):
|
|
64
|
+
}): any;
|
|
65
65
|
}> & {
|
|
66
66
|
default(props: {
|
|
67
67
|
open: boolean;
|
|
68
|
-
}):
|
|
68
|
+
}): any;
|
|
69
69
|
items(props: {
|
|
70
70
|
open: boolean;
|
|
71
|
-
}):
|
|
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
|
-
}):
|
|
91
|
+
}): any;
|
|
92
92
|
items(props: {
|
|
93
93
|
open: boolean;
|
|
94
|
-
}):
|
|
94
|
+
}): any;
|
|
95
95
|
}> & {
|
|
96
96
|
default(props: {
|
|
97
97
|
open: boolean;
|
|
98
|
-
}):
|
|
98
|
+
}): any;
|
|
99
99
|
items(props: {
|
|
100
100
|
open: boolean;
|
|
101
|
-
}):
|
|
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
|
-
}):
|
|
211
|
+
}): any;
|
|
212
212
|
items(props: {
|
|
213
213
|
open: boolean;
|
|
214
|
-
}):
|
|
214
|
+
}): any;
|
|
215
215
|
}> & {
|
|
216
216
|
default(props: {
|
|
217
217
|
open: boolean;
|
|
218
|
-
}):
|
|
218
|
+
}): any;
|
|
219
219
|
items(props: {
|
|
220
220
|
open: boolean;
|
|
221
|
-
}):
|
|
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
|
-
}):
|
|
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
|
-
}):
|
|
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
|
-
}):
|
|
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
|
-
}):
|
|
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":"
|
|
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
|
|
2
|
-
import { Menu as
|
|
3
|
-
import { useBindCx as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
7
|
-
|
|
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(
|
|
18
|
-
const { cx:
|
|
19
|
-
return (
|
|
20
|
-
default:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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:
|
|
40
|
-
|
|
41
|
-
default:
|
|
42
|
-
|
|
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
|
-
},
|
|
45
|
+
}, 1040, ["placement"])
|
|
49
46
|
]),
|
|
50
47
|
_: 3
|
|
51
48
|
}));
|
|
52
49
|
}
|
|
53
50
|
});
|
|
54
51
|
export {
|
|
55
|
-
|
|
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
|
-
|
|
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":"
|
|
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
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
10
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
t("div", _, [
|
|
19
|
+
t("div", u, [
|
|
20
|
+
r(e.$slots, "default")
|
|
18
21
|
]),
|
|
19
|
-
|
|
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
|
-
|
|
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":"
|
|
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":"
|
|
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"}
|