@ogcio/design-system-react 1.12.3 → 1.13.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 (96) hide show
  1. package/dist/accordion/accordion-item.js +1 -1
  2. package/dist/alert/alert.js +1 -1
  3. package/dist/autocomplete/autocomplete.js +124 -198
  4. package/dist/autocomplete/types.d.ts +23 -5
  5. package/dist/autocomplete/use-autocomplete-controller.d.ts +10 -0
  6. package/dist/autocomplete/use-autocomplete-controller.js +125 -0
  7. package/dist/button/helpers.d.ts +1 -1
  8. package/dist/button/helpers.js +14 -12
  9. package/dist/button/types.d.ts +1 -1
  10. package/dist/button-group/button-group.d.ts +1 -0
  11. package/dist/button-group/button-group.js +67 -60
  12. package/dist/card/card-next.js +28 -28
  13. package/dist/checkbox/checkbox.d.ts +7 -1
  14. package/dist/combo-box/dropdown-item.js +30 -30
  15. package/dist/data-grid/editable-table-cell.d.ts +3 -0
  16. package/dist/data-grid/editable-table-cell.js +73 -0
  17. package/dist/data-grid/tanstack/tanstack-helpers.d.ts +11 -0
  18. package/dist/data-grid/tanstack/tanstack-helpers.js +1799 -0
  19. package/dist/data-grid/types.d.ts +20 -0
  20. package/dist/data-grid/types.js +1 -0
  21. package/dist/drawer/drawer.content.js +6 -6
  22. package/dist/drawer/drawer.js +8 -8
  23. package/dist/error-text/error-text.js +1 -1
  24. package/dist/forms/form-field/form-field.js +15 -15
  25. package/dist/forms/form-field-with-tag/form-field-with-tag.js +1 -1
  26. package/dist/header/components/header-slot.js +38 -27
  27. package/dist/header/header.js +5 -5
  28. package/dist/heading/heading.js +1 -1
  29. package/dist/hint-text/hint-text.js +1 -1
  30. package/dist/hooks/use-aria-hider.d.ts +1 -0
  31. package/dist/hooks/use-aria-hider.js +20 -0
  32. package/dist/hooks/use-focus-trap.d.ts +2 -0
  33. package/dist/hooks/use-focus-trap.js +678 -0
  34. package/dist/icon/icon.js +32 -32
  35. package/dist/icon/icons.d.ts +2 -2
  36. package/dist/icon/icons.js +5 -1
  37. package/dist/icon/svgs/placeholder.js +2 -2
  38. package/dist/icon-button/icon-button.js +17 -17
  39. package/dist/index-2sRBqKFV.js +78 -0
  40. package/dist/{index-DNkhmzZp.js → index-CB-zPpNk.js} +44 -44
  41. package/dist/index.d.ts +6 -4
  42. package/dist/index.js +135 -130
  43. package/dist/input-checkbox/input-checkbox.d.ts +9 -2
  44. package/dist/input-checkbox/input-checkbox.js +65 -42
  45. package/dist/input-checkbox/types.d.ts +5 -0
  46. package/dist/input-checkbox-group/input-checkbox-group.js +22 -16
  47. package/dist/input-checkbox-group/types.d.ts +1 -0
  48. package/dist/input-radio/input-radio.js +15 -15
  49. package/dist/input-radio-group/input-radio-group.js +24 -17
  50. package/dist/input-radio-group/types.d.ts +1 -0
  51. package/dist/input-text/input-text.d.ts +22 -0
  52. package/dist/input-text/input-text.js +121 -100
  53. package/dist/input-text/type.d.ts +5 -0
  54. package/dist/label/label.js +1 -1
  55. package/dist/link/link.js +1 -1
  56. package/dist/list/list.js +2 -2
  57. package/dist/lodash-D1c5hFAM.js +3677 -0
  58. package/dist/modal/modal.content.js +1 -1
  59. package/dist/modal/modal.js +141 -127
  60. package/dist/popover/popover.js +464 -466
  61. package/dist/primitives/anchor.js +1 -1
  62. package/dist/progress-bar/progress-bar.js +8 -8
  63. package/dist/progress-stepper/progress-stepper.js +12 -12
  64. package/dist/score-select/score-select.js +3 -3
  65. package/dist/select/select-menu.d.ts +1 -1
  66. package/dist/select/select-menu.js +96 -90
  67. package/dist/select/select-native.d.ts +5 -2
  68. package/dist/select/select-native.js +45 -15
  69. package/dist/select/select-next.d.ts +3 -2
  70. package/dist/select/select-next.js +125 -92
  71. package/dist/select/select-search.d.ts +3 -0
  72. package/dist/select/select-search.js +24 -0
  73. package/dist/select/select.d.ts +4 -2
  74. package/dist/select/select.js +3 -2
  75. package/dist/select/types.d.ts +22 -0
  76. package/dist/side-nav/side-nav.js +23 -23
  77. package/dist/spinner/spinner.js +1 -1
  78. package/dist/stack/stack.js +40 -49
  79. package/dist/styles.css +2 -3
  80. package/dist/table/index.d.ts +8 -0
  81. package/dist/table/index.js +19 -0
  82. package/dist/table/table-data.d.ts +16 -2
  83. package/dist/table/table-data.js +64 -17
  84. package/dist/table/table-header.d.ts +4 -1
  85. package/dist/table/table-header.js +58 -18
  86. package/dist/table/table-pagination.d.ts +8 -0
  87. package/dist/table/table-pagination.js +97 -0
  88. package/dist/table/table-row.js +7 -6
  89. package/dist/table/table.d.ts +4 -1
  90. package/dist/table/table.js +22 -15
  91. package/dist/text-input/text-input.d.ts +1 -0
  92. package/dist/textarea/textarea.js +18 -17
  93. package/dist/toast/ds-toast.js +1 -1
  94. package/dist/tooltip/tooltip.js +1 -1
  95. package/package.json +5 -5
  96. package/dist/index-ntYL1VRC.js +0 -64
