wimui 0.51.1 → 0.52.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/dist/components/_internal/FeedbackCloseButton.cjs +1 -1
- package/dist/components/_internal/FeedbackCloseButton.js +14 -13
- package/dist/components/_internal/FieldLabelContent.cjs +1 -1
- package/dist/components/_internal/FieldLabelContent.js +18 -17
- package/dist/components/ai/AIResponseFeedback/AIResponseFeedback.cjs +1 -1
- package/dist/components/ai/AIResponseFeedback/AIResponseFeedback.js +46 -45
- package/dist/components/ai/AgentStatus/AgentStatus.cjs +1 -1
- package/dist/components/ai/AgentStatus/AgentStatus.js +24 -23
- package/dist/components/ai/ArtifactsOverlay/ArtifactsOverlay.cjs +1 -1
- package/dist/components/ai/ArtifactsOverlay/ArtifactsOverlay.js +47 -45
- package/dist/components/ai/ChatUI/ChatUI.cjs +1 -1
- package/dist/components/ai/ChatUI/ChatUI.js +82 -81
- package/dist/components/ai/CodeBlock/CodeBlock.cjs +3 -3
- package/dist/components/ai/CodeBlock/CodeBlock.js +53 -52
- package/dist/components/ai/CodeDiffViewer/CodeDiffViewer.cjs +2 -2
- package/dist/components/ai/CodeDiffViewer/CodeDiffViewer.js +105 -104
- package/dist/components/ai/MarkdownRenderer/MarkdownRenderer.cjs +1 -1
- package/dist/components/ai/MarkdownRenderer/MarkdownRenderer.js +60 -59
- package/dist/components/ai/ModelSelector/ModelSelector.cjs +1 -1
- package/dist/components/ai/ModelSelector/ModelSelector.js +122 -120
- package/dist/components/ai/ModelSelector/model-selector.module.cjs +1 -1
- package/dist/components/ai/ModelSelector/model-selector.module.js +1 -1
- package/dist/components/ai/PromptInput/PromptInput.cjs +1 -1
- package/dist/components/ai/PromptInput/PromptInput.js +76 -75
- package/dist/components/ai/SourceCitation/SourceCitation.cjs +1 -1
- package/dist/components/ai/SourceCitation/SourceCitation.js +39 -38
- package/dist/components/ai/Terminal/Terminal.cjs +2 -2
- package/dist/components/ai/Terminal/Terminal.js +65 -64
- package/dist/components/ai/ThreadList/ThreadList.cjs +1 -1
- package/dist/components/ai/ThreadList/ThreadList.js +64 -62
- package/dist/components/data-display/Accordion/accordion.module.cjs +1 -1
- package/dist/components/data-display/Accordion/accordion.module.js +1 -1
- package/dist/components/data-display/Barcode/Barcode.cjs +1 -1
- package/dist/components/data-display/Barcode/Barcode.js +76 -75
- package/dist/components/data-display/Calendar/Calendar.cjs +1 -1
- package/dist/components/data-display/Calendar/Calendar.js +75 -74
- package/dist/components/data-display/CalendarHeatmap/CalendarHeatmap.cjs +1 -1
- package/dist/components/data-display/CalendarHeatmap/CalendarHeatmap.js +54 -52
- package/dist/components/data-display/Carousel/Carousel.cjs +1 -1
- package/dist/components/data-display/Carousel/Carousel.js +24 -23
- package/dist/components/data-display/Chip/Chip.cjs +1 -1
- package/dist/components/data-display/Chip/Chip.js +36 -35
- package/dist/components/data-display/Comment/Comment.cjs +1 -1
- package/dist/components/data-display/Comment/Comment.js +58 -57
- package/dist/components/data-display/Countdown/Countdown.cjs +1 -1
- package/dist/components/data-display/Countdown/Countdown.js +56 -55
- package/dist/components/data-display/DataGrid/DataGrid.cjs +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.js +128 -127
- package/dist/components/data-display/JsonViewer/JsonViewer.cjs +1 -1
- package/dist/components/data-display/JsonViewer/JsonViewer.js +153 -152
- package/dist/components/data-display/Kanban/Kanban.cjs +1 -1
- package/dist/components/data-display/Kanban/Kanban.js +95 -94
- package/dist/components/data-display/NodeGraph/NodeGraph.cjs +1 -1
- package/dist/components/data-display/NodeGraph/NodeGraph.js +67 -66
- package/dist/components/data-display/PivotTable/PivotTable.cjs +1 -1
- package/dist/components/data-display/PivotTable/PivotTable.js +153 -152
- package/dist/components/data-display/Presence/Presence.cjs +1 -1
- package/dist/components/data-display/Presence/Presence.js +28 -27
- package/dist/components/data-display/PullToRefresh/PullToRefresh.cjs +1 -1
- package/dist/components/data-display/PullToRefresh/PullToRefresh.js +73 -72
- package/dist/components/data-display/Reaction/Reaction.cjs +1 -1
- package/dist/components/data-display/Reaction/Reaction.js +31 -30
- package/dist/components/data-display/ScheduleView/ScheduleView.cjs +1 -1
- package/dist/components/data-display/ScheduleView/ScheduleView.js +52 -50
- package/dist/components/data-display/SortableList/SortableList.cjs +1 -1
- package/dist/components/data-display/SortableList/SortableList.js +44 -43
- package/dist/components/data-display/Tag/Tag.cjs +1 -1
- package/dist/components/data-display/Tag/Tag.js +29 -28
- package/dist/components/data-display/TreeDiagram/TreeDiagram.cjs +1 -1
- package/dist/components/data-display/TreeDiagram/TreeDiagram.js +85 -84
- package/dist/components/data-display/TreeView/TreeView.cjs +1 -1
- package/dist/components/data-display/TreeView/TreeView.js +123 -122
- package/dist/components/feedback/Autosave/Autosave.cjs +1 -1
- package/dist/components/feedback/Autosave/Autosave.js +32 -31
- package/dist/components/feedback/ErrorBoundary/ErrorBoundary.cjs +1 -1
- package/dist/components/feedback/ErrorBoundary/ErrorBoundary.js +35 -34
- package/dist/components/feedback/ScrollProgress/ScrollProgress.cjs +1 -1
- package/dist/components/feedback/ScrollProgress/ScrollProgress.js +21 -20
- package/dist/components/feedback/Tour/Tour.cjs +1 -1
- package/dist/components/feedback/Tour/Tour.js +127 -101
- package/dist/components/form/Button/Button.cjs +1 -1
- package/dist/components/form/Button/Button.js +55 -54
- package/dist/components/form/ColorInput/ColorInput.cjs +1 -1
- package/dist/components/form/ColorInput/ColorInput.js +30 -29
- package/dist/components/form/ColorPicker/color-picker.module.cjs +1 -1
- package/dist/components/form/ColorPicker/color-picker.module.js +1 -1
- package/dist/components/form/CopyButton/CopyButton.cjs +1 -1
- package/dist/components/form/CopyButton/CopyButton.js +27 -26
- package/dist/components/form/DatePicker/DatePicker.cjs +1 -1
- package/dist/components/form/DatePicker/DatePicker.js +47 -46
- package/dist/components/form/DateRangePicker/DateRangePicker.cjs +1 -1
- package/dist/components/form/DateRangePicker/DateRangePicker.js +36 -35
- package/dist/components/form/Dropzone/Dropzone.cjs +1 -1
- package/dist/components/form/Dropzone/Dropzone.js +56 -55
- package/dist/components/form/FileUpload/FileUpload.cjs +1 -1
- package/dist/components/form/FileUpload/FileUpload.js +47 -46
- package/dist/components/form/FloatButton/FloatButton.cjs +1 -1
- package/dist/components/form/FloatButton/FloatButton.d.ts +4 -1
- package/dist/components/form/FloatButton/FloatButton.js +6 -6
- package/dist/components/form/ImageCropper/ImageCropper.cjs +1 -1
- package/dist/components/form/ImageCropper/ImageCropper.js +101 -99
- package/dist/components/form/InlineEdit/InlineEdit.cjs +1 -1
- package/dist/components/form/InlineEdit/InlineEdit.js +66 -65
- package/dist/components/form/Input/Input.cjs +1 -1
- package/dist/components/form/Input/Input.js +45 -44
- package/dist/components/form/InputBase/InputBase.cjs +1 -1
- package/dist/components/form/InputBase/InputBase.js +51 -50
- package/dist/components/form/InputBase/input-base.module.cjs +1 -1
- package/dist/components/form/InputBase/input-base.module.js +1 -1
- package/dist/components/form/MultiSelect/multiselect.module.cjs +1 -1
- package/dist/components/form/MultiSelect/multiselect.module.js +1 -1
- package/dist/components/form/OtpInput/otp-input.module.cjs +1 -1
- package/dist/components/form/OtpInput/otp-input.module.js +1 -1
- package/dist/components/form/PasswordStrength/PasswordStrength.cjs +1 -1
- package/dist/components/form/PasswordStrength/PasswordStrength.js +27 -26
- package/dist/components/form/PhoneInput/PhoneInput.cjs +1 -1
- package/dist/components/form/PhoneInput/PhoneInput.js +10 -10
- package/dist/components/form/QueryBuilder/QueryBuilder.cjs +1 -1
- package/dist/components/form/QueryBuilder/QueryBuilder.js +90 -89
- package/dist/components/form/RangeSlider/RangeSlider.cjs +1 -1
- package/dist/components/form/RangeSlider/RangeSlider.js +121 -119
- package/dist/components/form/RangeSlider/range-slider.module.cjs +1 -1
- package/dist/components/form/RangeSlider/range-slider.module.js +1 -1
- package/dist/components/form/RichTextEditor/RichTextEditor.cjs +1 -1
- package/dist/components/form/RichTextEditor/RichTextEditor.js +223 -222
- package/dist/components/form/SegmentedControl/SegmentedControl.cjs +1 -1
- package/dist/components/form/SegmentedControl/SegmentedControl.js +7 -7
- package/dist/components/form/Select/Select.cjs +1 -1
- package/dist/components/form/Select/Select.js +112 -111
- package/dist/components/form/SignaturePad/SignaturePad.cjs +1 -1
- package/dist/components/form/SignaturePad/SignaturePad.js +86 -79
- package/dist/components/form/SmartSearchInput/SmartSearchInput.cjs +1 -1
- package/dist/components/form/SmartSearchInput/SmartSearchInput.js +63 -62
- package/dist/components/form/TagInput/TagInput.cjs +1 -1
- package/dist/components/form/TagInput/TagInput.js +68 -67
- package/dist/components/form/ThemeToggle/ThemeToggle.cjs +1 -1
- package/dist/components/form/ThemeToggle/ThemeToggle.js +69 -67
- package/dist/components/form/ThemeToggle/theme-toggle.module.cjs +1 -1
- package/dist/components/form/ThemeToggle/theme-toggle.module.js +1 -1
- package/dist/components/form/ToggleGroup/ToggleGroup.cjs +1 -1
- package/dist/components/form/ToggleGroup/ToggleGroup.js +6 -6
- package/dist/components/form/Transfer/Transfer.cjs +1 -1
- package/dist/components/form/Transfer/Transfer.d.ts +1 -1
- package/dist/components/form/Transfer/Transfer.js +155 -154
- package/dist/components/form/Transfer/transfer.module.cjs +1 -1
- package/dist/components/form/Transfer/transfer.module.js +6 -6
- package/dist/components/form/TreeSelect/TreeSelect.cjs +1 -1
- package/dist/components/form/TreeSelect/TreeSelect.js +6 -6
- package/dist/components/layout/Dashboard/Dashboard.cjs +1 -1
- package/dist/components/layout/Dashboard/Dashboard.js +90 -89
- package/dist/components/layout/Navbar/Navbar.cjs +1 -1
- package/dist/components/layout/Navbar/Navbar.d.ts +1 -1
- package/dist/components/layout/Navbar/Navbar.js +1 -1
- package/dist/components/layout/Sidebar/Sidebar.d.ts +1 -1
- package/dist/components/layout/Splitter/Splitter.cjs +1 -1
- package/dist/components/layout/Splitter/Splitter.js +40 -39
- package/dist/components/layout/Toolbar/Toolbar.cjs +1 -1
- package/dist/components/layout/Toolbar/Toolbar.js +66 -39
- package/dist/components/media/Audio/Audio.cjs +1 -1
- package/dist/components/media/Audio/Audio.js +91 -90
- package/dist/components/media/Audio/components/AudioCustomControls.cjs +1 -1
- package/dist/components/media/Audio/components/AudioCustomControls.js +116 -114
- package/dist/components/media/Gallery/Gallery.cjs +1 -1
- package/dist/components/media/Gallery/Gallery.js +132 -131
- package/dist/components/media/ImageCompare/ImageCompare.cjs +1 -1
- package/dist/components/media/ImageCompare/ImageCompare.js +75 -73
- package/dist/components/media/Lightbox/Lightbox.cjs +1 -1
- package/dist/components/media/Lightbox/Lightbox.js +128 -127
- package/dist/components/media/Video/Video.cjs +1 -1
- package/dist/components/media/Video/Video.js +73 -71
- package/dist/components/media/Video/components/VideoAdvancedMenu.cjs +1 -1
- package/dist/components/media/Video/components/VideoAdvancedMenu.js +140 -138
- package/dist/components/media/Video/components/VideoControls.cjs +1 -1
- package/dist/components/media/Video/components/VideoControls.js +103 -102
- package/dist/components/navigation/BackTop/BackTop.cjs +1 -1
- package/dist/components/navigation/BackTop/BackTop.js +37 -36
- package/dist/components/navigation/Breadcrumb/Breadcrumb.cjs +1 -1
- package/dist/components/navigation/Breadcrumb/Breadcrumb.js +41 -40
- package/dist/components/navigation/CommandPalette/CommandPalette.cjs +1 -1
- package/dist/components/navigation/CommandPalette/CommandPalette.js +100 -99
- package/dist/components/navigation/HamburgerMenu/HamburgerMenu.cjs +1 -1
- package/dist/components/navigation/HamburgerMenu/HamburgerMenu.d.ts +6 -0
- package/dist/components/navigation/HamburgerMenu/HamburgerMenu.js +32 -22
- package/dist/components/navigation/Pagination/Pagination.cjs +1 -1
- package/dist/components/navigation/Pagination/Pagination.js +39 -38
- package/dist/components/navigation/SpeedDial/SpeedDial.cjs +1 -1
- package/dist/components/navigation/SpeedDial/SpeedDial.js +44 -43
- package/dist/components/navigation/Tabs/tabs.module.cjs +1 -1
- package/dist/components/navigation/Tabs/tabs.module.js +1 -1
- package/dist/components/overlay/ContextMenu/ContextMenu.cjs +1 -1
- package/dist/components/overlay/ContextMenu/ContextMenu.js +4 -4
- package/dist/components/overlay/Popover/Popover.cjs +1 -1
- package/dist/components/overlay/Popover/Popover.js +63 -62
- package/dist/components/typography/Spoiler/Spoiler.cjs +1 -1
- package/dist/components/typography/Spoiler/Spoiler.js +38 -37
- package/dist/i18n/generated/common.cjs +2 -0
- package/dist/i18n/generated/common.d.ts +3 -0
- package/dist/i18n/generated/common.js +570 -0
- package/dist/i18n/generated/components.cjs +2 -0
- package/dist/i18n/generated/components.d.ts +3 -0
- package/dist/i18n/generated/components.js +399 -0
- package/dist/i18n/generated/data-display.cjs +2 -0
- package/dist/i18n/generated/data-display.d.ts +3 -0
- package/dist/i18n/generated/data-display.js +12 -0
- package/dist/i18n/generated/form.cjs +2 -0
- package/dist/i18n/generated/form.d.ts +3 -0
- package/dist/i18n/generated/form.js +321 -0
- package/dist/i18n/generated/keys.d.ts +5 -1
- package/dist/i18n/generated/locales.cjs +2 -0
- package/dist/i18n/generated/locales.d.ts +1 -0
- package/dist/i18n/generated/locales.js +9 -0
- package/dist/i18n/instance.cjs +1 -1
- package/dist/i18n/instance.d.ts +18 -3
- package/dist/i18n/instance.js +24 -26
- package/dist/i18n/useWimTranslation.cjs +1 -1
- package/dist/i18n/useWimTranslation.d.ts +7 -8
- package/dist/i18n/useWimTranslation.js +6 -5
- package/dist/llms-full.txt +10 -6
- package/dist/llms.txt +1 -1
- package/dist/locales/en/common.json +53 -4
- package/dist/locales/en/components.json +3 -1
- package/dist/locales/ja/common.json +53 -4
- package/dist/locales/ja/components.json +3 -1
- package/dist/locales/pt/common.json +53 -4
- package/dist/locales/pt/components.json +3 -1
- package/dist/styles.css +2 -2
- package/dist/wimui.umd.css +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +10 -10
- package/dist/i18n/generated/resources.cjs +0 -2
- package/dist/i18n/generated/resources.d.ts +0 -4
- package/dist/i18n/generated/resources.js +0 -1103
|
@@ -1,150 +1,152 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
3
|
+
import { commonNs as t } from "../../../i18n/generated/common.js";
|
|
4
|
+
import { Button as n } from "../Button/Button.js";
|
|
5
|
+
import { formNs as r } from "../../../i18n/generated/form.js";
|
|
6
|
+
import { Slider as i } from "../Slider/Slider.js";
|
|
7
|
+
import { IconButton as a } from "../IconButton/IconButton.js";
|
|
8
|
+
import { Dialog as o, DialogClose as s, DialogContent as c, DialogDescription as l, DialogFooter as u, DialogHeader as d, DialogTitle as f } from "../../overlay/Dialog/Dialog.js";
|
|
9
|
+
import p from "./image-cropper.module.js";
|
|
10
|
+
import m, { useCallback as h, useEffect as g, useRef as _, useState as v } from "react";
|
|
11
|
+
import y from "classnames";
|
|
12
|
+
import { jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
11
13
|
//#region src/components/form/ImageCropper/ImageCropper.tsx
|
|
12
|
-
var
|
|
13
|
-
let { t:
|
|
14
|
+
var S = m.forwardRef(({ src: m, aspectRatio: S = 1, circular: C = !1, onCrop: w, showRotation: T = !0, showZoom: E = !0, showApplyButton: D = !0, applyLabel: O, onApply: k, className: A, ...j }, M) => {
|
|
15
|
+
let { t: N } = e([r, t]), [P, F] = v(1), [I, L] = v(0), [R, z] = v({
|
|
14
16
|
x: 0,
|
|
15
17
|
y: 0
|
|
16
|
-
}), [
|
|
18
|
+
}), [B, V] = v(!1), [H, U] = v({
|
|
17
19
|
x: 0,
|
|
18
20
|
y: 0
|
|
19
|
-
}), [
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
}), [W, G] = v(!1), K = _(null), q = _(null);
|
|
22
|
+
g(() => {
|
|
23
|
+
z({
|
|
22
24
|
x: 0,
|
|
23
25
|
y: 0
|
|
24
|
-
}),
|
|
25
|
-
}, [
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
x: e.clientX -
|
|
29
|
-
y: e.clientY -
|
|
26
|
+
}), F(1), L(0);
|
|
27
|
+
}, [m]);
|
|
28
|
+
let J = (e) => {
|
|
29
|
+
V(!0), U({
|
|
30
|
+
x: e.clientX - R.x,
|
|
31
|
+
y: e.clientY - R.y
|
|
30
32
|
});
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
x: e.clientX -
|
|
34
|
-
y: e.clientY -
|
|
33
|
+
}, Y = h((e) => {
|
|
34
|
+
B && z({
|
|
35
|
+
x: e.clientX - H.x,
|
|
36
|
+
y: e.clientY - H.y
|
|
35
37
|
});
|
|
36
|
-
}, [
|
|
37
|
-
|
|
38
|
+
}, [B, H]), X = h(() => {
|
|
39
|
+
V(!1);
|
|
38
40
|
}, []);
|
|
39
|
-
|
|
40
|
-
window.removeEventListener("mousemove",
|
|
41
|
+
g(() => (B ? (window.addEventListener("mousemove", Y), window.addEventListener("mouseup", X)) : (window.removeEventListener("mousemove", Y), window.removeEventListener("mouseup", X)), () => {
|
|
42
|
+
window.removeEventListener("mousemove", Y), window.removeEventListener("mouseup", X);
|
|
41
43
|
}), [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
B,
|
|
45
|
+
Y,
|
|
46
|
+
X
|
|
45
47
|
]);
|
|
46
|
-
let
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
let e =
|
|
52
|
-
|
|
48
|
+
let Z = () => {
|
|
49
|
+
L((e) => (e + 90) % 360);
|
|
50
|
+
}, Q = () => {
|
|
51
|
+
G(!0);
|
|
52
|
+
}, $ = () => {
|
|
53
|
+
let e = m || "";
|
|
54
|
+
w?.(e), k?.(e), G(!1);
|
|
53
55
|
};
|
|
54
|
-
return
|
|
55
|
-
ref:
|
|
56
|
-
className:
|
|
57
|
-
...
|
|
56
|
+
return m ? /* @__PURE__ */ x("div", {
|
|
57
|
+
ref: M,
|
|
58
|
+
className: y("wim-image-cropper", p.root, A),
|
|
59
|
+
...j,
|
|
58
60
|
children: [
|
|
59
|
-
/* @__PURE__ */
|
|
60
|
-
ref:
|
|
61
|
-
className:
|
|
62
|
-
onMouseDown:
|
|
61
|
+
/* @__PURE__ */ x("div", {
|
|
62
|
+
ref: q,
|
|
63
|
+
className: p.viewer,
|
|
64
|
+
onMouseDown: J,
|
|
63
65
|
role: "presentation",
|
|
64
|
-
children: [/* @__PURE__ */
|
|
65
|
-
className:
|
|
66
|
-
children: /* @__PURE__ */
|
|
67
|
-
ref:
|
|
68
|
-
src:
|
|
69
|
-
alt:
|
|
70
|
-
className:
|
|
71
|
-
style: { transform: `translate(${
|
|
66
|
+
children: [/* @__PURE__ */ b("div", {
|
|
67
|
+
className: p.imageContainer,
|
|
68
|
+
children: /* @__PURE__ */ b("img", {
|
|
69
|
+
ref: K,
|
|
70
|
+
src: m,
|
|
71
|
+
alt: N("a11y.crop_target"),
|
|
72
|
+
className: p.image,
|
|
73
|
+
style: { transform: `translate(${R.x}px, ${R.y}px) rotate(${I}deg) scale(${P})` },
|
|
72
74
|
draggable: !1
|
|
73
75
|
})
|
|
74
|
-
}), /* @__PURE__ */
|
|
75
|
-
className:
|
|
76
|
-
children: /* @__PURE__ */
|
|
77
|
-
className:
|
|
78
|
-
style: { aspectRatio:
|
|
76
|
+
}), /* @__PURE__ */ b("div", {
|
|
77
|
+
className: p.overlay,
|
|
78
|
+
children: /* @__PURE__ */ b("div", {
|
|
79
|
+
className: y(p.cropArea, { [p.circular]: C }),
|
|
80
|
+
style: { aspectRatio: S }
|
|
79
81
|
})
|
|
80
82
|
})]
|
|
81
83
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
className:
|
|
84
|
+
/* @__PURE__ */ x("div", {
|
|
85
|
+
className: p.controls,
|
|
84
86
|
children: [
|
|
85
|
-
|
|
86
|
-
className:
|
|
87
|
-
children: /* @__PURE__ */
|
|
87
|
+
E && /* @__PURE__ */ b("div", {
|
|
88
|
+
className: p.zoomControl,
|
|
89
|
+
children: /* @__PURE__ */ b(i, {
|
|
88
90
|
min: 1,
|
|
89
91
|
max: 3,
|
|
90
92
|
step: .1,
|
|
91
|
-
value:
|
|
92
|
-
onChange: (e) =>
|
|
93
|
-
label:
|
|
94
|
-
styles: { root:
|
|
93
|
+
value: P,
|
|
94
|
+
onChange: (e) => F(e),
|
|
95
|
+
label: N("image_cropper.zoom"),
|
|
96
|
+
styles: { root: p.zoomSlider }
|
|
95
97
|
})
|
|
96
98
|
}),
|
|
97
|
-
|
|
98
|
-
className:
|
|
99
|
-
children: /* @__PURE__ */
|
|
99
|
+
T && /* @__PURE__ */ b("div", {
|
|
100
|
+
className: p.rotationControl,
|
|
101
|
+
children: /* @__PURE__ */ b(a, {
|
|
100
102
|
iconName: "RefreshIcon",
|
|
101
|
-
onClick:
|
|
102
|
-
"aria-label":
|
|
103
|
+
onClick: Z,
|
|
104
|
+
"aria-label": N("image_cropper.rotate"),
|
|
103
105
|
variant: "outline",
|
|
104
106
|
size: "sm"
|
|
105
107
|
})
|
|
106
108
|
}),
|
|
107
|
-
|
|
108
|
-
className:
|
|
109
|
-
children: /* @__PURE__ */
|
|
110
|
-
onClick:
|
|
109
|
+
D && /* @__PURE__ */ b("div", {
|
|
110
|
+
className: p.applyControl,
|
|
111
|
+
children: /* @__PURE__ */ b(n, {
|
|
112
|
+
onClick: Q,
|
|
111
113
|
size: "sm",
|
|
112
114
|
variant: "solid",
|
|
113
|
-
children:
|
|
115
|
+
children: O || N("image_cropper.apply")
|
|
114
116
|
})
|
|
115
117
|
})
|
|
116
118
|
]
|
|
117
119
|
}),
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
open:
|
|
120
|
-
onOpenChange:
|
|
121
|
-
children: /* @__PURE__ */
|
|
122
|
-
/* @__PURE__ */
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ b(o, {
|
|
121
|
+
open: W,
|
|
122
|
+
onOpenChange: G,
|
|
123
|
+
children: /* @__PURE__ */ x(c, { children: [
|
|
124
|
+
/* @__PURE__ */ b(d, { children: /* @__PURE__ */ b(f, { children: N("image_cropper.confirm_title") }) }),
|
|
125
|
+
/* @__PURE__ */ b(l, { children: N("image_cropper.confirm_message") }),
|
|
126
|
+
/* @__PURE__ */ x(u, { children: [/* @__PURE__ */ b(s, {
|
|
125
127
|
asChild: !0,
|
|
126
|
-
children: /* @__PURE__ */
|
|
128
|
+
children: /* @__PURE__ */ b(n, {
|
|
127
129
|
variant: "ghost",
|
|
128
|
-
children:
|
|
130
|
+
children: N("image_cropper.cancel")
|
|
129
131
|
})
|
|
130
|
-
}), /* @__PURE__ */
|
|
131
|
-
onClick:
|
|
132
|
+
}), /* @__PURE__ */ b(n, {
|
|
133
|
+
onClick: $,
|
|
132
134
|
variant: "solid",
|
|
133
|
-
children:
|
|
135
|
+
children: N("image_cropper.confirm")
|
|
134
136
|
})] })
|
|
135
137
|
] })
|
|
136
138
|
})
|
|
137
139
|
]
|
|
138
|
-
}) : /* @__PURE__ */
|
|
139
|
-
ref:
|
|
140
|
-
className:
|
|
141
|
-
...
|
|
142
|
-
children: /* @__PURE__ */
|
|
143
|
-
className:
|
|
144
|
-
children:
|
|
140
|
+
}) : /* @__PURE__ */ b("div", {
|
|
141
|
+
ref: M,
|
|
142
|
+
className: y("wim-image-cropper", p.root, p.empty, A),
|
|
143
|
+
...j,
|
|
144
|
+
children: /* @__PURE__ */ b("div", {
|
|
145
|
+
className: p.emptyContent,
|
|
146
|
+
children: N("image_cropper.no_image")
|
|
145
147
|
})
|
|
146
148
|
});
|
|
147
149
|
});
|
|
148
|
-
|
|
150
|
+
S.displayName = "ImageCropper";
|
|
149
151
|
//#endregion
|
|
150
|
-
export {
|
|
152
|
+
export { S as ImageCropper };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../FieldTemplate/FieldTemplate.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../FieldTemplate/FieldTemplate.cjs"),i=require("../Input/Input.cjs"),a=require("../IconButton/IconButton.cjs"),o=require("./inline-edit.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("classnames");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u=s.default.forwardRef(({value:e,defaultValue:u,onChange:d,onSave:f,onCancel:p,onEdit:m,placeholder:h,disabled:g=!1,fullWidth:_=!1,label:v,className:y,"aria-label":b,...x},S)=>{let{t:C}=t.useWimTranslation(n.commonNs),[w,T]=(0,s.useState)(!1),[E,D]=(0,s.useState)(u??``),[O,k]=(0,s.useState)(u??``),A=(0,s.useRef)(null),j=e!==void 0,M=j?e:O,N=()=>{g||(j||k(E),T(!0),m?.())},P=()=>{g||(j||D(M),T(!1),f?.(M))},F=()=>{g||(j||k(E),T(!1),p?.())},I=e=>{let t=e.target.value;j||k(t),d?.(t)},L=e=>{e.key===`Enter`?(e.preventDefault(),P()):e.key===`Escape`&&(e.preventDefault(),F())};return(0,s.useEffect)(()=>{w&&A.current&&A.current.focus()},[w]),(0,l.jsx)(r.FieldTemplate,{label:v,className:y,children:(0,l.jsx)(`div`,{ref:S,className:(0,c.default)(`wim-inline-edit`,o.default.root,_&&o.default.fullWidth,g&&o.default.disabled),...x,children:w?(0,l.jsxs)(`div`,{className:o.default.editWrapper,children:[(0,l.jsx)(i.Input,{ref:A,value:M,onChange:I,onKeyDown:L,disabled:g,placeholder:h,"aria-label":b,fullWidth:_,className:o.default.input}),(0,l.jsxs)(`div`,{className:o.default.editActions,children:[(0,l.jsx)(a.IconButton,{iconName:`CheckIcon`,intent:`success`,variant:`outline`,"aria-label":C(`action.save`),onClick:P,disabled:g}),(0,l.jsx)(a.IconButton,{iconName:`CloseIcon`,intent:`default`,variant:`outline`,"aria-label":C(`action.cancel`),onClick:F,disabled:g})]})]}):(0,l.jsxs)(`div`,{className:o.default.preview,onClick:N,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),N())},tabIndex:g?-1:0,role:`button`,"aria-label":b,"aria-disabled":g,children:[(0,l.jsx)(`span`,{className:(0,c.default)(o.default.text,!M&&o.default.placeholder),children:M||h||`\xA0`}),(0,l.jsx)(`span`,{className:o.default.editIconWrapper,children:(0,l.jsx)(a.IconButton,{iconName:`EditIcon`,variant:`ghost`,size:`sm`,tabIndex:-1,"aria-label":C(`action.edit`),"aria-hidden":`true`,asChild:!0,children:(0,l.jsx)(`span`,{})})})]})})})});u.displayName=`InlineEdit`,exports.InlineEdit=u;
|
|
@@ -1,95 +1,96 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import i from "
|
|
7
|
-
import a
|
|
8
|
-
import l from "
|
|
9
|
-
import
|
|
3
|
+
import { commonNs as t } from "../../../i18n/generated/common.js";
|
|
4
|
+
import { FieldTemplate as n } from "../FieldTemplate/FieldTemplate.js";
|
|
5
|
+
import { Input as r } from "../Input/Input.js";
|
|
6
|
+
import { IconButton as i } from "../IconButton/IconButton.js";
|
|
7
|
+
import a from "./inline-edit.module.js";
|
|
8
|
+
import o, { useEffect as s, useRef as c, useState as l } from "react";
|
|
9
|
+
import u from "classnames";
|
|
10
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
11
|
//#region src/components/form/InlineEdit/InlineEdit.tsx
|
|
11
|
-
var
|
|
12
|
-
let { t:
|
|
13
|
-
|
|
14
|
-
}, I = () => {
|
|
15
|
-
v || (N || k(P), D(!1), m?.(P));
|
|
12
|
+
var p = o.forwardRef(({ value: o, defaultValue: p, onChange: m, onSave: h, onCancel: g, onEdit: _, placeholder: v, disabled: y = !1, fullWidth: b = !1, label: x, className: S, "aria-label": C, ...w }, T) => {
|
|
13
|
+
let { t: E } = e(t), [D, O] = l(!1), [k, A] = l(p ?? ""), [j, M] = l(p ?? ""), N = c(null), P = o !== void 0, F = P ? o : j, I = () => {
|
|
14
|
+
y || (P || M(k), O(!0), _?.());
|
|
16
15
|
}, L = () => {
|
|
17
|
-
|
|
18
|
-
}, R = (
|
|
19
|
-
|
|
20
|
-
N || j(t), p?.(t);
|
|
16
|
+
y || (P || A(F), O(!1), h?.(F));
|
|
17
|
+
}, R = () => {
|
|
18
|
+
y || (P || M(k), O(!1), g?.());
|
|
21
19
|
}, z = (e) => {
|
|
22
|
-
|
|
20
|
+
let t = e.target.value;
|
|
21
|
+
P || M(t), m?.(t);
|
|
22
|
+
}, B = (e) => {
|
|
23
|
+
e.key === "Enter" ? (e.preventDefault(), L()) : e.key === "Escape" && (e.preventDefault(), R());
|
|
23
24
|
};
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
}, [
|
|
27
|
-
label:
|
|
28
|
-
className:
|
|
29
|
-
children: /* @__PURE__ */
|
|
30
|
-
ref:
|
|
31
|
-
className:
|
|
32
|
-
...
|
|
33
|
-
children:
|
|
34
|
-
className:
|
|
35
|
-
children: [/* @__PURE__ */
|
|
36
|
-
ref:
|
|
37
|
-
value:
|
|
38
|
-
onChange:
|
|
39
|
-
onKeyDown:
|
|
40
|
-
disabled:
|
|
41
|
-
placeholder:
|
|
42
|
-
"aria-label":
|
|
43
|
-
fullWidth:
|
|
44
|
-
className:
|
|
45
|
-
}), /* @__PURE__ */
|
|
46
|
-
className:
|
|
47
|
-
children: [/* @__PURE__ */
|
|
25
|
+
return s(() => {
|
|
26
|
+
D && N.current && N.current.focus();
|
|
27
|
+
}, [D]), /* @__PURE__ */ d(n, {
|
|
28
|
+
label: x,
|
|
29
|
+
className: S,
|
|
30
|
+
children: /* @__PURE__ */ d("div", {
|
|
31
|
+
ref: T,
|
|
32
|
+
className: u("wim-inline-edit", a.root, b && a.fullWidth, y && a.disabled),
|
|
33
|
+
...w,
|
|
34
|
+
children: D ? /* @__PURE__ */ f("div", {
|
|
35
|
+
className: a.editWrapper,
|
|
36
|
+
children: [/* @__PURE__ */ d(r, {
|
|
37
|
+
ref: N,
|
|
38
|
+
value: F,
|
|
39
|
+
onChange: z,
|
|
40
|
+
onKeyDown: B,
|
|
41
|
+
disabled: y,
|
|
42
|
+
placeholder: v,
|
|
43
|
+
"aria-label": C,
|
|
44
|
+
fullWidth: b,
|
|
45
|
+
className: a.input
|
|
46
|
+
}), /* @__PURE__ */ f("div", {
|
|
47
|
+
className: a.editActions,
|
|
48
|
+
children: [/* @__PURE__ */ d(i, {
|
|
48
49
|
iconName: "CheckIcon",
|
|
49
50
|
intent: "success",
|
|
50
51
|
variant: "outline",
|
|
51
|
-
"aria-label":
|
|
52
|
-
onClick:
|
|
53
|
-
disabled:
|
|
54
|
-
}), /* @__PURE__ */
|
|
52
|
+
"aria-label": E("action.save"),
|
|
53
|
+
onClick: L,
|
|
54
|
+
disabled: y
|
|
55
|
+
}), /* @__PURE__ */ d(i, {
|
|
55
56
|
iconName: "CloseIcon",
|
|
56
57
|
intent: "default",
|
|
57
58
|
variant: "outline",
|
|
58
|
-
"aria-label":
|
|
59
|
-
onClick:
|
|
60
|
-
disabled:
|
|
59
|
+
"aria-label": E("action.cancel"),
|
|
60
|
+
onClick: R,
|
|
61
|
+
disabled: y
|
|
61
62
|
})]
|
|
62
63
|
})]
|
|
63
|
-
}) : /* @__PURE__ */
|
|
64
|
-
className:
|
|
65
|
-
onClick:
|
|
64
|
+
}) : /* @__PURE__ */ f("div", {
|
|
65
|
+
className: a.preview,
|
|
66
|
+
onClick: I,
|
|
66
67
|
onKeyDown: (e) => {
|
|
67
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(),
|
|
68
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), I());
|
|
68
69
|
},
|
|
69
|
-
tabIndex:
|
|
70
|
+
tabIndex: y ? -1 : 0,
|
|
70
71
|
role: "button",
|
|
71
|
-
"aria-label":
|
|
72
|
-
"aria-disabled":
|
|
73
|
-
children: [/* @__PURE__ */
|
|
74
|
-
className:
|
|
75
|
-
children:
|
|
76
|
-
}), /* @__PURE__ */
|
|
77
|
-
className:
|
|
78
|
-
children: /* @__PURE__ */
|
|
72
|
+
"aria-label": C,
|
|
73
|
+
"aria-disabled": y,
|
|
74
|
+
children: [/* @__PURE__ */ d("span", {
|
|
75
|
+
className: u(a.text, !F && a.placeholder),
|
|
76
|
+
children: F || v || "\xA0"
|
|
77
|
+
}), /* @__PURE__ */ d("span", {
|
|
78
|
+
className: a.editIconWrapper,
|
|
79
|
+
children: /* @__PURE__ */ d(i, {
|
|
79
80
|
iconName: "EditIcon",
|
|
80
81
|
variant: "ghost",
|
|
81
82
|
size: "sm",
|
|
82
83
|
tabIndex: -1,
|
|
83
|
-
"aria-label":
|
|
84
|
+
"aria-label": E("action.edit"),
|
|
84
85
|
"aria-hidden": "true",
|
|
85
86
|
asChild: !0,
|
|
86
|
-
children: /* @__PURE__ */
|
|
87
|
+
children: /* @__PURE__ */ d("span", {})
|
|
87
88
|
})
|
|
88
89
|
})]
|
|
89
90
|
})
|
|
90
91
|
})
|
|
91
92
|
});
|
|
92
93
|
});
|
|
93
|
-
|
|
94
|
+
p.displayName = "InlineEdit";
|
|
94
95
|
//#endregion
|
|
95
|
-
export {
|
|
96
|
+
export { p as InlineEdit };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../i18n/useWimTranslation.cjs"),ee=require("../../../i18n/generated/common.cjs"),te=require("../../../hooks/useMergedRef.cjs"),ne=require("../InputBase/InputBase.cjs"),r=require("../FieldTemplate/FieldTemplate.cjs"),i=require("./input.module.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=(0,a.forwardRef)(({intent:e=`default`,variant:c=`outline`,fullWidth:re=!1,className:l,disabled:u,leftIcon:d,rightIcon:f,leftIconColor:p,rightIconColor:ie,onLeftIconClick:ae,onRightIconClick:oe,allowClear:se=!1,showPasswordToggle:ce=!0,rightIconClassName:m,rightIconRotated:h,width:g,value:_,defaultValue:v,onChange:y,type:b,label:x,error:S,required:C,layout:w,id:T,inputClassName:E,showPasswordAriaLabel:D,hidePasswordAriaLabel:O,rightIconAriaLabel:k,rightIconDecorative:A=!1,suffix:j,styles:M,asChild:N=!1,children:P,...F},I)=>{let{t:L}=n.useWimTranslation(ee.commonNs),R=D??L(`a11y.show_password`),z=O??L(`a11y.hide_password`),B=k??L(`a11y.right_icon_action`),[le,V]=(0,a.useState)(v??``),[H,U]=(0,a.useState)(!1),W=(0,a.useRef)(null),ue=te.useMergedRef(I,W),G=_!==void 0,K=G?_:le,q=u,de=e=>{G||V(e.target.value),y?.(e)},fe=()=>{let e=W.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set;t?(t.call(e,``),e.dispatchEvent(new Event(`input`,{bubbles:!0}))):(G||V(``),y&&(e.value=``,y({target:e,currentTarget:e}))),G||V(``)},pe=()=>{U(e=>!e)},me=b===`password`&&ce,J=[];me&&J.push({name:H?`EyeOffIcon`:`EyeIcon`,onClick:e=>pe(),ariaLabel:H?z:R}),f&&(J.some(e=>e.name===f)||J.push({name:f,onClick:oe,color:ie,ariaLabel:B,decorative:A,className:m,rotated:h}));let he=b===`password`&&H?`text`:b,Y=S?`danger`:e,ge=(0,a.useId)(),X=T||`wim-input-${ge}`,Z=S?`${X}-error`:void 0,Q=j!=null&&j!==``?`${X}-suffix`:void 0,_e=[Z,Q].filter(Boolean).join(` `)||void 0,$=x?`${X}-label`:void 0;return(0,s.jsx)(r.FieldTemplate,{label:x,error:S,required:C,layout:w,labelId:$,htmlFor:X,errorId:Z,className:l,children:(0,s.jsx)(ne.InputBase,{intent:Y,variant:c,fullWidth:re,width:g,disabled:q,leftIcon:d,leftIconColor:p,onLeftIconClick:ae,rightIcons:J,suffix:j,suffixId:Q,allowClear:se,hasValue:!!K,onClear:fe,styles:M,children:(0,s.jsx)(N?t.Root:`input`,{id:X,ref:ue,className:(0,o.default)(`wim-input`,i.default.root,i.default[Y],q&&i.default.disabled,i.default[c],E),disabled:q,value:K,onChange:de,type:he,"aria-invalid":Y===`danger`,"aria-describedby":_e,"aria-labelledby":x?$:void 0,"aria-required":C,...F,children:N?(0,s.jsx)(t.Slottable,{children:P}):null})})})});c.displayName=`Input`,exports.Input=c,exports.default=c;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Root as e, Slottable as t } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
|
|
3
3
|
import { useWimTranslation as ee } from "../../../i18n/useWimTranslation.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import i from "
|
|
8
|
-
import
|
|
9
|
-
import l from "
|
|
10
|
-
import
|
|
4
|
+
import { commonNs as te } from "../../../i18n/generated/common.js";
|
|
5
|
+
import { useMergedRef as n } from "../../../hooks/useMergedRef.js";
|
|
6
|
+
import { InputBase as r } from "../InputBase/InputBase.js";
|
|
7
|
+
import { FieldTemplate as i } from "../FieldTemplate/FieldTemplate.js";
|
|
8
|
+
import a from "./input.module.js";
|
|
9
|
+
import { forwardRef as o, useId as s, useRef as c, useState as l } from "react";
|
|
10
|
+
import u from "classnames";
|
|
11
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
11
12
|
//#region src/components/form/Input/Input.tsx
|
|
12
|
-
var
|
|
13
|
-
let { t: L } = ee(
|
|
13
|
+
var f = o(({ intent: o = "default", variant: f = "outline", fullWidth: p = !1, className: m, disabled: h, leftIcon: ne, rightIcon: g, leftIconColor: re, rightIconColor: ie, onLeftIconClick: ae, onRightIconClick: oe, allowClear: se = !1, showPasswordToggle: ce = !0, rightIconClassName: le, rightIconRotated: ue, width: de, value: _, defaultValue: v, onChange: y, type: b, label: x, error: S, required: C, layout: w, id: T, inputClassName: E, showPasswordAriaLabel: D, hidePasswordAriaLabel: O, rightIconAriaLabel: k, rightIconDecorative: A = !1, suffix: j, styles: M, asChild: N = !1, children: P, ...F }, I) => {
|
|
14
|
+
let { t: L } = ee(te), fe = D ?? L("a11y.show_password"), R = O ?? L("a11y.hide_password"), z = k ?? L("a11y.right_icon_action"), [B, V] = l(v ?? ""), [H, pe] = l(!1), U = c(null), me = n(I, U), W = _ !== void 0, G = W ? _ : B, K = h, he = (e) => {
|
|
14
15
|
W || V(e.target.value), y?.(e);
|
|
15
|
-
},
|
|
16
|
+
}, ge = () => {
|
|
16
17
|
let e = U.current;
|
|
17
18
|
if (!e) return;
|
|
18
19
|
let t = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, "value")?.set;
|
|
@@ -20,24 +21,24 @@ var d = a(({ intent: a = "default", variant: d = "outline", fullWidth: f = !1, c
|
|
|
20
21
|
target: e,
|
|
21
22
|
currentTarget: e
|
|
22
23
|
}))), W || V("");
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
24
|
+
}, _e = () => {
|
|
25
|
+
pe((e) => !e);
|
|
26
|
+
}, ve = b === "password" && ce, q = [];
|
|
27
|
+
ve && q.push({
|
|
27
28
|
name: H ? "EyeOffIcon" : "EyeIcon",
|
|
28
|
-
onClick: (e) =>
|
|
29
|
-
ariaLabel: H ?
|
|
30
|
-
}),
|
|
31
|
-
name:
|
|
32
|
-
onClick:
|
|
33
|
-
color:
|
|
29
|
+
onClick: (e) => _e(),
|
|
30
|
+
ariaLabel: H ? R : fe
|
|
31
|
+
}), g && (q.some((e) => e.name === g) || q.push({
|
|
32
|
+
name: g,
|
|
33
|
+
onClick: oe,
|
|
34
|
+
color: ie,
|
|
34
35
|
ariaLabel: z,
|
|
35
36
|
decorative: A,
|
|
36
|
-
className:
|
|
37
|
-
rotated:
|
|
37
|
+
className: le,
|
|
38
|
+
rotated: ue
|
|
38
39
|
}));
|
|
39
|
-
let
|
|
40
|
-
return /* @__PURE__ */
|
|
40
|
+
let J = b === "password" && H ? "text" : b, Y = S ? "danger" : o, ye = s(), X = T || `wim-input-${ye}`, Z = S ? `${X}-error` : void 0, Q = j != null && j !== "" ? `${X}-suffix` : void 0, be = [Z, Q].filter(Boolean).join(" ") || void 0, $ = x ? `${X}-label` : void 0;
|
|
41
|
+
return /* @__PURE__ */ d(i, {
|
|
41
42
|
label: x,
|
|
42
43
|
error: S,
|
|
43
44
|
required: C,
|
|
@@ -45,41 +46,41 @@ var d = a(({ intent: a = "default", variant: d = "outline", fullWidth: f = !1, c
|
|
|
45
46
|
labelId: $,
|
|
46
47
|
htmlFor: X,
|
|
47
48
|
errorId: Z,
|
|
48
|
-
className:
|
|
49
|
-
children: /* @__PURE__ */
|
|
49
|
+
className: m,
|
|
50
|
+
children: /* @__PURE__ */ d(r, {
|
|
50
51
|
intent: Y,
|
|
51
|
-
variant:
|
|
52
|
-
fullWidth:
|
|
53
|
-
width:
|
|
52
|
+
variant: f,
|
|
53
|
+
fullWidth: p,
|
|
54
|
+
width: de,
|
|
54
55
|
disabled: K,
|
|
55
|
-
leftIcon:
|
|
56
|
-
leftIconColor:
|
|
57
|
-
onLeftIconClick:
|
|
58
|
-
rightIcons:
|
|
56
|
+
leftIcon: ne,
|
|
57
|
+
leftIconColor: re,
|
|
58
|
+
onLeftIconClick: ae,
|
|
59
|
+
rightIcons: q,
|
|
59
60
|
suffix: j,
|
|
60
61
|
suffixId: Q,
|
|
61
|
-
allowClear:
|
|
62
|
+
allowClear: se,
|
|
62
63
|
hasValue: !!G,
|
|
63
|
-
onClear:
|
|
64
|
+
onClear: ge,
|
|
64
65
|
styles: M,
|
|
65
|
-
children: /* @__PURE__ */
|
|
66
|
+
children: /* @__PURE__ */ d(N ? e : "input", {
|
|
66
67
|
id: X,
|
|
67
|
-
ref:
|
|
68
|
-
className:
|
|
68
|
+
ref: me,
|
|
69
|
+
className: u("wim-input", a.root, a[Y], K && a.disabled, a[f], E),
|
|
69
70
|
disabled: K,
|
|
70
71
|
value: G,
|
|
71
|
-
onChange:
|
|
72
|
-
type:
|
|
72
|
+
onChange: he,
|
|
73
|
+
type: J,
|
|
73
74
|
"aria-invalid": Y === "danger",
|
|
74
|
-
"aria-describedby":
|
|
75
|
+
"aria-describedby": be,
|
|
75
76
|
"aria-labelledby": x ? $ : void 0,
|
|
76
77
|
"aria-required": C,
|
|
77
78
|
...F,
|
|
78
|
-
children: N ? /* @__PURE__ */
|
|
79
|
+
children: N ? /* @__PURE__ */ d(t, { children: P }) : null
|
|
79
80
|
})
|
|
80
81
|
})
|
|
81
82
|
});
|
|
82
83
|
});
|
|
83
|
-
|
|
84
|
+
f.displayName = "Input";
|
|
84
85
|
//#endregion
|
|
85
|
-
export {
|
|
86
|
+
export { f as Input, f as default };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../media/Icon/Icon.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../media/Icon/Icon.cjs"),i=require("./input-base.module.cjs");let a=require("react");a=e.__toESM(a,1);let o=require("classnames");o=e.__toESM(o,1);let s=require("react/jsx-runtime");var c=({children:e,intent:c=`default`,variant:l=`outline`,fullWidth:u=!1,width:d,className:f,disabled:p,leftIcon:m,leftIconColor:h,onLeftIconClick:g,leftIconAriaLabel:_,rightIcons:v=[],suffix:y,suffixId:b,allowClear:x,hasValue:S,onClear:C,clearAriaLabel:w,styles:T})=>{let{t:E}=t.useWimTranslation(n.commonNs),D=_??E(`a11y.left_icon_action`),O=w??E(`a11y.clear_input`),k=typeof d==`string`&&[`xs`,`sm`,`md`,`lg`,`xl`].includes(d),A=a.default.Children.map(e,e=>a.default.isValidElement(e)?a.default.cloneElement(e,{disabled:p?!0:e.props.disabled,className:(0,o.default)(e.props.className,i.default.inner,T?.inner)}):e),j=d!==void 0&&!k&&!u,M=k&&!u?d:void 0,N=e=>p?`disabled`:e||(c===`danger`?`danger`:c===`warning`?`warning`:c===`success`?`success`:`secondary`),P=[...v];x&&S&&!p&&P.push({name:`CloseIcon`,onClick:e=>{e.stopPropagation(),C?.()},ariaLabel:O});let F=M?i.default[`width${M.charAt(0).toUpperCase()}${M.slice(1)}`]:void 0;return(0,s.jsxs)(`div`,{className:(0,o.default)(`wim-input-base`,i.default.root,c&&i.default[c],p&&i.default.disabled,i.default[l],u&&i.default.fullWidth,j&&i.default.hasCustomWidth,F,m&&i.default.hasLeftIcon,(P.length>0||x)&&i.default.hasRightIcon,(P.length>=2||v.length>=1&&x)&&i.default.hasMultipleRightIcons,f,T?.root),style:j?{"--wim-input-width":typeof d==`number`?`${d}px`:d}:void 0,children:[m&&(0,s.jsx)(`div`,{className:(0,o.default)(i.default.icon,i.default.left,g&&i.default.clickable,T?.icon),children:g?(0,s.jsx)(`button`,{type:`button`,onClick:g,className:(0,o.default)(i.default.iconButton,T?.iconButton),"aria-label":D,disabled:p,children:(0,s.jsx)(r.Icon,{name:m,size:`md`,color:N(h)})}):(0,s.jsx)(r.Icon,{name:m,size:`md`,color:N(h)})}),A,y!=null&&y!==``&&(0,s.jsx)(`span`,{id:b,className:(0,o.default)(i.default.suffix,P.length>0&&i.default.suffixClearsIcons),"data-testid":`input-suffix`,children:y}),P.length>0&&(0,s.jsx)(`div`,{className:(0,o.default)(i.default.icons,i.default.right,T?.icons),children:P.map((e,t)=>(0,s.jsx)(`div`,{className:(0,o.default)(i.default.iconItem,e.onClick&&i.default.clickable,e.rotated&&i.default.rotated,e.className,T?.iconItem),children:e.onClick?(0,s.jsx)(`button`,{type:`button`,onClick:e.onClick,className:(0,o.default)(i.default.iconButton,T?.iconButton),disabled:p,tabIndex:e.decorative?-1:void 0,"aria-hidden":e.decorative||void 0,"aria-label":e.decorative?void 0:e.ariaLabel??E(`a11y.right_icon_action`),children:(0,s.jsx)(r.Icon,{name:e.name,size:`md`,color:N(e.color)})}):(0,s.jsx)(r.Icon,{name:e.name,size:`md`,color:N(e.color)})},`${e.name}-${t}`))})]})};exports.InputBase=c;
|