@pie-lib/config-ui 0.1.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 (132) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +11 -0
  2. package/dist/alert-dialog.d.ts +44 -0
  3. package/dist/alert-dialog.d.ts.map +1 -0
  4. package/dist/alert-dialog.js +47 -0
  5. package/dist/checkbox.d.ts +34 -0
  6. package/dist/checkbox.d.ts.map +1 -0
  7. package/dist/checkbox.js +57 -0
  8. package/dist/choice-configuration/feedback-menu.d.ts +33 -0
  9. package/dist/choice-configuration/feedback-menu.d.ts.map +1 -0
  10. package/dist/choice-configuration/feedback-menu.js +85 -0
  11. package/dist/choice-configuration/index.d.ts +63 -0
  12. package/dist/choice-configuration/index.d.ts.map +1 -0
  13. package/dist/choice-configuration/index.js +240 -0
  14. package/dist/choice-utils.d.ts +22 -0
  15. package/dist/choice-utils.d.ts.map +1 -0
  16. package/dist/choice-utils.js +15 -0
  17. package/dist/feedback-config/feedback-selector.d.ts +34 -0
  18. package/dist/feedback-config/feedback-selector.d.ts.map +1 -0
  19. package/dist/feedback-config/feedback-selector.js +92 -0
  20. package/dist/feedback-config/group.d.ts +21 -0
  21. package/dist/feedback-config/group.d.ts.map +1 -0
  22. package/dist/feedback-config/group.js +33 -0
  23. package/dist/feedback-config/index.d.ts +49 -0
  24. package/dist/feedback-config/index.d.ts.map +1 -0
  25. package/dist/feedback-config/index.js +96 -0
  26. package/dist/form-section.d.ts +25 -0
  27. package/dist/form-section.d.ts.map +1 -0
  28. package/dist/form-section.js +25 -0
  29. package/dist/help.d.ts +42 -0
  30. package/dist/help.d.ts.map +1 -0
  31. package/dist/help.js +61 -0
  32. package/dist/index.d.ts +32 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +34 -0
  35. package/dist/input.d.ts +30 -0
  36. package/dist/input.d.ts.map +1 -0
  37. package/dist/input.js +65 -0
  38. package/dist/inputs.d.ts +63 -0
  39. package/dist/inputs.d.ts.map +1 -0
  40. package/dist/inputs.js +70 -0
  41. package/dist/langs.d.ts +42 -0
  42. package/dist/langs.d.ts.map +1 -0
  43. package/dist/langs.js +76 -0
  44. package/dist/layout/config-layout.d.ts +11 -0
  45. package/dist/layout/config-layout.d.ts.map +1 -0
  46. package/dist/layout/config-layout.js +75 -0
  47. package/dist/layout/index.d.ts +12 -0
  48. package/dist/layout/index.d.ts.map +1 -0
  49. package/dist/layout/index.js +10 -0
  50. package/dist/layout/layout-contents.d.ts +22 -0
  51. package/dist/layout/layout-contents.d.ts.map +1 -0
  52. package/dist/layout/layout-contents.js +70 -0
  53. package/dist/layout/settings-box.d.ts +20 -0
  54. package/dist/layout/settings-box.d.ts.map +1 -0
  55. package/dist/layout/settings-box.js +31 -0
  56. package/dist/mui-box/index.d.ts +21 -0
  57. package/dist/mui-box/index.d.ts.map +1 -0
  58. package/dist/mui-box/index.js +47 -0
  59. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
  60. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
  61. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
  62. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
  63. package/dist/node_modules/.bun/react-measure@2.5.2_6dbf9a050bc9aadb/node_modules/react-measure/dist/index.esm.js +122 -0
  64. package/dist/node_modules/.bun/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +276 -0
  65. package/dist/number-text-field-custom.d.ts +52 -0
  66. package/dist/number-text-field-custom.d.ts.map +1 -0
  67. package/dist/number-text-field-custom.js +192 -0
  68. package/dist/number-text-field.d.ts +48 -0
  69. package/dist/number-text-field.d.ts.map +1 -0
  70. package/dist/number-text-field.js +122 -0
  71. package/dist/radio-with-label.d.ts +25 -0
  72. package/dist/radio-with-label.d.ts.map +1 -0
  73. package/dist/radio-with-label.js +27 -0
  74. package/dist/settings/display-size.d.ts +26 -0
  75. package/dist/settings/display-size.d.ts.map +1 -0
  76. package/dist/settings/display-size.js +45 -0
  77. package/dist/settings/index.d.ts +46 -0
  78. package/dist/settings/index.d.ts.map +1 -0
  79. package/dist/settings/index.js +63 -0
  80. package/dist/settings/panel.d.ts +28 -0
  81. package/dist/settings/panel.d.ts.map +1 -0
  82. package/dist/settings/panel.js +201 -0
  83. package/dist/settings/settings-radio-label.d.ts +25 -0
  84. package/dist/settings/settings-radio-label.d.ts.map +1 -0
  85. package/dist/settings/settings-radio-label.js +29 -0
  86. package/dist/settings/toggle.d.ts +25 -0
  87. package/dist/settings/toggle.d.ts.map +1 -0
  88. package/dist/settings/toggle.js +33 -0
  89. package/dist/tabs/index.d.ts +23 -0
  90. package/dist/tabs/index.d.ts.map +1 -0
  91. package/dist/tabs/index.js +39 -0
  92. package/dist/tags-input/index.d.ts +22 -0
  93. package/dist/tags-input/index.d.ts.map +1 -0
  94. package/dist/tags-input/index.js +83 -0
  95. package/dist/two-choice.d.ts +44 -0
  96. package/dist/two-choice.d.ts.map +1 -0
  97. package/dist/two-choice.js +79 -0
  98. package/dist/with-stateful-model.d.ts +22 -0
  99. package/dist/with-stateful-model.d.ts.map +1 -0
  100. package/dist/with-stateful-model.js +32 -0
  101. package/package.json +40 -0
  102. package/src/alert-dialog.tsx +85 -0
  103. package/src/checkbox.tsx +71 -0
  104. package/src/choice-configuration/feedback-menu.tsx +134 -0
  105. package/src/choice-configuration/index.tsx +400 -0
  106. package/src/choice-utils.ts +40 -0
  107. package/src/feedback-config/feedback-selector.tsx +153 -0
  108. package/src/feedback-config/group.tsx +61 -0
  109. package/src/feedback-config/index.tsx +121 -0
  110. package/src/form-section.tsx +41 -0
  111. package/src/help.tsx +89 -0
  112. package/src/index.ts +93 -0
  113. package/src/input.tsx +109 -0
  114. package/src/inputs.tsx +107 -0
  115. package/src/langs.tsx +121 -0
  116. package/src/layout/config-layout.tsx +113 -0
  117. package/src/layout/index.ts +14 -0
  118. package/src/layout/layout-contents.tsx +127 -0
  119. package/src/layout/settings-box.tsx +42 -0
  120. package/src/mui-box/index.tsx +66 -0
  121. package/src/number-text-field-custom.tsx +343 -0
  122. package/src/number-text-field.tsx +229 -0
  123. package/src/radio-with-label.tsx +40 -0
  124. package/src/settings/display-size.tsx +63 -0
  125. package/src/settings/index.ts +93 -0
  126. package/src/settings/panel.tsx +343 -0
  127. package/src/settings/settings-radio-label.tsx +42 -0
  128. package/src/settings/toggle.tsx +56 -0
  129. package/src/tabs/index.tsx +57 -0
  130. package/src/tags-input/index.tsx +126 -0
  131. package/src/two-choice.tsx +128 -0
  132. package/src/with-stateful-model.tsx +46 -0
