@pathscale/ui 0.0.2 → 0.0.4
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/Autocomplete-gLkjMHrc.d.ts +28 -0
- package/dist/Field-DfUn85_1.d.ts +49 -0
- package/dist/Progress-gN0xqhAF.d.ts +64 -0
- package/dist/Steps-1miUeyCD.d.ts +34 -0
- package/dist/Table-CGa6Nop3.d.ts +39 -0
- package/dist/Timeline-Bd4SxHMT.d.ts +14 -0
- package/dist/{Upload-BrFuZ4JA.d.ts → Upload-CRljD5jf.d.ts} +1 -1
- package/dist/chunk/3VOILEMN.js +187 -0
- package/dist/chunk/7ROVLN3J.js +175 -0
- package/dist/chunk/BBDVIXAH.jsx +194 -0
- package/dist/chunk/{4RCWSX7S.jsx → C4745OZS.jsx} +7 -7
- package/dist/chunk/C4YO33NN.jsx +179 -0
- package/dist/chunk/D2BEL4SM.jsx +169 -0
- package/dist/chunk/DSTUGZW6.jsx +81 -0
- package/dist/chunk/FKSQPGOD.jsx +170 -0
- package/dist/chunk/GMIXRYN3.js +138 -0
- package/dist/chunk/HWAGW5N4.jsx +118 -0
- package/dist/chunk/JWRGKHDO.js +172 -0
- package/dist/chunk/LAQPAV5I.jsx +187 -0
- package/dist/chunk/MAX47D6F.js +99 -0
- package/dist/chunk/{2JGZSAW5.js → MI773TMC.js} +6 -6
- package/dist/chunk/MYERRMTM.js +200 -0
- package/dist/chunk/OSJ3P7PI.js +189 -0
- package/dist/chunk/{QLESLIWS.jsx → QHJOIUYT.jsx} +14 -7
- package/dist/chunk/QYEMOKUG.js +125 -0
- package/dist/chunk/SCJSBRV2.jsx +39 -0
- package/dist/chunk/STKRVQR6.jsx +130 -0
- package/dist/chunk/{NZZRKP74.js → TFLJI242.js} +1 -25
- package/dist/chunk/TT2JYGLU.js +218 -0
- package/dist/chunk/VN5BKHA2.jsx +97 -0
- package/dist/chunk/WUZETUQR.js +92 -0
- package/dist/chunk/XD34JKSU.jsx +201 -0
- package/dist/chunk/{GA2HCFRS.jsx → YAQK2KFY.jsx} +1 -35
- package/dist/chunk/{S3ZDSQSV.js → YDEDUOFM.js} +8 -4
- package/dist/chunk/YMO6RPS6.js +26 -0
- package/dist/components/Progress/index.d.ts +4 -38
- package/dist/components/Progress/index.js +1 -1
- package/dist/components/Progress/index.jsx +3 -11
- package/dist/components/autocomplete/index.d.ts +8 -0
- package/dist/components/autocomplete/index.js +1 -0
- package/dist/components/autocomplete/index.jsx +7 -0
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/avatar/index.jsx +3 -3
- package/dist/components/button/index.js +1 -1
- package/dist/components/button/index.jsx +2 -1
- package/dist/components/dropdown/index.d.ts +43 -0
- package/dist/components/dropdown/index.js +1 -0
- package/dist/components/dropdown/index.jsx +12 -0
- package/dist/components/field/index.d.ts +7 -0
- package/dist/components/field/index.js +1 -0
- package/dist/components/field/index.jsx +7 -0
- package/dist/components/menu/index.d.ts +66 -0
- package/dist/components/menu/index.js +1 -0
- package/dist/components/menu/index.jsx +11 -0
- package/dist/components/navbar/index.d.ts +74 -0
- package/dist/components/navbar/index.js +1 -0
- package/dist/components/navbar/index.jsx +11 -0
- package/dist/components/steps/index.d.ts +8 -0
- package/dist/components/steps/index.js +1 -0
- package/dist/components/steps/index.jsx +7 -0
- package/dist/components/table/index.d.ts +8 -0
- package/dist/components/table/index.js +1 -0
- package/dist/components/table/index.jsx +7 -0
- package/dist/components/timeline/index.d.ts +7 -0
- package/dist/components/timeline/index.js +1 -0
- package/dist/components/timeline/index.jsx +7 -0
- package/dist/components/toast/index.d.ts +24 -0
- package/dist/components/toast/index.js +1 -0
- package/dist/components/toast/index.jsx +11 -0
- package/dist/components/upload/index.d.ts +2 -2
- package/dist/components/upload/index.js +1 -1
- package/dist/components/upload/index.jsx +1 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.js +18 -8
- package/dist/index.jsx +71 -17
- package/package.json +1 -1
- package/dist/Progress-a616LgE0.d.ts +0 -5
- package/dist/chunk/QNOJ6PCD.js +0 -278
- package/dist/chunk/WCBMW2TP.jsx +0 -203
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Component } from 'solid-js';
|
|
2
|
+
import { C as ConfigVariants, a as ClassProps, V as VariantProps } from './classes-B_S9K-9I.js';
|
|
3
|
+
|
|
4
|
+
declare const inputBoxClass: {
|
|
5
|
+
(props?: (ConfigVariants<{
|
|
6
|
+
state: {
|
|
7
|
+
default: string;
|
|
8
|
+
disabled: string;
|
|
9
|
+
};
|
|
10
|
+
size: {
|
|
11
|
+
sm: string;
|
|
12
|
+
md: string;
|
|
13
|
+
lg: string;
|
|
14
|
+
};
|
|
15
|
+
}> & ClassProps) | undefined): string;
|
|
16
|
+
variantKeys: ("size" | "state")[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type AutocompleteProps = {
|
|
20
|
+
items: Array<string | number>;
|
|
21
|
+
label?: string;
|
|
22
|
+
value?: string | number;
|
|
23
|
+
onChange?: (val: string | number) => void;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
} & VariantProps<typeof inputBoxClass>;
|
|
26
|
+
declare const Autocomplete: Component<AutocompleteProps>;
|
|
27
|
+
|
|
28
|
+
export { Autocomplete as A, type AutocompleteProps as a };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Component, JSX } from 'solid-js';
|
|
2
|
+
import { C as ConfigVariants, a as ClassProps, V as VariantProps } from './classes-B_S9K-9I.js';
|
|
3
|
+
|
|
4
|
+
declare const fieldWrapper: {
|
|
5
|
+
(props?: (ConfigVariants<{
|
|
6
|
+
horizontal: {
|
|
7
|
+
true: string;
|
|
8
|
+
false: string;
|
|
9
|
+
};
|
|
10
|
+
size: {
|
|
11
|
+
sm: string;
|
|
12
|
+
md: string;
|
|
13
|
+
lg: string;
|
|
14
|
+
};
|
|
15
|
+
type: {
|
|
16
|
+
default: string;
|
|
17
|
+
danger: string;
|
|
18
|
+
};
|
|
19
|
+
grouped: {
|
|
20
|
+
true: string;
|
|
21
|
+
false: string;
|
|
22
|
+
};
|
|
23
|
+
groupMultiline: {
|
|
24
|
+
true: string;
|
|
25
|
+
false: string;
|
|
26
|
+
};
|
|
27
|
+
}> & ClassProps) | undefined): string;
|
|
28
|
+
variantKeys: ("size" | "horizontal" | "type" | "grouped" | "groupMultiline")[];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type FieldProps = {
|
|
32
|
+
/** Label text */
|
|
33
|
+
label?: string;
|
|
34
|
+
/** Helper or error message */
|
|
35
|
+
message?: string;
|
|
36
|
+
/** Visual intent */
|
|
37
|
+
type?: "default" | "danger";
|
|
38
|
+
/** Layout direction */
|
|
39
|
+
horizontal?: boolean;
|
|
40
|
+
/** Font/control size */
|
|
41
|
+
size?: "sm" | "md" | "lg";
|
|
42
|
+
/** Extra wrapper classes */
|
|
43
|
+
className?: string;
|
|
44
|
+
} & VariantProps<typeof fieldWrapper> & ClassProps & Omit<JSX.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
45
|
+
children: JSX.Element;
|
|
46
|
+
};
|
|
47
|
+
declare const Field: Component<FieldProps>;
|
|
48
|
+
|
|
49
|
+
export { Field as F };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Component, ComponentProps } from 'solid-js';
|
|
2
|
+
import { C as ConfigVariants, a as ClassProps, V as VariantProps } from './classes-B_S9K-9I.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The outer flex container. We don’t apply shape or variant here any more —
|
|
6
|
+
* that all goes on the actual track (`progressWrapper`).
|
|
7
|
+
*/
|
|
8
|
+
declare const progressContainer: {
|
|
9
|
+
(props?: (ConfigVariants<{
|
|
10
|
+
size: {
|
|
11
|
+
sm: string;
|
|
12
|
+
md: string;
|
|
13
|
+
lg: string;
|
|
14
|
+
};
|
|
15
|
+
}> & ClassProps) | undefined): string;
|
|
16
|
+
variantKeys: "size"[];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The “track” itself: background, height, pill‐shape.
|
|
20
|
+
*/
|
|
21
|
+
declare const progressWrapper: {
|
|
22
|
+
(props?: (ConfigVariants<{
|
|
23
|
+
size: {
|
|
24
|
+
sm: string;
|
|
25
|
+
md: string;
|
|
26
|
+
lg: string;
|
|
27
|
+
};
|
|
28
|
+
shape: {
|
|
29
|
+
rounded: string;
|
|
30
|
+
circle: string;
|
|
31
|
+
};
|
|
32
|
+
}> & ClassProps) | undefined): string;
|
|
33
|
+
variantKeys: ("size" | "shape")[];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The colored fill bar.
|
|
37
|
+
*/
|
|
38
|
+
declare const progressFill: {
|
|
39
|
+
(props?: (ConfigVariants<{
|
|
40
|
+
color: {
|
|
41
|
+
default: string;
|
|
42
|
+
danger: string;
|
|
43
|
+
success: string;
|
|
44
|
+
info: string;
|
|
45
|
+
warning: string;
|
|
46
|
+
};
|
|
47
|
+
variant: {
|
|
48
|
+
filled: string;
|
|
49
|
+
outlined: string;
|
|
50
|
+
ghost: string;
|
|
51
|
+
};
|
|
52
|
+
}> & ClassProps) | undefined): string;
|
|
53
|
+
variantKeys: ("variant" | "color")[];
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
interface ProgressProps extends VariantProps<typeof progressContainer>, VariantProps<typeof progressWrapper>, VariantProps<typeof progressFill>, Omit<ComponentProps<"div">, "class" | "color"> {
|
|
57
|
+
value?: number | null;
|
|
58
|
+
showValue?: boolean;
|
|
59
|
+
format?: "percent" | "raw";
|
|
60
|
+
className?: string;
|
|
61
|
+
}
|
|
62
|
+
declare const Progress: Component<ProgressProps>;
|
|
63
|
+
|
|
64
|
+
export { Progress as P };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Component, JSX } from 'solid-js';
|
|
2
|
+
import { C as ConfigVariants, a as ClassProps, V as VariantProps } from './classes-B_S9K-9I.js';
|
|
3
|
+
|
|
4
|
+
declare const stepsContainer: {
|
|
5
|
+
(props?: (ConfigVariants<{
|
|
6
|
+
animated: {
|
|
7
|
+
true: string;
|
|
8
|
+
false: string;
|
|
9
|
+
};
|
|
10
|
+
}> & ClassProps) | undefined): string;
|
|
11
|
+
variantKeys: "animated"[];
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type StepItem = {
|
|
15
|
+
title: string;
|
|
16
|
+
marker?: string;
|
|
17
|
+
subtitle?: string;
|
|
18
|
+
clickable?: boolean;
|
|
19
|
+
content: JSX.Element;
|
|
20
|
+
className?: string;
|
|
21
|
+
};
|
|
22
|
+
type StepsProps = {
|
|
23
|
+
steps: StepItem[];
|
|
24
|
+
animated?: boolean;
|
|
25
|
+
initial?: number;
|
|
26
|
+
/** Controlled active index */
|
|
27
|
+
value?: number;
|
|
28
|
+
/** Fired on step change */
|
|
29
|
+
onStepChange?: (stepIndex: number) => void;
|
|
30
|
+
className?: string;
|
|
31
|
+
} & VariantProps<typeof stepsContainer>;
|
|
32
|
+
declare const Steps: Component<StepsProps>;
|
|
33
|
+
|
|
34
|
+
export { Steps as S, type StepItem as a };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { JSX, ComponentProps } from 'solid-js';
|
|
2
|
+
import { C as ConfigVariants, a as ClassProps, V as VariantProps } from './classes-B_S9K-9I.js';
|
|
3
|
+
|
|
4
|
+
declare const tableVariants: {
|
|
5
|
+
(props?: (ConfigVariants<{
|
|
6
|
+
header: {
|
|
7
|
+
default: string;
|
|
8
|
+
};
|
|
9
|
+
row: {
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
cell: {
|
|
13
|
+
default: string;
|
|
14
|
+
};
|
|
15
|
+
divider: {
|
|
16
|
+
on: string;
|
|
17
|
+
off: string;
|
|
18
|
+
};
|
|
19
|
+
}> & ClassProps) | undefined): string;
|
|
20
|
+
variantKeys: ("header" | "cell" | "row" | "divider")[];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type Column<Row> = {
|
|
24
|
+
key: keyof Row;
|
|
25
|
+
header: string;
|
|
26
|
+
sortable?: boolean;
|
|
27
|
+
};
|
|
28
|
+
type TableProps<Row> = {
|
|
29
|
+
columns: Column<Row>[];
|
|
30
|
+
rows: Row[];
|
|
31
|
+
className?: string;
|
|
32
|
+
rowKey: (row: Row) => string | number;
|
|
33
|
+
onSelectionChange?: (selectedKeys: Array<string | number>) => void;
|
|
34
|
+
renderDetail?: (row: Row) => JSX.Element;
|
|
35
|
+
onSort?: (key: keyof Row, direction: "asc" | "desc") => void;
|
|
36
|
+
} & VariantProps<typeof tableVariants> & ComponentProps<"table">;
|
|
37
|
+
declare const Table: <Row extends Record<string, any>>(props: TableProps<Row>) => JSX.Element;
|
|
38
|
+
|
|
39
|
+
export { type Column as C, Table as T, type TableProps as a };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component, JSX } from 'solid-js';
|
|
2
|
+
|
|
3
|
+
type TimelineStage = {
|
|
4
|
+
active?: boolean;
|
|
5
|
+
error?: boolean;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
type TimelineProps<T = TimelineStage> = {
|
|
9
|
+
stages: T[];
|
|
10
|
+
renderStage?: (stage: T, index: number) => JSX.Element;
|
|
11
|
+
};
|
|
12
|
+
declare const Timeline: Component<TimelineProps>;
|
|
13
|
+
|
|
14
|
+
export { Timeline as T, type TimelineProps as a };
|
|
@@ -33,7 +33,7 @@ type UploadProps = {
|
|
|
33
33
|
dragDrop?: boolean;
|
|
34
34
|
name?: string;
|
|
35
35
|
onChange?: (files: File | File[]) => void;
|
|
36
|
-
} & VariantProps<typeof uploadWrapperVariants> & JSX.InputHTMLAttributes<HTMLInputElement>;
|
|
36
|
+
} & VariantProps<typeof uploadWrapperVariants> & Omit<JSX.InputHTMLAttributes<HTMLInputElement>, "onChange" | "multiple" | "accept" | "disabled">;
|
|
37
37
|
declare const Upload: Component<UploadProps>;
|
|
38
38
|
|
|
39
39
|
export { Upload as U, type UploadProps as a };
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { cva, classes } from './HKS7ET6T.js';
|
|
2
|
+
import { template, spread, mergeProps, insert, createComponent, Dynamic, effect, className } from 'solid-js/web';
|
|
3
|
+
import { splitProps, Show, createMemo, createSignal } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/menu/Menu.styles.ts
|
|
6
|
+
var menuWrapper = cva("bg-white border border-gray-200 rounded shadow", {
|
|
7
|
+
variants: {
|
|
8
|
+
inline: {
|
|
9
|
+
true: "flex space-x-4",
|
|
10
|
+
false: "block"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
inline: false
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
var listWrapper = cva("px-4 py-2", {
|
|
18
|
+
variants: {
|
|
19
|
+
label: {
|
|
20
|
+
true: "pt-6",
|
|
21
|
+
false: ""
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: {
|
|
25
|
+
label: false
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
var itemVariants = cva(
|
|
29
|
+
"px-4 py-2 cursor-pointer select-none transition-colors",
|
|
30
|
+
{
|
|
31
|
+
variants: {
|
|
32
|
+
active: {
|
|
33
|
+
true: "bg-blue-100 font-semibold",
|
|
34
|
+
false: "hover:bg-blue-500"
|
|
35
|
+
},
|
|
36
|
+
expanded: {
|
|
37
|
+
true: "bg-gray-50 text-black",
|
|
38
|
+
false: ""
|
|
39
|
+
},
|
|
40
|
+
disabled: {
|
|
41
|
+
true: "opacity-50 cursor-not-allowed text-gray-700",
|
|
42
|
+
false: ""
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
compoundVariants: [
|
|
46
|
+
{
|
|
47
|
+
active: true,
|
|
48
|
+
expanded: true,
|
|
49
|
+
class: "bg-blue-200"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
defaultVariants: {
|
|
53
|
+
active: false,
|
|
54
|
+
expanded: false,
|
|
55
|
+
disabled: false
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
var itemDetailWrapper = cva(
|
|
60
|
+
"ml-4 border-l border-gray-200 mt-1 pl-2"
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
// src/components/menu/Menu.tsx
|
|
64
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
65
|
+
var Menu = (props) => {
|
|
66
|
+
const [local, variantProps, otherProps] = splitProps(props, ["class", "className", "children", "inline"], Object.keys(menuWrapper.variantKeys ?? {}));
|
|
67
|
+
return (() => {
|
|
68
|
+
var _el$ = _tmpl$();
|
|
69
|
+
spread(_el$, mergeProps({
|
|
70
|
+
get ["class"]() {
|
|
71
|
+
return classes(menuWrapper({
|
|
72
|
+
inline: !!variantProps.inline
|
|
73
|
+
}), local.class, local.className);
|
|
74
|
+
}
|
|
75
|
+
}, otherProps), false, true);
|
|
76
|
+
insert(_el$, () => local.children);
|
|
77
|
+
return _el$;
|
|
78
|
+
})();
|
|
79
|
+
};
|
|
80
|
+
var Menu_default = Menu;
|
|
81
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div class="px-4 pb-2 font-medium text-gray-700">`);
|
|
82
|
+
var _tmpl$22 = /* @__PURE__ */ template(`<div><div class="flex flex-col">`);
|
|
83
|
+
var MenuList = (props) => {
|
|
84
|
+
const [local, variantProps, otherProps] = splitProps(props, ["class", "children", "label"], Object.keys(listWrapper.variantKeys ?? {}));
|
|
85
|
+
return (() => {
|
|
86
|
+
var _el$ = _tmpl$22(), _el$3 = _el$.firstChild;
|
|
87
|
+
spread(_el$, mergeProps({
|
|
88
|
+
get ["class"]() {
|
|
89
|
+
return classes(listWrapper({
|
|
90
|
+
label: !!local.label
|
|
91
|
+
}), local.class);
|
|
92
|
+
}
|
|
93
|
+
}, otherProps), false, true);
|
|
94
|
+
insert(_el$, createComponent(Show, {
|
|
95
|
+
get when() {
|
|
96
|
+
return local.label;
|
|
97
|
+
},
|
|
98
|
+
get children() {
|
|
99
|
+
var _el$2 = _tmpl$2();
|
|
100
|
+
insert(_el$2, () => local.label);
|
|
101
|
+
return _el$2;
|
|
102
|
+
}
|
|
103
|
+
}), _el$3);
|
|
104
|
+
insert(_el$3, () => local.children);
|
|
105
|
+
return _el$;
|
|
106
|
+
})();
|
|
107
|
+
};
|
|
108
|
+
var MenuList_default = MenuList;
|
|
109
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<span class="ml-2 text-gray-500">`);
|
|
110
|
+
var _tmpl$23 = /* @__PURE__ */ template(`<div><div class="flex items-center justify-between"><span>`);
|
|
111
|
+
var _tmpl$32 = /* @__PURE__ */ template(`<div>`);
|
|
112
|
+
var MenuItem = (props) => {
|
|
113
|
+
const [local, variantProps, rest] = splitProps(props, ["class", "className", "label", "active", "expanded", "disabled", "tag", "to", "target", "children"], Object.keys(itemVariants.variantKeys ?? {}));
|
|
114
|
+
const hasChildren = createMemo(() => !!local.children);
|
|
115
|
+
const isControlled = createMemo(() => local.expanded !== void 0);
|
|
116
|
+
const [internalExpanded, setInternalExpanded] = createSignal(false);
|
|
117
|
+
const isExpanded = createMemo(() => isControlled() ? !!local.expanded : internalExpanded());
|
|
118
|
+
const toggleExpand = () => {
|
|
119
|
+
if (!isControlled() && hasChildren() && !local.disabled) {
|
|
120
|
+
setInternalExpanded((prev) => !prev);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const onKeyDown = (e) => {
|
|
124
|
+
if (local.disabled) return;
|
|
125
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
126
|
+
e.preventDefault();
|
|
127
|
+
toggleExpand();
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const tagName = local.to ? "a" : local.tag ?? "div";
|
|
131
|
+
const focusableProps = !local.to && !local.disabled ? {
|
|
132
|
+
tabIndex: 0
|
|
133
|
+
} : {};
|
|
134
|
+
return createComponent(Dynamic, mergeProps({
|
|
135
|
+
component: tagName,
|
|
136
|
+
get ["class"]() {
|
|
137
|
+
return classes(local.class, local.className, "w-full");
|
|
138
|
+
},
|
|
139
|
+
get href() {
|
|
140
|
+
return local.to;
|
|
141
|
+
},
|
|
142
|
+
get target() {
|
|
143
|
+
return local.target;
|
|
144
|
+
},
|
|
145
|
+
get ["aria-disabled"]() {
|
|
146
|
+
return local.disabled;
|
|
147
|
+
},
|
|
148
|
+
onClick: toggleExpand,
|
|
149
|
+
onKeyDown
|
|
150
|
+
}, focusableProps, rest, {
|
|
151
|
+
get children() {
|
|
152
|
+
return [(() => {
|
|
153
|
+
var _el$ = _tmpl$23(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
|
|
154
|
+
insert(_el$3, () => local.label);
|
|
155
|
+
insert(_el$2, createComponent(Show, {
|
|
156
|
+
get when() {
|
|
157
|
+
return hasChildren();
|
|
158
|
+
},
|
|
159
|
+
get children() {
|
|
160
|
+
var _el$4 = _tmpl$3();
|
|
161
|
+
insert(_el$4, () => isExpanded() ? "\u25BE" : "\u25B8");
|
|
162
|
+
return _el$4;
|
|
163
|
+
}
|
|
164
|
+
}), null);
|
|
165
|
+
effect(() => className(_el$, itemVariants({
|
|
166
|
+
active: !!local.active,
|
|
167
|
+
expanded: isExpanded(),
|
|
168
|
+
disabled: !!local.disabled
|
|
169
|
+
})));
|
|
170
|
+
return _el$;
|
|
171
|
+
})(), createComponent(Show, {
|
|
172
|
+
get when() {
|
|
173
|
+
return isExpanded();
|
|
174
|
+
},
|
|
175
|
+
get children() {
|
|
176
|
+
var _el$5 = _tmpl$32();
|
|
177
|
+
insert(_el$5, () => local.children);
|
|
178
|
+
effect(() => className(_el$5, itemDetailWrapper()));
|
|
179
|
+
return _el$5;
|
|
180
|
+
}
|
|
181
|
+
})];
|
|
182
|
+
}
|
|
183
|
+
}));
|
|
184
|
+
};
|
|
185
|
+
var MenuItem_default = MenuItem;
|
|
186
|
+
|
|
187
|
+
export { MenuItem_default, MenuList_default, Menu_default };
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { buttonVariants } from './TFLJI242.js';
|
|
2
|
+
import { cva, classes } from './HKS7ET6T.js';
|
|
3
|
+
import { delegateEvents, template, spread, mergeProps, insert, addEventListener, use, createComponent, effect, className, setAttribute } from 'solid-js/web';
|
|
4
|
+
import { splitProps, createMemo, Show, createSignal, onMount, onCleanup } from 'solid-js';
|
|
5
|
+
|
|
6
|
+
function useDropdown(trigger, disabled = false) {
|
|
7
|
+
const [open, setOpen] = createSignal(false);
|
|
8
|
+
let ref;
|
|
9
|
+
const toggle = () => {
|
|
10
|
+
if (!disabled && trigger === "click") {
|
|
11
|
+
setOpen((v) => !v);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const onEnter = () => {
|
|
15
|
+
if (!disabled && trigger === "hover") setOpen(true);
|
|
16
|
+
};
|
|
17
|
+
const onLeave = () => {
|
|
18
|
+
if (!disabled && trigger === "hover") setOpen(false);
|
|
19
|
+
};
|
|
20
|
+
const onClickOutside = (e) => {
|
|
21
|
+
if (trigger === "click" && ref && !ref.contains(e.target)) {
|
|
22
|
+
setOpen(false);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
onMount(() => {
|
|
26
|
+
document.addEventListener("click", onClickOutside);
|
|
27
|
+
onCleanup(() => document.removeEventListener("click", onClickOutside));
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
open,
|
|
31
|
+
ref: (el) => ref = el,
|
|
32
|
+
toggle,
|
|
33
|
+
onEnter,
|
|
34
|
+
onLeave
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// src/components/dropdown/Dropdown.styles.ts
|
|
39
|
+
var dropdownVariants = cva(
|
|
40
|
+
[
|
|
41
|
+
"absolute mt-2 shadow-lg z-10",
|
|
42
|
+
"w-max rounded-md bg-white border border-gray-300",
|
|
43
|
+
"transition-all duration-150 ease-in-out",
|
|
44
|
+
"flex flex-col"
|
|
45
|
+
],
|
|
46
|
+
{
|
|
47
|
+
variants: {
|
|
48
|
+
position: {
|
|
49
|
+
"bottom-left": "left-0 top-full text-black",
|
|
50
|
+
"bottom-right": "right-0 top-full text-black",
|
|
51
|
+
"top-left": "left-0 bottom-full text-black",
|
|
52
|
+
"top-right": "right-0 bottom-full text-black"
|
|
53
|
+
},
|
|
54
|
+
open: {
|
|
55
|
+
true: "block",
|
|
56
|
+
false: "hidden"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
position: "bottom-left",
|
|
61
|
+
open: false
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
var dropdownItemVariants = cva(
|
|
66
|
+
"px-4 py-2 cursor-pointer transition-colors duration-150 ease-in-out hover:bg-gray-100",
|
|
67
|
+
{
|
|
68
|
+
variants: {
|
|
69
|
+
hasLink: { true: "p-0 text-blue-600 hover:underline", false: "" }
|
|
70
|
+
},
|
|
71
|
+
defaultVariants: { hasLink: false }
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
// src/components/dropdown/DropdownMenu.tsx
|
|
76
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
77
|
+
var DropdownMenu = (props) => {
|
|
78
|
+
const [local, other] = splitProps(props, ["open", "position", "children"]);
|
|
79
|
+
return (() => {
|
|
80
|
+
var _el$ = _tmpl$();
|
|
81
|
+
spread(_el$, mergeProps({
|
|
82
|
+
get ["class"]() {
|
|
83
|
+
return dropdownVariants({
|
|
84
|
+
open: local.open,
|
|
85
|
+
position: local.position
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}, other, {
|
|
89
|
+
"id": "dropdown-menu",
|
|
90
|
+
"role": "menu"
|
|
91
|
+
}), false, true);
|
|
92
|
+
insert(_el$, () => local.children);
|
|
93
|
+
return _el$;
|
|
94
|
+
})();
|
|
95
|
+
};
|
|
96
|
+
var DropdownMenu_default = DropdownMenu;
|
|
97
|
+
|
|
98
|
+
// src/components/dropdown/Dropdown.tsx
|
|
99
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div><button type=button aria-controls=dropdown-menu>`);
|
|
100
|
+
var Dropdown = (props) => {
|
|
101
|
+
const [localProps, variantProps, restProps] = splitProps(props, ["label", "disabledLabel", "trigger", "children", "disabled", "color", "class", "className"], Object.keys(dropdownVariants.variantKeys ?? {}));
|
|
102
|
+
const {
|
|
103
|
+
open,
|
|
104
|
+
ref,
|
|
105
|
+
toggle,
|
|
106
|
+
onEnter,
|
|
107
|
+
onLeave
|
|
108
|
+
} = useDropdown(localProps.trigger ?? "click", !!localProps.disabled);
|
|
109
|
+
const labelContent = createMemo(() => localProps.disabled ? localProps.disabledLabel ?? localProps.label : localProps.label ?? "Toggle");
|
|
110
|
+
const containerClass = createMemo(() => classes("relative inline-block", localProps.class, localProps.className));
|
|
111
|
+
const buttonClass = createMemo(() => buttonVariants({
|
|
112
|
+
color: "primary"
|
|
113
|
+
}));
|
|
114
|
+
return (() => {
|
|
115
|
+
var _el$ = _tmpl$2(), _el$2 = _el$.firstChild;
|
|
116
|
+
addEventListener(_el$, "mouseleave", onLeave);
|
|
117
|
+
addEventListener(_el$, "mouseenter", onEnter);
|
|
118
|
+
use(ref, _el$);
|
|
119
|
+
spread(_el$, mergeProps({
|
|
120
|
+
get ["class"]() {
|
|
121
|
+
return containerClass();
|
|
122
|
+
}
|
|
123
|
+
}, restProps), false, true);
|
|
124
|
+
_el$2.$$click = (e) => {
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
if (localProps.trigger === "click") toggle();
|
|
127
|
+
};
|
|
128
|
+
insert(_el$2, labelContent);
|
|
129
|
+
insert(_el$, createComponent(Show, {
|
|
130
|
+
get when() {
|
|
131
|
+
return open();
|
|
132
|
+
},
|
|
133
|
+
get children() {
|
|
134
|
+
return createComponent(DropdownMenu_default, mergeProps({
|
|
135
|
+
open: true
|
|
136
|
+
}, variantProps, {
|
|
137
|
+
get children() {
|
|
138
|
+
return localProps.children;
|
|
139
|
+
}
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
}), null);
|
|
143
|
+
effect((_p$) => {
|
|
144
|
+
var _v$ = buttonClass(), _v$2 = localProps.disabled, _v$3 = localProps.disabled;
|
|
145
|
+
_v$ !== _p$.e && className(_el$2, _p$.e = _v$);
|
|
146
|
+
_v$2 !== _p$.t && setAttribute(_el$2, "aria-disabled", _p$.t = _v$2);
|
|
147
|
+
_v$3 !== _p$.a && (_el$2.disabled = _p$.a = _v$3);
|
|
148
|
+
return _p$;
|
|
149
|
+
}, {
|
|
150
|
+
e: void 0,
|
|
151
|
+
t: void 0,
|
|
152
|
+
a: void 0
|
|
153
|
+
});
|
|
154
|
+
return _el$;
|
|
155
|
+
})();
|
|
156
|
+
};
|
|
157
|
+
var Dropdown_default = Dropdown;
|
|
158
|
+
delegateEvents(["click"]);
|
|
159
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<div>`);
|
|
160
|
+
var DropdownItem = ({
|
|
161
|
+
hasLink = false,
|
|
162
|
+
children
|
|
163
|
+
}) => {
|
|
164
|
+
return (() => {
|
|
165
|
+
var _el$ = _tmpl$3();
|
|
166
|
+
insert(_el$, children);
|
|
167
|
+
effect(() => className(_el$, dropdownItemVariants({
|
|
168
|
+
hasLink
|
|
169
|
+
})));
|
|
170
|
+
return _el$;
|
|
171
|
+
})();
|
|
172
|
+
};
|
|
173
|
+
var DropdownItem_default = DropdownItem;
|
|
174
|
+
|
|
175
|
+
export { DropdownItem_default, DropdownMenu_default, Dropdown_default };
|