test-stpr-ui-kit 0.6.15 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -9
- package/dist/components/Accordion/Accordion.css +1 -0
- package/dist/components/Accordion/Accordion.d.ts +3 -0
- package/dist/components/Accordion/Accordion.js +78 -0
- package/dist/components/Accordion/Accordion.module.scss.js +37 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Accordion/types/index.d.ts +22 -0
- package/dist/components/ApplyButtons/ApplyButtons.css +1 -0
- package/dist/components/ApplyButtons/ApplyButtons.d.ts +3 -0
- package/dist/components/ApplyButtons/ApplyButtons.js +67 -0
- package/dist/components/ApplyButtons/ApplyButtons.module.scss.js +16 -0
- package/dist/components/ApplyButtons/index.d.ts +2 -0
- package/dist/components/ApplyButtons/types/index.d.ts +24 -0
- package/dist/components/AuthProtected/AuthProtected.d.ts +3 -0
- package/dist/components/AuthProtected/AuthProtected.js +37 -0
- package/dist/components/AuthProtected/index.d.ts +2 -0
- package/dist/components/AuthProtected/types/index.d.ts +11 -0
- package/dist/components/BaseTooltip/BaseTooltip.css +1 -0
- package/dist/components/BaseTooltip/BaseTooltip.d.ts +3 -0
- package/dist/components/BaseTooltip/BaseTooltip.js +25 -0
- package/dist/components/BaseTooltip/BaseTooltip.module.scss.js +11 -0
- package/dist/components/BaseTooltip/index.d.ts +2 -0
- package/dist/components/BaseTooltip/types/index.d.ts +8 -0
- package/dist/components/Breadcrumb/Breadcrumb.css +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +3 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +42 -0
- package/dist/components/Breadcrumb/Breadcrumb.module.scss.js +17 -0
- package/dist/components/Breadcrumb/index.d.ts +2 -0
- package/dist/components/Breadcrumb/types/index.d.ts +11 -0
- package/dist/components/Button/Button.css +1 -0
- package/dist/components/Button/Button.d.ts +3 -0
- package/dist/components/Button/Button.js +74 -0
- package/dist/components/Button/Button.module.scss.js +33 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/types/index.d.ts +24 -0
- package/dist/components/Checkbox/Checkbox.css +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +3 -0
- package/dist/components/Checkbox/Checkbox.js +72 -0
- package/dist/components/Checkbox/Checkbox.module.scss.js +33 -0
- package/dist/components/Checkbox/index.d.ts +2 -0
- package/dist/components/Checkbox/types/index.d.ts +24 -0
- package/dist/components/Confirm/Confirm.d.ts +3 -0
- package/dist/components/Confirm/Confirm.js +85 -0
- package/dist/components/Confirm/index.d.ts +2 -0
- package/dist/components/Confirm/types/index.d.ts +7 -0
- package/dist/components/ContextMenu/ContextMenu.css +1 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +3 -0
- package/dist/components/ContextMenu/ContextMenu.js +39 -0
- package/dist/components/ContextMenu/ContextMenu.module.scss.js +13 -0
- package/dist/components/ContextMenu/index.d.ts +2 -0
- package/dist/components/ContextMenu/types/index.d.ts +12 -0
- package/dist/components/DatePicker/DatePicker.css +1 -0
- package/dist/components/DatePicker/DatePicker.d.ts +4 -0
- package/dist/components/DatePicker/DatePicker.js +198 -0
- package/dist/components/DatePicker/DatePicker.module.scss.js +31 -0
- package/dist/components/DatePicker/index.d.ts +2 -0
- package/dist/components/DatePicker/types/index.d.ts +33 -0
- package/dist/components/DatePickerInput/DatePickerInput.css +1 -0
- package/dist/components/DatePickerInput/DatePickerInput.d.ts +3 -0
- package/dist/components/DatePickerInput/DatePickerInput.js +101 -0
- package/dist/components/DatePickerInput/DatePickerInput.module.scss.js +25 -0
- package/dist/components/DatePickerInput/index.d.ts +2 -0
- package/dist/components/DatePickerInput/types/index.d.ts +32 -0
- package/dist/components/DefaultDropzone/DefaultDropzone.d.ts +3 -0
- package/dist/components/DefaultDropzone/DefaultDropzone.js +11 -0
- package/dist/components/DefaultDropzone/hooks/useDefaultDropzone.d.ts +2 -0
- package/dist/components/DefaultDropzone/hooks/useDefaultDropzone.js +5 -0
- package/dist/components/DefaultDropzone/index.d.ts +2 -0
- package/dist/components/DefaultDropzone/types/index.d.ts +10 -0
- package/dist/components/Dropdown/Dropdown.css +1 -0
- package/dist/components/Dropdown/Dropdown.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.js +68 -0
- package/dist/components/Dropdown/Dropdown.module.scss.js +21 -0
- package/dist/components/Dropdown/index.d.ts +2 -0
- package/dist/components/Dropdown/types/index.d.ts +14 -0
- package/dist/components/EllipsisTextWithTooltip/EllipsisTextWithTooltip.css +1 -0
- package/dist/components/EllipsisTextWithTooltip/EllipsisTextWithTooltip.d.ts +3 -0
- package/dist/components/EllipsisTextWithTooltip/EllipsisTextWithTooltip.js +75 -0
- package/dist/components/EllipsisTextWithTooltip/EllipsisTextWithTooltip.module.scss.js +11 -0
- package/dist/components/EllipsisTextWithTooltip/index.d.ts +2 -0
- package/dist/components/EllipsisTextWithTooltip/types/index.d.ts +13 -0
- package/dist/components/EllipsisTextWithTooltip/utils/index.d.ts +2 -0
- package/dist/components/EllipsisTextWithTooltip/utils/index.js +5 -0
- package/dist/components/Form/Form.css +1 -0
- package/dist/components/Form/Form.d.ts +3 -0
- package/dist/components/Form/Form.js +28 -0
- package/dist/components/Form/Form.module.scss.js +15 -0
- package/dist/components/Form/index.d.ts +2 -0
- package/dist/components/Form/types/index.d.ts +13 -0
- package/dist/components/Icons/Icon.css +1 -0
- package/dist/components/Icons/Icon.d.ts +43 -0
- package/dist/components/Icons/Icon.js +136 -0
- package/dist/components/Icons/Icon.module.scss.js +7 -0
- package/dist/components/Icons/index.d.ts +3 -0
- package/dist/components/Icons/types/index.d.ts +47 -0
- package/dist/components/Icons/types/index.js +4 -0
- package/dist/components/IfcPreview/IfcPreview.css +1 -0
- package/dist/components/IfcPreview/IfcPreview.d.ts +3 -0
- package/dist/components/IfcPreview/IfcPreview.js +104 -0
- package/dist/components/IfcPreview/IfcPreview.module.scss.js +37 -0
- package/dist/components/IfcPreview/components/IfcPreviewCard/IfcPreviewCard.d.ts +14 -0
- package/dist/components/IfcPreview/components/IfcPreviewCard/IfcPreviewCard.js +79 -0
- package/dist/components/IfcPreview/components/IfcPreviewCard/index.d.ts +1 -0
- package/dist/components/IfcPreview/components/IfcPreviewViewerLayer/IfcPreviewViewerLayer.d.ts +18 -0
- package/dist/components/IfcPreview/components/IfcPreviewViewerLayer/IfcPreviewViewerLayer.js +59 -0
- package/dist/components/IfcPreview/components/IfcPreviewViewerLayer/index.d.ts +1 -0
- package/dist/components/IfcPreview/constants/index.d.ts +3 -0
- package/dist/components/IfcPreview/constants/index.js +6 -0
- package/dist/components/IfcPreview/hooks/useIfcPreviewModel.d.ts +20 -0
- package/dist/components/IfcPreview/hooks/useIfcPreviewModel.js +34 -0
- package/dist/components/IfcPreview/hooks/useIfcPreviewViewer.d.ts +30 -0
- package/dist/components/IfcPreview/hooks/useIfcPreviewViewer.js +73 -0
- package/dist/components/IfcPreview/index.d.ts +2 -0
- package/dist/components/IfcPreview/types/index.d.ts +52 -0
- package/dist/components/IfcPreview/utils/file-hellper.d.ts +2 -0
- package/dist/components/IfcPreview/utils/file-hellper.js +7 -0
- package/dist/components/IfcPreview/utils/fileSizeLimit.d.ts +7 -0
- package/dist/components/IfcPreview/utils/fileSizeLimit.js +8 -0
- package/dist/components/IfcPreview/utils/modelSource.d.ts +7 -0
- package/dist/components/IfcPreview/utils/modelSource.js +35 -0
- package/dist/components/IfcViewer/IfcViewer.css +1 -0
- package/dist/components/IfcViewer/IfcViewer.d.ts +3 -0
- package/dist/components/IfcViewer/IfcViewer.js +71 -0
- package/dist/components/IfcViewer/IfcViewer.module.scss.js +13 -0
- package/dist/components/IfcViewer/index.d.ts +2 -0
- package/dist/components/IfcViewer/types/index.d.ts +12 -0
- package/dist/components/IfcViewer/utils/fetchIfc.d.ts +1 -0
- package/dist/components/IfcViewer/utils/fetchIfc.js +9 -0
- package/dist/components/IfcViewer/utils/formatMeshProgress.d.ts +1 -0
- package/dist/components/IfcViewer/utils/formatMeshProgress.js +4 -0
- package/dist/components/IfcViewer/utils/ifcWebViewer.d.ts +14 -0
- package/dist/components/IfcViewer/utils/ifcWebViewer.js +120 -0
- package/dist/components/Input/Input.css +1 -0
- package/dist/components/Input/Input.d.ts +3 -0
- package/dist/components/Input/Input.js +121 -0
- package/dist/components/Input/Input.module.scss.js +33 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/types/index.d.ts +40 -0
- package/dist/components/Label/Label.css +1 -0
- package/dist/components/Label/Label.d.ts +3 -0
- package/dist/components/Label/Label.js +36 -0
- package/dist/components/Label/Label.module.scss.js +9 -0
- package/dist/components/Label/index.d.ts +2 -0
- package/dist/components/Label/types/index.d.ts +9 -0
- package/dist/components/Layer/Layer.css +1 -0
- package/dist/components/Layer/Layer.d.ts +3 -0
- package/dist/components/Layer/Layer.js +26 -0
- package/dist/components/Layer/Layer.module.scss.js +9 -0
- package/dist/components/Layer/index.d.ts +2 -0
- package/dist/components/Layer/types/index.d.ts +7 -0
- package/dist/components/MediaContextProvider/MediaContextProvider.d.ts +3 -0
- package/dist/components/MediaContextProvider/MediaContextProvider.js +25 -0
- package/dist/components/MediaContextProvider/constants/index.d.ts +3 -0
- package/dist/components/MediaContextProvider/constants/index.js +11 -0
- package/dist/components/MediaContextProvider/hooks/index.d.ts +8 -0
- package/dist/components/MediaContextProvider/hooks/index.js +14 -0
- package/dist/components/MediaContextProvider/index.d.ts +4 -0
- package/dist/components/MediaContextProvider/types/index.d.ts +23 -0
- package/dist/components/Modal/Modal.css +1 -0
- package/dist/components/Modal/Modal.d.ts +3 -0
- package/dist/components/Modal/Modal.js +89 -0
- package/dist/components/Modal/Modal.module.scss.js +56 -0
- package/dist/components/Modal/hooks/index.d.ts +17 -0
- package/dist/components/Modal/hooks/index.js +25 -0
- package/dist/components/Modal/index.d.ts +3 -0
- package/dist/components/Modal/types/index.d.ts +24 -0
- package/dist/components/Portal/Potral.d.ts +3 -0
- package/dist/components/Portal/Potral.js +18 -0
- package/dist/components/Portal/index.d.ts +2 -0
- package/dist/components/Portal/types/index.d.ts +5 -0
- package/dist/components/ProgressWrapper/ProgressWrapper.css +1 -0
- package/dist/components/ProgressWrapper/ProgressWrapper.d.ts +3 -0
- package/dist/components/ProgressWrapper/ProgressWrapper.js +50 -0
- package/dist/components/ProgressWrapper/ProgressWrapper.module.scss.js +17 -0
- package/dist/components/ProgressWrapper/constants/index.d.ts +1 -0
- package/dist/components/ProgressWrapper/constants/index.js +4 -0
- package/dist/components/ProgressWrapper/hooks/index.d.ts +5 -0
- package/dist/components/ProgressWrapper/hooks/index.js +41 -0
- package/dist/components/ProgressWrapper/index.d.ts +3 -0
- package/dist/components/ProgressWrapper/types/index.d.ts +17 -0
- package/dist/components/Select/Select.css +1 -0
- package/dist/components/Select/Select.d.ts +3 -0
- package/dist/components/Select/Select.js +195 -0
- package/dist/components/Select/Select.module.scss.js +69 -0
- package/dist/components/Select/constants/index.d.ts +3 -0
- package/dist/components/Select/constants/index.js +5 -0
- package/dist/components/Select/hooks/useSelect.d.ts +28 -0
- package/dist/components/Select/hooks/useSelect.js +73 -0
- package/dist/components/Select/index.d.ts +2 -0
- package/dist/components/Select/types/index.d.ts +50 -0
- package/dist/components/Skeleton/Skeleton.css +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +3 -0
- package/dist/components/Skeleton/Skeleton.js +38 -0
- package/dist/components/Skeleton/Skeleton.module.scss.js +13 -0
- package/dist/components/Skeleton/index.d.ts +2 -0
- package/dist/components/Skeleton/typs/index.d.ts +10 -0
- package/dist/components/Spinner/Spinner.css +1 -0
- package/dist/components/Spinner/Spinner.d.ts +3 -0
- package/dist/components/Spinner/Spinner.js +46 -0
- package/dist/components/Spinner/Spinner.module.scss.js +28 -0
- package/dist/components/Spinner/index.d.ts +2 -0
- package/dist/components/Spinner/types/index.d.ts +9 -0
- package/dist/components/Table/Table.css +1 -0
- package/dist/components/Table/Table.d.ts +2 -0
- package/dist/components/Table/Table.js +219 -0
- package/dist/components/Table/Table.module.scss.js +41 -0
- package/dist/components/Table/hooks/index.d.ts +12 -0
- package/dist/components/Table/hooks/index.js +28 -0
- package/dist/components/Table/index.d.ts +3 -0
- package/dist/components/Table/types/index.d.ts +39 -0
- package/dist/components/Table/utils/index.d.ts +2 -0
- package/dist/components/Table/utils/index.js +5 -0
- package/dist/components/Tabs/Tabs.css +1 -0
- package/dist/components/Tabs/Tabs.d.ts +3 -0
- package/dist/components/Tabs/Tabs.js +73 -0
- package/dist/components/Tabs/Tabs.module.scss.js +26 -0
- package/dist/components/Tabs/index.d.ts +2 -0
- package/dist/components/Tabs/types/index.d.ts +25 -0
- package/dist/components/Text/Text.css +1 -0
- package/dist/components/Text/Text.d.ts +3 -0
- package/dist/components/Text/Text.js +39 -0
- package/dist/components/Text/Text.module.scss.js +17 -0
- package/dist/components/Text/index.d.ts +2 -0
- package/dist/components/Text/types/index.d.ts +15 -0
- package/dist/components/TextWithLabel/TextWithLabel.css +1 -0
- package/dist/components/TextWithLabel/TextWithLabel.d.ts +3 -0
- package/dist/components/TextWithLabel/TextWithLabel.js +39 -0
- package/dist/components/TextWithLabel/TextWithLabel.module.scss.js +9 -0
- package/dist/components/TextWithLabel/index.d.ts +2 -0
- package/dist/components/TextWithLabel/types/index.d.ts +6 -0
- package/dist/components/Textarea/Textarea.css +1 -0
- package/dist/components/Textarea/Textarea.d.ts +3 -0
- package/dist/components/Textarea/Textarea.js +132 -0
- package/dist/components/Textarea/Textarea.module.scss.js +35 -0
- package/dist/components/Textarea/index.d.ts +2 -0
- package/dist/components/Textarea/types/index.d.ts +45 -0
- package/dist/components/Tooltip/Tooltip.css +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +4 -0
- package/dist/components/Tooltip/Tooltip.js +191 -0
- package/dist/components/Tooltip/Tooltip.module.scss.js +13 -0
- package/dist/components/Tooltip/index.d.ts +3 -0
- package/dist/components/Tooltip/types/index.d.ts +36 -0
- package/dist/components/Tooltip/types/index.js +4 -0
- package/dist/components/UploadFiles/UploadFiles.css +1 -0
- package/dist/components/UploadFiles/UploadFiles.d.ts +3 -0
- package/dist/components/UploadFiles/UploadFiles.js +238 -0
- package/dist/components/UploadFiles/UploadFiles.module.scss.js +73 -0
- package/dist/components/UploadFiles/index.d.ts +2 -0
- package/dist/components/UploadFiles/types/index.d.ts +33 -0
- package/dist/components/UploadFiles/utils/index.d.ts +12 -0
- package/dist/components/UploadFiles/utils/index.js +67 -0
- package/dist/components/ViewImageModal/ViewImageModal.css +1 -0
- package/dist/components/ViewImageModal/ViewImageModal.d.ts +3 -0
- package/dist/components/ViewImageModal/ViewImageModal.js +71 -0
- package/dist/components/ViewImageModal/ViewImageModal.module.scss.js +19 -0
- package/dist/components/ViewImageModal/index.d.ts +2 -0
- package/dist/components/ViewImageModal/types/index.d.ts +13 -0
- package/dist/components-assets/IfcPreview/web-ifc/web-ifc.wasm +0 -0
- package/dist/hooks/useClickOutside.d.ts +14 -0
- package/dist/hooks/useClickOutside.js +15 -0
- package/dist/images/add_file.svg.js +5 -0
- package/dist/images/add_user.svg.js +5 -0
- package/dist/images/arrow-bottom.svg.js +5 -0
- package/dist/images/calendar.svg.js +5 -0
- package/dist/images/check.svg.js +5 -0
- package/dist/images/chevron_down.svg.js +5 -0
- package/dist/images/close.svg.js +5 -0
- package/dist/images/copy.svg.js +5 -0
- package/dist/images/dots.svg.js +5 -0
- package/dist/images/download.svg.js +5 -0
- package/dist/images/edit.svg.js +5 -0
- package/dist/images/eye.svg.js +5 -0
- package/dist/images/file.svg.js +5 -0
- package/dist/images/file_not_filled.svg.js +5 -0
- package/dist/images/filter.svg.js +5 -0
- package/dist/images/folder.svg.js +5 -0
- package/dist/images/history_clock.svg.js +5 -0
- package/dist/images/info.svg.js +5 -0
- package/dist/images/info_error.svg.js +5 -0
- package/dist/images/layers-three.svg.js +5 -0
- package/dist/images/link-angled.svg.js +5 -0
- package/dist/images/logout.svg.js +5 -0
- package/dist/images/minus.svg.js +5 -0
- package/dist/images/pause-circle.svg.js +5 -0
- package/dist/images/play-circle.svg.js +5 -0
- package/dist/images/plus.svg.js +5 -0
- package/dist/images/plus_circle.svg.js +5 -0
- package/dist/images/plus_square.svg.js +5 -0
- package/dist/images/refresh.svg.js +5 -0
- package/dist/images/save.svg.js +5 -0
- package/dist/images/search.svg.js +5 -0
- package/dist/images/select_chevron_down.svg.js +5 -0
- package/dist/images/terminal_square.svg.js +5 -0
- package/dist/images/trash.svg.js +5 -0
- package/dist/images/update.svg.js +5 -0
- package/dist/images/upload-top.svg.js +5 -0
- package/dist/images/upload.svg.js +5 -0
- package/dist/images/user-right.svg.js +5 -0
- package/dist/images/warning_color.svg.js +5 -0
- package/dist/styles/tokens.css +250 -0
- package/dist/test-stpr-ui-kit.d.ts +36 -0
- package/dist/test-stpr-ui-kit.js +43 -15043
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/sleep.d.ts +1 -0
- package/dist/utils/stringHelper.d.ts +13 -0
- package/dist/utils/stringHelper.js +4 -0
- package/package.json +34 -30
- package/dist/images/icon.svg +0 -8
- package/dist/images/viewImageExample.jpg +0 -0
- package/dist/test-stpr-ui-kit.css +0 -1
- package/dist/test-stpr-ui-kit.es.d.ts +0 -829
- package/dist/test-stpr-ui-kit.umd.cjs +0 -9
- /package/dist/{images → components-assets/ViewImageModal}/fallBackSrc.jpeg +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useState as F, useRef as c, useEffect as L } from "react";
|
|
2
|
+
import { DEFAULT_DURATION as C } from "../constants/index.js";
|
|
3
|
+
const D = 500;
|
|
4
|
+
function S(n) {
|
|
5
|
+
return n < 0.5 ? 4 * n * n * n : 1 - Math.pow(-2 * n + 2, 3) / 2;
|
|
6
|
+
}
|
|
7
|
+
const w = (n) => {
|
|
8
|
+
const { targetValue: r, duration: s = C, doneValue: u, onSuccessLoaded: f } = n, [o, m] = F(r), [M, l] = F(r !== u), e = c(), a = c(r), d = c(0), p = c(r), v = c(o), t = c(), i = c(!1);
|
|
9
|
+
return v.current = o, L(() => {
|
|
10
|
+
if (p.current = r, r === a.current)
|
|
11
|
+
return;
|
|
12
|
+
if (e.current && (cancelAnimationFrame(e.current), e.current = void 0), r === u && a.current === u) {
|
|
13
|
+
m(u);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
a.current = v.current, d.current = performance.now();
|
|
17
|
+
const R = (h) => {
|
|
18
|
+
const T = d.current;
|
|
19
|
+
if (T === void 0) return;
|
|
20
|
+
const E = h - T, V = Math.min(E / s, 1), I = S(V), A = a.current, g = p.current, O = Math.max(0, Math.floor(A + (g - A) * I));
|
|
21
|
+
m(O), V < 1 ? e.current = requestAnimationFrame(R) : (a.current = g, e.current = void 0);
|
|
22
|
+
};
|
|
23
|
+
return e.current = requestAnimationFrame(R), () => {
|
|
24
|
+
e.current && (cancelAnimationFrame(e.current), e.current = void 0);
|
|
25
|
+
};
|
|
26
|
+
}, [r, s, u]), L(() => {
|
|
27
|
+
if (o === u)
|
|
28
|
+
return i.current ? void 0 : (t.current = setTimeout(() => {
|
|
29
|
+
t.current = void 0, i.current = !0, f?.(), l(!1);
|
|
30
|
+
}, D), () => {
|
|
31
|
+
t.current && (clearTimeout(t.current), t.current = void 0);
|
|
32
|
+
});
|
|
33
|
+
i.current = !1, t.current && (clearTimeout(t.current), t.current = void 0), l(!0);
|
|
34
|
+
}, [o, u, f]), {
|
|
35
|
+
animatedValue: o,
|
|
36
|
+
isLoading: M
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
w as useAnimatedValue
|
|
41
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
export type TProgressWrapperAnimationVariant = "pulse" | "backgroundProgress";
|
|
3
|
+
export interface ProgressWrapperProps extends PropsWithChildren {
|
|
4
|
+
value: number;
|
|
5
|
+
classNameRoot?: string;
|
|
6
|
+
classNameProgressBadgeRoot?: string;
|
|
7
|
+
duration?: number;
|
|
8
|
+
doneValue?: number;
|
|
9
|
+
animationVariant?: TProgressWrapperAnimationVariant;
|
|
10
|
+
onSuccessLoaded?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export type TUseAnimatedValueProps = {
|
|
13
|
+
targetValue: number;
|
|
14
|
+
doneValue: number;
|
|
15
|
+
duration?: number;
|
|
16
|
+
onSuccessLoaded?: () => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._spSelect_c8o64_1{display:inline-flex;flex-direction:column;width:100%}._spSelect_c8o64_1{opacity:1;visibility:visible}._spSelect_c8o64_1{transition:all .3s ease-in-out}@starting-style{._spSelect_c8o64_1{opacity:0;visibility:hidden}}._spSelect_size-md_c8o64_19{--spui-select-control-font-size: 16px;--spui-select-error-font-size: 12px;--spui-select-control-height: var(--spui-control-height-md);--spui-select-control-icon-size: var(--spui-icon-size-sm);--spui-select-control-padding-right: var(--spui-spacing-10x)}._spSelect_size-xl_c8o64_26{--spui-select-control-font-size: 18px;--spui-select-error-font-size: 14px;--spui-select-control-height: var(--spui-control-height-xl);--spui-select-control-icon-size: var(--spui-icon-size-base);--spui-select-control-padding-right: var(--spui-spacing-12x)}._spSelect_error_c8o64_33 ._spSelect__control_c8o64_33{border-color:var(--spui-color-border-error);color:var(--spui-color-text-error)}._spSelect_error_c8o64_33 ._spSelect__control_c8o64_33:hover ._spSelect__value_empty_c8o64_37{color:var(--spui-color-text-secondary)}._spSelect_error_c8o64_33 ._spSelect__control_c8o64_33:hover ._spSelect__icon_c8o64_40{color:var(--spui-color-icon-disabled)}._spSelect_absolutePositionError_c8o64_43,._spSelect__container_c8o64_46{position:relative}._spSelect__control_c8o64_33{cursor:pointer;display:flex;height:var(--spui-select-control-height);padding:var(--spui-spacing-none) var(--spui-select-control-padding-right) var(--spui-spacing-none) var(--spui-spacing-4x);align-items:center;align-self:stretch;width:100%;border-width:2px;border-style:solid}._spSelect__control_filled_c8o64_60{border-color:var(--spui-color-border-secondary);background-color:var(--spui-color-surface-page)}._spSelect__control_outlined_c8o64_64{background-color:var(--spui-color-surface-transparent);border-color:var(--spui-color-border-primary)}._spSelect__control_c8o64_33::placeholder{color:var(--spui-color-text-secondary)}._spSelect__control_c8o64_33:hover ._spSelect__value_empty_c8o64_37{color:var(--spui-color-text-primary)}._spSelect__control_c8o64_33:hover ._spSelect__icon_c8o64_40{color:var(--spui-color-icon-primary)}._spSelect__control_open_c8o64_77,._spSelect__control_c8o64_33:focus,._spSelect__control_c8o64_33:focus-visible{outline:none;border-style:solid;border-color:var(--spui-color-border-action);background-color:var(--spui-color-surface-transparent)}._spSelect__control_disabled_c8o64_83{cursor:default;color:var(--spui-color-text-disabled);pointer-events:none}._spSelect__control_disabled_c8o64_83:hover ._spSelect__value_empty_c8o64_37{color:var(--spui-color-text-disabled)}._spSelect__control_disabled_c8o64_83:hover ._spSelect__icon_c8o64_40{color:var(--spui-color-icon-disabled);cursor:default}._spSelect__value_c8o64_37{font-family:var(--spui-font-family-main),serif;font-weight:var(--spui-font-weight-regular);font-size:var(--spui-select-control-font-size);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;width:100%}._spSelect__value_empty_c8o64_37{color:var(--spui-color-text-secondary)}._spSelect__icon_c8o64_40{z-index:10;color:var(--spui-color-icon-disabled);cursor:pointer;position:absolute;right:var(--spui-spacing-4x);width:var(--spui-select-control-icon-size);height:var(--spui-select-control-icon-size);top:0;bottom:0;margin:auto}._spSelect__listWrapper_c8o64_119{position:absolute;width:100%;display:flex;flex-direction:column;background-color:var(--spui-color-surface-default);border-radius:var(--spui-border-radius-sm);box-shadow:1px 1px 26px 0 var(--spui-color-gray-300);z-index:15}._spSelect__listWrapper_size-md_c8o64_129{--spui-select-control-font-size: 16px;--empty-options-font-size: 12px;--spui-select-control-icon-size: var(--spui-icon-size-sm);--spui-select-control-padding-right: var(--spui-spacing-10x)}._spSelect__listWrapper_size-xl_c8o64_135{--spui-select-control-font-size: 18px;--empty-options-font-size: 14px;--spui-select-control-icon-size: var(--spui-icon-size-base);--spui-select-control-padding-right: var(--spui-spacing-12x)}._spSelect__listWrapper_placementBottom_c8o64_141{animation:_selectListOpenFromBottom_c8o64_1 .2s ease-out forwards}._spSelect__listWrapper_placementTop_c8o64_144{flex-direction:column-reverse;animation:_selectListOpenFromTop_c8o64_1 .2s ease-out forwards}._spSelect__list_c8o64_119{font-family:var(--spui-font-family-main),serif;font-weight:var(--spui-font-weight-regular);width:100%;background-color:var(--spui-color-surface-default)}._spSelect__list_scrollable_c8o64_154{overflow-y:auto}._spSelect__list_withSearch_c8o64_157{padding-top:var(--spui-spacing-none)}._spSelect__list_c8o64_119::-webkit-scrollbar{width:var(--spui-scrollbar-width);height:var(--spui-scrollbar-width)}._spSelect__list_c8o64_119::-webkit-scrollbar-track{background:var(--spui-color-surface-transparent)}._spSelect__list_c8o64_119::-webkit-scrollbar-thumb{background:var(--color-aqua-blue)}._spSelect__list_c8o64_119::-webkit-scrollbar-thumb:hover{background:var(--color-accent-blue)}._spSelect__emptyOptions_c8o64_173{font-style:italic;color:var(--spui-color-text-secondary);font-size:var(--empty-options-font-size);padding:var(--spui-spacing-3x) var(--spui-select-control-padding-right) var(--spui-spacing-3x) var(--spui-spacing-4x)}._spSelect__option_c8o64_179{cursor:pointer;position:relative;white-space:pre-line;color:var(--spui-color-text-primary);font-size:var(--spui-select-control-font-size);padding:var(--spui-spacing-3x) var(--spui-select-control-padding-right) var(--spui-spacing-3x) var(--spui-spacing-4x)}._spSelect__option_c8o64_179:hover{background-color:var(--spui-color-surface-page)}._spSelect__label_c8o64_190{margin-bottom:var(--spui-spacing-2x)}._spSelect__error_c8o64_193{padding-top:var(--spui-spacing-2x);font-family:var(--spui-font-family-main),serif;font-weight:var(--spui-font-weight-regular);font-size:var(--spui-select-error-font-size);color:var(--spui-color-text-error)}._spSelect__error_absolutePosition_c8o64_200{position:absolute;top:100%}._spSelect__search_c8o64_204{position:relative;padding:8px 16px;border-bottom:var(--spui-border-width-sm) solid var(--spui-color-border-secondary);background-color:var(--spui-color-surface-default)}._spSelect__search_atBottom_c8o64_210{border-bottom:none;border-top:var(--spui-border-width-sm) solid var(--spui-color-border-secondary)}._spSelect__searchInput_c8o64_214{width:100%;outline:none;font-family:var(--spui-font-family-main),serif;font-size:14px;padding:8px 30px;border:1px solid var(--spui-color-border-primary);border-radius:4px;box-sizing:border-box}._spSelect__searchInput_c8o64_214:focus{border-color:var(--spui-color-border-action)}._spSelect__searchInput_c8o64_214::placeholder{color:var(--spui-color-text-secondary)}._spSelect__searchIcon_c8o64_230{position:absolute;left:24px;top:50%;transform:translateY(-50%);color:var(--spui-color-icon-disabled);width:16px;height:16px}._spSelect__searchClearIcon_c8o64_239{position:absolute;right:24px;top:50%;transform:translateY(-50%);color:var(--spui-color-icon-disabled);cursor:pointer;width:16px;height:16px}._spSelect__searchClearIcon_c8o64_239:hover{color:var(--spui-color-icon-primary)}@keyframes _selectListOpenFromBottom_c8o64_1{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}@keyframes _selectListOpenFromTop_c8o64_1{0%{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { jsxs as a, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import s from "clsx";
|
|
3
|
+
import { MAX_HEIGHT_SELECT_LIST as re } from "./constants/index.js";
|
|
4
|
+
import { useSelect as oe } from "./hooks/useSelect.js";
|
|
5
|
+
import e from "./Select.module.scss.js";
|
|
6
|
+
import { Label as ce } from "../Label/Label.js";
|
|
7
|
+
import { Icon as c } from "../Icons/Icon.js";
|
|
8
|
+
import { EIconName as n } from "../Icons/types/index.js";
|
|
9
|
+
import { Portal as ne } from "../Portal/Potral.js";
|
|
10
|
+
const fe = (I) => {
|
|
11
|
+
const {
|
|
12
|
+
options: L = [],
|
|
13
|
+
size: r = "xl",
|
|
14
|
+
placeholder: g = "Выберите из списка...",
|
|
15
|
+
value: o,
|
|
16
|
+
name: d,
|
|
17
|
+
variant: h = "outlined",
|
|
18
|
+
onChange: R,
|
|
19
|
+
onBlur: B,
|
|
20
|
+
onMouseEnter: k,
|
|
21
|
+
error: i,
|
|
22
|
+
label: u,
|
|
23
|
+
infoTooltipText: P,
|
|
24
|
+
tooltipPosition: W,
|
|
25
|
+
disabled: p = !1,
|
|
26
|
+
required: O,
|
|
27
|
+
maxHeightList: H = re,
|
|
28
|
+
isVisibleDefaultTitle: $ = !0,
|
|
29
|
+
isScrollableList: N = !1,
|
|
30
|
+
isAbsolutePositionError: f = !1,
|
|
31
|
+
isSearchable: v = !1,
|
|
32
|
+
searchPlaceholder: z = "Поиск...",
|
|
33
|
+
classNameRoot: b,
|
|
34
|
+
classNameError: C,
|
|
35
|
+
classNameLabel: T,
|
|
36
|
+
classNameBaseTooltipRoot: j
|
|
37
|
+
} = I, {
|
|
38
|
+
isOpen: m,
|
|
39
|
+
searchQuery: _,
|
|
40
|
+
listStyle: S,
|
|
41
|
+
refControl: A,
|
|
42
|
+
refListWrapper: D,
|
|
43
|
+
searchInputRef: M,
|
|
44
|
+
selectedOption: x,
|
|
45
|
+
filteredOptions: y,
|
|
46
|
+
listWrapperStyle: Q,
|
|
47
|
+
handleSelect: V,
|
|
48
|
+
handleToggle: q,
|
|
49
|
+
handleSearchChange: w,
|
|
50
|
+
handleSearchClick: F,
|
|
51
|
+
setSearchQuery: G
|
|
52
|
+
} = oe({
|
|
53
|
+
options: L,
|
|
54
|
+
value: o,
|
|
55
|
+
name: d,
|
|
56
|
+
disabled: p,
|
|
57
|
+
isSearchable: v,
|
|
58
|
+
onChange: R,
|
|
59
|
+
onBlur: B
|
|
60
|
+
}), X = s({
|
|
61
|
+
[e.spSelect]: !0,
|
|
62
|
+
[e[`spSelect_size-${r}`]]: r,
|
|
63
|
+
[e.spSelect_error]: !!i,
|
|
64
|
+
[e.spSelect_absolutePositionError]: f,
|
|
65
|
+
...b && { [b]: !0 }
|
|
66
|
+
}), J = s({
|
|
67
|
+
[e.spSelect__container]: !0
|
|
68
|
+
}), K = s({
|
|
69
|
+
[e.spSelect__control]: !0,
|
|
70
|
+
[e.spSelect__control_open]: m,
|
|
71
|
+
[e[`spSelect__control_${h}`]]: h,
|
|
72
|
+
[e.spSelect__control_disabled]: p
|
|
73
|
+
}), U = s({
|
|
74
|
+
[e.spSelect__value]: !0,
|
|
75
|
+
[e.spSelect__value_empty]: !x
|
|
76
|
+
}), E = s({
|
|
77
|
+
[e.spSelect__icon]: !0
|
|
78
|
+
}), Y = s({
|
|
79
|
+
[e.spSelect__list]: !0,
|
|
80
|
+
[e.spSelect__list_scrollable]: N
|
|
81
|
+
}), Z = e.spSelect__search, ee = s({
|
|
82
|
+
[e.spSelect__label]: !0,
|
|
83
|
+
...T && { [T]: !0 }
|
|
84
|
+
}), le = s({
|
|
85
|
+
[e.spSelect__error]: !0,
|
|
86
|
+
[e.spSelect__error_absolutePosition]: f,
|
|
87
|
+
...C && { [C]: !0 }
|
|
88
|
+
}), se = (t) => v ? /* @__PURE__ */ a(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
className: s(Z, t && e.spSelect__search_atBottom),
|
|
92
|
+
onClick: F,
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ l(c, { name: n.Search, className: e.spSelect__searchIcon }),
|
|
95
|
+
/* @__PURE__ */ l(
|
|
96
|
+
"input",
|
|
97
|
+
{
|
|
98
|
+
ref: M,
|
|
99
|
+
type: "text",
|
|
100
|
+
placeholder: z,
|
|
101
|
+
value: _,
|
|
102
|
+
onChange: w,
|
|
103
|
+
className: e.spSelect__searchInput
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
_ && /* @__PURE__ */ l(
|
|
107
|
+
c,
|
|
108
|
+
{
|
|
109
|
+
name: n.Trash,
|
|
110
|
+
className: e.spSelect__searchClearIcon,
|
|
111
|
+
onClick: () => G("")
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
) : null;
|
|
117
|
+
return /* @__PURE__ */ a("div", { className: X, children: [
|
|
118
|
+
u && /* @__PURE__ */ l(
|
|
119
|
+
ce,
|
|
120
|
+
{
|
|
121
|
+
classNameRoot: ee,
|
|
122
|
+
tooltipPosition: W,
|
|
123
|
+
required: O,
|
|
124
|
+
label: u,
|
|
125
|
+
infoTooltipText: P,
|
|
126
|
+
classNameBaseTooltipRoot: j
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
/* @__PURE__ */ a("div", { className: J, onMouseEnter: k, children: [
|
|
130
|
+
/* @__PURE__ */ a(
|
|
131
|
+
"div",
|
|
132
|
+
{
|
|
133
|
+
ref: A,
|
|
134
|
+
tabIndex: p ? -1 : 0,
|
|
135
|
+
title: $ && o ? String(o) : void 0,
|
|
136
|
+
className: K,
|
|
137
|
+
onClick: q,
|
|
138
|
+
children: [
|
|
139
|
+
/* @__PURE__ */ l("div", { className: U, children: x?.label || g }),
|
|
140
|
+
/* @__PURE__ */ l(
|
|
141
|
+
c,
|
|
142
|
+
{
|
|
143
|
+
name: n.SelectChevronDown,
|
|
144
|
+
rotate: m ? 180 : void 0,
|
|
145
|
+
className: E
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
m && /* @__PURE__ */ l(ne, { node: document.body, children: /* @__PURE__ */ a(
|
|
152
|
+
"div",
|
|
153
|
+
{
|
|
154
|
+
ref: D,
|
|
155
|
+
className: s(
|
|
156
|
+
e.spSelect__listWrapper,
|
|
157
|
+
r && [e[`spSelect__listWrapper_size-${r}`]],
|
|
158
|
+
S?.placement === "bottom" && e.spSelect__listWrapper_placementBottom,
|
|
159
|
+
S?.placement === "top" && e.spSelect__listWrapper_placementTop
|
|
160
|
+
),
|
|
161
|
+
style: Q,
|
|
162
|
+
children: [
|
|
163
|
+
se(S?.placement === "top"),
|
|
164
|
+
/* @__PURE__ */ l(
|
|
165
|
+
"div",
|
|
166
|
+
{
|
|
167
|
+
className: Y,
|
|
168
|
+
style: N ? { maxHeight: `${H}px` } : {},
|
|
169
|
+
children: y.length > 0 ? y.map((t) => {
|
|
170
|
+
const te = t.value === o;
|
|
171
|
+
return /* @__PURE__ */ a(
|
|
172
|
+
"div",
|
|
173
|
+
{
|
|
174
|
+
className: e.spSelect__option,
|
|
175
|
+
onClick: (ae) => V(ae, { value: t.value, name: d }),
|
|
176
|
+
children: [
|
|
177
|
+
t.label,
|
|
178
|
+
te && /* @__PURE__ */ l(c, { name: n.Check, className: E })
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
t.value
|
|
182
|
+
);
|
|
183
|
+
}) : /* @__PURE__ */ l("div", { className: e.spSelect__emptyOptions, children: _ ? "Ничего не найдено" : "Нет доступных вариантов выбора..." })
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
) })
|
|
189
|
+
] }),
|
|
190
|
+
i && /* @__PURE__ */ l("div", { className: le, children: i })
|
|
191
|
+
] });
|
|
192
|
+
};
|
|
193
|
+
export {
|
|
194
|
+
fe as Select
|
|
195
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import './Select.css';const e = "_spSelect_c8o64_1", _ = "_spSelect_error_c8o64_33", t = "_spSelect__control_c8o64_33", c = "_spSelect__value_empty_c8o64_37", s = "_spSelect__icon_c8o64_40", l = "_spSelect_absolutePositionError_c8o64_43", o = "_spSelect__container_c8o64_46", p = "_spSelect__control_filled_c8o64_60", r = "_spSelect__control_outlined_c8o64_64", S = "_spSelect__control_open_c8o64_77", n = "_spSelect__control_disabled_c8o64_83", i = "_spSelect__value_c8o64_37", a = "_spSelect__listWrapper_c8o64_119", m = "_spSelect__listWrapper_placementBottom_c8o64_141", h = "_selectListOpenFromBottom_c8o64_1", u = "_spSelect__listWrapper_placementTop_c8o64_144", d = "_selectListOpenFromTop_c8o64_1", b = "_spSelect__list_c8o64_119", W = "_spSelect__list_scrollable_c8o64_154", B = "_spSelect__list_withSearch_c8o64_157", I = "_spSelect__emptyOptions_c8o64_173", O = "_spSelect__option_c8o64_179", z = "_spSelect__label_c8o64_190", y = "_spSelect__error_c8o64_193", v = "_spSelect__error_absolutePosition_c8o64_200", F = "_spSelect__search_c8o64_204", L = "_spSelect__search_atBottom_c8o64_210", P = "_spSelect__searchInput_c8o64_214", T = "_spSelect__searchIcon_c8o64_230", x = "_spSelect__searchClearIcon_c8o64_239", f = {
|
|
2
|
+
spSelect: e,
|
|
3
|
+
"spSelect_size-md": "_spSelect_size-md_c8o64_19",
|
|
4
|
+
"spSelect_size-xl": "_spSelect_size-xl_c8o64_26",
|
|
5
|
+
spSelect_error: _,
|
|
6
|
+
spSelect__control: t,
|
|
7
|
+
spSelect__value_empty: c,
|
|
8
|
+
spSelect__icon: s,
|
|
9
|
+
spSelect_absolutePositionError: l,
|
|
10
|
+
spSelect__container: o,
|
|
11
|
+
spSelect__control_filled: p,
|
|
12
|
+
spSelect__control_outlined: r,
|
|
13
|
+
spSelect__control_open: S,
|
|
14
|
+
spSelect__control_disabled: n,
|
|
15
|
+
spSelect__value: i,
|
|
16
|
+
spSelect__listWrapper: a,
|
|
17
|
+
"spSelect__listWrapper_size-md": "_spSelect__listWrapper_size-md_c8o64_129",
|
|
18
|
+
"spSelect__listWrapper_size-xl": "_spSelect__listWrapper_size-xl_c8o64_135",
|
|
19
|
+
spSelect__listWrapper_placementBottom: m,
|
|
20
|
+
selectListOpenFromBottom: h,
|
|
21
|
+
spSelect__listWrapper_placementTop: u,
|
|
22
|
+
selectListOpenFromTop: d,
|
|
23
|
+
spSelect__list: b,
|
|
24
|
+
spSelect__list_scrollable: W,
|
|
25
|
+
spSelect__list_withSearch: B,
|
|
26
|
+
spSelect__emptyOptions: I,
|
|
27
|
+
spSelect__option: O,
|
|
28
|
+
spSelect__label: z,
|
|
29
|
+
spSelect__error: y,
|
|
30
|
+
spSelect__error_absolutePosition: v,
|
|
31
|
+
spSelect__search: F,
|
|
32
|
+
spSelect__search_atBottom: L,
|
|
33
|
+
spSelect__searchInput: P,
|
|
34
|
+
spSelect__searchIcon: T,
|
|
35
|
+
spSelect__searchClearIcon: x
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
f as default,
|
|
39
|
+
h as selectListOpenFromBottom,
|
|
40
|
+
d as selectListOpenFromTop,
|
|
41
|
+
e as spSelect,
|
|
42
|
+
o as spSelect__container,
|
|
43
|
+
t as spSelect__control,
|
|
44
|
+
n as spSelect__control_disabled,
|
|
45
|
+
p as spSelect__control_filled,
|
|
46
|
+
S as spSelect__control_open,
|
|
47
|
+
r as spSelect__control_outlined,
|
|
48
|
+
I as spSelect__emptyOptions,
|
|
49
|
+
y as spSelect__error,
|
|
50
|
+
v as spSelect__error_absolutePosition,
|
|
51
|
+
s as spSelect__icon,
|
|
52
|
+
z as spSelect__label,
|
|
53
|
+
b as spSelect__list,
|
|
54
|
+
a as spSelect__listWrapper,
|
|
55
|
+
m as spSelect__listWrapper_placementBottom,
|
|
56
|
+
u as spSelect__listWrapper_placementTop,
|
|
57
|
+
W as spSelect__list_scrollable,
|
|
58
|
+
B as spSelect__list_withSearch,
|
|
59
|
+
O as spSelect__option,
|
|
60
|
+
F as spSelect__search,
|
|
61
|
+
x as spSelect__searchClearIcon,
|
|
62
|
+
T as spSelect__searchIcon,
|
|
63
|
+
P as spSelect__searchInput,
|
|
64
|
+
L as spSelect__search_atBottom,
|
|
65
|
+
i as spSelect__value,
|
|
66
|
+
c as spSelect__value_empty,
|
|
67
|
+
l as spSelect_absolutePositionError,
|
|
68
|
+
_ as spSelect_error
|
|
69
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TOnBlurSelect, TOnChangeSelect, TSelectListStyle, TSelectOption } from "../types";
|
|
3
|
+
export type TUseSelectParams = {
|
|
4
|
+
options: TSelectOption[];
|
|
5
|
+
value?: string | null | number;
|
|
6
|
+
name: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
isSearchable?: boolean;
|
|
9
|
+
onChange?: TOnChangeSelect;
|
|
10
|
+
onBlur?: TOnBlurSelect;
|
|
11
|
+
};
|
|
12
|
+
export type TUseSelectReturn = {
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
searchQuery: string;
|
|
15
|
+
listStyle: TSelectListStyle;
|
|
16
|
+
refControl: React.RefObject<HTMLDivElement>;
|
|
17
|
+
refListWrapper: React.RefObject<HTMLDivElement>;
|
|
18
|
+
searchInputRef: React.RefObject<HTMLInputElement>;
|
|
19
|
+
selectedOption: TSelectOption | undefined;
|
|
20
|
+
filteredOptions: TSelectOption[];
|
|
21
|
+
listWrapperStyle: React.CSSProperties;
|
|
22
|
+
handleSelect: TOnChangeSelect;
|
|
23
|
+
handleToggle: () => void;
|
|
24
|
+
handleSearchChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
25
|
+
handleSearchClick: (event: React.MouseEvent) => void;
|
|
26
|
+
setSearchQuery: React.Dispatch<React.SetStateAction<string>>;
|
|
27
|
+
};
|
|
28
|
+
export declare function useSelect(params: TUseSelectParams): TUseSelectReturn;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useState as C, useRef as L, useCallback as i, useLayoutEffect as F, useEffect as f } from "react";
|
|
2
|
+
import { useClickOutside as Q } from "../../../hooks/useClickOutside.js";
|
|
3
|
+
import { SELECT_DROPDOWN_GAP as _ } from "../constants/index.js";
|
|
4
|
+
function N(R) {
|
|
5
|
+
const { options: d, value: B, name: p, disabled: S = !1, isSearchable: h = !1, onChange: b, onBlur: E } = R, [t, m] = C(!1), [l, s] = C(""), [o, y] = C(null), c = L(null), a = L(null), w = L(null), r = i(() => {
|
|
6
|
+
if (!c.current || !a.current) return;
|
|
7
|
+
const e = c.current.getBoundingClientRect(), n = a.current.getBoundingClientRect(), u = _, W = e.bottom + n.height + u <= window.innerHeight, D = e.top - n.height - u >= 0;
|
|
8
|
+
let g, v;
|
|
9
|
+
!W && D ? (v = "top", g = e.top - n.height - u) : (v = "bottom", g = e.bottom + u), y({
|
|
10
|
+
top: g,
|
|
11
|
+
left: e.left,
|
|
12
|
+
width: e.width,
|
|
13
|
+
placement: v
|
|
14
|
+
});
|
|
15
|
+
}, []);
|
|
16
|
+
F(() => {
|
|
17
|
+
if (!t) {
|
|
18
|
+
y(null);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
r();
|
|
22
|
+
}, [t, r]), f(() => {
|
|
23
|
+
if (!t) return;
|
|
24
|
+
const e = requestAnimationFrame(() => r()), n = () => r();
|
|
25
|
+
return window.addEventListener("resize", n), window.addEventListener("scroll", n, !0), () => {
|
|
26
|
+
cancelAnimationFrame(e), window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
27
|
+
};
|
|
28
|
+
}, [t, r]), f(() => {
|
|
29
|
+
!t || o?.placement !== "top" || r();
|
|
30
|
+
}, [t, l, o?.placement, r]), Q([c, a], () => m(!1), t), f(() => {
|
|
31
|
+
if (t && h && w.current) {
|
|
32
|
+
const e = setTimeout(() => w.current?.focus(), 0);
|
|
33
|
+
return () => clearTimeout(e);
|
|
34
|
+
}
|
|
35
|
+
}, [t, h]), f(() => {
|
|
36
|
+
t || s("");
|
|
37
|
+
}, [t]);
|
|
38
|
+
const A = d.find((e) => e.value === B), I = h && l ? d.filter((e) => e.label.toLowerCase().includes(l.toLowerCase())) : d, O = i((e) => E?.(e), [E]), P = i(
|
|
39
|
+
(e, n) => {
|
|
40
|
+
b?.(e, { value: n.value, name: p }), m(!1), s(""), O({ value: n.value, name: p });
|
|
41
|
+
},
|
|
42
|
+
[b, p, O]
|
|
43
|
+
), T = i(() => {
|
|
44
|
+
S || (m((e) => !e), s(""));
|
|
45
|
+
}, [S]), k = i((e) => {
|
|
46
|
+
s(e.target.value);
|
|
47
|
+
}, []), x = i((e) => {
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
}, []), z = {
|
|
50
|
+
position: "fixed",
|
|
51
|
+
zIndex: 1e3,
|
|
52
|
+
...o ? { top: o.top, left: o.left, width: o.width } : { top: -9999, left: 0, width: 100, visibility: "hidden" }
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
isOpen: t,
|
|
56
|
+
searchQuery: l,
|
|
57
|
+
listStyle: o,
|
|
58
|
+
refControl: c,
|
|
59
|
+
refListWrapper: a,
|
|
60
|
+
searchInputRef: w,
|
|
61
|
+
selectedOption: A,
|
|
62
|
+
filteredOptions: I,
|
|
63
|
+
listWrapperStyle: z,
|
|
64
|
+
handleSelect: P,
|
|
65
|
+
handleToggle: T,
|
|
66
|
+
handleSearchChange: k,
|
|
67
|
+
handleSearchClick: x,
|
|
68
|
+
setSearchQuery: s
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
N as useSelect
|
|
73
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ETooltipPosition } from "../../Tooltip";
|
|
3
|
+
export type TSelectOption = {
|
|
4
|
+
value: string | null | number;
|
|
5
|
+
label: string;
|
|
6
|
+
key?: string;
|
|
7
|
+
};
|
|
8
|
+
export type TSelectVariant = "outlined" | "filled";
|
|
9
|
+
export type TSelectSize = "md" | "xl";
|
|
10
|
+
export interface ISelectProps {
|
|
11
|
+
options: TSelectOption[];
|
|
12
|
+
isAbsolutePositionError?: boolean;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
variant?: TSelectVariant;
|
|
15
|
+
value?: string | null | number;
|
|
16
|
+
name: string;
|
|
17
|
+
onChange?: TOnChangeSelect;
|
|
18
|
+
onBlur?: TOnBlurSelect;
|
|
19
|
+
onMouseEnter?: () => void;
|
|
20
|
+
error?: string;
|
|
21
|
+
label?: string;
|
|
22
|
+
infoTooltipText?: string;
|
|
23
|
+
tooltipPosition?: ETooltipPosition;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
required?: boolean;
|
|
26
|
+
maxHeightList?: number;
|
|
27
|
+
isVisibleDefaultTitle?: boolean;
|
|
28
|
+
isScrollableList?: boolean;
|
|
29
|
+
classNameRoot?: string;
|
|
30
|
+
classNameError?: string;
|
|
31
|
+
classNameLabel?: string;
|
|
32
|
+
classNameBaseTooltipRoot?: string;
|
|
33
|
+
isSearchable?: boolean;
|
|
34
|
+
searchPlaceholder?: string;
|
|
35
|
+
size?: TSelectSize;
|
|
36
|
+
}
|
|
37
|
+
export type TOnChangeSelect = (event: React.MouseEvent<HTMLDivElement>, data: {
|
|
38
|
+
value: string | null | number;
|
|
39
|
+
name: string;
|
|
40
|
+
}) => void;
|
|
41
|
+
export type TOnBlurSelect = (data: {
|
|
42
|
+
value: string | null | number;
|
|
43
|
+
name: string;
|
|
44
|
+
}) => void;
|
|
45
|
+
export type TSelectListStyle = {
|
|
46
|
+
top: number;
|
|
47
|
+
left: number;
|
|
48
|
+
width: number;
|
|
49
|
+
placement: "top" | "bottom";
|
|
50
|
+
} | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._skeleton_1h6ke_1{--start-color: var(--spui-color-gray-100);--end-color: var(--spui-color-surface-default);background-color:var(--start-color);background-image:linear-gradient(90deg,var(--start-color) 0%,var(--end-color) 50%,var(--start-color) 100%);background-size:200% 100%;animation:_shimmer_1h6ke_1 2s infinite ease-in-out;display:inline-block}._skeleton_1h6ke_1{opacity:1;visibility:visible}._skeleton_1h6ke_1{transition:all .3s ease-in-out}@starting-style{._skeleton_1h6ke_1{opacity:0;visibility:hidden}}._skeleton_circle_1h6ke_23{border-radius:50%}._skeleton_customStart_1h6ke_26{--start-color: var(--custom-start-color, var(--spui-color-gray-100))}._skeleton_customEnd_1h6ke_29{--end-color: var(--custom-end-color, var(--spui-color-surface-default))}@keyframes _shimmer_1h6ke_1{0%{background-position:200% 0}to{background-position:-200% 0}}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import k from "clsx";
|
|
3
|
+
import o from "./Skeleton.module.scss.js";
|
|
4
|
+
const y = (r) => {
|
|
5
|
+
const {
|
|
6
|
+
startColor: t,
|
|
7
|
+
endColor: e,
|
|
8
|
+
width: l = "100%",
|
|
9
|
+
height: c = "1rem",
|
|
10
|
+
circle: m = !1,
|
|
11
|
+
classNameRoot: s,
|
|
12
|
+
style: n = {}
|
|
13
|
+
} = r, a = {
|
|
14
|
+
width: l,
|
|
15
|
+
height: c,
|
|
16
|
+
...n
|
|
17
|
+
}, i = k({
|
|
18
|
+
[o.skeleton]: !0,
|
|
19
|
+
[o.skeleton_circle]: m,
|
|
20
|
+
[o.skeleton_customStart]: t,
|
|
21
|
+
[o.skeleton_customEnd]: e,
|
|
22
|
+
...s && { [s]: !0 }
|
|
23
|
+
});
|
|
24
|
+
return /* @__PURE__ */ u(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: i,
|
|
28
|
+
style: {
|
|
29
|
+
...a,
|
|
30
|
+
...t && { "--custom-start-color": t },
|
|
31
|
+
...e && { "--custom-end-color": e }
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
y as Skeleton
|
|
38
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './Skeleton.css';const e = "_skeleton_1h6ke_1", t = "_skeleton_circle_1h6ke_23", s = "_skeleton_customStart_1h6ke_26", o = "_skeleton_customEnd_1h6ke_29", _ = {
|
|
2
|
+
skeleton: e,
|
|
3
|
+
skeleton_circle: t,
|
|
4
|
+
skeleton_customStart: s,
|
|
5
|
+
skeleton_customEnd: o
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
_ as default,
|
|
9
|
+
e as skeleton,
|
|
10
|
+
t as skeleton_circle,
|
|
11
|
+
o as skeleton_customEnd,
|
|
12
|
+
s as skeleton_customStart
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._spinner_if3pi_1{--spinner-size: 24px;--spinner-thickness: 2px;width:var(--spinner-size);height:var(--spinner-size);border-radius:50%;position:relative;animation:_spinner-rotate_if3pi_1 1s linear infinite;flex-shrink:0}._spinner_if3pi_1{opacity:1;visibility:visible}._spinner_if3pi_1{transition:all .3s ease-in-out}@starting-style{._spinner_if3pi_1{opacity:0;visibility:hidden}}._spinner_if3pi_1:before{content:"";position:absolute;inset:0;border-radius:50%;border:var(--spinner-thickness) solid currentColor;animation:_spinner-clip_if3pi_1 2s linear infinite}._spinner--size-sm_if3pi_32{--spinner-size: 16px;--spinner-thickness: 2px}._spinner--size-md_if3pi_36{--spinner-size: 24px;--spinner-thickness: 3px}._spinner--size-lg_if3pi_40{--spinner-size: 32px;--spinner-thickness: 4px}._spinner--size-xl_if3pi_44{--spinner-size: 48px;--spinner-thickness: 5px}@keyframes _spinner-rotate_if3pi_1{to{transform:rotate(360deg)}}@keyframes _spinner-clip_if3pi_1{0%{clip-path:polygon(50% 50%,0 0,0 0,0 0,0 0,0 0)}25%{clip-path:polygon(50% 50%,0 0,100% 0,100% 0,100% 0,100% 0)}50%{clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,100% 100%,100% 100%)}75%{clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,0 100%,0 100%)}to{clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,0 100%,0 0)}}._spinnerWithText_if3pi_71{display:flex;flex-direction:column;align-items:center;gap:12px}._spinnerWithText__line_if3pi_77{--spinner-text-size: 14px;display:block;text-align:center;overflow-wrap:break-word;font-family:var(--spui-font-family-main),serif;font-weight:var(--spui-font-weight-regular);line-height:120%;color:var(--spui-color-text-primary);font-size:var(--spinner-text-size)}._spinnerWithText__line--size-sm_if3pi_88{--spinner-text-size: 8px}._spinnerWithText__line--size-md_if3pi_91{--spinner-text-size: 10px}._spinnerWithText__line--size-lg_if3pi_94{--spinner-text-size: 12px}._spinnerWithText__line--size-xl_if3pi_97{--spinner-text-size: 14px}._spinnerWithText__text_if3pi_100{display:inline}._spinnerWithText__dots_if3pi_103{display:inline-flex;align-items:baseline;gap:.05em;font-family:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;font-style:inherit}._spinnerWithText__dot_if3pi_103{display:inline-block;animation:_spinner-dot-wave_if3pi_1 1.2s ease-in-out infinite both;font-family:inherit;font-size:inherit;line-height:inherit;font-weight:inherit;font-style:inherit}._spinnerWithText__dot_if3pi_103:after{content:"."}._spinnerWithText__dot_if3pi_103:nth-child(1){animation-delay:0s}._spinnerWithText__dot_if3pi_103:nth-child(2){animation-delay:.15s}._spinnerWithText__dot_if3pi_103:nth-child(3){animation-delay:.3s}._spinnerWithText__dot_if3pi_103:nth-child(4){animation-delay:.45s}@keyframes _spinner-dot-wave_if3pi_1{0%,60%,to{transform:translateY(0)}30%{transform:translateY(-.35em)}}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsxs as i, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import l from "clsx";
|
|
3
|
+
import e from "./Spinner.module.scss.js";
|
|
4
|
+
const h = (p) => {
|
|
5
|
+
const {
|
|
6
|
+
size: n = "md",
|
|
7
|
+
color: c = "#036bfd",
|
|
8
|
+
classNameRoot: a,
|
|
9
|
+
classNameSpinnerTextLine: r,
|
|
10
|
+
loadingText: t
|
|
11
|
+
} = p, m = l({
|
|
12
|
+
[e.spinner]: !0,
|
|
13
|
+
[e[`spinner--size-${n}`]]: n,
|
|
14
|
+
...a && { [a]: !0 }
|
|
15
|
+
}), o = () => /* @__PURE__ */ s(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
className: m,
|
|
19
|
+
"aria-label": t ? void 0 : "Loading",
|
|
20
|
+
role: "status",
|
|
21
|
+
style: { color: c }
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
if (!t)
|
|
25
|
+
return o();
|
|
26
|
+
const d = l({
|
|
27
|
+
[e.spinnerWithText__line]: !0,
|
|
28
|
+
[e[`spinnerWithText__line--size-${n}`]]: n,
|
|
29
|
+
...r && { [r]: !0 }
|
|
30
|
+
});
|
|
31
|
+
return /* @__PURE__ */ i("div", { className: e.spinnerWithText, children: [
|
|
32
|
+
o(),
|
|
33
|
+
/* @__PURE__ */ i("div", { className: d, "aria-live": "polite", children: [
|
|
34
|
+
/* @__PURE__ */ s("span", { className: e.spinnerWithText__text, children: t }),
|
|
35
|
+
/* @__PURE__ */ i("span", { className: e.spinnerWithText__dots, "aria-hidden": "true", children: [
|
|
36
|
+
/* @__PURE__ */ s("span", { className: e.spinnerWithText__dot }),
|
|
37
|
+
/* @__PURE__ */ s("span", { className: e.spinnerWithText__dot }),
|
|
38
|
+
/* @__PURE__ */ s("span", { className: e.spinnerWithText__dot }),
|
|
39
|
+
/* @__PURE__ */ s("span", { className: e.spinnerWithText__dot })
|
|
40
|
+
] })
|
|
41
|
+
] })
|
|
42
|
+
] });
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
h as Spinner
|
|
46
|
+
};
|