@pathscale/ui 0.0.1 → 0.0.2
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/Accordion-nwuRbRRw.d.ts +27 -0
- package/dist/Checkbox-BjaweaOH.d.ts +40 -0
- package/dist/Pagination-BlrjElGg.d.ts +43 -0
- package/dist/Progress-a616LgE0.d.ts +5 -0
- package/dist/Select-CP-TUHJv.d.ts +44 -0
- package/dist/Switch-3IXS_68H.d.ts +72 -0
- package/dist/Tabs-BNR3p92D.d.ts +42 -0
- package/dist/Tag-BPrhn-Ne.d.ts +42 -0
- package/dist/Tooltip-BfPongoz.d.ts +53 -0
- package/dist/Upload-BrFuZ4JA.d.ts +39 -0
- package/dist/chunk/3IHANYRN.js +98 -0
- package/dist/chunk/4TWLQ3IA.js +103 -0
- package/dist/chunk/6SBH3KSM.jsx +96 -0
- package/dist/chunk/CJZGTNJZ.js +115 -0
- package/dist/chunk/DBQ7IOPU.js +189 -0
- package/dist/chunk/DNTGSCVF.jsx +100 -0
- package/dist/chunk/ELRAUORW.jsx +179 -0
- package/dist/chunk/FPUQ25SO.js +137 -0
- package/dist/chunk/GLEAR2TS.jsx +160 -0
- package/dist/chunk/KV6LTJHI.jsx +175 -0
- package/dist/chunk/LI3HCFL7.jsx +132 -0
- package/dist/chunk/MMTAND25.jsx +126 -0
- package/dist/chunk/MXG3MBEN.jsx +148 -0
- package/dist/chunk/NZKPDBTE.js +118 -0
- package/dist/chunk/P2L6LFLS.js +144 -0
- package/dist/chunk/QLESLIWS.jsx +110 -0
- package/dist/chunk/QNOJ6PCD.js +278 -0
- package/dist/chunk/QONDPQ2I.jsx +105 -0
- package/dist/chunk/S3ZDSQSV.js +98 -0
- package/dist/chunk/V6Y5E7BL.js +133 -0
- package/dist/chunk/WCBMW2TP.jsx +203 -0
- package/dist/chunk/WOT36Q7O.js +166 -0
- package/dist/components/Progress/index.d.ts +2 -3
- package/dist/components/Progress/index.js +1 -278
- package/dist/components/Progress/index.jsx +7 -194
- package/dist/components/accordion/index.d.ts +5 -24
- package/dist/components/accordion/index.js +1 -118
- package/dist/components/accordion/index.jsx +3 -100
- package/dist/components/breadcrumb/index.d.ts +2 -2
- package/dist/components/breadcrumb/index.js +1 -133
- package/dist/components/breadcrumb/index.jsx +4 -120
- package/dist/components/checkbox/index.d.ts +5 -37
- package/dist/components/checkbox/index.js +1 -137
- package/dist/components/checkbox/index.jsx +3 -143
- package/dist/components/pagination/index.d.ts +5 -40
- package/dist/components/pagination/index.js +1 -189
- package/dist/components/pagination/index.jsx +3 -174
- package/dist/components/select/index.d.ts +5 -41
- package/dist/components/select/index.js +1 -98
- package/dist/components/select/index.jsx +3 -91
- package/dist/components/switch/index.d.ts +5 -69
- package/dist/components/switch/index.js +1 -144
- package/dist/components/switch/index.jsx +3 -155
- package/dist/components/tabs/index.d.ts +5 -39
- package/dist/components/tabs/index.js +1 -166
- package/dist/components/tabs/index.jsx +3 -170
- package/dist/components/tag/index.d.ts +5 -39
- package/dist/components/tag/index.js +1 -115
- package/dist/components/tag/index.jsx +3 -127
- package/dist/components/tooltip/index.d.ts +5 -50
- package/dist/components/tooltip/index.js +1 -103
- package/dist/components/tooltip/index.jsx +3 -95
- package/dist/components/upload/index.d.ts +5 -36
- package/dist/components/upload/index.js +1 -98
- package/dist/components/upload/index.jsx +3 -105
- package/dist/index.d.ts +11 -0
- package/dist/index.js +12 -1
- package/dist/index.jsx +47 -1
- package/package.json +1 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cva
|
|
3
|
+
} from "./P7WPLZNA.jsx";
|
|
4
|
+
|
|
5
|
+
// src/components/breadcrumb/Breadcrumb.tsx
|
|
6
|
+
import {
|
|
7
|
+
splitProps,
|
|
8
|
+
children,
|
|
9
|
+
createMemo,
|
|
10
|
+
untrack
|
|
11
|
+
} from "solid-js";
|
|
12
|
+
|
|
13
|
+
// src/components/breadcrumb/Breadcrumb.styles.ts
|
|
14
|
+
var breadcrumbContainerVariants = cva(
|
|
15
|
+
["flex", "items-center", "gap-2", "text-sm"],
|
|
16
|
+
{
|
|
17
|
+
variants: {
|
|
18
|
+
alignment: {
|
|
19
|
+
left: "justify-start",
|
|
20
|
+
center: "justify-center",
|
|
21
|
+
right: "justify-end"
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
sm: "text-xs gap-1",
|
|
25
|
+
md: "text-sm gap-2",
|
|
26
|
+
lg: "text-base gap-3"
|
|
27
|
+
},
|
|
28
|
+
separator: {
|
|
29
|
+
arrow: "breadcrumb-arrow",
|
|
30
|
+
dot: "breadcrumb-dot",
|
|
31
|
+
bullet: "breadcrumb-bullet",
|
|
32
|
+
succeeds: "breadcrumb-succeeds"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
alignment: "left",
|
|
37
|
+
size: "md"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
var breadcrumbItemVariants = cva(
|
|
42
|
+
["text-gray-600", "dark:text-gray-300"],
|
|
43
|
+
{
|
|
44
|
+
variants: {
|
|
45
|
+
active: {
|
|
46
|
+
true: "text-blue-600 font-semibold cursor-default",
|
|
47
|
+
false: "hover:underline"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
defaultVariants: {
|
|
51
|
+
active: false
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// src/components/breadcrumb/Breadcrumb.tsx
|
|
57
|
+
var separatorMap = {
|
|
58
|
+
arrow: "\u2192",
|
|
59
|
+
dot: "\xB7",
|
|
60
|
+
bullet: "\u2022",
|
|
61
|
+
succeeds: "\xBB"
|
|
62
|
+
};
|
|
63
|
+
var Breadcrumb = (props) => {
|
|
64
|
+
const [local, variantProps, otherProps] = splitProps(
|
|
65
|
+
props,
|
|
66
|
+
["children"],
|
|
67
|
+
["alignment", "size", "separator"]
|
|
68
|
+
);
|
|
69
|
+
const resolvedChildren = children(() => local.children);
|
|
70
|
+
const items = createMemo(() => resolvedChildren.toArray());
|
|
71
|
+
const separator = createMemo(
|
|
72
|
+
() => untrack(() => {
|
|
73
|
+
const sep = variantProps.separator;
|
|
74
|
+
return sep && separatorMap[sep] ? separatorMap[sep] : "/";
|
|
75
|
+
})
|
|
76
|
+
);
|
|
77
|
+
const containerClasses = createMemo(
|
|
78
|
+
() => breadcrumbContainerVariants(variantProps)
|
|
79
|
+
);
|
|
80
|
+
const renderItems = createMemo(() => {
|
|
81
|
+
return items().reduce((acc, item, idx) => {
|
|
82
|
+
if (idx > 0) {
|
|
83
|
+
acc.push(
|
|
84
|
+
<li class="text-gray-400 select-none" aria-hidden="true">
|
|
85
|
+
{separator()}
|
|
86
|
+
</li>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
acc.push(
|
|
90
|
+
<li>
|
|
91
|
+
<span aria-current={idx === items().length - 1 ? "page" : void 0}>
|
|
92
|
+
{item}
|
|
93
|
+
</span>
|
|
94
|
+
</li>
|
|
95
|
+
);
|
|
96
|
+
return acc;
|
|
97
|
+
}, []);
|
|
98
|
+
});
|
|
99
|
+
return <nav class={containerClasses()} aria-label="Breadcrumb" {...otherProps}>
|
|
100
|
+
<ol class="flex items-center flex-wrap gap-1">{renderItems()}</ol>
|
|
101
|
+
</nav>;
|
|
102
|
+
};
|
|
103
|
+
var Breadcrumb_default = Breadcrumb;
|
|
104
|
+
|
|
105
|
+
// src/components/breadcrumb/BreadcrumbItem.tsx
|
|
106
|
+
import { splitProps as splitProps2 } from "solid-js";
|
|
107
|
+
var BreadcrumbItem = (props) => {
|
|
108
|
+
const [local, variantProps] = splitProps2(
|
|
109
|
+
props,
|
|
110
|
+
["children", "href", "active"],
|
|
111
|
+
["active"]
|
|
112
|
+
);
|
|
113
|
+
return <li class="flex items-center gap-1">
|
|
114
|
+
{local.href && !local.active ? <a href={local.href} class={breadcrumbItemVariants(variantProps)}>
|
|
115
|
+
{local.children}
|
|
116
|
+
</a> : <span class={breadcrumbItemVariants({ active: true })}>
|
|
117
|
+
{local.children}
|
|
118
|
+
</span>}
|
|
119
|
+
</li>;
|
|
120
|
+
};
|
|
121
|
+
var BreadcrumbItem_default = BreadcrumbItem;
|
|
122
|
+
|
|
123
|
+
export {
|
|
124
|
+
Breadcrumb_default,
|
|
125
|
+
BreadcrumbItem_default
|
|
126
|
+
};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import {
|
|
2
|
+
classes,
|
|
3
|
+
cva
|
|
4
|
+
} from "./P7WPLZNA.jsx";
|
|
5
|
+
|
|
6
|
+
// src/components/checkbox/Checkbox.tsx
|
|
7
|
+
import {
|
|
8
|
+
splitProps,
|
|
9
|
+
Show,
|
|
10
|
+
createEffect,
|
|
11
|
+
createMemo,
|
|
12
|
+
untrack
|
|
13
|
+
} from "solid-js";
|
|
14
|
+
|
|
15
|
+
// src/components/checkbox/Checkbox.styles.ts
|
|
16
|
+
var checkboxVariants = cva(
|
|
17
|
+
[
|
|
18
|
+
"relative inline-flex items-center gap-2 cursor-pointer",
|
|
19
|
+
"select-none",
|
|
20
|
+
"disabled:cursor-not-allowed disabled:opacity-50"
|
|
21
|
+
],
|
|
22
|
+
{
|
|
23
|
+
variants: {
|
|
24
|
+
size: {
|
|
25
|
+
sm: "text-sm",
|
|
26
|
+
md: "text-base",
|
|
27
|
+
lg: "text-lg"
|
|
28
|
+
},
|
|
29
|
+
color: {
|
|
30
|
+
primary: "text-primary",
|
|
31
|
+
success: "text-green-600",
|
|
32
|
+
warning: "text-yellow-600",
|
|
33
|
+
danger: "text-red-600"
|
|
34
|
+
},
|
|
35
|
+
checked: {
|
|
36
|
+
true: "",
|
|
37
|
+
false: ""
|
|
38
|
+
},
|
|
39
|
+
indeterminate: {
|
|
40
|
+
true: "",
|
|
41
|
+
false: ""
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
size: "md",
|
|
46
|
+
color: "primary",
|
|
47
|
+
checked: false,
|
|
48
|
+
indeterminate: false
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
// src/components/checkbox/Checkbox.tsx
|
|
54
|
+
var Checkbox = (props) => {
|
|
55
|
+
const [localProps, variantProps, otherProps] = splitProps(
|
|
56
|
+
props,
|
|
57
|
+
[
|
|
58
|
+
"label",
|
|
59
|
+
"indeterminate",
|
|
60
|
+
"type",
|
|
61
|
+
"onChange",
|
|
62
|
+
"onFocus",
|
|
63
|
+
"onBlur",
|
|
64
|
+
"checked",
|
|
65
|
+
"disabled",
|
|
66
|
+
"aria-label",
|
|
67
|
+
"aria-describedby"
|
|
68
|
+
],
|
|
69
|
+
["class", ...checkboxVariants.variantKeys]
|
|
70
|
+
);
|
|
71
|
+
let inputRef;
|
|
72
|
+
const checkboxClasses = createMemo(() => checkboxVariants(variantProps));
|
|
73
|
+
const markerClasses = createMemo(
|
|
74
|
+
() => classes(
|
|
75
|
+
"inline-block w-4 h-4 border border-gray-400 rounded-sm peer-checked:bg-current",
|
|
76
|
+
localProps.indeterminate ? "bg-gray-400 relative" : ""
|
|
77
|
+
)
|
|
78
|
+
);
|
|
79
|
+
const handleChange = (e) => {
|
|
80
|
+
untrack(() => {
|
|
81
|
+
if (typeof localProps.onChange === "function") {
|
|
82
|
+
localProps.onChange(e);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const handleFocus = (e) => {
|
|
87
|
+
untrack(() => {
|
|
88
|
+
if (typeof localProps.onFocus === "function") {
|
|
89
|
+
localProps.onFocus(e);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
const handleBlur = (e) => {
|
|
94
|
+
untrack(() => {
|
|
95
|
+
if (typeof localProps.onBlur === "function") {
|
|
96
|
+
localProps.onBlur(e);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
createEffect(() => {
|
|
101
|
+
if (inputRef) {
|
|
102
|
+
untrack(() => {
|
|
103
|
+
inputRef.indeterminate = !!localProps.indeterminate;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return <label
|
|
108
|
+
class={checkboxClasses()}
|
|
109
|
+
role="checkbox"
|
|
110
|
+
aria-checked={localProps.indeterminate ? "mixed" : localProps.checked}
|
|
111
|
+
aria-label={localProps["aria-label"]}
|
|
112
|
+
aria-describedby={localProps["aria-describedby"]}
|
|
113
|
+
>
|
|
114
|
+
<input
|
|
115
|
+
ref={inputRef}
|
|
116
|
+
type="checkbox"
|
|
117
|
+
class="peer absolute opacity-0 w-4 h-4"
|
|
118
|
+
checked={localProps.checked}
|
|
119
|
+
disabled={localProps.disabled}
|
|
120
|
+
aria-hidden="true"
|
|
121
|
+
{...otherProps}
|
|
122
|
+
onChange={handleChange}
|
|
123
|
+
onFocus={handleFocus}
|
|
124
|
+
onBlur={handleBlur}
|
|
125
|
+
/>
|
|
126
|
+
|
|
127
|
+
<span class={markerClasses()}>
|
|
128
|
+
<Show when={localProps.indeterminate}>
|
|
129
|
+
<span
|
|
130
|
+
class="absolute top-1/2 left-1/2 w-2 h-0.5 bg-white -translate-x-1/2 -translate-y-1/2"
|
|
131
|
+
aria-hidden="true"
|
|
132
|
+
/>
|
|
133
|
+
</Show>
|
|
134
|
+
</span>
|
|
135
|
+
|
|
136
|
+
<Show when={localProps.label}>
|
|
137
|
+
<span class="ml-2">{localProps.label}</span>
|
|
138
|
+
</Show>
|
|
139
|
+
</label>;
|
|
140
|
+
};
|
|
141
|
+
var Checkbox_default = Checkbox;
|
|
142
|
+
|
|
143
|
+
// src/components/checkbox/index.ts
|
|
144
|
+
var checkbox_default = Checkbox_default;
|
|
145
|
+
|
|
146
|
+
export {
|
|
147
|
+
checkbox_default
|
|
148
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { cva } from './HKS7ET6T.js';
|
|
2
|
+
import { delegateEvents, template, addEventListener, spread, mergeProps, memo, insert, createComponent, effect, className, setAttribute } from 'solid-js/web';
|
|
3
|
+
import { splitProps, createSignal, Show } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/accordion/Accordion.styles.ts
|
|
6
|
+
var accordionContainerVariants = cva(
|
|
7
|
+
["w-full border rounded transition-colors", "bg-white dark:bg-gray-800"],
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
expanded: {
|
|
11
|
+
true: "border-blue-500",
|
|
12
|
+
false: "border-gray-300 dark:border-gray-600"
|
|
13
|
+
},
|
|
14
|
+
disabled: {
|
|
15
|
+
true: "opacity-50 cursor-not-allowed",
|
|
16
|
+
false: ""
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
expanded: false,
|
|
21
|
+
disabled: false
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
var accordionHeaderVariants = cva(
|
|
26
|
+
[
|
|
27
|
+
"w-full text-left px-4 py-2 flex items-center justify-between cursor-pointer",
|
|
28
|
+
"transition-colors duration-200"
|
|
29
|
+
],
|
|
30
|
+
{
|
|
31
|
+
variants: {
|
|
32
|
+
headerIsTrigger: {
|
|
33
|
+
true: "hover:bg-gray-100 dark:hover:bg-gray-700",
|
|
34
|
+
false: ""
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
headerIsTrigger: true
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
var accordionContentVariants = cva(
|
|
43
|
+
"px-4 py-2 border-t border-gray-200 dark:border-gray-700"
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
// src/components/accordion/Accordion.tsx
|
|
47
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
48
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div><div>`);
|
|
49
|
+
var Accordion = (props) => {
|
|
50
|
+
const [local, variantProps, otherProps] = splitProps(props, ["expanded", "disabled", "headerIsTrigger", "header", "content"], ["expanded", "disabled"]);
|
|
51
|
+
const [isOpen, setIsOpen] = createSignal(local.expanded ?? false);
|
|
52
|
+
const handleToggle = () => {
|
|
53
|
+
if (!local.disabled) setIsOpen((prev) => !prev);
|
|
54
|
+
};
|
|
55
|
+
const handleKeyDown = local.headerIsTrigger ? (e) => {
|
|
56
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
handleToggle();
|
|
59
|
+
}
|
|
60
|
+
} : void 0;
|
|
61
|
+
return (() => {
|
|
62
|
+
var _el$ = _tmpl$2(), _el$2 = _el$.firstChild;
|
|
63
|
+
addEventListener(_el$, "keydown", handleKeyDown, true);
|
|
64
|
+
spread(_el$, mergeProps({
|
|
65
|
+
get ["class"]() {
|
|
66
|
+
return accordionContainerVariants({
|
|
67
|
+
...variantProps,
|
|
68
|
+
expanded: isOpen(),
|
|
69
|
+
disabled: local.disabled
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
get role() {
|
|
73
|
+
return local.headerIsTrigger ? "button" : void 0;
|
|
74
|
+
},
|
|
75
|
+
get tabindex() {
|
|
76
|
+
return local.headerIsTrigger ? "0" : void 0;
|
|
77
|
+
},
|
|
78
|
+
get ["aria-expanded"]() {
|
|
79
|
+
return memo(() => !!local.headerIsTrigger)() ? isOpen() : void 0;
|
|
80
|
+
},
|
|
81
|
+
get ["aria-disabled"]() {
|
|
82
|
+
return local.disabled;
|
|
83
|
+
}
|
|
84
|
+
}, otherProps), false, true);
|
|
85
|
+
addEventListener(_el$2, "click", local.headerIsTrigger ? handleToggle : void 0, true);
|
|
86
|
+
insert(_el$2, () => local.header);
|
|
87
|
+
insert(_el$, createComponent(Show, {
|
|
88
|
+
get when() {
|
|
89
|
+
return isOpen();
|
|
90
|
+
},
|
|
91
|
+
get children() {
|
|
92
|
+
var _el$3 = _tmpl$();
|
|
93
|
+
insert(_el$3, () => local.content);
|
|
94
|
+
effect(() => className(_el$3, accordionContentVariants()));
|
|
95
|
+
return _el$3;
|
|
96
|
+
}
|
|
97
|
+
}), null);
|
|
98
|
+
effect((_p$) => {
|
|
99
|
+
var _v$ = accordionHeaderVariants({
|
|
100
|
+
headerIsTrigger: local.headerIsTrigger
|
|
101
|
+
}), _v$2 = local.headerIsTrigger ? "button" : void 0;
|
|
102
|
+
_v$ !== _p$.e && className(_el$2, _p$.e = _v$);
|
|
103
|
+
_v$2 !== _p$.t && setAttribute(_el$2, "role", _p$.t = _v$2);
|
|
104
|
+
return _p$;
|
|
105
|
+
}, {
|
|
106
|
+
e: void 0,
|
|
107
|
+
t: void 0
|
|
108
|
+
});
|
|
109
|
+
return _el$;
|
|
110
|
+
})();
|
|
111
|
+
};
|
|
112
|
+
var Accordion_default = Accordion;
|
|
113
|
+
delegateEvents(["keydown", "click"]);
|
|
114
|
+
|
|
115
|
+
// src/components/accordion/index.ts
|
|
116
|
+
var accordion_default = Accordion_default;
|
|
117
|
+
|
|
118
|
+
export { accordion_default };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { cva } from './HKS7ET6T.js';
|
|
2
|
+
import { template, spread, mergeProps, insert, effect, className, setAttribute } from 'solid-js/web';
|
|
3
|
+
import { splitProps, createSignal, createMemo, untrack } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/switch/Switch.styles.ts
|
|
6
|
+
var switchVariants = cva(
|
|
7
|
+
"switch inline-flex items-center gap-2 select-none",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
sm: "text-sm",
|
|
12
|
+
md: "text-base",
|
|
13
|
+
lg: "text-lg"
|
|
14
|
+
},
|
|
15
|
+
disabled: {
|
|
16
|
+
true: "opacity-50 cursor-not-allowed",
|
|
17
|
+
false: ""
|
|
18
|
+
},
|
|
19
|
+
rounded: {
|
|
20
|
+
true: "",
|
|
21
|
+
false: ""
|
|
22
|
+
},
|
|
23
|
+
outlined: {
|
|
24
|
+
true: "",
|
|
25
|
+
false: ""
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
size: "md",
|
|
30
|
+
disabled: false,
|
|
31
|
+
rounded: true,
|
|
32
|
+
outlined: false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
var checkVariants = cva(
|
|
37
|
+
[
|
|
38
|
+
"relative transition-colors duration-200",
|
|
39
|
+
"after:content-[''] after:absolute after:bg-white after:transition-transform after:duration-700 after:ease-in-out"
|
|
40
|
+
].join(" "),
|
|
41
|
+
{
|
|
42
|
+
variants: {
|
|
43
|
+
size: {
|
|
44
|
+
sm: "w-8 h-4 after:w-3 after:h-3 after:left-0.5 after:top-0.5 peer-checked:after:translate-x-4",
|
|
45
|
+
md: "w-10 h-6 after:w-4 after:h-4 after:left-1 after:top-1 peer-checked:after:translate-x-4",
|
|
46
|
+
lg: "w-12 h-7 after:w-5 after:h-5 after:left-1 after:top-1 peer-checked:after:translate-x-5"
|
|
47
|
+
},
|
|
48
|
+
color: {
|
|
49
|
+
blue: "peer-checked:bg-blue-500",
|
|
50
|
+
green: "peer-checked:bg-green-500",
|
|
51
|
+
red: "peer-checked:bg-red-500",
|
|
52
|
+
yellow: "peer-checked:bg-yellow-400",
|
|
53
|
+
gray: "peer-checked:bg-gray-500"
|
|
54
|
+
},
|
|
55
|
+
passiveColor: {
|
|
56
|
+
blue: "bg-blue-200",
|
|
57
|
+
green: "bg-green-200",
|
|
58
|
+
red: "bg-red-200",
|
|
59
|
+
yellow: "bg-yellow-200",
|
|
60
|
+
gray: "bg-gray-300"
|
|
61
|
+
},
|
|
62
|
+
rounded: {
|
|
63
|
+
true: "rounded-full after:rounded-full",
|
|
64
|
+
false: "rounded-md after:rounded-sm"
|
|
65
|
+
},
|
|
66
|
+
outlined: {
|
|
67
|
+
true: "ring-2 ring-inset ring-white",
|
|
68
|
+
false: ""
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
defaultVariants: {
|
|
72
|
+
size: "md",
|
|
73
|
+
color: "blue",
|
|
74
|
+
passiveColor: "gray",
|
|
75
|
+
rounded: true,
|
|
76
|
+
outlined: false
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// src/components/switch/Switch.tsx
|
|
82
|
+
var _tmpl$ = /* @__PURE__ */ template(`<label role=switch><input type=checkbox class="sr-only peer"aria-hidden=true><span></span><span class=control-label>`);
|
|
83
|
+
var Switch = (props) => {
|
|
84
|
+
const [localProps, variantProps, otherProps] = splitProps(props, ["children", "checked", "defaultChecked", "onChange", "name", "required", "disabled", "aria-label", "aria-describedby"], ["size", "rounded", "outlined", "color", "passiveColor"]);
|
|
85
|
+
const isControlled = localProps.checked !== void 0;
|
|
86
|
+
const [internalChecked, setInternalChecked] = createSignal(localProps.defaultChecked ?? false);
|
|
87
|
+
const checkedValue = createMemo(() => untrack(() => isControlled ? localProps.checked : internalChecked()));
|
|
88
|
+
const switchClasses = createMemo(() => switchVariants(variantProps));
|
|
89
|
+
const checkClasses = createMemo(() => checkVariants({
|
|
90
|
+
size: variantProps.size,
|
|
91
|
+
color: variantProps.color,
|
|
92
|
+
passiveColor: variantProps.passiveColor,
|
|
93
|
+
rounded: variantProps.rounded,
|
|
94
|
+
outlined: variantProps.outlined
|
|
95
|
+
}));
|
|
96
|
+
const handleChange = (e) => {
|
|
97
|
+
const next = e.currentTarget.checked;
|
|
98
|
+
untrack(() => {
|
|
99
|
+
if (!isControlled) setInternalChecked(next);
|
|
100
|
+
localProps.onChange?.(next);
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
return (() => {
|
|
104
|
+
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling, _el$4 = _el$3.nextSibling;
|
|
105
|
+
_el$2.addEventListener("change", handleChange);
|
|
106
|
+
spread(_el$2, mergeProps({
|
|
107
|
+
get checked() {
|
|
108
|
+
return checkedValue();
|
|
109
|
+
},
|
|
110
|
+
get name() {
|
|
111
|
+
return localProps.name;
|
|
112
|
+
},
|
|
113
|
+
get required() {
|
|
114
|
+
return localProps.required;
|
|
115
|
+
},
|
|
116
|
+
get disabled() {
|
|
117
|
+
return localProps.disabled;
|
|
118
|
+
}
|
|
119
|
+
}, otherProps), false, false);
|
|
120
|
+
insert(_el$4, () => localProps.children);
|
|
121
|
+
effect((_p$) => {
|
|
122
|
+
var _v$ = switchClasses(), _v$2 = checkedValue(), _v$3 = localProps["aria-label"], _v$4 = localProps["aria-describedby"], _v$5 = checkClasses();
|
|
123
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
124
|
+
_v$2 !== _p$.t && setAttribute(_el$, "aria-checked", _p$.t = _v$2);
|
|
125
|
+
_v$3 !== _p$.a && setAttribute(_el$, "aria-label", _p$.a = _v$3);
|
|
126
|
+
_v$4 !== _p$.o && setAttribute(_el$, "aria-describedby", _p$.o = _v$4);
|
|
127
|
+
_v$5 !== _p$.i && className(_el$3, _p$.i = _v$5);
|
|
128
|
+
return _p$;
|
|
129
|
+
}, {
|
|
130
|
+
e: void 0,
|
|
131
|
+
t: void 0,
|
|
132
|
+
a: void 0,
|
|
133
|
+
o: void 0,
|
|
134
|
+
i: void 0
|
|
135
|
+
});
|
|
136
|
+
return _el$;
|
|
137
|
+
})();
|
|
138
|
+
};
|
|
139
|
+
var Switch_default = Switch;
|
|
140
|
+
|
|
141
|
+
// src/components/switch/index.ts
|
|
142
|
+
var switch_default = Switch_default;
|
|
143
|
+
|
|
144
|
+
export { switch_default };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
classes,
|
|
3
|
+
cva
|
|
4
|
+
} from "./P7WPLZNA.jsx";
|
|
5
|
+
|
|
6
|
+
// src/components/upload/Upload.tsx
|
|
7
|
+
import { splitProps, Show } from "solid-js";
|
|
8
|
+
|
|
9
|
+
// src/components/upload/Upload.styles.ts
|
|
10
|
+
var uploadWrapperVariants = cva("", {
|
|
11
|
+
variants: {
|
|
12
|
+
style: {
|
|
13
|
+
boxed: "flex flex-col items-center justify-center border border-gray-300 rounded-md p-4 bg-white dark:bg-gray-800 text-gray-700 hover:text-gray-900 text-center",
|
|
14
|
+
button: "px-4 py-2 rounded inline-flex items-center gap-2 text-white transition-colors"
|
|
15
|
+
},
|
|
16
|
+
color: {
|
|
17
|
+
primary: "bg-blue-500 hover:bg-blue-600",
|
|
18
|
+
success: "bg-green-500 hover:bg-green-600",
|
|
19
|
+
info: "bg-sky-500 hover:bg-sky-600",
|
|
20
|
+
warning: "bg-yellow-500 hover:bg-yellow-600",
|
|
21
|
+
danger: "bg-red-500 hover:bg-red-600",
|
|
22
|
+
gray: ""
|
|
23
|
+
// usado solo en style="boxed"
|
|
24
|
+
},
|
|
25
|
+
size: {
|
|
26
|
+
sm: "text-sm",
|
|
27
|
+
md: "text-base",
|
|
28
|
+
lg: "text-lg"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
style: "boxed",
|
|
33
|
+
color: "gray",
|
|
34
|
+
size: "md"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
var fileInputClass = "absolute inset-0 w-full h-full opacity-0 cursor-pointer";
|
|
38
|
+
var fileIconClass = "w-6 h-6";
|
|
39
|
+
var fileLabelClass = "font-medium";
|
|
40
|
+
|
|
41
|
+
// src/components/upload/Upload.tsx
|
|
42
|
+
var Upload = (props) => {
|
|
43
|
+
const [local, variantProps, otherProps] = splitProps(
|
|
44
|
+
props,
|
|
45
|
+
[
|
|
46
|
+
"icon",
|
|
47
|
+
"label",
|
|
48
|
+
"multiple",
|
|
49
|
+
"disabled",
|
|
50
|
+
"accept",
|
|
51
|
+
"dragDrop",
|
|
52
|
+
"name",
|
|
53
|
+
"onChange"
|
|
54
|
+
],
|
|
55
|
+
["style", "color", "size"]
|
|
56
|
+
);
|
|
57
|
+
const handleChange = (e) => {
|
|
58
|
+
const files = e.target.files;
|
|
59
|
+
if (!files || files.length === 0) return;
|
|
60
|
+
const result = local.multiple ? Array.from(files) : files[0];
|
|
61
|
+
if (result) {
|
|
62
|
+
local.onChange?.(result);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const handleDrop = (e) => {
|
|
66
|
+
if (!local.dragDrop) return;
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
const files = e.dataTransfer?.files;
|
|
69
|
+
if (!files || files.length === 0) return;
|
|
70
|
+
const result = local.multiple ? Array.from(files) : files[0];
|
|
71
|
+
if (result) {
|
|
72
|
+
local.onChange?.(result);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const handleDragOver = (e) => {
|
|
76
|
+
if (local.dragDrop) e.preventDefault();
|
|
77
|
+
};
|
|
78
|
+
return <div class={uploadWrapperVariants(variantProps)}>
|
|
79
|
+
<label class="cursor-pointer relative w-full h-full">
|
|
80
|
+
<input
|
|
81
|
+
type="file"
|
|
82
|
+
class={fileInputClass}
|
|
83
|
+
name={local.name}
|
|
84
|
+
multiple={local.multiple}
|
|
85
|
+
accept={local.accept}
|
|
86
|
+
disabled={local.disabled}
|
|
87
|
+
onChange={handleChange}
|
|
88
|
+
{...otherProps}
|
|
89
|
+
/>
|
|
90
|
+
<div
|
|
91
|
+
class={classes(
|
|
92
|
+
variantProps.style === "boxed" ? "flex flex-col items-center justify-center gap-2" : "flex flex-row items-center justify-center gap-2"
|
|
93
|
+
)}
|
|
94
|
+
>
|
|
95
|
+
<Show when={local.icon}>
|
|
96
|
+
<span class={fileIconClass}>{local.icon}</span>
|
|
97
|
+
</Show>
|
|
98
|
+
<span class={fileLabelClass}>{local.label}</span>
|
|
99
|
+
</div>
|
|
100
|
+
</label>
|
|
101
|
+
</div>;
|
|
102
|
+
};
|
|
103
|
+
var Upload_default = Upload;
|
|
104
|
+
|
|
105
|
+
// src/components/upload/index.ts
|
|
106
|
+
var upload_default = Upload_default;
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
upload_default
|
|
110
|
+
};
|