@ogcio/design-system-react 1.13.0 → 1.14.0
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/autocomplete/autocomplete.d.ts +21 -3
- package/dist/autocomplete/autocomplete.js +208 -159
- package/dist/autocomplete/types.d.ts +8 -4
- package/dist/autocomplete/types.js +2 -1
- package/dist/autocomplete/use-autocomplete-controller.d.ts +4 -2
- package/dist/autocomplete/use-autocomplete-controller.js +123 -79
- package/dist/button/button.js +27 -22
- package/dist/hooks/use-combined-refs.d.ts +5 -0
- package/dist/hooks/use-combined-refs.js +10 -0
- package/dist/hooks/use-scroll-highlighted-item.d.ts +1 -0
- package/dist/hooks/use-scroll-highlighted-item.js +16 -0
- package/dist/icon/icon.js +14 -14
- package/dist/icon-button/icon-button.js +14 -12
- package/dist/index.d.ts +3 -2
- package/dist/list/list.js +1 -1
- package/dist/modal/modal.d.ts +8 -2
- package/dist/modal/modal.js +155 -134
- package/dist/popover/popover.d.ts +1 -1
- package/dist/popover/popover.js +296 -286
- package/dist/popover/types.d.ts +1 -0
- package/dist/popover/utilities.d.ts +2 -0
- package/dist/popover/utilities.js +16 -0
- package/dist/primitives/button.d.ts +3 -0
- package/dist/primitives/button.js +9 -0
- package/dist/select/select-menu.d.ts +2 -2
- package/dist/select/select-menu.js +96 -99
- package/dist/select/select-next.d.ts +13 -2
- package/dist/select/select-next.js +182 -167
- package/dist/select/select-search.js +17 -17
- package/dist/select/types.d.ts +3 -1
- package/dist/styles.css +1 -1
- package/dist/tabs/scrollable-tab-list.d.ts +9 -0
- package/dist/tabs/scrollable-tab-list.js +84 -0
- package/dist/tabs/tab-item.d.ts +9 -15
- package/dist/tabs/tab-item.js +85 -38
- package/dist/tabs/tab-list.d.ts +2 -5
- package/dist/tabs/tab-list.js +83 -49
- package/dist/tabs/tab-panel.d.ts +2 -7
- package/dist/tabs/tab-panel.js +2 -5
- package/dist/tabs/tabs.d.ts +2 -7
- package/dist/tabs/tabs.js +24 -20
- package/dist/tabs/types.d.ts +64 -0
- package/dist/tabs/types.js +1 -0
- package/dist/textarea/textarea.d.ts +1 -2
- package/dist/textarea/textarea.js +60 -61
- package/package.json +3 -3
package/dist/popover/types.d.ts
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const r = (o) => ({
|
|
2
|
+
name: "dynamicHeight",
|
|
3
|
+
enabled: !0,
|
|
4
|
+
phase: "main",
|
|
5
|
+
fn({ state: e }) {
|
|
6
|
+
const t = e.elements.popper.getBoundingClientRect(), i = e.placement, n = 32, p = i.startsWith("top") ? t.bottom - n : window.innerHeight - t.top - n, s = typeof o == "number" && p > o ? o : p;
|
|
7
|
+
e.styles.popper = {
|
|
8
|
+
...e.styles.popper,
|
|
9
|
+
overflowY: "auto",
|
|
10
|
+
maxHeight: `${s}px`
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
export {
|
|
15
|
+
r as createDynamicHeightModifier
|
|
16
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SelectMenuOptionProps, SelectMenuProps } from './types.js';
|
|
2
|
-
export declare const SelectMenu: (
|
|
3
|
-
export declare const SelectMenuOption: ({ children, value, selected, onChange, disabled, dataTestid, className, hidden, enableSearch, isHighlighted, ...props }: SelectMenuOptionProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
2
|
+
export declare const SelectMenu: import('react').ForwardRefExoticComponent<SelectMenuProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
3
|
+
export declare const SelectMenuOption: ({ children, value, selected, onChange, disabled, dataTestid, className, hidden, enableSearch, isHighlighted, index, ...props }: SelectMenuOptionProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
4
4
|
export declare const SelectMenuGroupItem: ({ children, label, ...props }: {
|
|
5
5
|
children?: any;
|
|
6
6
|
label: string;
|
|
@@ -1,148 +1,145 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { cn as
|
|
5
|
-
import { translate as
|
|
6
|
-
import { Icon as
|
|
7
|
-
import { InputText as
|
|
8
|
-
import { Label as
|
|
9
|
-
import { Spinner as
|
|
10
|
-
const
|
|
11
|
-
children: o,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return v(e, {
|
|
34
|
-
onChange: s,
|
|
35
|
-
enableSearch: r
|
|
36
|
-
});
|
|
2
|
+
import { jsxs as b, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as H, useState as v, useEffect as K, Children as P, isValidElement as V, cloneElement as N } from "react";
|
|
4
|
+
import { cn as F } from "../cn.js";
|
|
5
|
+
import { translate as B } from "../i18n/utility.js";
|
|
6
|
+
import { Icon as J } from "../icon/icon.js";
|
|
7
|
+
import { InputText as Q } from "../input-text/input-text.js";
|
|
8
|
+
import { Label as U } from "../label/label.js";
|
|
9
|
+
import { Spinner as W } from "../spinner/spinner.js";
|
|
10
|
+
const se = H(
|
|
11
|
+
({ children: o, className: i, onChange: s, enableSearch: r, isLoading: c, showNoData: m }, g) => {
|
|
12
|
+
const [l, y] = v(""), [O, f] = v(!1), [S, w] = v([]);
|
|
13
|
+
K(() => {
|
|
14
|
+
f(!1), m && setTimeout(() => f(!0), 0);
|
|
15
|
+
}, [m]), K(() => {
|
|
16
|
+
const R = P.toArray(o).filter(
|
|
17
|
+
(a) => V(a)
|
|
18
|
+
).map((a) => {
|
|
19
|
+
var L, M, T, I, k, E;
|
|
20
|
+
const q = (L = a == null ? void 0 : a.type) == null ? void 0 : L.componentType, D = l.toLowerCase();
|
|
21
|
+
switch (q) {
|
|
22
|
+
case "SelectMenuOption": {
|
|
23
|
+
const e = a;
|
|
24
|
+
if (typeof e.props.value == "string") {
|
|
25
|
+
const G = ((I = (T = (M = e == null ? void 0 : e.props) == null ? void 0 : M.children) == null ? void 0 : T.toString()) == null ? void 0 : I.toLowerCase()) || "", j = (E = (k = e == null ? void 0 : e.props) == null ? void 0 : k.value) == null ? void 0 : E.toLowerCase();
|
|
26
|
+
if (G.includes(D) || j.includes(D))
|
|
27
|
+
return N(e, {
|
|
28
|
+
onChange: s,
|
|
29
|
+
enableSearch: r
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
break;
|
|
37
33
|
}
|
|
38
|
-
|
|
34
|
+
case "SelectMenuGroupItem": {
|
|
35
|
+
const e = a, C = P.toArray(
|
|
36
|
+
e.props.children
|
|
37
|
+
).filter((t) => V(t)).map((t) => {
|
|
38
|
+
var p;
|
|
39
|
+
return ((p = t == null ? void 0 : t.type) == null ? void 0 : p.componentType) === "SelectMenuOption" ? N(t, { onChange: s }) : null;
|
|
40
|
+
}).filter(
|
|
41
|
+
(t) => t !== null
|
|
42
|
+
).filter((t) => {
|
|
43
|
+
var $, z, A;
|
|
44
|
+
const p = ((z = ($ = t.props.children) == null ? void 0 : $.toString()) == null ? void 0 : z.toLowerCase()) || "", d = ((A = t.props.value) == null ? void 0 : A.toLowerCase()) || "";
|
|
45
|
+
return (p == null ? void 0 : p.includes(l.toLowerCase())) || (d == null ? void 0 : d.includes(l.toLowerCase()));
|
|
46
|
+
});
|
|
47
|
+
return C.length > 0 || l === "" ? N(e, {
|
|
48
|
+
children: C
|
|
49
|
+
}) : null;
|
|
50
|
+
}
|
|
51
|
+
default:
|
|
52
|
+
return null;
|
|
39
53
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}) : null;
|
|
54
|
+
}).filter(Boolean);
|
|
55
|
+
w(R);
|
|
56
|
+
}, [o, l, s]);
|
|
57
|
+
const h = (x) => {
|
|
58
|
+
y(x.target.value);
|
|
59
|
+
}, u = () => c ? /* @__PURE__ */ n("div", { className: "gi-select-menu-loading", children: /* @__PURE__ */ n(W, { size: "md" }) }) : O ? /* @__PURE__ */ n("div", { className: "gi-select-menu-option-not-found", children: B("autocomplete.noData") }) : /* @__PURE__ */ n("ul", { children: S });
|
|
60
|
+
return /* @__PURE__ */ b("div", { ref: g, className: F("gi-select-menu-container", i), children: [
|
|
61
|
+
r && /* @__PURE__ */ n("div", { className: "gi-select-menu-input-container", children: /* @__PURE__ */ n(
|
|
62
|
+
Q,
|
|
63
|
+
{
|
|
64
|
+
tabIndex: 0,
|
|
65
|
+
placeholder: B("input.search"),
|
|
66
|
+
iconEnd: "search",
|
|
67
|
+
onChange: h,
|
|
68
|
+
value: l
|
|
56
69
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, [o, l, s]);
|
|
63
|
-
const w = (b) => {
|
|
64
|
-
g(b.target.value);
|
|
65
|
-
}, u = () => c ? /* @__PURE__ */ n("div", { className: "gi-select-menu-loading", children: /* @__PURE__ */ n(R, { size: "md" }) }) : S ? /* @__PURE__ */ n("div", { className: "gi-select-menu-option-not-found", children: q("autocomplete.noData") }) : /* @__PURE__ */ n("ul", { children: y });
|
|
66
|
-
return /* @__PURE__ */ N("div", { className: V("gi-select-menu-container", i), children: [
|
|
67
|
-
r && /* @__PURE__ */ n("div", { className: "gi-select-menu-input-container", children: /* @__PURE__ */ n(
|
|
68
|
-
J,
|
|
69
|
-
{
|
|
70
|
-
tabIndex: 0,
|
|
71
|
-
placeholder: "Search",
|
|
72
|
-
iconEnd: "search",
|
|
73
|
-
onChange: w,
|
|
74
|
-
value: l
|
|
75
|
-
}
|
|
76
|
-
) }),
|
|
77
|
-
/* @__PURE__ */ n("div", { className: "gi-select-menu-option-container", children: u() })
|
|
78
|
-
] });
|
|
79
|
-
}, U = ({
|
|
70
|
+
) }),
|
|
71
|
+
/* @__PURE__ */ n("div", { className: "gi-select-menu-option-container", children: u() })
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
), X = ({
|
|
80
75
|
children: o,
|
|
81
76
|
value: i,
|
|
82
77
|
selected: s,
|
|
83
78
|
onChange: r,
|
|
84
79
|
disabled: c,
|
|
85
80
|
dataTestid: m,
|
|
86
|
-
className:
|
|
87
|
-
hidden:
|
|
88
|
-
enableSearch:
|
|
89
|
-
isHighlighted:
|
|
90
|
-
|
|
81
|
+
className: g,
|
|
82
|
+
hidden: l,
|
|
83
|
+
enableSearch: y,
|
|
84
|
+
isHighlighted: O,
|
|
85
|
+
index: f,
|
|
86
|
+
...S
|
|
91
87
|
}) => {
|
|
92
|
-
const
|
|
88
|
+
const w = (u) => {
|
|
93
89
|
(u.key === "Enter" || u.key === " ") && (u.preventDefault(), r == null || r(i));
|
|
94
|
-
},
|
|
90
|
+
}, h = () => {
|
|
95
91
|
c || r == null || r(i);
|
|
96
92
|
};
|
|
97
|
-
return
|
|
93
|
+
return l ? null : /* @__PURE__ */ b(
|
|
98
94
|
"li",
|
|
99
95
|
{
|
|
100
96
|
role: "option",
|
|
101
97
|
tabIndex: c ? -1 : 0,
|
|
98
|
+
"data-index": f,
|
|
102
99
|
"aria-selected": s,
|
|
103
100
|
"aria-label": o == null ? void 0 : o.toString(),
|
|
104
101
|
"aria-disabled": c,
|
|
105
|
-
onKeyDown:
|
|
106
|
-
onClick:
|
|
107
|
-
className:
|
|
102
|
+
onKeyDown: w,
|
|
103
|
+
onClick: h,
|
|
104
|
+
className: F(
|
|
108
105
|
"gi-select-option-item",
|
|
109
106
|
{
|
|
110
107
|
"gi-select-option-item-disabled": c,
|
|
111
|
-
"gi-select-option-item-highlighted":
|
|
108
|
+
"gi-select-option-item-highlighted": O
|
|
112
109
|
},
|
|
113
|
-
|
|
110
|
+
g
|
|
114
111
|
),
|
|
115
|
-
"data-search-enabled":
|
|
112
|
+
"data-search-enabled": y,
|
|
116
113
|
"data-testid": m || `option-${i}`,
|
|
117
|
-
...
|
|
114
|
+
...S,
|
|
118
115
|
children: [
|
|
119
116
|
/* @__PURE__ */ n("span", { className: "gi-text-sm", children: o }),
|
|
120
|
-
s && /* @__PURE__ */ n(
|
|
117
|
+
s && /* @__PURE__ */ n(J, { icon: "check" })
|
|
121
118
|
]
|
|
122
119
|
},
|
|
123
120
|
`${o}-${i}`
|
|
124
121
|
);
|
|
125
122
|
};
|
|
126
|
-
Object.defineProperty(
|
|
123
|
+
Object.defineProperty(X, "componentType", {
|
|
127
124
|
value: "SelectMenuOption",
|
|
128
125
|
writable: !1,
|
|
129
126
|
enumerable: !1
|
|
130
127
|
});
|
|
131
|
-
const
|
|
128
|
+
const Y = ({
|
|
132
129
|
children: o,
|
|
133
130
|
label: i,
|
|
134
131
|
...s
|
|
135
|
-
}) => /* @__PURE__ */
|
|
136
|
-
/* @__PURE__ */ n(
|
|
132
|
+
}) => /* @__PURE__ */ b("div", { ...s, role: "group", className: "gi-px-3", children: [
|
|
133
|
+
/* @__PURE__ */ n(U, { text: i, size: "sm", className: "gi-font-bold gi-pb-1" }),
|
|
137
134
|
o
|
|
138
135
|
] });
|
|
139
|
-
Object.defineProperty(
|
|
136
|
+
Object.defineProperty(Y, "componentType", {
|
|
140
137
|
value: "SelectMenuGroupItem",
|
|
141
138
|
writable: !1,
|
|
142
139
|
enumerable: !1
|
|
143
140
|
});
|
|
144
141
|
export {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
142
|
+
se as SelectMenu,
|
|
143
|
+
Y as SelectMenuGroupItem,
|
|
144
|
+
X as SelectMenuOption
|
|
148
145
|
};
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
import { SelectNextGroupProps,
|
|
3
|
-
export declare const SelectNext:
|
|
2
|
+
import { SelectNextGroupProps, SelectNextOptionProps, SelectNextTableCellProps } from './types.js';
|
|
3
|
+
export declare const SelectNext: import('react').ForwardRefExoticComponent<{
|
|
4
|
+
name?: string;
|
|
5
|
+
onChange?: (event: import('react').ChangeEvent<HTMLSelectElement>) => void;
|
|
6
|
+
onMenuClose?: () => void;
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
value?: string;
|
|
9
|
+
enableSearch?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
} & Omit<import('react').HTMLAttributes<HTMLDivElement>, "onChange"> & {
|
|
13
|
+
children?: import('react').ReactNode | undefined;
|
|
14
|
+
} & import('react').RefAttributes<HTMLInputElement>>;
|
|
4
15
|
export declare const SelectItemNext: FC<SelectNextOptionProps>;
|
|
5
16
|
export declare const SelectGroupItemNext: FC<SelectNextGroupProps>;
|
|
6
17
|
export declare const SelectNextTableCell: (props: SelectNextTableCellProps) => import("react/jsx-runtime").JSX.Element;
|