@pathscale/ui 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk/3FBDYV4P.js +143 -0
- package/dist/chunk/55B7Q4NT.jsx +258 -0
- package/dist/chunk/{6B7HOWQD.js → EE4HXMKA.js} +5 -5
- package/dist/chunk/{YAQK2KFY.jsx → GA2HCFRS.jsx} +35 -1
- package/dist/chunk/{5R7S7TXL.jsx → GWFGP2JQ.jsx} +5 -5
- package/dist/chunk/{TFLJI242.js → NZZRKP74.js} +25 -1
- package/dist/chunk/OJRG4ZAB.jsx +143 -0
- package/dist/chunk/{5KABSQPM.js → OYAKKETQ.js} +1 -1
- package/dist/chunk/P653OZ5D.js +224 -0
- package/dist/chunk/{YM2NLFQE.jsx → R6COBCN7.jsx} +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/button/index.jsx +1 -2
- package/dist/components/dropdown/index.d.ts +17 -33
- package/dist/components/dropdown/index.js +1 -1
- package/dist/components/dropdown/index.jsx +4 -3
- package/dist/components/navbar/index.d.ts +18 -56
- package/dist/components/navbar/index.js +1 -1
- package/dist/components/navbar/index.jsx +1 -1
- package/dist/components/switch/index.js +1 -1
- package/dist/components/switch/index.jsx +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/index.jsx +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/index.jsx +16 -15
- package/package.json +1 -1
- package/dist/chunk/7ROVLN3J.js +0 -175
- package/dist/chunk/BBDVIXAH.jsx +0 -194
- package/dist/chunk/D2BEL4SM.jsx +0 -169
- package/dist/chunk/OSJ3P7PI.js +0 -189
- package/dist/chunk/SCJSBRV2.jsx +0 -39
- package/dist/chunk/YMO6RPS6.js +0 -26
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { cva } from './HKS7ET6T.js';
|
|
2
|
+
import { delegateEvents, createComponent, template, addEventListener, insert, effect, className } from 'solid-js/web';
|
|
3
|
+
import { createContext, createSignal, useContext, Show } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
var DropdownContext = createContext();
|
|
6
|
+
|
|
7
|
+
// src/components/dropdown/Dropdown.styles.ts
|
|
8
|
+
var dropdownMenuClass = cva(
|
|
9
|
+
"absolute z-10 w-max bg-white rounded shadow border border-gray-200 flex flex-col",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
position: {
|
|
13
|
+
"top-left": "bottom-full left-0 mb-2",
|
|
14
|
+
"top-right": "bottom-full right-0 mb-2",
|
|
15
|
+
left: "right-full top-0 mr-2",
|
|
16
|
+
right: "left-full top-0 ml-2",
|
|
17
|
+
"bottom-left": "top-full left-0 mt-2",
|
|
18
|
+
"bottom-right": "top-full right-0 mt-2"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
position: "bottom-left"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
var dropdownItemClass = cva(
|
|
27
|
+
"px-4 py-2 text-sm cursor-pointer transition-colors",
|
|
28
|
+
{
|
|
29
|
+
variants: {
|
|
30
|
+
disabled: {
|
|
31
|
+
true: "text-gray-400 cursor-not-allowed",
|
|
32
|
+
false: "hover:bg-gray-100 text-gray-800"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
disabled: false
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
var dropdownRootClass = cva("relative inline-block");
|
|
41
|
+
var dropdownTriggerClass = cva("cursor-pointer w-fit", {
|
|
42
|
+
variants: {
|
|
43
|
+
disabled: {
|
|
44
|
+
true: "pointer-events-none opacity-50",
|
|
45
|
+
false: ""
|
|
46
|
+
},
|
|
47
|
+
hoverable: {
|
|
48
|
+
true: "",
|
|
49
|
+
false: ""
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: {
|
|
53
|
+
disabled: false,
|
|
54
|
+
hoverable: false
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// src/components/dropdown/Dropdown.tsx
|
|
59
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
60
|
+
var Dropdown = (props) => {
|
|
61
|
+
const [open, setOpen] = createSignal(false);
|
|
62
|
+
const context = {
|
|
63
|
+
open,
|
|
64
|
+
setOpen,
|
|
65
|
+
disabled: props.disabled,
|
|
66
|
+
hoverable: props.hoverable,
|
|
67
|
+
position: props.position ?? "left"
|
|
68
|
+
};
|
|
69
|
+
return createComponent(DropdownContext.Provider, {
|
|
70
|
+
value: context,
|
|
71
|
+
get children() {
|
|
72
|
+
var _el$ = _tmpl$();
|
|
73
|
+
addEventListener(_el$, "mouseleave", props.hoverable ? () => setOpen(false) : void 0);
|
|
74
|
+
addEventListener(_el$, "mouseenter", props.hoverable ? () => setOpen(true) : void 0);
|
|
75
|
+
insert(_el$, () => props.children);
|
|
76
|
+
effect(() => className(_el$, dropdownRootClass()));
|
|
77
|
+
return _el$;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
var Dropdown_default = Dropdown;
|
|
82
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div>`);
|
|
83
|
+
var DropdownTrigger = (props) => {
|
|
84
|
+
const context = useContext(DropdownContext);
|
|
85
|
+
const handleClick = () => {
|
|
86
|
+
if (!context?.hoverable && !context?.disabled) {
|
|
87
|
+
context?.setOpen(!context.open());
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
return (() => {
|
|
91
|
+
var _el$ = _tmpl$2();
|
|
92
|
+
_el$.$$click = handleClick;
|
|
93
|
+
insert(_el$, () => props.children);
|
|
94
|
+
effect(() => className(_el$, dropdownTriggerClass({
|
|
95
|
+
disabled: context?.disabled,
|
|
96
|
+
hoverable: context?.hoverable
|
|
97
|
+
})));
|
|
98
|
+
return _el$;
|
|
99
|
+
})();
|
|
100
|
+
};
|
|
101
|
+
var DropdownTrigger_default = DropdownTrigger;
|
|
102
|
+
delegateEvents(["click"]);
|
|
103
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
104
|
+
var DropdownMenu = (props) => {
|
|
105
|
+
const context = useContext(DropdownContext);
|
|
106
|
+
return createComponent(Show, {
|
|
107
|
+
get when() {
|
|
108
|
+
return context?.open?.();
|
|
109
|
+
},
|
|
110
|
+
get children() {
|
|
111
|
+
var _el$ = _tmpl$3();
|
|
112
|
+
insert(_el$, () => props.children);
|
|
113
|
+
effect(() => className(_el$, dropdownMenuClass({
|
|
114
|
+
position: context?.position
|
|
115
|
+
})));
|
|
116
|
+
return _el$;
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
var DropdownMenu_default = DropdownMenu;
|
|
121
|
+
var _tmpl$4 = /* @__PURE__ */ template(`<div role=menuitem>`);
|
|
122
|
+
var DropdownItem = (props) => {
|
|
123
|
+
const context = useContext(DropdownContext);
|
|
124
|
+
const handleClick = () => {
|
|
125
|
+
if (!props.disabled) {
|
|
126
|
+
props.onClick?.();
|
|
127
|
+
context?.setOpen(false);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
return (() => {
|
|
131
|
+
var _el$ = _tmpl$4();
|
|
132
|
+
_el$.$$click = handleClick;
|
|
133
|
+
insert(_el$, () => props.children);
|
|
134
|
+
effect(() => className(_el$, dropdownItemClass({
|
|
135
|
+
disabled: props.disabled
|
|
136
|
+
})));
|
|
137
|
+
return _el$;
|
|
138
|
+
})();
|
|
139
|
+
};
|
|
140
|
+
var DropdownItem_default = DropdownItem;
|
|
141
|
+
delegateEvents(["click"]);
|
|
142
|
+
|
|
143
|
+
export { DropdownItem_default, DropdownMenu_default, DropdownTrigger_default, Dropdown_default };
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import {
|
|
2
|
+
classes,
|
|
3
|
+
cva
|
|
4
|
+
} from "./P7WPLZNA.jsx";
|
|
5
|
+
|
|
6
|
+
// src/components/navbar/Navbar.tsx
|
|
7
|
+
import {
|
|
8
|
+
createSignal,
|
|
9
|
+
splitProps,
|
|
10
|
+
createEffect
|
|
11
|
+
} from "solid-js";
|
|
12
|
+
|
|
13
|
+
// src/components/navbar/NavbarContext.ts
|
|
14
|
+
import { createContext } from "solid-js";
|
|
15
|
+
var NavbarContext = createContext();
|
|
16
|
+
|
|
17
|
+
// src/components/navbar/Navbar.styles.ts
|
|
18
|
+
var navbarClass = cva("flex items-center px-4", {
|
|
19
|
+
variants: {
|
|
20
|
+
color: {
|
|
21
|
+
primary: "bg-indigo-600 text-white",
|
|
22
|
+
info: "bg-blue-500 text-white",
|
|
23
|
+
success: "bg-green-500 text-white",
|
|
24
|
+
danger: "bg-red-600 text-white",
|
|
25
|
+
warning: "bg-yellow-500 text-white",
|
|
26
|
+
light: "bg-white text-gray-800"
|
|
27
|
+
},
|
|
28
|
+
spaced: {
|
|
29
|
+
true: "py-4",
|
|
30
|
+
false: ""
|
|
31
|
+
},
|
|
32
|
+
shadow: {
|
|
33
|
+
true: "shadow-md",
|
|
34
|
+
false: ""
|
|
35
|
+
},
|
|
36
|
+
transparent: {
|
|
37
|
+
true: "bg-transparent",
|
|
38
|
+
false: ""
|
|
39
|
+
},
|
|
40
|
+
fixedTop: {
|
|
41
|
+
true: "fixed top-0 left-0 right-0 z-50",
|
|
42
|
+
false: ""
|
|
43
|
+
},
|
|
44
|
+
fixedBottom: {
|
|
45
|
+
true: "fixed bottom-0 left-0 right-0 z-50",
|
|
46
|
+
false: ""
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
defaultVariants: {
|
|
50
|
+
color: "primary",
|
|
51
|
+
spaced: false,
|
|
52
|
+
shadow: false,
|
|
53
|
+
transparent: false,
|
|
54
|
+
fixedTop: false,
|
|
55
|
+
fixedBottom: false
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
var navbarItemClass = cva(
|
|
59
|
+
"px-4 py-2 rounded transition-colors cursor-pointer",
|
|
60
|
+
{
|
|
61
|
+
variants: {
|
|
62
|
+
active: {
|
|
63
|
+
true: "",
|
|
64
|
+
false: ""
|
|
65
|
+
},
|
|
66
|
+
color: {
|
|
67
|
+
primary: "",
|
|
68
|
+
success: "",
|
|
69
|
+
info: "",
|
|
70
|
+
danger: "",
|
|
71
|
+
warning: "",
|
|
72
|
+
light: ""
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
defaultVariants: {
|
|
76
|
+
active: false,
|
|
77
|
+
color: "primary"
|
|
78
|
+
},
|
|
79
|
+
compoundVariants: [
|
|
80
|
+
{ color: "primary", active: true, class: "bg-white/20 text-white" },
|
|
81
|
+
{
|
|
82
|
+
color: "primary",
|
|
83
|
+
active: false,
|
|
84
|
+
class: "hover:bg-white/10 text-white"
|
|
85
|
+
},
|
|
86
|
+
{ color: "success", active: true, class: "bg-white/20 text-white" },
|
|
87
|
+
{
|
|
88
|
+
color: "success",
|
|
89
|
+
active: false,
|
|
90
|
+
class: "hover:bg-white/10 text-white"
|
|
91
|
+
},
|
|
92
|
+
{ color: "info", active: true, class: "bg-white/20 text-white" },
|
|
93
|
+
{ color: "info", active: false, class: "hover:bg-white/10 text-white" },
|
|
94
|
+
{ color: "danger", active: true, class: "bg-white/20 text-white" },
|
|
95
|
+
{ color: "danger", active: false, class: "hover:bg-white/10 text-white" },
|
|
96
|
+
{ color: "warning", active: true, class: "bg-white/20 text-white" },
|
|
97
|
+
{
|
|
98
|
+
color: "warning",
|
|
99
|
+
active: false,
|
|
100
|
+
class: "hover:bg-white/10 text-white"
|
|
101
|
+
},
|
|
102
|
+
{ color: "light", active: true, class: "bg-gray-300 text-gray-900" },
|
|
103
|
+
{
|
|
104
|
+
color: "light",
|
|
105
|
+
active: false,
|
|
106
|
+
class: "hover:bg-gray-100 text-gray-800"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
var navbarDropdownClass = cva("relative", {
|
|
112
|
+
variants: {
|
|
113
|
+
hoverable: {
|
|
114
|
+
true: "group",
|
|
115
|
+
false: ""
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
defaultVariants: {
|
|
119
|
+
hoverable: true
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
var dropdownMenuClass = cva(
|
|
123
|
+
"absolute mt-2 bg-white text-gray-800 rounded shadow-lg hidden group-hover:block",
|
|
124
|
+
{
|
|
125
|
+
variants: {
|
|
126
|
+
align: {
|
|
127
|
+
left: "left-0",
|
|
128
|
+
right: "right-0"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
defaultVariants: {
|
|
132
|
+
align: "left"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
// src/components/navbar/Navbar.tsx
|
|
138
|
+
var Navbar = (props) => {
|
|
139
|
+
const [local] = splitProps(props, [
|
|
140
|
+
"color",
|
|
141
|
+
"modelValue",
|
|
142
|
+
"children",
|
|
143
|
+
"spaced",
|
|
144
|
+
"shadow",
|
|
145
|
+
"transparent",
|
|
146
|
+
"fixedTop",
|
|
147
|
+
"fixedBottom"
|
|
148
|
+
]);
|
|
149
|
+
const [selected, setSelected] = createSignal(props.modelValue);
|
|
150
|
+
createEffect(() => {
|
|
151
|
+
if (props.modelValue !== void 0) {
|
|
152
|
+
setSelected(props.modelValue);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
return <NavbarContext.Provider
|
|
156
|
+
value={{
|
|
157
|
+
color: local.color ?? "primary",
|
|
158
|
+
selected,
|
|
159
|
+
setSelected: (val) => {
|
|
160
|
+
props.onChange?.(val);
|
|
161
|
+
setSelected(val);
|
|
162
|
+
}
|
|
163
|
+
}}
|
|
164
|
+
>
|
|
165
|
+
<nav
|
|
166
|
+
class={navbarClass({
|
|
167
|
+
color: local.color,
|
|
168
|
+
spaced: local.spaced,
|
|
169
|
+
shadow: local.shadow,
|
|
170
|
+
transparent: local.transparent,
|
|
171
|
+
fixedTop: local.fixedTop,
|
|
172
|
+
fixedBottom: local.fixedBottom
|
|
173
|
+
})}
|
|
174
|
+
>
|
|
175
|
+
{local.children}
|
|
176
|
+
</nav>
|
|
177
|
+
</NavbarContext.Provider>;
|
|
178
|
+
};
|
|
179
|
+
var Navbar_default = Navbar;
|
|
180
|
+
|
|
181
|
+
// src/components/navbar/NavbarItem.tsx
|
|
182
|
+
import { splitProps as splitProps2, useContext } from "solid-js";
|
|
183
|
+
import { Dynamic } from "solid-js/web";
|
|
184
|
+
var allowedColors = [
|
|
185
|
+
"primary",
|
|
186
|
+
"info",
|
|
187
|
+
"success",
|
|
188
|
+
"danger",
|
|
189
|
+
"warning",
|
|
190
|
+
"light"
|
|
191
|
+
];
|
|
192
|
+
var NavbarItem = (props) => {
|
|
193
|
+
const context = useContext(NavbarContext);
|
|
194
|
+
const [local, rest] = splitProps2(props, [
|
|
195
|
+
"tag",
|
|
196
|
+
"href",
|
|
197
|
+
"label",
|
|
198
|
+
"children",
|
|
199
|
+
"class",
|
|
200
|
+
"color"
|
|
201
|
+
]);
|
|
202
|
+
const Tag = local.tag || (local.href ? "a" : "div");
|
|
203
|
+
const isActive = () => context?.selected?.() === local.label;
|
|
204
|
+
const resolveColor = (input) => {
|
|
205
|
+
return allowedColors.includes(input) ? input : void 0;
|
|
206
|
+
};
|
|
207
|
+
return <Dynamic
|
|
208
|
+
component={Tag}
|
|
209
|
+
href={local.href}
|
|
210
|
+
onClick={() => context?.setSelected?.(local.label)}
|
|
211
|
+
class={classes(
|
|
212
|
+
navbarItemClass({
|
|
213
|
+
active: isActive(),
|
|
214
|
+
color: resolveColor(local.color ?? context?.color)
|
|
215
|
+
}),
|
|
216
|
+
local.class
|
|
217
|
+
)}
|
|
218
|
+
{...rest}
|
|
219
|
+
>
|
|
220
|
+
{local.children}
|
|
221
|
+
</Dynamic>;
|
|
222
|
+
};
|
|
223
|
+
var NavbarItem_default = NavbarItem;
|
|
224
|
+
|
|
225
|
+
// src/components/navbar/NavbarDropdown.tsx
|
|
226
|
+
import { splitProps as splitProps3, Show } from "solid-js";
|
|
227
|
+
var NavbarDropdown = (props) => {
|
|
228
|
+
const [local, rest] = splitProps3(props, [
|
|
229
|
+
"label",
|
|
230
|
+
"hoverable",
|
|
231
|
+
"align",
|
|
232
|
+
"class",
|
|
233
|
+
"children"
|
|
234
|
+
]);
|
|
235
|
+
return <div
|
|
236
|
+
class={classes(
|
|
237
|
+
navbarDropdownClass({ hoverable: local.hoverable }),
|
|
238
|
+
local.class
|
|
239
|
+
)}
|
|
240
|
+
{...rest}
|
|
241
|
+
>
|
|
242
|
+
<div class="cursor-pointer px-4 py-2 rounded hover:bg-white/10">
|
|
243
|
+
{local.label}
|
|
244
|
+
</div>
|
|
245
|
+
<Show when={local.hoverable}>
|
|
246
|
+
<div class={dropdownMenuClass({ align: local.align })}>
|
|
247
|
+
{local.children}
|
|
248
|
+
</div>
|
|
249
|
+
</Show>
|
|
250
|
+
</div>;
|
|
251
|
+
};
|
|
252
|
+
var NavbarDropdown_default = NavbarDropdown;
|
|
253
|
+
|
|
254
|
+
export {
|
|
255
|
+
Navbar_default,
|
|
256
|
+
NavbarItem_default,
|
|
257
|
+
NavbarDropdown_default
|
|
258
|
+
};
|
|
@@ -53,11 +53,11 @@ var checkVariants = cva(
|
|
|
53
53
|
gray: "peer-checked:bg-gray-400"
|
|
54
54
|
},
|
|
55
55
|
passiveColor: {
|
|
56
|
-
primary: "bg-blue-
|
|
57
|
-
success: "bg-green-
|
|
58
|
-
danger: "bg-red-
|
|
59
|
-
warning: "bg-yellow-
|
|
60
|
-
gray: "bg-gray-
|
|
56
|
+
primary: "bg-blue-200",
|
|
57
|
+
success: "bg-green-200",
|
|
58
|
+
danger: "bg-red-200",
|
|
59
|
+
warning: "bg-yellow-200",
|
|
60
|
+
gray: "bg-gray-200"
|
|
61
61
|
},
|
|
62
62
|
rounded: {
|
|
63
63
|
true: "rounded-full after:rounded-full",
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PolymorphicButton_default
|
|
3
|
+
} from "./KACNXPUM.jsx";
|
|
1
4
|
import {
|
|
2
5
|
cva
|
|
3
6
|
} from "./P7WPLZNA.jsx";
|
|
4
7
|
|
|
8
|
+
// src/components/button/Button.tsx
|
|
9
|
+
import {
|
|
10
|
+
mergeProps,
|
|
11
|
+
splitProps,
|
|
12
|
+
createMemo
|
|
13
|
+
} from "solid-js";
|
|
14
|
+
|
|
5
15
|
// src/components/button/Button.styles.ts
|
|
6
16
|
var buttonVariants = cva(
|
|
7
17
|
[
|
|
@@ -189,6 +199,30 @@ var buttonVariants = cva(
|
|
|
189
199
|
}
|
|
190
200
|
);
|
|
191
201
|
|
|
202
|
+
// src/components/button/Button.tsx
|
|
203
|
+
var Button = (props) => {
|
|
204
|
+
const defaultedProps = mergeProps(
|
|
205
|
+
{
|
|
206
|
+
color: "primary"
|
|
207
|
+
},
|
|
208
|
+
props
|
|
209
|
+
);
|
|
210
|
+
const [variantProps, otherProps] = splitProps(defaultedProps, [
|
|
211
|
+
"class",
|
|
212
|
+
...buttonVariants.variantKeys
|
|
213
|
+
]);
|
|
214
|
+
const classes = createMemo(() => buttonVariants(variantProps));
|
|
215
|
+
return <PolymorphicButton_default
|
|
216
|
+
class={classes()}
|
|
217
|
+
aria-busy={variantProps.loading ? "true" : void 0}
|
|
218
|
+
{...otherProps}
|
|
219
|
+
/>;
|
|
220
|
+
};
|
|
221
|
+
var Button_default = Button;
|
|
222
|
+
|
|
223
|
+
// src/components/button/index.ts
|
|
224
|
+
var button_default = Button_default;
|
|
225
|
+
|
|
192
226
|
export {
|
|
193
|
-
|
|
227
|
+
button_default
|
|
194
228
|
};
|
|
@@ -61,11 +61,11 @@ var checkVariants = cva(
|
|
|
61
61
|
gray: "peer-checked:bg-gray-400"
|
|
62
62
|
},
|
|
63
63
|
passiveColor: {
|
|
64
|
-
primary: "bg-blue-
|
|
65
|
-
success: "bg-green-
|
|
66
|
-
danger: "bg-red-
|
|
67
|
-
warning: "bg-yellow-
|
|
68
|
-
gray: "bg-gray-
|
|
64
|
+
primary: "bg-blue-200",
|
|
65
|
+
success: "bg-green-200",
|
|
66
|
+
danger: "bg-red-200",
|
|
67
|
+
warning: "bg-yellow-200",
|
|
68
|
+
gray: "bg-gray-200"
|
|
69
69
|
},
|
|
70
70
|
rounded: {
|
|
71
71
|
true: "rounded-full after:rounded-full",
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { PolymorphicButton_default } from './G6RG4LR7.js';
|
|
1
2
|
import { cva } from './HKS7ET6T.js';
|
|
3
|
+
import { createComponent, mergeProps as mergeProps$1 } from 'solid-js/web';
|
|
4
|
+
import { mergeProps, splitProps, createMemo } from 'solid-js';
|
|
2
5
|
|
|
3
6
|
// src/components/button/Button.styles.ts
|
|
4
7
|
var buttonVariants = cva(
|
|
@@ -187,4 +190,25 @@ var buttonVariants = cva(
|
|
|
187
190
|
}
|
|
188
191
|
);
|
|
189
192
|
|
|
190
|
-
|
|
193
|
+
// src/components/button/Button.tsx
|
|
194
|
+
var Button = (props) => {
|
|
195
|
+
const defaultedProps = mergeProps({
|
|
196
|
+
color: "primary"
|
|
197
|
+
}, props);
|
|
198
|
+
const [variantProps, otherProps] = splitProps(defaultedProps, ["class", ...buttonVariants.variantKeys]);
|
|
199
|
+
const classes = createMemo(() => buttonVariants(variantProps));
|
|
200
|
+
return createComponent(PolymorphicButton_default, mergeProps$1({
|
|
201
|
+
get ["class"]() {
|
|
202
|
+
return classes();
|
|
203
|
+
},
|
|
204
|
+
get ["aria-busy"]() {
|
|
205
|
+
return variantProps.loading ? "true" : void 0;
|
|
206
|
+
}
|
|
207
|
+
}, otherProps));
|
|
208
|
+
};
|
|
209
|
+
var Button_default = Button;
|
|
210
|
+
|
|
211
|
+
// src/components/button/index.ts
|
|
212
|
+
var button_default = Button_default;
|
|
213
|
+
|
|
214
|
+
export { button_default };
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cva
|
|
3
|
+
} from "./P7WPLZNA.jsx";
|
|
4
|
+
|
|
5
|
+
// src/components/dropdown/Dropdown.tsx
|
|
6
|
+
import { createSignal } from "solid-js";
|
|
7
|
+
|
|
8
|
+
// src/components/dropdown/DropdownContext.ts
|
|
9
|
+
import { createContext } from "solid-js";
|
|
10
|
+
var DropdownContext = createContext();
|
|
11
|
+
|
|
12
|
+
// src/components/dropdown/Dropdown.styles.ts
|
|
13
|
+
var dropdownMenuClass = cva(
|
|
14
|
+
"absolute z-10 w-max bg-white rounded shadow border border-gray-200 flex flex-col",
|
|
15
|
+
{
|
|
16
|
+
variants: {
|
|
17
|
+
position: {
|
|
18
|
+
"top-left": "bottom-full left-0 mb-2",
|
|
19
|
+
"top-right": "bottom-full right-0 mb-2",
|
|
20
|
+
left: "right-full top-0 mr-2",
|
|
21
|
+
right: "left-full top-0 ml-2",
|
|
22
|
+
"bottom-left": "top-full left-0 mt-2",
|
|
23
|
+
"bottom-right": "top-full right-0 mt-2"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
position: "bottom-left"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
var dropdownItemClass = cva(
|
|
32
|
+
"px-4 py-2 text-sm cursor-pointer transition-colors",
|
|
33
|
+
{
|
|
34
|
+
variants: {
|
|
35
|
+
disabled: {
|
|
36
|
+
true: "text-gray-400 cursor-not-allowed",
|
|
37
|
+
false: "hover:bg-gray-100 text-gray-800"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
disabled: false
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
var dropdownRootClass = cva("relative inline-block");
|
|
46
|
+
var dropdownTriggerClass = cva("cursor-pointer w-fit", {
|
|
47
|
+
variants: {
|
|
48
|
+
disabled: {
|
|
49
|
+
true: "pointer-events-none opacity-50",
|
|
50
|
+
false: ""
|
|
51
|
+
},
|
|
52
|
+
hoverable: {
|
|
53
|
+
true: "",
|
|
54
|
+
false: ""
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
defaultVariants: {
|
|
58
|
+
disabled: false,
|
|
59
|
+
hoverable: false
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// src/components/dropdown/Dropdown.tsx
|
|
64
|
+
var Dropdown = (props) => {
|
|
65
|
+
const [open, setOpen] = createSignal(false);
|
|
66
|
+
const context = {
|
|
67
|
+
open,
|
|
68
|
+
setOpen,
|
|
69
|
+
disabled: props.disabled,
|
|
70
|
+
hoverable: props.hoverable,
|
|
71
|
+
position: props.position ?? "left"
|
|
72
|
+
};
|
|
73
|
+
return <DropdownContext.Provider value={context}>
|
|
74
|
+
<div
|
|
75
|
+
class={dropdownRootClass()}
|
|
76
|
+
onMouseEnter={props.hoverable ? () => setOpen(true) : void 0}
|
|
77
|
+
onMouseLeave={props.hoverable ? () => setOpen(false) : void 0}
|
|
78
|
+
>
|
|
79
|
+
{props.children}
|
|
80
|
+
</div>
|
|
81
|
+
</DropdownContext.Provider>;
|
|
82
|
+
};
|
|
83
|
+
var Dropdown_default = Dropdown;
|
|
84
|
+
|
|
85
|
+
// src/components/dropdown/DropdownTrigger.tsx
|
|
86
|
+
import { useContext } from "solid-js";
|
|
87
|
+
var DropdownTrigger = (props) => {
|
|
88
|
+
const context = useContext(DropdownContext);
|
|
89
|
+
const handleClick = () => {
|
|
90
|
+
if (!context?.hoverable && !context?.disabled) {
|
|
91
|
+
context?.setOpen(!context.open());
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
return <div
|
|
95
|
+
onClick={handleClick}
|
|
96
|
+
class={dropdownTriggerClass({
|
|
97
|
+
disabled: context?.disabled,
|
|
98
|
+
hoverable: context?.hoverable
|
|
99
|
+
})}
|
|
100
|
+
>
|
|
101
|
+
{props.children}
|
|
102
|
+
</div>;
|
|
103
|
+
};
|
|
104
|
+
var DropdownTrigger_default = DropdownTrigger;
|
|
105
|
+
|
|
106
|
+
// src/components/dropdown/DropdownMenu.tsx
|
|
107
|
+
import { Show, useContext as useContext2 } from "solid-js";
|
|
108
|
+
var DropdownMenu = (props) => {
|
|
109
|
+
const context = useContext2(DropdownContext);
|
|
110
|
+
return <Show when={context?.open?.()}>
|
|
111
|
+
<div class={dropdownMenuClass({ position: context?.position })}>
|
|
112
|
+
{props.children}
|
|
113
|
+
</div>
|
|
114
|
+
</Show>;
|
|
115
|
+
};
|
|
116
|
+
var DropdownMenu_default = DropdownMenu;
|
|
117
|
+
|
|
118
|
+
// src/components/dropdown/DropdownItem.tsx
|
|
119
|
+
import { useContext as useContext3 } from "solid-js";
|
|
120
|
+
var DropdownItem = (props) => {
|
|
121
|
+
const context = useContext3(DropdownContext);
|
|
122
|
+
const handleClick = () => {
|
|
123
|
+
if (!props.disabled) {
|
|
124
|
+
props.onClick?.();
|
|
125
|
+
context?.setOpen(false);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
return <div
|
|
129
|
+
role="menuitem"
|
|
130
|
+
onClick={handleClick}
|
|
131
|
+
class={dropdownItemClass({ disabled: props.disabled })}
|
|
132
|
+
>
|
|
133
|
+
{props.children}
|
|
134
|
+
</div>;
|
|
135
|
+
};
|
|
136
|
+
var DropdownItem_default = DropdownItem;
|
|
137
|
+
|
|
138
|
+
export {
|
|
139
|
+
Dropdown_default,
|
|
140
|
+
DropdownTrigger_default,
|
|
141
|
+
DropdownMenu_default,
|
|
142
|
+
DropdownItem_default
|
|
143
|
+
};
|