@mohasinac/appkit 3.2.0 → 3.2.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/dist/_internal/server/features/products/data.js +5 -1
- package/dist/features/layout/AppLayoutShell.js +1 -1
- package/dist/features/products/components/ProductGrid.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/seed/categories-seed-data.d.ts +1 -0
- package/dist/seed/categories-seed-data.js +6 -0
- package/dist/seed/index.d.ts +1 -1
- package/dist/seed/index.js +1 -1
- package/dist/seed/orders-seed-data.js +8 -8
- package/dist/seed/products-standard-seed-data.js +15 -15
- package/dist/styles.css +9 -1
- package/dist/tailwind-utilities.css +1 -1
- package/dist/ui/components/PaginatedSelect.js +10 -1
- package/dist/ui/components/PaginatedSelect.style.css +8 -0
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ const C = {
|
|
|
17
17
|
placeholder: "appkit-ps__placeholder",
|
|
18
18
|
triggerLeft: "appkit-ps__trigger-left",
|
|
19
19
|
dropdown: "appkit-ps__dropdown",
|
|
20
|
+
dropdownUp: "appkit-ps__dropdown--up",
|
|
20
21
|
search: "appkit-ps__search",
|
|
21
22
|
list: "appkit-ps__list",
|
|
22
23
|
option: "appkit-ps__option",
|
|
@@ -55,6 +56,7 @@ export function PaginatedSelect(props) {
|
|
|
55
56
|
const maxChipsVisible = isMulti ? props.maxChipsVisible ?? 3 : 0;
|
|
56
57
|
const [query, setQuery] = useState("");
|
|
57
58
|
const [open, setOpen] = useState(false);
|
|
59
|
+
const [opensUp, setOpensUp] = useState(false);
|
|
58
60
|
const [asyncOptions, setAsyncOptions] = useState([]);
|
|
59
61
|
const [page, setPage] = useState(1);
|
|
60
62
|
const [hasMore, setHasMore] = useState(false);
|
|
@@ -88,6 +90,13 @@ export function PaginatedSelect(props) {
|
|
|
88
90
|
return;
|
|
89
91
|
void load(query, 1, true);
|
|
90
92
|
}, [open, query, load, loadOptions]);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (!open || !containerRef.current)
|
|
95
|
+
return;
|
|
96
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
97
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
98
|
+
setOpensUp(spaceBelow < 220 && rect.top > 220);
|
|
99
|
+
}, [open]);
|
|
91
100
|
useEffect(() => {
|
|
92
101
|
const onClickOutside = (e) => {
|
|
93
102
|
if (!containerRef.current?.contains(e.target))
|
|
@@ -182,7 +191,7 @@ export function PaginatedSelect(props) {
|
|
|
182
191
|
removeChip(v);
|
|
183
192
|
}, children: "\u2715" }))] }, String(v)))), overflowCount > 0 && (_jsxs("span", { className: C.overflowChip, children: ["+", overflowCount, " more"] }))] })), _jsxs("button", { type: "button", disabled: disabled, onClick: () => setOpen((prev) => !prev), className: [C.trigger, disabled ? C.triggerDisabled : ""]
|
|
184
193
|
.filter(Boolean)
|
|
185
|
-
.join(" "), "aria-expanded": open, "aria-haspopup": "listbox", children: [_jsx("span", { className: C.triggerLeft, children: _jsx("span", { className: triggerEmpty ? C.placeholder : "", children: triggerLabel }) }), _jsx("span", { "aria-hidden": "true", children: "\u25BE" })] }), open && (_jsxs("div", { className: C.dropdown, role: "listbox", "aria-multiselectable": isMulti || undefined, children: [_jsx(Input, { autoFocus: true, value: query, onChange: (e) => setQuery(e.target.value), placeholder: searchPlaceholder, className: C.search }), _jsxs("ul", { className: C.list, children: [filtered.map((opt, idx) => {
|
|
194
|
+
.join(" "), "aria-expanded": open, "aria-haspopup": "listbox", children: [_jsx("span", { className: C.triggerLeft, children: _jsx("span", { className: triggerEmpty ? C.placeholder : "", children: triggerLabel }) }), _jsx("span", { "aria-hidden": "true", children: "\u25BE" })] }), open && (_jsxs("div", { className: [C.dropdown, opensUp ? C.dropdownUp : ""].filter(Boolean).join(" "), role: "listbox", "aria-multiselectable": isMulti || undefined, children: [_jsx(Input, { autoFocus: true, value: query, onChange: (e) => setQuery(e.target.value), placeholder: searchPlaceholder, className: C.search }), _jsxs("ul", { className: C.list, children: [filtered.map((opt, idx) => {
|
|
186
195
|
const selected = isSelected(opt.value);
|
|
187
196
|
return (_jsx("li", { children: _jsxs("button", { type: "button", role: "option", "aria-selected": selected, className: [C.option, selected ? C.optionSelected : ""]
|
|
188
197
|
.filter(Boolean)
|
|
@@ -120,6 +120,7 @@
|
|
|
120
120
|
margin-top: 0.25rem;
|
|
121
121
|
width: 100%;
|
|
122
122
|
min-width: 14rem;
|
|
123
|
+
max-width: calc(100vw - 2rem);
|
|
123
124
|
overflow: hidden;
|
|
124
125
|
border-radius: 0.5rem;
|
|
125
126
|
border: 1px solid var(--appkit-color-border);
|
|
@@ -127,6 +128,13 @@
|
|
|
127
128
|
box-shadow: var(--appkit-shadow-lg);
|
|
128
129
|
}
|
|
129
130
|
|
|
131
|
+
.appkit-ps__dropdown--up {
|
|
132
|
+
top: auto;
|
|
133
|
+
bottom: 100%;
|
|
134
|
+
margin-top: 0;
|
|
135
|
+
margin-bottom: 0.25rem;
|
|
136
|
+
}
|
|
137
|
+
|
|
130
138
|
:is(.dark) .appkit-ps__dropdown {
|
|
131
139
|
border-color: var(--appkit-color-border);
|
|
132
140
|
background: var(--appkit-color-surface);
|