@dotss/ui 0.0.10 → 0.0.11

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 (159) hide show
  1. package/Accordion/Accordion.cjs +13 -7
  2. package/Accordion/Accordion.d.ts +2 -0
  3. package/Accordion/Accordion.es.js +86 -65
  4. package/Autocomplete/Autocomplete.cjs +1 -1
  5. package/Autocomplete/Autocomplete.d.ts +1 -1
  6. package/Autocomplete/Autocomplete.es.js +235 -80
  7. package/BottomSheet/BottomSheet.cjs +5 -5
  8. package/BottomSheet/BottomSheet.d.ts +3 -0
  9. package/BottomSheet/BottomSheet.es.js +88 -70
  10. package/BottomSheet/BottomSheetText/BottomSheetText.cjs +2 -2
  11. package/BottomSheet/BottomSheetText/BottomSheetText.es.js +18 -6
  12. package/BottomSheet/BottomSheetTitle/BottomSheetTitle.cjs +6 -6
  13. package/BottomSheet/BottomSheetTitle/BottomSheetTitle.d.ts +2 -1
  14. package/BottomSheet/BottomSheetTitle/BottomSheetTitle.es.js +26 -15
  15. package/Button/Button.cjs +6 -6
  16. package/Button/Button.es.js +35 -29
  17. package/ChainPicker/ChainPicker.cjs +16 -6
  18. package/ChainPicker/ChainPicker.d.ts +4 -2
  19. package/ChainPicker/ChainPicker.es.js +155 -110
  20. package/ChainPicker/ChainPicker.stories.d.ts +1 -1
  21. package/Checkbox/Checkbox.cjs +3 -3
  22. package/Checkbox/Checkbox.es.js +12 -10
  23. package/CircularProgressIndicator/CircularProgressIndicator.cjs +5 -5
  24. package/CircularProgressIndicator/CircularProgressIndicator.es.js +26 -23
  25. package/DatePicker/DatePicker.cjs +37 -20
  26. package/DatePicker/DatePicker.d.ts +2 -1
  27. package/DatePicker/DatePicker.es.js +345 -320
  28. package/DatePicker/DatePicker.stories.d.ts +1 -0
  29. package/DatePicker/EventDot/EventDot.cjs +8 -0
  30. package/DatePicker/EventDot/EventDot.d.ts +8 -0
  31. package/DatePicker/EventDot/EventDot.es.js +19 -0
  32. package/DatePicker/EventDot/index.cjs +1 -0
  33. package/DatePicker/EventDot/index.d.ts +3 -0
  34. package/DatePicker/EventDot/index.es.js +4 -0
  35. package/DatePicker/EventDotGroup/EventDotGroup.cjs +8 -0
  36. package/DatePicker/EventDotGroup/EventDotGroup.d.ts +8 -0
  37. package/DatePicker/EventDotGroup/EventDotGroup.es.js +39 -0
  38. package/DatePicker/EventDotGroup/index.cjs +1 -0
  39. package/DatePicker/EventDotGroup/index.d.ts +3 -0
  40. package/DatePicker/EventDotGroup/index.es.js +4 -0
  41. package/DatePicker/index.cjs +1 -1
  42. package/DatePicker/index.d.ts +2 -0
  43. package/DatePicker/index.es.js +6 -2
  44. package/Dialog/Dialog.cjs +2 -2
  45. package/Dialog/Dialog.d.ts +2 -0
  46. package/Dialog/Dialog.es.js +45 -40
  47. package/Dialog/Dialog.stories.d.ts +10 -0
  48. package/Dialog/DialogText/DialogText.cjs +1 -1
  49. package/Dialog/DialogText/DialogText.es.js +1 -1
  50. package/Dialog/DialogTitle/DialogTitle.cjs +4 -4
  51. package/Dialog/DialogTitle/DialogTitle.d.ts +2 -1
  52. package/Dialog/DialogTitle/DialogTitle.es.js +17 -17
  53. package/FocusBoundary/FocusBoundary.cjs +1 -1
  54. package/FocusBoundary/FocusBoundary.d.ts +3 -1
  55. package/FocusBoundary/FocusBoundary.es.js +49 -42
  56. package/FormControlText/FormControlText.cjs +7 -5
  57. package/FormControlText/FormControlText.d.ts +2 -0
  58. package/FormControlText/FormControlText.es.js +50 -40
  59. package/Icon/Icon.cjs +1 -1
  60. package/Icon/Icon.es.js +1 -1
  61. package/IconButton/IconButton.cjs +8 -8
  62. package/IconButton/IconButton.es.js +32 -25
  63. package/LineProgressIndicator/LineProgressIndicator.cjs +6 -6
  64. package/LineProgressIndicator/LineProgressIndicator.es.js +35 -23
  65. package/Menu/Menu.cjs +16 -16
  66. package/Menu/Menu.d.ts +3 -2
  67. package/Menu/Menu.es.js +115 -81
  68. package/Menu/Menu.stories.d.ts +1 -0
  69. package/Menu/MenuBlock/MenuBlock.cjs +14 -7
  70. package/Menu/MenuBlock/MenuBlock.d.ts +1 -0
  71. package/Menu/MenuBlock/MenuBlock.es.js +47 -35
  72. package/Menu/MenuButton/MenuButton.cjs +1 -0
  73. package/Menu/MenuButton/MenuButton.d.ts +10 -0
  74. package/Menu/MenuButton/MenuButton.es.js +44 -0
  75. package/Menu/MenuButton/index.cjs +1 -0
  76. package/Menu/MenuButton/index.d.ts +3 -0
  77. package/Menu/MenuButton/index.es.js +4 -0
  78. package/Menu/index.cjs +1 -1
  79. package/Menu/index.d.ts +1 -0
  80. package/Menu/index.es.js +4 -2
  81. package/NumberKeypad/NumberKeypad.cjs +2 -2
  82. package/NumberKeypad/NumberKeypad.es.js +18 -16
  83. package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.cjs +1 -1
  84. package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.es.js +10 -1
  85. package/PageControl/PageControl.cjs +16 -5
  86. package/PageControl/PageControl.d.ts +3 -0
  87. package/PageControl/PageControl.es.js +77 -24
  88. package/PageControl/PageControl.stories.d.ts +1 -0
  89. package/Radio/Radio.cjs +3 -3
  90. package/Radio/Radio.es.js +22 -20
  91. package/RadioGroup/RadioGroup.cjs +1 -0
  92. package/RadioGroup/RadioGroup.d.ts +8 -0
  93. package/RadioGroup/RadioGroup.es.js +28 -0
  94. package/RadioGroup/RadioGroup.stories.d.ts +14 -0
  95. package/RadioGroup/index.cjs +1 -0
  96. package/RadioGroup/index.d.ts +3 -0
  97. package/RadioGroup/index.es.js +4 -0
  98. package/SegmentedButton/SegmentedButton.cjs +14 -3
  99. package/SegmentedButton/SegmentedButton.es.js +108 -34
  100. package/Select/Select.cjs +4 -4
  101. package/Select/Select.es.js +95 -86
  102. package/Slider/Slider.cjs +27 -12
  103. package/Slider/Slider.d.ts +1 -0
  104. package/Slider/Slider.es.js +177 -90
  105. package/Switch/Switch.cjs +28 -11
  106. package/Switch/Switch.d.ts +2 -0
  107. package/Switch/Switch.es.js +185 -65
  108. package/Switch/Switch.stories.d.ts +1 -0
  109. package/Tab/Tab.es.js +2 -4
  110. package/TextArea/TextArea.cjs +42 -34
  111. package/TextArea/TextArea.es.js +116 -82
  112. package/TextArea/TextArea.stories.d.ts +1 -1
  113. package/TextField/TextField.cjs +29 -13
  114. package/TextField/TextField.d.ts +2 -1
  115. package/TextField/TextField.es.js +122 -79
  116. package/TextField/TextField.stories.d.ts +1 -0
  117. package/Tooltip/Tooltip.cjs +7 -6
  118. package/Tooltip/Tooltip.d.ts +8 -3
  119. package/Tooltip/Tooltip.es.js +248 -146
  120. package/Tooltip/Tooltip.stories.d.ts +1 -0
  121. package/hooks/index.cjs +1 -1
  122. package/hooks/index.d.ts +3 -0
  123. package/hooks/index.es.js +7 -1
  124. package/hooks/useCheckHasFocus/useCheckHasFocus.cjs +1 -0
  125. package/hooks/useCheckHasFocus/useCheckHasFocus.d.ts +9 -0
  126. package/hooks/useCheckHasFocus/useCheckHasFocus.es.js +21 -0
  127. package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs +1 -0
  128. package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.d.ts +4 -0
  129. package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.es.js +30 -0
  130. package/hooks/useFocusBoundary/useFocusBoundary.cjs +1 -0
  131. package/hooks/useFocusBoundary/useFocusBoundary.d.ts +12 -0
  132. package/hooks/useFocusBoundary/useFocusBoundary.es.js +63 -0
  133. package/index.cjs +1 -1
  134. package/index.d.ts +2 -1
  135. package/index.es.js +97 -90
  136. package/package.json +3 -3
  137. package/resources/tictoccroc/icons/fill/certified-fill.svg-B_RVx6K_.cjs +1 -0
  138. package/resources/tictoccroc/icons/fill/certified-fill.svg-CK7UqYft.js +5 -0
  139. package/resources/tictoccroc/icons/fill/index.d.ts +3 -0
  140. package/resources/tictoccroc/icons/fill/location-fill.svg-DfSHAnsd.js +5 -0
  141. package/resources/tictoccroc/icons/fill/location-fill.svg-Die9mxQH.cjs +1 -0
  142. package/resources/tictoccroc/icons/fill/send-fill.svg-CItD_2L1.js +5 -0
  143. package/resources/tictoccroc/icons/fill/send-fill.svg-D197Lwl0.cjs +1 -0
  144. package/resources/tictoccroc/icons/index.ts-BmqvB_n6.cjs +1 -0
  145. package/resources/tictoccroc/icons/index.ts-CzTh-XsD.js +228 -0
  146. package/resources/tictoccroc/icons/line/index.d.ts +4 -0
  147. package/resources/tictoccroc/icons/line/list-line.svg-r5d5htjN.cjs +1 -0
  148. package/resources/tictoccroc/icons/line/list-line.svg-yFfhZxUp.js +5 -0
  149. package/resources/tictoccroc/icons/line/monthly-line.svg-BdyaJ1t_.cjs +1 -0
  150. package/resources/tictoccroc/icons/line/monthly-line.svg-DY5-Xv34.js +5 -0
  151. package/resources/tictoccroc/icons/line/review-line.svg-B4rfJrsO.js +5 -0
  152. package/resources/tictoccroc/icons/line/review-line.svg-DYUuUybx.cjs +1 -0
  153. package/resources/tictoccroc/icons/line/weekly-line.svg-BCO-LS_a.cjs +1 -0
  154. package/resources/tictoccroc/icons/line/weekly-line.svg-BUPmmgeE.js +5 -0
  155. package/utils/getIconLabel/getIconLabel.cjs +1 -1
  156. package/utils/getIconLabel/getIconLabel.es.js +8 -1
  157. package/utils/getSibling/getSibling.es.js +1 -2
  158. package/resources/tictoccroc/icons/index.ts-CarI_z7q.js +0 -214
  159. package/resources/tictoccroc/icons/index.ts-IVJAK4qr.cjs +0 -1
