brd-ui-kit 0.1.57 → 0.1.58
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/_commonjsHelpers-DKOUU3wS.cjs +2 -0
- package/dist/_commonjsHelpers-DKOUU3wS.cjs.map +1 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js +9 -0
- package/dist/_commonjsHelpers-DaMA6jEr.js.map +1 -0
- package/dist/chart-CgVfpT_X.cjs +63 -0
- package/dist/chart-CgVfpT_X.cjs.map +1 -0
- package/dist/chart-D15EtNmb.js +13139 -0
- package/dist/chart-D15EtNmb.js.map +1 -0
- package/dist/components-app-pagination-app-pagination.js +97 -0
- package/dist/components-app-pagination-app-pagination.js.map +1 -0
- package/dist/components-app-pagination-app-pagination.styles.js +85 -0
- package/dist/components-app-pagination-app-pagination.styles.js.map +1 -0
- package/dist/components-app-pagination.js +5 -0
- package/dist/components-app-pagination.js.map +1 -0
- package/dist/components-app-sidebar-app-sidebar.js +97 -0
- package/dist/components-app-sidebar-app-sidebar.js.map +1 -0
- package/dist/components-app-sidebar-app-sidebar.styles.js +59 -0
- package/dist/components-app-sidebar-app-sidebar.styles.js.map +1 -0
- package/dist/components-app-sidebar.js +5 -0
- package/dist/components-app-sidebar.js.map +1 -0
- package/dist/components-avatar-uploader-avatar-uploader.cjs +2 -2
- package/dist/components-avatar-uploader-avatar-uploader.cjs.map +1 -1
- package/dist/components-avatar-uploader-avatar-uploader.js +103 -0
- package/dist/components-avatar-uploader-avatar-uploader.js.map +1 -0
- package/dist/components-avatar-uploader.js +5 -0
- package/dist/components-avatar-uploader.js.map +1 -0
- package/dist/components-basic-avatar-basic-avatar.cjs +1 -1
- package/dist/components-basic-avatar-basic-avatar.cjs.map +1 -1
- package/dist/components-basic-avatar-basic-avatar.js +99 -0
- package/dist/components-basic-avatar-basic-avatar.js.map +1 -0
- package/dist/components-basic-avatar.js +5 -0
- package/dist/components-basic-avatar.js.map +1 -0
- package/dist/components-basic-chart-basic-chart.cjs +3 -1
- package/dist/components-basic-chart-basic-chart.cjs.map +1 -1
- package/dist/components-basic-chart-basic-chart.js +5546 -0
- package/dist/components-basic-chart-basic-chart.js.map +1 -0
- package/dist/components-basic-chart.js +5 -0
- package/dist/components-basic-chart.js.map +1 -0
- package/dist/components-basic-checkbox-basic-checkbox.js +54 -0
- package/dist/components-basic-checkbox-basic-checkbox.js.map +1 -0
- package/dist/components-basic-checkbox.js +5 -0
- package/dist/components-basic-checkbox.js.map +1 -0
- package/dist/components-basic-drawer-basic-drawer.cjs +1 -1
- package/dist/components-basic-drawer-basic-drawer.cjs.map +1 -1
- package/dist/components-basic-drawer-basic-drawer.js +74 -0
- package/dist/components-basic-drawer-basic-drawer.js.map +1 -0
- package/dist/components-basic-drawer.js +5 -0
- package/dist/components-basic-drawer.js.map +1 -0
- package/dist/components-basic-modal-basic-modal.js +56 -0
- package/dist/components-basic-modal-basic-modal.js.map +1 -0
- package/dist/components-basic-modal.js +5 -0
- package/dist/components-basic-modal.js.map +1 -0
- package/dist/components-basic-select-basic-select.js +53 -0
- package/dist/components-basic-select-basic-select.js.map +1 -0
- package/dist/components-basic-select.js +5 -0
- package/dist/components-basic-select.js.map +1 -0
- package/dist/components-basic-table-basic-table.js +1961 -0
- package/dist/components-basic-table-basic-table.js.map +1 -0
- package/dist/components-basic-table.js +5 -0
- package/dist/components-basic-table.js.map +1 -0
- package/dist/components-basic-tooltip-basic-tooltip.js +61 -0
- package/dist/components-basic-tooltip-basic-tooltip.js.map +1 -0
- package/dist/components-basic-tooltip.js +5 -0
- package/dist/components-basic-tooltip.js.map +1 -0
- package/dist/components-files-uploader-files-uploader.cjs +3 -3
- package/dist/components-files-uploader-files-uploader.cjs.map +1 -1
- package/dist/components-files-uploader-files-uploader.js +185 -0
- package/dist/components-files-uploader-files-uploader.js.map +1 -0
- package/dist/components-files-uploader.js +5 -0
- package/dist/components-files-uploader.js.map +1 -0
- package/dist/components-input-field-input-field.js +56 -0
- package/dist/components-input-field-input-field.js.map +1 -0
- package/dist/components-input-field.js +5 -0
- package/dist/components-input-field.js.map +1 -0
- package/dist/components-input-password-input-password.cjs +1 -1
- package/dist/components-input-password-input-password.cjs.map +1 -1
- package/dist/components-input-password-input-password.js +67 -0
- package/dist/components-input-password-input-password.js.map +1 -0
- package/dist/components-input-password.js +5 -0
- package/dist/components-input-password.js.map +1 -0
- package/dist/components-popover-modal-popover-modal.js +40 -0
- package/dist/components-popover-modal-popover-modal.js.map +1 -0
- package/dist/components-popover-modal.js +5 -0
- package/dist/components-popover-modal.js.map +1 -0
- package/dist/components-radio-button-radio-button.js +74 -0
- package/dist/components-radio-button-radio-button.js.map +1 -0
- package/dist/components-radio-button.js +5 -0
- package/dist/components-radio-button.js.map +1 -0
- package/dist/components-select-field-select-field.js +179 -0
- package/dist/components-select-field-select-field.js.map +1 -0
- package/dist/components-select-field.js +5 -0
- package/dist/components-select-field.js.map +1 -0
- package/dist/components-select-groups-select-groups.js +91 -0
- package/dist/components-select-groups-select-groups.js.map +1 -0
- package/dist/components-select-groups.js +5 -0
- package/dist/components-select-groups.js.map +1 -0
- package/dist/components-textarea-field-textarea-field.js +30 -0
- package/dist/components-textarea-field-textarea-field.js.map +1 -0
- package/dist/components-textarea-field.js +5 -0
- package/dist/components-textarea-field.js.map +1 -0
- package/dist/components-ui-avatar-avatar.js +149 -0
- package/dist/components-ui-avatar-avatar.js.map +1 -0
- package/dist/components-ui-avatar.js +10 -0
- package/dist/components-ui-avatar.js.map +1 -0
- package/dist/components-ui-badge-badge.js +47 -0
- package/dist/components-ui-badge-badge.js.map +1 -0
- package/dist/components-ui-badge-badge.styles.js +53 -0
- package/dist/components-ui-badge-badge.styles.js.map +1 -0
- package/dist/components-ui-badge.js +7 -0
- package/dist/components-ui-badge.js.map +1 -0
- package/dist/components-ui-button-button.js +26 -0
- package/dist/components-ui-button-button.js.map +1 -0
- package/dist/components-ui-button-button.styles.js +58 -0
- package/dist/components-ui-button-button.styles.js.map +1 -0
- package/dist/components-ui-button.js +7 -0
- package/dist/components-ui-button.js.map +1 -0
- package/dist/components-ui-card-card.js +95 -0
- package/dist/components-ui-card-card.js.map +1 -0
- package/dist/components-ui-card-card.styles.js +55 -0
- package/dist/components-ui-card-card.styles.js.map +1 -0
- package/dist/components-ui-card.js +10 -0
- package/dist/components-ui-card.js.map +1 -0
- package/dist/components-ui-chart-chart.cjs +1 -21
- package/dist/components-ui-chart-chart.cjs.map +1 -1
- package/dist/components-ui-chart-chart.js +13 -0
- package/dist/components-ui-chart-chart.js.map +1 -0
- package/dist/components-ui-chart.cjs +1 -1
- package/dist/components-ui-chart.js +10 -0
- package/dist/components-ui-chart.js.map +1 -0
- package/dist/components-ui-checkbox-checkbox.js +26 -0
- package/dist/components-ui-checkbox-checkbox.js.map +1 -0
- package/dist/components-ui-checkbox-checkbox.styles.js +20 -0
- package/dist/components-ui-checkbox-checkbox.styles.js.map +1 -0
- package/dist/components-ui-checkbox.js +5 -0
- package/dist/components-ui-checkbox.js.map +1 -0
- package/dist/components-ui-combobox-combobox.cjs +5 -5
- package/dist/components-ui-combobox-combobox.cjs.map +1 -1
- package/dist/components-ui-combobox-combobox.js +7155 -0
- package/dist/components-ui-combobox-combobox.js.map +1 -0
- package/dist/components-ui-combobox-combobox.styles.js +93 -0
- package/dist/components-ui-combobox-combobox.styles.js.map +1 -0
- package/dist/components-ui-combobox.js +20 -0
- package/dist/components-ui-combobox.js.map +1 -0
- package/dist/components-ui-dialog-dialog.js +88 -0
- package/dist/components-ui-dialog-dialog.js.map +1 -0
- package/dist/components-ui-dialog-dialog.styles.js +34 -0
- package/dist/components-ui-dialog-dialog.styles.js.map +1 -0
- package/dist/components-ui-dialog.js +14 -0
- package/dist/components-ui-dialog.js.map +1 -0
- package/dist/components-ui-drawer-drawer.cjs +1 -1
- package/dist/components-ui-drawer-drawer.cjs.map +1 -1
- package/dist/components-ui-drawer-drawer.js +177 -0
- package/dist/components-ui-drawer-drawer.js.map +1 -0
- package/dist/components-ui-drawer.js +14 -0
- package/dist/components-ui-drawer.js.map +1 -0
- package/dist/components-ui-field-field.js +155 -0
- package/dist/components-ui-field-field.js.map +1 -0
- package/dist/components-ui-field-field.styles.js +59 -0
- package/dist/components-ui-field-field.styles.js.map +1 -0
- package/dist/components-ui-field.js +14 -0
- package/dist/components-ui-field.js.map +1 -0
- package/dist/components-ui-icon-icon-dictionary.js +60 -0
- package/dist/components-ui-icon-icon-dictionary.js.map +1 -0
- package/dist/components-ui-icon-icon.js +40 -0
- package/dist/components-ui-icon-icon.js.map +1 -0
- package/dist/components-ui-icon-overrides.js +65 -0
- package/dist/components-ui-icon-overrides.js.map +1 -0
- package/dist/components-ui-icon.js +5 -0
- package/dist/components-ui-icon.js.map +1 -0
- package/dist/components-ui-input-group-input-group.js +129 -0
- package/dist/components-ui-input-group-input-group.js.map +1 -0
- package/dist/components-ui-input-group-input-group.styles.js +43 -0
- package/dist/components-ui-input-group-input-group.styles.js.map +1 -0
- package/dist/components-ui-input-group.js +10 -0
- package/dist/components-ui-input-group.js.map +1 -0
- package/dist/components-ui-input-input.js +18 -0
- package/dist/components-ui-input-input.js.map +1 -0
- package/dist/components-ui-input-input.styles.js +31 -0
- package/dist/components-ui-input-input.styles.js.map +1 -0
- package/dist/components-ui-input.js +5 -0
- package/dist/components-ui-input.js.map +1 -0
- package/dist/components-ui-label-label.js +19 -0
- package/dist/components-ui-label-label.js.map +1 -0
- package/dist/components-ui-label.js +5 -0
- package/dist/components-ui-label.js.map +1 -0
- package/dist/components-ui-navigation-item-navigation-item.js +66 -0
- package/dist/components-ui-navigation-item-navigation-item.js.map +1 -0
- package/dist/components-ui-navigation-item-navigation-item.styles.js +32 -0
- package/dist/components-ui-navigation-item-navigation-item.styles.js.map +1 -0
- package/dist/components-ui-navigation-item.js +5 -0
- package/dist/components-ui-navigation-item.js.map +1 -0
- package/dist/components-ui-navigation-menu-navigation-menu.js +25 -0
- package/dist/components-ui-navigation-menu-navigation-menu.js.map +1 -0
- package/dist/components-ui-navigation-menu-navigation-menu.styles.js +23 -0
- package/dist/components-ui-navigation-menu-navigation-menu.styles.js.map +1 -0
- package/dist/components-ui-navigation-menu.js +5 -0
- package/dist/components-ui-navigation-menu.js.map +1 -0
- package/dist/components-ui-pagination-pagination.js +110 -0
- package/dist/components-ui-pagination-pagination.js.map +1 -0
- package/dist/components-ui-pagination.js +11 -0
- package/dist/components-ui-pagination.js.map +1 -0
- package/dist/components-ui-popover-popover.js +117 -0
- package/dist/components-ui-popover-popover.js.map +1 -0
- package/dist/components-ui-popover-popover.styles.js +13 -0
- package/dist/components-ui-popover-popover.styles.js.map +1 -0
- package/dist/components-ui-popover.js +11 -0
- package/dist/components-ui-popover.js.map +1 -0
- package/dist/components-ui-progress-progress.js +49 -0
- package/dist/components-ui-progress-progress.js.map +1 -0
- package/dist/components-ui-progress.js +5 -0
- package/dist/components-ui-progress.js.map +1 -0
- package/dist/components-ui-radio-group-radio-group.js +29 -0
- package/dist/components-ui-radio-group-radio-group.js.map +1 -0
- package/dist/components-ui-radio-group-radio-group.styles.js +23 -0
- package/dist/components-ui-radio-group-radio-group.styles.js.map +1 -0
- package/dist/components-ui-radio-group.js +6 -0
- package/dist/components-ui-radio-group.js.map +1 -0
- package/dist/components-ui-select-select.js +194 -0
- package/dist/components-ui-select-select.js.map +1 -0
- package/dist/components-ui-select-select.styles.js +43 -0
- package/dist/components-ui-select-select.styles.js.map +1 -0
- package/dist/components-ui-select.js +14 -0
- package/dist/components-ui-select.js.map +1 -0
- package/dist/components-ui-separator-separator.js +29 -0
- package/dist/components-ui-separator-separator.js.map +1 -0
- package/dist/components-ui-separator.js +5 -0
- package/dist/components-ui-separator.js.map +1 -0
- package/dist/components-ui-sonner-sonner.cjs +1 -1
- package/dist/components-ui-sonner-sonner.cjs.map +1 -1
- package/dist/components-ui-sonner-sonner.js +72 -0
- package/dist/components-ui-sonner-sonner.js.map +1 -0
- package/dist/components-ui-sonner-sonner.styles.js +42 -0
- package/dist/components-ui-sonner-sonner.styles.js.map +1 -0
- package/dist/components-ui-sonner.cjs +1 -1
- package/dist/components-ui-sonner.js +7 -0
- package/dist/components-ui-sonner.js.map +1 -0
- package/dist/components-ui-switch-switch.js +19 -0
- package/dist/components-ui-switch-switch.js.map +1 -0
- package/dist/components-ui-switch-switch.styles.js +22 -0
- package/dist/components-ui-switch-switch.styles.js.map +1 -0
- package/dist/components-ui-switch.js +5 -0
- package/dist/components-ui-switch.js.map +1 -0
- package/dist/components-ui-table-table.js +130 -0
- package/dist/components-ui-table-table.js.map +1 -0
- package/dist/components-ui-table.js +12 -0
- package/dist/components-ui-table.js.map +1 -0
- package/dist/components-ui-tabs-tabs.js +62 -0
- package/dist/components-ui-tabs-tabs.js.map +1 -0
- package/dist/components-ui-tabs-tabs.styles.js +64 -0
- package/dist/components-ui-tabs-tabs.styles.js.map +1 -0
- package/dist/components-ui-tabs.js +8 -0
- package/dist/components-ui-tabs.js.map +1 -0
- package/dist/components-ui-textarea-textarea.js +16 -0
- package/dist/components-ui-textarea-textarea.js.map +1 -0
- package/dist/components-ui-textarea-textarea.styles.js +13 -0
- package/dist/components-ui-textarea-textarea.styles.js.map +1 -0
- package/dist/components-ui-textarea.js +5 -0
- package/dist/components-ui-textarea.js.map +1 -0
- package/dist/components-ui-tooltip-tooltip.js +28 -0
- package/dist/components-ui-tooltip-tooltip.js.map +1 -0
- package/dist/components-ui-tooltip-tooltip.styles.js +11 -0
- package/dist/components-ui-tooltip-tooltip.styles.js.map +1 -0
- package/dist/components-ui-tooltip.js +9 -0
- package/dist/components-ui-tooltip.js.map +1 -0
- package/dist/components-ui-typography-typography.js +19 -0
- package/dist/components-ui-typography-typography.js.map +1 -0
- package/dist/components-ui-typography-typography.styles.js +85 -0
- package/dist/components-ui-typography-typography.styles.js.map +1 -0
- package/dist/components-ui-typography.js +9 -0
- package/dist/components-ui-typography.js.map +1 -0
- package/dist/hooks-usePopupControls.js +14 -0
- package/dist/hooks-usePopupControls.js.map +1 -0
- package/dist/index-B5Id-jNC.js +2830 -0
- package/dist/index-B5Id-jNC.js.map +1 -0
- package/dist/index-C4iHL8Gs.js +776 -0
- package/dist/index-C4iHL8Gs.js.map +1 -0
- package/dist/index-C6N9aMq_.js +1038 -0
- package/dist/index-C6N9aMq_.js.map +1 -0
- package/dist/index-D8y9Cogu.cjs +7 -0
- package/dist/index-D8y9Cogu.cjs.map +1 -0
- package/dist/index-DGxwh2Ms.cjs +2 -0
- package/dist/index-DGxwh2Ms.cjs.map +1 -0
- package/dist/index-fTTv8YY8.cjs +4 -0
- package/dist/index-fTTv8YY8.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +194 -0
- package/dist/index.js.map +1 -0
- package/dist/lib-utils.js +16 -0
- package/dist/lib-utils.js.map +1 -0
- package/dist/lodash-FemA_LCk.js +3688 -0
- package/dist/lodash-FemA_LCk.js.map +1 -0
- package/dist/lodash-kqhtUJfz.cjs +21 -0
- package/dist/lodash-kqhtUJfz.cjs.map +1 -0
- package/dist/types-types.js +2 -0
- package/dist/types-types.js.map +1 -0
- package/dist/utils-helpers.js +17 -0
- package/dist/utils-helpers.js.map +1 -0
- package/dist/with-selector-CNcGWQ-h.js +534 -0
- package/dist/with-selector-CNcGWQ-h.js.map +1 -0
- package/dist/with-selector-DSbfqgSY.cjs +8 -0
- package/dist/with-selector-DSbfqgSY.cjs.map +1 -0
- package/package.json +149 -379
- package/.githooks/pre-commit +0 -19
- package/.prettierignore +0 -13
- package/components.json +0 -25
- package/prettier.config.mjs +0 -28
- package/public/vite.svg +0 -1
- package/scripts/generate-exports.js +0 -76
- package/scripts/get-entry-points.ts +0 -102
- package/tsconfig.app.json +0 -40
- package/tsconfig.node.json +0 -26
- package/tsconfig.storybook.json +0 -7
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as e, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip as T, TooltipTrigger as f, TooltipContent as h, TooltipArrow as C } from "./components-ui-tooltip-tooltip.js";
|
|
3
|
+
import { usePopupControls as b } from "./hooks-usePopupControls.js";
|
|
4
|
+
import { cn as x } from "./lib-utils.js";
|
|
5
|
+
import { useMemo as a } from "react";
|
|
6
|
+
const O = ({
|
|
7
|
+
children: m,
|
|
8
|
+
text: r,
|
|
9
|
+
place: l = "top",
|
|
10
|
+
arrow: s = !0,
|
|
11
|
+
classes: o,
|
|
12
|
+
color: t = "dark",
|
|
13
|
+
tooltipItemsLimit: n = 1 / 0
|
|
14
|
+
}) => {
|
|
15
|
+
const { isOpened: c, togglePopup: d } = b(), i = a(
|
|
16
|
+
() => ({
|
|
17
|
+
arrow: t === "dark" ? "fill-primary-inverse-bg" : "fill-primary-bg",
|
|
18
|
+
content: t === "dark" ? "bg-primary-inverse-bg text-primary-inverse-text" : "bg-primary-bg text-primary-text"
|
|
19
|
+
}),
|
|
20
|
+
[t]
|
|
21
|
+
), g = a(() => Array.isArray(r) ? (r.length - n > 0 ? r.slice(0, n) : r).map((u, y) => /* @__PURE__ */ e(
|
|
22
|
+
"p",
|
|
23
|
+
{
|
|
24
|
+
className: o?.tooltipTextItem,
|
|
25
|
+
children: u
|
|
26
|
+
},
|
|
27
|
+
y
|
|
28
|
+
)) : r, [o?.tooltipTextItem, r, n]);
|
|
29
|
+
return /* @__PURE__ */ p(
|
|
30
|
+
T,
|
|
31
|
+
{
|
|
32
|
+
open: c,
|
|
33
|
+
onOpenChange: d,
|
|
34
|
+
children: [
|
|
35
|
+
/* @__PURE__ */ e(
|
|
36
|
+
f,
|
|
37
|
+
{
|
|
38
|
+
asChild: !0,
|
|
39
|
+
className: o?.trigger,
|
|
40
|
+
children: m
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ p(
|
|
44
|
+
h,
|
|
45
|
+
{
|
|
46
|
+
side: l,
|
|
47
|
+
className: i.content,
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ e("div", { className: x(o?.tooltip), children: g }),
|
|
50
|
+
s && /* @__PURE__ */ e(C, { className: i.arrow })
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
O as BasicTooltip
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=components-basic-tooltip-basic-tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-basic-tooltip-basic-tooltip.js","sources":["../src/components/basic-tooltip/basic-tooltip.tsx"],"sourcesContent":["import {\n Tooltip,\n TooltipArrow,\n TooltipContent,\n TooltipTrigger,\n} from \"@/components/ui/tooltip\";\nimport { usePopupControls } from \"@/hooks/usePopupControls\";\nimport { cn } from \"@/lib/utils\";\n\nimport { useMemo, type JSX } from \"react\";\n\ntype TooltipContentItem = JSX.Element | string | number;\n\ntype Position = \"left\" | \"top\" | \"bottom\" | \"right\";\n\ntype Classes = {\n trigger?: string;\n tooltip?: string;\n tooltipTextItem?: string;\n};\n\ntype Props = {\n children: React.ReactNode;\n text: TooltipContentItem | TooltipContentItem[];\n place?: Position;\n arrow?: boolean;\n classes?: Classes;\n color?: \"dark\" | \"light\";\n tooltipItemsLimit?: number;\n};\n\nexport const BasicTooltip = ({\n children,\n text,\n place = \"top\",\n arrow = true,\n classes,\n color = \"dark\",\n tooltipItemsLimit = Infinity,\n}: Props) => {\n const { isOpened, togglePopup } = usePopupControls();\n\n const colorStyle = useMemo(\n () => ({\n arrow: color === \"dark\" ? \"fill-primary-inverse-bg\" : \"fill-primary-bg\",\n content:\n color === \"dark\"\n ? \"bg-primary-inverse-bg text-primary-inverse-text\"\n : \"bg-primary-bg text-primary-text\",\n }),\n [color],\n );\n\n const tooltipContent = useMemo(() => {\n if (!Array.isArray(text)) {\n return text;\n }\n\n const hiddenItemCount = text.length - tooltipItemsLimit;\n const newText = hiddenItemCount > 0 ? text.slice(0, tooltipItemsLimit) : text;\n\n return newText.map((item, i) => (\n <p\n // eslint-disable-next-line react-x/no-array-index-key -- Stable list order; items are not inserted, removed, or reordered.\n key={i}\n className={classes?.tooltipTextItem}\n >\n {item}\n </p>\n ));\n }, [classes?.tooltipTextItem, text, tooltipItemsLimit]);\n\n return (\n <Tooltip\n open={isOpened}\n onOpenChange={togglePopup}\n >\n <TooltipTrigger\n asChild\n className={classes?.trigger}\n >\n {children}\n </TooltipTrigger>\n <TooltipContent\n side={place}\n className={colorStyle.content}\n >\n <div className={cn(classes?.tooltip)}>{tooltipContent}</div>\n {arrow && <TooltipArrow className={colorStyle.arrow} />}\n </TooltipContent>\n </Tooltip>\n );\n};\n"],"names":["BasicTooltip","children","text","place","arrow","classes","color","tooltipItemsLimit","isOpened","togglePopup","usePopupControls","colorStyle","useMemo","tooltipContent","item","i","jsx","jsxs","Tooltip","TooltipTrigger","TooltipContent","cn","TooltipArrow"],"mappings":";;;;;AA+BO,MAAMA,IAAe,CAAC;AAAA,EAC3B,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,OAAAC,IAAQ;AAAA,EACR,SAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,mBAAAC,IAAoB;AACtB,MAAa;AACX,QAAM,EAAE,UAAAC,GAAU,aAAAC,EAAA,IAAgBC,EAAA,GAE5BC,IAAaC;AAAA,IACjB,OAAO;AAAA,MACL,OAAON,MAAU,SAAS,4BAA4B;AAAA,MACtD,SACEA,MAAU,SACN,oDACA;AAAA,IAAA;AAAA,IAER,CAACA,CAAK;AAAA,EAAA,GAGFO,IAAiBD,EAAQ,MACxB,MAAM,QAAQV,CAAI,KAICA,EAAK,SAASK,IACJ,IAAIL,EAAK,MAAM,GAAGK,CAAiB,IAAIL,GAE1D,IAAI,CAACY,GAAMC,MACxB,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MAGC,WAAWX,GAAS;AAAA,MAEnB,UAAAS;AAAA,IAAA;AAAA,IAHIC;AAAA,EAAA,CAKR,IAdQb,GAeR,CAACG,GAAS,iBAAiBH,GAAMK,CAAiB,CAAC;AAEtD,SACE,gBAAAU;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAMV;AAAA,MACN,cAAcC;AAAA,MAEd,UAAA;AAAA,QAAA,gBAAAO;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,SAAO;AAAA,YACP,WAAWd,GAAS;AAAA,YAEnB,UAAAJ;AAAA,UAAA;AAAA,QAAA;AAAA,QAEH,gBAAAgB;AAAA,UAACG;AAAA,UAAA;AAAA,YACC,MAAMjB;AAAA,YACN,WAAWQ,EAAW;AAAA,YAEtB,UAAA;AAAA,cAAA,gBAAAK,EAAC,SAAI,WAAWK,EAAGhB,GAAS,OAAO,GAAI,UAAAQ,GAAe;AAAA,cACrDT,KAAS,gBAAAY,EAACM,GAAA,EAAa,WAAWX,EAAW,MAAA,CAAO;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACvD;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-basic-tooltip.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("./lib-utils.cjs"),b=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("./lib-utils.cjs"),b=require("react"),D=require("./index-D8y9Cogu.cjs"),h=require("./components-ui-icon-icon.cjs"),L=require("./components-ui-typography-typography.cjs");require("./components-ui-typography-typography.styles.cjs");const $=["B","KB","MB","GB","TB"],u=1024,B=5*u*u,P=5,C=["all"],F=800,k={image:{"image/*":[".jpg",".jpeg",".png",".webp"]},pdf:{"application/pdf":[".pdf"]},doc:{"application/msword":[".doc"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":[".docx"]},excel:{"application/vnd.ms-excel":[".xls"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":[".xlsx"]},text:{"text/plain":[".txt"]},all:{}},O=r=>{if(r===0)return"0 B";const e=Math.floor(Math.log(r)/Math.log(u));return`${(r/Math.pow(u,e)).toFixed(2)} ${$[e]}`},Z=r=>r.reduce((e,l)=>({...e,...k[l]}),{}),z=r=>{const e=r.name.split(".").pop()?.toLowerCase();return e?["jpg","jpeg","png","webp"].includes(e)?"image":e==="pdf"?"pdf":["doc","docx"].includes(e)?"doc":["xls","xlsx"].includes(e)?"excel":e==="txt"?"text":"other":"other"},K=({value:r=null,onChange:e,multiple:l=!1,maxFiles:i=P,disabled:y=!1,className:p,maxSize:g=B,variant:m="grid",accepts:T=C,icon:U,title:j,text:v,showFiles:_=!0})=>{const[f,w]=b.useState(!1),[A,x]=b.useState(null),s=Array.isArray(r)?r:r?[r]:[],E=b.useCallback((o,n)=>{if(x(null),s.length+o.length>i){x(`Максимальное количество файлов: ${i}`);return}if(n.length>0){const c=n[0].errors[0]?.code==="file-too-large"?`Файл слишком большой. Максимальный размер: ${g/1024/1024}MB`:"Неподдерживаемый формат файла";x(c);return}w(!0),setTimeout(()=>{const a=o.map(c=>({url:URL.createObjectURL(c),name:c.name,size:O(c.size),addedAt:new Date().toISOString()}));l?e?.([...s,...a]):(s[0]?.url?.startsWith("blob:")&&URL.revokeObjectURL(s[0].url),e?.(a[0]??null)),w(!1)},F)},[s,i,g,l,e]),{getRootProps:I,getInputProps:M,isDragActive:N}=D.useDropzone({onDrop:E,accept:Z(T),maxSize:g,multiple:l&&i>1,disabled:y||f,maxFiles:i-s.length}),R=o=>()=>{s[o]?.url?.startsWith("blob:")&&URL.revokeObjectURL(s[o].url);const n=s.filter((a,c)=>c!==o);e?.(l?n:n[0]||null)},S=s.length>=i,q={grid:"grid-cols-2 sm:grid-cols-3 md:grid-cols-4",list:"grid-cols-1",compact:"grid-cols-2 sm:grid-cols-3"};return t.jsxs("div",{className:d.cn("w-full space-y-4",p?.container),children:[t.jsxs("div",{className:d.cn("grid h-full w-full gap-4",m==="list"?"grid-cols-1":q[m]),children:[_&&s.map((o,n)=>{const a=z(o);return t.jsxs("div",{className:`group bg-primary-bg relative aspect-square h-full w-full
|
|
2
2
|
overflow-hidden rounded-lg`,children:[a==="image"?t.jsx("img",{src:o.url,alt:`Preview ${n+1}`,className:"h-full w-full object-cover"}):t.jsx("div",{className:`flex h-full w-full items-center justify-center bg-gray-100
|
|
3
3
|
text-sm font-semibold`,children:o.name.split(".").pop()?.toUpperCase()}),t.jsx("div",{className:`text-primary-bg bg-primary-inverse-bg/50 absolute inset-0 flex
|
|
4
4
|
cursor-pointer items-center justify-center rounded-lg opacity-0
|
|
5
|
-
transition-opacity hover:opacity-100`,onClick:c=>c.stopPropagation(),children:t.jsx(h.Icon,{type:"close",onClick:
|
|
5
|
+
transition-opacity hover:opacity-100`,onClick:c=>c.stopPropagation(),children:t.jsx(h.Icon,{type:"close",onClick:R(n)})})]},n)}),(!S||!_)&&t.jsxs("div",{...I(),className:d.cn(`relative flex cursor-pointer flex-col items-center justify-center
|
|
6
6
|
rounded-lg border-2 border-dashed border-gray-300 bg-gray-50
|
|
7
|
-
transition-colors hover:bg-gray-100`,
|
|
7
|
+
transition-colors hover:bg-gray-100`,N&&"border-primary bg-primary/5",(y||f)&&"cursor-not-allowed opacity-50",m==="list"?"min-h-37.5":"aspect-square",p?.blockAdd),children:[t.jsx("input",{...M()}),f?t.jsx(h.Icon,{type:"loader",className:"text-sub-label-text h-8 w-8 animate-spin"}):t.jsxs("div",{className:"flex flex-col items-center space-y-2 p-4 text-center",children:[t.jsx(h.Icon,{type:U?.type??"plus",className:d.cn("text-sub-label-text h-8 w-8",p?.icon)}),t.jsx(L.Typography,{variant:"body-md-medium",className:d.cn("text-sub-label-text",p?.title),children:l?`${j||"Добавить"} (${s.length}/${i})`:`${j||"Добавить"}`}),v&&t.jsx(L.Typography,{variant:"body-xxs-medium",className:d.cn("text-sub-label-text",p?.text),children:v})]})]})]}),A&&t.jsx("div",{className:"rounded-lg bg-red-50 p-3 text-sm text-red-600",children:A})]})};exports.FilesUploader=K;
|
|
8
8
|
//# sourceMappingURL=components-files-uploader-files-uploader.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-files-uploader-files-uploader.cjs","sources":["../src/components/files-uploader/files-uploader.tsx"],"sourcesContent":["import { cn } from \"@/lib/utils\";\nimport { useCallback, useState } from \"react\";\nimport { type FileRejection, useDropzone } from \"react-dropzone\";\nimport { Icon, type IconProps } from \"../ui/icon\";\nimport { Typography } from \"../ui/typography\";\n\ntype Variant = \"grid\" | \"list\" | \"compact\";\ntype AcceptType = \"image\" | \"pdf\" | \"doc\" | \"excel\" | \"text\" | \"all\";\ntype UploadedFileData = {\n url: string;\n name: string;\n size: string;\n addedAt: string;\n};\ntype FilesUploaderValue = UploadedFileData | UploadedFileData[] | null;\n\ntype PropsFilesUploader = {\n value?: FilesUploaderValue;\n onChange?: (value: FilesUploaderValue) => void;\n multiple?: boolean;\n maxFiles?: number;\n disabled?: boolean;\n className?: {\n container?: string;\n blockAdd?: string;\n title?: string;\n text?: string;\n icon?: string;\n };\n displayFiles?: boolean;\n maxSize?: number;\n variant?: Variant;\n accepts?: AcceptType[];\n icon?: IconProps;\n title?: string;\n text?: string;\n showFiles?: boolean,\n \n};\nconst FILE_SIZE_UNITS = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\"];\nconst FILE_SIZE_KB = 1024;\nconst DEFAULT_MAX_SIZE = 5 * FILE_SIZE_KB * FILE_SIZE_KB;\nconst DEFAULT_MAX_FILES = 5;\nconst DEFAULT_ACCEPT: AcceptType[] = [\"all\"];\nconst DEFAULT_TIMEOUT = 800;\n\nconst ACCEPT_MAP: Record<AcceptType, Record<string, string[]>> = {\n image: { \"image/*\": [\".jpg\", \".jpeg\", \".png\", \".webp\"] },\n pdf: { \"application/pdf\": [\".pdf\"] },\n doc: {\n \"application/msword\": [\".doc\"],\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\": [\".docx\"],\n },\n excel: {\n \"application/vnd.ms-excel\": [\".xls\"],\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\": [\".xlsx\"],\n },\n text: { \"text/plain\": [\".txt\"] },\n all: {},\n};\n\nconst formatFileSize = (bytes: number) => {\n if (bytes === 0) return \"0 B\";\n const i = Math.floor(Math.log(bytes) / Math.log(FILE_SIZE_KB));\n return `${(bytes / Math.pow(FILE_SIZE_KB, i)).toFixed(2)} ${FILE_SIZE_UNITS[i]}`;\n};\n\nconst fileAcceptMap = (accepts: AcceptType[]): Record<string, string[]> =>\n accepts.reduce((acc, t) => ({ ...acc, ...ACCEPT_MAP[t] }), {});\n\nconst getFileType = (file: UploadedFileData) => {\n const ext = file.name.split(\".\").pop()?.toLowerCase();\n\n if (!ext) return \"other\";\n\n if ([\"jpg\", \"jpeg\", \"png\", \"webp\"].includes(ext)) return \"image\";\n if (ext === \"pdf\") return \"pdf\";\n if ([\"doc\", \"docx\"].includes(ext)) return \"doc\";\n if ([\"xls\", \"xlsx\"].includes(ext)) return \"excel\";\n if (ext === \"txt\") return \"text\";\n\n return \"other\";\n};\n\nexport const FilesUploader = ({\n value = null,\n onChange,\n multiple = false,\n maxFiles = DEFAULT_MAX_FILES,\n disabled = false,\n className,\n maxSize = DEFAULT_MAX_SIZE,\n variant = \"grid\",\n accepts = DEFAULT_ACCEPT,\n icon,\n title,\n text,\n showFiles = true,\n}: PropsFilesUploader) => {\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const files = Array.isArray(value) ? value : value ? [value] : [];\n \n\n const onDrop = useCallback(\n (acceptedFiles: File[], rejectedFiles: FileRejection[]) => {\n setError(null);\n\n if (files.length + acceptedFiles.length > maxFiles) {\n setError(`Максимальное количество файлов: ${maxFiles}`);\n return;\n }\n\n if (rejectedFiles.length > 0) {\n const rejection = rejectedFiles[0];\n const errorMessage =\n rejection.errors[0]?.code === \"file-too-large\"\n ? `Файл слишком большой. Максимальный размер: ${maxSize / 1024 / 1024}MB`\n : \"Неподдерживаемый формат файла\";\n setError(errorMessage);\n return;\n }\n\n setLoading(true);\n\n setTimeout(() => {\n const newFilesData: UploadedFileData[] = acceptedFiles.map((file) => ({\n url: URL.createObjectURL(file),\n name: file.name,\n size: formatFileSize(file.size),\n addedAt: new Date().toISOString(),\n }));\n\n if (multiple) {\n onChange?.([...files, ...newFilesData]);\n } else {\n if (files[0]?.url?.startsWith(\"blob:\")) URL.revokeObjectURL(files[0].url);\n onChange?.(newFilesData[0] ?? null);\n }\n\n setLoading(false);\n }, DEFAULT_TIMEOUT);\n },\n [files, maxFiles, maxSize, multiple, onChange],\n );\n\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n onDrop,\n accept: fileAcceptMap(accepts),\n maxSize,\n multiple: multiple && maxFiles > 1,\n disabled: disabled || loading,\n maxFiles: maxFiles - files.length,\n });\n\n const removeImage = (index: number) => {\n return () => {\n if (files[index]?.url?.startsWith(\"blob:\")) {\n URL.revokeObjectURL(files[index].url);\n }\n const newFiles = files.filter((_, i) => i !== index);\n onChange?.(multiple ? newFiles : newFiles[0] || null);\n };\n };\n\n const isMaxFilesReached = files.length >= maxFiles;\n\n // Варианты отображения\n const gridClasses = {\n grid: \"grid-cols-2 sm:grid-cols-3 md:grid-cols-4\",\n list: \"grid-cols-1\",\n compact: \"grid-cols-2 sm:grid-cols-3\",\n };\n\n return (\n <div className={cn(\"w-full space-y-4\", className?.container)}>\n {/* Предпросмотр с возможностью добавления новых */}\n <div\n className={cn(\n \"grid h-full w-full gap-4\",\n variant === \"list\" ? \"grid-cols-1\" : gridClasses[variant],\n )}\n >\n {showFiles && files.map((file, index) => {\n const type = getFileType(file);\n\n return (\n <div\n key={index}\n className=\"group bg-primary-bg relative aspect-square h-full w-full\n overflow-hidden rounded-lg\"\n >\n {type === \"image\" ? (\n <img\n src={file.url}\n alt={`Preview ${index + 1}`}\n className=\"h-full w-full object-cover\"\n />\n ) : (\n <div\n className=\"flex h-full w-full items-center justify-center bg-gray-100\n text-sm font-semibold\"\n >\n {file.name.split(\".\").pop()?.toUpperCase()}\n </div>\n )}\n\n <div\n className=\"text-primary-bg bg-primary-inverse-bg/50 absolute inset-0 flex\n cursor-pointer items-center justify-center rounded-lg opacity-0\n transition-opacity hover:opacity-100\"\n onClick={(e) => e.stopPropagation()}\n >\n <Icon\n type=\"close\"\n onClick={removeImage(index)}\n />\n </div>\n </div>\n );\n })}\n {/* Кнопка добавления нового изображения */}\n {(!isMaxFilesReached || !showFiles) && (\n <div\n {...getRootProps()}\n className={cn(\n `relative flex cursor-pointer flex-col items-center justify-center\n rounded-lg border-2 border-dashed border-gray-300 bg-gray-50\n transition-colors hover:bg-gray-100`,\n isDragActive && \"border-primary bg-primary/5\",\n (disabled || loading) && \"cursor-not-allowed opacity-50\",\n variant === \"list\" ? \"min-h-37.5\" : \"aspect-square\",\n className?.blockAdd,\n )}\n >\n <input {...getInputProps()} />\n\n {loading ? (\n <Icon\n type=\"loader\"\n className=\"text-sub-label-text h-8 w-8 animate-spin\"\n />\n ) : (\n <div className=\"flex flex-col items-center space-y-2 p-4 text-center\">\n <Icon\n type={icon?.type ?? \"plus\"}\n className={cn(\"text-sub-label-text h-8 w-8\", className?.icon)}\n />\n <Typography\n variant=\"body-md-medium\"\n className={cn(\"text-sub-label-text\", className?.title)}\n >\n {multiple\n ? `${title || \"Добавить\"} (${files.length}/${maxFiles})`\n : `${title || \"Добавить\"}`}\n </Typography>\n {text && (\n <Typography variant=\"body-xxs-medium\" className={cn(\"text-sub-label-text\", className?.text)}>\n {text}\n </Typography>\n )}\n </div>\n )}\n </div>\n )}\n </div>\n\n {/* Информация о количестве */}\n {/* {multiple && images.length > 0 && (\n <p className=\"text-xs text-gray-500\">\n Загружено {images.length} из {maxFiles} изображений\n </p>\n )} */}\n\n {/* Ошибка */}\n {error && (\n <div className=\"rounded-lg bg-red-50 p-3 text-sm text-red-600\">{error}</div>\n )}\n </div>\n );\n};\n\nexport type { PropsFilesUploader, UploadedFileData, FilesUploaderValue };\n\n"],"names":["FILE_SIZE_UNITS","FILE_SIZE_KB","DEFAULT_MAX_SIZE","DEFAULT_MAX_FILES","DEFAULT_ACCEPT","DEFAULT_TIMEOUT","ACCEPT_MAP","formatFileSize","bytes","i","fileAcceptMap","accepts","acc","t","getFileType","file","ext","FilesUploader","value","onChange","multiple","maxFiles","disabled","className","maxSize","variant","icon","title","text","showFiles","loading","setLoading","useState","error","setError","files","onDrop","useCallback","acceptedFiles","rejectedFiles","errorMessage","newFilesData","getRootProps","getInputProps","isDragActive","useDropzone","removeImage","index","newFiles","_","isMaxFilesReached","gridClasses","cn","jsxs","type","jsx","e","Icon","Typography"],"mappings":"+VAuCA,MAAMA,EAAkB,CAAC,IAAK,KAAM,KAAM,KAAM,IAAI,EAC9CC,EAAe,KACfC,EAAmB,EAAID,EAAeA,EACtCE,EAAoB,EACpBC,EAA+B,CAAC,KAAK,EACrCC,EAAkB,IAElBC,EAA2D,CAC/D,MAAO,CAAE,UAAW,CAAC,OAAQ,QAAS,OAAQ,OAAO,CAAA,EACrD,IAAK,CAAE,kBAAmB,CAAC,MAAM,CAAA,EACjC,IAAK,CACH,qBAAsB,CAAC,MAAM,EAC7B,0EAA2E,CAAC,OAAO,CAAA,EAErF,MAAO,CACL,2BAA4B,CAAC,MAAM,EACnC,oEAAqE,CAAC,OAAO,CAAA,EAE/E,KAAM,CAAE,aAAc,CAAC,MAAM,CAAA,EAC7B,IAAK,CAAA,CACP,EAEMC,EAAkBC,GAAkB,CACxC,GAAIA,IAAU,EAAG,MAAO,MACxB,MAAMC,EAAI,KAAK,MAAM,KAAK,IAAID,CAAK,EAAI,KAAK,IAAIP,CAAY,CAAC,EAC7D,MAAO,IAAIO,EAAQ,KAAK,IAAIP,EAAcQ,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAIT,EAAgBS,CAAC,CAAC,EAChF,EAEMC,EAAiBC,GACrBA,EAAQ,OAAO,CA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,MAAM,IAAId,CAAQ,IACnD,GAAGM,GAAS,UAAU,EAAA,CAAA,EAE3BC,GACC2B,EAAAA,IAACG,EAAAA,WAAA,CAAW,QAAQ,kBAAkB,UAAWN,EAAAA,GAAG,sBAAuB7B,GAAW,IAAI,EACvF,SAAAK,CAAA,CACH,CAAA,CAAA,CAEJ,CAAA,CAAA,CAAA,CAEJ,CAAA,CAAA,EAYHK,GACCsB,EAAAA,IAAC,MAAA,CAAI,UAAU,gDAAiD,SAAAtB,CAAA,CAAM,CAAA,EAE1E,CAEJ"}
|
|
1
|
+
{"version":3,"file":"components-files-uploader-files-uploader.cjs","sources":["../src/components/files-uploader/files-uploader.tsx"],"sourcesContent":["import { cn } from \"@/lib/utils\";\nimport { useCallback, useState } from \"react\";\nimport { type FileRejection, useDropzone } from \"react-dropzone\";\nimport { Icon, type IconProps } from \"../ui/icon\";\nimport { Typography } from \"../ui/typography\";\n\ntype Variant = \"grid\" | \"list\" | \"compact\";\ntype AcceptType = \"image\" | \"pdf\" | \"doc\" | \"excel\" | \"text\" | \"all\";\ntype UploadedFileData = {\n url: string;\n name: string;\n size: string;\n addedAt: string;\n};\ntype FilesUploaderValue = UploadedFileData | UploadedFileData[] | null;\n\ntype PropsFilesUploader = {\n value?: FilesUploaderValue;\n onChange?: (value: FilesUploaderValue) => void;\n multiple?: boolean;\n maxFiles?: number;\n disabled?: boolean;\n className?: {\n container?: string;\n blockAdd?: string;\n title?: string;\n text?: string;\n icon?: string;\n };\n displayFiles?: boolean;\n maxSize?: number;\n variant?: Variant;\n accepts?: AcceptType[];\n icon?: IconProps;\n title?: string;\n text?: string;\n showFiles?: boolean,\n \n};\nconst FILE_SIZE_UNITS = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\"];\nconst FILE_SIZE_KB = 1024;\nconst DEFAULT_MAX_SIZE = 5 * FILE_SIZE_KB * FILE_SIZE_KB;\nconst DEFAULT_MAX_FILES = 5;\nconst DEFAULT_ACCEPT: AcceptType[] = [\"all\"];\nconst DEFAULT_TIMEOUT = 800;\n\nconst ACCEPT_MAP: Record<AcceptType, Record<string, string[]>> = {\n image: { \"image/*\": [\".jpg\", \".jpeg\", \".png\", \".webp\"] },\n pdf: { \"application/pdf\": [\".pdf\"] },\n doc: {\n \"application/msword\": [\".doc\"],\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\": [\".docx\"],\n },\n excel: {\n \"application/vnd.ms-excel\": [\".xls\"],\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\": [\".xlsx\"],\n },\n text: { \"text/plain\": [\".txt\"] },\n all: {},\n};\n\nconst formatFileSize = (bytes: number) => {\n if (bytes === 0) return \"0 B\";\n const i = Math.floor(Math.log(bytes) / Math.log(FILE_SIZE_KB));\n return `${(bytes / Math.pow(FILE_SIZE_KB, i)).toFixed(2)} ${FILE_SIZE_UNITS[i]}`;\n};\n\nconst fileAcceptMap = (accepts: AcceptType[]): Record<string, string[]> =>\n accepts.reduce((acc, t) => ({ ...acc, ...ACCEPT_MAP[t] }), {});\n\nconst getFileType = (file: UploadedFileData) => {\n const ext = file.name.split(\".\").pop()?.toLowerCase();\n\n if (!ext) return \"other\";\n\n if ([\"jpg\", \"jpeg\", \"png\", \"webp\"].includes(ext)) return \"image\";\n if (ext === \"pdf\") return \"pdf\";\n if ([\"doc\", \"docx\"].includes(ext)) return \"doc\";\n if ([\"xls\", \"xlsx\"].includes(ext)) return \"excel\";\n if (ext === \"txt\") return \"text\";\n\n return \"other\";\n};\n\nexport const FilesUploader = ({\n value = null,\n onChange,\n multiple = false,\n maxFiles = DEFAULT_MAX_FILES,\n disabled = false,\n className,\n maxSize = DEFAULT_MAX_SIZE,\n variant = \"grid\",\n accepts = DEFAULT_ACCEPT,\n icon,\n title,\n text,\n showFiles = true,\n}: PropsFilesUploader) => {\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const files = Array.isArray(value) ? value : value ? [value] : [];\n \n\n const onDrop = useCallback(\n (acceptedFiles: File[], rejectedFiles: FileRejection[]) => {\n setError(null);\n\n if (files.length + acceptedFiles.length > maxFiles) {\n setError(`Максимальное количество файлов: ${maxFiles}`);\n return;\n }\n\n if (rejectedFiles.length > 0) {\n const rejection = rejectedFiles[0];\n const errorMessage =\n rejection.errors[0]?.code === \"file-too-large\"\n ? `Файл слишком большой. Максимальный размер: ${maxSize / 1024 / 1024}MB`\n : \"Неподдерживаемый формат файла\";\n setError(errorMessage);\n return;\n }\n\n setLoading(true);\n\n setTimeout(() => {\n const newFilesData: UploadedFileData[] = acceptedFiles.map((file) => ({\n url: URL.createObjectURL(file),\n name: file.name,\n size: formatFileSize(file.size),\n addedAt: new Date().toISOString(),\n }));\n\n if (multiple) {\n onChange?.([...files, ...newFilesData]);\n } else {\n if (files[0]?.url?.startsWith(\"blob:\")) URL.revokeObjectURL(files[0].url);\n onChange?.(newFilesData[0] ?? null);\n }\n\n setLoading(false);\n }, DEFAULT_TIMEOUT);\n },\n [files, maxFiles, maxSize, multiple, onChange],\n );\n\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n onDrop,\n accept: fileAcceptMap(accepts),\n maxSize,\n multiple: multiple && maxFiles > 1,\n disabled: disabled || loading,\n maxFiles: maxFiles - files.length,\n });\n\n const removeImage = (index: number) => {\n return () => {\n if (files[index]?.url?.startsWith(\"blob:\")) {\n URL.revokeObjectURL(files[index].url);\n }\n const newFiles = files.filter((_, i) => i !== index);\n onChange?.(multiple ? newFiles : newFiles[0] || null);\n };\n };\n\n const isMaxFilesReached = files.length >= maxFiles;\n\n // Варианты отображения\n const gridClasses = {\n grid: \"grid-cols-2 sm:grid-cols-3 md:grid-cols-4\",\n list: \"grid-cols-1\",\n compact: \"grid-cols-2 sm:grid-cols-3\",\n };\n\n return (\n <div className={cn(\"w-full space-y-4\", className?.container)}>\n {/* Предпросмотр с возможностью добавления новых */}\n <div\n className={cn(\n \"grid h-full w-full gap-4\",\n variant === \"list\" ? \"grid-cols-1\" : gridClasses[variant],\n )}\n >\n {showFiles && files.map((file, index) => {\n const type = getFileType(file);\n\n return (\n <div\n key={index}\n className=\"group bg-primary-bg relative aspect-square h-full w-full\n overflow-hidden rounded-lg\"\n >\n {type === \"image\" ? (\n <img\n src={file.url}\n alt={`Preview ${index + 1}`}\n className=\"h-full w-full object-cover\"\n />\n ) : (\n <div\n className=\"flex h-full w-full items-center justify-center bg-gray-100\n text-sm font-semibold\"\n >\n {file.name.split(\".\").pop()?.toUpperCase()}\n </div>\n )}\n\n <div\n className=\"text-primary-bg bg-primary-inverse-bg/50 absolute inset-0 flex\n cursor-pointer items-center justify-center rounded-lg opacity-0\n transition-opacity hover:opacity-100\"\n onClick={(e) => e.stopPropagation()}\n >\n <Icon\n type=\"close\"\n onClick={removeImage(index)}\n />\n </div>\n </div>\n );\n })}\n {/* Кнопка добавления нового изображения */}\n {(!isMaxFilesReached || !showFiles) && (\n <div\n {...getRootProps()}\n className={cn(\n `relative flex cursor-pointer flex-col items-center justify-center\n rounded-lg border-2 border-dashed border-gray-300 bg-gray-50\n transition-colors hover:bg-gray-100`,\n isDragActive && \"border-primary bg-primary/5\",\n (disabled || loading) && \"cursor-not-allowed opacity-50\",\n variant === \"list\" ? \"min-h-37.5\" : \"aspect-square\",\n className?.blockAdd,\n )}\n >\n <input {...getInputProps()} />\n\n {loading ? (\n <Icon\n type=\"loader\"\n className=\"text-sub-label-text h-8 w-8 animate-spin\"\n />\n ) : (\n <div className=\"flex flex-col items-center space-y-2 p-4 text-center\">\n <Icon\n type={icon?.type ?? \"plus\"}\n className={cn(\"text-sub-label-text h-8 w-8\", className?.icon)}\n />\n <Typography\n variant=\"body-md-medium\"\n className={cn(\"text-sub-label-text\", className?.title)}\n >\n {multiple\n ? `${title || \"Добавить\"} (${files.length}/${maxFiles})`\n : `${title || \"Добавить\"}`}\n </Typography>\n {text && (\n <Typography variant=\"body-xxs-medium\" className={cn(\"text-sub-label-text\", className?.text)}>\n {text}\n </Typography>\n )}\n </div>\n )}\n </div>\n )}\n </div>\n\n {/* Информация о количестве */}\n {/* {multiple && images.length > 0 && (\n <p className=\"text-xs text-gray-500\">\n Загружено {images.length} из {maxFiles} изображений\n </p>\n )} */}\n\n {/* Ошибка */}\n {error && (\n <div className=\"rounded-lg bg-red-50 p-3 text-sm text-red-600\">{error}</div>\n )}\n </div>\n );\n};\n\nexport type { PropsFilesUploader, UploadedFileData, FilesUploaderValue };\n\n"],"names":["FILE_SIZE_UNITS","FILE_SIZE_KB","DEFAULT_MAX_SIZE","DEFAULT_MAX_FILES","DEFAULT_ACCEPT","DEFAULT_TIMEOUT","ACCEPT_MAP","formatFileSize","bytes","i","fileAcceptMap","accepts","acc","t","getFileType","file","ext","FilesUploader","value","onChange","multiple","maxFiles","disabled","className","maxSize","variant","icon","title","text","showFiles","loading","setLoading","useState","error","setError","files","onDrop","useCallback","acceptedFiles","rejectedFiles","errorMessage","newFilesData","getRootProps","getInputProps","isDragActive","useDropzone","removeImage","index","newFiles","_","isMaxFilesReached","gridClasses","cn","jsxs","type","jsx","e","Icon","Typography"],"mappings":"qWAuCA,MAAMA,EAAkB,CAAC,IAAK,KAAM,KAAM,KAAM,IAAI,EAC9CC,EAAe,KACfC,EAAmB,EAAID,EAAeA,EACtCE,EAAoB,EACpBC,EAA+B,CAAC,KAAK,EACrCC,EAAkB,IAElBC,EAA2D,CAC/D,MAAO,CAAE,UAAW,CAAC,OAAQ,QAAS,OAAQ,OAAO,CAAA,EACrD,IAAK,CAAE,kBAAmB,CAAC,MAAM,CAAA,EACjC,IAAK,CACH,qBAAsB,CAAC,MAAM,EAC7B,0EAA2E,CAAC,OAAO,CAAA,EAErF,MAAO,CACL,2BAA4B,CAAC,MAAM,EACnC,oEAAqE,CAAC,OAAO,CAAA,EAE/E,KAAM,CAAE,aAAc,CAAC,MAAM,CAAA,EAC7B,IAAK,CAAA,CACP,EAEMC,EAAkBC,GAAkB,CACxC,GAAIA,IAAU,EAAG,MAAO,MACxB,MAAMC,EAAI,KAAK,MAAM,KAAK,IAAID,CAAK,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8BAA+B7B,GAAW,IAAI,CAAA,CAAA,EAE9DgC,EAAAA,IAACG,EAAAA,WAAA,CACC,QAAQ,iBACR,UAAWN,EAAAA,GAAG,sBAAuB7B,GAAW,KAAK,EAEpD,SAAAH,EACG,GAAGO,GAAS,UAAU,KAAKQ,EAAM,MAAM,IAAId,CAAQ,IACnD,GAAGM,GAAS,UAAU,EAAA,CAAA,EAE3BC,GACC2B,EAAAA,IAACG,EAAAA,WAAA,CAAW,QAAQ,kBAAkB,UAAWN,EAAAA,GAAG,sBAAuB7B,GAAW,IAAI,EACvF,SAAAK,CAAA,CACH,CAAA,CAAA,CAEJ,CAAA,CAAA,CAAA,CAEJ,CAAA,CAAA,EAYHK,GACCsB,EAAAA,IAAC,MAAA,CAAI,UAAU,gDAAiD,SAAAtB,CAAA,CAAM,CAAA,EAE1E,CAEJ"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { jsxs as u, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { cn as d } from "./lib-utils.js";
|
|
3
|
+
import { useState as E, useCallback as C } from "react";
|
|
4
|
+
import { u as P } from "./index-B5Id-jNC.js";
|
|
5
|
+
import { Icon as x } from "./components-ui-icon-icon.js";
|
|
6
|
+
import { Typography as U } from "./components-ui-typography-typography.js";
|
|
7
|
+
import "./components-ui-typography-typography.styles.js";
|
|
8
|
+
const S = ["B", "KB", "MB", "GB", "TB"], m = 1024, k = 5 * m * m, F = 5, O = ["all"], Z = 800, q = {
|
|
9
|
+
image: { "image/*": [".jpg", ".jpeg", ".png", ".webp"] },
|
|
10
|
+
pdf: { "application/pdf": [".pdf"] },
|
|
11
|
+
doc: {
|
|
12
|
+
"application/msword": [".doc"],
|
|
13
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": [".docx"]
|
|
14
|
+
},
|
|
15
|
+
excel: {
|
|
16
|
+
"application/vnd.ms-excel": [".xls"],
|
|
17
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"]
|
|
18
|
+
},
|
|
19
|
+
text: { "text/plain": [".txt"] },
|
|
20
|
+
all: {}
|
|
21
|
+
}, z = (t) => {
|
|
22
|
+
if (t === 0) return "0 B";
|
|
23
|
+
const e = Math.floor(Math.log(t) / Math.log(m));
|
|
24
|
+
return `${(t / Math.pow(m, e)).toFixed(2)} ${S[e]}`;
|
|
25
|
+
}, K = (t) => t.reduce((e, c) => ({ ...e, ...q[c] }), {}), W = (t) => {
|
|
26
|
+
const e = t.name.split(".").pop()?.toLowerCase();
|
|
27
|
+
return e ? ["jpg", "jpeg", "png", "webp"].includes(e) ? "image" : e === "pdf" ? "pdf" : ["doc", "docx"].includes(e) ? "doc" : ["xls", "xlsx"].includes(e) ? "excel" : e === "txt" ? "text" : "other" : "other";
|
|
28
|
+
}, ee = ({
|
|
29
|
+
value: t = null,
|
|
30
|
+
onChange: e,
|
|
31
|
+
multiple: c = !1,
|
|
32
|
+
maxFiles: i = F,
|
|
33
|
+
disabled: y = !1,
|
|
34
|
+
className: p,
|
|
35
|
+
maxSize: g = k,
|
|
36
|
+
variant: f = "grid",
|
|
37
|
+
accepts: M = O,
|
|
38
|
+
icon: T,
|
|
39
|
+
title: v,
|
|
40
|
+
text: w,
|
|
41
|
+
showFiles: A = !0
|
|
42
|
+
}) => {
|
|
43
|
+
const [b, L] = E(!1), [j, h] = E(null), r = Array.isArray(t) ? t : t ? [t] : [], I = C(
|
|
44
|
+
(o, l) => {
|
|
45
|
+
if (h(null), r.length + o.length > i) {
|
|
46
|
+
h(`Максимальное количество файлов: ${i}`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (l.length > 0) {
|
|
50
|
+
const n = l[0].errors[0]?.code === "file-too-large" ? `Файл слишком большой. Максимальный размер: ${g / 1024 / 1024}MB` : "Неподдерживаемый формат файла";
|
|
51
|
+
h(n);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
L(!0), setTimeout(() => {
|
|
55
|
+
const a = o.map((n) => ({
|
|
56
|
+
url: URL.createObjectURL(n),
|
|
57
|
+
name: n.name,
|
|
58
|
+
size: z(n.size),
|
|
59
|
+
addedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
60
|
+
}));
|
|
61
|
+
c ? e?.([...r, ...a]) : (r[0]?.url?.startsWith("blob:") && URL.revokeObjectURL(r[0].url), e?.(a[0] ?? null)), L(!1);
|
|
62
|
+
}, Z);
|
|
63
|
+
},
|
|
64
|
+
[r, i, g, c, e]
|
|
65
|
+
), { getRootProps: _, getInputProps: N, isDragActive: D } = P({
|
|
66
|
+
onDrop: I,
|
|
67
|
+
accept: K(M),
|
|
68
|
+
maxSize: g,
|
|
69
|
+
multiple: c && i > 1,
|
|
70
|
+
disabled: y || b,
|
|
71
|
+
maxFiles: i - r.length
|
|
72
|
+
}), $ = (o) => () => {
|
|
73
|
+
r[o]?.url?.startsWith("blob:") && URL.revokeObjectURL(r[o].url);
|
|
74
|
+
const l = r.filter((a, n) => n !== o);
|
|
75
|
+
e?.(c ? l : l[0] || null);
|
|
76
|
+
}, B = r.length >= i, R = {
|
|
77
|
+
grid: "grid-cols-2 sm:grid-cols-3 md:grid-cols-4",
|
|
78
|
+
list: "grid-cols-1",
|
|
79
|
+
compact: "grid-cols-2 sm:grid-cols-3"
|
|
80
|
+
};
|
|
81
|
+
return /* @__PURE__ */ u("div", { className: d("w-full space-y-4", p?.container), children: [
|
|
82
|
+
/* @__PURE__ */ u(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
className: d(
|
|
86
|
+
"grid h-full w-full gap-4",
|
|
87
|
+
f === "list" ? "grid-cols-1" : R[f]
|
|
88
|
+
),
|
|
89
|
+
children: [
|
|
90
|
+
A && r.map((o, l) => {
|
|
91
|
+
const a = W(o);
|
|
92
|
+
return /* @__PURE__ */ u(
|
|
93
|
+
"div",
|
|
94
|
+
{
|
|
95
|
+
className: `group bg-primary-bg relative aspect-square h-full w-full
|
|
96
|
+
overflow-hidden rounded-lg`,
|
|
97
|
+
children: [
|
|
98
|
+
a === "image" ? /* @__PURE__ */ s(
|
|
99
|
+
"img",
|
|
100
|
+
{
|
|
101
|
+
src: o.url,
|
|
102
|
+
alt: `Preview ${l + 1}`,
|
|
103
|
+
className: "h-full w-full object-cover"
|
|
104
|
+
}
|
|
105
|
+
) : /* @__PURE__ */ s(
|
|
106
|
+
"div",
|
|
107
|
+
{
|
|
108
|
+
className: `flex h-full w-full items-center justify-center bg-gray-100
|
|
109
|
+
text-sm font-semibold`,
|
|
110
|
+
children: o.name.split(".").pop()?.toUpperCase()
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ s(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
className: `text-primary-bg bg-primary-inverse-bg/50 absolute inset-0 flex
|
|
117
|
+
cursor-pointer items-center justify-center rounded-lg opacity-0
|
|
118
|
+
transition-opacity hover:opacity-100`,
|
|
119
|
+
onClick: (n) => n.stopPropagation(),
|
|
120
|
+
children: /* @__PURE__ */ s(
|
|
121
|
+
x,
|
|
122
|
+
{
|
|
123
|
+
type: "close",
|
|
124
|
+
onClick: $(l)
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
l
|
|
132
|
+
);
|
|
133
|
+
}),
|
|
134
|
+
(!B || !A) && /* @__PURE__ */ u(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
..._(),
|
|
138
|
+
className: d(
|
|
139
|
+
`relative flex cursor-pointer flex-col items-center justify-center
|
|
140
|
+
rounded-lg border-2 border-dashed border-gray-300 bg-gray-50
|
|
141
|
+
transition-colors hover:bg-gray-100`,
|
|
142
|
+
D && "border-primary bg-primary/5",
|
|
143
|
+
(y || b) && "cursor-not-allowed opacity-50",
|
|
144
|
+
f === "list" ? "min-h-37.5" : "aspect-square",
|
|
145
|
+
p?.blockAdd
|
|
146
|
+
),
|
|
147
|
+
children: [
|
|
148
|
+
/* @__PURE__ */ s("input", { ...N() }),
|
|
149
|
+
b ? /* @__PURE__ */ s(
|
|
150
|
+
x,
|
|
151
|
+
{
|
|
152
|
+
type: "loader",
|
|
153
|
+
className: "text-sub-label-text h-8 w-8 animate-spin"
|
|
154
|
+
}
|
|
155
|
+
) : /* @__PURE__ */ u("div", { className: "flex flex-col items-center space-y-2 p-4 text-center", children: [
|
|
156
|
+
/* @__PURE__ */ s(
|
|
157
|
+
x,
|
|
158
|
+
{
|
|
159
|
+
type: T?.type ?? "plus",
|
|
160
|
+
className: d("text-sub-label-text h-8 w-8", p?.icon)
|
|
161
|
+
}
|
|
162
|
+
),
|
|
163
|
+
/* @__PURE__ */ s(
|
|
164
|
+
U,
|
|
165
|
+
{
|
|
166
|
+
variant: "body-md-medium",
|
|
167
|
+
className: d("text-sub-label-text", p?.title),
|
|
168
|
+
children: c ? `${v || "Добавить"} (${r.length}/${i})` : `${v || "Добавить"}`
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
w && /* @__PURE__ */ s(U, { variant: "body-xxs-medium", className: d("text-sub-label-text", p?.text), children: w })
|
|
172
|
+
] })
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
),
|
|
179
|
+
j && /* @__PURE__ */ s("div", { className: "rounded-lg bg-red-50 p-3 text-sm text-red-600", children: j })
|
|
180
|
+
] });
|
|
181
|
+
};
|
|
182
|
+
export {
|
|
183
|
+
ee as FilesUploader
|
|
184
|
+
};
|
|
185
|
+
//# sourceMappingURL=components-files-uploader-files-uploader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-files-uploader-files-uploader.js","sources":["../src/components/files-uploader/files-uploader.tsx"],"sourcesContent":["import { cn } from \"@/lib/utils\";\nimport { useCallback, useState } from \"react\";\nimport { type FileRejection, useDropzone } from \"react-dropzone\";\nimport { Icon, type IconProps } from \"../ui/icon\";\nimport { Typography } from \"../ui/typography\";\n\ntype Variant = \"grid\" | \"list\" | \"compact\";\ntype AcceptType = \"image\" | \"pdf\" | \"doc\" | \"excel\" | \"text\" | \"all\";\ntype UploadedFileData = {\n url: string;\n name: string;\n size: string;\n addedAt: string;\n};\ntype FilesUploaderValue = UploadedFileData | UploadedFileData[] | null;\n\ntype PropsFilesUploader = {\n value?: FilesUploaderValue;\n onChange?: (value: FilesUploaderValue) => void;\n multiple?: boolean;\n maxFiles?: number;\n disabled?: boolean;\n className?: {\n container?: string;\n blockAdd?: string;\n title?: string;\n text?: string;\n icon?: string;\n };\n displayFiles?: boolean;\n maxSize?: number;\n variant?: Variant;\n accepts?: AcceptType[];\n icon?: IconProps;\n title?: string;\n text?: string;\n showFiles?: boolean,\n \n};\nconst FILE_SIZE_UNITS = [\"B\", \"KB\", \"MB\", \"GB\", \"TB\"];\nconst FILE_SIZE_KB = 1024;\nconst DEFAULT_MAX_SIZE = 5 * FILE_SIZE_KB * FILE_SIZE_KB;\nconst DEFAULT_MAX_FILES = 5;\nconst DEFAULT_ACCEPT: AcceptType[] = [\"all\"];\nconst DEFAULT_TIMEOUT = 800;\n\nconst ACCEPT_MAP: Record<AcceptType, Record<string, string[]>> = {\n image: { \"image/*\": [\".jpg\", \".jpeg\", \".png\", \".webp\"] },\n pdf: { \"application/pdf\": [\".pdf\"] },\n doc: {\n \"application/msword\": [\".doc\"],\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\": [\".docx\"],\n },\n excel: {\n \"application/vnd.ms-excel\": [\".xls\"],\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\": [\".xlsx\"],\n },\n text: { \"text/plain\": [\".txt\"] },\n all: {},\n};\n\nconst formatFileSize = (bytes: number) => {\n if (bytes === 0) return \"0 B\";\n const i = Math.floor(Math.log(bytes) / Math.log(FILE_SIZE_KB));\n return `${(bytes / Math.pow(FILE_SIZE_KB, i)).toFixed(2)} ${FILE_SIZE_UNITS[i]}`;\n};\n\nconst fileAcceptMap = (accepts: AcceptType[]): Record<string, string[]> =>\n accepts.reduce((acc, t) => ({ ...acc, ...ACCEPT_MAP[t] }), {});\n\nconst getFileType = (file: UploadedFileData) => {\n const ext = file.name.split(\".\").pop()?.toLowerCase();\n\n if (!ext) return \"other\";\n\n if ([\"jpg\", \"jpeg\", \"png\", \"webp\"].includes(ext)) return \"image\";\n if (ext === \"pdf\") return \"pdf\";\n if ([\"doc\", \"docx\"].includes(ext)) return \"doc\";\n if ([\"xls\", \"xlsx\"].includes(ext)) return \"excel\";\n if (ext === \"txt\") return \"text\";\n\n return \"other\";\n};\n\nexport const FilesUploader = ({\n value = null,\n onChange,\n multiple = false,\n maxFiles = DEFAULT_MAX_FILES,\n disabled = false,\n className,\n maxSize = DEFAULT_MAX_SIZE,\n variant = \"grid\",\n accepts = DEFAULT_ACCEPT,\n icon,\n title,\n text,\n showFiles = true,\n}: PropsFilesUploader) => {\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const files = Array.isArray(value) ? value : value ? [value] : [];\n \n\n const onDrop = useCallback(\n (acceptedFiles: File[], rejectedFiles: FileRejection[]) => {\n setError(null);\n\n if (files.length + acceptedFiles.length > maxFiles) {\n setError(`Максимальное количество файлов: ${maxFiles}`);\n return;\n }\n\n if (rejectedFiles.length > 0) {\n const rejection = rejectedFiles[0];\n const errorMessage =\n rejection.errors[0]?.code === \"file-too-large\"\n ? `Файл слишком большой. Максимальный размер: ${maxSize / 1024 / 1024}MB`\n : \"Неподдерживаемый формат файла\";\n setError(errorMessage);\n return;\n }\n\n setLoading(true);\n\n setTimeout(() => {\n const newFilesData: UploadedFileData[] = acceptedFiles.map((file) => ({\n url: URL.createObjectURL(file),\n name: file.name,\n size: formatFileSize(file.size),\n addedAt: new Date().toISOString(),\n }));\n\n if (multiple) {\n onChange?.([...files, ...newFilesData]);\n } else {\n if (files[0]?.url?.startsWith(\"blob:\")) URL.revokeObjectURL(files[0].url);\n onChange?.(newFilesData[0] ?? null);\n }\n\n setLoading(false);\n }, DEFAULT_TIMEOUT);\n },\n [files, maxFiles, maxSize, multiple, onChange],\n );\n\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n onDrop,\n accept: fileAcceptMap(accepts),\n maxSize,\n multiple: multiple && maxFiles > 1,\n disabled: disabled || loading,\n maxFiles: maxFiles - files.length,\n });\n\n const removeImage = (index: number) => {\n return () => {\n if (files[index]?.url?.startsWith(\"blob:\")) {\n URL.revokeObjectURL(files[index].url);\n }\n const newFiles = files.filter((_, i) => i !== index);\n onChange?.(multiple ? newFiles : newFiles[0] || null);\n };\n };\n\n const isMaxFilesReached = files.length >= maxFiles;\n\n // Варианты отображения\n const gridClasses = {\n grid: \"grid-cols-2 sm:grid-cols-3 md:grid-cols-4\",\n list: \"grid-cols-1\",\n compact: \"grid-cols-2 sm:grid-cols-3\",\n };\n\n return (\n <div className={cn(\"w-full space-y-4\", className?.container)}>\n {/* Предпросмотр с возможностью добавления новых */}\n <div\n className={cn(\n \"grid h-full w-full gap-4\",\n variant === \"list\" ? \"grid-cols-1\" : gridClasses[variant],\n )}\n >\n {showFiles && files.map((file, index) => {\n const type = getFileType(file);\n\n return (\n <div\n key={index}\n className=\"group bg-primary-bg relative aspect-square h-full w-full\n overflow-hidden rounded-lg\"\n >\n {type === \"image\" ? (\n <img\n src={file.url}\n alt={`Preview ${index + 1}`}\n className=\"h-full w-full object-cover\"\n />\n ) : (\n <div\n className=\"flex h-full w-full items-center justify-center bg-gray-100\n text-sm font-semibold\"\n >\n {file.name.split(\".\").pop()?.toUpperCase()}\n </div>\n )}\n\n <div\n className=\"text-primary-bg bg-primary-inverse-bg/50 absolute inset-0 flex\n cursor-pointer items-center justify-center rounded-lg opacity-0\n transition-opacity hover:opacity-100\"\n onClick={(e) => e.stopPropagation()}\n >\n <Icon\n type=\"close\"\n onClick={removeImage(index)}\n />\n </div>\n </div>\n );\n })}\n {/* Кнопка добавления нового изображения */}\n {(!isMaxFilesReached || !showFiles) && (\n <div\n {...getRootProps()}\n className={cn(\n `relative flex cursor-pointer flex-col items-center justify-center\n rounded-lg border-2 border-dashed border-gray-300 bg-gray-50\n transition-colors hover:bg-gray-100`,\n isDragActive && \"border-primary bg-primary/5\",\n (disabled || loading) && \"cursor-not-allowed opacity-50\",\n variant === \"list\" ? \"min-h-37.5\" : \"aspect-square\",\n className?.blockAdd,\n )}\n >\n <input {...getInputProps()} />\n\n {loading ? (\n <Icon\n type=\"loader\"\n className=\"text-sub-label-text h-8 w-8 animate-spin\"\n />\n ) : (\n <div className=\"flex flex-col items-center space-y-2 p-4 text-center\">\n <Icon\n type={icon?.type ?? \"plus\"}\n className={cn(\"text-sub-label-text h-8 w-8\", className?.icon)}\n />\n <Typography\n variant=\"body-md-medium\"\n className={cn(\"text-sub-label-text\", className?.title)}\n >\n {multiple\n ? `${title || \"Добавить\"} (${files.length}/${maxFiles})`\n : `${title || \"Добавить\"}`}\n </Typography>\n {text && (\n <Typography variant=\"body-xxs-medium\" className={cn(\"text-sub-label-text\", className?.text)}>\n {text}\n </Typography>\n )}\n </div>\n )}\n </div>\n )}\n </div>\n\n {/* Информация о количестве */}\n {/* {multiple && images.length > 0 && (\n <p className=\"text-xs text-gray-500\">\n Загружено {images.length} из {maxFiles} изображений\n </p>\n )} */}\n\n {/* Ошибка */}\n {error && (\n <div className=\"rounded-lg bg-red-50 p-3 text-sm text-red-600\">{error}</div>\n )}\n </div>\n );\n};\n\nexport type { PropsFilesUploader, UploadedFileData, FilesUploaderValue };\n\n"],"names":["FILE_SIZE_UNITS","FILE_SIZE_KB","DEFAULT_MAX_SIZE","DEFAULT_MAX_FILES","DEFAULT_ACCEPT","DEFAULT_TIMEOUT","ACCEPT_MAP","formatFileSize","bytes","i","fileAcceptMap","accepts","acc","t","getFileType","file","ext","FilesUploader","value","onChange","multiple","maxFiles","disabled","className","maxSize","variant","icon","title","text","showFiles","loading","setLoading","useState","error","setError","files","onDrop","useCallback","acceptedFiles","rejectedFiles","errorMessage","newFilesData","getRootProps","getInputProps","isDragActive","useDropzone","removeImage","index","newFiles","_","isMaxFilesReached","gridClasses","cn","jsxs","type","jsx","e","Icon","Typography"],"mappings":";;;;;;;AAuCA,MAAMA,IAAkB,CAAC,KAAK,MAAM,MAAM,MAAM,IAAI,GAC9CC,IAAe,MACfC,IAAmB,IAAID,IAAeA,GACtCE,IAAoB,GACpBC,IAA+B,CAAC,KAAK,GACrCC,IAAkB,KAElBC,IAA2D;AAAA,EAC/D,OAAO,EAAE,WAAW,CAAC,QAAQ,SAAS,QAAQ,OAAO,EAAA;AAAA,EACrD,KAAK,EAAE,mBAAmB,CAAC,MAAM,EAAA;AAAA,EACjC,KAAK;AAAA,IACH,sBAAsB,CAAC,MAAM;AAAA,IAC7B,2EAA2E,CAAC,OAAO;AAAA,EAAA;AAAA,EAErF,OAAO;AAAA,IACL,4BAA4B,CAAC,MAAM;AAAA,IACnC,qEAAqE,CAAC,OAAO;AAAA,EAAA;AAAA,EAE/E,MAAM,EAAE,cAAc,CAAC,MAAM,EAAA;AAAA,EAC7B,KAAK,CAAA;AACP,GAEMC,IAAiB,CAACC,MAAkB;AACxC,MAAIA,MAAU,EAAG,QAAO;AACxB,QAAMC,IAAI,KAAK,MAAM,KAAK,IAAID,CAAK,IAAI,KAAK,IAAIP,CAAY,CAAC;AAC7D,SAAO,IAAIO,IAAQ,KAAK,IAAIP,GAAcQ,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAIT,EAAgBS,CAAC,CAAC;AAChF,GAEMC,IAAgB,CAACC,MACrBA,EAAQ,OAAO,CAACC,GAAKC,OAAO,EAAE,GAAGD,GAAK,GAAGN,EAAWO,CAAC,EAAA,IAAM,CAAA,CAAE,GAEzDC,IAAc,CAACC,MAA2B;AAC9C,QAAMC,IAAMD,EAAK,KAAK,MAAM,GAAG,EAAE,IAAA,GAAO,YAAA;AAExC,SAAKC,IAED,CAAC,OAAO,QAAQ,OAAO,MAAM,EAAE,SAASA,CAAG,IAAU,UACrDA,MAAQ,QAAc,QACt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BACC,MAAK;AAAA,oBACL,WAAU;AAAA,kBAAA;AAAA,gBAAA,IAGZ,gBAAAJ,EAAC,OAAA,EAAI,WAAU,wDACb,UAAA;AAAA,kBAAA,gBAAAE;AAAA,oBAACE;AAAA,oBAAA;AAAA,sBACC,MAAM/B,GAAM,QAAQ;AAAA,sBACpB,WAAW0B,EAAG,+BAA+B7B,GAAW,IAAI;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAE9D,gBAAAgC;AAAA,oBAACG;AAAA,oBAAA;AAAA,sBACC,SAAQ;AAAA,sBACR,WAAWN,EAAG,uBAAuB7B,GAAW,KAAK;AAAA,sBAEpD,UAAAH,IACG,GAAGO,KAAS,UAAU,KAAKQ,EAAM,MAAM,IAAId,CAAQ,MACnD,GAAGM,KAAS,UAAU;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAE3BC,KACC,gBAAA2B,EAACG,GAAA,EAAW,SAAQ,mBAAkB,WAAWN,EAAG,uBAAuB7B,GAAW,IAAI,GACvF,UAAAK,EAAA,CACH;AAAA,gBAAA,EAAA,CAEJ;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,IAYHK,KACC,gBAAAsB,EAAC,OAAA,EAAI,WAAU,iDAAiD,UAAAtB,EAAA,CAAM;AAAA,EAAA,GAE1E;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-files-uploader.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as r, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { FieldSet as c, FieldGroup as f, Field as h, FieldLabel as F, FieldDescription as I } from "./components-ui-field-field.js";
|
|
4
|
+
import { Input as s } from "./components-ui-input-input.js";
|
|
5
|
+
import { InputGroup as G, InputGroupInput as g, InputGroupAddon as v } from "./components-ui-input-group-input-group.js";
|
|
6
|
+
const L = ({
|
|
7
|
+
date: p = [],
|
|
8
|
+
isValid: e,
|
|
9
|
+
disabled: i = !1,
|
|
10
|
+
label: l,
|
|
11
|
+
description: u,
|
|
12
|
+
classes: t,
|
|
13
|
+
ref: m,
|
|
14
|
+
...a
|
|
15
|
+
}) => {
|
|
16
|
+
const o = {
|
|
17
|
+
...e === !0 && !i && { "aria-valid": !0 },
|
|
18
|
+
...e === !1 && !i && { "aria-invalid": !0 },
|
|
19
|
+
disabled: i
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ r(c, { className: t?.fieldset, children: /* @__PURE__ */ r(f, { className: t?.fieldgroup, children: /* @__PURE__ */ d(h, { className: t?.field, children: [
|
|
22
|
+
l && /* @__PURE__ */ r(F, { ...o, children: l }),
|
|
23
|
+
p.length > 0 ? /* @__PURE__ */ d(G, { "data-slot": !0, children: [
|
|
24
|
+
/* @__PURE__ */ r(
|
|
25
|
+
g,
|
|
26
|
+
{
|
|
27
|
+
ref: m,
|
|
28
|
+
...a,
|
|
29
|
+
...o,
|
|
30
|
+
disabled: i
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
p.map((n) => /* @__PURE__ */ r(
|
|
34
|
+
v,
|
|
35
|
+
{
|
|
36
|
+
align: n.position,
|
|
37
|
+
children: n.component
|
|
38
|
+
},
|
|
39
|
+
n.id
|
|
40
|
+
))
|
|
41
|
+
] }) : /* @__PURE__ */ r(
|
|
42
|
+
s,
|
|
43
|
+
{
|
|
44
|
+
ref: m,
|
|
45
|
+
...a,
|
|
46
|
+
...o,
|
|
47
|
+
disabled: i
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
u && /* @__PURE__ */ r(I, { ...o, children: u })
|
|
51
|
+
] }) }) });
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
L as InputField
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=components-input-field-input-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-input-field-input-field.js","sources":["../src/components/input-field/input-field.tsx"],"sourcesContent":["import React from \"react\";\nimport { Field, FieldDescription, FieldGroup, FieldLabel, FieldSet } from \"../ui/field\";\nimport { Input } from \"../ui/input\";\nimport { InputGroup, InputGroupAddon, InputGroupInput } from \"../ui/input-group\";\n\nexport type DateAddon = {\n id: string | number;\n position?: \"inline-start\" | \"inline-end\" | \"block-start\" | \"block-end\" | null;\n component: React.ReactNode;\n};\n\ntype BaseProps = {\n date?: DateAddon[];\n isValid?: boolean;\n label?: string;\n description?: string;\n classes?: {\n fieldset?: string;\n fieldgroup?: string;\n field?: string;\n };\n};\n\ntype InputFieldProps = BaseProps & React.ComponentPropsWithRef<\"input\">;\n\nexport const InputField = ({\n date = [],\n isValid,\n disabled = false,\n label,\n description,\n classes,\n ref,\n ...rest\n}: InputFieldProps) => {\n const validationProps = {\n ...(isValid === true && !disabled && { \"aria-valid\": true }),\n ...(isValid === false && !disabled && { \"aria-invalid\": true }),\n disabled,\n };\n\n return (\n <FieldSet className={classes?.fieldset}>\n <FieldGroup className={classes?.fieldgroup}>\n <Field className={classes?.field}>\n {label && <FieldLabel {...validationProps}>{label}</FieldLabel>}\n {date.length > 0 ? (\n <InputGroup data-slot>\n <InputGroupInput\n ref={ref}\n {...rest}\n {...validationProps}\n disabled={disabled}\n />\n {date.map((e) => (\n <InputGroupAddon\n key={e.id}\n align={e.position}\n >\n {e.component}\n </InputGroupAddon>\n ))}\n </InputGroup>\n ) : (\n <Input\n ref={ref}\n {...rest}\n {...validationProps}\n disabled={disabled}\n />\n )}\n {description && (\n <FieldDescription {...validationProps}>{description}</FieldDescription>\n )}\n </Field>\n </FieldGroup>\n </FieldSet>\n );\n};\n\ntype InputProps = InputFieldProps;\n\nexport type { InputFieldProps, InputProps };\n"],"names":["InputField","date","isValid","disabled","label","description","classes","ref","rest","validationProps","jsx","FieldSet","FieldGroup","jsxs","Field","FieldLabel","InputGroup","InputGroupInput","e","InputGroupAddon","Input","FieldDescription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,GAAkB,UAAAJ,EAAA,CAAY;AAAA,EAAA,EAAA,CAExD,GACF,GACF;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-input-field.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./brd-ui-kit.css');const r=require("react/jsx-runtime");;/* empty css
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./brd-ui-kit.css');const r=require("react/jsx-runtime");;/* empty css */require("./lib-utils.cjs");require("class-variance-authority");require("react");require("./components-ui-badge-badge.styles.cjs");require("./components-ui-button-button.cjs");require("./components-ui-button-button.styles.cjs");require("./components-ui-card-card.cjs");require("./components-ui-checkbox-checkbox.cjs");const q=require("./components-ui-icon-icon.cjs");require("./components-ui-combobox-combobox.cjs");require("./components-ui-dialog-dialog.cjs");require("./components-ui-label-label.cjs");require("./components-ui-separator-separator.cjs");require("./components-ui-field-field.styles.cjs");require("./components-ui-input-input.styles.cjs");require("./components-ui-textarea-textarea.cjs");require("./components-ui-input-group-input-group.styles.cjs");require("./components-ui-navigation-item-navigation-item.styles.cjs");require("./components-ui-navigation-menu-navigation-menu.styles.cjs");require("./components-ui-pagination-pagination.cjs");require("./components-ui-progress-progress.cjs");require("./components-ui-radio-group-radio-group.cjs");require("./components-ui-switch-switch.cjs");require("./components-ui-table-table.cjs");require("./components-ui-tabs-tabs.cjs");require("./components-ui-tooltip-tooltip.cjs");require("./components-ui-typography-typography.styles.cjs");const o=require("./hooks-usePopupControls.cjs");require("lucide-react");require("./components-app-pagination-app-pagination.styles.cjs");require("./components-app-sidebar-app-sidebar.styles.cjs");const n=require("./components-input-field-input-field.cjs");require("./components-select-field-select-field.cjs");require("./lodash-kqhtUJfz.cjs");require("./chart-CgVfpT_X.cjs");require("./index-DGxwh2Ms.cjs");require("./index-fTTv8YY8.cjs");const t=({...i})=>{const{isOpened:e,togglePopup:u}=o.usePopupControls();return r.jsx(n.InputField,{...i,type:e?"text":"password",date:[{id:"0",position:"inline-end",component:r.jsx(q.Icon,{type:e?"eye-off":"eye",onClick:u,className:"cursor-pointer"})}]})};exports.InputPassword=t;
|
|
2
2
|
//# sourceMappingURL=components-input-password-input-password.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components-input-password-input-password.cjs","sources":["../src/components/input-password/input-password.tsx"],"sourcesContent":["import { Icon, InputField, usePopupControls, type InputProps } from \"@/index\";\n\ntype InputPasswordProps = InputProps;\n\nexport const InputPassword: React.FC<InputPasswordProps> = ({ ...rest }) => {\n const { isOpened, togglePopup } = usePopupControls();\n\n return (\n <InputField\n {...rest}\n type={isOpened ? \"text\" : \"password\"}\n date={[\n {\n id: \"0\",\n position: \"inline-end\",\n component: (\n <Icon\n type={isOpened ? \"eye-off\" : \"eye\"}\n onClick={togglePopup}\n className=\"cursor-pointer\"\n />\n ),\n },\n ]}\n />\n );\n};\n\nexport type { InputPasswordProps };\n"],"names":["InputPassword","rest","isOpened","togglePopup","usePopupControls","jsx","InputField","Icon"],"mappings":"
|
|
1
|
+
{"version":3,"file":"components-input-password-input-password.cjs","sources":["../src/components/input-password/input-password.tsx"],"sourcesContent":["import { Icon, InputField, usePopupControls, type InputProps } from \"@/index\";\n\ntype InputPasswordProps = InputProps;\n\nexport const InputPassword: React.FC<InputPasswordProps> = ({ ...rest }) => {\n const { isOpened, togglePopup } = usePopupControls();\n\n return (\n <InputField\n {...rest}\n type={isOpened ? \"text\" : \"password\"}\n date={[\n {\n id: \"0\",\n position: \"inline-end\",\n component: (\n <Icon\n type={isOpened ? \"eye-off\" : \"eye\"}\n onClick={togglePopup}\n className=\"cursor-pointer\"\n />\n ),\n },\n ]}\n />\n );\n};\n\nexport type { InputPasswordProps };\n"],"names":["InputPassword","rest","isOpened","togglePopup","usePopupControls","jsx","InputField","Icon"],"mappings":"g2DAIO,MAAMA,EAA8C,CAAC,CAAE,GAAGC,KAAW,CAC1E,KAAM,CAAE,SAAAC,EAAU,YAAAC,CAAA,EAAgBC,mBAAA,EAElC,OACEC,EAAAA,IAACC,EAAAA,WAAA,CACE,GAAGL,EACJ,KAAMC,EAAW,OAAS,WAC1B,KAAM,CACJ,CACE,GAAI,IACJ,SAAU,aACV,UACEG,EAAAA,IAACE,EAAAA,KAAA,CACC,KAAML,EAAW,UAAY,MAC7B,QAASC,EACT,UAAU,gBAAA,CAAA,CACZ,CAEJ,CACF,CAAA,CAGN"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import './brd-ui-kit.css';/* empty css */
|
|
3
|
+
import "./lib-utils.js";
|
|
4
|
+
import "class-variance-authority";
|
|
5
|
+
import "react";
|
|
6
|
+
import "./components-ui-badge-badge.styles.js";
|
|
7
|
+
import "./components-ui-button-button.js";
|
|
8
|
+
import "./components-ui-button-button.styles.js";
|
|
9
|
+
import "./components-ui-card-card.js";
|
|
10
|
+
import "./components-ui-checkbox-checkbox.js";
|
|
11
|
+
import { Icon as i } from "./components-ui-icon-icon.js";
|
|
12
|
+
import "./components-ui-combobox-combobox.js";
|
|
13
|
+
import "./components-ui-dialog-dialog.js";
|
|
14
|
+
import "./components-ui-label-label.js";
|
|
15
|
+
import "./components-ui-separator-separator.js";
|
|
16
|
+
import "./components-ui-field-field.styles.js";
|
|
17
|
+
import "./components-ui-input-input.styles.js";
|
|
18
|
+
import "./components-ui-textarea-textarea.js";
|
|
19
|
+
import "./components-ui-input-group-input-group.styles.js";
|
|
20
|
+
import "./components-ui-navigation-item-navigation-item.styles.js";
|
|
21
|
+
import "./components-ui-navigation-menu-navigation-menu.styles.js";
|
|
22
|
+
import "./components-ui-pagination-pagination.js";
|
|
23
|
+
import "./components-ui-progress-progress.js";
|
|
24
|
+
import "./components-ui-radio-group-radio-group.js";
|
|
25
|
+
import "./components-ui-switch-switch.js";
|
|
26
|
+
import "./components-ui-table-table.js";
|
|
27
|
+
import "./components-ui-tabs-tabs.js";
|
|
28
|
+
import "./components-ui-tooltip-tooltip.js";
|
|
29
|
+
import "./components-ui-typography-typography.styles.js";
|
|
30
|
+
import { usePopupControls as m } from "./hooks-usePopupControls.js";
|
|
31
|
+
import "lucide-react";
|
|
32
|
+
import "./components-app-pagination-app-pagination.styles.js";
|
|
33
|
+
import "./components-app-sidebar-app-sidebar.styles.js";
|
|
34
|
+
import { InputField as e } from "./components-input-field-input-field.js";
|
|
35
|
+
import "./components-select-field-select-field.js";
|
|
36
|
+
import "./lodash-FemA_LCk.js";
|
|
37
|
+
import "./chart-D15EtNmb.js";
|
|
38
|
+
import "./index-C4iHL8Gs.js";
|
|
39
|
+
import "./index-C6N9aMq_.js";
|
|
40
|
+
const U = ({ ...p }) => {
|
|
41
|
+
const { isOpened: o, togglePopup: r } = m();
|
|
42
|
+
return /* @__PURE__ */ t(
|
|
43
|
+
e,
|
|
44
|
+
{
|
|
45
|
+
...p,
|
|
46
|
+
type: o ? "text" : "password",
|
|
47
|
+
date: [
|
|
48
|
+
{
|
|
49
|
+
id: "0",
|
|
50
|
+
position: "inline-end",
|
|
51
|
+
component: /* @__PURE__ */ t(
|
|
52
|
+
i,
|
|
53
|
+
{
|
|
54
|
+
type: o ? "eye-off" : "eye",
|
|
55
|
+
onClick: r,
|
|
56
|
+
className: "cursor-pointer"
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
U as InputPassword
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=components-input-password-input-password.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-input-password-input-password.js","sources":["../src/components/input-password/input-password.tsx"],"sourcesContent":["import { Icon, InputField, usePopupControls, type InputProps } from \"@/index\";\n\ntype InputPasswordProps = InputProps;\n\nexport const InputPassword: React.FC<InputPasswordProps> = ({ ...rest }) => {\n const { isOpened, togglePopup } = usePopupControls();\n\n return (\n <InputField\n {...rest}\n type={isOpened ? \"text\" : \"password\"}\n date={[\n {\n id: \"0\",\n position: \"inline-end\",\n component: (\n <Icon\n type={isOpened ? \"eye-off\" : \"eye\"}\n onClick={togglePopup}\n className=\"cursor-pointer\"\n />\n ),\n },\n ]}\n />\n );\n};\n\nexport type { InputPasswordProps };\n"],"names":["InputPassword","rest","isOpened","togglePopup","usePopupControls","jsx","InputField","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAMA,IAA8C,CAAC,EAAE,GAAGC,QAAW;AAC1E,QAAM,EAAE,UAAAC,GAAU,aAAAC,EAAA,IAAgBC,EAAA;AAElC,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACE,GAAGL;AAAA,MACJ,MAAMC,IAAW,SAAS;AAAA,MAC1B,MAAM;AAAA,QACJ;AAAA,UACE,IAAI;AAAA,UACJ,UAAU;AAAA,UACV,WACE,gBAAAG;AAAA,YAACE;AAAA,YAAA;AAAA,cACC,MAAML,IAAW,YAAY;AAAA,cAC7B,SAASC;AAAA,cACT,WAAU;AAAA,YAAA;AAAA,UAAA;AAAA,QACZ;AAAA,MAEJ;AAAA,IACF;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-input-password.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|