@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.
Files changed (46) hide show
  1. package/dist/autocomplete/autocomplete.d.ts +21 -3
  2. package/dist/autocomplete/autocomplete.js +208 -159
  3. package/dist/autocomplete/types.d.ts +8 -4
  4. package/dist/autocomplete/types.js +2 -1
  5. package/dist/autocomplete/use-autocomplete-controller.d.ts +4 -2
  6. package/dist/autocomplete/use-autocomplete-controller.js +123 -79
  7. package/dist/button/button.js +27 -22
  8. package/dist/hooks/use-combined-refs.d.ts +5 -0
  9. package/dist/hooks/use-combined-refs.js +10 -0
  10. package/dist/hooks/use-scroll-highlighted-item.d.ts +1 -0
  11. package/dist/hooks/use-scroll-highlighted-item.js +16 -0
  12. package/dist/icon/icon.js +14 -14
  13. package/dist/icon-button/icon-button.js +14 -12
  14. package/dist/index.d.ts +3 -2
  15. package/dist/list/list.js +1 -1
  16. package/dist/modal/modal.d.ts +8 -2
  17. package/dist/modal/modal.js +155 -134
  18. package/dist/popover/popover.d.ts +1 -1
  19. package/dist/popover/popover.js +296 -286
  20. package/dist/popover/types.d.ts +1 -0
  21. package/dist/popover/utilities.d.ts +2 -0
  22. package/dist/popover/utilities.js +16 -0
  23. package/dist/primitives/button.d.ts +3 -0
  24. package/dist/primitives/button.js +9 -0
  25. package/dist/select/select-menu.d.ts +2 -2
  26. package/dist/select/select-menu.js +96 -99
  27. package/dist/select/select-next.d.ts +13 -2
  28. package/dist/select/select-next.js +182 -167
  29. package/dist/select/select-search.js +17 -17
  30. package/dist/select/types.d.ts +3 -1
  31. package/dist/styles.css +1 -1
  32. package/dist/tabs/scrollable-tab-list.d.ts +9 -0
  33. package/dist/tabs/scrollable-tab-list.js +84 -0
  34. package/dist/tabs/tab-item.d.ts +9 -15
  35. package/dist/tabs/tab-item.js +85 -38
  36. package/dist/tabs/tab-list.d.ts +2 -5
  37. package/dist/tabs/tab-list.js +83 -49
  38. package/dist/tabs/tab-panel.d.ts +2 -7
  39. package/dist/tabs/tab-panel.js +2 -5
  40. package/dist/tabs/tabs.d.ts +2 -7
  41. package/dist/tabs/tabs.js +24 -20
  42. package/dist/tabs/types.d.ts +64 -0
  43. package/dist/tabs/types.js +1 -0
  44. package/dist/textarea/textarea.d.ts +1 -2
  45. package/dist/textarea/textarea.js +60 -61
  46. package/package.json +3 -3
@@ -7,4 +7,5 @@ export type PopoverProps = {
7
7
  onOpenChange: (open: boolean) => void;
8
8
  options?: PopperOptions;
9
9
  extraRefs?: React.RefObject<any>[];
10
+ maxHeight?: number;
10
11
  };
@@ -0,0 +1,2 @@
1
+ import { Modifier } from '@popperjs/core/index.js';
2
+ export declare const createDynamicHeightModifier: (maxHeight?: number) => Modifier<"dynamicHeight", any>;
@@ -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
+ };
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ export type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
3
+ export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,9 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as m } from "react";
3
+ const f = m(
4
+ (o, t) => /* @__PURE__ */ r("button", { ref: t, ...o })
5
+ );
6
+ f.displayName = "Button";
7
+ export {
8
+ f as Button
9
+ };
@@ -1,6 +1,6 @@
1
1
  import { SelectMenuOptionProps, SelectMenuProps } from './types.js';