@@ -0,0 +1,12 @@
1
+ //#region ../../../node_modules/.bun/@babel+runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/extends.js
2
+ function e() {
3
+ return e = Object.assign ? Object.assign.bind() : function(e) {
4
+ for (var t = 1; t < arguments.length; t++) {
5
+ var n = arguments[t];
6
+ for (var r in n) ({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
7
+ }
8
+ return e;
9
+ }, e.apply(null, arguments);
10
+ }
11
+ //#endregion
12
+ export { e as _extends };
@@ -0,0 +1,7 @@
1
+ import { _setPrototypeOf as e } from "./setPrototypeOf.js";
2
+ //#region ../../../node_modules/.bun/@babel+runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
3
+ function t(t, n) {
4
+ t.prototype = Object.create(n.prototype), t.prototype.constructor = t, e(t, n);
5
+ }
6
+ //#endregion
7
+ export { t as _inheritsLoose };
@@ -0,0 +1,12 @@
1
+ //#region ../../../node_modules/.bun/@babel+runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
2
+ function e(e, t) {
3
+ if (e == null) return {};
4
+ var n = {};
5
+ for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
6
+ if (t.indexOf(r) !== -1) continue;
7
+ n[r] = e[r];
8
+ }
9
+ return n;
10
+ }
11
+ //#endregion
12
+ export { e as _objectWithoutPropertiesLoose };
@@ -0,0 +1,8 @@
1
+ //#region ../../../node_modules/.bun/@babel+runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
2
+ function e(t, n) {
3
+ return e = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
4
+ return e.__proto__ = t, e;
5
+ }, e(t, n);
6
+ }
7
+ //#endregion
8
+ export { e as _setPrototypeOf };
@@ -0,0 +1,122 @@
1
+ import { _extends as e } from "../../../../@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/extends.js";
2
+ import { _objectWithoutPropertiesLoose as t } from "../../../../@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js";
3
+ import { _inheritsLoose as n } from "../../../../@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js";
4
+ import r from "../../../../resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js";
5
+ import { Component as i, createElement as a } from "react";
6
+ import o from "prop-types";
7
+ //#region ../../../node_modules/.bun/react-measure@2.5.2+6dbf9a050bc9aadb/node_modules/react-measure/dist/index.esm.js
8
+ var s = [
9
+ "client",
10
+ "offset",
11
+ "scroll",
12
+ "bounds",
13
+ "margin"
14
+ ];
15
+ function c(e) {
16
+ var t = [];
17
+ return s.forEach(function(n) {
18
+ e[n] && t.push(n);
19
+ }), t;
20
+ }
21
+ function l(e, t) {
22
+ var n = {};
23
+ if (t.indexOf("client") > -1 && (n.client = {
24
+ top: e.clientTop,
25
+ left: e.clientLeft,
26
+ width: e.clientWidth,
27
+ height: e.clientHeight
28
+ }), t.indexOf("offset") > -1 && (n.offset = {
29
+ top: e.offsetTop,
30
+ left: e.offsetLeft,
31
+ width: e.offsetWidth,
32
+ height: e.offsetHeight
33
+ }), t.indexOf("scroll") > -1 && (n.scroll = {
34
+ top: e.scrollTop,
35
+ left: e.scrollLeft,
36
+ width: e.scrollWidth,
37
+ height: e.scrollHeight
38
+ }), t.indexOf("bounds") > -1) {
39
+ var r = e.getBoundingClientRect();
40
+ n.bounds = {
41
+ top: r.top,
42
+ right: r.right,
43
+ bottom: r.bottom,
44
+ left: r.left,
45
+ width: r.width,
46
+ height: r.height
47
+ };
48
+ }
49
+ if (t.indexOf("margin") > -1) {
50
+ var i = getComputedStyle(e);
51
+ n.margin = {
52
+ top: i ? parseInt(i.marginTop) : 0,
53
+ right: i ? parseInt(i.marginRight) : 0,
54
+ bottom: i ? parseInt(i.marginBottom) : 0,
55
+ left: i ? parseInt(i.marginLeft) : 0
56
+ };
57
+ }
58
+ return n;
59
+ }
60
+ function u(e) {
61
+ return e && e.ownerDocument && e.ownerDocument.defaultView || window;
62
+ }
63
+ function d(s) {
64
+ return function(d) {
65
+ var f, p;
66
+ return p = f = /* @__PURE__ */ function(i) {
67
+ n(o, i);
68
+ function o() {
69
+ var e, t = [...arguments];
70
+ return e = i.call.apply(i, [this].concat(t)) || this, e.state = { contentRect: {
71
+ entry: {},
72
+ client: {},
73
+ offset: {},
74
+ scroll: {},
75
+ bounds: {},
76
+ margin: {}
77
+ } }, e._animationFrameID = null, e._resizeObserver = null, e._node = null, e._window = null, e.measure = function(t) {
78
+ var n = l(e._node, s || c(e.props));
79
+ t && (n.entry = t[0].contentRect), e._animationFrameID = e._window.requestAnimationFrame(function() {
80
+ e._resizeObserver !== null && (e.setState({ contentRect: n }), typeof e.props.onResize == "function" && e.props.onResize(n));
81
+ });
82
+ }, e._handleRef = function(t) {
83
+ e._resizeObserver !== null && e._node !== null && e._resizeObserver.unobserve(e._node), e._node = t, e._window = u(e._node);
84
+ var n = e.props.innerRef;
85
+ n && (typeof n == "function" ? n(e._node) : n.current = e._node), e._resizeObserver !== null && e._node !== null && e._resizeObserver.observe(e._node);
86
+ }, e;
87
+ }
88
+ var f = o.prototype;
89
+ return f.componentDidMount = function() {
90
+ this._resizeObserver = this._window !== null && this._window.ResizeObserver ? new this._window.ResizeObserver(this.measure) : new r(this.measure), this._node !== null && (this._resizeObserver.observe(this._node), typeof this.props.onResize == "function" && this.props.onResize(l(this._node, s || c(this.props))));
91
+ }, f.componentWillUnmount = function() {
92
+ this._window !== null && this._window.cancelAnimationFrame(this._animationFrameID), this._resizeObserver !== null && (this._resizeObserver.disconnect(), this._resizeObserver = null);
93
+ }, f.render = function() {
94
+ var n = this.props;
95
+ return n.innerRef, n.onResize, a(d, e({}, t(n, ["innerRef", "onResize"]), {
96
+ measureRef: this._handleRef,
97
+ measure: this.measure,
98
+ contentRect: this.state.contentRect
99
+ }));
100
+ }, o;
101
+ }(i), f.propTypes = {
102
+ client: o.bool,
103
+ offset: o.bool,
104
+ scroll: o.bool,
105
+ bounds: o.bool,
106
+ margin: o.bool,
107
+ innerRef: o.oneOfType([o.object, o.func]),
108
+ onResize: o.func
109
+ }, p;
110
+ };
111
+ }
112
+ var f = d()(function(e) {
113
+ var t = e.measure, n = e.measureRef, r = e.contentRect, i = e.children;
114
+ return i({
115
+ measure: t,
116
+ measureRef: n,
117
+ contentRect: r
118
+ });
119
+ });
120
+ f.displayName = "Measure", f.propTypes.children = o.func;
121
+ //#endregion
122
+ export { f as default, d as withContentRect };
@@ -0,0 +1,276 @@
1
+ //#region ../../../node_modules/.bun/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js
2
+ var e = (function() {
3
+ if (typeof Map < "u") return Map;
4
+ function e(e, t) {
5
+ var n = -1;
6
+ return e.some(function(e, r) {
7
+ return e[0] === t ? (n = r, !0) : !1;
8
+ }), n;
9
+ }
10
+ return function() {
11
+ function t() {
12
+ this.__entries__ = [];
13
+ }
14
+ return Object.defineProperty(t.prototype, "size", {
15
+ get: function() {
16
+ return this.__entries__.length;
17
+ },
18
+ enumerable: !0,
19
+ configurable: !0
20
+ }), t.prototype.get = function(t) {
21
+ var n = e(this.__entries__, t), r = this.__entries__[n];
22
+ return r && r[1];
23
+ }, t.prototype.set = function(t, n) {
24
+ var r = e(this.__entries__, t);
25
+ ~r ? this.__entries__[r][1] = n : this.__entries__.push([t, n]);
26
+ }, t.prototype.delete = function(t) {
27
+ var n = this.__entries__, r = e(n, t);
28
+ ~r && n.splice(r, 1);
29
+ }, t.prototype.has = function(t) {
30
+ return !!~e(this.__entries__, t);
31
+ }, t.prototype.clear = function() {
32
+ this.__entries__.splice(0);
33
+ }, t.prototype.forEach = function(e, t) {
34
+ t === void 0 && (t = null);
35
+ for (var n = 0, r = this.__entries__; n < r.length; n++) {
36
+ var i = r[n];
37
+ e.call(t, i[1], i[0]);
38
+ }
39
+ }, t;
40
+ }();
41
+ })(), t = typeof window < "u" && typeof document < "u" && window.document === document, n = (function() {
42
+ return typeof global < "u" && global.Math === Math ? global : typeof self < "u" && self.Math === Math ? self : typeof window < "u" && window.Math === Math ? window : Function("return this")();
43
+ })(), r = (function() {
44
+ return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(n) : function(e) {
45
+ return setTimeout(function() {
46
+ return e(Date.now());
47
+ }, 1e3 / 60);
48
+ };
49
+ })(), i = 2;
50
+ function a(e, t) {
51
+ var n = !1, a = !1, o = 0;
52
+ function s() {
53
+ n && (n = !1, e()), a && l();
54
+ }
55
+ function c() {
56
+ r(s);
57
+ }
58
+ function l() {
59
+ var e = Date.now();
60
+ if (n) {
61
+ if (e - o < i) return;
62
+ a = !0;
63
+ } else n = !0, a = !1, setTimeout(c, t);
64
+ o = e;
65
+ }
66
+ return l;
67
+ }
68
+ var o = 20, s = [
69
+ "top",
70
+ "right",
71
+ "bottom",
72
+ "left",
73
+ "width",
74
+ "height",
75
+ "size",
76
+ "weight"
77
+ ], c = typeof MutationObserver < "u", l = function() {
78
+ function e() {
79
+ this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = a(this.refresh.bind(this), o);
80
+ }
81
+ return e.prototype.addObserver = function(e) {
82
+ ~this.observers_.indexOf(e) || this.observers_.push(e), this.connected_ || this.connect_();
83
+ }, e.prototype.removeObserver = function(e) {
84
+ var t = this.observers_, n = t.indexOf(e);
85
+ ~n && t.splice(n, 1), !t.length && this.connected_ && this.disconnect_();
86
+ }, e.prototype.refresh = function() {
87
+ this.updateObservers_() && this.refresh();
88
+ }, e.prototype.updateObservers_ = function() {
89
+ var e = this.observers_.filter(function(e) {
90
+ return e.gatherActive(), e.hasActive();
91
+ });
92
+ return e.forEach(function(e) {
93
+ return e.broadcastActive();
94
+ }), e.length > 0;
95
+ }, e.prototype.connect_ = function() {
96
+ !t || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), c ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
97
+ attributes: !0,
98
+ childList: !0,
99
+ characterData: !0,
100
+ subtree: !0
101
+ })) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0);
102
+ }, e.prototype.disconnect_ = function() {
103
+ !t || !this.connected_ || (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = !1, this.connected_ = !1);
104
+ }, e.prototype.onTransitionEnd_ = function(e) {
105
+ var t = e.propertyName, n = t === void 0 ? "" : t;
106
+ s.some(function(e) {
107
+ return !!~n.indexOf(e);
108
+ }) && this.refresh();
109
+ }, e.getInstance = function() {
110
+ return this.instance_ ||= new e(), this.instance_;
111
+ }, e.instance_ = null, e;
112
+ }(), u = (function(e, t) {
113
+ for (var n = 0, r = Object.keys(t); n < r.length; n++) {
114
+ var i = r[n];
115
+ Object.defineProperty(e, i, {
116
+ value: t[i],
117
+ enumerable: !1,
118
+ writable: !1,
119
+ configurable: !0
120
+ });
121
+ }
122
+ return e;
123
+ }), d = (function(e) {
124
+ return e && e.ownerDocument && e.ownerDocument.defaultView || n;
125
+ }), f = S(0, 0, 0, 0);
126
+ function p(e) {
127
+ return parseFloat(e) || 0;
128
+ }
129
+ function m(e) {
130
+ return [...arguments].slice(1).reduce(function(t, n) {
131
+ var r = e["border-" + n + "-width"];
132
+ return t + p(r);
133
+ }, 0);
134
+ }
135
+ function h(e) {
136
+ for (var t = [
137
+ "top",
138
+ "right",
139
+ "bottom",
140
+ "left"
141
+ ], n = {}, r = 0, i = t; r < i.length; r++) {
142
+ var a = i[r], o = e["padding-" + a];
143
+ n[a] = p(o);
144
+ }
145
+ return n;
146
+ }
147
+ function g(e) {
148
+ var t = e.getBBox();
149
+ return S(0, 0, t.width, t.height);
150
+ }
151
+ function _(e) {
152
+ var t = e.clientWidth, n = e.clientHeight;
153
+ if (!t && !n) return f;
154
+ var r = d(e).getComputedStyle(e), i = h(r), a = i.left + i.right, o = i.top + i.bottom, s = p(r.width), c = p(r.height);
155
+ if (r.boxSizing === "border-box" && (Math.round(s + a) !== t && (s -= m(r, "left", "right") + a), Math.round(c + o) !== n && (c -= m(r, "top", "bottom") + o)), !y(e)) {
156
+ var l = Math.round(s + a) - t, u = Math.round(c + o) - n;
157
+ Math.abs(l) !== 1 && (s -= l), Math.abs(u) !== 1 && (c -= u);
158
+ }
159
+ return S(i.left, i.top, s, c);
160
+ }
161
+ var v = (function() {
162
+ return typeof SVGGraphicsElement < "u" ? function(e) {
163
+ return e instanceof d(e).SVGGraphicsElement;
164
+ } : function(e) {
165
+ return e instanceof d(e).SVGElement && typeof e.getBBox == "function";
166
+ };
167
+ })();
168
+ function y(e) {
169
+ return e === d(e).document.documentElement;
170
+ }
171
+ function b(e) {
172
+ return t ? v(e) ? g(e) : _(e) : f;
173
+ }
174
+ function x(e) {
175
+ var t = e.x, n = e.y, r = e.width, i = e.height, a = Object.create((typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object).prototype);
176
+ return u(a, {
177
+ x: t,
178
+ y: n,
179
+ width: r,
180
+ height: i,
181
+ top: n,
182
+ right: t + r,
183
+ bottom: i + n,
184
+ left: t
185
+ }), a;
186
+ }
187
+ function S(e, t, n, r) {
188
+ return {
189
+ x: e,
190
+ y: t,
191
+ width: n,
192
+ height: r
193
+ };
194
+ }
195
+ var C = function() {
196
+ function e(e) {
197
+ this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = S(0, 0, 0, 0), this.target = e;
198
+ }
199
+ return e.prototype.isActive = function() {
200
+ var e = b(this.target);
201
+ return this.contentRect_ = e, e.width !== this.broadcastWidth || e.height !== this.broadcastHeight;
202
+ }, e.prototype.broadcastRect = function() {
203
+ var e = this.contentRect_;
204
+ return this.broadcastWidth = e.width, this.broadcastHeight = e.height, e;
205
+ }, e;
206
+ }(), w = function() {
207
+ function e(e, t) {
208
+ var n = x(t);
209
+ u(this, {
210
+ target: e,
211
+ contentRect: n
212
+ });
213
+ }
214
+ return e;
215
+ }(), T = function() {
216
+ function t(t, n, r) {
217
+ if (this.activeObservations_ = [], this.observations_ = new e(), typeof t != "function") throw TypeError("The callback provided as parameter 1 is not a function.");
218
+ this.callback_ = t, this.controller_ = n, this.callbackCtx_ = r;
219
+ }
220
+ return t.prototype.observe = function(e) {
221
+ if (!arguments.length) throw TypeError("1 argument required, but only 0 present.");
222
+ if (!(typeof Element > "u" || !(Element instanceof Object))) {
223
+ if (!(e instanceof d(e).Element)) throw TypeError("parameter 1 is not of type \"Element\".");
224
+ var t = this.observations_;
225
+ t.has(e) || (t.set(e, new C(e)), this.controller_.addObserver(this), this.controller_.refresh());
226
+ }
227
+ }, t.prototype.unobserve = function(e) {
228
+ if (!arguments.length) throw TypeError("1 argument required, but only 0 present.");
229
+ if (!(typeof Element > "u" || !(Element instanceof Object))) {
230
+ if (!(e instanceof d(e).Element)) throw TypeError("parameter 1 is not of type \"Element\".");
231
+ var t = this.observations_;
232
+ t.has(e) && (t.delete(e), t.size || this.controller_.removeObserver(this));
233
+ }
234
+ }, t.prototype.disconnect = function() {
235
+ this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this);
236
+ }, t.prototype.gatherActive = function() {
237
+ var e = this;
238
+ this.clearActive(), this.observations_.forEach(function(t) {
239
+ t.isActive() && e.activeObservations_.push(t);
240
+ });
241
+ }, t.prototype.broadcastActive = function() {
242
+ if (this.hasActive()) {
243
+ var e = this.callbackCtx_, t = this.activeObservations_.map(function(e) {
244
+ return new w(e.target, e.broadcastRect());
245
+ });
246
+ this.callback_.call(e, t, e), this.clearActive();
247
+ }
248
+ }, t.prototype.clearActive = function() {
249
+ this.activeObservations_.splice(0);
250
+ }, t.prototype.hasActive = function() {
251
+ return this.activeObservations_.length > 0;
252
+ }, t;
253
+ }(), E = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new e(), D = function() {
254
+ function e(t) {
255
+ if (!(this instanceof e)) throw TypeError("Cannot call a class as a function.");
256
+ if (!arguments.length) throw TypeError("1 argument required, but only 0 present.");
257
+ var n = new T(t, l.getInstance(), this);
258
+ E.set(this, n);
259
+ }
260
+ return e;
261
+ }();
262
+ [
263
+ "observe",
264
+ "unobserve",
265
+ "disconnect"
266
+ ].forEach(function(e) {
267
+ D.prototype[e] = function() {
268
+ var t;
269
+ return (t = E.get(this))[e].apply(t, arguments);
270
+ };
271
+ });
272
+ var O = (function() {
273
+ return n.ResizeObserver === void 0 ? D : n.ResizeObserver;
274
+ })();
275
+ //#endregion
276
+ export { O as default };
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/number-text-field-custom.jsx
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ import PropTypes from 'prop-types';
10
+ import React from 'react';
11
+ export declare class NumberTextFieldCustom extends React.Component {
12
+ static propTypes: {
13
+ className: PropTypes.Requireable<string>;
14
+ customValues: PropTypes.Requireable<any[]>;
15
+ disabled: PropTypes.Requireable<boolean>;
16
+ error: PropTypes.Requireable<boolean>;
17
+ inputClassName: PropTypes.Requireable<string>;
18
+ helperText: PropTypes.Requireable<string>;
19
+ onChange: PropTypes.Validator<(...args: any[]) => any>;
20
+ onlyIntegersAllowed: PropTypes.Requireable<boolean>;
21
+ value: PropTypes.Requireable<any>;
22
+ min: PropTypes.Requireable<number>;
23
+ max: PropTypes.Requireable<number>;
24
+ step: PropTypes.Requireable<number>;
25
+ label: PropTypes.Requireable<string>;
26
+ disableUnderline: PropTypes.Requireable<boolean>;
27
+ textAlign: PropTypes.Requireable<string>;
28
+ variant: PropTypes.Requireable<string>;
29
+ type: PropTypes.Requireable<string>;
30
+ };
31
+ static defaultProps: {
32
+ step: number;
33
+ customValues: never[];
34
+ textAlign: string;
35
+ variant: string;
36
+ onlyIntegersAllowed: boolean;
37
+ };
38
+ constructor(props: any);
39
+ UNSAFE_componentWillReceiveProps(props: any): void;
40
+ clamp(value: any, min?: any, max?: any): any;
41
+ normalizeValueAndIndex: any;
42
+ getClosestValue: (customValues: any, number: any) => any;
43
+ getClosestFractionValue: (customValues: any, number: any) => any;
44
+ getValidFraction: any;
45
+ isPositiveInteger: any;
46
+ onBlur: any;
47
+ onChange(event: any): void;
48
+ changeValue(event: any, sign?: number, shouldUpdate?: boolean): void;
49
+ render(): JSX.Element;
50
+ }
51
+ export default NumberTextFieldCustom;
52
+ //# sourceMappingURL=number-text-field-custom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-text-field-custom.d.ts","sourceRoot":"","sources":["../src/number-text-field-custom.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,MAAM,OAAO,CAAC;AA0C1B,qBAAa,qBAAsB,SAAQ,KAAK,CAAC,SAAS;IACxD,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;MAkBd;IAEF,MAAM,CAAC,YAAY;;;;;;MAMjB;gBAEU,KAAK,KAAA;IAiBjB,gCAAgC,CAAC,KAAK,KAAA;IAMtC,KAAK,CAAC,KAAK,KAAA,EAAE,GAAG,MAAiB,EAAE,GAAG,MAAiB;IAsBvD,sBAAsB,EAAE,GAAG,CAazB;IAEF,eAAe,GAAI,iBAAY,EAAE,WAAM,SAKnC;IAEJ,uBAAuB,GAAI,iBAAY,EAAE,WAAM,SAQ3C;IAEJ,gBAAgB,EAAE,GAAG,CAoBnB;IAEF,iBAAiB,EAAE,GAAG,CAEpB;IAEF,MAAM,EAAE,GAAG,CAuBT;IAEF,QAAQ,CAAC,KAAK,KAAA;IASd,WAAW,CAAC,KAAK,KAAA,EAAE,IAAI,SAAI,EAAE,YAAY,UAAQ;IA6BjD,MAAM;CA4FP;AAED,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,192 @@
1
+ import e from "react";
2
+ import t from "prop-types";
3
+ import { styled as n } from "@mui/material/styles";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ import { isFinite as i } from "lodash-es";
6
+ import a from "@mui/material/IconButton";
7
+ import o from "@mui/material/TextField";
8
+ import s from "@mui/material/InputAdornment";
9
+ import c from "@mui/icons-material/Remove";
10
+ import l from "@mui/icons-material/Add";
11
+ import * as u from "mathjs";
12
+ //#region src/number-text-field-custom.tsx
13
+ var d = n(o)(() => ({
14
+ "& input[type=number]": { MozAppearance: "textfield" },
15
+ "& input[type=number]::-webkit-outer-spin-button": {
16
+ WebkitAppearance: "none",
17
+ margin: 0
18
+ },
19
+ "& input[type=number]::-webkit-inner-spin-button": {
20
+ WebkitAppearance: "none",
21
+ margin: 0
22
+ }
23
+ })), f = n(a)(() => ({ padding: "2px" })), p = (e, t) => {
24
+ if (!i(e) && !i(t)) return 0;
25
+ if (!i(e) && i(t)) return t;
26
+ if (i(e)) return e;
27
+ }, m = class extends e.Component {
28
+ static propTypes = {
29
+ className: t.string,
30
+ customValues: t.array,
31
+ disabled: t.bool,
32
+ error: t.bool,
33
+ inputClassName: t.string,
34
+ helperText: t.string,
35
+ onChange: t.func.isRequired,
36
+ onlyIntegersAllowed: t.bool,
37
+ value: t.any,
38
+ min: t.number,
39
+ max: t.number,
40
+ step: t.number,
41
+ label: t.string,
42
+ disableUnderline: t.bool,
43
+ textAlign: t.string,
44
+ variant: t.string,
45
+ type: t.string
46
+ };
47
+ static defaultProps = {
48
+ step: 1,
49
+ customValues: [],
50
+ textAlign: "center",
51
+ variant: "standard",
52
+ onlyIntegersAllowed: !1
53
+ };
54
+ constructor(e) {
55
+ super(e);
56
+ let { value: t, currentIndex: n } = this.normalizeValueAndIndex(e.customValues, e.value);
57
+ this.state = {
58
+ value: t,
59
+ currentIndex: n
60
+ }, t !== e.value && this.props.onChange({}, t), this.onChange = this.onChange.bind(this);
61
+ }
62
+ UNSAFE_componentWillReceiveProps(e) {
63
+ let { value: t, currentIndex: n } = this.normalizeValueAndIndex(e.customValues, e.value, e.min, e.max);
64
+ this.setState({
65
+ value: t,
66
+ currentIndex: n
67
+ });
68
+ }
69
+ clamp(e, t = this.props.min, n = this.props.max) {
70
+ let { customValues: r } = this.props;
71
+ return (r || []).length > 0 ? e : i(e) ? (i(n) && (e = Math.min(e, n)), i(t) && (e = Math.max(e, t)), e) : p(t, n);
72
+ }
73
+ normalizeValueAndIndex = (e, t, n, r) => {
74
+ let { type: i } = this.props, a = this.clamp(t, n, r), o = (e || []).findIndex((e) => e === a);
75
+ if ((e || []).length > 0 && o === -1) {
76
+ let t = i === "text" ? this.getClosestFractionValue(e, a) : this.getClosestValue(e, a);
77
+ return {
78
+ value: t.value,
79
+ currentIndex: t.index
80
+ };
81
+ }
82
+ return {
83
+ value: a,
84
+ currentIndex: o
85
+ };
86
+ };
87
+ getClosestValue = (e, t) => e.reduce((e, n, r) => Math.abs(n - t) < Math.abs(e.value - t) ? {
88
+ value: n,
89
+ index: r
90
+ } : e, {
91
+ value: e[0],
92
+ index: 0
93
+ });
94
+ getClosestFractionValue = (e, t) => e.reduce((e, n, r) => Math.abs(u.number(u.fraction(n)) - u.number(u.fraction(t))) < Math.abs(u.number(u.fraction(e.value)) - u.number(u.fraction(t))) ? {
95
+ value: n,
96
+ index: r
97
+ } : e, {
98
+ value: e[0],
99
+ index: 0
100
+ });
101
+ getValidFraction = (e) => {
102
+ if (this.isPositiveInteger(e.trim())) return e.trim();
103
+ if (e.trim() === "" || e.trim().split("/").length !== 2) return !1;
104
+ let [t, n] = e.trim().split("/");
105
+ return isNaN(t) || isNaN(n) || (t = parseFloat(t), n = parseFloat(n), !Number.isInteger(t) || !Number.isInteger(n)) || t < 0 || n < 1 ? !1 : t + "/" + n;
106
+ };
107
+ isPositiveInteger = (e) => e >>> 0 === parseFloat(e);
108
+ onBlur = (e) => {
109
+ let { customValues: t, onlyIntegersAllowed: n, type: r } = this.props, { value: i } = e.target;
110
+ r === "text" && (i = this.getValidFraction(i) || this.props.value);
111
+ let a = n ? Math.round(parseFloat(i)) : parseFloat(i);
112
+ r === "text" && (a = i.trim());
113
+ let { value: o, currentIndex: s } = this.normalizeValueAndIndex(t, a);
114
+ this.setState({
115
+ value: o.toString(),
116
+ currentIndex: s
117
+ }, () => this.props.onChange(e, o));
118
+ };
119
+ onChange(e) {
120
+ let { type: t } = this.props, { value: n } = e.target;
121
+ t !== "text" && typeof n == "string" && n.trim() === "" || this.setState({ value: n });
122
+ }
123
+ changeValue(e, t = 1, n = !1) {
124
+ e.preventDefault();
125
+ let { customValues: r, step: i, onlyIntegersAllowed: a, onChange: o } = this.props, { currentIndex: s, value: c } = this.state, l = s + t * 1, u;
126
+ if (r.length > 0) {
127
+ if (l < 0 || l >= r.length) return;
128
+ u = r[l];
129
+ } else {
130
+ let e = ((a ? parseInt(c) : parseFloat(c)) * 1e4 + i * t * 1e4) / 1e4;
131
+ u = this.clamp(e);
132
+ }
133
+ this.setState({
134
+ value: u.toString(),
135
+ currentIndex: l
136
+ }, () => {
137
+ n && o(e, u);
138
+ });
139
+ }
140
+ render() {
141
+ let { className: e, label: t, disabled: n, error: a, min: o, max: u, customValues: p, inputClassName: m, disableUnderline: h, helperText: g, variant: _, textAlign: v, type: y = "number" } = this.props, { value: b } = this.state, x = e, S = !1, C = !1;
142
+ return p.length > 0 ? (S = b === p[0], C = b === p[p.length - 1]) : i(o) && i(u) && (S = b === o, C = b === u), /* @__PURE__ */ r(d, {
143
+ variant: _,
144
+ inputRef: (e) => this.inputRef = e,
145
+ disabled: n,
146
+ label: t,
147
+ value: b,
148
+ error: a,
149
+ helperText: g,
150
+ onChange: this.onChange,
151
+ onBlur: this.onBlur,
152
+ onKeyPress: (e) => {
153
+ e.key === "Enter" && this.inputRef && this.inputRef.blur();
154
+ },
155
+ onKeyDown: (e) => {
156
+ e.key === "ArrowUp" && this.changeValue(e), e.key === "ArrowDown" && this.changeValue(e, -1);
157
+ },
158
+ title: "",
159
+ type: y,
160
+ className: x,
161
+ InputProps: {
162
+ className: m,
163
+ disableUnderline: h,
164
+ startAdornment: /* @__PURE__ */ r(s, {
165
+ position: "start",
166
+ children: /* @__PURE__ */ r(f, {
167
+ disabled: n || S,
168
+ onClick: (e) => this.changeValue(e, -1, !0),
169
+ size: "large",
170
+ children: /* @__PURE__ */ r(c, { fontSize: "small" })
171
+ })
172
+ }),
173
+ endAdornment: /* @__PURE__ */ r(s, {
174
+ position: "end",
175
+ children: /* @__PURE__ */ r(f, {
176
+ disabled: n || C,
177
+ onClick: (e) => this.changeValue(e, 1, !0),
178
+ size: "large",
179
+ children: /* @__PURE__ */ r(l, { fontSize: "small" })
180
+ })
181
+ })
182
+ },
183
+ inputProps: {
184
+ style: { textAlign: v },
185
+ min: o,
186
+ max: u
187
+ }
188
+ });
189
+ }
190
+ };
191
+ //#endregion
192
+ export { m as default };