@@ -1,4 +1,4 @@
1
- import { jsxs as i, Fragment as r, jsx as t } from "react/jsx-runtime";
1
+ import { jsxs as i, jsx as t, Fragment as r } from "react/jsx-runtime";
2
2
  import { Button as o } from "../button/button.js";
3
3
  import { ModalTitle as e, ModalBody as a, ModalFooter as n } from "./modal.js";
4
4
  const c = /* @__PURE__ */ i(r, { children: [
@@ -1,129 +1,134 @@
1
1
  "use client";
2
- import { jsx as r, jsxs as p, Fragment as T } from "react/jsx-runtime";
3
- import { Children as x, cloneElement as f, isValidElement as k, useState as F } from "react";
2
+ import { jsx as e, jsxs as g, Fragment as B } from "react/jsx-runtime";
3
+ import { useState as x, cloneElement as f, isValidElement as b, useRef as I, Children as E } from "react";
4
+ import { createPortal as H } from "react-dom";
4
5
  import { Button as A } from "../button/button.js";
5
- import { cn as s } from "../cn.js";
6
- import { Heading as I } from "../heading/heading.js";
7
- import { Icon as E } from "../icon/icon.js";
8
- import { IconButton as R } from "../icon-button/icon-button.js";
9
- const v = (e, a, t) => {
10
- var i;
11
- return k(t) ? t.type === e || ((i = t == null ? void 0 : t._owner) == null ? void 0 : i.name) === a : !1;
12
- }, B = {
6
+ import { cn as c } from "../cn.js";
7
+ import { Heading as O } from "../heading/heading.js";
8
+ import { useAriaHider as P } from "../hooks/use-aria-hider.js";
9
+ import { useFocusTrap as S } from "../hooks/use-focus-trap.js";
10
+ import { Icon as V } from "../icon/icon.js";
11
+ import { IconButton as _ } from "../icon-button/icon-button.js";
12
+ const h = (o, t, a) => {
13
+ var l;
14
+ return b(a) ? a.type === o || ((l = a == null ? void 0 : a._owner) == null ? void 0 : l.name) === t : !1;
15
+ }, T = {
13
16
  flat: 0,
14
17
  secondary: 1,
15
18
  primary: 2
16
- }, O = ({
17
- label: e,
18
- size: a = "small",
19
- ...t
19
+ }, w = ({
20
+ label: o,
21
+ size: t = "small",
22
+ ...a
20
23
  }) => {
21
24
  let n = "sm";
22
- return (a === "large" || a === "medium") && (n = "md"), e ? /* @__PURE__ */ r(
25
+ return (t === "large" || t === "medium") && (n = "md"), o ? /* @__PURE__ */ e(
23
26
  A,
24
27
  {
25
- onClick: t.onClick,
28
+ onClick: a.onClick,
26
29
  variant: "flat",
27
- size: a,
30
+ size: t,
28
31
  appearance: "dark",
29
32
  className: "gi-modal-icon",
30
- "aria-label": e,
31
- ...t,
32
- children: /* @__PURE__ */ p(T, { children: [
33
- e,
34
- /* @__PURE__ */ r(E, { icon: "close", size: n })
33
+ "aria-label": o,
34
+ ...a,
35
+ children: /* @__PURE__ */ g(B, { children: [
36
+ o,
37
+ /* @__PURE__ */ e(V, { icon: "close", size: n })
35
38
  ] })
36
39
  }
37
- ) : /* @__PURE__ */ r(
38
- R,
40
+ ) : /* @__PURE__ */ e(
41
+ _,
39
42
  {
40
43
  className: "gi-modal-icon",
41
44
  icon: {
42
45
  icon: "close"
43
46
  },
44
47
  "aria-label": "Close modal",
45
- onClick: t.onClick,
48
+ onClick: a.onClick,
46
49
  variant: "flat",
47
- size: a,
50
+ size: t,
48
51
  appearance: "dark",
49
- ...t
52
+ ...a
50
53
  }
51
54
  );
52
- }, V = ({
53
- position: e = "center",
54
- size: a = "lg",
55
- closeOnClick: t = !0,
55
+ }, D = ({
56
+ position: o = "center",
57
+ size: t = "lg",
58
+ closeOnClick: a = !0,
56
59
  closeOnOverlayClick: n = !0,
57
- isOpen: i,
58
- onClose: c,
59
- closeButtonLabel: d,
60
+ isOpen: l,
61
+ onClose: d,
62
+ closeButtonLabel: s,
60
63
  className: m,
61
- children: o,
62
- closeButtonSize: g,
63
- dataTestId: u,
64
+ children: r,
65
+ closeButtonSize: u,
66
+ dataTestId: p,
64
67
  ...y
65
68
  }) => {
66
- const h = x.toArray(o), C = h.find(
67
- (l) => v(M, "ModalTitle", l)
68
- ), N = h.find(
69
- (l) => v(_, "ModalFooter", l)
70
- ), b = C ? f(C, {
71
- as: a === "sm" ? "h5" : "h4"
72
- }) : null, j = h.map(
73
- (l) => N ? f(l, {
74
- dataModalSize: a
75
- }) : l
76
- ).filter((l) => !v(M, "ModalTitle", l));
77
- return /* @__PURE__ */ r(
69
+ const C = I(null);
70
+ P(C.current, l);
71
+ const v = E.toArray(r), k = v.find(
72
+ (i) => h(N, "ModalTitle", i)
73
+ ), M = v.find(
74
+ (i) => h(W, "ModalFooter", i)
75
+ ), F = k ? f(k, {
76
+ as: t === "sm" ? "h5" : "h4"
77
+ }) : null, j = v.map(
78
+ (i) => M ? f(i, {
79
+ dataModalSize: t
80
+ }) : i
81
+ ).filter((i) => !h(N, "ModalTitle", i));
82
+ return /* @__PURE__ */ e(q, { modalRef: C, isOpen: l, children: /* @__PURE__ */ e(
78
83
  "div",
79
84
  {
80
85
  ...y,
81
- className: s("gi-modal", {
82
- "gi-modal-open": i,
83
- "gi-modal-close": !i
86
+ ref: C,
87
+ className: c("gi-modal", {
88
+ "gi-modal-open": l,
89
+ "gi-modal-close": !l
84
90
  }),
85
- "data-testid": u || "modal",
86
- "data-element": "modal",
87
- role: "dialog",
88
- "aria-modal": "true",
89
- "aria-describedby": "gi-modal-body",
90
- onClick: (l) => {
91
- l.target.dataset.element === "modal" && t && n && c();
91
+ "data-testid": p || "modal",
92
+ onClick: (i) => {
93
+ i.currentTarget === i.target && a && n && d();
92
94
  },
93
- children: /* @__PURE__ */ p(
95
+ children: /* @__PURE__ */ g(
94
96
  "div",
95
97
  {
96
98
  "data-testid": "modal-container",
97
- "data-size": a,
98
- "data-position": e,
99
- className: s(
99
+ role: "dialog",
100
+ "aria-modal": "true",
101
+ "aria-label": "dialog",
102
+ "data-size": t,
103
+ "data-position": o,
104
+ className: c(
100
105
  "gi-modal-container-control",
101
106
  {
102
107
  "gi-modal-container": !m,
103
- "gi-modal-container-center": e === "center",
104
- "gi-modal-container-left": e === "left",
105
- "gi-modal-container-right": e === "right",
106
- "gi-modal-container-bottom": e === "bottom"
108
+ "gi-modal-container-center": o === "center",
109
+ "gi-modal-container-left": o === "left",
110
+ "gi-modal-container-right": o === "right",
111
+ "gi-modal-container-bottom": o === "bottom"
107
112
  },
108
113
  m
109
114
  ),
110
115
  children: [
111
- /* @__PURE__ */ p("div", { children: [
112
- b,
113
- t && /* @__PURE__ */ r(
114
- O,
116
+ /* @__PURE__ */ g("div", { children: [
117
+ F,
118
+ a && /* @__PURE__ */ e(
119
+ w,
115
120
  {
116
- onClick: c,
117
- label: d,
118
- size: g
121
+ onClick: d,
122
+ label: s,
123
+ size: u
119
124
  }
120
125
  )
121
126
  ] }),
122
- /* @__PURE__ */ r(
127
+ /* @__PURE__ */ e(
123
128
  "div",
124
129
  {
125
- className: s({
126
- "gi-pb-6": !N
130
+ className: c({
131
+ "gi-pb-6": !M
127
132
  }),
128
133
  children: j
129
134
  }
@@ -132,55 +137,57 @@ const v = (e, a, t) => {
132
137
  }
133
138
  )
134
139
  }
135
- );
136
- }, M = ({ children: e, as: a = "h4", ...t }) => /* @__PURE__ */ r("div", { className: "gi-flex-1", id: "gi-modal-title", children: /* @__PURE__ */ r(I, { as: a, ...t, children: e }) }), J = ({
137
- children: e,
138
- className: a
139
- }) => /* @__PURE__ */ r(
140
+ ) });
141
+ }, N = ({ children: o, as: t = "h4", ...a }) => /* @__PURE__ */ e("div", { className: "gi-flex-1", id: a.id, "aria-label": o == null ? void 0 : o.toString(), children: /* @__PURE__ */ e(O, { as: t, ...a, children: o }) }), R = ({
142
+ children: o,
143
+ className: t
144
+ }) => /* @__PURE__ */ e(
140
145
  "div",
141
146
  {
142
147
  id: "gi-modal-body",
143
- className: s(
148
+ "aria-label": "Modal content",
149
+ role: "document",
150
+ className: c(
144
151
  {
145
- "gi-modal-body": !a
152
+ "gi-modal-body": !t
146
153
  },
147
- a
154
+ t
148
155
  ),
149
- children: e
156
+ children: o
150
157
  }
151
- ), _ = ({
152
- className: e,
153
- children: a,
154
- orientation: t,
158
+ ), W = ({
159
+ className: o,
160
+ children: t,
161
+ orientation: a,
155
162
  dataModalSize: n
156
163
  }) => {
157
- const d = (Array.isArray(a) ? a : [a]).filter(
158
- (o) => k(o) && o.type === A
159
- ).sort((o, g) => {
160
- const u = o.props.variant ?? "primary", y = g.props.variant ?? "primary";
161
- return (B[u] || 0) - (B[y] || 0);
162
- }), m = s({
163
- "gi-justify-center sm:gi-justify-start": !t && n !== "sm",
164
- "gi-justify-center": t === "vertical" || n === "sm",
165
- "gi-justify-start": t === "horizontal"
164
+ const s = (Array.isArray(t) ? t : [t]).filter(
165
+ (r) => b(r) && r.type === A
166
+ ).sort((r, u) => {
167
+ const p = r.props.variant ?? "primary", y = u.props.variant ?? "primary";
168
+ return (T[p] || 0) - (T[y] || 0);
169
+ }), m = c({
170
+ "gi-justify-center sm:gi-justify-start": !a && n !== "sm",
171
+ "gi-justify-center": a === "vertical" || n === "sm",
172
+ "gi-justify-start": a === "horizontal"
166
173
  });
167
- return /* @__PURE__ */ r(
174
+ return /* @__PURE__ */ e(
168
175
  "div",
169
176
  {
170
- className: s(e, {
171
- "gi-pt-6": d.length === 0,
172
- "gi-modal-footer": d.length
177
+ className: c(o, {
178
+ "gi-pt-6": s.length === 0,
179
+ "gi-modal-footer": s.length
173
180
  }),
174
- children: d.length > 0 && /* @__PURE__ */ r(
181
+ children: s.length > 0 && /* @__PURE__ */ e(
175
182
  "div",
176
183
  {
177
- "data-orientation": t || "unset",
184
+ "data-orientation": a || "unset",
178
185
  "data-modal-size": n,
179
- children: d.map(
180
- (o) => {
181
- var g;
182
- return f(o, {
183
- className: s((g = o == null ? void 0 : o.props) == null ? void 0 : g.className, m)
186
+ children: s.map(
187
+ (r) => {
188
+ var u;
189
+ return f(r, {
190
+ className: c((u = r == null ? void 0 : r.props) == null ? void 0 : u.className, m)
184
191
  });
185
192
  }
186
193
  ) || null
@@ -188,35 +195,42 @@ const v = (e, a, t) => {
188
195
  )
189
196
  }
190
197
  );
191
- }, K = ({
192
- children: e,
193
- triggerButton: a,
194
- startsOpen: t,
198
+ }, q = ({
199
+ children: o,
200
+ modalRef: t,
201
+ isOpen: a
202
+ }) => (S(t == null ? void 0 : t.current, a, {
203
+ initialFocus: !1,
204
+ fallbackFocus: () => t == null ? void 0 : t.current
205
+ }), typeof document > "u" ? null : H(o, document.body)), tt = ({
206
+ children: o,
207
+ triggerButton: t,
208
+ startsOpen: a,
195
209
  ...n
196
210
  }) => {
197
- const [i, c] = F(!!t), d = () => c(!0), m = () => c(!1), o = f(a, {
211
+ const [l, d] = x(!!a), s = () => d(!0), m = () => d(!1), r = f(t, {
198
212
  "data-testid": "modal-trigger-button-container",
199
213
  "aria-haspopup": "dialog",
200
- onClick: d
214
+ onClick: s
201
215
  });
202
- return /* @__PURE__ */ p(T, { children: [
203
- o,
204
- /* @__PURE__ */ r(
205
- V,
216
+ return /* @__PURE__ */ g(B, { children: [
217
+ r,
218
+ /* @__PURE__ */ e(
219
+ D,
206
220
  {
207
221
  onClose: m,
208
222
  position: "center",
209
- isOpen: i,
223
+ isOpen: l,
210
224
  ...n,
211
- children: e
225
+ children: o
212
226
  }
213
227
  )
214
228
  ] });
215
229
  };
216
230
  export {
217
- K as Modal,
218
- J as ModalBody,
219
- _ as ModalFooter,
220
- M as ModalTitle,
221
- V as ModalWrapper
231
+ tt as Modal,
232
+ R as ModalBody,
233
+ W as ModalFooter,
234
+ N as ModalTitle,
235
+ D as ModalWrapper
222
236
  };