@prokodo/ui 0.0.7 → 0.0.8

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 (225) hide show
  1. package/README.md +1 -2
  2. package/dist/components/Accordion2.js +1 -0
  3. package/dist/components/Animated2.js +1 -0
  4. package/dist/components/AnimatedText2.js +1 -0
  5. package/dist/components/Avatar2.js +1 -0
  6. package/dist/components/BaseLink.js +1 -0
  7. package/dist/components/Button2.js +1 -0
  8. package/dist/components/Calendly2.js +1 -0
  9. package/dist/components/Card2.js +1 -0
  10. package/dist/components/Carousel2.js +1 -0
  11. package/dist/components/Chip2.js +1 -0
  12. package/dist/components/{ClassNameConfigurator-C6UbdI-d.js → ClassNameConfigurator.js} +1 -1
  13. package/dist/components/DatePicker2.js +1 -0
  14. package/dist/components/Dialog2.js +1 -0
  15. package/dist/components/Drawer2.js +1 -0
  16. package/dist/components/Form2.js +1 -0
  17. package/dist/components/GridRow.js +1 -0
  18. package/dist/components/Headline2.js +1 -0
  19. package/dist/components/Icon2.js +1 -0
  20. package/dist/components/Image2.js +1 -0
  21. package/dist/components/ImageText.js +1 -0
  22. package/dist/components/Input2.js +1 -0
  23. package/dist/components/InputOTP2.js +1 -0
  24. package/dist/components/Label2.js +1 -0
  25. package/dist/components/Link2.js +1 -0
  26. package/dist/components/List2.js +1 -0
  27. package/dist/components/Loading2.js +1 -0
  28. package/dist/components/Lottie2.js +1 -0
  29. package/dist/components/Map2.js +1 -0
  30. package/dist/components/PostItem.js +1 -0
  31. package/dist/components/PostTeaser.js +1 -0
  32. package/dist/components/PostWidget.js +1 -0
  33. package/dist/components/PostWidgetCarousel.js +1 -0
  34. package/dist/components/Quote2.js +1 -0
  35. package/dist/components/RichText.js +1 -0
  36. package/dist/components/{Select-DbjU6dlH.js → Select2.js} +1 -1
  37. package/dist/components/Skeleton2.js +1 -0
  38. package/dist/components/Slider2.js +1 -0
  39. package/dist/components/Stepper2.js +1 -0
  40. package/dist/components/Switch2.js +1 -0
  41. package/dist/components/Table2.js +1 -0
  42. package/dist/components/Teaser2.js +1 -0
  43. package/dist/components/accordion.js +1 -1
  44. package/dist/components/animated.js +1 -1
  45. package/dist/components/animatedText.js +1 -1
  46. package/dist/components/avatar.js +1 -1
  47. package/dist/components/base-link.js +1 -1
  48. package/dist/components/button.js +1 -1
  49. package/dist/components/calendly.js +1 -1
  50. package/dist/components/card.js +1 -1
  51. package/dist/components/carousel.js +1 -1
  52. package/dist/components/chip.js +1 -1
  53. package/dist/components/datePicker.js +1 -1
  54. package/dist/components/dialog.js +1 -1
  55. package/dist/components/drawer.js +1 -1
  56. package/dist/components/form.js +1 -1
  57. package/dist/components/grid.js +1 -1
  58. package/dist/components/headline.js +1 -1
  59. package/dist/components/icon.js +1 -1
  60. package/dist/components/image-text.js +1 -1
  61. package/dist/components/image.js +1 -1
  62. package/dist/components/input.js +1 -1
  63. package/dist/components/inputOTP.js +1 -1
  64. package/dist/components/label.js +1 -1
  65. package/dist/components/link.js +1 -1
  66. package/dist/components/list.js +1 -1
  67. package/dist/components/loading.js +1 -1
  68. package/dist/components/lottie.js +1 -1
  69. package/dist/components/map.js +1 -1
  70. package/dist/components/post-item.js +1 -1
  71. package/dist/components/post-teaser.js +1 -1
  72. package/dist/components/post-widget-carousel.js +1 -1
  73. package/dist/components/post-widget.js +1 -1
  74. package/dist/components/quote.js +1 -1
  75. package/dist/components/rich-text.js +1 -1
  76. package/dist/components/select.js +1 -1
  77. package/dist/components/skeleton.js +1 -1
  78. package/dist/components/slider.js +1 -1
  79. package/dist/components/stepper.js +1 -1
  80. package/dist/components/switch.js +1 -1
  81. package/dist/components/table.js +1 -1
  82. package/dist/components/teaser.js +1 -1
  83. package/dist/index.cjs.js +1 -1
  84. package/dist/index.es.js +40 -40
  85. package/dist/tsconfig.build.tsbuildinfo +1 -1
  86. package/dist/tsconfig.typecheck.tsbuildinfo +1 -0
  87. package/dist/types/components/accordion/index.d.ts +1 -1
  88. package/dist/types/components/animated/index.d.ts +1 -1
  89. package/dist/types/components/animatedText/index.d.ts +1 -1
  90. package/dist/types/components/avatar/index.d.ts +1 -1
  91. package/dist/types/components/base-link/index.d.ts +1 -1
  92. package/dist/types/components/button/index.d.ts +1 -1
  93. package/dist/types/components/calendly/index.d.ts +1 -1
  94. package/dist/types/components/card/index.d.ts +1 -1
  95. package/dist/types/components/carousel/index.d.ts +1 -1
  96. package/dist/types/components/chip/index.d.ts +1 -1
  97. package/dist/types/components/datePicker/index.d.ts +1 -1
  98. package/dist/types/components/dialog/index.d.ts +1 -1
  99. package/dist/types/components/drawer/index.d.ts +1 -1
  100. package/dist/types/components/form/Form.model.d.ts +4 -1
  101. package/dist/types/components/form/FormResponse.d.ts +2 -5
  102. package/dist/types/components/form/index.d.ts +2 -1
  103. package/dist/types/components/grid/Grid.d.ts +2 -6
  104. package/dist/types/components/grid/Grid.model.d.ts +17 -0
  105. package/dist/types/components/grid/GridRow.d.ts +2 -12
  106. package/dist/types/components/grid/index.d.ts +1 -0
  107. package/dist/types/components/headline/index.d.ts +1 -1
  108. package/dist/types/components/icon/index.d.ts +1 -1
  109. package/dist/types/components/image/index.d.ts +1 -1
  110. package/dist/types/components/image-text/index.d.ts +1 -1
  111. package/dist/types/components/input/index.d.ts +1 -1
  112. package/dist/types/components/inputOTP/index.d.ts +1 -1
  113. package/dist/types/components/label/index.d.ts +1 -1
  114. package/dist/types/components/link/index.d.ts +1 -1
  115. package/dist/types/components/list/index.d.ts +1 -1
  116. package/dist/types/components/loading/index.d.ts +1 -1
  117. package/dist/types/components/lottie/index.d.ts +1 -1
  118. package/dist/types/components/map/index.d.ts +1 -1
  119. package/dist/types/components/post-item/index.d.ts +2 -2
  120. package/dist/types/components/post-teaser/index.d.ts +1 -1
  121. package/dist/types/components/post-widget/index.d.ts +1 -1
  122. package/dist/types/components/post-widget-carousel/index.d.ts +1 -1
  123. package/dist/types/components/quote/index.d.ts +1 -1
  124. package/dist/types/components/rich-text/index.d.ts +1 -1
  125. package/dist/types/components/select/index.d.ts +1 -1
  126. package/dist/types/components/skeleton/index.d.ts +1 -1
  127. package/dist/types/components/slider/index.d.ts +1 -1
  128. package/dist/types/components/stepper/index.d.ts +1 -1
  129. package/dist/types/components/switch/index.d.ts +1 -1
  130. package/dist/types/components/table/index.d.ts +1 -1
  131. package/dist/types/components/teaser/index.d.ts +1 -1
  132. package/dist/types/index.d.ts +0 -40
  133. package/package.json +1 -1
  134. package/dist/components/Accordion-V3d_aGvZ.js +0 -130
  135. package/dist/components/Accordion-o8oKA6Tq.js +0 -1
  136. package/dist/components/Animated-BBfAgsHL.js +0 -64
  137. package/dist/components/Animated-CO4IEerF.js +0 -1
  138. package/dist/components/AnimatedText-BmB5Vkyq.js +0 -31
  139. package/dist/components/AnimatedText-Sy1jofZl.js +0 -1
  140. package/dist/components/Avatar-Ci5YNFc5.js +0 -95
  141. package/dist/components/Avatar-CjlbA5a5.js +0 -1
  142. package/dist/components/BaseLink-Dd9htNXU.js +0 -1
  143. package/dist/components/BaseLink-w1q9Qc1U.js +0 -30
  144. package/dist/components/Button-B8chVgsB.js +0 -111
  145. package/dist/components/Button-yvFLX-6Q.js +0 -1
  146. package/dist/components/Calendly-CWCAs02R.js +0 -1
  147. package/dist/components/Calendly-WBM4oHyC.js +0 -82
  148. package/dist/components/Card-BPEoLzF1.js +0 -1
  149. package/dist/components/Card-IW4R7bKr.js +0 -202
  150. package/dist/components/Carousel-CdS7SVzA.js +0 -1
  151. package/dist/components/Carousel-DpO4a3lm.js +0 -257
  152. package/dist/components/Chip-BmBxJH5M.js +0 -80
  153. package/dist/components/Chip-Q2ttDAQn.js +0 -1
  154. package/dist/components/ClassNameConfigurator-Ce5BUPXc.js +0 -860
  155. package/dist/components/DatePicker-BTenaDN8.js +0 -1
  156. package/dist/components/DatePicker-PK173UTy.js +0 -93
  157. package/dist/components/Dialog-Bq3tfZ0_.js +0 -1
  158. package/dist/components/Dialog-KlXAOdt_.js +0 -172
  159. package/dist/components/Drawer-DulO9091.js +0 -1
  160. package/dist/components/Drawer-i9X07r74.js +0 -120
  161. package/dist/components/Form-B6963dT5.js +0 -368
  162. package/dist/components/Form-DVNzITG2.js +0 -1
  163. package/dist/components/GridRow-1h1JHuDl.js +0 -114
  164. package/dist/components/GridRow-C5v0sOZZ.js +0 -1
  165. package/dist/components/Headline-CnyLLQLB.js +0 -1
  166. package/dist/components/Headline-DzEinaZi.js +0 -98
  167. package/dist/components/Icon-BMrVlROP.js +0 -4195
  168. package/dist/components/Icon-eWdA85cf.js +0 -1
  169. package/dist/components/Image-B-lyA7ym.js +0 -1
  170. package/dist/components/Image-CVgvVlLE.js +0 -33
  171. package/dist/components/ImageText-Cqp4xp9y.js +0 -113
  172. package/dist/components/ImageText-D-06_EGf.js +0 -1
  173. package/dist/components/Input-BEO9ig1R.js +0 -1
  174. package/dist/components/Input-CrNLI_OY.js +0 -258
  175. package/dist/components/InputOTP-Db7DHrhS.js +0 -88
  176. package/dist/components/InputOTP-MnmjEmPU.js +0 -1
  177. package/dist/components/Label-BvCzZIGM.js +0 -1
  178. package/dist/components/Label-DRUCdGoX.js +0 -71
  179. package/dist/components/Link-DSQ1125B.js +0 -69
  180. package/dist/components/Link-Dg7XR4uY.js +0 -1
  181. package/dist/components/List-D_dSwMx5.js +0 -1
  182. package/dist/components/List-P6xbVrBc.js +0 -196
  183. package/dist/components/Loading-C7lyHDW7.js +0 -68
  184. package/dist/components/Loading-U-CrTVTi.js +0 -1
  185. package/dist/components/Lottie-Br7PmIzX.js +0 -1
  186. package/dist/components/Lottie-CrvbxK0R.js +0 -87
  187. package/dist/components/Map-D3xbPS1S.js +0 -1
  188. package/dist/components/Map-DEIB_y-M.js +0 -64
  189. package/dist/components/PostItem-B8Vfv_sW.js +0 -183
  190. package/dist/components/PostItem-BSTn6cHD.js +0 -1
  191. package/dist/components/PostTeaser-BmZyqFL2.js +0 -186
  192. package/dist/components/PostTeaser-DLynX43c.js +0 -1
  193. package/dist/components/PostWidget-Bo4KiSsV.js +0 -170
  194. package/dist/components/PostWidget-DYWA-B8d.js +0 -1
  195. package/dist/components/PostWidgetCarousel-CZ6ptOGv.js +0 -168
  196. package/dist/components/PostWidgetCarousel-D7-p3Pwr.js +0 -1
  197. package/dist/components/Quote-6aurOanD.js +0 -1
  198. package/dist/components/Quote-CV_UYE1G.js +0 -101
  199. package/dist/components/RichText-Cg_XzkUs.js +0 -152
  200. package/dist/components/RichText-DVg1dwMV.js +0 -1
  201. package/dist/components/Select-BMyrX8V0.js +0 -3081
  202. package/dist/components/Skeleton-BuY3bttw.js +0 -1
  203. package/dist/components/Skeleton-D6olNYTG.js +0 -40
  204. package/dist/components/Slider-C-lecSwc.js +0 -957
  205. package/dist/components/Slider-GvO3Xllf.js +0 -1
  206. package/dist/components/Stepper-BV3PGCr2.js +0 -1
  207. package/dist/components/Stepper-CA1DOm4D.js +0 -135
  208. package/dist/components/Switch-C_6EUOIc.js +0 -330
  209. package/dist/components/Switch-Db3HpOhM.js +0 -1
  210. package/dist/components/Table-Csc0FIbX.js +0 -1
  211. package/dist/components/Table-Cy8bIv_C.js +0 -95
  212. package/dist/components/Teaser-CkisYOs-.js +0 -1
  213. package/dist/components/Teaser-Cl2oBeh5.js +0 -118
  214. package/dist/components/areArraysEqual-CJkStQkx.js +0 -20
  215. package/dist/components/bem-CYKrPjje.js +0 -11
  216. package/dist/components/calculation-79PhfKvq.js +0 -4
  217. package/dist/components/jsx-runtime-C5mzlN2N.js +0 -284
  218. package/dist/components/useControlled-BYdyS7Pn.js +0 -31
  219. package/dist/components/validations-B_cxltQ_.js +0 -8
  220. /package/dist/components/{areArraysEqual-6R3bBH2E.js → areArraysEqual.js} +0 -0
  221. /package/dist/components/{bem-DC5wv0dD.js → bem.js} +0 -0
  222. /package/dist/components/{calculation-D-p0iqpk.js → calculation.js} +0 -0
  223. /package/dist/components/{jsx-runtime-CITbqOLs.js → jsx-runtime.js} +0 -0
  224. /package/dist/components/{useControlled-Ysk4KqoX.js → useControlled.js} +0 -0
  225. /package/dist/components/{validations-Cnxtn28y.js → validations.js} +0 -0
