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,116 +1,67 @@
1
- import { jsxs as k, jsx as _ } from "react/jsx-runtime";
2
- import { scale as d, keyOfMatchingRange as M, clamp01 as N } from "../common/math.js";
3
- import { classes as u } from "../common/react.js";
4
- import { AnimatedNumber as A } from "./AnimatedNumber.js";
5
- import { Box as B, computeBoxClassName as G, computeBoxProps as j } from "./Box.js";
6
- import '../assets/RoundGauge.css';const F = "_roundGauge_gktag_17", L = "_ringTrack_gktag_25", T = "_ringFill_gktag_33", V = "_needle_gktag_41", O = "_needleLine_gktag_46", R = "_needleMiddle_gktag_47", Z = "_alert_gktag_51", z = "_max_gktag_59", P = "_color__black_gktag_63", S = "_color__white_gktag_67", $ = "_color__red_gktag_71", D = "_color__orange_gktag_75", E = "_color__yellow_gktag_79", I = "_color__olive_gktag_83", q = "_color__green_gktag_87", H = "_color__teal_gktag_91", J = "_color__blue_gktag_95", K = "_color__violet_gktag_99", Q = "_color__purple_gktag_103", U = "_color__pink_gktag_107", W = "_color__brown_gktag_111", X = "_color__grey_gktag_115", Y = "_color__good_gktag_123", __ = "_color__average_gktag_127", e_ = "_color__bad_gktag_131", l_ = "_color__label_gktag_135", o_ = "_alert__black_gktag_139", r_ = "_alertAnim_gktag_1", t_ = "_alert__white_gktag_145", a_ = "_alert__red_gktag_151", c_ = "_alert__orange_gktag_157", g_ = "_alert__yellow_gktag_163", n_ = "_alert__olive_gktag_169", s_ = "_alert__green_gktag_175", i_ = "_alert__teal_gktag_181", k_ = "_alert__blue_gktag_187", d_ = "_alert__violet_gktag_193", u_ = "_alert__purple_gktag_199", m_ = "_alert__pink_gktag_205", p_ = "_alert__brown_gktag_211", b_ = "_alert__grey_gktag_217", y_ = "_alert__good_gktag_229", h_ = "_alert__average_gktag_235", f_ = "_alert__bad_gktag_241", v_ = "_alert__label_gktag_247", e = {
7
- roundGauge: F,
8
- ringTrack: L,
9
- ringFill: T,
10
- needle: V,
11
- needleLine: O,
12
- needleMiddle: R,
13
- alert: Z,
14
- max: z,
15
- color__black: P,
16
- color__white: S,
17
- color__red: $,
18
- color__orange: D,
19
- color__yellow: E,
20
- color__olive: I,
21
- color__green: q,
22
- color__teal: H,
23
- color__blue: J,
24
- color__violet: K,
25
- color__purple: Q,
26
- color__pink: U,
27
- color__brown: W,
28
- color__grey: X,
29
- "color__light-grey": "_color__light-grey_gktag_119",
30
- color__good: Y,
31
- color__average: __,
32
- color__bad: e_,
33
- color__label: l_,
34
- alert__black: o_,
35
- alertAnim: r_,
36
- alert__white: t_,
37
- alert__red: a_,
38
- alert__orange: c_,
39
- alert__yellow: g_,
40
- alert__olive: n_,
41
- alert__green: s_,
42
- alert__teal: i_,
43
- alert__blue: k_,
44
- alert__violet: d_,
45
- alert__purple: u_,
46
- alert__pink: m_,
47
- alert__brown: p_,
48
- alert__grey: b_,
49
- "alert__light-grey": "_alert__light-grey_gktag_223",
50
- alert__good: y_,
51
- alert__average: h_,
52
- alert__bad: f_,
53
- alert__label: v_
54
- };
55
- function A_(y) {
1
+ import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
+ import { scale as d, keyOfMatchingRange as M, clamp01 as k } from "../common/math.js";
3
+ import { classes as h } from "../common/react.js";
4
+ import { AnimatedNumber as v } from "./AnimatedNumber.js";
5
+ import { Box as B, computeBoxClassName as $, computeBoxProps as j } from "./Box.js";
6
+ function w(p) {
56
7
  const {
57
- alertAfter: o,
58
- alertBefore: r,
59
- className: h,
60
- format: f,
61
- maxValue: n = 1,
62
- minValue: s = 1,
63
- ranges: a,
64
- size: v = 1,
65
- style: w,
66
- value: l,
67
- ...m
68
- } = y, C = d(l, s, n), p = N(C), c = a ? {} : { primary: [0, 1] };
69
- a && Object.keys(a).forEach((t) => {
70
- const g = a[t];
71
- c[t] = [
72
- d(g[0], s, n),
73
- d(g[1], s, n)
8
+ alertAfter: a,
9
+ alertBefore: t,
10
+ className: _,
11
+ format: R,
12
+ maxValue: c = 1,
13
+ minValue: u = 1,
14
+ ranges: n,
15
+ size: y = 1,
16
+ style: x,
17
+ value: r,
18
+ ...g
19
+ } = p, G = d(r, u, c), f = k(G), l = n ? {} : { primary: [0, 1] };
20
+ n && Object.keys(n).forEach((o) => {
21
+ const s = n[o];
22
+ l[o] = [
23
+ d(s[0], u, c),
24
+ d(s[1], u, c)
74
25
  ];
75
26
  });
76
- function x() {
77
- return o && r && l > o && l < r || o && l > o ? !0 : !!(r && l < r);
27
+ function N() {
28
+ return !!(a && t && r > a && r < t || a && r > a || t && r < t);
78
29
  }
79
- const b = x() && M(p, c);
80
- return /* @__PURE__ */ k(B, { inline: !0, children: [
81
- /* @__PURE__ */ _(
30
+ const C = N() && M(f, l);
31
+ return /* @__PURE__ */ m(B, { inline: !0, children: [
32
+ /* @__PURE__ */ e(
82
33
  "div",
83
34
  {
84
- className: u([
85
- e.roundGauge,
86
- h,
87
- G(m)
35
+ className: h([
36
+ "RoundGauge",
37
+ _,
38
+ $(g)
88
39
  ]),
89
40
  ...j({
90
41
  style: {
91
- fontSize: v + "em",
92
- ...w
42
+ fontSize: `${y}em`,
43
+ ...x
93
44
  },
94
- ...m
45
+ ...g
95
46
  }),
96
- children: /* @__PURE__ */ k("svg", { viewBox: "0 0 100 50", children: [
97
- (o || r) && /* @__PURE__ */ _(
47
+ children: /* @__PURE__ */ m("svg", { viewBox: "0 0 100 50", children: [
48
+ (a || t) && /* @__PURE__ */ e(
98
49
  "g",
99
50
  {
100
- className: u([
101
- e.alert,
102
- b ? e["alert__" + b] : ""
51
+ className: h([
52
+ "RoundGauge__alert",
53
+ C ? `active RoundGauge__alert--${C}` : ""
103
54
  ]),
104
- children: /* @__PURE__ */ _("path", { d: "M48.211,14.578C48.55,13.9 49.242,13.472 50,13.472C50.758,13.472 51.45,13.9 51.789,14.578C54.793,20.587 60.795,32.589 63.553,38.106C63.863,38.726 63.83,39.462 63.465,40.051C63.101,40.641 62.457,41 61.764,41C55.996,41 44.004,41 38.236,41C37.543,41 36.899,40.641 36.535,40.051C36.17,39.462 36.137,38.726 36.447,38.106C39.205,32.589 45.207,20.587 48.211,14.578ZM50,34.417C51.426,34.417 52.583,35.574 52.583,37C52.583,38.426 51.426,39.583 50,39.583C48.574,39.583 47.417,38.426 47.417,37C47.417,35.574 48.574,34.417 50,34.417ZM50,32.75C50,32.75 53,31.805 53,22.25C53,20.594 51.656,19.25 50,19.25C48.344,19.25 47,20.594 47,22.25C47,31.805 50,32.75 50,32.75Z" })
55
+ children: /* @__PURE__ */ e("path", { d: "M48.211,14.578C48.55,13.9 49.242,13.472 50,13.472C50.758,13.472 51.45,13.9 51.789,14.578C54.793,20.587 60.795,32.589 63.553,38.106C63.863,38.726 63.83,39.462 63.465,40.051C63.101,40.641 62.457,41 61.764,41C55.996,41 44.004,41 38.236,41C37.543,41 36.899,40.641 36.535,40.051C36.17,39.462 36.137,38.726 36.447,38.106C39.205,32.589 45.207,20.587 48.211,14.578ZM50,34.417C51.426,34.417 52.583,35.574 52.583,37C52.583,38.426 51.426,39.583 50,39.583C48.574,39.583 47.417,38.426 47.417,37C47.417,35.574 48.574,34.417 50,34.417ZM50,32.75C50,32.75 53,31.805 53,22.25C53,20.594 51.656,19.25 50,19.25C48.344,19.25 47,20.594 47,22.25C47,31.805 50,32.75 50,32.75Z" })
105
56
  }
106
57
  ),
107
- /* @__PURE__ */ _("g", { children: /* @__PURE__ */ _("circle", { className: e.ringTrack, cx: "50", cy: "50", r: "45" }) }),
108
- /* @__PURE__ */ _("g", { children: Object.keys(c).map((t, g) => {
109
- const i = c[t];
110
- return /* @__PURE__ */ _(
58
+ /* @__PURE__ */ e("g", { children: /* @__PURE__ */ e("circle", { className: "RoundGauge__ringTrack", cx: "50", cy: "50", r: "45" }) }),
59
+ /* @__PURE__ */ e("g", { children: Object.keys(l).map((o, s) => {
60
+ const i = l[o];
61
+ return /* @__PURE__ */ e(
111
62
  "circle",
112
63
  {
113
- className: u([e.ringFill, e["color__" + t]]),
64
+ className: `RoundGauge__ringFill RoundGauge--color--${o}`,
114
65
  style: {
115
66
  strokeDashoffset: Math.max(
116
67
  (2 - (i[1] - i[0])) * Math.PI * 50,
@@ -122,26 +73,41 @@ function A_(y) {
122
73
  cy: "50",
123
74
  r: "45"
124
75
  },
125
- g
76
+ s
126
77
  );
127
78
  }) }),
128
- /* @__PURE__ */ k(
79
+ /* @__PURE__ */ m(
129
80
  "g",
130
81
  {
131
- className: e.needle,
132
- transform: `rotate(${p * 180 - 90} 50 50)`,
82
+ className: "RoundGauge__needle",
83
+ transform: `rotate(${f * 180 - 90} 50 50)`,
133
84
  children: [
134
- /* @__PURE__ */ _("polygon", { className: e.needleLine, points: "46,50 50,0 54,50" }),
135
- /* @__PURE__ */ _("circle", { className: e.needleMiddle, cx: "50", cy: "50", r: "8" })
85
+ /* @__PURE__ */ e(
86
+ "polygon",
87
+ {
88
+ className: "RoundGauge__needleLine",
89
+ points: "46,50 50,0 54,50"
90
+ }
91
+ ),
92
+ /* @__PURE__ */ e(
93
+ "circle",
94
+ {
95
+ className: "RoundGauge__needleMiddle",
96
+ cx: "50",
97
+ cy: "50",
98
+ r: "8"
99
+ }
100
+ )
136
101
  ]
137
102
  }
138
- )
103
+ ),
104
+ /* @__PURE__ */ e("title", { children: "alert" })
139
105
  ] })
140
106
  }
141
107
  ),
142
- /* @__PURE__ */ _(A, { value: l, format: f })
108
+ /* @__PURE__ */ e(v, { value: r, format: R })
143
109
  ] });
144
110
  }
145
111
  export {
146
- A_ as RoundGauge
112
+ w as RoundGauge
147
113
  };
@@ -1,6 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { BoxProps } from './Box';
3
-
4
3
  type Props = Partial<{
5
4
  /** Buttons to render aside the section title. */
6
5
  buttons: ReactNode;
@@ -52,5 +51,5 @@ type Props = Partial<{
52
51
  * </Section>
53
52
  * ```
54
53
  */
55
- export declare const Section: (props: Props) => import("react/jsx-runtime").JSX.Element;
54
+ export declare function Section(props: Props): import("react/jsx-runtime").JSX.Element;
56
55
  export {};
@@ -1,69 +1,68 @@
1
- import { jsxs as a, jsx as r } from "react/jsx-runtime";
2
- import { useRef as P, useEffect as g } from "react";
3
- import { addScrollableNode as j, removeScrollableNode as z } from "../common/events.js";
4
- import { classes as d, canRender as m } from "../common/react.js";
5
- import { s as e } from "../Section.module-qhQWhlUX.js";
6
- import { computeBoxClassName as B, computeBoxProps as H } from "./Box.js";
7
- const _ = (f) => {
1
+ import { jsxs as s, jsx as t } from "react/jsx-runtime";
2
+ import { useRef as T, useEffect as C } from "react";
3
+ import { addScrollableNode as P, removeScrollableNode as g } from "../common/events.js";
4
+ import { classes as a, canRender as d } from "../common/react.js";
5
+ import { computeBoxClassName as j, computeBoxProps as z } from "./Box.js";
6
+ function G(m) {
8
7
  const {
9
- buttons: o,
10
- children: u,
11
- className: p,
12
- fill: N,
13
- fitted: h,
14
- flexGrow: b,
15
- noTopPadding: x,
16
- onScroll: v,
17
- scrollable: s,
18
- scrollableHorizontal: n,
19
- stretchContents: S,
20
- title: c,
21
- container_id: T,
8
+ buttons: n,
9
+ children: f,
10
+ className: _,
11
+ fill: u,
12
+ fitted: S,
13
+ flexGrow: p,
14
+ noTopPadding: N,
15
+ onScroll: h,
16
+ scrollable: c,
17
+ scrollableHorizontal: l,
18
+ stretchContents: b,
19
+ title: r,
20
+ container_id: x,
22
21
  ...i
23
- } = f, t = P(null), C = m(c) || m(o);
24
- return g(() => {
25
- if (!(t != null && t.current) || !s && !n) return;
26
- const l = t.current;
27
- return j(l), () => {
28
- l && z(l);
22
+ } = m, e = T(null), v = d(r) || d(n);
23
+ return C(() => {
24
+ if (!(e != null && e.current) || !c && !l) return;
25
+ const o = e.current;
26
+ return P(o), () => {
27
+ o && g(o);
29
28
  };
30
- }, []), /* @__PURE__ */ a(
29
+ }, []), /* @__PURE__ */ s(
31
30
  "div",
32
31
  {
33
- id: T || "",
34
- className: d([
35
- e.section,
36
- N && e.fill,
37
- h && e.fitted,
38
- s && e.scrollable,
39
- n && e.scrollableHorizontal,
40
- b && e.sectionFlex,
41
- p,
42
- B(i)
32
+ id: x || "",
33
+ className: a([
34
+ "Section",
35
+ u && "Section--fill",
36
+ S && "Section--fitted",
37
+ c && "Section--scrollable",
38
+ l && "Section--scrollableHorizontal",
39
+ p && "Section__flex",
40
+ _,
41
+ j(i)
43
42
  ]),
44
- ...H(i),
43
+ ...z(i),
45
44
  children: [
46
- C && /* @__PURE__ */ a("div", { className: e.title, children: [
47
- /* @__PURE__ */ r("span", { className: e.titleText, children: c }),
48
- /* @__PURE__ */ r("div", { className: e.buttons, children: o })
45
+ v && /* @__PURE__ */ s("div", { className: "Section__title", children: [
46
+ /* @__PURE__ */ t("span", { className: "Section__titleText", children: r }),
47
+ /* @__PURE__ */ t("div", { className: "Section__buttons", children: n })
49
48
  ] }),
50
- /* @__PURE__ */ r("div", { className: e.rest, children: /* @__PURE__ */ r(
49
+ /* @__PURE__ */ t("div", { className: "Section__rest", children: /* @__PURE__ */ t(
51
50
  "div",
52
51
  {
53
- className: d([
54
- e.content,
55
- !!S && e.stretchContents,
56
- !!x && e.noTopPadding
52
+ className: a([
53
+ "Section__content",
54
+ !!b && "content__stretchContents",
55
+ !!N && "content__noTopPadding"
57
56
  ]),
58
- onScroll: v,
59
- ref: t,
60
- children: u
57
+ onScroll: h,
58
+ ref: e,
59
+ children: f
61
60
  }
62
61
  ) })
63
62
  ]
64
63
  }
65
64
  );
66
- };
65
+ }
67
66
  export {
68
- _ as Section
67
+ G as Section
69
68
  };
@@ -1,6 +1,5 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { BoxProps } from './Box';
3
-
4
3
  type Props = {
5
4
  /** Highest possible value. */
6
5
  maxValue: number;
@@ -1,117 +1,109 @@
1
- import { jsx as s, jsxs as m } from "react/jsx-runtime";
2
- import { keyOfMatchingRange as R, clamp01 as t, scale as f } from "../common/math.js";
3
- import { classes as _ } from "../common/react.js";
4
- import { p as e } from "../ProgressBar.module-Jzqlebbx.js";
5
- import { computeBoxClassName as q, computeBoxProps as A } from "./Box.js";
6
- import { DraggableControl as G } from "./DraggableControl.js";
7
- import '../assets/Slider.css';const H = "_slider_1assx_9", I = "_cursorOffset_1assx_13", J = "_cursor_1assx_13", K = "_pointer_1assx_30", L = "_popupValue_1assx_41", a = {
8
- slider: H,
9
- cursorOffset: I,
10
- cursor: J,
11
- pointer: K,
12
- popupValue: L
13
- };
14
- function Z(h) {
1
+ import { jsx as e, jsxs as m } from "react/jsx-runtime";
2
+ import { keyOfMatchingRange as O, clamp01 as r, scale as u } from "../common/math.js";
3
+ import { classes as p } from "../common/react.js";
4
+ import { computeBoxClassName as b, computeBoxProps as z } from "./Box.js";
5
+ import { DraggableControl as R } from "./DraggableControl.js";
6
+ function J(g) {
15
7
  const {
16
8
  // Draggable props (passthrough)
17
- animated: g,
18
- format: v,
19
- maxValue: o,
20
- minValue: r,
21
- onChange: x,
22
- onDrag: V,
23
- step: y,
24
- stepPixelSize: N,
25
- suppressFlicker: C,
26
- unit: D,
27
- value: O,
9
+ animated: f,
10
+ format: _,
11
+ maxValue: l,
12
+ minValue: s,
13
+ onChange: h,
14
+ onDrag: v,
15
+ step: N,
16
+ stepPixelSize: x,
17
+ suppressFlicker: y,
18
+ unit: B,
19
+ value: P,
28
20
  // Own props
29
- className: w,
30
- fillValue: l,
31
- color: M,
32
- ranges: S = {},
21
+ className: S,
22
+ fillValue: a,
23
+ color: V,
24
+ ranges: C = {},
33
25
  children: i,
34
- ...c
35
- } = h, B = i !== void 0;
36
- return /* @__PURE__ */ s(
37
- G,
26
+ ...o
27
+ } = g, D = i !== void 0;
28
+ return /* @__PURE__ */ e(
29
+ R,
38
30
  {
39
31
  dragMatrix: [1, 0],
40
- animated: g,
41
- format: v,
42
- maxValue: o,
43
- minValue: r,
44
- onChange: x,
45
- onDrag: V,
46
- step: y,
47
- stepPixelSize: N,
48
- suppressFlicker: C,
49
- unit: D,
50
- value: O,
51
- children: (F) => {
32
+ animated: f,
33
+ format: _,
34
+ maxValue: l,
35
+ minValue: s,
36
+ onChange: h,
37
+ onDrag: v,
38
+ step: N,
39
+ stepPixelSize: x,
40
+ suppressFlicker: y,
41
+ unit: B,
42
+ value: P,
43
+ children: (w) => {
52
44
  const {
53
- displayElement: n,
54
- displayValue: p,
55
- dragging: j,
56
- handleDragStart: k,
57
- inputElement: E,
58
- value: P
59
- } = F, b = l != null, u = f(
60
- l ?? p,
61
- r,
62
- o
63
- ), d = f(p, r, o), z = M || R(l ?? P, S) || "default";
45
+ displayElement: t,
46
+ displayValue: n,
47
+ dragging: M,
48
+ handleDragStart: $,
49
+ inputElement: F,
50
+ value: j
51
+ } = w, k = a != null, c = u(
52
+ a ?? n,
53
+ s,
54
+ l
55
+ ), d = u(n, s, l), E = V || O(a ?? j, C) || "default";
64
56
  return /* @__PURE__ */ m(
65
57
  "div",
66
58
  {
67
- className: _([
68
- a.slider,
69
- e.progressBar,
70
- e["color__" + z],
71
- w,
72
- q(c)
59
+ className: p([
60
+ "Slider",
61
+ "ProgressBar",
62
+ `ProgressBar--color--${E}`,
63
+ S,
64
+ b(o)
73
65
  ]),
74
- ...A(c),
75
- onMouseDown: k,
66
+ ...z(o),
67
+ onMouseDown: $,
76
68
  children: [
77
- /* @__PURE__ */ s(
69
+ /* @__PURE__ */ e(
78
70
  "div",
79
71
  {
80
- className: _([
81
- e.fill,
82
- b && e.fill__animated
72
+ className: p([
73
+ "ProgressBar__fill",
74
+ k && "ProgressBar__fill--animated"
83
75
  ]),
84
76
  style: {
85
- width: t(u) * 100 + "%",
77
+ width: `${r(c) * 100}%`,
86
78
  opacity: 0.4
87
79
  }
88
80
  }
89
81
  ),
90
- /* @__PURE__ */ s(
82
+ /* @__PURE__ */ e(
91
83
  "div",
92
84
  {
93
- className: e.fill,
85
+ className: "ProgressBar__fill",
94
86
  style: {
95
- width: t(Math.min(u, d)) * 100 + "%"
87
+ width: `${r(Math.min(c, d)) * 100}%`
96
88
  }
97
89
  }
98
90
  ),
99
91
  /* @__PURE__ */ m(
100
92
  "div",
101
93
  {
102
- className: a.cursorOffset,
94
+ className: "Slider__cursorOffset",
103
95
  style: {
104
- width: t(d) * 100 + "%"
96
+ width: `${r(d) * 100}%`
105
97
  },
106
98
  children: [
107
- /* @__PURE__ */ s("div", { className: a.cursor }),
108
- /* @__PURE__ */ s("div", { className: a.pointer }),
109
- j && /* @__PURE__ */ s("div", { className: a.popupValue, children: n })
99
+ /* @__PURE__ */ e("div", { className: "Slider__cursor" }),
100
+ /* @__PURE__ */ e("div", { className: "Slider__pointer" }),
101
+ M && /* @__PURE__ */ e("div", { className: "Slider__popupValue", children: t })
110
102
  ]
111
103
  }
112
104
  ),
113
- /* @__PURE__ */ s("div", { className: e.content, children: B ? i : n }),
114
- E
105
+ /* @__PURE__ */ e("div", { className: "ProgressBar__content", children: D ? i : t }),
106
+ F
115
107
  ]
116
108
  }
117
109
  );
@@ -120,5 +112,5 @@ function Z(h) {
120
112
  );
121
113
  }
122
114
  export {
123
- Z as Slider
115
+ J as Slider
124
116
  };
@@ -1,6 +1,5 @@
1
1
  import { RefObject } from 'react';
2
2
  import { FlexItemProps, FlexProps } from './Flex';
3
-
4
3
  type Props = Partial<{
5
4
  /** Fills available space. */
6
5
  fill: boolean;