@pathscale/ui 0.0.1
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/LICENSE +21 -0
- package/README.md +12 -0
- package/dist/Avatar-CzIirpVq.d.ts +33 -0
- package/dist/Button-B50OLXuV.d.ts +63 -0
- package/dist/Input-BQbTzjIO.d.ts +34 -0
- package/dist/Textarea-Cpdk7m6S.d.ts +37 -0
- package/dist/chunk/2JGZSAW5.js +107 -0
- package/dist/chunk/4RCWSX7S.jsx +101 -0
- package/dist/chunk/EB7KXR65.js +102 -0
- package/dist/chunk/G6RG4LR7.js +87 -0
- package/dist/chunk/GA2HCFRS.jsx +228 -0
- package/dist/chunk/HKS7ET6T.js +56 -0
- package/dist/chunk/KACNXPUM.jsx +103 -0
- package/dist/chunk/N7BXP7EI.jsx +102 -0
- package/dist/chunk/NZZRKP74.js +214 -0
- package/dist/chunk/P7WPLZNA.jsx +59 -0
- package/dist/chunk/T2DPPLBQ.js +100 -0
- package/dist/chunk/WB6NEEQV.jsx +107 -0
- package/dist/classes-B_S9K-9I.d.ts +13 -0
- package/dist/components/Progress/index.d.ts +42 -0
- package/dist/components/Progress/index.js +278 -0
- package/dist/components/Progress/index.jsx +202 -0
- package/dist/components/accordion/index.d.ts +27 -0
- package/dist/components/accordion/index.js +118 -0
- package/dist/components/accordion/index.jsx +104 -0
- package/dist/components/avatar/index.d.ts +8 -0
- package/dist/components/avatar/index.js +1 -0
- package/dist/components/avatar/index.jsx +7 -0
- package/dist/components/breadcrumb/index.d.ts +47 -0
- package/dist/components/breadcrumb/index.js +133 -0
- package/dist/components/breadcrumb/index.jsx +125 -0
- package/dist/components/button/index.d.ts +9 -0
- package/dist/components/button/index.js +1 -0
- package/dist/components/button/index.jsx +8 -0
- package/dist/components/checkbox/index.d.ts +40 -0
- package/dist/components/checkbox/index.js +137 -0
- package/dist/components/checkbox/index.jsx +147 -0
- package/dist/components/input/index.d.ts +8 -0
- package/dist/components/input/index.js +1 -0
- package/dist/components/input/index.jsx +7 -0
- package/dist/components/pagination/index.d.ts +43 -0
- package/dist/components/pagination/index.js +189 -0
- package/dist/components/pagination/index.jsx +178 -0
- package/dist/components/polymorphic/index.d.ts +35 -0
- package/dist/components/polymorphic/index.js +1 -0
- package/dist/components/polymorphic/index.jsx +8 -0
- package/dist/components/select/index.d.ts +44 -0
- package/dist/components/select/index.js +98 -0
- package/dist/components/select/index.jsx +95 -0
- package/dist/components/switch/index.d.ts +72 -0
- package/dist/components/switch/index.js +144 -0
- package/dist/components/switch/index.jsx +159 -0
- package/dist/components/tabs/index.d.ts +42 -0
- package/dist/components/tabs/index.js +166 -0
- package/dist/components/tabs/index.jsx +174 -0
- package/dist/components/tag/index.d.ts +42 -0
- package/dist/components/tag/index.js +115 -0
- package/dist/components/tag/index.jsx +131 -0
- package/dist/components/textarea/index.d.ts +8 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/textarea/index.jsx +7 -0
- package/dist/components/tooltip/index.d.ts +53 -0
- package/dist/components/tooltip/index.js +103 -0
- package/dist/components/tooltip/index.jsx +99 -0
- package/dist/components/upload/index.d.ts +39 -0
- package/dist/components/upload/index.js +98 -0
- package/dist/components/upload/index.jsx +109 -0
- package/dist/index.css +73 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +4 -0
- package/dist/index.jsx +20 -0
- package/package.json +67 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { cva } from '../../chunk/HKS7ET6T.js';
|
|
2
|
+
import { delegateEvents, template, spread, mergeProps, insert, createComponent, memo, effect, className } from 'solid-js/web';
|
|
3
|
+
import { splitProps, createMemo, Show, For } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/pagination/Pagination.styles.ts
|
|
6
|
+
var paginationItemVariants = cva(
|
|
7
|
+
[
|
|
8
|
+
"inline-flex items-center justify-center font-medium transition-colors",
|
|
9
|
+
"select-none border border-transparent",
|
|
10
|
+
// border shown only when needed
|
|
11
|
+
"disabled:opacity-50 disabled:pointer-events-none"
|
|
12
|
+
],
|
|
13
|
+
{
|
|
14
|
+
variants: {
|
|
15
|
+
active: {
|
|
16
|
+
true: "bg-blue-500 text-white hover:bg-blue-600",
|
|
17
|
+
false: "bg-transparent text-gray-700 hover:bg-gray-200 dark:text-gray-200 dark:hover:bg-gray-700"
|
|
18
|
+
},
|
|
19
|
+
rounded: {
|
|
20
|
+
true: "rounded-full",
|
|
21
|
+
false: "rounded"
|
|
22
|
+
},
|
|
23
|
+
simple: {
|
|
24
|
+
true: "border-none bg-transparent hover:bg-transparent text-gray-700 dark:text-gray-300",
|
|
25
|
+
false: ""
|
|
26
|
+
},
|
|
27
|
+
size: {
|
|
28
|
+
sm: "text-xs px-2 py-1",
|
|
29
|
+
md: "text-sm px-3 py-1.5",
|
|
30
|
+
lg: "text-base px-4 py-2"
|
|
31
|
+
},
|
|
32
|
+
disabled: {
|
|
33
|
+
true: "opacity-50 pointer-events-none",
|
|
34
|
+
false: ""
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
defaultVariants: {
|
|
38
|
+
active: false,
|
|
39
|
+
rounded: false,
|
|
40
|
+
simple: false,
|
|
41
|
+
size: "md",
|
|
42
|
+
disabled: false
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
var paginationInfoVariants = cva(
|
|
47
|
+
"inline-block font-medium transition-colors",
|
|
48
|
+
{
|
|
49
|
+
variants: {
|
|
50
|
+
simple: {
|
|
51
|
+
true: "text-sm text-gray-600 dark:text-gray-300 px-2",
|
|
52
|
+
false: "text-sm text-gray-700 dark:text-gray-200 px-2"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
simple: false
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
var paginationContainerVariants = cva(
|
|
61
|
+
"flex items-center gap-1 flex-wrap",
|
|
62
|
+
{
|
|
63
|
+
variants: {
|
|
64
|
+
align: {
|
|
65
|
+
start: "justify-start",
|
|
66
|
+
center: "justify-center",
|
|
67
|
+
end: "justify-end"
|
|
68
|
+
},
|
|
69
|
+
wrap: {
|
|
70
|
+
true: "flex-wrap",
|
|
71
|
+
false: "flex-nowrap"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
defaultVariants: {
|
|
75
|
+
align: "start",
|
|
76
|
+
wrap: true
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// src/components/pagination/Pagination.tsx
|
|
82
|
+
var _tmpl$ = /* @__PURE__ */ template(`<span>`);
|
|
83
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<nav><button>«</button><button>»`);
|
|
84
|
+
var _tmpl$3 = /* @__PURE__ */ template(`<button>`);
|
|
85
|
+
var Pagination = (props) => {
|
|
86
|
+
const [local, variantProps, otherProps] = splitProps(props, ["total", "perPage", "current", "onChange", "rangeBefore", "rangeAfter", "simple", "children"], ["rounded", "size", "disabled", "active", "simple"]);
|
|
87
|
+
const perPage = () => local.perPage ?? 20;
|
|
88
|
+
const pageCount = createMemo(() => Math.ceil(local.total / perPage()));
|
|
89
|
+
const hasPrev = createMemo(() => local.current > 1);
|
|
90
|
+
const hasNext = createMemo(() => local.current < pageCount());
|
|
91
|
+
const pagesInRange = createMemo(() => {
|
|
92
|
+
const before = local.rangeBefore ?? 1;
|
|
93
|
+
const after = local.rangeAfter ?? 1;
|
|
94
|
+
const start = Math.max(1, local.current - before);
|
|
95
|
+
const end = Math.min(local.current + after, pageCount());
|
|
96
|
+
return Array.from({
|
|
97
|
+
length: end - start + 1
|
|
98
|
+
}, (_, i) => start + i);
|
|
99
|
+
});
|
|
100
|
+
const changePage = (page) => {
|
|
101
|
+
if (page >= 1 && page <= pageCount() && page !== local.current) {
|
|
102
|
+
local.onChange(page);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
return (() => {
|
|
106
|
+
var _el$ = _tmpl$2(), _el$2 = _el$.firstChild, _el$4 = _el$2.nextSibling;
|
|
107
|
+
spread(_el$, mergeProps({
|
|
108
|
+
get ["class"]() {
|
|
109
|
+
return paginationContainerVariants({
|
|
110
|
+
align: "start",
|
|
111
|
+
wrap: true
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}, otherProps), false, true);
|
|
115
|
+
_el$2.$$click = () => changePage(local.current - 1);
|
|
116
|
+
insert(_el$, createComponent(Show, {
|
|
117
|
+
get when() {
|
|
118
|
+
return pageCount() > 1;
|
|
119
|
+
},
|
|
120
|
+
get children() {
|
|
121
|
+
return [createComponent(Show, {
|
|
122
|
+
get when() {
|
|
123
|
+
return local.simple;
|
|
124
|
+
},
|
|
125
|
+
get children() {
|
|
126
|
+
var _el$3 = _tmpl$();
|
|
127
|
+
insert(_el$3, (() => {
|
|
128
|
+
var _c$ = memo(() => perPage() === 1);
|
|
129
|
+
return () => _c$() ? `${(local.current - 1) * perPage() + 1} / ${local.total}` : `${(local.current - 1) * perPage() + 1}-${Math.min(local.current * perPage(), local.total)} / ${local.total}`;
|
|
130
|
+
})());
|
|
131
|
+
effect(() => className(_el$3, paginationInfoVariants({
|
|
132
|
+
simple: true
|
|
133
|
+
})));
|
|
134
|
+
return _el$3;
|
|
135
|
+
}
|
|
136
|
+
}), createComponent(Show, {
|
|
137
|
+
get when() {
|
|
138
|
+
return !local.simple;
|
|
139
|
+
},
|
|
140
|
+
get children() {
|
|
141
|
+
return createComponent(For, {
|
|
142
|
+
get each() {
|
|
143
|
+
return pagesInRange();
|
|
144
|
+
},
|
|
145
|
+
children: (page) => (() => {
|
|
146
|
+
var _el$5 = _tmpl$3();
|
|
147
|
+
_el$5.$$click = () => changePage(page);
|
|
148
|
+
insert(_el$5, page);
|
|
149
|
+
effect(() => className(_el$5, paginationItemVariants({
|
|
150
|
+
...variantProps,
|
|
151
|
+
active: page === local.current
|
|
152
|
+
})));
|
|
153
|
+
return _el$5;
|
|
154
|
+
})()
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
})];
|
|
158
|
+
}
|
|
159
|
+
}), _el$4);
|
|
160
|
+
_el$4.$$click = () => changePage(local.current + 1);
|
|
161
|
+
effect((_p$) => {
|
|
162
|
+
var _v$ = paginationItemVariants({
|
|
163
|
+
...variantProps,
|
|
164
|
+
disabled: !hasPrev()
|
|
165
|
+
}), _v$2 = !hasPrev(), _v$3 = paginationItemVariants({
|
|
166
|
+
...variantProps,
|
|
167
|
+
disabled: !hasNext()
|
|
168
|
+
}), _v$4 = !hasNext();
|
|
169
|
+
_v$ !== _p$.e && className(_el$2, _p$.e = _v$);
|
|
170
|
+
_v$2 !== _p$.t && (_el$2.disabled = _p$.t = _v$2);
|
|
171
|
+
_v$3 !== _p$.a && className(_el$4, _p$.a = _v$3);
|
|
172
|
+
_v$4 !== _p$.o && (_el$4.disabled = _p$.o = _v$4);
|
|
173
|
+
return _p$;
|
|
174
|
+
}, {
|
|
175
|
+
e: void 0,
|
|
176
|
+
t: void 0,
|
|
177
|
+
a: void 0,
|
|
178
|
+
o: void 0
|
|
179
|
+
});
|
|
180
|
+
return _el$;
|
|
181
|
+
})();
|
|
182
|
+
};
|
|
183
|
+
var Pagination_default = Pagination;
|
|
184
|
+
delegateEvents(["click"]);
|
|
185
|
+
|
|
186
|
+
// src/components/pagination/index.ts
|
|
187
|
+
var pagination_default = Pagination_default;
|
|
188
|
+
|
|
189
|
+
export { pagination_default as default };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cva
|
|
3
|
+
} from "../../chunk/P7WPLZNA.jsx";
|
|
4
|
+
|
|
5
|
+
// src/components/pagination/Pagination.tsx
|
|
6
|
+
import {
|
|
7
|
+
splitProps,
|
|
8
|
+
createMemo,
|
|
9
|
+
Show,
|
|
10
|
+
For
|
|
11
|
+
} from "solid-js";
|
|
12
|
+
|
|
13
|
+
// src/components/pagination/Pagination.styles.ts
|
|
14
|
+
var paginationItemVariants = cva(
|
|
15
|
+
[
|
|
16
|
+
"inline-flex items-center justify-center font-medium transition-colors",
|
|
17
|
+
"select-none border border-transparent",
|
|
18
|
+
// border shown only when needed
|
|
19
|
+
"disabled:opacity-50 disabled:pointer-events-none"
|
|
20
|
+
],
|
|
21
|
+
{
|
|
22
|
+
variants: {
|
|
23
|
+
active: {
|
|
24
|
+
true: "bg-blue-500 text-white hover:bg-blue-600",
|
|
25
|
+
false: "bg-transparent text-gray-700 hover:bg-gray-200 dark:text-gray-200 dark:hover:bg-gray-700"
|
|
26
|
+
},
|
|
27
|
+
rounded: {
|
|
28
|
+
true: "rounded-full",
|
|
29
|
+
false: "rounded"
|
|
30
|
+
},
|
|
31
|
+
simple: {
|
|
32
|
+
true: "border-none bg-transparent hover:bg-transparent text-gray-700 dark:text-gray-300",
|
|
33
|
+
false: ""
|
|
34
|
+
},
|
|
35
|
+
size: {
|
|
36
|
+
sm: "text-xs px-2 py-1",
|
|
37
|
+
md: "text-sm px-3 py-1.5",
|
|
38
|
+
lg: "text-base px-4 py-2"
|
|
39
|
+
},
|
|
40
|
+
disabled: {
|
|
41
|
+
true: "opacity-50 pointer-events-none",
|
|
42
|
+
false: ""
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
active: false,
|
|
47
|
+
rounded: false,
|
|
48
|
+
simple: false,
|
|
49
|
+
size: "md",
|
|
50
|
+
disabled: false
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
var paginationInfoVariants = cva(
|
|
55
|
+
"inline-block font-medium transition-colors",
|
|
56
|
+
{
|
|
57
|
+
variants: {
|
|
58
|
+
simple: {
|
|
59
|
+
true: "text-sm text-gray-600 dark:text-gray-300 px-2",
|
|
60
|
+
false: "text-sm text-gray-700 dark:text-gray-200 px-2"
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
defaultVariants: {
|
|
64
|
+
simple: false
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
var paginationContainerVariants = cva(
|
|
69
|
+
"flex items-center gap-1 flex-wrap",
|
|
70
|
+
{
|
|
71
|
+
variants: {
|
|
72
|
+
align: {
|
|
73
|
+
start: "justify-start",
|
|
74
|
+
center: "justify-center",
|
|
75
|
+
end: "justify-end"
|
|
76
|
+
},
|
|
77
|
+
wrap: {
|
|
78
|
+
true: "flex-wrap",
|
|
79
|
+
false: "flex-nowrap"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
defaultVariants: {
|
|
83
|
+
align: "start",
|
|
84
|
+
wrap: true
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
// src/components/pagination/Pagination.tsx
|
|
90
|
+
var Pagination = (props) => {
|
|
91
|
+
const [local, variantProps, otherProps] = splitProps(
|
|
92
|
+
props,
|
|
93
|
+
[
|
|
94
|
+
"total",
|
|
95
|
+
"perPage",
|
|
96
|
+
"current",
|
|
97
|
+
"onChange",
|
|
98
|
+
"rangeBefore",
|
|
99
|
+
"rangeAfter",
|
|
100
|
+
"simple",
|
|
101
|
+
"children"
|
|
102
|
+
],
|
|
103
|
+
["rounded", "size", "disabled", "active", "simple"]
|
|
104
|
+
);
|
|
105
|
+
const perPage = () => local.perPage ?? 20;
|
|
106
|
+
const pageCount = createMemo(() => Math.ceil(local.total / perPage()));
|
|
107
|
+
const hasPrev = createMemo(() => local.current > 1);
|
|
108
|
+
const hasNext = createMemo(() => local.current < pageCount());
|
|
109
|
+
const pagesInRange = createMemo(() => {
|
|
110
|
+
const before = local.rangeBefore ?? 1;
|
|
111
|
+
const after = local.rangeAfter ?? 1;
|
|
112
|
+
const start = Math.max(1, local.current - before);
|
|
113
|
+
const end = Math.min(local.current + after, pageCount());
|
|
114
|
+
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
115
|
+
});
|
|
116
|
+
const changePage = (page) => {
|
|
117
|
+
if (page >= 1 && page <= pageCount() && page !== local.current) {
|
|
118
|
+
local.onChange(page);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
return <nav
|
|
122
|
+
class={paginationContainerVariants({ align: "start", wrap: true })}
|
|
123
|
+
{...otherProps}
|
|
124
|
+
>
|
|
125
|
+
<button
|
|
126
|
+
class={paginationItemVariants({
|
|
127
|
+
...variantProps,
|
|
128
|
+
disabled: !hasPrev()
|
|
129
|
+
})}
|
|
130
|
+
onClick={() => changePage(local.current - 1)}
|
|
131
|
+
disabled={!hasPrev()}
|
|
132
|
+
>
|
|
133
|
+
«
|
|
134
|
+
</button>
|
|
135
|
+
|
|
136
|
+
<Show when={pageCount() > 1}>
|
|
137
|
+
<Show when={local.simple}>
|
|
138
|
+
<span class={paginationInfoVariants({ simple: true })}>
|
|
139
|
+
{perPage() === 1 ? `${(local.current - 1) * perPage() + 1} / ${local.total}` : `${(local.current - 1) * perPage() + 1}-${Math.min(
|
|
140
|
+
local.current * perPage(),
|
|
141
|
+
local.total
|
|
142
|
+
)} / ${local.total}`}
|
|
143
|
+
</span>
|
|
144
|
+
</Show>
|
|
145
|
+
|
|
146
|
+
<Show when={!local.simple}>
|
|
147
|
+
<For each={pagesInRange()}>
|
|
148
|
+
{(page) => <button
|
|
149
|
+
class={paginationItemVariants({
|
|
150
|
+
...variantProps,
|
|
151
|
+
active: page === local.current
|
|
152
|
+
})}
|
|
153
|
+
onClick={() => changePage(page)}
|
|
154
|
+
>
|
|
155
|
+
{page}
|
|
156
|
+
</button>}
|
|
157
|
+
</For>
|
|
158
|
+
</Show>
|
|
159
|
+
</Show>
|
|
160
|
+
<button
|
|
161
|
+
class={paginationItemVariants({
|
|
162
|
+
...variantProps,
|
|
163
|
+
disabled: !hasNext()
|
|
164
|
+
})}
|
|
165
|
+
onClick={() => changePage(local.current + 1)}
|
|
166
|
+
disabled={!hasNext()}
|
|
167
|
+
>
|
|
168
|
+
»
|
|
169
|
+
</button>
|
|
170
|
+
</nav>;
|
|
171
|
+
};
|
|
172
|
+
var Pagination_default = Pagination;
|
|
173
|
+
|
|
174
|
+
// src/components/pagination/index.ts
|
|
175
|
+
var pagination_default = Pagination_default;
|
|
176
|
+
export {
|
|
177
|
+
pagination_default as default
|
|
178
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as solid_js from 'solid-js';
|
|
2
|
+
import { ValidComponent, ComponentProps, JSX, Ref } from 'solid-js';
|
|
3
|
+
|
|
4
|
+
type OverrideProps<T, P> = Omit<T, keyof P> & P;
|
|
5
|
+
|
|
6
|
+
type PolymorphicAttributes<T extends ValidComponent> = {
|
|
7
|
+
/**
|
|
8
|
+
* Component to render the polymorphic component as.
|
|
9
|
+
* @defaultValue `div`
|
|
10
|
+
*/
|
|
11
|
+
as?: T | keyof JSX.HTMLElementTags;
|
|
12
|
+
};
|
|
13
|
+
type PolymorphicProps<T extends ValidComponent, P extends object> = OverrideProps<ComponentProps<T>, P & PolymorphicAttributes<T>>;
|
|
14
|
+
/**
|
|
15
|
+
* Renders as a div by default and can be overridden with the `as` property.
|
|
16
|
+
*/
|
|
17
|
+
declare const Polymorphic: <ElementProps>(props: PolymorphicAttributes<ValidComponent> & ElementProps) => JSX.Element;
|
|
18
|
+
|
|
19
|
+
type ElementOf<T> = T extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[T] : unknown;
|
|
20
|
+
|
|
21
|
+
type PolymorphicButtonSharedProps<T extends ValidComponent = "button"> = {
|
|
22
|
+
ref: Ref<ElementOf<T>>;
|
|
23
|
+
type: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
type PolymorphicButtonElementProps = PolymorphicButtonSharedProps & {
|
|
26
|
+
role: "button" | undefined;
|
|
27
|
+
};
|
|
28
|
+
type PolymorphicButtonProps<T extends ValidComponent = "button"> = Partial<PolymorphicButtonSharedProps<T>>;
|
|
29
|
+
/**
|
|
30
|
+
* An accessible button that sets `type` and `role` properly based on
|
|
31
|
+
* if it's a native button.
|
|
32
|
+
*/
|
|
33
|
+
declare const PolymorphicButton: <T extends ValidComponent = "button">(props: PolymorphicProps<T, PolymorphicButtonProps<T>>) => solid_js.JSX.Element;
|
|
34
|
+
|
|
35
|
+
export { Polymorphic, type PolymorphicAttributes, PolymorphicButton, type PolymorphicButtonElementProps, type PolymorphicButtonProps, type PolymorphicButtonSharedProps, type PolymorphicProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Polymorphic_default as Polymorphic, PolymorphicButton_default as PolymorphicButton } from '../../chunk/G6RG4LR7.js';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ComponentProps, JSX, 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 selectVariants: {
|
|
5
|
+
(props?: (ConfigVariants<{
|
|
6
|
+
size: {
|
|
7
|
+
sm: string;
|
|
8
|
+
md: string;
|
|
9
|
+
lg: string;
|
|
10
|
+
};
|
|
11
|
+
color: {
|
|
12
|
+
primary: string;
|
|
13
|
+
info: string;
|
|
14
|
+
success: string;
|
|
15
|
+
warning: string;
|
|
16
|
+
danger: string;
|
|
17
|
+
};
|
|
18
|
+
loading: {
|
|
19
|
+
true: string;
|
|
20
|
+
false: string;
|
|
21
|
+
};
|
|
22
|
+
expanded: {
|
|
23
|
+
true: string;
|
|
24
|
+
false: string;
|
|
25
|
+
};
|
|
26
|
+
rounded: {
|
|
27
|
+
true: string;
|
|
28
|
+
false: string;
|
|
29
|
+
};
|
|
30
|
+
}> & ClassProps) | undefined): string;
|
|
31
|
+
variantKeys: ("size" | "color" | "loading" | "expanded" | "rounded")[];
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type SelectProps = VariantProps<typeof selectVariants> & ClassProps & ComponentProps<"select"> & {
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
nativeSize?: string | number;
|
|
37
|
+
value?: string | number | null;
|
|
38
|
+
onChange?: JSX.EventHandlerUnion<HTMLSelectElement, Event>;
|
|
39
|
+
onFocus?: JSX.EventHandlerUnion<HTMLSelectElement, FocusEvent>;
|
|
40
|
+
onBlur?: JSX.EventHandlerUnion<HTMLSelectElement, FocusEvent>;
|
|
41
|
+
};
|
|
42
|
+
declare const Select: Component<SelectProps>;
|
|
43
|
+
|
|
44
|
+
export { type SelectProps, Select as default };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { cva, classes } from '../../chunk/HKS7ET6T.js';
|
|
2
|
+
import { template, spread, mergeProps, insert, createComponent, memo } from 'solid-js/web';
|
|
3
|
+
import { splitProps, createMemo, untrack, Show } from 'solid-js';
|
|
4
|
+
|
|
5
|
+
// src/components/select/Select.styles.ts
|
|
6
|
+
var selectVariants = cva(
|
|
7
|
+
[
|
|
8
|
+
"relative inline-flex items-center appearance-none",
|
|
9
|
+
"border outline-none",
|
|
10
|
+
"transition bg-white text-black",
|
|
11
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
12
|
+
],
|
|
13
|
+
{
|
|
14
|
+
variants: {
|
|
15
|
+
size: {
|
|
16
|
+
sm: "text-sm px-2 py-1",
|
|
17
|
+
md: "text-base px-3 py-2",
|
|
18
|
+
lg: "text-lg px-4 py-2"
|
|
19
|
+
},
|
|
20
|
+
color: {
|
|
21
|
+
primary: "border-gray-300 focus:border-primary",
|
|
22
|
+
info: "border-blue-300 focus:border-blue-500",
|
|
23
|
+
success: "border-green-300 focus:border-green-500",
|
|
24
|
+
warning: "border-yellow-300 focus:border-yellow-500",
|
|
25
|
+
danger: "border-red-300 focus:border-red-500"
|
|
26
|
+
},
|
|
27
|
+
loading: {
|
|
28
|
+
true: "cursor-wait opacity-75",
|
|
29
|
+
false: ""
|
|
30
|
+
},
|
|
31
|
+
expanded: {
|
|
32
|
+
true: "w-full",
|
|
33
|
+
false: "w-fit"
|
|
34
|
+
},
|
|
35
|
+
rounded: {
|
|
36
|
+
true: "rounded",
|
|
37
|
+
false: "rounded-none"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
size: "md",
|
|
42
|
+
color: "primary",
|
|
43
|
+
loading: false,
|
|
44
|
+
expanded: false,
|
|
45
|
+
rounded: false
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// src/components/select/Select.tsx
|
|
51
|
+
var _tmpl$ = /* @__PURE__ */ template(`<option value disabled hidden>`);
|
|
52
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<select>`);
|
|
53
|
+
var Select = (props) => {
|
|
54
|
+
const [localProps, variantProps, otherProps] = splitProps(props, ["placeholder", "value", "nativeSize", "onChange", "onBlur", "onFocus"], ["class", ...selectVariants.variantKeys]);
|
|
55
|
+
const empty = createMemo(() => untrack(() => localProps.value === null || localProps.value === void 0));
|
|
56
|
+
const selectClasses = createMemo(() => classes(selectVariants(variantProps), variantProps.class));
|
|
57
|
+
return (() => {
|
|
58
|
+
var _el$ = _tmpl$2();
|
|
59
|
+
spread(_el$, mergeProps({
|
|
60
|
+
get ["class"]() {
|
|
61
|
+
return selectClasses();
|
|
62
|
+
},
|
|
63
|
+
get size() {
|
|
64
|
+
return localProps.nativeSize;
|
|
65
|
+
},
|
|
66
|
+
get value() {
|
|
67
|
+
return localProps.value;
|
|
68
|
+
},
|
|
69
|
+
get onChange() {
|
|
70
|
+
return localProps.onChange;
|
|
71
|
+
},
|
|
72
|
+
get onFocus() {
|
|
73
|
+
return localProps.onFocus;
|
|
74
|
+
},
|
|
75
|
+
get onBlur() {
|
|
76
|
+
return localProps.onBlur;
|
|
77
|
+
}
|
|
78
|
+
}, otherProps), false, true);
|
|
79
|
+
insert(_el$, createComponent(Show, {
|
|
80
|
+
get when() {
|
|
81
|
+
return memo(() => !!localProps.placeholder)() && empty();
|
|
82
|
+
},
|
|
83
|
+
get children() {
|
|
84
|
+
var _el$2 = _tmpl$();
|
|
85
|
+
insert(_el$2, () => localProps.placeholder);
|
|
86
|
+
return _el$2;
|
|
87
|
+
}
|
|
88
|
+
}), null);
|
|
89
|
+
insert(_el$, () => props.children, null);
|
|
90
|
+
return _el$;
|
|
91
|
+
})();
|
|
92
|
+
};
|
|
93
|
+
var Select_default = Select;
|
|
94
|
+
|
|
95
|
+
// src/components/select/index.ts
|
|
96
|
+
var select_default = Select_default;
|
|
97
|
+
|
|
98
|
+
export { select_default as default };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
classes,
|
|
3
|
+
cva
|
|
4
|
+
} from "../../chunk/P7WPLZNA.jsx";
|
|
5
|
+
|
|
6
|
+
// src/components/select/Select.tsx
|
|
7
|
+
import {
|
|
8
|
+
splitProps,
|
|
9
|
+
Show,
|
|
10
|
+
createMemo,
|
|
11
|
+
untrack
|
|
12
|
+
} from "solid-js";
|
|
13
|
+
|
|
14
|
+
// src/components/select/Select.styles.ts
|
|
15
|
+
var selectVariants = cva(
|
|
16
|
+
[
|
|
17
|
+
"relative inline-flex items-center appearance-none",
|
|
18
|
+
"border outline-none",
|
|
19
|
+
"transition bg-white text-black",
|
|
20
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
21
|
+
],
|
|
22
|
+
{
|
|
23
|
+
variants: {
|
|
24
|
+
size: {
|
|
25
|
+
sm: "text-sm px-2 py-1",
|
|
26
|
+
md: "text-base px-3 py-2",
|
|
27
|
+
lg: "text-lg px-4 py-2"
|
|
28
|
+
},
|
|
29
|
+
color: {
|
|
30
|
+
primary: "border-gray-300 focus:border-primary",
|
|
31
|
+
info: "border-blue-300 focus:border-blue-500",
|
|
32
|
+
success: "border-green-300 focus:border-green-500",
|
|
33
|
+
warning: "border-yellow-300 focus:border-yellow-500",
|
|
34
|
+
danger: "border-red-300 focus:border-red-500"
|
|
35
|
+
},
|
|
36
|
+
loading: {
|
|
37
|
+
true: "cursor-wait opacity-75",
|
|
38
|
+
false: ""
|
|
39
|
+
},
|
|
40
|
+
expanded: {
|
|
41
|
+
true: "w-full",
|
|
42
|
+
false: "w-fit"
|
|
43
|
+
},
|
|
44
|
+
rounded: {
|
|
45
|
+
true: "rounded",
|
|
46
|
+
false: "rounded-none"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
defaultVariants: {
|
|
50
|
+
size: "md",
|
|
51
|
+
color: "primary",
|
|
52
|
+
loading: false,
|
|
53
|
+
expanded: false,
|
|
54
|
+
rounded: false
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
// src/components/select/Select.tsx
|
|
60
|
+
var Select = (props) => {
|
|
61
|
+
const [localProps, variantProps, otherProps] = splitProps(
|
|
62
|
+
props,
|
|
63
|
+
["placeholder", "value", "nativeSize", "onChange", "onBlur", "onFocus"],
|
|
64
|
+
["class", ...selectVariants.variantKeys]
|
|
65
|
+
);
|
|
66
|
+
const empty = createMemo(
|
|
67
|
+
() => untrack(() => localProps.value === null || localProps.value === void 0)
|
|
68
|
+
);
|
|
69
|
+
const selectClasses = createMemo(
|
|
70
|
+
() => classes(selectVariants(variantProps), variantProps.class)
|
|
71
|
+
);
|
|
72
|
+
return <select
|
|
73
|
+
class={selectClasses()}
|
|
74
|
+
size={localProps.nativeSize}
|
|
75
|
+
value={localProps.value}
|
|
76
|
+
onChange={localProps.onChange}
|
|
77
|
+
onFocus={localProps.onFocus}
|
|
78
|
+
onBlur={localProps.onBlur}
|
|
79
|
+
{...otherProps}
|
|
80
|
+
>
|
|
81
|
+
<Show when={localProps.placeholder && empty()}>
|
|
82
|
+
<option value="" disabled hidden>
|
|
83
|
+
{localProps.placeholder}
|
|
84
|
+
</option>
|
|
85
|
+
</Show>
|
|
86
|
+
{props.children}
|
|
87
|
+
</select>;
|
|
88
|
+
};
|
|
89
|
+
var Select_default = Select;
|
|
90
|
+
|
|
91
|
+
// src/components/select/index.ts
|
|
92
|
+
var select_default = Select_default;
|
|
93
|
+
export {
|
|
94
|
+
select_default as default
|
|
95
|
+
};
|