@pathscale/ui 1.1.12 → 1.1.14
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/components/pagination/Pagination.css +121 -0
- package/dist/components/pagination/Pagination.d.ts +8 -2
- package/dist/components/pagination/Pagination.js +113 -7
- package/dist/components/select/Select.css +244 -0
- package/dist/components/select/Select.d.ts +44 -13
- package/dist/components/select/Select.js +618 -41
- package/dist/components/select/index.d.ts +2 -1
- package/dist/components/streaming-table/StreamingTable.js +39 -92
- package/dist/components/table/EnhancedTable.d.ts +1 -1
- package/dist/components/table/EnhancedTable.js +131 -195
- package/dist/components/table/{table.css → Table.css} +138 -0
- package/dist/components/table/Table.d.ts +69 -7
- package/dist/components/table/Table.js +302 -28
- package/dist/components/table/hooks/helpers.d.ts +7 -0
- package/dist/components/table/hooks/helpers.js +26 -0
- package/dist/components/table/hooks/index.d.ts +9 -0
- package/dist/components/table/hooks/index.js +18 -0
- package/dist/components/table/hooks/useAnchoredOverlayPosition.d.ts +16 -0
- package/dist/components/table/hooks/useAnchoredOverlayPosition.js +61 -0
- package/dist/components/table/hooks/useTableExpansion.d.ts +13 -0
- package/dist/components/table/hooks/useTableExpansion.js +17 -0
- package/dist/components/table/hooks/useTableFiltering.d.ts +30 -0
- package/dist/components/table/hooks/useTableFiltering.js +67 -0
- package/dist/components/table/hooks/useTableModel.d.ts +27 -0
- package/dist/components/table/hooks/useTableModel.js +56 -0
- package/dist/components/table/hooks/useTablePagination.d.ts +20 -0
- package/dist/components/table/hooks/useTablePagination.js +48 -0
- package/dist/components/table/hooks/useTableSelection.d.ts +14 -0
- package/dist/components/table/hooks/useTableSelection.js +17 -0
- package/dist/components/table/hooks/useTableSorting.d.ts +19 -0
- package/dist/components/table/hooks/useTableSorting.js +21 -0
- package/dist/components/table/index.d.ts +4 -1
- package/dist/components/table/index.js +26 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +10 -1
- package/package.json +1 -1
- package/dist/components/select/select.css +0 -351
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.pagination {
|
|
3
|
+
display: flex;
|
|
4
|
+
width: 100%;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
gap: 1rem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@media (min-width: 640px) {
|
|
12
|
+
.pagination {
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.pagination__summary {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: 0.5rem;
|
|
21
|
+
align-self: flex-start;
|
|
22
|
+
font-size: 0.875rem;
|
|
23
|
+
opacity: 0.7;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@media (min-width: 640px) {
|
|
27
|
+
.pagination__summary {
|
|
28
|
+
align-self: center;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.pagination__content {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
gap: 0.25rem;
|
|
36
|
+
align-self: flex-start;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@media (min-width: 640px) {
|
|
40
|
+
.pagination__content {
|
|
41
|
+
align-self: center;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.pagination__item {
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.pagination__link {
|
|
50
|
+
position: relative;
|
|
51
|
+
isolation: isolate;
|
|
52
|
+
display: inline-flex;
|
|
53
|
+
height: 2.25rem;
|
|
54
|
+
width: 2.25rem;
|
|
55
|
+
transform-origin: center;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
border-radius: 9999px;
|
|
59
|
+
border: 0;
|
|
60
|
+
background-color: transparent;
|
|
61
|
+
color: var(--color-base-content);
|
|
62
|
+
font-size: 0.875rem;
|
|
63
|
+
font-weight: 500;
|
|
64
|
+
white-space: nowrap;
|
|
65
|
+
outline: none;
|
|
66
|
+
user-select: none;
|
|
67
|
+
cursor: pointer;
|
|
68
|
+
transition:
|
|
69
|
+
transform 250ms var(--ease-smooth, cubic-bezier(0.22, 1, 0.36, 1)),
|
|
70
|
+
background-color 100ms ease-out,
|
|
71
|
+
box-shadow 100ms ease-out;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.pagination__link:focus-visible,
|
|
75
|
+
.pagination__link[data-focus-visible="true"] {
|
|
76
|
+
outline: none;
|
|
77
|
+
box-shadow: 0 0 0 2px var(--color-focus, var(--color-accent));
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.pagination__link:disabled,
|
|
81
|
+
.pagination__link[aria-disabled="true"] {
|
|
82
|
+
opacity: 0.5;
|
|
83
|
+
cursor: not-allowed;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@media (hover: hover) {
|
|
87
|
+
.pagination__link:hover:not(:disabled),
|
|
88
|
+
.pagination__link[data-hovered="true"]:not(:disabled) {
|
|
89
|
+
background-color: var(--color-base-200);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.pagination__link:active:not(:disabled),
|
|
94
|
+
.pagination__link[data-pressed="true"]:not(:disabled) {
|
|
95
|
+
background-color: var(--color-base-300);
|
|
96
|
+
transform: scale(0.97);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.pagination__link[data-active="true"] {
|
|
100
|
+
background-color: var(--color-base-300);
|
|
101
|
+
color: var(--color-base-content);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.pagination__ellipsis {
|
|
105
|
+
display: inline-flex;
|
|
106
|
+
height: 2.25rem;
|
|
107
|
+
width: 2.25rem;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
font-size: 0.875rem;
|
|
111
|
+
opacity: 0.65;
|
|
112
|
+
user-select: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.pagination__link--nav {
|
|
116
|
+
width: auto;
|
|
117
|
+
gap: 0.375rem;
|
|
118
|
+
padding-inline: 0.625rem;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
import "./Pagination.css";
|
|
1
2
|
import { type JSX } from "solid-js";
|
|
2
|
-
import {
|
|
3
|
-
export type PaginationProps =
|
|
3
|
+
import type { IComponentBaseProps } from "../types";
|
|
4
|
+
export type PaginationProps = Omit<JSX.HTMLAttributes<HTMLElement>, "onChange"> & IComponentBaseProps & {
|
|
5
|
+
page: number;
|
|
6
|
+
total: number;
|
|
7
|
+
onChange: (page: number) => void;
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
};
|
|
4
10
|
declare const Pagination: (props: PaginationProps) => JSX.Element;
|
|
5
11
|
export default Pagination;
|
|
@@ -1,17 +1,123 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__ from "solid-js/web";
|
|
2
|
+
import "./Pagination.css";
|
|
2
3
|
import * as __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__ from "solid-js";
|
|
3
4
|
import * as __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__ from "tailwind-merge";
|
|
4
|
-
|
|
5
|
+
var _tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)(`<nav><div class=pagination__summary data-slot=pagination-summary>Page <!> of </div><ul class=pagination__content data-slot=pagination-content><li class=pagination__item data-slot=pagination-item><button type=button class="pagination__link pagination__link--nav"data-slot=pagination-previous aria-label="Go to previous page"><span aria-hidden=true>\u{2039}</span><span>Previous</span></button></li><li class=pagination__item data-slot=pagination-item><button type=button class="pagination__link pagination__link--nav"data-slot=pagination-next aria-label="Go to next page"><span>Next</span><span aria-hidden=true>\u{203A}`), _tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<li class=pagination__item data-slot=pagination-item>"), _tmpl$3 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)("<button type=button class=pagination__link data-slot=pagination-link>"), _tmpl$4 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)(`<span class=pagination__ellipsis data-slot=pagination-ellipsis aria-hidden=true>\u{2026}`);
|
|
6
|
+
const clampPage = (page, total)=>{
|
|
7
|
+
if (!Number.isFinite(page)) return 1;
|
|
8
|
+
return Math.min(Math.max(1, Math.floor(page)), total);
|
|
9
|
+
};
|
|
10
|
+
const getPaginationTokens = (page, total)=>{
|
|
11
|
+
if (total <= 0) return [];
|
|
12
|
+
if (total <= 7) return Array.from({
|
|
13
|
+
length: total
|
|
14
|
+
}, (_, index)=>index + 1);
|
|
15
|
+
if (page <= 4) return [
|
|
16
|
+
1,
|
|
17
|
+
2,
|
|
18
|
+
3,
|
|
19
|
+
4,
|
|
20
|
+
5,
|
|
21
|
+
"ellipsis-right",
|
|
22
|
+
total
|
|
23
|
+
];
|
|
24
|
+
if (page >= total - 3) return [
|
|
25
|
+
1,
|
|
26
|
+
"ellipsis-left",
|
|
27
|
+
total - 4,
|
|
28
|
+
total - 3,
|
|
29
|
+
total - 2,
|
|
30
|
+
total - 1,
|
|
31
|
+
total
|
|
32
|
+
];
|
|
33
|
+
return [
|
|
34
|
+
1,
|
|
35
|
+
"ellipsis-left",
|
|
36
|
+
page - 1,
|
|
37
|
+
page,
|
|
38
|
+
page + 1,
|
|
39
|
+
"ellipsis-right",
|
|
40
|
+
total
|
|
41
|
+
];
|
|
42
|
+
};
|
|
5
43
|
const Pagination = (props)=>{
|
|
6
44
|
const [local, others] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
|
|
7
45
|
"class",
|
|
8
|
-
"className"
|
|
46
|
+
"className",
|
|
47
|
+
"dataTheme",
|
|
48
|
+
"page",
|
|
49
|
+
"total",
|
|
50
|
+
"onChange",
|
|
51
|
+
"isDisabled"
|
|
9
52
|
]);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
53
|
+
const safeTotal = ()=>Math.max(1, Math.floor(local.total || 0));
|
|
54
|
+
const currentPage = ()=>clampPage(local.page, safeTotal());
|
|
55
|
+
const tokens = ()=>getPaginationTokens(currentPage(), safeTotal());
|
|
56
|
+
const disabled = ()=>Boolean(local.isDisabled);
|
|
57
|
+
const handleChange = (nextPage)=>{
|
|
58
|
+
if (disabled()) return;
|
|
59
|
+
const bounded = clampPage(nextPage, safeTotal());
|
|
60
|
+
if (bounded === currentPage()) return;
|
|
61
|
+
local.onChange(bounded);
|
|
62
|
+
};
|
|
63
|
+
return (()=>{
|
|
64
|
+
var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$5 = _el$3.nextSibling, _el$6 = (_el$5.nextSibling, _el$2.nextSibling), _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$7.nextSibling, _el$0 = _el$9.firstChild;
|
|
65
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.spread)(_el$, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)(others, {
|
|
66
|
+
"aria-label": "pagination",
|
|
67
|
+
role: "navigation",
|
|
68
|
+
get ["class"] () {
|
|
69
|
+
return (0, __WEBPACK_EXTERNAL_MODULE_tailwind_merge_e05e3e95__.twMerge)("pagination", local.class, local.className);
|
|
70
|
+
},
|
|
71
|
+
get ["data-theme"] () {
|
|
72
|
+
return local.dataTheme;
|
|
73
|
+
},
|
|
74
|
+
"data-slot": "pagination"
|
|
75
|
+
}), false, true);
|
|
76
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$2, currentPage, _el$5);
|
|
77
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$2, safeTotal, null);
|
|
78
|
+
_el$8.$$click = ()=>handleChange(currentPage() - 1);
|
|
79
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$6, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.For, {
|
|
80
|
+
get each () {
|
|
81
|
+
return tokens();
|
|
82
|
+
},
|
|
83
|
+
children: (token)=>(()=>{
|
|
84
|
+
var _el$1 = _tmpl$2();
|
|
85
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$1, "number" == typeof token ? (()=>{
|
|
86
|
+
var _el$10 = _tmpl$3();
|
|
87
|
+
_el$10.$$click = ()=>handleChange(token);
|
|
88
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$10, "aria-label", `Go to page ${token}`);
|
|
89
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$10, token);
|
|
90
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.effect)((_p$)=>{
|
|
91
|
+
var _v$3 = token === currentPage() ? "true" : void 0, _v$4 = token === currentPage() ? "page" : void 0, _v$5 = disabled();
|
|
92
|
+
_v$3 !== _p$.e && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$10, "data-active", _p$.e = _v$3);
|
|
93
|
+
_v$4 !== _p$.t && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.setAttribute)(_el$10, "aria-current", _p$.t = _v$4);
|
|
94
|
+
_v$5 !== _p$.a && (_el$10.disabled = _p$.a = _v$5);
|
|
95
|
+
return _p$;
|
|
96
|
+
}, {
|
|
97
|
+
e: void 0,
|
|
98
|
+
t: void 0,
|
|
99
|
+
a: void 0
|
|
100
|
+
});
|
|
101
|
+
return _el$10;
|
|
102
|
+
})() : _tmpl$4());
|
|
103
|
+
return _el$1;
|
|
104
|
+
})()
|
|
105
|
+
}), _el$9);
|
|
106
|
+
_el$0.$$click = ()=>handleChange(currentPage() + 1);
|
|
107
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.effect)((_p$)=>{
|
|
108
|
+
var _v$ = disabled() || currentPage() <= 1, _v$2 = disabled() || currentPage() >= safeTotal();
|
|
109
|
+
_v$ !== _p$.e && (_el$8.disabled = _p$.e = _v$);
|
|
110
|
+
_v$2 !== _p$.t && (_el$0.disabled = _p$.t = _v$2);
|
|
111
|
+
return _p$;
|
|
112
|
+
}, {
|
|
113
|
+
e: void 0,
|
|
114
|
+
t: void 0
|
|
115
|
+
});
|
|
116
|
+
return _el$;
|
|
117
|
+
})();
|
|
15
118
|
};
|
|
16
119
|
const pagination_Pagination = Pagination;
|
|
120
|
+
(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.delegateEvents)([
|
|
121
|
+
"click"
|
|
122
|
+
]);
|
|
17
123
|
export { pagination_Pagination as default };
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ui-select {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: 0.25rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ui-select--full-width {
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ui-select__trigger {
|
|
14
|
+
position: relative;
|
|
15
|
+
isolation: isolate;
|
|
16
|
+
display: inline-flex;
|
|
17
|
+
min-height: 2.25rem;
|
|
18
|
+
width: fit-content;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: space-between;
|
|
21
|
+
gap: 0.5rem;
|
|
22
|
+
border-radius: 1rem;
|
|
23
|
+
border: 1px solid var(--color-field-border, var(--color-base-300));
|
|
24
|
+
background-color: var(--color-field, var(--color-base-100));
|
|
25
|
+
padding: 0.5rem 0.75rem;
|
|
26
|
+
text-align: left;
|
|
27
|
+
font-size: 0.875rem;
|
|
28
|
+
line-height: 1.25;
|
|
29
|
+
color: var(--color-field-foreground, var(--color-base-content));
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
user-select: none;
|
|
32
|
+
outline: none;
|
|
33
|
+
box-shadow:
|
|
34
|
+
0 1px 2px oklch(0% 0 0 / 0.06),
|
|
35
|
+
0 1px 0 oklch(100% 0 0 / 0.04) inset;
|
|
36
|
+
transition:
|
|
37
|
+
background-color 150ms ease,
|
|
38
|
+
border-color 150ms ease,
|
|
39
|
+
box-shadow 150ms ease,
|
|
40
|
+
transform 150ms ease,
|
|
41
|
+
color 150ms ease;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ui-select__trigger--full-width {
|
|
45
|
+
width: 100%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@media (hover: hover) {
|
|
49
|
+
.ui-select__trigger:hover:not(:disabled) {
|
|
50
|
+
background-color: var(--color-base-200);
|
|
51
|
+
border-color: color-mix(in oklch, var(--color-base-content) 10%, transparent);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.ui-select__trigger:focus-visible,
|
|
56
|
+
.ui-select__trigger[data-focus-visible="true"] {
|
|
57
|
+
outline: 2px solid var(--color-accent);
|
|
58
|
+
outline-offset: 2px;
|
|
59
|
+
border-color: var(--color-accent);
|
|
60
|
+
background-color: color-mix(in oklch, var(--color-accent) 8%, var(--color-base-100));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.ui-select__trigger:active:not(:disabled) {
|
|
64
|
+
transform: scale(0.99);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.ui-select__trigger:disabled,
|
|
68
|
+
.ui-select[data-disabled="true"] .ui-select__trigger,
|
|
69
|
+
.ui-select__trigger[aria-disabled="true"] {
|
|
70
|
+
cursor: not-allowed;
|
|
71
|
+
opacity: 0.55;
|
|
72
|
+
background-color: var(--color-base-200);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ui-select--secondary .ui-select__trigger {
|
|
76
|
+
border-color: transparent;
|
|
77
|
+
background-color: var(--color-base-200);
|
|
78
|
+
box-shadow: none;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@media (hover: hover) {
|
|
82
|
+
.ui-select--secondary .ui-select__trigger:hover:not(:disabled) {
|
|
83
|
+
background-color: var(--color-base-300);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ui-select__value {
|
|
88
|
+
flex: 1;
|
|
89
|
+
min-width: 0;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
text-overflow: ellipsis;
|
|
92
|
+
white-space: nowrap;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.ui-select__value[data-placeholder="true"] {
|
|
96
|
+
color: color-mix(in oklch, var(--color-base-content) 42%, transparent);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.ui-select__indicator {
|
|
100
|
+
display: inline-flex;
|
|
101
|
+
width: 1rem;
|
|
102
|
+
height: 1rem;
|
|
103
|
+
flex-shrink: 0;
|
|
104
|
+
align-items: center;
|
|
105
|
+
justify-content: center;
|
|
106
|
+
color: color-mix(in oklch, var(--color-base-content) 55%, transparent);
|
|
107
|
+
transition:
|
|
108
|
+
transform 150ms ease,
|
|
109
|
+
color 150ms ease;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.ui-select__indicator svg {
|
|
113
|
+
width: 100%;
|
|
114
|
+
height: 100%;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.ui-select__indicator[data-open="true"] {
|
|
118
|
+
transform: rotate(180deg);
|
|
119
|
+
color: var(--color-base-content);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.ui-select__popover {
|
|
123
|
+
display: none;
|
|
124
|
+
position: absolute;
|
|
125
|
+
z-index: 80;
|
|
126
|
+
top: calc(100% + 0.375rem);
|
|
127
|
+
inset-inline-start: 0;
|
|
128
|
+
min-width: max(100%, 14rem);
|
|
129
|
+
max-width: min(30rem, calc(100vw - 2rem));
|
|
130
|
+
max-height: min(24rem, 70vh);
|
|
131
|
+
overflow-y: auto;
|
|
132
|
+
overscroll-behavior: contain;
|
|
133
|
+
border-radius: 1.5rem;
|
|
134
|
+
border: 1px solid color-mix(in oklch, var(--color-base-content) 8%, transparent);
|
|
135
|
+
background-color: var(--color-base-100);
|
|
136
|
+
box-shadow:
|
|
137
|
+
0 20px 32px oklch(0% 0 0 / 0.16),
|
|
138
|
+
0 8px 18px oklch(0% 0 0 / 0.1);
|
|
139
|
+
visibility: hidden;
|
|
140
|
+
opacity: 0;
|
|
141
|
+
transform: translateY(-4px) scale(0.98);
|
|
142
|
+
transform-origin: top;
|
|
143
|
+
pointer-events: none;
|
|
144
|
+
transition:
|
|
145
|
+
opacity 150ms cubic-bezier(0.22, 1, 0.36, 1),
|
|
146
|
+
transform 150ms cubic-bezier(0.22, 1, 0.36, 1),
|
|
147
|
+
visibility 150ms ease;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.ui-select__popover[data-open="true"] {
|
|
151
|
+
display: block;
|
|
152
|
+
visibility: visible;
|
|
153
|
+
opacity: 1;
|
|
154
|
+
transform: translateY(0) scale(1);
|
|
155
|
+
pointer-events: auto;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.ui-select__listbox {
|
|
159
|
+
display: flex;
|
|
160
|
+
flex-direction: column;
|
|
161
|
+
gap: 0.125rem;
|
|
162
|
+
padding: 0.375rem;
|
|
163
|
+
outline: none;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.ui-select__option {
|
|
167
|
+
display: flex;
|
|
168
|
+
min-height: 2.25rem;
|
|
169
|
+
width: 100%;
|
|
170
|
+
align-items: center;
|
|
171
|
+
justify-content: space-between;
|
|
172
|
+
gap: 0.75rem;
|
|
173
|
+
border: 0;
|
|
174
|
+
border-radius: 1rem;
|
|
175
|
+
background: transparent;
|
|
176
|
+
padding: 0.5rem 0.625rem;
|
|
177
|
+
text-align: start;
|
|
178
|
+
font-size: 0.875rem;
|
|
179
|
+
line-height: 1.2;
|
|
180
|
+
color: var(--color-base-content);
|
|
181
|
+
cursor: pointer;
|
|
182
|
+
outline: none;
|
|
183
|
+
transition:
|
|
184
|
+
background-color 150ms ease,
|
|
185
|
+
color 120ms ease,
|
|
186
|
+
transform 150ms ease,
|
|
187
|
+
opacity 120ms ease;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.ui-select__option-label {
|
|
191
|
+
min-width: 0;
|
|
192
|
+
flex: 1;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.ui-select__option-indicator {
|
|
196
|
+
display: inline-flex;
|
|
197
|
+
width: 1rem;
|
|
198
|
+
height: 1rem;
|
|
199
|
+
flex-shrink: 0;
|
|
200
|
+
align-items: center;
|
|
201
|
+
justify-content: center;
|
|
202
|
+
opacity: 0;
|
|
203
|
+
transform: scale(0.85);
|
|
204
|
+
transition:
|
|
205
|
+
opacity 120ms ease,
|
|
206
|
+
transform 150ms ease;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.ui-select__option-indicator svg {
|
|
210
|
+
width: 100%;
|
|
211
|
+
height: 100%;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.ui-select__option[data-selected="true"] .ui-select__option-indicator {
|
|
215
|
+
opacity: 1;
|
|
216
|
+
transform: scale(1);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.ui-select__option[data-focused="true"],
|
|
220
|
+
.ui-select__option:focus-visible {
|
|
221
|
+
background-color: var(--color-base-200);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@media (hover: hover) {
|
|
225
|
+
.ui-select__option:hover:not(:disabled):not([data-disabled="true"]) {
|
|
226
|
+
background-color: var(--color-base-200);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.ui-select__option:active:not(:disabled):not([data-disabled="true"]) {
|
|
231
|
+
transform: scale(0.99);
|
|
232
|
+
background-color: var(--color-base-300);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.ui-select__option[data-selected="true"] {
|
|
236
|
+
color: var(--color-base-content);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.ui-select__option:disabled,
|
|
240
|
+
.ui-select__option[data-disabled="true"] {
|
|
241
|
+
cursor: not-allowed;
|
|
242
|
+
opacity: 0.45;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
@@ -1,16 +1,47 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { type
|
|
3
|
-
import type {
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
style?: JSX.CSSProperties;
|
|
1
|
+
import "./Select.css";
|
|
2
|
+
import { type Component, type JSX } from "solid-js";
|
|
3
|
+
import type { IComponentBaseProps } from "../types";
|
|
4
|
+
type SelectKey = string | number;
|
|
5
|
+
export type SelectValueType = SelectKey | SelectKey[] | null;
|
|
6
|
+
export type SelectVariant = "primary" | "secondary";
|
|
7
|
+
export type SelectSelectionMode = "single" | "multiple";
|
|
8
|
+
export type SelectRootProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, "onChange"> & IComponentBaseProps & {
|
|
9
|
+
children: JSX.Element;
|
|
11
10
|
placeholder?: string;
|
|
12
|
-
value?:
|
|
11
|
+
value?: SelectValueType;
|
|
12
|
+
defaultValue?: SelectValueType;
|
|
13
|
+
selectedKeys?: Iterable<SelectKey>;
|
|
14
|
+
defaultSelectedKeys?: Iterable<SelectKey>;
|
|
15
|
+
onChange?: (value: string | string[] | null) => void;
|
|
16
|
+
onSelectionChange?: (keys: Set<string>) => void;
|
|
17
|
+
isDisabled?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
fullWidth?: boolean;
|
|
20
|
+
variant?: SelectVariant;
|
|
21
|
+
selectionMode?: SelectSelectionMode;
|
|
22
|
+
isOpen?: boolean;
|
|
23
|
+
defaultOpen?: boolean;
|
|
24
|
+
onOpenChange?: (open: boolean) => void;
|
|
13
25
|
};
|
|
14
|
-
export type
|
|
15
|
-
|
|
26
|
+
export type SelectTriggerProps = JSX.ButtonHTMLAttributes<HTMLButtonElement> & IComponentBaseProps;
|
|
27
|
+
export type SelectValueProps = JSX.HTMLAttributes<HTMLSpanElement> & IComponentBaseProps;
|
|
28
|
+
export type SelectIndicatorProps = JSX.HTMLAttributes<HTMLSpanElement> & IComponentBaseProps;
|
|
29
|
+
export type SelectPopoverProps = JSX.HTMLAttributes<HTMLDivElement> & IComponentBaseProps;
|
|
30
|
+
export type SelectListboxProps = JSX.HTMLAttributes<HTMLDivElement> & IComponentBaseProps;
|
|
31
|
+
export type SelectOptionProps = Omit<JSX.ButtonHTMLAttributes<HTMLButtonElement>, "value"> & IComponentBaseProps & {
|
|
32
|
+
value: SelectKey;
|
|
33
|
+
textValue?: string;
|
|
34
|
+
isDisabled?: boolean;
|
|
35
|
+
};
|
|
36
|
+
export type SelectProps = SelectRootProps;
|
|
37
|
+
type SelectComponent = Component<SelectRootProps> & {
|
|
38
|
+
Root: Component<SelectRootProps>;
|
|
39
|
+
Trigger: Component<SelectTriggerProps>;
|
|
40
|
+
Value: Component<SelectValueProps>;
|
|
41
|
+
Indicator: Component<SelectIndicatorProps>;
|
|
42
|
+
Popover: Component<SelectPopoverProps>;
|
|
43
|
+
Listbox: Component<SelectListboxProps>;
|
|
44
|
+
Option: Component<SelectOptionProps>;
|
|
45
|
+
};
|
|
46
|
+
declare const Select: SelectComponent;
|
|
16
47
|
export default Select;
|