@@ -1,957 +0,0 @@
1
- import { j as A } from "./jsx-runtime-C5mzlN2N.js";
2
- import * as h from "react";
3
- import { memo as qe, useState as Oe, useCallback as Ce, useEffect as Ye } from "react";
4
- import { c as Ge } from "./bem-CYKrPjje.js";
5
- import { L as Xe } from "./Label-DRUCdGoX.js";
6
- import { g as Be, a as We, u as Je, e as Ee, i as Me, b as X, f as Ae, c as Qe, d as Ze, P as n } from "./ClassNameConfigurator-Ce5BUPXc.js";
7
- import { u as He } from "./useControlled-BYdyS7Pn.js";
8
- import { u as Ue, v as et, a as tt } from "./areArraysEqual-CJkStQkx.js";
9
- function Ve(t, r) {
10
- return process.env.NODE_ENV === "production" ? () => null : function(...l) {
11
- return t(...l) || r(...l);
12
- };
13
- }
14
- function he(t) {
15
- return t && t.ownerDocument || document;
16
- }
17
- function Ie(t) {
18
- const r = h.useRef(t);
19
- return Ue(() => {
20
- r.current = t;
21
- }), h.useRef((...u) => (
22
- // @ts-expect-error hide `this`
23
- (0, r.current)(...u)
24
- )).current;
25
- }
26
- function ue(t, r = Number.MIN_SAFE_INTEGER, u = Number.MAX_SAFE_INTEGER) {
27
- return Math.max(r, Math.min(t, u));
28
- }
29
- function Pe(t) {
30
- return typeof t == "string";
31
- }
32
- function at(t, r, u) {
33
- return typeof t == "function" ? t(r, u) : t;
34
- }
35
- const $e = "Slider";
36
- function nt(t) {
37
- return We($e, t);
38
- }
39
- Be($e, ["root", "active", "focusVisible", "disabled", "dragging", "marked", "vertical", "trackInverted", "trackFalse", "rail", "track", "mark", "markActive", "markLabel", "markLabelActive", "thumb"]);
40
- const rt = 2;
41
- function Ke(t, r) {
42
- return t - r;
43
- }
44
- function Re(t, r) {
45
- const {
46
- index: u
47
- } = t.reduce((l, m, b) => {
48
- const x = Math.abs(r - m);
49
- return l === null || x < l.distance || x === l.distance ? {
50
- distance: x,
51
- index: b
52
- } : l;
53
- }, null) ?? {};
54
- return u;
55
- }
56
- function ge(t, r) {
57
- if (r.current !== void 0 && t.changedTouches) {
58
- const u = t;
59
- for (let l = 0; l < u.changedTouches.length; l += 1) {
60
- const m = u.changedTouches[l];
61
- if (m.identifier === r.current)
62
- return {
63
- x: m.clientX,
64
- y: m.clientY
65
- };
66
- }
67
- return !1;
68
- }
69
- return {
70
- x: t.clientX,
71
- y: t.clientY
72
- };
73
- }
74
- function xe(t, r, u) {
75
- return (t - r) * 100 / (u - r);
76
- }
77
- function ot(t, r, u) {
78
- return (u - r) * t + r;
79
- }
80
- function st(t) {
81
- if (Math.abs(t) < 1) {
82
- const u = t.toExponential().split("e-"), l = u[0].split(".")[1];
83
- return (l ? l.length : 0) + parseInt(u[1], 10);
84
- }
85
- const r = t.toString().split(".")[1];
86
- return r ? r.length : 0;
87
- }
88
- function lt(t, r, u) {
89
- const l = Math.round((t - u) / r) * r + u;
90
- return Number(l.toFixed(st(r)));
91
- }
92
- function je({
93
- values: t,
94
- newValue: r,
95
- index: u
96
- }) {
97
- const l = t.slice();
98
- return l[u] = r, l.sort(Ke);
99
- }
100
- function ye({
101
- sliderRef: t,
102
- activeIndex: r,
103
- setActive: u
104
- }) {
105
- var m, b, x;
106
- const l = he(t.current);
107
- (!((m = t.current) != null && m.contains(l.activeElement)) || Number((b = l == null ? void 0 : l.activeElement) == null ? void 0 : b.getAttribute("data-index")) !== r) && ((x = t.current) == null || x.querySelector(`[type="range"][data-index="${r}"]`).focus()), u && u(r);
108
- }
109
- function ke(t, r) {
110
- return typeof t == "number" && typeof r == "number" ? t === r : typeof t == "object" && typeof r == "object" ? tt(t, r) : !1;
111
- }
112
- const it = {
113
- horizontal: {
114
- offset: (t) => ({
115
- left: `${t}%`
116
- }),
117
- leap: (t) => ({
118
- width: `${t}%`
119
- })
120
- },
121
- "horizontal-reverse": {
122
- offset: (t) => ({
123
- right: `${t}%`
124
- }),
125
- leap: (t) => ({
126
- width: `${t}%`
127
- })
128
- },
129
- vertical: {
130
- offset: (t) => ({
131
- bottom: `${t}%`
132
- }),
133
- leap: (t) => ({
134
- height: `${t}%`
135
- })
136
- }
137
- }, ut = (t) => t;
138
- let ve;
139
- function De() {
140
- return ve === void 0 && (typeof CSS < "u" && typeof CSS.supports == "function" ? ve = CSS.supports("touch-action", "none") : ve = !0), ve;
141
- }
142
- function ct(t) {
143
- const {
144
- "aria-labelledby": r,
145
- defaultValue: u,
146
- disabled: l = !1,
147
- disableSwap: m = !1,
148
- isRtl: b = !1,
149
- marks: x = !1,
150
- max: S = 100,
151
- min: d = 0,
152
- name: P,
153
- onChange: w,
154
- onChangeCommitted: F,
155
- orientation: O = "horizontal",
156
- rootRef: R,
157
- scale: U = ut,
158
- step: C = 1,
159
- shiftStep: B = 10,
160
- tabIndex: ae,
161
- value: M
162
- } = t, T = h.useRef(void 0), [$, W] = h.useState(-1), [J, Q] = h.useState(-1), [K, ce] = h.useState(!1), Z = h.useRef(0), [g, _] = He({
163
- controlled: M,
164
- default: u ?? d,
165
- name: "Slider"
166
- }), V = w && ((e, a, s) => {
167
- const c = e.nativeEvent || e, i = new c.constructor(c.type, c);
168
- Object.defineProperty(i, "target", {
169
- writable: !0,
170
- value: {
171
- value: a,
172
- name: P
173
- }
174
- }), w(i, a, s);
175
- }), z = Array.isArray(g);
176
- let p = z ? g.slice().sort(Ke) : [g];
177
- p = p.map((e) => e == null ? d : ue(e, d, S));
178
- const ne = x === !0 && C !== null ? [...Array(Math.floor((S - d) / C) + 1)].map((e, a) => ({
179
- value: d + C * a
180
- })) : x || [], I = ne.map((e) => e.value), [fe, q] = h.useState(-1), y = h.useRef(null), re = Je(R, y), oe = (e) => (a) => {
181
- var c;
182
- const s = Number(a.currentTarget.getAttribute("data-index"));
183
- Me(a.target) && q(s), Q(s), (c = e == null ? void 0 : e.onFocus) == null || c.call(e, a);
184
- }, Se = (e) => (a) => {
185
- var s;
186
- Me(a.target) || q(-1), Q(-1), (s = e == null ? void 0 : e.onBlur) == null || s.call(e, a);
187
- }, H = (e, a) => {
188
- const s = Number(e.currentTarget.getAttribute("data-index")), c = p[s], i = I.indexOf(c);
189
- let o = a;
190
- if (ne && C == null) {
191
- const N = I[I.length - 1];
192
- o > N ? o = N : o < I[0] ? o = I[0] : o = o < c ? I[i - 1] : I[i + 1];
193
- }
194
- if (o = ue(o, d, S), z) {
195
- m && (o = ue(o, p[s - 1] || -1 / 0, p[s + 1] || 1 / 0));
196
- const N = o;
197
- o = je({
198
- values: p,
199
- newValue: o,
200
- index: s
201
- });
202
- let E = s;
203
- m || (E = o.indexOf(N)), ye({
204
- sliderRef: y,
205
- activeIndex: E
206
- });
207
- }
208
- _(o), q(s), V && !ke(o, g) && V(e, o, s), F && F(e, o);
209
- }, L = (e) => (a) => {
210
- var s;
211
- if (C !== null) {
212
- const c = Number(a.currentTarget.getAttribute("data-index")), i = p[c];
213
- let o = null;
214
- (a.key === "ArrowLeft" || a.key === "ArrowDown") && a.shiftKey || a.key === "PageDown" ? o = Math.max(i - B, d) : ((a.key === "ArrowRight" || a.key === "ArrowUp") && a.shiftKey || a.key === "PageUp") && (o = Math.min(i + B, S)), o !== null && (H(a, o), a.preventDefault());
215
- }
216
- (s = e == null ? void 0 : e.onKeyDown) == null || s.call(e, a);
217
- };
218
- Ue(() => {
219
- var e;
220
- l && y.current.contains(document.activeElement) && ((e = document.activeElement) == null || e.blur());
221
- }, [l]), l && $ !== -1 && W(-1), l && fe !== -1 && q(-1);
222
- const Te = (e) => (a) => {
223
- var s;
224
- (s = e.onChange) == null || s.call(e, a), H(a, a.target.valueAsNumber);
225
- }, de = h.useRef(void 0);
226
- let ee = O;
227
- b && O === "horizontal" && (ee += "-reverse");
228
- const v = ({
229
- finger: e,
230
- move: a = !1
231
- }) => {
232
- const {
233
- current: s
234
- } = y, {
235
- width: c,
236
- height: i,
237
- bottom: o,
238
- left: N
239
- } = s.getBoundingClientRect();
240
- let E;
241
- ee.startsWith("vertical") ? E = (o - e.y) / i : E = (e.x - N) / c, ee.indexOf("-reverse") !== -1 && (E = 1 - E);
242
- let f;
243
- if (f = ot(E, d, S), C)
244
- f = lt(f, C, d);
245
- else {
246
- const Ne = Re(I, f);
247
- f = I[Ne];
248
- }
249
- f = ue(f, d, S);
250
- let G = 0;
251
- if (z) {
252
- a ? G = de.current : G = Re(p, f), m && (f = ue(f, p[G - 1] || -1 / 0, p[G + 1] || 1 / 0));
253
- const Ne = f;
254
- f = je({
255
- values: p,
256
- newValue: f,
257
- index: G
258
- }), m && a || (G = f.indexOf(Ne), de.current = G);
259
- }
260
- return {
261
- newValue: f,
262
- activeIndex: G
263
- };
264
- }, k = Ie((e) => {
265
- const a = ge(e, T);
266
- if (!a)
267
- return;
268
- if (Z.current += 1, e.type === "mousemove" && e.buttons === 0) {
269
- j(e);
270
- return;
271
- }
272
- const {
273
- newValue: s,
274
- activeIndex: c
275
- } = v({
276
- finger: a,
277
- move: !0
278
- });
279
- ye({
280
- sliderRef: y,
281
- activeIndex: c,
282
- setActive: W
283
- }), _(s), !K && Z.current > rt && ce(!0), V && !ke(s, g) && V(e, s, c);
284
- }), j = Ie((e) => {
285
- const a = ge(e, T);
286
- if (ce(!1), !a)
287
- return;
288
- const {
289
- newValue: s
290
- } = v({
291
- finger: a,
292
- move: !0
293
- });
294
- W(-1), e.type === "touchend" && Q(-1), F && F(e, s), T.current = void 0, Y();
295
- }), se = Ie((e) => {
296
- if (l)
297
- return;
298
- De() || e.preventDefault();
299
- const a = e.changedTouches[0];
300
- a != null && (T.current = a.identifier);
301
- const s = ge(e, T);
302
- if (s !== !1) {
303
- const {
304
- newValue: i,
305
- activeIndex: o
306
- } = v({
307
- finger: s
308
- });
309
- ye({
310
- sliderRef: y,
311
- activeIndex: o,
312
- setActive: W
313
- }), _(i), V && !ke(i, g) && V(e, i, o);
314
- }
315
- Z.current = 0;
316
- const c = he(y.current);
317
- c.addEventListener("touchmove", k, {
318
- passive: !0
319
- }), c.addEventListener("touchend", j, {
320
- passive: !0
321
- });
322
- }), Y = h.useCallback(() => {
323
- const e = he(y.current);
324
- e.removeEventListener("mousemove", k), e.removeEventListener("mouseup", j), e.removeEventListener("touchmove", k), e.removeEventListener("touchend", j);
325
- }, [j, k]);
326
- h.useEffect(() => {
327
- const {
328
- current: e
329
- } = y;
330
- return e.addEventListener("touchstart", se, {
331
- passive: De()
332
- }), () => {
333
- e.removeEventListener("touchstart", se), Y();
334
- };
335
- }, [Y, se]), h.useEffect(() => {
336
- l && Y();
337
- }, [l, Y]);
338
- const _e = (e) => (a) => {
339
- var i;
340
- if ((i = e.onMouseDown) == null || i.call(e, a), l || a.defaultPrevented || a.button !== 0)
341
- return;
342
- a.preventDefault();
343
- const s = ge(a, T);
344
- if (s !== !1) {
345
- const {
346
- newValue: o,
347
- activeIndex: N
348
- } = v({
349
- finger: s
350
- });
351
- ye({
352
- sliderRef: y,
353
- activeIndex: N,
354
- setActive: W
355
- }), _(o), V && !ke(o, g) && V(a, o, N);
356
- }
357
- Z.current = 0;
358
- const c = he(y.current);
359
- c.addEventListener("mousemove", k, {
360
- passive: !0
361
- }), c.addEventListener("mouseup", j);
362
- }, le = xe(z ? p[0] : d, d, S), Le = xe(p[p.length - 1], d, S) - le, me = (e = {}) => {
363
- const a = Ee(e), s = {
364
- onMouseDown: _e(a || {})
365
- }, c = {
366
- ...a,
367
- ...s
368
- };
369
- return {
370
- ...e,
371
- ref: re,
372
- ...c
373
- };
374
- }, ie = (e) => (a) => {
375
- var c;
376
- (c = e.onMouseOver) == null || c.call(e, a);
377
- const s = Number(a.currentTarget.getAttribute("data-index"));
378
- Q(s);
379
- }, te = (e) => (a) => {
380
- var s;
381
- (s = e.onMouseLeave) == null || s.call(e, a), Q(-1);
382
- };
383
- return {
384
- active: $,
385
- axis: ee,
386
- axisProps: it,
387
- dragging: K,
388
- focusedThumbIndex: fe,
389
- getHiddenInputProps: (e = {}) => {
390
- const a = Ee(e), s = {
391
- onChange: Te(a || {}),
392
- onFocus: oe(a || {}),
393
- onBlur: Se(a || {}),
394
- onKeyDown: L(a || {})
395
- }, c = {
396
- ...a,
397
- ...s
398
- };
399
- return {
400
- tabIndex: ae,
401
- "aria-labelledby": r,
402
- "aria-orientation": O,
403
- "aria-valuemax": U(S),
404
- "aria-valuemin": U(d),
405
- name: P,
406
- type: "range",
407
- min: t.min,
408
- max: t.max,
409
- step: t.step === null && t.marks ? "any" : t.step ?? void 0,
410
- disabled: l,
411
- ...e,
412
- ...c,
413
- style: {
414
- ...et,
415
- direction: b ? "rtl" : "ltr",
416
- // So that VoiceOver's focus indicator matches the thumb's dimensions
417
- width: "100%",
418
- height: "100%"
419
- }
420
- };
421
- },
422
- getRootProps: me,
423
- getThumbProps: (e = {}) => {
424
- const a = Ee(e), s = {
425
- onMouseOver: ie(a || {}),
426
- onMouseLeave: te(a || {})
427
- };
428
- return {
429
- ...e,
430
- ...a,
431
- ...s
432
- };
433
- },
434
- marks: ne,
435
- open: J,
436
- range: z,
437
- rootRef: re,
438
- trackLeap: Le,
439
- trackOffset: le,
440
- values: p,
441
- getThumbStyle: (e) => ({
442
- // So the non active thumb doesn't show its label on hover.
443
- pointerEvents: $ !== -1 && $ !== e ? "none" : void 0
444
- })
445
- };
446
- }
447
- function Fe(t) {
448
- return t;
449
- }
450
- const ft = (t) => {
451
- const {
452
- disabled: r,
453
- dragging: u,
454
- marked: l,
455
- orientation: m,
456
- track: b
457
- } = t;
458
- return Qe({
459
- root: ["root", r && "disabled", u && "dragging", l && "marked", m === "vertical" && "vertical", b === "inverted" && "trackInverted", b === !1 && "trackFalse"],
460
- rail: ["rail"],
461
- track: ["track"],
462
- mark: ["mark"],
463
- markActive: ["markActive"],
464
- markLabel: ["markLabel"],
465
- markLabelActive: ["markLabelActive"],
466
- valueLabel: ["valueLabel"],
467
- thumb: ["thumb", r && "disabled"],
468
- active: ["active"],
469
- disabled: ["disabled"],
470
- focusVisible: ["focusVisible"]
471
- }, Ze(nt));
472
- }, ze = /* @__PURE__ */ h.forwardRef(function(r, u) {
473
- const {
474
- "aria-label": l,
475
- "aria-valuetext": m,
476
- "aria-labelledby": b,
477
- className: x,
478
- disableSwap: S = !1,
479
- disabled: d = !1,
480
- getAriaLabel: P,
481
- getAriaValueText: w,
482
- marks: F = !1,
483
- max: O = 100,
484
- min: R = 0,
485
- name: U,
486
- onChange: C,
487
- onChangeCommitted: B,
488
- orientation: ae = "horizontal",
489
- shiftStep: M = 10,
490
- scale: T = Fe,
491
- step: $ = 1,
492
- tabIndex: W,
493
- track: J = "normal",
494
- value: Q,
495
- valueLabelFormat: K = Fe,
496
- isRtl: ce = !1,
497
- defaultValue: Z,
498
- slotProps: g = {},
499
- slots: _ = {},
500
- ...V
501
- } = r, z = {
502
- ...r,
503
- marks: F,
504
- disabled: d,
505
- disableSwap: S,
506
- isRtl: ce,
507
- defaultValue: Z,
508
- max: O,
509
- min: R,
510
- orientation: ae,
511
- scale: T,
512
- step: $,
513
- shiftStep: M,
514
- track: J,
515
- valueLabelFormat: K
516
- }, {
517
- axisProps: p,
518
- getRootProps: ne,
519
- getHiddenInputProps: I,
520
- getThumbProps: fe,
521
- active: q,
522
- axis: y,
523
- range: re,
524
- focusedThumbIndex: oe,
525
- dragging: Se,
526
- marks: H,
527
- values: L,
528
- trackOffset: Te,
529
- trackLeap: de,
530
- getThumbStyle: ee
531
- } = ct({
532
- ...z,
533
- rootRef: u
534
- }), v = {
535
- ...z,
536
- marked: H.length > 0 && H.some((i) => i.label),
537
- dragging: Se,
538
- focusedThumbIndex: oe,
539
- activeThumbIndex: q
540
- }, k = ft(v), j = _.root ?? "span", se = X({
541
- elementType: j,
542
- getSlotProps: ne,
543
- externalSlotProps: g.root,
544
- externalForwardedProps: V,
545
- ownerState: v,
546
- className: [k.root, x]
547
- }), Y = _.rail ?? "span", _e = X({
548
- elementType: Y,
549
- externalSlotProps: g.rail,
550
- ownerState: v,
551
- className: k.rail
552
- }), le = _.track ?? "span", Le = X({
553
- elementType: le,
554
- externalSlotProps: g.track,
555
- additionalProps: {
556
- style: {
557
- ...p[y].offset(Te),
558
- ...p[y].leap(de)
559
- }
560
- },
561
- ownerState: v,
562
- className: k.track
563
- }), me = _.thumb ?? "span", ie = X({
564
- elementType: me,
565
- getSlotProps: fe,
566
- externalSlotProps: g.thumb,
567
- ownerState: v,
568
- skipResolvingSlotProps: !0
569
- }), te = _.valueLabel, we = X({
570
- elementType: te,
571
- externalSlotProps: g.valueLabel,
572
- ownerState: v
573
- }), pe = _.mark ?? "span", be = X({
574
- elementType: pe,
575
- externalSlotProps: g.mark,
576
- ownerState: v,
577
- className: k.mark
578
- }), e = _.markLabel ?? "span", a = X({
579
- elementType: e,
580
- externalSlotProps: g.markLabel,
581
- ownerState: v
582
- }), s = _.input || "input", c = X({
583
- elementType: s,
584
- getSlotProps: I,
585
- externalSlotProps: g.input,
586
- ownerState: v
587
- });
588
- return /* @__PURE__ */ A.jsxs(j, {
589
- ...se,
590
- children: [/* @__PURE__ */ A.jsx(Y, {
591
- ..._e
592
- }), /* @__PURE__ */ A.jsx(le, {
593
- ...Le
594
- }), H.filter((i) => i.value >= R && i.value <= O).map((i, o) => {
595
- const N = xe(i.value, R, O), E = p[y].offset(N);
596
- let f;
597
- return J === !1 ? f = L.indexOf(i.value) !== -1 : f = J === "normal" && (re ? i.value >= L[0] && i.value <= L[L.length - 1] : i.value <= L[0]) || J === "inverted" && (re ? i.value <= L[0] || i.value >= L[L.length - 1] : i.value >= L[0]), /* @__PURE__ */ A.jsxs(h.Fragment, {
598
- children: [/* @__PURE__ */ A.jsx(pe, {
599
- "data-index": o,
600
- ...be,
601
- ...!Pe(pe) && {
602
- markActive: f
603
- },
604
- style: {
605
- ...E,
606
- ...be.style
607
- },
608
- className: Ae(be.className, f && k.markActive)
609
- }), i.label != null ? /* @__PURE__ */ A.jsx(e, {
610
- "aria-hidden": !0,
611
- "data-index": o,
612
- ...a,
613
- ...!Pe(e) && {
614
- markLabelActive: f
615
- },
616
- style: {
617
- ...E,
618
- ...a.style
619
- },
620
- className: Ae(k.markLabel, a.className, f && k.markLabelActive),
621
- children: i.label
622
- }) : null]
623
- }, o);
624
- }), L.map((i, o) => {
625
- const N = xe(i, R, O), E = p[y].offset(N), f = at(g.thumb, v, {
626
- index: o,
627
- focused: oe === o,
628
- active: q === o
629
- });
630
- return /* @__PURE__ */ A.jsxs(me, {
631
- "data-index": o,
632
- ...ie,
633
- ...f,
634
- className: Ae(k.thumb, ie.className, f == null ? void 0 : f.className, q === o && k.active, oe === o && k.focusVisible),
635
- style: {
636
- ...E,
637
- ...ee(o),
638
- ...ie.style,
639
- ...f == null ? void 0 : f.style
640
- },
641
- children: [/* @__PURE__ */ A.jsx(s, {
642
- "data-index": o,
643
- "aria-label": P ? P(o) : l,
644
- "aria-valuenow": T(i),
645
- "aria-labelledby": b,
646
- "aria-valuetext": w ? w(T(i), o) : m,
647
- value: L[o],
648
- ...c
649
- }), te ? /* @__PURE__ */ A.jsx(te, {
650
- ...!Pe(te) && {
651
- valueLabelFormat: K,
652
- index: o,
653
- disabled: d
654
- },
655
- ...we,
656
- children: typeof K == "function" ? K(T(i), o) : K
657
- }) : null]
658
- }, o);
659
- })]
660
- });
661
- });
662
- process.env.NODE_ENV !== "production" && (ze.propTypes = {
663
- // ┌────────────────────────────── Warning ──────────────────────────────┐
664
- // │ These PropTypes are generated from the TypeScript type definitions. │
665
- // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
666
- // └─────────────────────────────────────────────────────────────────────┘
667
- /**
668
- * The label of the slider.
669
- */
670
- "aria-label": Ve(n.string, (t) => Array.isArray(t.value || t.defaultValue) && t["aria-label"] != null ? new Error("MUI: You need to use the `getAriaLabel` prop instead of `aria-label` when using a range slider.") : null),
671
- /**
672
- * The id of the element containing a label for the slider.
673
- */
674
- "aria-labelledby": n.string,
675
- /**
676
- * A string value that provides a user-friendly name for the current value of the slider.
677
- */
678
- "aria-valuetext": Ve(n.string, (t) => Array.isArray(t.value || t.defaultValue) && t["aria-valuetext"] != null ? new Error("MUI: You need to use the `getAriaValueText` prop instead of `aria-valuetext` when using a range slider.") : null),
679
- /**
680
- * The default value. Use when the component is not controlled.
681
- */
682
- defaultValue: n.oneOfType([n.arrayOf(n.number), n.number]),
683
- /**
684
- * If `true`, the component is disabled.
685
- * @default false
686
- */
687
- disabled: n.bool,
688
- /**
689
- * If `true`, the active thumb doesn't swap when moving pointer over a thumb while dragging another thumb.
690
- * @default false
691
- */
692
- disableSwap: n.bool,
693
- /**
694
- * Accepts a function which returns a string value that provides a user-friendly name for the thumb labels of the slider.
695
- * This is important for screen reader users.
696
- * @param {number} index The thumb label's index to format.
697
- * @returns {string}
698
- */
699
- getAriaLabel: n.func,
700
- /**
701
- * Accepts a function which returns a string value that provides a user-friendly name for the current value of the slider.
702
- * This is important for screen reader users.
703
- * @param {number} value The thumb label's value to format.
704
- * @param {number} index The thumb label's index to format.
705
- * @returns {string}
706
- */
707
- getAriaValueText: n.func,
708
- /**
709
- * If `true` the Slider will be rendered right-to-left (with the lowest value on the right-hand side).
710
- * @default false
711
- */
712
- isRtl: n.bool,
713
- /**
714
- * Marks indicate predetermined values to which the user can move the slider.
715
- * If `true` the marks are spaced according the value of the `step` prop.
716
- * If an array, it should contain objects with `value` and an optional `label` keys.
717
- * @default false
718
- */
719
- marks: n.oneOfType([n.arrayOf(n.shape({
720
- label: n.node,
721
- value: n.number.isRequired
722
- })), n.bool]),
723
- /**
724
- * The maximum allowed value of the slider.
725
- * Should not be equal to min.
726
- * @default 100
727
- */
728
- max: n.number,
729
- /**
730
- * The minimum allowed value of the slider.
731
- * Should not be equal to max.
732
- * @default 0
733
- */
734
- min: n.number,
735
- /**
736
- * Name attribute of the hidden `input` element.
737
- */
738
- name: n.string,
739
- /**
740
- * Callback function that is fired when the slider's value changed.
741
- *
742
- * @param {Event} event The event source of the callback.
743
- * You can pull out the new value by accessing `event.target.value` (any).
744
- * **Warning**: This is a generic event not a change event.
745
- * @param {number | number[]} value The new value.
746
- * @param {number} activeThumb Index of the currently moved thumb.
747
- */
748
- onChange: n.func,
749
- /**
750
- * Callback function that is fired when the `mouseup` is triggered.
751
- *
752
- * @param {React.SyntheticEvent | Event} event The event source of the callback. **Warning**: This is a generic event not a change event.
753
- * @param {number | number[]} value The new value.
754
- */
755
- onChangeCommitted: n.func,
756
- /**
757
- * The component orientation.
758
- * @default 'horizontal'
759
- */
760
- orientation: n.oneOf(["horizontal", "vertical"]),
761
- /**
762
- * A transformation function, to change the scale of the slider.
763
- * @param {any} x
764
- * @returns {any}
765
- * @default function Identity(x) {
766
- * return x;
767
- * }
768
- */
769
- scale: n.func,
770
- /**
771
- * The granularity with which the slider can step through values when using Page Up/Page Down or Shift + Arrow Up/Arrow Down.
772
- * @default 10
773
- */
774
- shiftStep: n.number,
775
- /**
776
- * The props used for each slot inside the Slider.
777
- * @default {}
778
- */
779
- slotProps: n.shape({
780
- input: n.oneOfType([n.func, n.object]),
781
- mark: n.oneOfType([n.func, n.object]),
782
- markLabel: n.oneOfType([n.func, n.object]),
783
- rail: n.oneOfType([n.func, n.object]),
784
- root: n.oneOfType([n.func, n.object]),
785
- thumb: n.oneOfType([n.func, n.object]),
786
- track: n.oneOfType([n.func, n.object]),
787
- valueLabel: n.oneOfType([n.any, n.func])
788
- }),
789
- /**
790
- * The components used for each slot inside the Slider.
791
- * Either a string to use a HTML element or a component.
792
- * @default {}
793
- */
794
- slots: n.shape({
795
- input: n.elementType,
796
- mark: n.elementType,
797
- markLabel: n.elementType,
798
- rail: n.elementType,
799
- root: n.elementType,
800
- thumb: n.elementType,
801
- track: n.elementType,
802
- valueLabel: n.elementType
803
- }),
804
- /**
805
- * The granularity with which the slider can step through values. (A "discrete" slider.)
806
- * The `min` prop serves as the origin for the valid values.
807
- * We recommend (max - min) to be evenly divisible by the step.
808
- *
809
- * When step is `null`, the thumb can only be slid onto marks provided with the `marks` prop.
810
- * @default 1
811
- */
812
- step: n.number,
813
- /**
814
- * Tab index attribute of the hidden `input` element.
815
- */
816
- tabIndex: n.number,
817
- /**
818
- * The track presentation:
819
- *
820
- * - `normal` the track will render a bar representing the slider value.
821
- * - `inverted` the track will render a bar representing the remaining slider value.
822
- * - `false` the track will render without a bar.
823
- * @default 'normal'
824
- */
825
- track: n.oneOf(["inverted", "normal", !1]),
826
- /**
827
- * The value of the slider.
828
- * For ranged sliders, provide an array with two values.
829
- */
830
- value: n.oneOfType([n.arrayOf(n.number), n.number]),
831
- /**
832
- * The format function the value label's value.
833
- *
834
- * When a function is provided, it should have the following signature:
835
- *
836
- * - {number} value The value label's value to format
837
- * - {number} index The value label's index to format
838
- * @param {any} x
839
- * @returns {any}
840
- * @default function Identity(x) {
841
- * return x;
842
- * }
843
- */
844
- valueLabelFormat: n.oneOfType([n.func, n.string])
845
- });
846
- const dt = "gradientMove", mt = "fadeInKeyframe", pt = {
847
- "prokodo-Slider": "prokodo-Slider",
848
- "prokodo-Slider__label": "prokodo-Slider__label",
849
- "prokodo-Slider__root": "prokodo-Slider__root",
850
- "prokodo-Slider__root--disabled": "prokodo-Slider__root--disabled",
851
- "prokodo-Slider__rail": "prokodo-Slider__rail",
852
- "prokodo-Slider__track": "prokodo-Slider__track",
853
- "prokodo-Slider__thumb": "prokodo-Slider__thumb",
854
- "prokodo-Slider__thumb--focused": "prokodo-Slider__thumb--focused",
855
- "prokodo-Slider__mark": "prokodo-Slider__mark",
856
- "prokodo-Slider__mark__label": "prokodo-Slider__mark__label",
857
- "prokodo-Slider__valueText": "prokodo-Slider__valueText",
858
- gradientMove: dt,
859
- fadeInKeyframe: mt
860
- }, D = Ge(pt, "Slider"), bt = qe(
861
- ({
862
- id: t,
863
- className: r,
864
- required: u,
865
- value: l,
866
- label: m,
867
- labelProps: b,
868
- valueLabelProps: x,
869
- disabled: S,
870
- onFocus: d,
871
- onBlur: P,
872
- onChange: w,
873
- ...F
874
- }) => {
875
- const [O, R] = Oe(
876
- Number(l) ?? 0
877
- ), [U, C] = Oe(!1), B = Ce(
878
- (M) => {
879
- C(!U), U ? P == null || P(M) : d == null || d(M);
880
- },
881
- [U, d, P]
882
- );
883
- Ye(() => {
884
- l !== void 0 && R(Number(l));
885
- }, [l]);
886
- const ae = Ce(
887
- (M, T, $) => {
888
- R(T), w == null || w(M, T, $);
889
- },
890
- [w]
891
- );
892
- return /* @__PURE__ */ A.jsxs("div", { className: D(void 0, void 0, r), children: [
893
- /* @__PURE__ */ A.jsx(
894
- Xe,
895
- {
896
- ...b,
897
- className: D("label"),
898
- htmlFor: t,
899
- label: m,
900
- required: u
901
- }
902
- ),
903
- /* @__PURE__ */ A.jsx(
904
- ze,
905
- {
906
- marks: !0,
907
- "aria-label": m,
908
- id: t,
909
- ...F,
910
- disabled: S,
911
- value: O,
912
- slotProps: {
913
- root: {
914
- className: D("root", {
915
- disabled: !!S
916
- })
917
- },
918
- rail: {
919
- className: D("rail")
920
- },
921
- track: {
922
- className: D("track")
923
- },
924
- thumb: {
925
- className: D("thumb", {
926
- focused: U
927
- })
928
- },
929
- mark: {
930
- className: D("mark")
931
- },
932
- markLabel: {
933
- className: D("mark__label")
934
- }
935
- },
936
- slots: {
937
- valueLabel: ({ children: M }) => /* @__PURE__ */ A.jsx(
938
- "span",
939
- {
940
- ...x,
941
- className: D("valueText", void 0, b == null ? void 0 : b.className),
942
- children: M
943
- }
944
- )
945
- },
946
- onBlur: B,
947
- onChange: ae,
948
- onFocus: B
949
- }
950
- )
951
- ] });
952
- }
953
- );
954
- bt.displayName = "Slider";
955
- export {
956
- bt as S
957
- };