@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.
- package/Accordion/Accordion.cjs +13 -7
- package/Accordion/Accordion.d.ts +2 -0
- package/Accordion/Accordion.es.js +86 -65
- package/Autocomplete/Autocomplete.cjs +1 -1
- package/Autocomplete/Autocomplete.d.ts +1 -1
- package/Autocomplete/Autocomplete.es.js +235 -80
- package/BottomSheet/BottomSheet.cjs +5 -5
- package/BottomSheet/BottomSheet.d.ts +3 -0
- package/BottomSheet/BottomSheet.es.js +88 -70
- package/BottomSheet/BottomSheetText/BottomSheetText.cjs +2 -2
- package/BottomSheet/BottomSheetText/BottomSheetText.es.js +18 -6
- package/BottomSheet/BottomSheetTitle/BottomSheetTitle.cjs +6 -6
- package/BottomSheet/BottomSheetTitle/BottomSheetTitle.d.ts +2 -1
- package/BottomSheet/BottomSheetTitle/BottomSheetTitle.es.js +26 -15
- package/Button/Button.cjs +6 -6
- package/Button/Button.es.js +35 -29
- package/ChainPicker/ChainPicker.cjs +16 -6
- package/ChainPicker/ChainPicker.d.ts +4 -2
- package/ChainPicker/ChainPicker.es.js +155 -110
- package/ChainPicker/ChainPicker.stories.d.ts +1 -1
- package/Checkbox/Checkbox.cjs +3 -3
- package/Checkbox/Checkbox.es.js +12 -10
- package/CircularProgressIndicator/CircularProgressIndicator.cjs +5 -5
- package/CircularProgressIndicator/CircularProgressIndicator.es.js +26 -23
- package/DatePicker/DatePicker.cjs +37 -20
- package/DatePicker/DatePicker.d.ts +2 -1
- package/DatePicker/DatePicker.es.js +345 -320
- package/DatePicker/DatePicker.stories.d.ts +1 -0
- package/DatePicker/EventDot/EventDot.cjs +8 -0
- package/DatePicker/EventDot/EventDot.d.ts +8 -0
- package/DatePicker/EventDot/EventDot.es.js +19 -0
- package/DatePicker/EventDot/index.cjs +1 -0
- package/DatePicker/EventDot/index.d.ts +3 -0
- package/DatePicker/EventDot/index.es.js +4 -0
- package/DatePicker/EventDotGroup/EventDotGroup.cjs +8 -0
- package/DatePicker/EventDotGroup/EventDotGroup.d.ts +8 -0
- package/DatePicker/EventDotGroup/EventDotGroup.es.js +39 -0
- package/DatePicker/EventDotGroup/index.cjs +1 -0
- package/DatePicker/EventDotGroup/index.d.ts +3 -0
- package/DatePicker/EventDotGroup/index.es.js +4 -0
- package/DatePicker/index.cjs +1 -1
- package/DatePicker/index.d.ts +2 -0
- package/DatePicker/index.es.js +6 -2
- package/Dialog/Dialog.cjs +2 -2
- package/Dialog/Dialog.d.ts +2 -0
- package/Dialog/Dialog.es.js +45 -40
- package/Dialog/Dialog.stories.d.ts +10 -0
- package/Dialog/DialogText/DialogText.cjs +1 -1
- package/Dialog/DialogText/DialogText.es.js +1 -1
- package/Dialog/DialogTitle/DialogTitle.cjs +4 -4
- package/Dialog/DialogTitle/DialogTitle.d.ts +2 -1
- package/Dialog/DialogTitle/DialogTitle.es.js +17 -17
- package/FocusBoundary/FocusBoundary.cjs +1 -1
- package/FocusBoundary/FocusBoundary.d.ts +3 -1
- package/FocusBoundary/FocusBoundary.es.js +49 -42
- package/FormControlText/FormControlText.cjs +7 -5
- package/FormControlText/FormControlText.d.ts +2 -0
- package/FormControlText/FormControlText.es.js +50 -40
- package/Icon/Icon.cjs +1 -1
- package/Icon/Icon.es.js +1 -1
- package/IconButton/IconButton.cjs +8 -8
- package/IconButton/IconButton.es.js +32 -25
- package/LineProgressIndicator/LineProgressIndicator.cjs +6 -6
- package/LineProgressIndicator/LineProgressIndicator.es.js +35 -23
- package/Menu/Menu.cjs +16 -16
- package/Menu/Menu.d.ts +3 -2
- package/Menu/Menu.es.js +115 -81
- package/Menu/Menu.stories.d.ts +1 -0
- package/Menu/MenuBlock/MenuBlock.cjs +14 -7
- package/Menu/MenuBlock/MenuBlock.d.ts +1 -0
- package/Menu/MenuBlock/MenuBlock.es.js +47 -35
- package/Menu/MenuButton/MenuButton.cjs +1 -0
- package/Menu/MenuButton/MenuButton.d.ts +10 -0
- package/Menu/MenuButton/MenuButton.es.js +44 -0
- package/Menu/MenuButton/index.cjs +1 -0
- package/Menu/MenuButton/index.d.ts +3 -0
- package/Menu/MenuButton/index.es.js +4 -0
- package/Menu/index.cjs +1 -1
- package/Menu/index.d.ts +1 -0
- package/Menu/index.es.js +4 -2
- package/NumberKeypad/NumberKeypad.cjs +2 -2
- package/NumberKeypad/NumberKeypad.es.js +18 -16
- package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.cjs +1 -1
- package/NumberKeypad/NumberKeypadBlock/NumberKeypadBlock.es.js +10 -1
- package/PageControl/PageControl.cjs +16 -5
- package/PageControl/PageControl.d.ts +3 -0
- package/PageControl/PageControl.es.js +77 -24
- package/PageControl/PageControl.stories.d.ts +1 -0
- package/Radio/Radio.cjs +3 -3
- package/Radio/Radio.es.js +22 -20
- package/RadioGroup/RadioGroup.cjs +1 -0
- package/RadioGroup/RadioGroup.d.ts +8 -0
- package/RadioGroup/RadioGroup.es.js +28 -0
- package/RadioGroup/RadioGroup.stories.d.ts +14 -0
- package/RadioGroup/index.cjs +1 -0
- package/RadioGroup/index.d.ts +3 -0
- package/RadioGroup/index.es.js +4 -0
- package/SegmentedButton/SegmentedButton.cjs +14 -3
- package/SegmentedButton/SegmentedButton.es.js +108 -34
- package/Select/Select.cjs +4 -4
- package/Select/Select.es.js +95 -86
- package/Slider/Slider.cjs +27 -12
- package/Slider/Slider.d.ts +1 -0
- package/Slider/Slider.es.js +177 -90
- package/Switch/Switch.cjs +28 -11
- package/Switch/Switch.d.ts +2 -0
- package/Switch/Switch.es.js +185 -65
- package/Switch/Switch.stories.d.ts +1 -0
- package/Tab/Tab.es.js +2 -4
- package/TextArea/TextArea.cjs +42 -34
- package/TextArea/TextArea.es.js +116 -82
- package/TextArea/TextArea.stories.d.ts +1 -1
- package/TextField/TextField.cjs +29 -13
- package/TextField/TextField.d.ts +2 -1
- package/TextField/TextField.es.js +122 -79
- package/TextField/TextField.stories.d.ts +1 -0
- package/Tooltip/Tooltip.cjs +7 -6
- package/Tooltip/Tooltip.d.ts +8 -3
- package/Tooltip/Tooltip.es.js +248 -146
- package/Tooltip/Tooltip.stories.d.ts +1 -0
- package/hooks/index.cjs +1 -1
- package/hooks/index.d.ts +3 -0
- package/hooks/index.es.js +7 -1
- package/hooks/useCheckHasFocus/useCheckHasFocus.cjs +1 -0
- package/hooks/useCheckHasFocus/useCheckHasFocus.d.ts +9 -0
- package/hooks/useCheckHasFocus/useCheckHasFocus.es.js +21 -0
- package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.cjs +1 -0
- package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.d.ts +4 -0
- package/hooks/useCheckKeyboardMode/useCheckKeyboardMode.es.js +30 -0
- package/hooks/useFocusBoundary/useFocusBoundary.cjs +1 -0
- package/hooks/useFocusBoundary/useFocusBoundary.d.ts +12 -0
- package/hooks/useFocusBoundary/useFocusBoundary.es.js +63 -0
- package/index.cjs +1 -1
- package/index.d.ts +2 -1
- package/index.es.js +97 -90
- package/package.json +3 -3
- package/resources/tictoccroc/icons/fill/certified-fill.svg-B_RVx6K_.cjs +1 -0
- package/resources/tictoccroc/icons/fill/certified-fill.svg-CK7UqYft.js +5 -0
- package/resources/tictoccroc/icons/fill/index.d.ts +3 -0
- package/resources/tictoccroc/icons/fill/location-fill.svg-DfSHAnsd.js +5 -0
- package/resources/tictoccroc/icons/fill/location-fill.svg-Die9mxQH.cjs +1 -0
- package/resources/tictoccroc/icons/fill/send-fill.svg-CItD_2L1.js +5 -0
- package/resources/tictoccroc/icons/fill/send-fill.svg-D197Lwl0.cjs +1 -0
- package/resources/tictoccroc/icons/index.ts-BmqvB_n6.cjs +1 -0
- package/resources/tictoccroc/icons/index.ts-CzTh-XsD.js +228 -0
- package/resources/tictoccroc/icons/line/index.d.ts +4 -0
- package/resources/tictoccroc/icons/line/list-line.svg-r5d5htjN.cjs +1 -0
- package/resources/tictoccroc/icons/line/list-line.svg-yFfhZxUp.js +5 -0
- package/resources/tictoccroc/icons/line/monthly-line.svg-BdyaJ1t_.cjs +1 -0
- package/resources/tictoccroc/icons/line/monthly-line.svg-DY5-Xv34.js +5 -0
- package/resources/tictoccroc/icons/line/review-line.svg-B4rfJrsO.js +5 -0
- package/resources/tictoccroc/icons/line/review-line.svg-DYUuUybx.cjs +1 -0
- package/resources/tictoccroc/icons/line/weekly-line.svg-BCO-LS_a.cjs +1 -0
- package/resources/tictoccroc/icons/line/weekly-line.svg-BUPmmgeE.js +5 -0
- package/utils/getIconLabel/getIconLabel.cjs +1 -1
- package/utils/getIconLabel/getIconLabel.es.js +8 -1
- package/utils/getSibling/getSibling.es.js +1 -2
- package/resources/tictoccroc/icons/index.ts-CarI_z7q.js +0 -214
- package/resources/tictoccroc/icons/index.ts-IVJAK4qr.cjs +0 -1
package/Select/Select.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as J, useId as N, useRef as y, useState as
|
|
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
|
|
8
|
-
import
|
|
9
|
-
const te =
|
|
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
|
-
`,
|
|
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
|
-
`,
|
|
114
|
+
`, oe = h.div`
|
|
115
115
|
overflow: hidden;
|
|
116
116
|
text-overflow: ellipsis;
|
|
117
117
|
white-space: nowrap;
|
|
118
|
-
`, ie =
|
|
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 =
|
|
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
|
-
`,
|
|
138
|
+
`, be = J(function({
|
|
139
139
|
value: i,
|
|
140
140
|
onChange: m,
|
|
141
141
|
open: r,
|
|
142
|
-
onOpen:
|
|
143
|
-
onClose:
|
|
144
|
-
variant:
|
|
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:
|
|
148
|
+
disabled: k = !1,
|
|
149
149
|
fullWidth: A,
|
|
150
|
-
children:
|
|
150
|
+
children: g,
|
|
151
151
|
inlineCSS: F,
|
|
152
|
-
...
|
|
153
|
-
},
|
|
154
|
-
const
|
|
155
|
-
r === void 0 ? a((t) => !t) : r === !1 &&
|
|
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()),
|
|
158
|
-
},
|
|
159
|
-
r === void 0 ? (a(!1),
|
|
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 (
|
|
163
|
-
if (
|
|
164
|
-
const
|
|
165
|
-
`#${CSS.escape(
|
|
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
|
-
|
|
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 (
|
|
174
|
-
|
|
175
|
-
|
|
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 (!
|
|
179
|
-
return;
|
|
177
|
+
if (!n) return;
|
|
180
178
|
if (t.code === "ArrowDown") {
|
|
181
|
-
const
|
|
182
|
-
|
|
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
|
|
186
|
-
|
|
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" &&
|
|
190
|
-
const
|
|
191
|
-
|
|
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
|
|
195
|
-
return
|
|
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
|
|
205
|
+
return z(() => {
|
|
198
206
|
const t = () => {
|
|
199
|
-
if (
|
|
200
|
-
const
|
|
201
|
-
|
|
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:
|
|
204
|
-
width:
|
|
211
|
+
left: n.left,
|
|
212
|
+
width: f.current.offsetWidth
|
|
205
213
|
} : {
|
|
206
|
-
top:
|
|
207
|
-
left:
|
|
208
|
-
width:
|
|
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
|
-
}, [
|
|
223
|
+
}, [g]), z(() => {
|
|
216
224
|
r !== void 0 && a(r);
|
|
217
|
-
}, [r]), /* @__PURE__ */
|
|
218
|
-
/* @__PURE__ */
|
|
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:
|
|
230
|
+
ref: f,
|
|
223
231
|
tabIndex: 0,
|
|
224
|
-
variant:
|
|
232
|
+
variant: V,
|
|
225
233
|
size: B,
|
|
226
|
-
disabled:
|
|
234
|
+
disabled: k,
|
|
227
235
|
fullWidth: A,
|
|
228
|
-
isFocused:
|
|
236
|
+
isFocused: c,
|
|
229
237
|
onClick: P,
|
|
230
238
|
onKeyDown: T,
|
|
231
|
-
"aria-controls":
|
|
232
|
-
"aria-expanded":
|
|
239
|
+
"aria-controls": p,
|
|
240
|
+
"aria-expanded": c,
|
|
233
241
|
"aria-haspopup": "listbox",
|
|
234
|
-
"aria-activedescendant":
|
|
235
|
-
...
|
|
242
|
+
"aria-activedescendant": d,
|
|
243
|
+
...w,
|
|
236
244
|
css: F,
|
|
237
245
|
children: [
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
-
R && /* @__PURE__ */
|
|
240
|
-
/* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
254
|
+
/* @__PURE__ */ b(
|
|
247
255
|
Y,
|
|
248
256
|
{
|
|
249
|
-
open:
|
|
250
|
-
onClose:
|
|
257
|
+
open: c,
|
|
258
|
+
onClose: j,
|
|
251
259
|
inlineCSS: { backgroundColor: "transparent" },
|
|
252
|
-
children: /* @__PURE__ */
|
|
260
|
+
children: /* @__PURE__ */ b(
|
|
253
261
|
re,
|
|
254
262
|
{
|
|
255
|
-
id:
|
|
263
|
+
id: p,
|
|
256
264
|
role: "listbox",
|
|
257
|
-
ref:
|
|
265
|
+
ref: x,
|
|
258
266
|
tabIndex: -1,
|
|
259
|
-
isFocused:
|
|
267
|
+
isFocused: c,
|
|
260
268
|
style: {
|
|
261
|
-
top:
|
|
262
|
-
bottom:
|
|
263
|
-
left:
|
|
264
|
-
width:
|
|
269
|
+
top: $.top,
|
|
270
|
+
bottom: $.bottom,
|
|
271
|
+
left: $.left,
|
|
272
|
+
width: $.width
|
|
265
273
|
},
|
|
266
|
-
children:
|
|
267
|
-
if (!
|
|
274
|
+
children: v.map(g, (t, n) => {
|
|
275
|
+
if (!D(t) || !t.props.value)
|
|
268
276
|
return null;
|
|
269
|
-
const
|
|
270
|
-
return
|
|
271
|
-
id:
|
|
272
|
-
selected:
|
|
273
|
-
focused:
|
|
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
|
-
|
|
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
|
|
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:
|
|
7
|
+
margin: ${({theme:{spacing:n}})=>`${n.content(2)}px 0px`};
|
|
8
8
|
cursor: pointer;
|
|
9
9
|
border-radius: 20px;
|
|
10
|
-
|
|
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:
|
|
25
|
+
background: ${({theme:{palette:n}})=>n.grey[10]};
|
|
15
26
|
border-radius: inherit;
|
|
16
|
-
`,
|
|
27
|
+
`,Y=h.default.div`
|
|
17
28
|
position: absolute;
|
|
18
29
|
height: 100%;
|
|
19
|
-
background: ${({theme:{palette:
|
|
30
|
+
background: ${({theme:{palette:n}})=>n.brand.primary.main};
|
|
20
31
|
border-radius: inherit;
|
|
21
|
-
`,
|
|
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:
|
|
29
|
-
background: ${({theme:{palette:
|
|
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
|
-
|
|
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:
|
|
40
|
-
`,
|
|
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;
|
package/Slider/Slider.d.ts
CHANGED
|
@@ -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>>;
|