tgui-core 1.2.0 → 1.3.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 (116) hide show
  1. package/README.md +3 -3
  2. package/dist/common/color.js +31 -30
  3. package/dist/common/events.js +5 -5
  4. package/dist/common/format.js +27 -27
  5. package/dist/common/hotkeys.d.ts +0 -1
  6. package/dist/common/hotkeys.js +2 -2
  7. package/dist/common/math.d.ts +4 -0
  8. package/dist/common/math.js +29 -25
  9. package/dist/common/random.js +14 -13
  10. package/dist/common/react.js +1 -1
  11. package/dist/common/string.js +9 -9
  12. package/dist/common/type-utils.d.ts +1 -1
  13. package/dist/components/AnimatedNumber.d.ts +6 -6
  14. package/dist/components/AnimatedNumber.js +14 -17
  15. package/dist/components/Autofocus.d.ts +0 -1
  16. package/dist/components/Blink.d.ts +0 -1
  17. package/dist/components/BlockQuote.d.ts +0 -1
  18. package/dist/components/BlockQuote.js +4 -7
  19. package/dist/components/Box.d.ts +0 -1
  20. package/dist/components/Box.js +4 -4
  21. package/dist/components/Button.d.ts +0 -1
  22. package/dist/components/Button.js +173 -211
  23. package/dist/components/ByondUi.js +3 -3
  24. package/dist/components/Chart.d.ts +0 -1
  25. package/dist/components/Chart.js +25 -22
  26. package/dist/components/Collapsible.d.ts +0 -1
  27. package/dist/components/ColorBox.d.ts +0 -1
  28. package/dist/components/ColorBox.js +7 -14
  29. package/dist/components/Dialog.js +31 -40
  30. package/dist/components/Dimmer.d.ts +0 -1
  31. package/dist/components/Dimmer.js +6 -9
  32. package/dist/components/Divider.js +10 -14
  33. package/dist/components/DmIcon.d.ts +0 -1
  34. package/dist/components/DraggableControl.js +57 -49
  35. package/dist/components/Dropdown.d.ts +0 -1
  36. package/dist/components/Dropdown.js +73 -67
  37. package/dist/components/FitText.d.ts +0 -1
  38. package/dist/components/Flex.d.ts +1 -1
  39. package/dist/components/Flex.js +39 -41
  40. package/dist/components/Icon.d.ts +0 -1
  41. package/dist/components/Icon.js +27 -34
  42. package/dist/components/Image.d.ts +0 -1
  43. package/dist/components/Image.js +7 -6
  44. package/dist/components/ImageButton.d.ts +0 -1
  45. package/dist/components/ImageButton.js +84 -171
  46. package/dist/components/InfinitePlane.js +1 -1
  47. package/dist/components/Input.d.ts +0 -1
  48. package/dist/components/Input.js +57 -64
  49. package/dist/components/KeyListener.d.ts +0 -1
  50. package/dist/components/Knob.d.ts +0 -1
  51. package/dist/components/Knob.js +91 -117
  52. package/dist/components/LabeledControls.d.ts +0 -1
  53. package/dist/components/LabeledList.d.ts +0 -1
  54. package/dist/components/LabeledList.js +48 -55
  55. package/dist/components/MenuBar.d.ts +0 -1
  56. package/dist/components/MenuBar.js +93 -102
  57. package/dist/components/Modal.d.ts +0 -1
  58. package/dist/components/Modal.js +11 -18
  59. package/dist/components/NoticeBox.d.ts +0 -1
  60. package/dist/components/NoticeBox.js +16 -43
  61. package/dist/components/NumberInput.d.ts +0 -2
  62. package/dist/components/NumberInput.js +99 -107
  63. package/dist/components/Popper.d.ts +0 -1
  64. package/dist/components/ProgressBar.d.ts +0 -1
  65. package/dist/components/ProgressBar.js +22 -27
  66. package/dist/components/RestrictedInput.js +64 -58
  67. package/dist/components/RoundGauge.d.ts +0 -1
  68. package/dist/components/RoundGauge.js +70 -104
  69. package/dist/components/Section.d.ts +1 -2
  70. package/dist/components/Section.js +50 -51
  71. package/dist/components/Slider.d.ts +0 -1
  72. package/dist/components/Slider.js +72 -80
  73. package/dist/components/Stack.d.ts +0 -1
  74. package/dist/components/Stack.js +37 -47
  75. package/dist/components/StyleableSection.d.ts +0 -1
  76. package/dist/components/StyleableSection.js +11 -11
  77. package/dist/components/Table.d.ts +0 -1
  78. package/dist/components/Table.js +38 -47
  79. package/dist/components/Tabs.d.ts +0 -1
  80. package/dist/components/Tabs.js +43 -75
  81. package/dist/components/TextArea.d.ts +0 -1
  82. package/dist/components/TextArea.js +74 -69
  83. package/dist/components/TimeDisplay.d.ts +7 -6
  84. package/dist/components/TimeDisplay.js +17 -17
  85. package/dist/components/Tooltip.d.ts +1 -2
  86. package/dist/components/Tooltip.js +8 -10
  87. package/dist/components/TrackOutsideClicks.d.ts +0 -1
  88. package/dist/components/VirtualList.d.ts +0 -1
  89. package/package.json +11 -25
  90. package/dist/ProgressBar.module-Jzqlebbx.js +0 -29
  91. package/dist/Section.module-qhQWhlUX.js +0 -18
  92. package/dist/assets/BlockQuote.css +0 -1
  93. package/dist/assets/Button.css +0 -1
  94. package/dist/assets/ColorBox.css +0 -1
  95. package/dist/assets/Dialog.css +0 -1
  96. package/dist/assets/Dimmer.css +0 -1
  97. package/dist/assets/Divider.css +0 -1
  98. package/dist/assets/Flex.css +0 -1
  99. package/dist/assets/Icon.css +0 -6
  100. package/dist/assets/ImageButton.css +0 -5
  101. package/dist/assets/Input.css +0 -1
  102. package/dist/assets/Knob.css +0 -1
  103. package/dist/assets/LabeledList.css +0 -1
  104. package/dist/assets/MenuBar.css +0 -1
  105. package/dist/assets/Modal.css +0 -1
  106. package/dist/assets/NoticeBox.css +0 -1
  107. package/dist/assets/NumberInput.css +0 -1
  108. package/dist/assets/ProgressBar.css +0 -1
  109. package/dist/assets/RoundGauge.css +0 -1
  110. package/dist/assets/Section.css +0 -1
  111. package/dist/assets/Slider.css +0 -1
  112. package/dist/assets/Stack.css +0 -1
  113. package/dist/assets/Table.css +0 -1
  114. package/dist/assets/Tabs.css +0 -1
  115. package/dist/assets/TextArea.css +0 -1
  116. package/dist/assets/Tooltip.css +0 -1