2
- export declare const SelectMenu: ({ children, className, onChange, enableSearch, isLoading, showNoData, }: SelectMenuProps) => import("react/jsx-runtime").JSX.Element;
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 N, jsx as n } from "react/jsx-runtime";
3
- import { useState as h, useEffect as A, Children as K, isValidElement as P, cloneElement as v } from "react";
4
- import { cn as V } from "../cn.js";
5
- import { translate as q } from "../i18n/utility.js";
6
- import { Icon as H } from "../icon/icon.js";
7
- import { InputText as J } from "../input-text/input-text.js";
8
- import { Label as Q } from "../label/label.js";
9
- import { Spinner as R } from "../spinner/spinner.js";
10
- const re = ({
11
- children: o,
12
- className: i,
13
- onChange: s,
14
- enableSearch: r,
15
- isLoading: c,
16
- showNoData: m
17
- }) => {
18
- const [l, g] = h(""), [S, f] = h(!1), [y, O] = h([]);
19
- A(() => {
20
- f(!1), m && setTimeout(() => f(!0), 0);
21
- }, [m]), A(() => {
22
- const B = K.toArray(o).filter(
23
- (a) => P(a)
24
- ).map((a) => {
25
- var D, L, M, T, I, k;
26
- const F = (D = a == null ? void 0 : a.type) == null ? void 0 : D.componentType, x = l.toLowerCase();
27
- switch (F) {
28
- case "SelectMenuOption": {
29
- const e = a;
30
- if (typeof e.props.value == "string") {
31
- const E = ((T = (M = (L = e == null ? void 0 : e.props) == null ? void 0 : L.children) == null ? void 0 : M.toString()) == null ? void 0 : T.toLowerCase()) || "", G = (k = (I = e == null ? void 0 : e.props) == null ? void 0 : I.value) == null ? void 0 : k.toLowerCase();
32
- if (E.includes(x) || G.includes(x))
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
- break;
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
- case "SelectMenuGroupItem": {
41
- const e = a, j = K.toArray(e.props.children).filter(
42
- (t) => P(t)
43
- ).map((t) => {
44
- var p;
45
- return ((p = t == null ? void 0 : t.type) == null ? void 0 : p.componentType) === "SelectMenuOption" ? v(t, { onChange: s }) : null;
46
- }).filter(
47
- (t) => t !== null
48
- ).filter((t) => {
49
- var C, $, z;
50
- const p = (($ = (C = t.props.children) == null ? void 0 : C.toString()) == null ? void 0 : $.toLowerCase()) || "", d = ((z = t.props.value) == null ? void 0 : z.toLowerCase()) || "";
51
- return (p == null ? void 0 : p.includes(l.toLowerCase())) || (d == null ? void 0 : d.includes(l.toLowerCase()));
52
- });
53
- return j.length > 0 || l === "" ? v(e, {
54
- children: j
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
- default:
58
- return null;
59
- }
60
- }).filter(Boolean);
61
- O(B);
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: l,
87
- hidden: g,
88
- enableSearch: S,
89
- isHighlighted: f,
90
- ...y
81
+ className: g,
82
+ hidden: l,
83
+ enableSearch: y,
84
+ isHighlighted: O,
85
+ index: f,
86
+ ...S
91
87
  }) => {
92
- const O = (u) => {
88
+ const w = (u) => {
93
89
  (u.key === "Enter" || u.key === " ") && (u.preventDefault(), r == null || r(i));
94
- }, w = () => {
90
+ }, h = () => {
95
91
  c || r == null || r(i);
96
92
  };
97
- return g ? null : /* @__PURE__ */ N(
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: O,
106
- onClick: w,
107
- className: V(
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": f
108
+ "gi-select-option-item-highlighted": O
112
109
  },
113
- l
110
+ g
114
111
  ),
115
- "data-search-enabled": S,
112
+ "data-search-enabled": y,
116
113
  "data-testid": m || `option-${i}`,
117
- ...y,
114
+ ...S,
118
115
  children: [
119
116
  /* @__PURE__ */ n("span", { className: "gi-text-sm", children: o }),
120
- s && /* @__PURE__ */ n(H, { icon: "check" })
117
+ s && /* @__PURE__ */ n(J, { icon: "check" })
121
118
  ]
122
119
  },
123
120
  `${o}-${i}`
124
121
  );
125
122
  };
126
- Object.defineProperty(U, "componentType", {
123
+ Object.defineProperty(X, "componentType", {
127
124
  value: "SelectMenuOption",
128
125
  writable: !1,
129
126
  enumerable: !1
130
127
  });
131
- const W = ({
128
+ const Y = ({
132
129
  children: o,
133
130
  label: i,
134
131
  ...s
135
- }) => /* @__PURE__ */ N("div", { ...s, role: "group", className: "gi-px-3", children: [
136
- /* @__PURE__ */ n(Q, { text: i, size: "sm", className: "gi-font-bold gi-pb-1" }),
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(W, "componentType", {
136
+ Object.defineProperty(Y, "componentType", {
140
137
  value: "SelectMenuGroupItem",
141
138
  writable: !1,
142
139
  enumerable: !1
143
140
  });
144
141
  export {
145
- re as SelectMenu,
146
- W as SelectMenuGroupItem,
147
- U as SelectMenuOption
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, SelectNextProps, SelectNextOptionProps, SelectNextTableCellProps } from './types.js';
3
- export declare const SelectNext: ({ children, value: controlledValue, defaultValue, onChange: onSelectNextChange, onMenuClose, enableSearch, disabled, ...props }: SelectNextProps) => import("react/jsx-runtime").JSX.Element;
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;