@prokodo/ui 0.1.12 → 0.1.13
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/README.md +4 -1
- package/dist/components/accordion/Accordion.css +46 -0
- package/dist/components/accordion/Accordion.module.css +46 -0
- package/dist/components/accordion/Accordion.module.scss.js +4 -0
- package/dist/components/accordion/Accordion.view.js +25 -5
- package/dist/components/autocomplete/Autocomplete.client.js +132 -0
- package/dist/components/autocomplete/Autocomplete.css +317 -0
- package/dist/components/autocomplete/Autocomplete.js +12 -0
- package/dist/components/autocomplete/Autocomplete.lazy.js +12 -0
- package/dist/components/autocomplete/Autocomplete.module.css +317 -0
- package/dist/components/autocomplete/Autocomplete.module.scss.js +21 -0
- package/dist/components/autocomplete/Autocomplete.server.js +11 -0
- package/dist/components/autocomplete/Autocomplete.view.js +142 -0
- package/dist/components/autocomplete/index.js +4 -0
- package/dist/components/dynamic-list/DynamicList.view.js +1 -1
- package/dist/components/input/Input.css +2 -2
- package/dist/components/input/Input.module.css +2 -2
- package/dist/components/rich-text/RichText.css +0 -1
- package/dist/components/rich-text/RichText.module.css +0 -1
- package/dist/components/tabs/Tabs.client.js +182 -0
- package/dist/components/tabs/Tabs.css +330 -0
- package/dist/components/tabs/Tabs.js +13 -0
- package/dist/components/tabs/Tabs.lazy.js +15 -0
- package/dist/components/tabs/Tabs.module.css +330 -0
- package/dist/components/tabs/Tabs.module.scss.js +19 -0
- package/dist/components/tabs/Tabs.server.js +11 -0
- package/dist/components/tabs/Tabs.view.js +157 -0
- package/dist/components/tabs/index.js +4 -0
- package/dist/components/tooltip/Tooltip.client.js +10 -1
- package/dist/components/tooltip/Tooltip.css +1 -0
- package/dist/components/tooltip/Tooltip.module.css +1 -0
- package/dist/constants/project.js +1 -1
- package/dist/index.js +4 -0
- package/dist/theme.css +445 -3
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/accordion/Accordion.d.ts +3 -0
- package/dist/types/components/accordion/Accordion.lazy.d.ts +3 -0
- package/dist/types/components/accordion/Accordion.model.d.ts +3 -0
- package/dist/types/components/accordion/Accordion.view.d.ts +1 -1
- package/dist/types/components/autocomplete/Autocomplete.client.d.ts +5 -0
- package/dist/types/components/autocomplete/Autocomplete.d.ts +4 -0
- package/dist/types/components/autocomplete/Autocomplete.lazy.d.ts +5 -0
- package/dist/types/components/autocomplete/Autocomplete.model.d.ts +58 -0
- package/dist/types/components/autocomplete/Autocomplete.server.d.ts +3 -0
- package/dist/types/components/autocomplete/Autocomplete.view.d.ts +3 -0
- package/dist/types/components/autocomplete/index.d.ts +2 -0
- package/dist/types/components/tabs/Tabs.client.d.ts +5 -0
- package/dist/types/components/tabs/Tabs.d.ts +4 -0
- package/dist/types/components/tabs/Tabs.lazy.d.ts +5 -0
- package/dist/types/components/tabs/Tabs.model.d.ts +43 -0
- package/dist/types/components/tabs/Tabs.server.d.ts +3 -0
- package/dist/types/components/tabs/Tabs.view.d.ts +3 -0
- package/dist/types/components/tabs/index.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +11 -1
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
- ✨ **Adaptive Island Components (AIC)**: A rendering strategy where each component loads only the JavaScript it needs — when needed.
|
|
43
43
|
- ⚡️ **Modern stack**: Vite, React 19, TypeScript, and SCSS Modules
|
|
44
44
|
- 💅 **Design consistency**: Theming via design tokens and BEM-style naming
|
|
45
|
-
- 🧩 **Component-rich**:
|
|
45
|
+
- 🧩 **Component-rich**: 50+ reusable UI components
|
|
46
46
|
- 🧪 **Reliable**: Fully tested with Jest and Testing Library
|
|
47
47
|
- 📚 **Storybook**: Explore the components at [ui.prokodo.com](https://ui.prokodo.com)
|
|
48
48
|
- 📦 **Ready-to-install**: Distributed via npm for non-production use under the BUSL-1.1 license
|
|
@@ -161,6 +161,7 @@ export default function GalleryPage() {
|
|
|
161
161
|
| Accordion | ✅ | ✅ |
|
|
162
162
|
| Animated | ✅ | ✅ |
|
|
163
163
|
| AnimatedText | ✅ | ✅ |
|
|
164
|
+
| Autocomplete | ✅ | ✅ |
|
|
164
165
|
| Avatar | ✅ | ✅ |
|
|
165
166
|
| BaseLink | ✅ | ✅ |
|
|
166
167
|
| Button | ✅ | ✅ |
|
|
@@ -204,6 +205,7 @@ export default function GalleryPage() {
|
|
|
204
205
|
| Stepper | ✅ | ✅ |
|
|
205
206
|
| Switch | ✅ | ✅ |
|
|
206
207
|
| Table | ✅ | – |
|
|
208
|
+
| Tabs | ✅ | ✅ |
|
|
207
209
|
| Teaser | ✅ | - |
|
|
208
210
|
| Tooltip | ✅ | ✅ |
|
|
209
211
|
|
|
@@ -335,6 +337,7 @@ export default createLazyWrapper<NavbarProps>({
|
|
|
335
337
|
- [ ] Add more ✨ **fancy styling**, UI polish and properties
|
|
336
338
|
- [ ] Improve **accessibility** to meet **WCAG 2.2 AAA** standards
|
|
337
339
|
- [ ] Detailed Documentation about the components
|
|
340
|
+
- [x] Detailed Typescript-Model-Documentation about the components
|
|
338
341
|
|
|
339
342
|
## Examples (Next.js + Headless CMS)
|
|
340
343
|
|
|
@@ -138,6 +138,9 @@
|
|
|
138
138
|
display: flex;
|
|
139
139
|
flex-direction: column;
|
|
140
140
|
}
|
|
141
|
+
.prokodo-Accordion--panel {
|
|
142
|
+
gap: 0;
|
|
143
|
+
}
|
|
141
144
|
.prokodo-Accordion__item {
|
|
142
145
|
border: 1px solid var(--color-grey-200);
|
|
143
146
|
border-radius: 0.75rem;
|
|
@@ -149,6 +152,12 @@
|
|
|
149
152
|
.prokodo-Accordion__item--is-expanded {
|
|
150
153
|
border-color: var(--color-primary-500);
|
|
151
154
|
}
|
|
155
|
+
.prokodo-Accordion__item--panel {
|
|
156
|
+
border-radius: 0;
|
|
157
|
+
margin-bottom: 0;
|
|
158
|
+
box-shadow: none;
|
|
159
|
+
border: none;
|
|
160
|
+
}
|
|
152
161
|
.prokodo-Accordion__header {
|
|
153
162
|
display: flex;
|
|
154
163
|
align-items: center;
|
|
@@ -209,6 +218,43 @@
|
|
|
209
218
|
animation: none !important;
|
|
210
219
|
box-shadow: var(--elevation-1);
|
|
211
220
|
}
|
|
221
|
+
.prokodo-Accordion__header__wrapper--panel {
|
|
222
|
+
position: relative;
|
|
223
|
+
border: none;
|
|
224
|
+
border-bottom: 2px solid transparent;
|
|
225
|
+
background: linear-gradient(var(--header-bg, var(--color-white)), var(--header-bg, var(--color-white)));
|
|
226
|
+
border-radius: 0;
|
|
227
|
+
}
|
|
228
|
+
.prokodo-Accordion__header__wrapper--panel::after {
|
|
229
|
+
content: "";
|
|
230
|
+
position: absolute;
|
|
231
|
+
left: 0;
|
|
232
|
+
right: 0;
|
|
233
|
+
bottom: 0;
|
|
234
|
+
height: 2px;
|
|
235
|
+
background: linear-gradient(90deg, var(--color-primary-500), var(--color-secondary-500), var(--color-primary-500));
|
|
236
|
+
background-size: 0% 100%;
|
|
237
|
+
background-position: 0 0;
|
|
238
|
+
background-repeat: no-repeat;
|
|
239
|
+
transition: background-size 0.35s ease;
|
|
240
|
+
}
|
|
241
|
+
.prokodo-Accordion__header__wrapper--panel:hover, .prokodo-Accordion__header__wrapper--panel:focus-visible {
|
|
242
|
+
animation: none;
|
|
243
|
+
}
|
|
244
|
+
.prokodo-Accordion__header__wrapper--panel:hover::after, .prokodo-Accordion__header__wrapper--panel:focus-visible::after {
|
|
245
|
+
background-size: 200% 100%;
|
|
246
|
+
animation: accordionBorderShift 2s linear;
|
|
247
|
+
}
|
|
248
|
+
.prokodo-Accordion__header__wrapper--panel--is-expanded {
|
|
249
|
+
border-radius: 0;
|
|
250
|
+
box-shadow: none;
|
|
251
|
+
animation: none !important;
|
|
252
|
+
}
|
|
253
|
+
.prokodo-Accordion__header__wrapper--panel--is-expanded::after {
|
|
254
|
+
background-size: 100% 100%;
|
|
255
|
+
background-position: 100% 0;
|
|
256
|
+
animation: none !important;
|
|
257
|
+
}
|
|
212
258
|
.prokodo-Accordion__title {
|
|
213
259
|
width: calc(100% - 20px);
|
|
214
260
|
margin: 0;
|
|
@@ -138,6 +138,9 @@
|
|
|
138
138
|
display: flex;
|
|
139
139
|
flex-direction: column;
|
|
140
140
|
}
|
|
141
|
+
.prokodo-Accordion--panel {
|
|
142
|
+
gap: 0;
|
|
143
|
+
}
|
|
141
144
|
.prokodo-Accordion__item {
|
|
142
145
|
border: 1px solid var(--color-grey-200);
|
|
143
146
|
border-radius: 0.75rem;
|
|
@@ -149,6 +152,12 @@
|
|
|
149
152
|
.prokodo-Accordion__item--is-expanded {
|
|
150
153
|
border-color: var(--color-primary-500);
|
|
151
154
|
}
|
|
155
|
+
.prokodo-Accordion__item--panel {
|
|
156
|
+
border-radius: 0;
|
|
157
|
+
margin-bottom: 0;
|
|
158
|
+
box-shadow: none;
|
|
159
|
+
border: none;
|
|
160
|
+
}
|
|
152
161
|
.prokodo-Accordion__header {
|
|
153
162
|
display: flex;
|
|
154
163
|
align-items: center;
|
|
@@ -209,6 +218,43 @@
|
|
|
209
218
|
animation: none !important;
|
|
210
219
|
box-shadow: var(--elevation-1);
|
|
211
220
|
}
|
|
221
|
+
.prokodo-Accordion__header__wrapper--panel {
|
|
222
|
+
position: relative;
|
|
223
|
+
border: none;
|
|
224
|
+
border-bottom: 2px solid transparent;
|
|
225
|
+
background: linear-gradient(var(--header-bg, var(--color-white)), var(--header-bg, var(--color-white)));
|
|
226
|
+
border-radius: 0;
|
|
227
|
+
}
|
|
228
|
+
.prokodo-Accordion__header__wrapper--panel::after {
|
|
229
|
+
content: "";
|
|
230
|
+
position: absolute;
|
|
231
|
+
left: 0;
|
|
232
|
+
right: 0;
|
|
233
|
+
bottom: 0;
|
|
234
|
+
height: 2px;
|
|
235
|
+
background: linear-gradient(90deg, var(--color-primary-500), var(--color-secondary-500), var(--color-primary-500));
|
|
236
|
+
background-size: 0% 100%;
|
|
237
|
+
background-position: 0 0;
|
|
238
|
+
background-repeat: no-repeat;
|
|
239
|
+
transition: background-size 0.35s ease;
|
|
240
|
+
}
|
|
241
|
+
.prokodo-Accordion__header__wrapper--panel:hover, .prokodo-Accordion__header__wrapper--panel:focus-visible {
|
|
242
|
+
animation: none;
|
|
243
|
+
}
|
|
244
|
+
.prokodo-Accordion__header__wrapper--panel:hover::after, .prokodo-Accordion__header__wrapper--panel:focus-visible::after {
|
|
245
|
+
background-size: 200% 100%;
|
|
246
|
+
animation: accordionBorderShift 2s linear;
|
|
247
|
+
}
|
|
248
|
+
.prokodo-Accordion__header__wrapper--panel--is-expanded {
|
|
249
|
+
border-radius: 0;
|
|
250
|
+
box-shadow: none;
|
|
251
|
+
animation: none !important;
|
|
252
|
+
}
|
|
253
|
+
.prokodo-Accordion__header__wrapper--panel--is-expanded::after {
|
|
254
|
+
background-size: 100% 100%;
|
|
255
|
+
background-position: 100% 0;
|
|
256
|
+
animation: none !important;
|
|
257
|
+
}
|
|
212
258
|
.prokodo-Accordion__title {
|
|
213
259
|
width: calc(100% - 20px);
|
|
214
260
|
margin: 0;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
const accordionBorderShift = "accordionBorderShift";
|
|
2
2
|
const styles = {
|
|
3
3
|
"prokodo-Accordion": "prokodo-Accordion",
|
|
4
|
+
"prokodo-Accordion--panel": "prokodo-Accordion--panel",
|
|
4
5
|
"prokodo-Accordion__item": "prokodo-Accordion__item",
|
|
5
6
|
"prokodo-Accordion__item--is-expanded": "prokodo-Accordion__item--is-expanded",
|
|
7
|
+
"prokodo-Accordion__item--panel": "prokodo-Accordion__item--panel",
|
|
6
8
|
"prokodo-Accordion__header": "prokodo-Accordion__header",
|
|
7
9
|
"prokodo-Accordion__header__toggle": "prokodo-Accordion__header__toggle",
|
|
8
10
|
"prokodo-Accordion__header__actions": "prokodo-Accordion__header__actions",
|
|
@@ -11,6 +13,8 @@ const styles = {
|
|
|
11
13
|
"prokodo-Accordion__header__wrapper": "prokodo-Accordion__header__wrapper",
|
|
12
14
|
accordionBorderShift,
|
|
13
15
|
"prokodo-Accordion__header__wrapper--is-expanded": "prokodo-Accordion__header__wrapper--is-expanded",
|
|
16
|
+
"prokodo-Accordion__header__wrapper--panel": "prokodo-Accordion__header__wrapper--panel",
|
|
17
|
+
"prokodo-Accordion__header__wrapper--panel--is-expanded": "prokodo-Accordion__header__wrapper--panel--is-expanded",
|
|
14
18
|
"prokodo-Accordion__title": "prokodo-Accordion__title",
|
|
15
19
|
"prokodo-Accordion__icon": "prokodo-Accordion__icon",
|
|
16
20
|
"prokodo-Accordion__icon--is-hidden": "prokodo-Accordion__icon--is-hidden",
|
|
@@ -11,6 +11,9 @@ import { Icon } from "../icon/Icon.js";
|
|
|
11
11
|
const bem = create(styles, "Accordion");
|
|
12
12
|
function AccordionView({
|
|
13
13
|
id,
|
|
14
|
+
type = "card",
|
|
15
|
+
headerWrapperClassName,
|
|
16
|
+
headerToggleClassName,
|
|
14
17
|
variant = "primary",
|
|
15
18
|
className,
|
|
16
19
|
items,
|
|
@@ -24,7 +27,7 @@ function AccordionView({
|
|
|
24
27
|
"div",
|
|
25
28
|
{
|
|
26
29
|
...domRest,
|
|
27
|
-
className: bem(void 0, { [variant]: true }, className),
|
|
30
|
+
className: bem(void 0, { [variant]: true, [type]: true }, className),
|
|
28
31
|
children: items.map((item, index) => {
|
|
29
32
|
const {
|
|
30
33
|
title,
|
|
@@ -49,18 +52,34 @@ function AccordionView({
|
|
|
49
52
|
return /* @__PURE__ */ jsxs(
|
|
50
53
|
"div",
|
|
51
54
|
{
|
|
52
|
-
className: bem(
|
|
55
|
+
className: bem(
|
|
56
|
+
"item",
|
|
57
|
+
{ "is-expanded": isExpanded, [type]: true },
|
|
58
|
+
itemCls
|
|
59
|
+
),
|
|
53
60
|
children: [
|
|
54
61
|
/* @__PURE__ */ jsx(
|
|
55
62
|
"div",
|
|
56
63
|
{
|
|
57
|
-
className: bem(
|
|
64
|
+
className: bem(
|
|
65
|
+
"header__wrapper",
|
|
66
|
+
{
|
|
67
|
+
"is-expanded": isExpanded,
|
|
68
|
+
[type]: true,
|
|
69
|
+
[`${type}--is-expanded`]: isExpanded
|
|
70
|
+
},
|
|
71
|
+
headerWrapperClassName
|
|
72
|
+
),
|
|
58
73
|
children: /* @__PURE__ */ jsxs(
|
|
59
74
|
"div",
|
|
60
75
|
{
|
|
61
|
-
...accHeaderProps,
|
|
62
|
-
className: bem("header__toggle", { "is-expanded": isExpanded }),
|
|
63
76
|
id: `${accId}-header`,
|
|
77
|
+
className: bem(
|
|
78
|
+
"header__toggle",
|
|
79
|
+
{ "is-expanded": isExpanded },
|
|
80
|
+
headerToggleClassName
|
|
81
|
+
),
|
|
82
|
+
...accHeaderProps,
|
|
64
83
|
children: [
|
|
65
84
|
!isNull(renderHeader) ? renderHeader : /* @__PURE__ */ jsx(
|
|
66
85
|
Headline,
|
|
@@ -118,6 +137,7 @@ function AccordionView({
|
|
|
118
137
|
/* @__PURE__ */ jsxs(
|
|
119
138
|
"div",
|
|
120
139
|
{
|
|
140
|
+
"aria-label": title,
|
|
121
141
|
"aria-labelledby": `${accId}-header`,
|
|
122
142
|
className: bem("content", { "is-expanded": isExpanded }),
|
|
123
143
|
hidden: !isExpanded,
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import { memo, useRef, useState, useEffect, useMemo, useCallback } from "react";
|
|
6
|
+
import { AutocompleteView } from "./Autocomplete.view.js";
|
|
7
|
+
function AutocompleteClient({
|
|
8
|
+
name,
|
|
9
|
+
value,
|
|
10
|
+
items,
|
|
11
|
+
minQueryLength = 2,
|
|
12
|
+
onChange,
|
|
13
|
+
onSelect,
|
|
14
|
+
...rest
|
|
15
|
+
}) {
|
|
16
|
+
const rootRef = useRef(null);
|
|
17
|
+
const [query, setQuery] = useState(value ?? "");
|
|
18
|
+
const [open, setOpen] = useState(false);
|
|
19
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
20
|
+
const [listTop, setListTop] = useState(void 0);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
setQuery(value ?? "");
|
|
23
|
+
}, [value]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!open) return;
|
|
26
|
+
const onClickOutside = /* @__PURE__ */ __name((event) => {
|
|
27
|
+
var _a;
|
|
28
|
+
if (!((_a = rootRef.current) == null ? void 0 : _a.contains(event.target))) {
|
|
29
|
+
setOpen(false);
|
|
30
|
+
}
|
|
31
|
+
}, "onClickOutside");
|
|
32
|
+
window.addEventListener("mousedown", onClickOutside);
|
|
33
|
+
return () => window.removeEventListener("mousedown", onClickOutside);
|
|
34
|
+
}, [open]);
|
|
35
|
+
const list = useMemo(() => items ?? [], [items]);
|
|
36
|
+
const updateListAnchor = useCallback(() => {
|
|
37
|
+
const root = rootRef.current;
|
|
38
|
+
if (!root) return;
|
|
39
|
+
const inputElement = root.querySelector(
|
|
40
|
+
`input[name="${name}"], textarea[name="${name}"]`
|
|
41
|
+
);
|
|
42
|
+
if (!inputElement) {
|
|
43
|
+
setListTop(void 0);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const rootRect = root.getBoundingClientRect();
|
|
47
|
+
const inputRect = inputElement.getBoundingClientRect();
|
|
48
|
+
setListTop(inputRect.bottom - rootRect.top);
|
|
49
|
+
}, [name]);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!open) return;
|
|
52
|
+
updateListAnchor();
|
|
53
|
+
const onLayoutChange = /* @__PURE__ */ __name(() => updateListAnchor(), "onLayoutChange");
|
|
54
|
+
window.addEventListener("resize", onLayoutChange);
|
|
55
|
+
window.addEventListener("scroll", onLayoutChange, true);
|
|
56
|
+
return () => {
|
|
57
|
+
window.removeEventListener("resize", onLayoutChange);
|
|
58
|
+
window.removeEventListener("scroll", onLayoutChange, true);
|
|
59
|
+
};
|
|
60
|
+
}, [open, query, updateListAnchor]);
|
|
61
|
+
const handleInputChange = useCallback(
|
|
62
|
+
(nextQuery) => {
|
|
63
|
+
setQuery(nextQuery);
|
|
64
|
+
setOpen(true);
|
|
65
|
+
setActiveIndex(0);
|
|
66
|
+
onChange == null ? void 0 : onChange({ query: nextQuery });
|
|
67
|
+
},
|
|
68
|
+
[onChange]
|
|
69
|
+
);
|
|
70
|
+
const handleSelectItem = useCallback(
|
|
71
|
+
(item) => {
|
|
72
|
+
setQuery(item.label);
|
|
73
|
+
setOpen(false);
|
|
74
|
+
onSelect == null ? void 0 : onSelect(item);
|
|
75
|
+
},
|
|
76
|
+
[onSelect]
|
|
77
|
+
);
|
|
78
|
+
const handleKeyDown = useCallback(
|
|
79
|
+
(event) => {
|
|
80
|
+
if (event.key === "Escape") {
|
|
81
|
+
setOpen(false);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (event.key === "ArrowDown") {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
setOpen(true);
|
|
87
|
+
setActiveIndex((previous) => Math.min(previous + 1, list.length - 1));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (event.key === "ArrowUp") {
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
setActiveIndex((previous) => Math.max(previous - 1, 0));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (event.key === "Enter" && open) {
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
const selected = list[activeIndex];
|
|
98
|
+
if (!selected) return;
|
|
99
|
+
handleSelectItem(selected);
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
[activeIndex, handleSelectItem, list, open]
|
|
103
|
+
);
|
|
104
|
+
const clientState = {
|
|
105
|
+
open,
|
|
106
|
+
listTop,
|
|
107
|
+
activeIndex,
|
|
108
|
+
onInputChange: handleInputChange,
|
|
109
|
+
onInputFocus: /* @__PURE__ */ __name(() => {
|
|
110
|
+
if (query.trim().length >= minQueryLength) setOpen(true);
|
|
111
|
+
}, "onInputFocus"),
|
|
112
|
+
onInputKeyDown: handleKeyDown,
|
|
113
|
+
onSelectItem: handleSelectItem
|
|
114
|
+
};
|
|
115
|
+
return /* @__PURE__ */ jsx("div", { ref: rootRef, children: /* @__PURE__ */ jsx(
|
|
116
|
+
AutocompleteView,
|
|
117
|
+
{
|
|
118
|
+
...rest,
|
|
119
|
+
_clientState: clientState,
|
|
120
|
+
items: list,
|
|
121
|
+
minQueryLength,
|
|
122
|
+
name,
|
|
123
|
+
open,
|
|
124
|
+
value: query
|
|
125
|
+
}
|
|
126
|
+
) });
|
|
127
|
+
}
|
|
128
|
+
__name(AutocompleteClient, "AutocompleteClient");
|
|
129
|
+
const AutocompleteClient$1 = memo(AutocompleteClient);
|
|
130
|
+
export {
|
|
131
|
+
AutocompleteClient$1 as default
|
|
132
|
+
};
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/* stylelint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* Calculates a rem-based value by a given pixel size.
|
|
4
|
+
*/
|
|
5
|
+
/* stylelint-disable */
|
|
6
|
+
/**
|
|
7
|
+
* Applies flex-column and gap.
|
|
8
|
+
*/
|
|
9
|
+
/*
|
|
10
|
+
As example (light, primary)
|
|
11
|
+
See defined modes in designsystem/config/gradients
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Mixin that renders a media query that target screens that are larger than the
|
|
15
|
+
* given size.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Mixin that renders a media query that target screens that are smaller than the
|
|
19
|
+
* given size.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Mixin that renders a media query that target screens in between the given range.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Mixin that renders a media query that target screens that have height larger than the
|
|
26
|
+
* given size.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Mixin that renders a media query that target screens that have height smaller than the
|
|
30
|
+
* given size.
|
|
31
|
+
*/
|
|
32
|
+
/* stylelint-disable */
|
|
33
|
+
/* M3/Elevation Light/1 */
|
|
34
|
+
/* M3/Elevation Light/2 */
|
|
35
|
+
/* M3/Elevation/5 */
|
|
36
|
+
/* M3/Elevation/1 Text */
|
|
37
|
+
/* Inner elevations */
|
|
38
|
+
/* stylelint-disable */
|
|
39
|
+
/**
|
|
40
|
+
* Visually hides an element but not removes them for screen readers.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* The inverse of the `hidden` helper to reset a previously hidden element to be
|
|
44
|
+
* visible for users.
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* Creates a selector for :hover effects depending on the current user input
|
|
48
|
+
* device. If the input device is a mouse, this hover effect will appear.
|
|
49
|
+
* Keyboard and touch inputs are ignored.
|
|
50
|
+
*
|
|
51
|
+
* Example usage:
|
|
52
|
+
* .link {
|
|
53
|
+
* color: blue;
|
|
54
|
+
*
|
|
55
|
+
* @include when-hovered() {
|
|
56
|
+
* color: green;
|
|
57
|
+
* }
|
|
58
|
+
* }
|
|
59
|
+
*/
|
|
60
|
+
/**
|
|
61
|
+
* Creates a selector for :active effects depending on the current user input
|
|
62
|
+
* device. The state applies when the input device is a mouse or keyboard. Touch
|
|
63
|
+
* devices will not show a pressed state.
|
|
64
|
+
*
|
|
65
|
+
* Example usage:
|
|
66
|
+
* .link {
|
|
67
|
+
* box-shadow: none;
|
|
68
|
+
*
|
|
69
|
+
* @include when-pressed() {
|
|
70
|
+
* box-shadow: inset 0 2px 4px grey;
|
|
71
|
+
* }
|
|
72
|
+
* }
|
|
73
|
+
*/
|
|
74
|
+
/**
|
|
75
|
+
* Creates a selector for :focus effects depending on the current user input
|
|
76
|
+
* device. When the user navigates using a keyboard, the focus effect defined in
|
|
77
|
+
* here is applied. For other input devices they don't show up.
|
|
78
|
+
*
|
|
79
|
+
* Example usage:
|
|
80
|
+
* .link {
|
|
81
|
+
* text-decoration: none;
|
|
82
|
+
*
|
|
83
|
+
* @include when-focused() {
|
|
84
|
+
* text-decoration: underline;
|
|
85
|
+
* }
|
|
86
|
+
* }
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* Creates a selector for :focus-within effects depending on the current user
|
|
90
|
+
* input device. When the user navigates using a keyboard, the focus effect
|
|
91
|
+
* defined in here is applied. For other input devices they don't show up.
|
|
92
|
+
*
|
|
93
|
+
* Example usage:
|
|
94
|
+
* .link {
|
|
95
|
+
* img {
|
|
96
|
+
* opacity: 0.75;
|
|
97
|
+
*
|
|
98
|
+
* @include when-focused-within() {
|
|
99
|
+
* opacity: 1;
|
|
100
|
+
* }
|
|
101
|
+
* }
|
|
102
|
+
* }
|
|
103
|
+
*/
|
|
104
|
+
/**
|
|
105
|
+
* Wrapper for media query "prefers-reduced-motion".
|
|
106
|
+
*/
|
|
107
|
+
/**
|
|
108
|
+
* This helper hides the outline but still makes it visible for
|
|
109
|
+
* Windows high-contrast users. Use this instead of `outline: 0;`.
|
|
110
|
+
*/
|
|
111
|
+
/**
|
|
112
|
+
* This helper hides the outline but still makes it visible for
|
|
113
|
+
* Windows high-contrast users. Use this instead of `outline: 0;`.
|
|
114
|
+
*/
|
|
115
|
+
/**
|
|
116
|
+
* Renders an alternative, but application consistent focus-ring.
|
|
117
|
+
*/
|
|
118
|
+
/**
|
|
119
|
+
* Specifies the outer layout for all contents across breakpoints. Apply this
|
|
120
|
+
* mixin to the container element, to center the contents on the screen within
|
|
121
|
+
* the layout offsets.
|
|
122
|
+
*/
|
|
123
|
+
/**
|
|
124
|
+
* This mixin specifies basic text-styles for components that render a richtext
|
|
125
|
+
* content.
|
|
126
|
+
*/
|
|
127
|
+
@keyframes fade-in {
|
|
128
|
+
from {
|
|
129
|
+
opacity: 0;
|
|
130
|
+
transform: translateY(-4px);
|
|
131
|
+
}
|
|
132
|
+
to {
|
|
133
|
+
opacity: 1;
|
|
134
|
+
transform: translateY(0);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
.prokodo-Autocomplete {
|
|
138
|
+
position: relative;
|
|
139
|
+
}
|
|
140
|
+
.prokodo-Autocomplete__inputWrap {
|
|
141
|
+
position: relative;
|
|
142
|
+
z-index: 41;
|
|
143
|
+
border-radius: 1.5rem;
|
|
144
|
+
}
|
|
145
|
+
.prokodo-Autocomplete__input {
|
|
146
|
+
width: 100%;
|
|
147
|
+
}
|
|
148
|
+
.prokodo-Autocomplete__input__inner--is-open, .prokodo-Autocomplete__input__node--is-open {
|
|
149
|
+
border-bottom-left-radius: 0 !important;
|
|
150
|
+
border-bottom-right-radius: 0 !important;
|
|
151
|
+
}
|
|
152
|
+
.prokodo-Autocomplete__input__inner--is-open {
|
|
153
|
+
background: var(--gradient-border-4);
|
|
154
|
+
}
|
|
155
|
+
.prokodo-Autocomplete__list {
|
|
156
|
+
position: absolute;
|
|
157
|
+
top: 100%;
|
|
158
|
+
left: 0;
|
|
159
|
+
width: calc(100% - 4px);
|
|
160
|
+
margin: 0;
|
|
161
|
+
padding: 0 2px 2px;
|
|
162
|
+
list-style: none;
|
|
163
|
+
transform: none;
|
|
164
|
+
border-bottom-left-radius: 1.5rem;
|
|
165
|
+
border-bottom-right-radius: 1.5rem;
|
|
166
|
+
border-top-left-radius: 0;
|
|
167
|
+
border-top-right-radius: 0;
|
|
168
|
+
background: var(--gradient-border-4);
|
|
169
|
+
margin-top: -2px;
|
|
170
|
+
box-shadow: var(--elevation-3);
|
|
171
|
+
max-height: 260px;
|
|
172
|
+
overflow: auto;
|
|
173
|
+
z-index: 50;
|
|
174
|
+
animation: fade-in 180ms ease-out;
|
|
175
|
+
scrollbar-width: none;
|
|
176
|
+
}
|
|
177
|
+
.prokodo-Autocomplete__list::-webkit-scrollbar {
|
|
178
|
+
display: none;
|
|
179
|
+
}
|
|
180
|
+
.prokodo-Autocomplete__state {
|
|
181
|
+
display: flex;
|
|
182
|
+
align-items: center;
|
|
183
|
+
gap: 0.5rem;
|
|
184
|
+
margin: 0;
|
|
185
|
+
padding: 0.5rem 1rem 1rem 1rem;
|
|
186
|
+
background: var(--color-white);
|
|
187
|
+
color: var(--color-grey-700);
|
|
188
|
+
border-bottom-left-radius: 1.5rem;
|
|
189
|
+
border-bottom-right-radius: 1.5rem;
|
|
190
|
+
font-weight: 400;
|
|
191
|
+
font-size: 1rem;
|
|
192
|
+
font-family: var(--font-secondary), -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
193
|
+
font-style: normal;
|
|
194
|
+
line-height: 1.45;
|
|
195
|
+
letter-spacing: 0.03em;
|
|
196
|
+
text-transform: none;
|
|
197
|
+
text-align: left;
|
|
198
|
+
text-decoration: none;
|
|
199
|
+
}
|
|
200
|
+
@media screen and (min-width: 480px) {
|
|
201
|
+
.prokodo-Autocomplete__state {
|
|
202
|
+
font-size: 0.875rem;
|
|
203
|
+
line-height: 1.4;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
@media screen and (min-width: 960px) {
|
|
207
|
+
.prokodo-Autocomplete__state {
|
|
208
|
+
font-size: 0.875rem;
|
|
209
|
+
line-height: 1.4;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
html[data-theme=dark] .prokodo-Autocomplete__state {
|
|
213
|
+
background: rgb(16, 19, 27);
|
|
214
|
+
color: var(--color-grey-500);
|
|
215
|
+
}
|
|
216
|
+
.prokodo-Autocomplete__itemRow {
|
|
217
|
+
list-style: none;
|
|
218
|
+
margin: 0;
|
|
219
|
+
padding: 0;
|
|
220
|
+
}
|
|
221
|
+
.prokodo-Autocomplete__itemRow--is-last {
|
|
222
|
+
border-bottom-left-radius: 1.5rem;
|
|
223
|
+
border-bottom-right-radius: 1.5rem;
|
|
224
|
+
}
|
|
225
|
+
.prokodo-Autocomplete__item {
|
|
226
|
+
width: 100%;
|
|
227
|
+
border: none;
|
|
228
|
+
background: var(--color-white);
|
|
229
|
+
color: inherit;
|
|
230
|
+
text-align: left;
|
|
231
|
+
display: grid;
|
|
232
|
+
grid-gap: 0.25rem;
|
|
233
|
+
gap: 0.25rem;
|
|
234
|
+
padding: 0.5rem 1rem;
|
|
235
|
+
cursor: pointer;
|
|
236
|
+
transition: background-color 120ms ease;
|
|
237
|
+
}
|
|
238
|
+
html[data-theme=dark] .prokodo-Autocomplete__item {
|
|
239
|
+
background: rgb(16, 19, 27);
|
|
240
|
+
}
|
|
241
|
+
.prokodo-Autocomplete__item:hover {
|
|
242
|
+
background: var(--color-primary-50);
|
|
243
|
+
}
|
|
244
|
+
html[data-theme=dark] .prokodo-Autocomplete__item:hover {
|
|
245
|
+
background: var(--color-primary-50);
|
|
246
|
+
}
|
|
247
|
+
.prokodo-Autocomplete__item:focus-visible {
|
|
248
|
+
outline: 0;
|
|
249
|
+
background: var(--color-primary-50);
|
|
250
|
+
}
|
|
251
|
+
html[data-theme=dark] .prokodo-Autocomplete__item:focus-visible {
|
|
252
|
+
background: var(--color-primary-50);
|
|
253
|
+
}
|
|
254
|
+
.prokodo-Autocomplete__item--is-first {
|
|
255
|
+
border-top-left-radius: 0;
|
|
256
|
+
border-top-right-radius: 0;
|
|
257
|
+
}
|
|
258
|
+
.prokodo-Autocomplete__item--is-last {
|
|
259
|
+
border-bottom-left-radius: 1.5rem;
|
|
260
|
+
border-bottom-right-radius: 1.5rem;
|
|
261
|
+
}
|
|
262
|
+
.prokodo-Autocomplete__item--is-active {
|
|
263
|
+
background: var(--color-primary-100);
|
|
264
|
+
}
|
|
265
|
+
html[data-theme=dark] .prokodo-Autocomplete__item--is-active {
|
|
266
|
+
background: var(--color-primary-100);
|
|
267
|
+
}
|
|
268
|
+
.prokodo-Autocomplete__itemLabel {
|
|
269
|
+
margin: 0;
|
|
270
|
+
color: var(--color-grey-900);
|
|
271
|
+
font-weight: 400;
|
|
272
|
+
font-size: 1rem;
|
|
273
|
+
font-family: var(--font-secondary), -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
274
|
+
font-style: normal;
|
|
275
|
+
line-height: 1.45;
|
|
276
|
+
letter-spacing: 0.03em;
|
|
277
|
+
text-transform: none;
|
|
278
|
+
text-align: left;
|
|
279
|
+
text-decoration: none;
|
|
280
|
+
}
|
|
281
|
+
@media screen and (min-width: 480px) {
|
|
282
|
+
.prokodo-Autocomplete__itemLabel {
|
|
283
|
+
font-size: 0.875rem;
|
|
284
|
+
line-height: 1.4;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
@media screen and (min-width: 960px) {
|
|
288
|
+
.prokodo-Autocomplete__itemLabel {
|
|
289
|
+
font-size: 0.875rem;
|
|
290
|
+
line-height: 1.4;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
.prokodo-Autocomplete__itemDescription {
|
|
294
|
+
margin: 0;
|
|
295
|
+
color: var(--color-grey-700);
|
|
296
|
+
font-weight: 400;
|
|
297
|
+
font-size: 1rem;
|
|
298
|
+
font-family: var(--font-secondary), -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
|
299
|
+
font-style: normal;
|
|
300
|
+
line-height: 1.45;
|
|
301
|
+
letter-spacing: 0.03em;
|
|
302
|
+
text-transform: none;
|
|
303
|
+
text-align: left;
|
|
304
|
+
text-decoration: none;
|
|
305
|
+
}
|
|
306
|
+
@media screen and (min-width: 480px) {
|
|
307
|
+
.prokodo-Autocomplete__itemDescription {
|
|
308
|
+
font-size: 0.875rem;
|
|
309
|
+
line-height: 1.4;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
@media screen and (min-width: 960px) {
|
|
313
|
+
.prokodo-Autocomplete__itemDescription {
|
|
314
|
+
font-size: 0.875rem;
|
|
315
|
+
line-height: 1.4;
|
|
316
|
+
}
|
|
317
|
+
}
|