@@ -1,22 +1,13 @@
1
- import { jsx as t, jsxs as c } from "react/jsx-runtime";
2
- import { Box as s } from "./Box.js";
3
- import { Button as a } from "./Button.js";
4
- import '../assets/Dialog.css';const m = "_dialog_1hdv8_5", v = "_content_1hdv8_17", u = "_header_1hdv8_25", g = "_title_1hdv8_33", p = "_body_1hdv8_42", C = "_footer_1hdv8_47", f = "_button_1hdv8_55", o = {
5
- dialog: m,
6
- content: v,
7
- header: u,
8
- title: g,
9
- body: p,
10
- footer: C,
11
- button: f
12
- };
13
- function h(n) {
14
- const { title: e, onClose: i, children: r, width: l, height: _ } = n;
15
- return /* @__PURE__ */ t("div", { className: o.dialog, children: /* @__PURE__ */ c(s, { className: o.content, width: l || "370px", height: _, children: [
16
- /* @__PURE__ */ c("div", { className: o.header, children: [
17
- /* @__PURE__ */ t("div", { className: o.title, children: e }),
18
- /* @__PURE__ */ t(s, { mr: 2, children: /* @__PURE__ */ t(
19
- a,
1
+ import { jsx as o, jsxs as e } from "react/jsx-runtime";
2
+ import { Box as r } from "./Box.js";
3
+ import { Button as s } from "./Button.js";
4
+ function d(i) {
5
+ const { title: n, onClose: t, children: c, width: l, height: h } = i;
6
+ return /* @__PURE__ */ o("div", { className: "Dialog", children: /* @__PURE__ */ e(r, { className: "Dialog__content", width: l || "370px", height: h, children: [
7
+ /* @__PURE__ */ e("div", { className: "Dialog__header", children: [
8
+ /* @__PURE__ */ o("div", { className: "Dialog__title", children: n }),
9
+ /* @__PURE__ */ o(r, { mr: 2, children: /* @__PURE__ */ o(
10
+ s,
20
11
  {
21
12
  mr: "-3px",
22
13
  width: "26px",
@@ -26,42 +17,42 @@ function h(n) {
26
17
  icon: "window-close-o",
27
18
  tooltip: "Close",
28
19
  tooltipPosition: "bottom-start",
29
- onClick: i
20
+ onClick: t
30
21
  }
31
22
  ) })
32
23
  ] }),
33
- r
24
+ c
34
25
  ] }) });
35
26
  }
36
- function d(n) {
37
- const { onClick: e, children: i } = n;
38
- return /* @__PURE__ */ t(
39
- a,
27
+ function a(i) {
28
+ const { onClick: n, children: t } = i;
29
+ return /* @__PURE__ */ o(
30
+ s,
40
31
  {
41
- onClick: e,
42
- className: o.button,
32
+ onClick: n,
33
+ className: "Dialog__button",
43
34
  verticalAlignContent: "middle",
44
- children: i
35
+ children: t
45
36
  }
46
37
  );
47
38
  }
48
- h.Button = d;
49
- function w(n) {
50
- const { documentName: e, onSave: i, onDiscard: r, onClose: l } = n;
51
- return /* @__PURE__ */ c(h, { title: "Notepad", onClose: l, children: [
52
- /* @__PURE__ */ c("div", { className: o.body, children: [
39
+ d.Button = a;
40
+ function p(i) {
41
+ const { documentName: n, onSave: t, onDiscard: c, onClose: l } = i;
42
+ return /* @__PURE__ */ e(d, { title: "Notepad", onClose: l, children: [
43
+ /* @__PURE__ */ e("div", { className: "Dialog__body", children: [
53
44
  "Do you want to save changes to ",
54
- e,
45
+ n,
55
46
  "?"
56
47
  ] }),
57
- /* @__PURE__ */ c("div", { className: o.footer, children: [
58
- /* @__PURE__ */ t(d, { onClick: i, children: "Save" }),
59
- /* @__PURE__ */ t(d, { onClick: r, children: "Don't Save" }),
60
- /* @__PURE__ */ t(d, { onClick: l, children: "Cancel" })
48
+ /* @__PURE__ */ e("div", { className: "Dialog__footer", children: [
49
+ /* @__PURE__ */ o(a, { onClick: t, children: "Save" }),
50
+ /* @__PURE__ */ o(a, { onClick: c, children: "Don't Save" }),
51
+ /* @__PURE__ */ o(a, { onClick: l, children: "Cancel" })
61
52
  ] })
62
53
  ] });
63
54
  }
64
55
  export {
65
- h as Dialog,
66
- w as UnsavedChangesDialog
56
+ d as Dialog,
57
+ p as UnsavedChangesDialog
67
58
  };
@@ -1,3 +1,2 @@
1
1
  import { BoxProps } from './Box';
2
-
3
2
  export declare function Dimmer(props: BoxProps): import("react/jsx-runtime").JSX.Element;
@@ -1,13 +1,10 @@
1
- import { jsx as m } from "react/jsx-runtime";
1
+ import { jsx as r } from "react/jsx-runtime";
2
2
  import { classes as o } from "../common/react.js";
3
- import { Box as t } from "./Box.js";
4
- import '../assets/Dimmer.css';const c = "_dimmer_ldz2o_5", n = {
5
- dimmer: c
6
- };
7
- function _(r) {
8
- const { className: e, children: s, ...i } = r;
9
- return /* @__PURE__ */ m(t, { className: o([n.dimmer, e]), ...i, children: /* @__PURE__ */ m("div", { className: "Dimmer__inner", children: s }) });
3
+ import { Box as c } from "./Box.js";
4
+ function l(m) {
5
+ const { className: e, children: s, ...i } = m;
6
+ return /* @__PURE__ */ r(c, { className: o(["Dimmer", e]), ...i, children: /* @__PURE__ */ r("div", { className: "Dimmer__inner", children: s }) });
10
7
  }
11
8
  export {
12
- _ as Dimmer
9
+ l as Dimmer
13
10
  };
@@ -1,22 +1,18 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { classes as e } from "../common/react.js";
3
- import '../assets/Divider.css';const d = "_horizontal_1dhv5_9", c = "_hidden_1dhv5_12", s = "_vertical_1dhv5_16", i = {
4
- horizontal: d,
5
- hidden: c,
6
- vertical: s
7
- };
8
- function l(t) {
9
- const { hidden: o, vertical: n } = t;
10
- return /* @__PURE__ */ r(
1
+ import { jsx as d } from "react/jsx-runtime";
2
+ import { classes as o } from "../common/react.js";
3
+ function n(i) {
4
+ const { hidden: r, vertical: e } = i;
5
+ return /* @__PURE__ */ d(
11
6
  "div",
12
7
  {
13
- className: e([
14
- o && i.hidden,
15
- n ? i.vertical : i.horizontal
8
+ className: o([
9
+ "Divider",
10
+ r && "Divider--hidden",
11
+ e ? "Divider--vertical" : "Divider--horizontal"
16
12
  ])
17
13
  }
18
14
  );
19
15
  }
20
16
  export {
21
- l as Divider
17
+ n as Divider
22
18
  };
@@ -1,6 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { BoxProps } from './Box';
3
-
4
3
  declare enum Direction {
5
4
  NORTH = 1,
6
5
  SOUTH = 2,
@@ -1,14 +1,14 @@
1
- import { jsxs as T, Fragment as N, jsx as F } from "react/jsx-runtime";
2
- import { clamp as m } from "../common/math.js";
3
- import { Component as b, createRef as I } from "react";
1
+ import { jsxs as T, Fragment as I, jsx as F } from "react/jsx-runtime";
2
+ import { Component as x, createRef as y } from "react";
3
+ import { clamp as c } from "../common/math.js";
4
4
  import { AnimatedNumber as M } from "./AnimatedNumber.js";
5
5
  const R = 400;
6
- function S(v, u) {
6
+ function N(v, u) {
7
7
  return v.screenX * u[0] + v.screenY * u[1];
8
8
  }
9
- class C extends b {
9
+ class C extends x {
10
10
  constructor(u) {
11
- super(u), this.inputRef = I(), this.state = {
11
+ super(u), this.inputRef = y(), this.state = {
12
12
  value: u.value,
13
13
  dragging: !1,
14
14
  editing: !1,
@@ -28,7 +28,7 @@ class C extends b {
28
28
  const { value: i, dragMatrix: l } = this.props, { editing: s } = this.state;
29
29
  s || (document.body.style["pointer-events"] = "none", this.ref = e.target, this.setState({
30
30
  dragging: !1,
31
- origin: S(e, l),
31
+ origin: N(e, l),
32
32
  value: i,
33
33
  internalValue: i
34
34
  }), this.timer = setTimeout(() => {
@@ -36,26 +36,26 @@ class C extends b {
36
36
  dragging: !0
37
37
  });
38
38
  }, 250), this.dragInterval = setInterval(() => {
39
- const { dragging: o, value: g } = this.state, { onDrag: a } = this.props;
40
- o && a && a(e, g);
39
+ const { dragging: o, value: g } = this.state, { onDrag: r } = this.props;
40
+ o && r && r(e, g);
41
41
  }, this.props.updateRate || R), document.addEventListener("mousemove", this.handleDragMove), document.addEventListener("mouseup", this.handleDragEnd));
42
42
  }, this.handleDragMove = (e) => {
43
43
  const { minValue: i, maxValue: l, step: s, stepPixelSize: o, dragMatrix: g } = this.props;
44
- this.setState((a) => {
45
- const n = { ...a }, p = S(e, g) - n.origin;
46
- if (a.dragging) {
44
+ this.setState((r) => {
45
+ const a = { ...r }, p = N(e, g) - a.origin;
46
+ if (r.dragging) {
47
47
  const h = Number.isFinite(i) ? i % s : 0;
48
- n.internalValue = m(
49
- n.internalValue + p * s / o,
48
+ a.internalValue = c(
49
+ a.internalValue + p * s / o,
50
50
  i - s,
51
51
  l + s
52
- ), n.value = m(
53
- n.internalValue - n.internalValue % s + h,
52
+ ), a.value = c(
53
+ a.internalValue - a.internalValue % s + h,
54
54
  i,
55
55
  l
56
- ), n.origin = S(e, g);
57
- } else Math.abs(p) > 4 && (n.dragging = !0);
58
- return n;
56
+ ), a.origin = N(e, g);
57
+ } else Math.abs(p) > 4 && (a.dragging = !0);
58
+ return a;
59
59
  });
60
60
  }, this.handleDragEnd = (e) => {
61
61
  const { onChange: i, onDrag: l } = this.props, { dragging: s, value: o, internalValue: g } = this.state;
@@ -66,9 +66,9 @@ class C extends b {
66
66
  }), document.removeEventListener("mousemove", this.handleDragMove), document.removeEventListener("mouseup", this.handleDragEnd), s)
67
67
  this.suppressFlicker(), i && i(e, o), l && l(e, o);
68
68
  else if (this.inputRef) {
69
- const a = this.inputRef.current;
70
- a.value = g, setTimeout(() => {
71
- a.focus(), a.select();
69
+ const r = this.inputRef.current;
70
+ r.value = g, setTimeout(() => {
71
+ r.focus(), r.select();
72
72
  }, 10);
73
73
  }
74
74
  };
@@ -83,39 +83,43 @@ class C extends b {
83
83
  animated: s,
84
84
  value: o,
85
85
  unit: g,
86
- minValue: a,
87
- maxValue: n,
86
+ minValue: r,
87
+ maxValue: a,
88
88
  unclamped: p,
89
89
  format: h,
90
- onChange: f,
91
- onDrag: c,
92
- children: D,
90
+ onChange: m,
91
+ onDrag: f,
92
+ children: S,
93
93
  // Input props
94
- height: k,
95
- lineHeight: V,
96
- fontSize: y
94
+ height: V,
95
+ lineHeight: D,
96
+ fontSize: b
97
97
  } = this.props;
98
98
  let d = o;
99
99
  (u || l) && (d = i);
100
- const E = /* @__PURE__ */ T(N, { children: [
100
+ const k = /* @__PURE__ */ T(I, { children: [
101
101
  s && !u && !l ? /* @__PURE__ */ F(M, { value: d, format: h }) : h ? h(d) : d,
102
- g ? " " + g : ""
103
- ] }), x = /* @__PURE__ */ F(
102
+ g ? ` ${g}` : ""
103
+ ] }), E = /* @__PURE__ */ F(
104
104
  "input",
105
105
  {
106
106
  ref: this.inputRef,
107
107
  className: "NumberInput__input",
108
108
  style: {
109
109
  display: e ? void 0 : "none",
110
- height: k,
111
- lineHeight: V,
112
- fontsize: y
110
+ height: V,
111
+ lineHeight: D,
112
+ fontsize: b
113
113
  },
114
- onBlur: (r) => {
114
+ onBlur: (n) => {
115
115
  if (!e)
116
116
  return;
117
117
  let t;
118
- if (p ? t = parseFloat(r.target.value) : t = m(parseFloat(r.target.value), a, n), Number.isNaN(t)) {
118
+ if (p ? t = Number.parseFloat(n.target.value) : t = c(
119
+ Number.parseFloat(n.target.value),
120
+ r,
121
+ a
122
+ ), Number.isNaN(t)) {
119
123
  this.setState({
120
124
  editing: !1
121
125
  });
@@ -124,12 +128,16 @@ class C extends b {
124
128
  this.setState({
125
129
  editing: !1,
126
130
  value: t
127
- }), this.suppressFlicker(), f && f(r, t), c && c(r, t);
131
+ }), this.suppressFlicker(), m && m(n, t), f && f(n, t);
128
132
  },
129
- onKeyDown: (r) => {
130
- if (r.keyCode === 13) {
133
+ onKeyDown: (n) => {
134
+ if (n.keyCode === 13) {
131
135
  let t;
132
- if (p ? t = parseFloat(r.target.value) : t = m(parseFloat(r.target.value), a, n), Number.isNaN(t)) {
136
+ if (p ? t = Number.parseFloat(n.target.value) : t = c(
137
+ Number.parseFloat(n.target.value),
138
+ r,
139
+ a
140
+ ), Number.isNaN(t)) {
133
141
  this.setState({
134
142
  editing: !1
135
143
  });
@@ -138,10 +146,10 @@ class C extends b {
138
146
  this.setState({
139
147
  editing: !1,
140
148
  value: t
141
- }), this.suppressFlicker(), f && f(r, t), c && c(r, t);
149
+ }), this.suppressFlicker(), m && m(n, t), f && f(n, t);
142
150
  return;
143
151
  }
144
- if (r.keyCode === 27) {
152
+ if (n.keyCode === 27) {
145
153
  this.setState({
146
154
  editing: !1
147
155
  });
@@ -150,20 +158,20 @@ class C extends b {
150
158
  }
151
159
  }
152
160
  );
153
- return D({
161
+ return S({
154
162
  dragging: u,
155
163
  editing: e,
156
164
  value: o,
157
165
  displayValue: d,
158
- displayElement: E,
159
- inputElement: x,
166
+ displayElement: k,
167
+ inputElement: E,
160
168
  handleDragStart: this.handleDragStart
161
169
  });
162
170
  }
163
171
  }
164
172
  C.defaultProps = {
165
- minValue: -1 / 0,
166
- maxValue: 1 / 0,
173
+ minValue: Number.NEGATIVE_INFINITY,
174
+ maxValue: Number.POSITIVE_INFINITY,
167
175
  step: 1,
168
176
  stepPixelSize: 1,
169
177
  suppressFlicker: 50,
@@ -1,6 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { BoxProps } from './Box';
3
-
4
3
  export type DropdownEntry = {
5
4
  displayText: ReactNode;
6
5
  value: string | number;
@@ -1,141 +1,147 @@
1
- import { jsx as o, jsxs as m, Fragment as W } from "react/jsx-runtime";
2
- import { useState as F, useRef as L, useEffect as q } from "react";
3
- import { classes as y } from "../common/react.js";
4
- import { unit as z } from "./Box.js";
1
+ import { jsx as l, jsxs as p, Fragment as W } from "react/jsx-runtime";
2
+ import { useState as F, useRef as L, useEffect as S } from "react";
3
+ import { classes as N } from "../common/react.js";
4
+ import { unit as $ } from "./Box.js";
5
5
  import { Button as D } from "./Button.js";
6
6
  import { Icon as b } from "./Icon.js";
7
- import { Popper as A } from "./Popper.js";
8
- const G = -1;
9
- function f(d) {
10
- return typeof d == "string" ? d : d.value;
7
+ import { Popper as q } from "./Popper.js";
8
+ const z = -1;
9
+ function h(u) {
10
+ return typeof u == "string" ? u : u.value;
11
11
  }
12
- function Y(d) {
12
+ function X(u) {
13
13
  const {
14
- autoScroll: w = !0,
14
+ autoScroll: v = !0,
15
15
  buttons: I,
16
16
  className: O,
17
17
  clipSelectedText: k = !0,
18
18
  color: B = "default",
19
- disabled: a,
20
- displayText: C,
19
+ disabled: d,
20
+ displayText: E,
21
21
  icon: x,
22
22
  iconRotation: T,
23
23
  iconSpin: j,
24
- menuWidth: R = "15rem",
25
- noChevron: S,
26
- onClick: p,
27
- onSelected: i,
28
- options: r = [],
29
- over: g,
30
- placeholder: E = "Select...",
31
- selected: u,
24
+ menuWidth: C = "15rem",
25
+ noChevron: R,
26
+ onClick: a,
27
+ onSelected: o,
28
+ options: c = [],
29
+ over: y,
30
+ placeholder: K = "Select...",
31
+ selected: m,
32
32
  width: P = "15rem"
33
- } = d, [l, h] = F(!1), V = g ? !l : l, v = L(null), s = r.findIndex((e) => f(e) === u) || 0;
34
- function _(e) {
35
- var c;
36
- let t = e;
37
- e < s ? t = e < 2 ? 0 : e - 2 : t = e > r.length - 3 ? r.length - 1 : e - 2;
38
- const n = (c = v.current) == null ? void 0 : c.children[t];
33
+ } = u, [r, f] = F(!1), V = y ? !r : r, w = L(null), i = c.findIndex((e) => h(e) === m) || 0;
34
+ function g(e) {
35
+ var t;
36
+ let s = e;
37
+ e < i ? s = e < 2 ? 0 : e - 2 : s = e > c.length - 3 ? c.length - 1 : e - 2;
38
+ const n = (t = w.current) == null ? void 0 : t.children[s];
39
39
  n == null || n.scrollIntoView({ block: "nearest" });
40
40
  }
41
- function N(e) {
42
- if (r.length < 1 || a)
41
+ function _(e) {
42
+ if (c.length < 1 || d)
43
43
  return;
44
- const t = 0, n = r.length - 1;
45
- let c;
46
- s < 0 ? c = e === "next" ? n : t : e === "next" ? c = s === n ? t : s + 1 : c = s === t ? n : s - 1, l && w && _(c), i == null || i(f(r[c]));
44
+ const s = 0, n = c.length - 1;
45
+ let t;
46
+ i < 0 ? t = e === "next" ? n : s : e === "next" ? t = i === n ? s : i + 1 : t = i === s ? n : i - 1, r && v && g(t), o == null || o(h(c[t]));
47
47
  }
48
- return q(() => {
48
+ return S(() => {
49
49
  var e;
50
- l && (w && s !== G && _(s), (e = v.current) == null || e.focus());
51
- }, [l]), /* @__PURE__ */ o(
52
- A,
50
+ r && (v && i !== z && g(i), (e = w.current) == null || e.focus());
51
+ }, [r]), /* @__PURE__ */ l(
52
+ q,
53
53
  {
54
- isOpen: l,
55
- onClickOutside: () => h(!1),
56
- placement: g ? "top-start" : "bottom-start",
57
- content: /* @__PURE__ */ m(
54
+ isOpen: r,
55
+ onClickOutside: () => f(!1),
56
+ placement: y ? "top-start" : "bottom-start",
57
+ content: /* @__PURE__ */ p(
58
58
  "div",
59
59
  {
60
60
  className: "Layout Dropdown__menu",
61
- style: { minWidth: R },
62
- ref: v,
61
+ style: { minWidth: C },
62
+ ref: w,
63
63
  children: [
64
- r.length === 0 && /* @__PURE__ */ o("div", { className: "Dropdown__menuentry", children: "No options" }),
65
- r.map((e, t) => {
66
- const n = f(e);
67
- return /* @__PURE__ */ o(
64
+ c.length === 0 && /* @__PURE__ */ l("div", { className: "Dropdown__menuentry", children: "No options" }),
65
+ c.map((e, s) => {
66
+ const n = h(e);
67
+ return /* @__PURE__ */ l(
68
68
  "div",
69
69
  {
70
- className: y([
70
+ className: N([
71
71
  "Dropdown__menuentry",
72
- u === n && "selected"
72
+ m === n && "selected"
73
73
  ]),
74
74
  onClick: () => {
75
- h(!1), i == null || i(n);
75
+ f(!1), o == null || o(n);
76
+ },
77
+ onKeyDown: (t) => {
78
+ t.key === "Enter" && (f(!1), o == null || o(n));
76
79
  },
77
80
  children: typeof e == "string" ? e : e.displayText
78
81
  },
79
- t
82
+ s
80
83
  );
81
84
  })
82
85
  ]
83
86
  }
84
87
  ),
85
- children: /* @__PURE__ */ m("div", { className: "Dropdown", style: { width: z(P) }, children: [
86
- /* @__PURE__ */ m(
88
+ children: /* @__PURE__ */ p("div", { className: "Dropdown", style: { width: $(P) }, children: [
89
+ /* @__PURE__ */ p(
87
90
  "div",
88
91
  {
89
- className: y([
92
+ className: N([
90
93
  "Dropdown__control",
91
94
  "Button",
92
95
  "Button--dropdown",
93
- "Button--color--" + B,
94
- a && "Button--disabled",
96
+ `Button--color--${B}`,
97
+ d && "Button--disabled",
95
98
  O
96
99
  ]),
97
100
  onClick: (e) => {
98
- a && !l || (h(!l), p == null || p(e));
101
+ d && !r || (f(!r), a == null || a(e));
102
+ },
103
+ onKeyDown: (e) => {
104
+ e.key === "Enter" && !d && (f(!r), a == null || a(e));
99
105
  },
100
106
  children: [
101
- x && /* @__PURE__ */ o(b, { mr: 1, name: x, rotation: T, spin: j }),
102
- /* @__PURE__ */ o(
107
+ x && /* @__PURE__ */ l(b, { mr: 1, name: x, rotation: T, spin: j }),
108
+ /* @__PURE__ */ l(
103
109
  "span",
104
110
  {
105
111
  className: "Dropdown__selected-text",
106
112
  style: {
107
113
  overflow: k ? "hidden" : "visible"
108
114
  },
109
- children: C || u && f(u) || E
115
+ children: E || m && h(m) || K
110
116
  }
111
117
  ),
112
- !S && /* @__PURE__ */ o("span", { className: "Dropdown__arrow-button", children: /* @__PURE__ */ o(b, { name: V ? "chevron-up" : "chevron-down" }) })
118
+ !R && /* @__PURE__ */ l("span", { className: "Dropdown__arrow-button", children: /* @__PURE__ */ l(b, { name: V ? "chevron-up" : "chevron-down" }) })
113
119
  ]
114
120
  }
115
121
  ),
116
- I && /* @__PURE__ */ m(W, { children: [
117
- /* @__PURE__ */ o(
122
+ I && /* @__PURE__ */ p(W, { children: [
123
+ /* @__PURE__ */ l(
118
124
  D,
119
125
  {
120
- disabled: a,
126
+ disabled: d,
121
127
  height: 1.8,
122
128
  icon: "chevron-left",
123
129
  onClick: () => {
124
- N(
130
+ _(
125
131
  "previous"
126
132
  /* Previous */
127
133
  );
128
134
  }
129
135
  }
130
136
  ),
131
- /* @__PURE__ */ o(
137
+ /* @__PURE__ */ l(
132
138
  D,
133
139
  {
134
- disabled: a,
140
+ disabled: d,
135
141
  height: 1.8,
136
142
  icon: "chevron-right",
137
143
  onClick: () => {
138
- N(
144
+ _(
139
145
  "next"
140
146
  /* Next */
141
147
  );
@@ -148,5 +154,5 @@ function Y(d) {
148
154
  );
149
155
  }
150
156
  export {
151
- Y as Dropdown
157
+ X as Dropdown
152
158
  };
@@ -1,5 +1,4 @@
1
1
  import { Component, HTMLAttributes, PropsWithChildren, RefObject } from 'react';
2
-
3
2
  type Props = {
4
3
  acceptableDifference?: number;
5
4
  maxFontSize: number;
@@ -1,5 +1,4 @@
1
1
  import { BoxProps } from './Box';
2
-
3
2
  export type FlexProps = Partial<{
4
3
  /**
5
4
  * Default alignment of all children.
@@ -60,6 +59,7 @@ export declare function Flex(props: any): import("react/jsx-runtime").JSX.Elemen
60
59
  export declare namespace Flex {
61
60
  var Item: typeof FlexItem;
62
61
  }
62
+ export declare const computeFlexItemClassName: (props: FlexItemProps) => string;
63
63
  export type FlexItemProps = Partial<{
64
64
  /** This allows the default alignment (or the one specified by align-items) to be overridden for individual flex items. */
65
65
  align: string | boolean;