@apple-pie/slice 0.0.1 → 0.0.2
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/dist/cjs/chunks/Avatar-8-wPWe0V.js +68 -0
- package/dist/cjs/chunks/AvatarGroup-CVKmgBbD.js +39 -0
- package/dist/cjs/chunks/Badge-CMapJCij.js +41 -0
- package/dist/cjs/chunks/CheckBox-7AACxrdZ.js +76 -0
- package/dist/cjs/chunks/DivInput-BKKJTFeV.js +204 -0
- package/dist/cjs/chunks/DocIcons-BRWOzK96.js +41 -0
- package/dist/cjs/chunks/Dot-Dnr9M9na.js +80 -0
- package/dist/cjs/chunks/DrggablePanel-C6TPsDB-.js +302 -0
- package/dist/cjs/chunks/DropDown-D9sf_m2I.js +154 -0
- package/dist/cjs/chunks/EditorButtonBar-CUNDgRQd.js +244 -0
- package/dist/cjs/chunks/ErrorSummary-Dv44onsV.js +42 -0
- package/dist/cjs/chunks/FlexDiv-DZBpswHV.js +103 -0
- package/dist/cjs/chunks/Grouper-_kd2nU78.js +50 -0
- package/dist/cjs/chunks/IconButton-BfsPlKTb.js +84 -0
- package/dist/cjs/chunks/Logos-DSlAUz8l.js +119 -0
- package/dist/cjs/chunks/MessageInput-CiHFo2j8.js +399 -0
- package/dist/cjs/chunks/Overlay-DwCPvGB5.js +45 -0
- package/dist/cjs/chunks/Pager-CFtZ0IIW.js +42 -0
- package/dist/cjs/chunks/ProgressIndicator-C5oB7Mky.js +121 -0
- package/dist/cjs/chunks/RadioButton-e_y2qiPE.js +65 -0
- package/dist/cjs/chunks/RadioButtonList-I81UwHmM.js +116 -0
- package/dist/cjs/chunks/Slider-C-gn7Sby.js +285 -0
- package/dist/cjs/chunks/Spacer-BEY2-_PB.js +16 -0
- package/dist/cjs/chunks/Switch-CtkFtogd.js +43 -0
- package/dist/cjs/chunks/TabBar-D3bj4pjj.js +176 -0
- package/dist/cjs/chunks/TextArea-B1oKK3_b.js +153 -0
- package/dist/cjs/chunks/TextField-CiQdPP5E.js +248 -0
- package/dist/cjs/chunks/Tip-C2pzExut.js +91 -0
- package/dist/cjs/chunks/Toast-DrijUwoL.js +141 -0
- package/dist/cjs/chunks/UIButton-CH4p-8yq.js +317 -0
- package/dist/cjs/chunks/UIButtonBar-0fHPB0ww.js +58 -0
- package/dist/cjs/chunks/UICard-DBDSyT7E.js +36 -0
- package/dist/cjs/chunks/UIChip-kjhvRrOV.js +93 -0
- package/dist/cjs/chunks/UIFileIcon-ZrbDIeYz.js +54 -0
- package/dist/cjs/chunks/UILabel-DkBE2AIt.js +116 -0
- package/dist/cjs/chunks/_types-CoWzQFsT.js +714 -0
- package/dist/cjs/chunks/sharedTypes-BvTjh6M5.js +9 -0
- package/dist/cjs/chunks/style-inject.es-XZHJH68X.js +30 -0
- package/dist/cjs/chunks/tipStore-C9oV9SIh.js +23 -0
- package/dist/cjs/chunks/toastStore-C-ETP9H6.js +23 -0
- package/dist/cjs/chunks/tslib.es6-4H29ixHs.js +48 -0
- package/dist/cjs/chunks/utils-CbayehuI.js +126 -0
- package/dist/cjs/hooks/useDoubleClick.js +26 -0
- package/dist/cjs/hooks/useKeyboardShortcuts.js +42 -0
- package/dist/cjs/hooks/useLastUpdated.js +53 -0
- package/dist/cjs/hooks/useLocalStore.js +52 -0
- package/dist/cjs/hooks/useObserveResize.js +56 -0
- package/dist/cjs/hooks/useObserveTheme.js +36 -0
- package/dist/cjs/hooks/useTheme.js +85 -0
- package/dist/cjs/hooks/useToolTip.js +36 -0
- package/dist/cjs/hooks/useTrackRenders.js +38 -0
- package/dist/cjs/hooks/useWindow.js +64 -0
- package/dist/cjs/hooks.js +32 -0
- package/dist/cjs/index.js +121 -0
- package/dist/cjs/providers/ThemeProvider.js +51 -0
- package/dist/cjs/providers.js +13 -0
- package/dist/cjs/stores/tip.js +12 -0
- package/dist/cjs/stores/toast.js +12 -0
- package/dist/cjs/stores.js +18 -0
- package/dist/cjs/theme/colors.js +383 -0
- package/dist/cjs/theme/corners.js +14 -0
- package/dist/cjs/theme/themes.js +23 -0
- package/dist/cjs/theme/type.js +316 -0
- package/dist/cjs/theme.js +13 -0
- package/dist/cjs/uikit/Avatar.js +11 -0
- package/dist/cjs/uikit/AvatarGroup.js +12 -0
- package/dist/cjs/uikit/Badge.js +11 -0
- package/dist/cjs/uikit/CheckBox.js +21 -0
- package/dist/cjs/uikit/DivInput.js +13 -0
- package/dist/cjs/uikit/DocIcon.js +17 -0
- package/dist/cjs/uikit/Dot.js +12 -0
- package/dist/cjs/uikit/DraggablePanel.js +20 -0
- package/dist/cjs/uikit/DropDown.js +20 -0
- package/dist/cjs/uikit/EditorButtonBar.js +27 -0
- package/dist/cjs/uikit/ErrorSummary.js +12 -0
- package/dist/cjs/uikit/FlexDiv.js +12 -0
- package/dist/cjs/uikit/Grouper.js +22 -0
- package/dist/cjs/uikit/Icon.js +22 -0
- package/dist/cjs/uikit/IconButton.js +24 -0
- package/dist/cjs/uikit/Logos.js +17 -0
- package/dist/cjs/uikit/MessageInput.js +29 -0
- package/dist/cjs/uikit/Overlay.js +12 -0
- package/dist/cjs/uikit/Pager.js +12 -0
- package/dist/cjs/uikit/Progress.js +20 -0
- package/dist/cjs/uikit/RadioButton.js +25 -0
- package/dist/cjs/uikit/RadioButtonList.js +26 -0
- package/dist/cjs/uikit/Slider.js +13 -0
- package/dist/cjs/uikit/Spacer.js +10 -0
- package/dist/cjs/uikit/Switch.js +12 -0
- package/dist/cjs/uikit/TabBar.js +25 -0
- package/dist/cjs/uikit/TextArea.js +26 -0
- package/dist/cjs/uikit/Textfield.js +27 -0
- package/dist/cjs/uikit/Tip.js +13 -0
- package/dist/cjs/uikit/Toast.js +25 -0
- package/dist/cjs/uikit/UIButton.js +25 -0
- package/dist/cjs/uikit/UIButtonBar.js +25 -0
- package/dist/cjs/uikit/UICard.js +20 -0
- package/dist/cjs/uikit/UIChip.js +21 -0
- package/dist/cjs/uikit/UIFileIcon.js +17 -0
- package/dist/cjs/uikit/UILabel.js +18 -0
- package/dist/esm/chunks/Avatar-D_muqPrW.js +66 -0
- package/dist/esm/chunks/AvatarGroup-D8Xmrn52.js +37 -0
- package/dist/esm/chunks/Badge-PPf5Uvw3.js +39 -0
- package/dist/esm/chunks/CheckBox-CswFI0Xc.js +74 -0
- package/dist/esm/chunks/DivInput-iKFkeU2F.js +202 -0
- package/dist/esm/chunks/DocIcons-CbOX4n8Y.js +39 -0
- package/dist/esm/chunks/Dot-B84UVs2e.js +78 -0
- package/dist/esm/chunks/DrggablePanel-CYYwTmFd.js +300 -0
- package/dist/esm/chunks/DropDown-D4t6EhKL.js +152 -0
- package/dist/esm/chunks/EditorButtonBar-FnMa8Zv2.js +242 -0
- package/dist/esm/chunks/ErrorSummary-DhU5SKPt.js +40 -0
- package/dist/esm/chunks/FlexDiv-CmMpORgn.js +101 -0
- package/dist/esm/chunks/Grouper-BbreOXI9.js +48 -0
- package/dist/esm/chunks/IconButton-CguHGkBM.js +82 -0
- package/dist/esm/chunks/Logos-DwZP-TR2.js +117 -0
- package/dist/esm/chunks/MessageInput-DMHzCwjO.js +397 -0
- package/dist/esm/chunks/Overlay-CCBy7n7H.js +43 -0
- package/dist/esm/chunks/Pager-BsSti93V.js +40 -0
- package/dist/esm/chunks/ProgressIndicator-BVukxMU6.js +118 -0
- package/dist/esm/chunks/RadioButton-B5BxQI0R.js +63 -0
- package/dist/esm/chunks/RadioButtonList-C2z8McAD.js +114 -0
- package/dist/esm/chunks/Slider-C-PcWqTz.js +283 -0
- package/dist/esm/chunks/Spacer-DbZSG5x3.js +14 -0
- package/dist/esm/chunks/Switch-DjfrSiQz.js +41 -0
- package/dist/esm/chunks/TabBar-BSBcgTbd.js +174 -0
- package/dist/esm/chunks/TextArea-COM0UPo2.js +151 -0
- package/dist/esm/chunks/TextField-Bh24bRWs.js +246 -0
- package/dist/esm/chunks/Tip-Ct19Ljul.js +89 -0
- package/dist/esm/chunks/Toast-BR0oMX6z.js +139 -0
- package/dist/esm/chunks/UIButton-DKx-_O8h.js +315 -0
- package/dist/esm/chunks/UIButtonBar-BNdA5eVq.js +56 -0
- package/dist/esm/chunks/UICard-Dn5f3wg8.js +34 -0
- package/dist/esm/chunks/UIChip-DqnGeVyR.js +91 -0
- package/dist/esm/chunks/UIFileIcon-qGxIPsJJ.js +52 -0
- package/dist/esm/chunks/UILabel-RnbodPCS.js +114 -0
- package/dist/esm/chunks/_types-BaYeLEWK.js +712 -0
- package/dist/esm/chunks/sharedTypes-BfZzG1KX.js +9 -0
- package/dist/esm/chunks/style-inject.es-tgCJW-Cu.js +28 -0
- package/dist/esm/chunks/tipStore-nBYJ6tmE.js +17 -0
- package/dist/esm/chunks/toastStore-r3pvNa28.js +17 -0
- package/dist/esm/chunks/tslib.es6-0pkUdtrF.js +45 -0
- package/dist/esm/chunks/utils-BRZK2Drn.js +119 -0
- package/dist/esm/hooks/useDoubleClick.js +24 -0
- package/dist/esm/hooks/useKeyboardShortcuts.js +40 -0
- package/dist/esm/hooks/useLastUpdated.js +51 -0
- package/dist/esm/hooks/useLocalStore.js +50 -0
- package/dist/esm/hooks/useObserveResize.js +54 -0
- package/dist/esm/hooks/useObserveTheme.js +34 -0
- package/dist/esm/hooks/useTheme.js +83 -0
- package/dist/esm/hooks/useToolTip.js +34 -0
- package/dist/esm/hooks/useTrackRenders.js +36 -0
- package/dist/esm/hooks/useWindow.js +62 -0
- package/dist/esm/hooks.js +14 -0
- package/dist/esm/index.js +57 -0
- package/dist/esm/providers/ThemeProvider.js +49 -0
- package/dist/esm/providers.js +7 -0
- package/dist/esm/stores/tip.js +2 -0
- package/dist/esm/stores/toast.js +2 -0
- package/dist/esm/stores.js +3 -0
- package/dist/esm/theme/colors.js +377 -0
- package/dist/esm/theme/corners.js +12 -0
- package/dist/esm/theme/themes.js +20 -0
- package/dist/esm/theme/type.js +312 -0
- package/dist/esm/theme.js +4 -0
- package/dist/esm/uikit/Avatar.js +5 -0
- package/dist/esm/uikit/AvatarGroup.js +6 -0
- package/dist/esm/uikit/Badge.js +5 -0
- package/dist/esm/uikit/CheckBox.js +15 -0
- package/dist/esm/uikit/DivInput.js +7 -0
- package/dist/esm/uikit/DocIcon.js +11 -0
- package/dist/esm/uikit/Dot.js +6 -0
- package/dist/esm/uikit/DraggablePanel.js +14 -0
- package/dist/esm/uikit/DropDown.js +14 -0
- package/dist/esm/uikit/EditorButtonBar.js +21 -0
- package/dist/esm/uikit/ErrorSummary.js +6 -0
- package/dist/esm/uikit/FlexDiv.js +6 -0
- package/dist/esm/uikit/Grouper.js +16 -0
- package/dist/esm/uikit/Icon.js +12 -0
- package/dist/esm/uikit/IconButton.js +18 -0
- package/dist/esm/uikit/Logos.js +11 -0
- package/dist/esm/uikit/MessageInput.js +23 -0
- package/dist/esm/uikit/Overlay.js +6 -0
- package/dist/esm/uikit/Pager.js +6 -0
- package/dist/esm/uikit/Progress.js +13 -0
- package/dist/esm/uikit/RadioButton.js +19 -0
- package/dist/esm/uikit/RadioButtonList.js +20 -0
- package/dist/esm/uikit/Slider.js +7 -0
- package/dist/esm/uikit/Spacer.js +4 -0
- package/dist/esm/uikit/Switch.js +6 -0
- package/dist/esm/uikit/TabBar.js +19 -0
- package/dist/esm/uikit/TextArea.js +20 -0
- package/dist/esm/uikit/Textfield.js +21 -0
- package/dist/esm/uikit/Tip.js +7 -0
- package/dist/esm/uikit/Toast.js +15 -0
- package/dist/esm/uikit/UIButton.js +19 -0
- package/dist/esm/uikit/UIButtonBar.js +19 -0
- package/dist/esm/uikit/UICard.js +14 -0
- package/dist/esm/uikit/UIChip.js +15 -0
- package/dist/esm/uikit/UIFileIcon.js +11 -0
- package/dist/esm/uikit/UILabel.js +12 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/stores/index.d.ts +2 -0
- package/dist/types/stores/tip/_types.d.ts +8 -0
- package/dist/types/stores/tip/index.d.ts +2 -0
- package/dist/types/stores/tip/tipStore.d.ts +12 -0
- package/dist/types/stores/toast/_types.d.ts +14 -0
- package/dist/types/stores/toast/index.d.ts +2 -0
- package/dist/types/stores/toast/toastStore.d.ts +12 -0
- package/dist/types/uikit/FlexDiv/FlexDiv.d.ts +2 -0
- package/dist/types/uikit/FlexDiv/_types.d.ts +1 -0
- package/dist/types/uikit/Toast/Toast.d.ts +1 -1
- package/dist/types/uikit/Toast/_types.d.ts +7 -1
- package/dist/types/uikit/Toast/index.d.ts +1 -1
- package/package.json +79 -5
- package/dist/index.esm.js +0 -5859
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js +0 -5911
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { _ as __rest, a as __awaiter } from './tslib.es6-0pkUdtrF.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useAnimate, usePresence, AnimatePresence, motion } from 'motion/react';
|
|
4
|
+
import React, { useEffect, useState, useRef, useMemo } from 'react';
|
|
5
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
6
|
+
import '../theme/colors.js';
|
|
7
|
+
import '../hooks/useWindow.js';
|
|
8
|
+
import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
|
|
9
|
+
|
|
10
|
+
const DoneCheck = React.memo((props) => {
|
|
11
|
+
const theme = useTheme();
|
|
12
|
+
const { size = 88, stroke = 0.75, duration = 0.35, bounce = 0.7, delay = 0.5, color = theme.current.colors['feedback-positive'], didEnd = () => null, didStart = () => null, play = false } = props, svgAttributes = __rest(props, ["size", "stroke", "duration", "bounce", "delay", "color", "didEnd", "didStart", "play"]);
|
|
13
|
+
const { id: svgId, className, style } = svgAttributes, rest = __rest(svgAttributes, ["id", "className", "style"]);
|
|
14
|
+
const [check, animateCheck] = useAnimate();
|
|
15
|
+
const [isPresent, safeToRemove] = usePresence();
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const variants = { initial: { scale: 0.9 }, animate: { scale: 1 } };
|
|
18
|
+
const spring = {
|
|
19
|
+
type: 'spring',
|
|
20
|
+
time: duration,
|
|
21
|
+
bounce,
|
|
22
|
+
delay,
|
|
23
|
+
};
|
|
24
|
+
const instant = { ease: 'linear', duration: 0, delay: 0 };
|
|
25
|
+
if (isPresent && play) {
|
|
26
|
+
const enterAnimation = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
didStart();
|
|
28
|
+
yield animateCheck(check.current, variants.initial, instant);
|
|
29
|
+
yield animateCheck(check.current, variants.animate, spring);
|
|
30
|
+
didEnd();
|
|
31
|
+
});
|
|
32
|
+
enterAnimation();
|
|
33
|
+
}
|
|
34
|
+
else if (isPresent && !play) {
|
|
35
|
+
const enterAnimation = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
yield animateCheck(check.current, variants.animate, instant);
|
|
37
|
+
});
|
|
38
|
+
enterAnimation();
|
|
39
|
+
}
|
|
40
|
+
else if (!isPresent) {
|
|
41
|
+
const exitAnimation = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
+
yield animateCheck(check.current, variants.initial, instant);
|
|
43
|
+
safeToRemove();
|
|
44
|
+
});
|
|
45
|
+
exitAnimation();
|
|
46
|
+
}
|
|
47
|
+
}, [
|
|
48
|
+
isPresent,
|
|
49
|
+
play,
|
|
50
|
+
animateCheck,
|
|
51
|
+
check,
|
|
52
|
+
didEnd,
|
|
53
|
+
didStart,
|
|
54
|
+
safeToRemove,
|
|
55
|
+
bounce,
|
|
56
|
+
delay,
|
|
57
|
+
duration,
|
|
58
|
+
]);
|
|
59
|
+
const checkMark = () => {
|
|
60
|
+
return (jsxs("svg", Object.assign({ id: svgId, className: className, ref: check, xmlns: "http://www.w3.org/2000/svg", width: size, height: size, scale: 0.9, viewBox: "0 0 20 20", fill: "none", style: (style !== null && style !== void 0 ? style : {}), "aria-label": "Checkmark icon" }, rest, { children: [jsx("title", { children: "Checkmark" }), jsx("path", { d: "M 1 1 L 19 1 L 19 19 L 1 19 Z", fill: "transparent" }), jsx("path", { d: "M 10 2 C 14.418 2 18 5.582 18 10 C 18 14.418 14.418 18 10 18 C 5.582 18 2 14.418 2 10 C 2 5.582 5.582 2 10 2 Z", fill: "transparent", strokeWidth: stroke, stroke: color }), jsx("path", { d: "M 6.5 9.5 L 9 12 L 13.5 7.5", fill: "transparent", strokeWidth: stroke, stroke: color })] })));
|
|
61
|
+
};
|
|
62
|
+
return checkMark();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
var css_248z = ".flexBox-module_row__PWxbe {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__27lKK {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__nJZnW {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__dHcOU {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__MP2Xd {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__Kg8cV {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__zcmtk {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__157yI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__u2nwI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.ProgressIndicator-module_container__CZDPk {\n\tposition: var(--pi-position);\n\ttop: var(--pi-inset);\n\tbottom: var(--pi-inset);\n\tleft: var(--pi-inset);\n\tright: var(--pi-inset);\n\tcolor: var(--core-text-disabled);\n}\n\n.ProgressIndicator-module_iconWrapper__jPIBx {\n\tmin-width: var(--pi-icon-size);\n\tmax-width: var(--pi-icon-size);\n\tmax-height: var(--pi-icon-size);\n\tmin-height: var(--pi-icon-size);\n\theight: var(--pi-icon-size);\n\twidth: var(--pi-icon-size);\n\tpadding: 0;\n\tbackground: none;\n\tborder-radius: 100%;\n}\n";
|
|
66
|
+
var css = {"container":"ProgressIndicator-module_container__CZDPk flexBox-module_column__MP2Xd"};
|
|
67
|
+
styleInject(css_248z);
|
|
68
|
+
|
|
69
|
+
function ProgressIndicator(props) {
|
|
70
|
+
const theme = useTheme();
|
|
71
|
+
const { size = 20, secondsPerSpin = 1, show = false, color = theme.current.colors['core-icon-primary'], stroke = 1.5, inline = false, duration = undefined, didStart = () => null, didStop = () => null } = props, divAttributes = __rest(props, ["size", "secondsPerSpin", "show", "color", "stroke", "inline", "duration", "didStart", "didStop"]);
|
|
72
|
+
const { id: divId, className, style } = divAttributes, rest = __rest(divAttributes, ["id", "className", "style"]);
|
|
73
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
74
|
+
const divClass = className ? ` ${className}` : '';
|
|
75
|
+
const [playing, setPlaying] = useState(show);
|
|
76
|
+
const timer = useRef(null);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (show) {
|
|
79
|
+
setPlaying(true);
|
|
80
|
+
didStart();
|
|
81
|
+
if (duration) {
|
|
82
|
+
timer.current = setTimeout(() => {
|
|
83
|
+
setPlaying(false);
|
|
84
|
+
didStop();
|
|
85
|
+
}, duration * 1000);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
setPlaying(false);
|
|
90
|
+
didStop();
|
|
91
|
+
}
|
|
92
|
+
return () => {
|
|
93
|
+
if (timer === null || timer === void 0 ? void 0 : timer.current)
|
|
94
|
+
clearTimeout(timer.current);
|
|
95
|
+
};
|
|
96
|
+
}, [show, didStart, didStop, duration]);
|
|
97
|
+
const cssVars = useMemo(() => {
|
|
98
|
+
return {
|
|
99
|
+
'--pi-position': inline ? 'relative' : 'absolute',
|
|
100
|
+
'--pi-inset': inline ? 'unset' : '0',
|
|
101
|
+
'--pi-icon-size': `${size !== null && size !== void 0 ? size : 0}px`,
|
|
102
|
+
};
|
|
103
|
+
}, [inline, size]);
|
|
104
|
+
const openCircle = useMemo(() => {
|
|
105
|
+
return OpenCircle(size, secondsPerSpin, color, stroke, playing);
|
|
106
|
+
}, [size, secondsPerSpin, color, stroke, playing]);
|
|
107
|
+
return (jsx(AnimatePresence, { initial: true, children: show && (jsx(motion.div, Object.assign({ id: divId, className: `${css.container}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars), initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 } }, rest, { children: openCircle }))) }));
|
|
108
|
+
}
|
|
109
|
+
const OpenCircle = (size, secondsPerSpin, color, stroke = 1.5, playing = false) => {
|
|
110
|
+
return (jsxs(motion.svg, { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", role: "img", "aria-label": "Loading spinner", transition: {
|
|
111
|
+
ease: 'linear',
|
|
112
|
+
repeatType: 'loop',
|
|
113
|
+
repeat: playing ? Number.POSITIVE_INFINITY : 0,
|
|
114
|
+
duration: secondsPerSpin,
|
|
115
|
+
}, animate: playing ? { rotate: 360 } : { rotate: 0 }, children: [jsx("title", { children: "Loading" }), jsx("defs", { children: jsxs("linearGradient", { id: "strokeFill", x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 1 }), jsx("stop", { offset: "50%", stopColor: color, stopOpacity: 1 }), jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0 })] }) }), jsx(motion.path, { d: "M 17.371 6.886 C 17.776 7.843 18 8.895 18 10 C 18 14.418 14.418 18 10 18 C 5.582 18 2 14.418 2 10 C 2 5.582 5.582 2 10 2", fill: "transparent", strokeWidth: stroke, stroke: 'url(#strokeFill)' })] }));
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export { DoneCheck as D, ProgressIndicator as P };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { _ as __rest } from './tslib.es6-0pkUdtrF.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
|
4
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
5
|
+
import '../theme/colors.js';
|
|
6
|
+
import '../hooks/useWindow.js';
|
|
7
|
+
import { I as IconButton } from './IconButton-CguHGkBM.js';
|
|
8
|
+
import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
|
|
9
|
+
|
|
10
|
+
var css_248z = ".flexBox-module_row__PWxbe {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__27lKK {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__nJZnW {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__dHcOU {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__MP2Xd {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__Kg8cV {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__zcmtk {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__157yI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__u2nwI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.type-module_body-xs-regular__QWEzl {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-medium__FxEAv {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-bold__rf7AV {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.25px;\n}.type-module_body-s-regular__8-FO- {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-medium__qyYq- {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-bold__7GQ5Z {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-m-regular__Qtp5G {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-medium__Ieh9K {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-bold__0lZ3I {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-l-regular__Ar4d3 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-medium__6tV1n {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-bold__I8Q1v {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_heading-s-bold__QFgN8 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 650;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-s-medium__jGIb2 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 560;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-bold__tdBSi {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 650;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-medium__-7Uyu {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 560;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-medium__8hGYF {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 560;\n\tfont-size: 28px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-bold__Cryjg {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 650;\n\tfont-size: 28px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}\n\n.RadioButton-module_wrapper__ezvz- {\n\tpadding: var(--rb-padding) !important;\n\tmax-width: var(--rb-max-width);\n\tflex: var(--rb-flex);\n\tborder: 1px solid var(--core-outline-primary);\n\tbackground: var(--rb-bg);\n\tgap: 8px;\n\tborder-radius: 8px;\n\tcursor: pointer;\n\ttransition: all 0.25s ease-in-out 0s;\n\tuser-select: none;\n\t-webkit-user-select: none;\n}\n\n.RadioButton-module_radioIcon__6ddS9 {\n\twidth: 20px;\n\theight: 20px;\n\tmax-width: 20px;\n\tmax-height: 20px;\n\tmin-height: 20px;\n\tmin-width: 20px;\n}\n\n.RadioButton-module_radioTitle__R1R2D {\n\tcolor: var(--core-text-primary);\n\twhite-space: nowrap;\n\tflex: 1;\n}\n\n.RadioButton-module_radioSummary__-RRdT {\n\tcolor: var(--core-text-primary);\n\tflex: 1;\n}\n\n.RadioButton-module_radioContent__Fq-Ry {\n\twidth: 100%;\n}\n";
|
|
11
|
+
var css = {"wrapper":"RadioButton-module_wrapper__ezvz- flexBox-module_row__PWxbe","radioIcon":"RadioButton-module_radioIcon__6ddS9 flexBox-module_column__MP2Xd","radioTitle":"RadioButton-module_radioTitle__R1R2D flexBox-module_rowStart__nJZnW type-module_body-m-regular__Qtp5G","radioSummary":"RadioButton-module_radioSummary__-RRdT flexBox-module_rowStart__nJZnW type-module_body-s-regular__8-FO-","radioContent":"RadioButton-module_radioContent__Fq-Ry flexBox-module_columnStart__Kg8cV"};
|
|
12
|
+
styleInject(css_248z);
|
|
13
|
+
|
|
14
|
+
const RadioButton = React.memo((props) => {
|
|
15
|
+
const theme = useTheme();
|
|
16
|
+
const { option, selected = false, deselect = true, tabIndex = 1, wrap = false, list = false, hideRadio = false, toggleIcon = true, noFrame = false, iconColor, onChange = () => null } = props, divAttributes = __rest(props, ["option", "selected", "deselect", "tabIndex", "wrap", "list", "hideRadio", "toggleIcon", "noFrame", "iconColor", "onChange"]);
|
|
17
|
+
const { id: divId, className, style } = divAttributes, rest = __rest(divAttributes, ["id", "className", "style"]);
|
|
18
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
19
|
+
const divClass = className ? ` ${className}` : '';
|
|
20
|
+
const [isSelected, setIsSelected] = useState(selected);
|
|
21
|
+
useEffect(() => setIsSelected(selected), [selected]);
|
|
22
|
+
const handleChange = useCallback(() => {
|
|
23
|
+
if (isSelected && !deselect)
|
|
24
|
+
return;
|
|
25
|
+
setIsSelected(!isSelected);
|
|
26
|
+
onChange(option, !isSelected);
|
|
27
|
+
}, [isSelected, deselect, onChange, option]);
|
|
28
|
+
const handleKeyDown = useCallback((e) => {
|
|
29
|
+
if (e.code === 'Space') {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
e.stopPropagation();
|
|
32
|
+
handleChange();
|
|
33
|
+
}
|
|
34
|
+
}, [handleChange]);
|
|
35
|
+
// memo icon color
|
|
36
|
+
const setIconColor = useMemo(() => {
|
|
37
|
+
if (iconColor)
|
|
38
|
+
return iconColor;
|
|
39
|
+
return toggleIcon && isSelected
|
|
40
|
+
? theme.current.colors['core-button-primary']
|
|
41
|
+
: theme.current.colors['core-icon-primary'];
|
|
42
|
+
}, [iconColor, toggleIcon, isSelected, theme]);
|
|
43
|
+
// memo icon name
|
|
44
|
+
const iconName = useMemo(() => (toggleIcon && isSelected ? 'checked' : 'unchecked'), [toggleIcon, isSelected]);
|
|
45
|
+
// memo flex
|
|
46
|
+
const setFlex = useMemo(() => {
|
|
47
|
+
if (list)
|
|
48
|
+
return 'unset';
|
|
49
|
+
return wrap ? '40%' : '1';
|
|
50
|
+
}, [list, wrap]);
|
|
51
|
+
// memo css vars
|
|
52
|
+
const cssVars = useMemo(() => {
|
|
53
|
+
return {
|
|
54
|
+
'--rb-max-width': wrap ? '50%' : '100%',
|
|
55
|
+
'--rb-flex': setFlex,
|
|
56
|
+
'--rb-padding': noFrame ? '0' : '8px 16px 8px 10px',
|
|
57
|
+
'--rb-bg': isSelected ? 'var(--core-surface-secondary)' : 'transparent',
|
|
58
|
+
};
|
|
59
|
+
}, [setFlex, isSelected, wrap, noFrame]);
|
|
60
|
+
return (jsxs("div", Object.assign({ id: divId, className: `${css.wrapper}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars), onClick: handleChange, onKeyDown: handleKeyDown, tabIndex: tabIndex, "aria-label": option.title, "aria-selected": isSelected }, rest, { children: [option.icon && !hideRadio && (jsx("div", { className: css.radioIcon, children: jsx(IconButton, { toggle: false, icon: iconName, color: setIconColor, frameSize: 20, iconSize: 20 }) })), jsxs("div", { className: css.radioContent, children: [jsx("div", { className: css.radioTitle, children: option.title }), option.description && option.description !== '' && (jsx("div", { className: css.radioSummary, children: option.description }))] })] })));
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export { RadioButton as R };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { _ as __rest } from './tslib.es6-0pkUdtrF.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
|
4
|
+
import { R as RadioButton } from './RadioButton-B5BxQI0R.js';
|
|
5
|
+
import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
|
|
6
|
+
|
|
7
|
+
var css_248z = ".flexBox-module_row__PWxbe {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__27lKK {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__nJZnW {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__dHcOU {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__MP2Xd {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__Kg8cV {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__zcmtk {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__157yI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__u2nwI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.RadioButtonList-module_wrapper__UMlAV {\n\talign-items: flex-start;\n\twidth: 100%;\n\tflex-wrap: var(--rb-list-flex-wrap);\n\tmargin-bottom: var(--rb-list-margin-bottom);\n\tgap: var(--rb-gap);\n}\n\n.RadioButtonList-module_column__E9MfY {\n}\n\n.RadioButtonList-module_row__l88Vt {\n}\n";
|
|
8
|
+
var css = {"wrapper":"RadioButtonList-module_wrapper__UMlAV","column":"RadioButtonList-module_column__E9MfY flexBox-module_columnStart__Kg8cV","row":"RadioButtonList-module_row__l88Vt flexBox-module_rowStart__nJZnW"};
|
|
9
|
+
styleInject(css_248z);
|
|
10
|
+
|
|
11
|
+
const RadioButtonList = React.memo((props) => {
|
|
12
|
+
const { options = [], selectedIndexes = null, selectedOptions = null, label = null, deselect = false, multiSelect = false, wrap = false, tabIndexSeed = 0, spacer = 'none', custom = 0, gap = 16, hideRadio = false, noFrame = false, toggleIcon = true, iconColor = undefined, iconSelectedColor = undefined, onChange = () => null } = props, divAttributes = __rest(props, ["options", "selectedIndexes", "selectedOptions", "label", "deselect", "multiSelect", "wrap", "tabIndexSeed", "spacer", "custom", "gap", "hideRadio", "noFrame", "toggleIcon", "iconColor", "iconSelectedColor", "onChange"]);
|
|
13
|
+
const { id: divId, className, style } = divAttributes, rest = __rest(divAttributes, ["id", "className", "style"]);
|
|
14
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
15
|
+
const divClass = className ? ` ${className}` : '';
|
|
16
|
+
// internal array of selected indexes
|
|
17
|
+
const [selected, setSelected] = useState(selectedIndexes);
|
|
18
|
+
// update indexes selected based on prop
|
|
19
|
+
useEffect(() => setSelected(selectedIndexes), [selectedIndexes]);
|
|
20
|
+
// update indexes selected if setting selections via field name / values
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (!selectedOptions || !options)
|
|
23
|
+
return;
|
|
24
|
+
const selections = [];
|
|
25
|
+
for (const item of selectedOptions) {
|
|
26
|
+
for (let i = 0; i < options.length; i++) {
|
|
27
|
+
const option = options[i];
|
|
28
|
+
if (option.fieldName === item)
|
|
29
|
+
selections.push(i);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
setSelected(selections);
|
|
33
|
+
}, [selectedOptions, options]);
|
|
34
|
+
// returns if a specific option index is selected
|
|
35
|
+
const isSelected = useCallback((index) => {
|
|
36
|
+
if (!selected)
|
|
37
|
+
return false;
|
|
38
|
+
return selected.includes(index);
|
|
39
|
+
}, [selected]);
|
|
40
|
+
const doMultiSelection = useCallback((selection, state) => {
|
|
41
|
+
// **** update the selected indexes
|
|
42
|
+
let indexesSelected = selected ? [...selected] : [];
|
|
43
|
+
// if deselecting and there are selections
|
|
44
|
+
if (!state && selected) {
|
|
45
|
+
const removeAt = indexesSelected.indexOf(selection);
|
|
46
|
+
indexesSelected.splice(removeAt, 1);
|
|
47
|
+
}
|
|
48
|
+
else if (state) {
|
|
49
|
+
indexesSelected = selected ? [...selected] : [];
|
|
50
|
+
const exists = indexesSelected.includes(selection);
|
|
51
|
+
if (!exists)
|
|
52
|
+
indexesSelected.push(selection);
|
|
53
|
+
}
|
|
54
|
+
// **** create an array of selected options
|
|
55
|
+
let updatedSelections = [];
|
|
56
|
+
for (const index of indexesSelected || []) {
|
|
57
|
+
if (updatedSelections)
|
|
58
|
+
updatedSelections.push(options[index]);
|
|
59
|
+
}
|
|
60
|
+
if (updatedSelections.length < 1)
|
|
61
|
+
updatedSelections = null;
|
|
62
|
+
setSelected(indexesSelected || null);
|
|
63
|
+
onChange(updatedSelections, indexesSelected || null);
|
|
64
|
+
}, [selected, options, onChange]);
|
|
65
|
+
const doSingleSelection = useCallback((selection, state) => {
|
|
66
|
+
onChange(state ? [options[selection]] : [], state ? [selection] : []);
|
|
67
|
+
setSelected(state ? [selection] : null);
|
|
68
|
+
}, [options, onChange]);
|
|
69
|
+
const handleChange = useCallback((selection, state) => {
|
|
70
|
+
// it not multiselect just pass the current selection
|
|
71
|
+
if (multiSelect) {
|
|
72
|
+
doMultiSelection(selection, state);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
doSingleSelection(selection, state);
|
|
76
|
+
}
|
|
77
|
+
}, [multiSelect, doMultiSelection, doSingleSelection]);
|
|
78
|
+
const renderedOptions = useMemo(() => {
|
|
79
|
+
return options.map((option, i) => {
|
|
80
|
+
return (jsx(RadioButton, { option: option, selected: isSelected(i), deselect: deselect, wrap: wrap, noFrame: noFrame, hideRadio: hideRadio, onChange: (_option, state) => handleChange(i, state), tabIndex: i + 1 + 100 * tabIndexSeed, toggleIcon: toggleIcon, iconColor: isSelected(i) ? iconSelectedColor : iconColor }, `${option.fieldName}_${i}`));
|
|
81
|
+
});
|
|
82
|
+
}, [
|
|
83
|
+
options,
|
|
84
|
+
isSelected,
|
|
85
|
+
deselect,
|
|
86
|
+
wrap,
|
|
87
|
+
noFrame,
|
|
88
|
+
hideRadio,
|
|
89
|
+
handleChange,
|
|
90
|
+
tabIndexSeed,
|
|
91
|
+
toggleIcon,
|
|
92
|
+
iconColor,
|
|
93
|
+
iconSelectedColor,
|
|
94
|
+
]);
|
|
95
|
+
// memo margin
|
|
96
|
+
const margin = useMemo(() => {
|
|
97
|
+
if (spacer === 'none')
|
|
98
|
+
return 0;
|
|
99
|
+
if (spacer === 'custom')
|
|
100
|
+
return custom;
|
|
101
|
+
return 0;
|
|
102
|
+
}, [spacer, custom]);
|
|
103
|
+
// memo css vars
|
|
104
|
+
const cssVars = useMemo(() => {
|
|
105
|
+
return {
|
|
106
|
+
'--rb-list-flex-wrap': wrap ? 'wrap' : 'nowrap',
|
|
107
|
+
'--rb-list-margin-bottom': noFrame ? 0 : `${margin}px`,
|
|
108
|
+
'--rb-gap': `${gap}px`,
|
|
109
|
+
};
|
|
110
|
+
}, [wrap, margin, gap, noFrame]);
|
|
111
|
+
return (jsxs("div", Object.assign({ id: divId, className: `${css.wrapper} ${noFrame ? css.column : css.row}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars) }, rest, { children: [label, renderedOptions] })));
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
export { RadioButtonList as R };
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { _ as __rest } from './tslib.es6-0pkUdtrF.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React, { useRef, useMemo, useCallback, useEffect } from 'react';
|
|
4
|
+
import { useObserveResize } from '../hooks/useObserveResize.js';
|
|
5
|
+
import { p as pointerPosition } from './utils-BRZK2Drn.js';
|
|
6
|
+
import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* General debounce utility with delay setting and cancel/flush methods
|
|
10
|
+
* to clear a "debounce" or immediately "execute" the debounced function
|
|
11
|
+
*/
|
|
12
|
+
function debounce(func, delay) {
|
|
13
|
+
let timeoutId = null;
|
|
14
|
+
let lastArgs = null;
|
|
15
|
+
const debounced = function (...args) {
|
|
16
|
+
lastArgs = args;
|
|
17
|
+
if (timeoutId !== null) {
|
|
18
|
+
clearTimeout(timeoutId);
|
|
19
|
+
}
|
|
20
|
+
timeoutId = setTimeout(() => {
|
|
21
|
+
func.apply(this, lastArgs !== null && lastArgs !== void 0 ? lastArgs : []);
|
|
22
|
+
timeoutId = null;
|
|
23
|
+
lastArgs = null;
|
|
24
|
+
}, delay);
|
|
25
|
+
};
|
|
26
|
+
debounced.cancel = () => {
|
|
27
|
+
if (timeoutId !== null) {
|
|
28
|
+
clearTimeout(timeoutId);
|
|
29
|
+
timeoutId = null;
|
|
30
|
+
lastArgs = null;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
debounced.flush = function () {
|
|
34
|
+
if (timeoutId !== null && lastArgs !== null) {
|
|
35
|
+
clearTimeout(timeoutId);
|
|
36
|
+
func.apply(this, lastArgs);
|
|
37
|
+
timeoutId = null;
|
|
38
|
+
lastArgs = null;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return debounced;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var css_248z = ".flexBox-module_row__PWxbe {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__27lKK {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__nJZnW {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__dHcOU {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__MP2Xd {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__Kg8cV {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__zcmtk {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__157yI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__u2nwI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.Slider-module_wrapper__ju4N2 {\n\tposition: relative;\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: var(--slider-padding);\n\tmargin: 0;\n\twidth: var(--slider-width);\n\theight: var(--slider-height);\n\tmin-height: var(--slider-touch-height);\n\tcursor: var(--slider-cursor);\n}\n\n.Slider-module_track__XogMe {\n\tposition: relative;\n\twidth: 0;\n\theight: 100%;\n\tbackground-color: var(--slider-progress-color);\n\toverflow: visible;\n\tpointer-events: none;\n\tborder-radius: 100px;\n}\n\n.Slider-module_trackHead__Ka3pu {\n\tposition: absolute;\n\tdisplay: var(--slider-head-display);\n\tbackground-color: var(--slider-head-color);\n\tpointer-events: none;\n\tborder-radius: var(--slider-head-radius);\n\tmax-width: var(--slider-head-width);\n\tmax-height: var(--slider-head-size);\n\tmin-width: var(--slider-head-width);\n\tmin-height: var(--slider-head-size);\n\ttop: 50%;\n\ttransform: translateY(-50%) translateX(-50%);\n}\n\n.Slider-module_trackBg__4z7Pt {\n\twidth: 100%;\n\theight: var(--slider-height);\n\tbackground-color: var(--slider-track-color);\n\tpointer-events: none;\n\tborder-radius: 100px;\n}\n";
|
|
45
|
+
var css = {"wrapper":"Slider-module_wrapper__ju4N2","track":"Slider-module_track__XogMe flexBox-module_rowStart__nJZnW","trackHead":"Slider-module_trackHead__Ka3pu","trackBg":"Slider-module_trackBg__4z7Pt flexBox-module_rowStart__nJZnW"};
|
|
46
|
+
styleInject(css_248z);
|
|
47
|
+
|
|
48
|
+
const Slider = React.memo((props) => {
|
|
49
|
+
const { value = 25, scaleMin = 0, scaleMax = 100, width, height = 2, touchHeight = 24, trackHeadSize = 7, headType = 'round', trackHeadWidth = 4, cursor = 'default', headColor = 'var(--core-text-primary)', trackColor = 'var(--core-surface-secondary)', progressColor = 'var(--core-text-primary)', onChange = () => null, onDragChange = () => null } = props, divAttributes = __rest(props, ["value", "scaleMin", "scaleMax", "width", "height", "touchHeight", "trackHeadSize", "headType", "trackHeadWidth", "cursor", "headColor", "trackColor", "progressColor", "onChange", "onDragChange"]);
|
|
50
|
+
const { id: divId, className, style } = divAttributes, rest = __rest(divAttributes, ["id", "className", "style"]);
|
|
51
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
52
|
+
const divClass = className ? ` ${className}` : '';
|
|
53
|
+
// hook into the relevant on screen elements
|
|
54
|
+
const ref = useRef(null);
|
|
55
|
+
const track = useRef(null);
|
|
56
|
+
const head = useRef(null);
|
|
57
|
+
// tracking slider values via ref to avoid state issues from direct listeners
|
|
58
|
+
const absProgressRef = useRef(value);
|
|
59
|
+
const relativeProgressRef = useRef(value / scaleMax);
|
|
60
|
+
const didMount = useRef(false);
|
|
61
|
+
// use resize observer to track changes to container size for responsive behavior
|
|
62
|
+
const size = useObserveResize(ref, { ignore: 'height' });
|
|
63
|
+
// use a "debounce" to limit the number of onChange calls
|
|
64
|
+
const debouncedOnChange = debounce((value, percent) => {
|
|
65
|
+
onChange(value, percent);
|
|
66
|
+
}, 0);
|
|
67
|
+
// set padding based on head size since dragging the head all the way to the edge will move it
|
|
68
|
+
// such that half the head would be outside the track constraints
|
|
69
|
+
const padding = useMemo(() => {
|
|
70
|
+
if (headType === 'none' || !trackHeadSize)
|
|
71
|
+
return 0;
|
|
72
|
+
return trackHeadSize / 2;
|
|
73
|
+
}, [headType, trackHeadSize]);
|
|
74
|
+
// set the position of the track progress and track head
|
|
75
|
+
// based on the pixel position / adjust for half the size of the head (= padding)
|
|
76
|
+
const setTrackAndHead = useCallback((pixelPos, max = false) => {
|
|
77
|
+
const tr = track.current;
|
|
78
|
+
const hd = head.current;
|
|
79
|
+
let adjustment = 0;
|
|
80
|
+
if (pixelPos === 0)
|
|
81
|
+
adjustment = padding;
|
|
82
|
+
if (max)
|
|
83
|
+
adjustment = -padding;
|
|
84
|
+
if (tr && hd) {
|
|
85
|
+
tr.style.width = `${pixelPos}px`;
|
|
86
|
+
hd.style.left = `${pixelPos - padding + adjustment}px`;
|
|
87
|
+
}
|
|
88
|
+
didMount.current = true;
|
|
89
|
+
}, [padding]);
|
|
90
|
+
// set the initial position of the slider absolute value within scale
|
|
91
|
+
const initialProgress = useCallback((current) => {
|
|
92
|
+
if (!(ref === null || ref === void 0 ? void 0 : ref.current))
|
|
93
|
+
return;
|
|
94
|
+
const sliderWidth = ref.current.getBoundingClientRect().width;
|
|
95
|
+
let adjustedCurrent = current;
|
|
96
|
+
if (adjustedCurrent > scaleMax || adjustedCurrent < scaleMin) {
|
|
97
|
+
console.warn('Slider outside range. Adjusted to mid point.');
|
|
98
|
+
adjustedCurrent = (scaleMax - scaleMin) / 2;
|
|
99
|
+
}
|
|
100
|
+
const normalized = (adjustedCurrent - scaleMin) / (scaleMax - scaleMin);
|
|
101
|
+
const pixelPos = normalized * sliderWidth;
|
|
102
|
+
absProgressRef.current = adjustedCurrent; // updated the progress value
|
|
103
|
+
relativeProgressRef.current = normalized; // updated the relative value
|
|
104
|
+
const max = relativeProgressRef.current === 1; // flag if at max value
|
|
105
|
+
setTrackAndHead(pixelPos, max);
|
|
106
|
+
didMount.current = true;
|
|
107
|
+
}, [scaleMax, scaleMin, setTrackAndHead]);
|
|
108
|
+
// based on x pos of a mouse drag/click, update the percent and normalized value of the slider
|
|
109
|
+
const progress = useCallback((posX) => {
|
|
110
|
+
const el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
111
|
+
if (!el)
|
|
112
|
+
return { value: 0, percent: 0 };
|
|
113
|
+
const rect = el.getBoundingClientRect();
|
|
114
|
+
const sliderWidth = rect.width;
|
|
115
|
+
relativeProgressRef.current = posX / sliderWidth;
|
|
116
|
+
absProgressRef.current =
|
|
117
|
+
scaleMin + relativeProgressRef.current * (scaleMax - scaleMin);
|
|
118
|
+
}, [scaleMax, scaleMin]);
|
|
119
|
+
// take a mouse pos and sets the slider position accordingly
|
|
120
|
+
// returns the pos value making sure it's in bounds
|
|
121
|
+
const updateSlider = useCallback((e) => {
|
|
122
|
+
const newPos = pointerPosition(e);
|
|
123
|
+
const el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
124
|
+
if (!el)
|
|
125
|
+
return 0;
|
|
126
|
+
const rect = el.getBoundingClientRect();
|
|
127
|
+
const sliderWidth = rect.width;
|
|
128
|
+
let pos = newPos - rect.x;
|
|
129
|
+
if (pos > sliderWidth - padding)
|
|
130
|
+
pos = sliderWidth;
|
|
131
|
+
else if (pos < padding)
|
|
132
|
+
pos = 0;
|
|
133
|
+
const max = pos === sliderWidth;
|
|
134
|
+
setTrackAndHead(pos, max);
|
|
135
|
+
return pos;
|
|
136
|
+
}, [setTrackAndHead, padding]);
|
|
137
|
+
// on mouse move, push slider to the updated mouse position and trigger the update events
|
|
138
|
+
// use ref values in the call back to avoid state issues
|
|
139
|
+
const handleMouseMove = useCallback((e) => {
|
|
140
|
+
e.preventDefault();
|
|
141
|
+
const el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
142
|
+
if (el) {
|
|
143
|
+
const pos = updateSlider(e); // return new pixel pos and updates head/track
|
|
144
|
+
progress(pos); // update the slider progress
|
|
145
|
+
debouncedOnChange(absProgressRef.current, relativeProgressRef.current); // debounce updates
|
|
146
|
+
}
|
|
147
|
+
}, [progress, updateSlider, debouncedOnChange]);
|
|
148
|
+
// on mouse up, push slider to the updated mouse up position and trigger the update events
|
|
149
|
+
// also cleaning up the mouse move and mouse up listeners attached to the window
|
|
150
|
+
const handleMouseUp = useCallback((e) => {
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
const el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
153
|
+
if (el) {
|
|
154
|
+
const pos = updateSlider(e); // return new pixel pos and updates head/track
|
|
155
|
+
progress(pos);
|
|
156
|
+
debouncedOnChange.cancel(); // cancel current debounce if any
|
|
157
|
+
onDragChange(absProgressRef.current, relativeProgressRef.current); // immediate update
|
|
158
|
+
onChange(absProgressRef.current, relativeProgressRef.current);
|
|
159
|
+
}
|
|
160
|
+
globalThis.removeEventListener('mousemove', handleMouseMove, false);
|
|
161
|
+
globalThis.removeEventListener('touchmove', handleMouseMove, false);
|
|
162
|
+
globalThis.removeEventListener('mouseup', handleMouseUp, false);
|
|
163
|
+
globalThis.removeEventListener('touchend', handleMouseUp, false);
|
|
164
|
+
}, [
|
|
165
|
+
handleMouseMove,
|
|
166
|
+
progress,
|
|
167
|
+
updateSlider,
|
|
168
|
+
debouncedOnChange,
|
|
169
|
+
onDragChange,
|
|
170
|
+
onChange,
|
|
171
|
+
]);
|
|
172
|
+
// On mouse down push the progress of then slider to the mouse down point
|
|
173
|
+
// and trigger events - add the drag and mouse up window listeners
|
|
174
|
+
const handleMouseDown = useCallback((e) => {
|
|
175
|
+
e.preventDefault();
|
|
176
|
+
e.stopPropagation();
|
|
177
|
+
globalThis.addEventListener('mousemove', handleMouseMove, false);
|
|
178
|
+
globalThis.addEventListener('touchmove', handleMouseMove, false);
|
|
179
|
+
globalThis.addEventListener('mouseup', handleMouseUp, false);
|
|
180
|
+
globalThis.addEventListener('touchend', handleMouseUp, false);
|
|
181
|
+
const el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
182
|
+
if (el) {
|
|
183
|
+
const pos = updateSlider(e); // return new pixel pos and updates head/track
|
|
184
|
+
progress(pos);
|
|
185
|
+
debouncedOnChange.cancel(); // cancel current debounce if any
|
|
186
|
+
onChange(absProgressRef.current, relativeProgressRef.current); // immediate update
|
|
187
|
+
onDragChange(absProgressRef.current, relativeProgressRef.current);
|
|
188
|
+
}
|
|
189
|
+
}, [
|
|
190
|
+
handleMouseMove,
|
|
191
|
+
handleMouseUp,
|
|
192
|
+
onChange,
|
|
193
|
+
onDragChange,
|
|
194
|
+
progress,
|
|
195
|
+
updateSlider,
|
|
196
|
+
debouncedOnChange,
|
|
197
|
+
]);
|
|
198
|
+
// on mount, set the initial position of the slider
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
if (didMount.current && value === absProgressRef.current)
|
|
201
|
+
return;
|
|
202
|
+
initialProgress(value);
|
|
203
|
+
}, [value, initialProgress]);
|
|
204
|
+
// set up slider
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
const el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
207
|
+
el === null || el === void 0 ? void 0 : el.addEventListener('mousedown', handleMouseDown, false);
|
|
208
|
+
el === null || el === void 0 ? void 0 : el.addEventListener('touchstart', handleMouseDown, false);
|
|
209
|
+
return () => {
|
|
210
|
+
el === null || el === void 0 ? void 0 : el.removeEventListener('mousedown', handleMouseDown, false);
|
|
211
|
+
el === null || el === void 0 ? void 0 : el.removeEventListener('touchstart', handleMouseDown, false);
|
|
212
|
+
};
|
|
213
|
+
}, [handleMouseDown]);
|
|
214
|
+
// respond to size changes triggered by browser resizing as opposed to props
|
|
215
|
+
// note: this causes an extra render with every width prop change
|
|
216
|
+
useEffect(() => {
|
|
217
|
+
var _a;
|
|
218
|
+
const sliderWidth = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth;
|
|
219
|
+
if (!sliderWidth || size.width === 0)
|
|
220
|
+
return;
|
|
221
|
+
const max = relativeProgressRef.current === 1;
|
|
222
|
+
setTrackAndHead(relativeProgressRef.current * sliderWidth, max);
|
|
223
|
+
}, [size.width, setTrackAndHead]);
|
|
224
|
+
// memo head color
|
|
225
|
+
const trackHeadColor = useMemo(() => {
|
|
226
|
+
if (headType === 'none')
|
|
227
|
+
return 'transparent';
|
|
228
|
+
return headColor !== null && headColor !== void 0 ? headColor : 'var(--core-text-primary)';
|
|
229
|
+
}, [headColor, headType]);
|
|
230
|
+
// memo head height
|
|
231
|
+
const headSize = useMemo(() => {
|
|
232
|
+
if (headType === 'none')
|
|
233
|
+
return height;
|
|
234
|
+
return trackHeadSize;
|
|
235
|
+
}, [trackHeadSize, headType, height]);
|
|
236
|
+
// memo head width
|
|
237
|
+
const headWidth = useMemo(() => {
|
|
238
|
+
if (headType === 'round')
|
|
239
|
+
return trackHeadSize;
|
|
240
|
+
return trackHeadWidth;
|
|
241
|
+
}, [headType, trackHeadSize, trackHeadWidth]);
|
|
242
|
+
// set container width
|
|
243
|
+
const setWidth = useMemo(() => {
|
|
244
|
+
if (width && typeof width === 'string') {
|
|
245
|
+
if (width === 'auto')
|
|
246
|
+
return '100%';
|
|
247
|
+
return width;
|
|
248
|
+
}
|
|
249
|
+
return `${width !== null && width !== void 0 ? width : 100}px`;
|
|
250
|
+
}, [width]);
|
|
251
|
+
// memo css vars
|
|
252
|
+
const cssVars = useMemo(() => {
|
|
253
|
+
return {
|
|
254
|
+
'--slider-padding': `${padding}px`,
|
|
255
|
+
'--slider-width': setWidth,
|
|
256
|
+
'--slider-height': `${height}px`,
|
|
257
|
+
'--slider-touch-height': `${touchHeight}px`,
|
|
258
|
+
'--slider-cursor': cursor,
|
|
259
|
+
'--slider-head-display': height ? 'block' : 'none',
|
|
260
|
+
'--slider-head-radius': headType === 'round' ? '100%' : '0px',
|
|
261
|
+
'--slider-head-size': `${headSize}px`,
|
|
262
|
+
'--slider-head-width': `${headWidth}px`,
|
|
263
|
+
'--slider-head-color': trackHeadColor,
|
|
264
|
+
'--slider-progress-color': progressColor !== null && progressColor !== void 0 ? progressColor : 'var(--core-text-primary)',
|
|
265
|
+
'--slider-track-color': trackColor !== null && trackColor !== void 0 ? trackColor : 'var(--core-surface-secondary)',
|
|
266
|
+
};
|
|
267
|
+
}, [
|
|
268
|
+
padding,
|
|
269
|
+
height,
|
|
270
|
+
touchHeight,
|
|
271
|
+
cursor,
|
|
272
|
+
headWidth,
|
|
273
|
+
progressColor,
|
|
274
|
+
trackColor,
|
|
275
|
+
headSize,
|
|
276
|
+
trackHeadColor,
|
|
277
|
+
headType,
|
|
278
|
+
setWidth,
|
|
279
|
+
]);
|
|
280
|
+
return (jsx("div", Object.assign({ id: divId, className: `${css.wrapper}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars), ref: ref }, rest, { children: jsx("div", { className: css.trackBg, children: jsx("div", { className: css.track, ref: track, children: jsx("div", { className: css.trackHead, ref: head }) }) }) })));
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
export { Slider as S };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { _ as __rest } from './tslib.es6-0pkUdtrF.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
|
|
5
|
+
const Spacer = React.memo((props) => {
|
|
6
|
+
const { size = 8 } = props, divAttributes = __rest(props, ["size"]);
|
|
7
|
+
const { id: divId, className, style } = divAttributes, rest = __rest(divAttributes, ["id", "className", "style"]);
|
|
8
|
+
const spacerStyle = useMemo(() => ({ height: size, minHeight: size, maxHeight: size }), [size]);
|
|
9
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
10
|
+
const divClass = className ? ` ${className}` : '';
|
|
11
|
+
return (jsx("div", Object.assign({ id: divId, className: divClass.trim(), style: Object.assign(Object.assign({}, divStyle), spacerStyle) }, rest)));
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { Spacer as S };
|