@@ -1,12 +1,12 @@
1
- import { jsxs as k, jsx as u } from "@emotion/react/jsx-runtime";
2
- import { forwardRef as J, useId as N, useRef as y, useState as I, useEffect as j, Children as $, isValidElement as z, cloneElement as Q } from "react";
1
+ import { jsxs as I, jsx as b } from "@emotion/react/jsx-runtime";
2
+ import { forwardRef as J, useId as N, useRef as y, useState as E, useEffect as z, Children as v, isValidElement as D, cloneElement as Q } from "react";
3
3
  import Y from "../Backdrop/Backdrop.es.js";
4
4
  import Z from "../Box/Box.es.js";
5
5
  import _ from "../Flexbox/Flexbox.es.js";
6
6
  import ee from "../Icon/Icon.es.js";
7
- import x from "@emotion/styled";
8
- import D from "../utils/getSibling/getSibling.es.js";
9
- const te = x.div`
7
+ import h from "@emotion/styled";
8
+ import H from "../utils/getSibling/getSibling.es.js";
9
+ const te = h.div`
10
10
  display: flex;
11
11
  justify-content: space-between;
12
12
  align-items: center;
@@ -79,7 +79,7 @@ const te = x.div`
79
79
  }
80
80
  return i;
81
81
  }}
82
- `, oe = x.div`
82
+ `, ne = h.div`
83
83
  display: flex;
84
84
  width: calc(100% - 24px - 8px);
85
85
  gap: ${({ theme: e }) => `${e.spacing.content(2)}px`};
@@ -111,17 +111,17 @@ const te = x.div`
111
111
  color: i[50]
112
112
  };
113
113
  }}
114
- `, ne = x.div`
114
+ `, oe = h.div`
115
115
  overflow: hidden;
116
116
  text-overflow: ellipsis;
117
117
  white-space: nowrap;
118
- `, ie = x.div`
118
+ `, ie = h.div`
119
119
  display: flex;
120
120
  align-items: center;
121
121
  justify-content: center;
122
122
  transform: ${({ isFocused: e }) => e ? "rotate(180deg)" : "rotate(0deg)"};
123
123
  transition: transform 200ms linear;
124
- `, re = x.ul`
124
+ `, re = h.ul`
125
125
  position: fixed;
126
126
  max-height: 476px;
127
127
  overflow-y: auto;
@@ -135,143 +135,152 @@ const te = x.div`
135
135
  box-shadow: ${({ theme: { elevation: e } }) => e[4]};
136
136
  transition: opacity 200ms linear;
137
137
  opacity: ${({ isFocused: e }) => e ? 1 : 0};
138
- `, me = J(function({
138
+ `, be = J(function({
139
139
  value: i,
140
140
  onChange: m,
141
141
  open: r,
142
- onOpen: v,
143
- onClose: S,
144
- variant: H = "outlined",
142
+ onOpen: S,
143
+ onClose: C,
144
+ variant: V = "outlined",
145
145
  size: B = "large",
146
146
  startAdornment: R,
147
147
  placeholder: L = "TEXT",
148
- disabled: C = !1,
148
+ disabled: k = !1,
149
149
  fullWidth: A,
150
- children: b,
150
+ children: g,
151
151
  inlineCSS: F,
152
- ...h
153
- }, V) {
154
- const q = N(), p = y(null), K = y(null), f = y(""), [l, a] = I(r || !1), [c, s] = I(""), [w, E] = I({ top: 0, bottom: 0, left: 0, width: 0 }), d = (h == null ? void 0 : h.id) || q, P = () => {
155
- r === void 0 ? a((t) => !t) : r === !1 && v && typeof v == "function" && v();
152
+ ...w
153
+ }, q) {
154
+ const K = N(), f = y(null), x = y(null), u = y(""), [c, a] = E(r || !1), [d, l] = E(""), [$, O] = E({ top: 0, bottom: 0, left: 0, width: 0 }), p = (w == null ? void 0 : w.id) || K, P = () => {
155
+ r === void 0 ? a((t) => !t) : r === !1 && S && typeof S == "function" && S();
156
156
  }, W = (t) => () => {
157
- m(t.toString()), O();
158
- }, O = () => {
159
- r === void 0 ? (a(!1), s("")) : r === !0 && S && typeof S == "function" && S();
157
+ m(t.toString()), j();
158
+ }, j = () => {
159
+ r === void 0 ? (a(!1), l("")) : r === !0 && C && typeof C == "function" && C();
160
160
  }, T = (t) => {
161
161
  if (t.preventDefault(), t.code === "Escape" && a(!1), t.code === "Space" || t.code === "Enter")
162
- if (f.current ? s(f.current) : c || s(`${d}-0`), l) {
163
- if (c) {
164
- const o = document.querySelector(
165
- `#${CSS.escape(c)}`
162
+ if (u.current ? l(u.current) : d || l(`${p}-0`), c) {
163
+ if (d) {
164
+ const n = document.querySelector(
165
+ `#${CSS.escape(d)}`
166
166
  );
167
- o && o.hasAttribute("value") && (f.current = o == null ? void 0 : o.id, W(o.value)());
167
+ n && n.hasAttribute("value") && (u.current = n == null ? void 0 : n.id, W(n.value)());
168
168
  }
169
169
  a(!1);
170
170
  } else
171
171
  a(!0);
172
172
  if (t.code === "ArrowDown" || t.code === "ArrowUp") {
173
- if (l || a(!0), f.current ? s(f.current) : s(`${d}-0`), !c)
174
- return;
175
- const o = document.querySelector(
176
- `#${CSS.escape(c)}`
173
+ if (c || a(!0), u.current ? l(u.current) : l(`${p}-0`), !x.current || !d) return;
174
+ const n = x.current.querySelector(
175
+ `#${CSS.escape(d)}`
177
176
  );
178
- if (!o)
179
- return;
177
+ if (!n) return;
180
178
  if (t.code === "ArrowDown") {
181
- const n = D(o, "next", { skipDisabled: !0 });
182
- n && n.id ? (s(n.id), n.scrollIntoView({ block: "end" })) : s(c);
179
+ const o = H(n, "next", { skipDisabled: !0 });
180
+ if (o && o.id)
181
+ l(o.id), o.scrollIntoView({ block: "end" });
182
+ else {
183
+ const s = x.current.firstElementChild;
184
+ s && (l(s.id), s.scrollIntoView({ block: "start" }));
185
+ }
183
186
  }
184
187
  if (t.code === "ArrowUp") {
185
- const n = D(o, "prev", { skipDisabled: !0 });
186
- n && n.id && (s(n.id), n.scrollIntoView({ block: "end" }));
188
+ const o = H(n, "prev", { skipDisabled: !0 });
189
+ if (o && o.id)
190
+ l(o.id), o.scrollIntoView({ block: "end" });
191
+ else {
192
+ const s = x.current.lastElementChild;
193
+ s && (l(s.id), s.scrollIntoView({ block: "end" }));
194
+ }
187
195
  }
188
196
  }
189
- if (t.code === "Home" && s(`${d}-0`), t.code === "End") {
190
- const o = $.count(b);
191
- s(`${d}-${o - 1}`);
197
+ if (t.code === "Home" && l(`${p}-0`), t.code === "End") {
198
+ const n = v.count(g);
199
+ l(`${p}-${n - 1}`);
192
200
  }
193
201
  }, U = (t) => {
194
- const o = $.map(t, (n) => z(n) && n && n.props.value === i ? n.props.children : null);
195
- return o && o.length ? o[0] : "";
202
+ const n = v.map(t, (o) => D(o) && o && o.props.value === i ? o.props.children : null);
203
+ return n && n.length ? n[0] : "";
196
204
  };
197
- return j(() => {
205
+ return z(() => {
198
206
  const t = () => {
199
- if (p.current) {
200
- const o = p.current.getBoundingClientRect(), n = $.count(b), g = 40, M = 24, X = g * n > 476 ? 476 : g * n, G = p.current.getBoundingClientRect().bottom + X + M > window.innerHeight;
201
- E(G ? {
207
+ if (f.current) {
208
+ const n = f.current.getBoundingClientRect(), o = v.count(g), s = 40, M = 24, X = s * o > 476 ? 476 : s * o, G = f.current.getBoundingClientRect().bottom + X + M > window.innerHeight;
209
+ O(G ? {
202
210
  bottom: 24,
203
- left: o.left,
204
- width: p.current.offsetWidth
211
+ left: n.left,
212
+ width: f.current.offsetWidth
205
213
  } : {
206
- top: o.top + o.height,
207
- left: o.left,
208
- width: p.current.offsetWidth
214
+ top: n.top + n.height,
215
+ left: n.left,
216
+ width: f.current.offsetWidth
209
217
  });
210
218
  }
211
219
  };
212
220
  return t(), window.addEventListener("resize", t), () => {
213
221
  window.removeEventListener("resize", t);
214
222
  };
215
- }, [b]), j(() => {
223
+ }, [g]), z(() => {
216
224
  r !== void 0 && a(r);
217
- }, [r]), /* @__PURE__ */ k(Z, { ref: V, inlineCSS: { position: "relative" }, children: [
218
- /* @__PURE__ */ k(
225
+ }, [r]), /* @__PURE__ */ I(Z, { ref: q, inlineCSS: { position: "relative" }, children: [
226
+ /* @__PURE__ */ I(
219
227
  te,
220
228
  {
221
229
  role: "combobox",
222
- ref: p,
230
+ ref: f,
223
231
  tabIndex: 0,
224
- variant: H,
232
+ variant: V,
225
233
  size: B,
226
- disabled: C,
234
+ disabled: k,
227
235
  fullWidth: A,
228
- isFocused: l,
236
+ isFocused: c,
229
237
  onClick: P,
230
238
  onKeyDown: T,
231
- "aria-controls": d,
232
- "aria-expanded": l,
239
+ "aria-controls": p,
240
+ "aria-expanded": c,
233
241
  "aria-haspopup": "listbox",
234
- "aria-activedescendant": c,
235
- ...h,
242
+ "aria-activedescendant": d,
243
+ ...w,
236
244
  css: F,
237
245
  children: [
238
- /* @__PURE__ */ k(oe, { value: i === "0" || !!i, disabled: C, children: [
239
- R && /* @__PURE__ */ u(_, { justifyContent: "center", alignItems: "center", children: R }),
240
- /* @__PURE__ */ u(ne, { children: U(b) || L })
246
+ /* @__PURE__ */ I(ne, { value: i === "0" || !!i, disabled: k, children: [
247
+ R && /* @__PURE__ */ b(_, { justifyContent: "center", alignItems: "center", children: R }),
248
+ /* @__PURE__ */ b(oe, { children: U(g) || L })
241
249
  ] }),
242
- /* @__PURE__ */ u(ie, { isFocused: l, children: /* @__PURE__ */ u(ee, { name: "ChevronDownLine", size: "small", color: C ? "grey.30" : "grey.100" }) })
250
+ /* @__PURE__ */ b(ie, { isFocused: c, children: /* @__PURE__ */ b(ee, { name: "ChevronDownLine", size: "small", color: k ? "grey.30" : "grey.100" }) })
243
251
  ]
244
252
  }
245
253
  ),
246
- /* @__PURE__ */ u(
254
+ /* @__PURE__ */ b(
247
255
  Y,
248
256
  {
249
- open: l,
250
- onClose: O,
257
+ open: c,
258
+ onClose: j,
251
259
  inlineCSS: { backgroundColor: "transparent" },
252
- children: /* @__PURE__ */ u(
260
+ children: /* @__PURE__ */ b(
253
261
  re,
254
262
  {
255
- id: d,
263
+ id: p,
256
264
  role: "listbox",
257
- ref: K,
265
+ ref: x,
258
266
  tabIndex: -1,
259
- isFocused: l,
267
+ isFocused: c,
260
268
  style: {
261
- top: w.top,
262
- bottom: w.bottom,
263
- left: w.left,
264
- width: w.width
269
+ top: $.top,
270
+ bottom: $.bottom,
271
+ left: $.left,
272
+ width: $.width
265
273
  },
266
- children: $.map(b, (t, o) => {
267
- if (!z(t) || !t.props.value)
274
+ children: v.map(g, (t, n) => {
275
+ if (!D(t) || !t.props.value)
268
276
  return null;
269
- const n = `${d}-${o}`, g = i === t.props.value;
270
- return g && (f.current = n), Q(t, {
271
- id: n,
272
- selected: g,
273
- focused: n === c,
274
- onClick: W(t.props.value)
277
+ const o = `${p}-${n}`, s = i === t.props.value;
278
+ return s && (u.current = o), Q(t, {
279
+ id: o,
280
+ selected: s,
281
+ focused: o === d,
282
+ onClick: W(t.props.value),
283
+ ...t.props
275
284
  });
276
285
  })
277
286
  }
@@ -281,5 +290,5 @@ const te = x.div`
281
290
  ] });
282
291
  });
283
292
  export {
284
- me as default
293
+ be as default
285
294
  };
package/Slider/Slider.cjs CHANGED
@@ -1,40 +1,55 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("@emotion/react/jsx-runtime"),i=require("react"),E=require("../Flexbox/Flexbox.cjs"),I=require("@emotion/styled"),O=e=>e&&e.__esModule?e:{default:e},u=O(I),B=u.default.div`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("@emotion/react/jsx-runtime"),u=require("react"),H=require("../Flexbox/Flexbox.cjs"),W=require("@emotion/styled"),z=require("../hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs"),B=require("../hooks/useCheckHasFocus/useCheckHasFocus.cjs"),G=n=>n&&n.__esModule?n:{default:n},h=G(W),J=h.default.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  position: relative;
5
5
  width: 100%;
6
6
  height: 12px;
7
- margin: ${({theme:{spacing:e}})=>`${e.content(2)}px 0px`};
7
+ margin: ${({theme:{spacing:n}})=>`${n.content(2)}px 0px`};
8
8
  cursor: pointer;
9
9
  border-radius: 20px;
10
- `,F=u.default.div`
10
+
11
+ @supports selector(:has(:focus-visible)) {
12
+ &:has(:focus-visible) {
13
+ outline: ${({theme:n})=>n.palette.grey[100]} solid 2px;
14
+ outline-offset: 2px;
15
+ }
16
+ }
17
+
18
+ @supports not selector(:has(:focus-visible)) {
19
+ ${({focusWithin:n,theme:o})=>n?{outline:`${o.palette.grey[100]} solid 2px`,outlineOffset:2}:{}}
20
+ }
21
+ `,Q=h.default.div`
11
22
  position: absolute;
12
23
  width: 100%;
13
24
  height: 100%;
14
- background: ${({theme:{palette:e}})=>e.grey[10]};
25
+ background: ${({theme:{palette:n}})=>n.grey[10]};
15
26
  border-radius: inherit;
16
- `,G=u.default.div`
27
+ `,Y=h.default.div`
17
28
  position: absolute;
18
29
  height: 100%;
19
- background: ${({theme:{palette:e}})=>e.brand.primary.main};
30
+ background: ${({theme:{palette:n}})=>n.brand.primary.main};
20
31
  border-radius: inherit;
21
- `,U=u.default.div`
32
+ `,Z=h.default.div`
22
33
  position: absolute;
23
34
  display: flex;
24
35
  width: 24px;
25
36
  height: 24px;
26
37
  justify-content: space-between;
27
38
  align-items: center;
28
- padding: ${({theme:{spacing:e}})=>`${e.content(2)}px ${e.content(3)}px`};
29
- background: ${({theme:{palette:e}})=>e.grey[90]};
39
+ padding: ${({theme:{spacing:n}})=>`${n.content(2)}px ${n.content(3)}px`};
40
+ background: ${({theme:{palette:n}})=>n.grey[90]};
30
41
  transform: translateX(-50%);
31
42
  border-radius: 50%;
32
- `,W=u.default.div`
43
+
44
+ &:focus {
45
+ outline-offset: 2px;
46
+ }
47
+ `,V=h.default.div`
33
48
  position: absolute;
34
49
  width: 4px;
35
50
  height: 4px;
36
51
  transform: translateX(-50%);
37
52
  border-radius: 50%;
38
53
 
39
- ${({theme:{palette:e},marked:l,disabled:d,hasMarks:r})=>d||!r?{background:"transparent",opacity:0}:l?{background:e.grey.white}:{background:e.grey[30]}}
40
- `,j=10,z=i.forwardRef(function({value:l,onChange:d,step:r=1,min:s=0,max:c=100,hasMarks:T=!0,disabledValues:N=[],railProps:f,trackProps:h,thumbProps:g,inlineCSS:_,...D},p){const o=i.useRef(null),b=i.useRef(null),q=i.useRef(null),[C,M]=i.useState(!1),m=100/((c-s)/r),k=t=>{if(o.current){const n=t-o.current.getBoundingClientRect().left,S=Array.from(o.current.querySelectorAll('[class^="slider-mark-"]:not([disabled])')),x=S.reduce((v,R)=>Math.abs(R.offsetLeft-n)<Math.abs(v.offsetLeft-n)?R:v,S[0]).getAttribute("data-value");return x!==null?Number(x):null}return null},$=t=>{M(!0);const n=k(t);n!==null&&d(n)},w=t=>{if(!C)return;const n=k(t);n!==null&&d(n)},y=()=>M(!1),X=t=>$(t.clientX),A=t=>$(t.touches[0].clientX),L=t=>w(t.clientX),V=t=>w(t.touches[0].clientX);return i.useEffect(()=>{if(o.current){const t=o.current.querySelector(`[data-value="${l}"]`);if(b.current&&t){const{offsetLeft:n,offsetWidth:S}=t;b.current.style.width=`${n+S+j*2}px`}}},[l,s,c,r]),a.jsxs(B,{ref:p,...D,className:"slider",onMouseDown:X,onMouseMove:L,onMouseUp:y,onMouseLeave:y,onTouchStart:A,onTouchMove:V,onTouchEnd:y,onTouchCancel:y,css:_,children:[a.jsx(F,{ref:q,...f,css:f==null?void 0:f.inlineCSS,className:"slider-rail"}),a.jsx(G,{ref:b,...h,css:h==null?void 0:h.inlineCSS,className:"slider-track"}),a.jsxs(E.default,{className:"slider-mark-wrapper",alignItems:"center",ref:o,inlineCSS:{margin:`0 ${j+2}px`,width:"100%",height:"24px",position:"relative"},children:[c>0&&s<c&&r>0&&Array.from({length:(c-s)/r+1},(t,n)=>a.jsx(W,{className:`slider-mark-${n} slider-mark`,marked:n<=(l-s)/r,hasMarks:T,disabled:N.includes(s+r*n),"data-value":s+r*n,style:{left:`${m*n}%`}},`slider-mark-${l}:${s+r*n}`)),a.jsx(U,{...g,className:"slider-thumb",css:g==null?void 0:g.inlineCSS,style:{left:`${m*(l-s)/r}%`}})]})]})});exports.default=z;
54
+ ${({theme:{palette:n},marked:o,disabled:c,hasMarks:s})=>c||!s?{background:"transparent",opacity:0}:o?{background:n.grey.white}:{background:n.grey[30]}}
55
+ `,q=10,P=u.forwardRef(function({value:o,onChange:c,step:s=1,min:i=0,max:l=100,hasMarks:N=!0,disabledValues:a=[],readValue:S,railProps:y,trackProps:g,thumbProps:b,inlineCSS:_,...I},M){const $=u.useRef(null),{isKeyboardMode:v}=z.default(),{hasFocus:X}=B.default({ref:M||$}),f=u.useRef(null),w=u.useRef(null),C=u.useRef(null),[L,x]=u.useState(!1),R=100/((l-i)/s),p=t=>{if(f.current){const e=t-f.current.getBoundingClientRect().left,r=Array.from(f.current.querySelectorAll('[class^="slider-mark-"]:not([disabled])')),j=r.reduce((A,T)=>Math.abs(T.offsetLeft-e)<Math.abs(A.offsetLeft-e)?T:A,r[0]).getAttribute("data-value");return j!==null?Number(j):null}return null},E=t=>{let e=o;if(t.key==="ArrowRight"||t.key==="ArrowUp"){if(o===l)return;e=o+s}else if(t.key==="ArrowLeft"||t.key==="ArrowDown"){if(o===i)return;e=o-s}else if(t.key==="PageUp"){if(o===l)return;e=Math.min(o+s*5,l)}else if(t.key==="PageDown"){if(o===i)return;e=Math.max(o-s*5,i)}else if(t.key==="Home"){for(let r=i;r<=l;r+=s)if(!a.includes(r)){e=r;break}}else if(t.key==="End"){for(let r=l;r>=i;r-=s)if(!a.includes(r)){e=r;break}}if(a.includes(e)){if(e>o){for(let r=e;r<=l;r+=s)if(!a.includes(r)){c(r);return}}else if(e<o){for(let r=e;r>=i;r-=s)if(!a.includes(r)){c(r);return}}return}c(e)},D=t=>{x(!0);const e=p(t);e!==null&&c(e)},m=t=>{if(!L)return;const e=p(t);e!==null&&c(e)},k=()=>x(!1),K=t=>D(t.clientX),F=t=>D(t.touches[0].clientX),O=t=>m(t.clientX),U=t=>m(t.touches[0].clientX);return u.useEffect(()=>{if(f.current){const t=f.current.querySelector(`[data-value="${o}"]`);if(w.current&&t){const{offsetLeft:e,offsetWidth:r}=t;w.current.style.width=`${e+r+q*2}px`}}},[o,i,l,s]),d.jsxs(J,{ref:M||$,...I,className:"slider",onMouseDown:K,onMouseMove:O,onMouseUp:k,onMouseLeave:k,onTouchStart:F,onTouchMove:U,onTouchEnd:k,onTouchCancel:k,css:_,focusWithin:v&&X,children:[d.jsx(Q,{ref:C,...y,css:y==null?void 0:y.inlineCSS,className:"slider-rail",tabIndex:-1,"aria-hidden":!0}),d.jsx(Y,{ref:w,...g,css:g==null?void 0:g.inlineCSS,className:"slider-track",tabIndex:-1,"aria-hidden":!0}),d.jsxs(H.default,{className:"slider-mark-wrapper",alignItems:"center",ref:f,tabIndex:-1,inlineCSS:{margin:`0 ${q+2}px`,width:"100%",height:"24px",position:"relative"},children:[l>0&&i<l&&s>0&&Array.from({length:(l-i)/s+1},(t,e)=>d.jsx(V,{className:`slider-mark-${e} slider-mark`,marked:e<=(o-i)/s,hasMarks:N,disabled:a.includes(i+s*e),"data-value":i+s*e,style:{left:`${R*e}%`},"aria-hidden":!0},`slider-mark-${o}:${i+s*e}`)),d.jsx(Z,{...b,className:"slider-thumb",css:b==null?void 0:b.inlineCSS,onKeyDown:E,role:"slider","aria-orientation":"horizontal",tabIndex:0,"aria-valuemin":i,"aria-valuemax":l,"aria-valuenow":o,"aria-valuetext":S&&typeof S=="function"?S(o):o.toString(),style:{left:`${R*(o-i)/s}%`}})]})]})});exports.default=P;
@@ -10,6 +10,7 @@ export interface SliderProps extends GeneralComponentProps<Omit<HTMLAttributes<H
10
10
  hasMarks?: boolean;
11
11
  defaultValue?: number;
12
12
  disabledValues?: number[];
13
+ readValue?: (value: number) => string;
13
14
  railProps?: GeneralComponentProps<HTMLAttributes<HTMLDivElement>>;
14
15
  trackProps?: GeneralComponentProps<HTMLAttributes<HTMLDivElement>>;
15
16
  thumbProps?: GeneralComponentProps<HTMLAttributes<HTMLDivElement>>;