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
|
@@ -2,71 +2,72 @@
|
|
|
2
2
|
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
3
|
import t from "../../../icon/external-link.js";
|
|
4
4
|
import { Icon as n } from "../../media/Icon/Icon.js";
|
|
5
|
-
import r from "
|
|
6
|
-
import i from "
|
|
7
|
-
import a from "
|
|
8
|
-
import
|
|
5
|
+
import { formNs as r } from "../../../i18n/generated/form.js";
|
|
6
|
+
import i from "./source-citation.module.js";
|
|
7
|
+
import a from "react";
|
|
8
|
+
import o from "classnames";
|
|
9
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
10
|
//#region src/components/ai/SourceCitation/SourceCitation.tsx
|
|
10
|
-
function
|
|
11
|
+
function u(e) {
|
|
11
12
|
try {
|
|
12
13
|
return new URL(e).hostname.replace(/^www\./, "");
|
|
13
14
|
} catch {
|
|
14
15
|
return e;
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
|
-
var
|
|
18
|
-
let { t:
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
className:
|
|
18
|
+
var d = ({ title: a, url: d, description: f, index: p, domain: m, className: h }) => {
|
|
19
|
+
let { t: g } = e(r), _ = m ?? (d ? u(d) : void 0), v = p == null ? a : g("source_citation.source_label", { index: p }), y = /* @__PURE__ */ l(s, { children: [
|
|
20
|
+
/* @__PURE__ */ l("div", {
|
|
21
|
+
className: i.header,
|
|
21
22
|
children: [
|
|
22
|
-
|
|
23
|
-
className:
|
|
23
|
+
p != null && /* @__PURE__ */ c("span", {
|
|
24
|
+
className: i.index,
|
|
24
25
|
"aria-hidden": "true",
|
|
25
|
-
children:
|
|
26
|
+
children: p
|
|
26
27
|
}),
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
className:
|
|
29
|
-
children:
|
|
28
|
+
/* @__PURE__ */ c("span", {
|
|
29
|
+
className: i.title,
|
|
30
|
+
children: a
|
|
30
31
|
}),
|
|
31
|
-
|
|
32
|
+
d && /* @__PURE__ */ c(n, {
|
|
32
33
|
component: t,
|
|
33
34
|
size: "xs",
|
|
34
|
-
className:
|
|
35
|
+
className: i.externalIcon,
|
|
35
36
|
"aria-hidden": "true"
|
|
36
37
|
})
|
|
37
38
|
]
|
|
38
39
|
}),
|
|
39
|
-
|
|
40
|
-
className:
|
|
41
|
-
children:
|
|
40
|
+
_ && /* @__PURE__ */ c("div", {
|
|
41
|
+
className: i.domain,
|
|
42
|
+
children: _
|
|
42
43
|
}),
|
|
43
|
-
|
|
44
|
-
className:
|
|
45
|
-
children:
|
|
44
|
+
f && /* @__PURE__ */ c("p", {
|
|
45
|
+
className: i.description,
|
|
46
|
+
children: f
|
|
46
47
|
})
|
|
47
48
|
] });
|
|
48
|
-
return
|
|
49
|
-
href:
|
|
49
|
+
return d ? /* @__PURE__ */ c("a", {
|
|
50
|
+
href: d,
|
|
50
51
|
target: "_blank",
|
|
51
52
|
rel: "noopener noreferrer",
|
|
52
|
-
className:
|
|
53
|
-
"aria-label":
|
|
54
|
-
children:
|
|
55
|
-
}) : /* @__PURE__ */
|
|
56
|
-
className:
|
|
53
|
+
className: o("wim-source-citation", i.root, i.link, h),
|
|
54
|
+
"aria-label": v,
|
|
55
|
+
children: y
|
|
56
|
+
}) : /* @__PURE__ */ c("div", {
|
|
57
|
+
className: o("wim-source-citation", i.root, h),
|
|
57
58
|
role: "group",
|
|
58
|
-
"aria-label":
|
|
59
|
-
children:
|
|
59
|
+
"aria-label": v,
|
|
60
|
+
children: y
|
|
60
61
|
});
|
|
61
|
-
},
|
|
62
|
-
ref:
|
|
63
|
-
className:
|
|
62
|
+
}, f = a.forwardRef(({ sources: e, className: t, ...n }, r) => /* @__PURE__ */ c("div", {
|
|
63
|
+
ref: r,
|
|
64
|
+
className: o(i.list, t),
|
|
64
65
|
...n,
|
|
65
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
66
|
+
children: e.map((e, t) => /* @__PURE__ */ c(d, {
|
|
66
67
|
index: t + 1,
|
|
67
68
|
...e
|
|
68
69
|
}, e.url ?? e.title))
|
|
69
70
|
}));
|
|
70
|
-
|
|
71
|
+
f.displayName = "SourceCitationList";
|
|
71
72
|
//#endregion
|
|
72
|
-
export {
|
|
73
|
+
export { d as SourceCitation, f as SourceCitationList };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../icon/check.cjs"),r=require("../../../icon/close.cjs"),i=require("../../../icon/copy.cjs"),a=require("../../media/Icon/Icon.cjs"),o=require("./terminal.module.cjs");let
|
|
3
|
-
`);try{await navigator.clipboard.writeText(t),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../icon/check.cjs"),r=require("../../../icon/close.cjs"),i=require("../../../icon/copy.cjs"),a=require("../../media/Icon/Icon.cjs"),o=require("../../../i18n/generated/form.cjs"),s=require("./terminal.module.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime");var d={30:`#2d2d2d`,31:`#e06c75`,32:`#98c379`,33:`#e5c07b`,34:`#61afef`,35:`#c678dd`,36:`#56b6c2`,37:`#abb2bf`,90:`#9aa1ab`,91:`#e06c75`,92:`#98c379`,93:`#e5c07b`,94:`#61afef`,95:`#c678dd`,96:`#56b6c2`,97:`#ffffff`};function f(e){let t=RegExp(`\x1B\\[([0-9;]*)m`,`g`),n=[],r=0,i={},a=0;for(let o of e.matchAll(t)){o.index>r&&n.push((0,u.jsx)(`span`,{style:{color:i.color,fontWeight:i.bold?`bold`:void 0},children:e.slice(r,o.index)},a++));let t=o[1]?o[1].split(`;`).map(Number):[0],s={...i};for(let e of t)e===0?Object.assign(s,{color:void 0,bold:void 0}):e===1?s.bold=!0:d[e]&&(s.color=d[e]);i=s,r=o.index+o[0].length}return r<e.length&&n.push((0,u.jsx)(`span`,{style:{color:i.color,fontWeight:i.bold?`bold`:void 0},children:e.slice(r)},a++)),n.length===1?n[0]:(0,u.jsx)(u.Fragment,{children:n})}var p=c.default.forwardRef(({lines:e=[],title:d,height:p,autoScroll:m=!0,prompt:h=`$`,showCopy:g=!0,showWindowControls:_=!1,onClear:v,className:y,style:b,...x},S)=>{let{t:C}=t.useWimTranslation(o.formNs),[w,T]=c.default.useState(!1),E=(0,c.useRef)(null);(0,c.useEffect)(()=>{m&&E.current&&(E.current.scrollTop=E.current.scrollHeight)},[e,m]);let D=(0,c.useCallback)(async()=>{let t=e.map(e=>e.type===`input`?`${h} ${e.content}`:e.content).join(`
|
|
3
|
+
`);try{await navigator.clipboard.writeText(t),T(!0),setTimeout(()=>T(!1),2e3)}catch{}},[e,h]);return(0,u.jsxs)(`div`,{ref:S,"data-theme":`dark`,className:(0,l.default)(`wim-terminal`,s.default.root,y),style:{...p==null?{}:{height:p},...b},...x,children:[(0,u.jsxs)(`div`,{className:s.default.titleBar,children:[_&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`span`,{className:s.default.dot,"data-color":`red`,"aria-hidden":`true`}),(0,u.jsx)(`span`,{className:s.default.dot,"data-color":`yellow`,"aria-hidden":`true`}),(0,u.jsx)(`span`,{className:s.default.dot,"data-color":`green`,"aria-hidden":`true`})]}),d&&(0,u.jsx)(`span`,{className:s.default.titleText,children:d}),(0,u.jsxs)(`div`,{className:s.default.titleActions,children:[g&&(0,u.jsx)(`button`,{type:`button`,className:(0,l.default)(s.default.titleBtn,w&&s.default.copied),onClick:D,"aria-label":C(w?`terminal.copied_label`:`terminal.copy_label`),children:(0,u.jsx)(a.Icon,{component:w?n.default:i.default,size:`sm`})}),v&&(0,u.jsx)(`button`,{type:`button`,className:s.default.titleBtn,onClick:v,"aria-label":C(`terminal.clear_label`),children:(0,u.jsx)(a.Icon,{component:r.default,size:`sm`})})]})]}),(0,u.jsx)(`div`,{ref:E,className:s.default.body,role:`log`,"aria-live":`polite`,"aria-label":d,tabIndex:0,children:e.map((e,t)=>(0,u.jsxs)(`div`,{className:(0,l.default)(s.default.line,e.type&&s.default[e.type]),children:[e.type===`input`&&(0,u.jsx)(`span`,{className:s.default.prompt,"aria-hidden":`true`,children:h}),(0,u.jsx)(`span`,{className:s.default.content,children:f(e.content)})]},e.id??t))})]})});p.displayName=`Terminal`,exports.Terminal=p;
|
|
@@ -4,12 +4,13 @@ import t from "../../../icon/check.js";
|
|
|
4
4
|
import n from "../../../icon/close.js";
|
|
5
5
|
import r from "../../../icon/copy.js";
|
|
6
6
|
import { Icon as i } from "../../media/Icon/Icon.js";
|
|
7
|
-
import a from "
|
|
8
|
-
import o
|
|
9
|
-
import u from "
|
|
10
|
-
import
|
|
7
|
+
import { formNs as a } from "../../../i18n/generated/form.js";
|
|
8
|
+
import o from "./terminal.module.js";
|
|
9
|
+
import s, { useCallback as c, useEffect as l, useRef as u } from "react";
|
|
10
|
+
import d from "classnames";
|
|
11
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
12
|
//#region src/components/ai/Terminal/Terminal.tsx
|
|
12
|
-
var
|
|
13
|
+
var h = {
|
|
13
14
|
30: "#2d2d2d",
|
|
14
15
|
31: "#e06c75",
|
|
15
16
|
32: "#98c379",
|
|
@@ -27,10 +28,10 @@ var m = {
|
|
|
27
28
|
96: "#56b6c2",
|
|
28
29
|
97: "#ffffff"
|
|
29
30
|
};
|
|
30
|
-
function
|
|
31
|
+
function g(e) {
|
|
31
32
|
let t = /* @__PURE__ */ RegExp("\x1B\\[([0-9;]*)m", "g"), n = [], r = 0, i = {}, a = 0;
|
|
32
33
|
for (let o of e.matchAll(t)) {
|
|
33
|
-
o.index > r && n.push(/* @__PURE__ */
|
|
34
|
+
o.index > r && n.push(/* @__PURE__ */ p("span", {
|
|
34
35
|
style: {
|
|
35
36
|
color: i.color,
|
|
36
37
|
fontWeight: i.bold ? "bold" : void 0
|
|
@@ -41,105 +42,105 @@ function h(e) {
|
|
|
41
42
|
for (let e of t) e === 0 ? Object.assign(s, {
|
|
42
43
|
color: void 0,
|
|
43
44
|
bold: void 0
|
|
44
|
-
}) : e === 1 ? s.bold = !0 :
|
|
45
|
+
}) : e === 1 ? s.bold = !0 : h[e] && (s.color = h[e]);
|
|
45
46
|
i = s, r = o.index + o[0].length;
|
|
46
47
|
}
|
|
47
|
-
return r < e.length && n.push(/* @__PURE__ */
|
|
48
|
+
return r < e.length && n.push(/* @__PURE__ */ p("span", {
|
|
48
49
|
style: {
|
|
49
50
|
color: i.color,
|
|
50
51
|
fontWeight: i.bold ? "bold" : void 0
|
|
51
52
|
},
|
|
52
53
|
children: e.slice(r)
|
|
53
|
-
}, a++)), n.length === 1 ? n[0] : /* @__PURE__ */ f
|
|
54
|
+
}, a++)), n.length === 1 ? n[0] : /* @__PURE__ */ p(f, { children: n });
|
|
54
55
|
}
|
|
55
|
-
var
|
|
56
|
-
let { t:
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}, [
|
|
60
|
-
let
|
|
61
|
-
let e =
|
|
56
|
+
var _ = s.forwardRef(({ lines: h = [], title: _, height: v, autoScroll: y = !0, prompt: b = "$", showCopy: x = !0, showWindowControls: S = !1, onClear: C, className: w, style: T, ...E }, D) => {
|
|
57
|
+
let { t: O } = e(a), [k, A] = s.useState(!1), j = u(null);
|
|
58
|
+
l(() => {
|
|
59
|
+
y && j.current && (j.current.scrollTop = j.current.scrollHeight);
|
|
60
|
+
}, [h, y]);
|
|
61
|
+
let M = c(async () => {
|
|
62
|
+
let e = h.map((e) => e.type === "input" ? `${b} ${e.content}` : e.content).join("\n");
|
|
62
63
|
try {
|
|
63
|
-
await navigator.clipboard.writeText(e),
|
|
64
|
+
await navigator.clipboard.writeText(e), A(!0), setTimeout(() => A(!1), 2e3);
|
|
64
65
|
} catch {}
|
|
65
|
-
}, [
|
|
66
|
-
return /* @__PURE__ */
|
|
67
|
-
ref:
|
|
66
|
+
}, [h, b]);
|
|
67
|
+
return /* @__PURE__ */ m("div", {
|
|
68
|
+
ref: D,
|
|
68
69
|
"data-theme": "dark",
|
|
69
|
-
className:
|
|
70
|
+
className: d("wim-terminal", o.root, w),
|
|
70
71
|
style: {
|
|
71
|
-
...
|
|
72
|
-
...
|
|
72
|
+
...v == null ? {} : { height: v },
|
|
73
|
+
...T
|
|
73
74
|
},
|
|
74
|
-
...
|
|
75
|
-
children: [/* @__PURE__ */
|
|
76
|
-
className:
|
|
75
|
+
...E,
|
|
76
|
+
children: [/* @__PURE__ */ m("div", {
|
|
77
|
+
className: o.titleBar,
|
|
77
78
|
children: [
|
|
78
|
-
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
className:
|
|
79
|
+
S && /* @__PURE__ */ m(f, { children: [
|
|
80
|
+
/* @__PURE__ */ p("span", {
|
|
81
|
+
className: o.dot,
|
|
81
82
|
"data-color": "red",
|
|
82
83
|
"aria-hidden": "true"
|
|
83
84
|
}),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
className:
|
|
85
|
+
/* @__PURE__ */ p("span", {
|
|
86
|
+
className: o.dot,
|
|
86
87
|
"data-color": "yellow",
|
|
87
88
|
"aria-hidden": "true"
|
|
88
89
|
}),
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
className:
|
|
90
|
+
/* @__PURE__ */ p("span", {
|
|
91
|
+
className: o.dot,
|
|
91
92
|
"data-color": "green",
|
|
92
93
|
"aria-hidden": "true"
|
|
93
94
|
})
|
|
94
95
|
] }),
|
|
95
|
-
|
|
96
|
-
className:
|
|
97
|
-
children:
|
|
96
|
+
_ && /* @__PURE__ */ p("span", {
|
|
97
|
+
className: o.titleText,
|
|
98
|
+
children: _
|
|
98
99
|
}),
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
className:
|
|
101
|
-
children: [
|
|
100
|
+
/* @__PURE__ */ m("div", {
|
|
101
|
+
className: o.titleActions,
|
|
102
|
+
children: [x && /* @__PURE__ */ p("button", {
|
|
102
103
|
type: "button",
|
|
103
|
-
className:
|
|
104
|
-
onClick:
|
|
105
|
-
"aria-label":
|
|
106
|
-
children: /* @__PURE__ */
|
|
107
|
-
component:
|
|
104
|
+
className: d(o.titleBtn, k && o.copied),
|
|
105
|
+
onClick: M,
|
|
106
|
+
"aria-label": O(k ? "terminal.copied_label" : "terminal.copy_label"),
|
|
107
|
+
children: /* @__PURE__ */ p(i, {
|
|
108
|
+
component: k ? t : r,
|
|
108
109
|
size: "sm"
|
|
109
110
|
})
|
|
110
|
-
}),
|
|
111
|
+
}), C && /* @__PURE__ */ p("button", {
|
|
111
112
|
type: "button",
|
|
112
|
-
className:
|
|
113
|
-
onClick:
|
|
114
|
-
"aria-label":
|
|
115
|
-
children: /* @__PURE__ */
|
|
113
|
+
className: o.titleBtn,
|
|
114
|
+
onClick: C,
|
|
115
|
+
"aria-label": O("terminal.clear_label"),
|
|
116
|
+
children: /* @__PURE__ */ p(i, {
|
|
116
117
|
component: n,
|
|
117
118
|
size: "sm"
|
|
118
119
|
})
|
|
119
120
|
})]
|
|
120
121
|
})
|
|
121
122
|
]
|
|
122
|
-
}), /* @__PURE__ */
|
|
123
|
-
ref:
|
|
124
|
-
className:
|
|
123
|
+
}), /* @__PURE__ */ p("div", {
|
|
124
|
+
ref: j,
|
|
125
|
+
className: o.body,
|
|
125
126
|
role: "log",
|
|
126
127
|
"aria-live": "polite",
|
|
127
|
-
"aria-label":
|
|
128
|
+
"aria-label": _,
|
|
128
129
|
tabIndex: 0,
|
|
129
|
-
children:
|
|
130
|
-
className:
|
|
131
|
-
children: [e.type === "input" && /* @__PURE__ */
|
|
132
|
-
className:
|
|
130
|
+
children: h.map((e, t) => /* @__PURE__ */ m("div", {
|
|
131
|
+
className: d(o.line, e.type && o[e.type]),
|
|
132
|
+
children: [e.type === "input" && /* @__PURE__ */ p("span", {
|
|
133
|
+
className: o.prompt,
|
|
133
134
|
"aria-hidden": "true",
|
|
134
|
-
children:
|
|
135
|
-
}), /* @__PURE__ */
|
|
136
|
-
className:
|
|
137
|
-
children:
|
|
135
|
+
children: b
|
|
136
|
+
}), /* @__PURE__ */ p("span", {
|
|
137
|
+
className: o.content,
|
|
138
|
+
children: g(e.content)
|
|
138
139
|
})]
|
|
139
140
|
}, e.id ?? t))
|
|
140
141
|
})]
|
|
141
142
|
});
|
|
142
143
|
});
|
|
143
|
-
|
|
144
|
+
_.displayName = "Terminal";
|
|
144
145
|
//#endregion
|
|
145
|
-
export {
|
|
146
|
+
export { _ as Terminal };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../icon/close.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../../icon/close.cjs"),i=require("../../../icon/plus.cjs"),a=require("../../media/Icon/Icon.cjs"),o=require("./thread-list.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(({threads:e,activeId:s,onSelect:u,onDelete:d,onNewThread:f,labels:p,className:m,...h},g)=>{let{t:_}=t.useWimTranslation(n.commonNs),{newThread:v=_(`threadList.new_thread`),empty:y=_(`threadList.empty`),delete:b=_(`threadList.delete`),listAriaLabel:x=_(`threadList.label`)}=p??{};return(0,l.jsxs)(`nav`,{ref:g,className:(0,c.default)(`wim-thread-list`,o.default.root,m),"aria-label":x,...h,children:[f&&(0,l.jsxs)(`button`,{type:`button`,className:o.default.newButton,onClick:f,children:[(0,l.jsx)(a.Icon,{component:i.default,size:`sm`}),(0,l.jsx)(`span`,{children:v})]}),e.length===0?(0,l.jsx)(`p`,{className:o.default.empty,children:y}):(0,l.jsx)(`ul`,{className:o.default.list,children:e.map(e=>{let t=e.id===s;return(0,l.jsxs)(`li`,{className:o.default.item,children:[(0,l.jsxs)(`button`,{type:`button`,className:(0,c.default)(o.default.thread,t&&o.default.active),"aria-current":t||void 0,onClick:()=>u?.(e.id),children:[e.iconName&&(0,l.jsx)(`span`,{className:o.default.icon,"aria-hidden":`true`,children:(0,l.jsx)(a.Icon,{name:e.iconName,size:`sm`})}),(0,l.jsxs)(`span`,{className:o.default.body,children:[(0,l.jsxs)(`span`,{className:o.default.titleRow,children:[e.unread&&(0,l.jsx)(`span`,{className:o.default.unread,"aria-hidden":`true`}),(0,l.jsx)(`span`,{className:o.default.title,children:e.title}),e.timestamp&&(0,l.jsx)(`span`,{className:o.default.timestamp,children:e.timestamp})]}),e.preview&&(0,l.jsx)(`span`,{className:o.default.preview,children:e.preview})]})]}),d&&(0,l.jsx)(`button`,{type:`button`,className:o.default.deleteButton,"aria-label":b,onClick:()=>d(e.id),children:(0,l.jsx)(a.Icon,{component:r.default,size:`sm`})})]},e.id)})})]})});u.displayName=`ThreadList`;var d=u;exports.ConversationList=d,exports.ThreadList=u;
|
|
@@ -1,87 +1,89 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import e from "../../../
|
|
3
|
-
import t from "../../../
|
|
4
|
-
import
|
|
5
|
-
import r from "
|
|
6
|
-
import i from "
|
|
7
|
-
import a from "
|
|
8
|
-
import
|
|
2
|
+
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
|
+
import { commonNs as t } from "../../../i18n/generated/common.js";
|
|
4
|
+
import n from "../../../icon/close.js";
|
|
5
|
+
import r from "../../../icon/plus.js";
|
|
6
|
+
import { Icon as i } from "../../media/Icon/Icon.js";
|
|
7
|
+
import a from "./thread-list.module.js";
|
|
8
|
+
import o from "react";
|
|
9
|
+
import s from "classnames";
|
|
10
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
9
11
|
//#region src/components/ai/ThreadList/ThreadList.tsx
|
|
10
|
-
var
|
|
11
|
-
let { newThread:
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
ref:
|
|
14
|
-
className:
|
|
15
|
-
"aria-label":
|
|
16
|
-
...
|
|
17
|
-
children: [
|
|
12
|
+
var u = o.forwardRef(({ threads: o, activeId: u, onSelect: d, onDelete: f, onNewThread: p, labels: m, className: h, ...g }, _) => {
|
|
13
|
+
let { t: v } = e(t), { newThread: y = v("threadList.new_thread"), empty: b = v("threadList.empty"), delete: x = v("threadList.delete"), listAriaLabel: S = v("threadList.label") } = m ?? {};
|
|
14
|
+
return /* @__PURE__ */ l("nav", {
|
|
15
|
+
ref: _,
|
|
16
|
+
className: s("wim-thread-list", a.root, h),
|
|
17
|
+
"aria-label": S,
|
|
18
|
+
...g,
|
|
19
|
+
children: [p && /* @__PURE__ */ l("button", {
|
|
18
20
|
type: "button",
|
|
19
|
-
className:
|
|
20
|
-
onClick:
|
|
21
|
-
children: [/* @__PURE__ */
|
|
22
|
-
component:
|
|
21
|
+
className: a.newButton,
|
|
22
|
+
onClick: p,
|
|
23
|
+
children: [/* @__PURE__ */ c(i, {
|
|
24
|
+
component: r,
|
|
23
25
|
size: "sm"
|
|
24
|
-
}), /* @__PURE__ */
|
|
25
|
-
}),
|
|
26
|
-
className:
|
|
27
|
-
children:
|
|
28
|
-
}) : /* @__PURE__ */
|
|
29
|
-
className:
|
|
30
|
-
children:
|
|
31
|
-
let
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
className:
|
|
34
|
-
children: [/* @__PURE__ */
|
|
26
|
+
}), /* @__PURE__ */ c("span", { children: y })]
|
|
27
|
+
}), o.length === 0 ? /* @__PURE__ */ c("p", {
|
|
28
|
+
className: a.empty,
|
|
29
|
+
children: b
|
|
30
|
+
}) : /* @__PURE__ */ c("ul", {
|
|
31
|
+
className: a.list,
|
|
32
|
+
children: o.map((e) => {
|
|
33
|
+
let t = e.id === u;
|
|
34
|
+
return /* @__PURE__ */ l("li", {
|
|
35
|
+
className: a.item,
|
|
36
|
+
children: [/* @__PURE__ */ l("button", {
|
|
35
37
|
type: "button",
|
|
36
|
-
className: a
|
|
37
|
-
"aria-current":
|
|
38
|
-
onClick: () =>
|
|
39
|
-
children: [
|
|
40
|
-
className:
|
|
38
|
+
className: s(a.thread, t && a.active),
|
|
39
|
+
"aria-current": t || void 0,
|
|
40
|
+
onClick: () => d?.(e.id),
|
|
41
|
+
children: [e.iconName && /* @__PURE__ */ c("span", {
|
|
42
|
+
className: a.icon,
|
|
41
43
|
"aria-hidden": "true",
|
|
42
|
-
children: /* @__PURE__ */
|
|
43
|
-
name:
|
|
44
|
+
children: /* @__PURE__ */ c(i, {
|
|
45
|
+
name: e.iconName,
|
|
44
46
|
size: "sm"
|
|
45
47
|
})
|
|
46
|
-
}), /* @__PURE__ */
|
|
47
|
-
className:
|
|
48
|
-
children: [/* @__PURE__ */
|
|
49
|
-
className:
|
|
48
|
+
}), /* @__PURE__ */ l("span", {
|
|
49
|
+
className: a.body,
|
|
50
|
+
children: [/* @__PURE__ */ l("span", {
|
|
51
|
+
className: a.titleRow,
|
|
50
52
|
children: [
|
|
51
|
-
|
|
52
|
-
className:
|
|
53
|
+
e.unread && /* @__PURE__ */ c("span", {
|
|
54
|
+
className: a.unread,
|
|
53
55
|
"aria-hidden": "true"
|
|
54
56
|
}),
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
className:
|
|
57
|
-
children:
|
|
57
|
+
/* @__PURE__ */ c("span", {
|
|
58
|
+
className: a.title,
|
|
59
|
+
children: e.title
|
|
58
60
|
}),
|
|
59
|
-
|
|
60
|
-
className:
|
|
61
|
-
children:
|
|
61
|
+
e.timestamp && /* @__PURE__ */ c("span", {
|
|
62
|
+
className: a.timestamp,
|
|
63
|
+
children: e.timestamp
|
|
62
64
|
})
|
|
63
65
|
]
|
|
64
|
-
}),
|
|
65
|
-
className:
|
|
66
|
-
children:
|
|
66
|
+
}), e.preview && /* @__PURE__ */ c("span", {
|
|
67
|
+
className: a.preview,
|
|
68
|
+
children: e.preview
|
|
67
69
|
})]
|
|
68
70
|
})]
|
|
69
|
-
}),
|
|
71
|
+
}), f && /* @__PURE__ */ c("button", {
|
|
70
72
|
type: "button",
|
|
71
|
-
className:
|
|
72
|
-
"aria-label":
|
|
73
|
-
onClick: () =>
|
|
74
|
-
children: /* @__PURE__ */
|
|
75
|
-
component:
|
|
73
|
+
className: a.deleteButton,
|
|
74
|
+
"aria-label": x,
|
|
75
|
+
onClick: () => f(e.id),
|
|
76
|
+
children: /* @__PURE__ */ c(i, {
|
|
77
|
+
component: n,
|
|
76
78
|
size: "sm"
|
|
77
79
|
})
|
|
78
80
|
})]
|
|
79
|
-
},
|
|
81
|
+
}, e.id);
|
|
80
82
|
})
|
|
81
83
|
})]
|
|
82
84
|
});
|
|
83
85
|
});
|
|
84
|
-
|
|
85
|
-
var
|
|
86
|
+
u.displayName = "ThreadList";
|
|
87
|
+
var d = u;
|
|
86
88
|
//#endregion
|
|
87
|
-
export {
|
|
89
|
+
export { d as ConversationList, u as ThreadList };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
var e=`
|
|
2
|
+
var e=`_root_vs8b2_23`,t=`_item_vs8b2_29`,n=`_disabled_vs8b2_38`,r=`_trigger_vs8b2_42`,i=`_open_vs8b2_62`,a=`_triggerContent_vs8b2_88`,o=`_chevron_vs8b2_91`,s=`_content_vs8b2_102`,c=`_contentInner_vs8b2_115`,l=`_contentBody_vs8b2_118`,u={root:e,item:t,disabled:n,trigger:r,open:i,triggerContent:a,chevron:o,content:s,contentInner:c,contentBody:l};exports.chevron=o,exports.content=s,exports.contentBody=l,exports.contentInner=c,exports.default=u,exports.disabled=n,exports.item=t,exports.open=i,exports.root=e,exports.trigger=r,exports.triggerContent=a;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
//#region src/components/data-display/Accordion/accordion.module.scss
|
|
3
|
-
var e = "
|
|
3
|
+
var e = "_root_vs8b2_23", t = "_item_vs8b2_29", n = "_disabled_vs8b2_38", r = "_trigger_vs8b2_42", i = "_open_vs8b2_62", a = "_triggerContent_vs8b2_88", o = "_chevron_vs8b2_91", s = "_content_vs8b2_102", c = "_contentInner_vs8b2_115", l = "_contentBody_vs8b2_118", u = {
|
|
4
4
|
root: e,
|
|
5
5
|
item: t,
|
|
6
6
|
disabled: n,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../hooks/useMergedRef.cjs"),
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../../hooks/useMergedRef.cjs"),i=require("./encode.cjs"),a=require("./warn-unencodable-value.cjs"),o=require("./barcode.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={code128:`Code 128`,ean13:`EAN-13`},d=11,f=8,p=.35,m=7,h=s.default.forwardRef(({value:e,format:h=`code128`,height:g=64,moduleWidth:_=2,showValue:v=!0,label:y,className:b,...x},S)=>{let{t:C}=t.useWimTranslation(n.commonNs),w=i.encodeBarcode(e,h),T=s.default.useRef(null),[E,D]=s.default.useState(!1);s.default.useLayoutEffect(()=>{let e=T.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>D(e.scrollWidth>e.clientWidth);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[w?.modules,_]);let O=r.useMergedRef(S,T);if(!w){a.warnUnencodableValue(e,h,u[h]);let t=C(`barcode.invalid`,{format:u[h]});return(0,l.jsxs)(`div`,{ref:O,"data-invalid":`true`,className:(0,c.default)(`wim-barcode`,o.default.root,o.default.invalid,b),...x,children:[(0,l.jsx)(`span`,{className:o.default.invalidMessage,children:t}),(0,l.jsx)(`span`,{className:o.default.invalidValue,children:e})]})}let k=w.modules.length+22,A=k*_,j=d,M=i.toRuns(w.modules).map(([e,t])=>{let n=j;return j+=t,e?{x:n,width:t,module:n-d}:null}),N=h===`ean13`&&v?w.print:void 0,P=N?Math.min(f*_,g*p):0,F=g-P,I=e=>N?N.guards.some(([t,n])=>e.module>=t&&e.module+e.width<=n):!1,L=N?[...[...N.left.text].map((e,t)=>({key:`l${t}`,digit:e,module:N.left.from+t*m+m/2})),...[...N.right.text].map((e,t)=>({key:`r${t}`,digit:e,module:N.right.from+t*m+m/2}))]:[];return(0,l.jsxs)(`div`,{ref:O,role:`img`,tabIndex:E?0:void 0,"aria-label":y??C(`barcode.aria_label`,{value:w.text}),"data-format":h,className:(0,c.default)(`wim-barcode`,o.default.root,b),...x,children:[N?(0,l.jsxs)(`svg`,{className:o.default.symbol,width:A,height:g,viewBox:`0 0 ${A} ${g}`,shapeRendering:`crispEdges`,"aria-hidden":`true`,children:[M.map(e=>e?(0,l.jsx)(`rect`,{x:e.x*_,y:0,width:e.width*_,height:I(e)?g:F,"data-guard":I(e)?`true`:void 0},e.x):null),(0,l.jsx)(`text`,{className:o.default.printedDigit,x:10*_,y:g,textAnchor:`end`,fontSize:P*.86,children:N.lead}),L.map(e=>(0,l.jsx)(`text`,{className:o.default.printedDigit,x:(d+e.module)*_,y:g,textAnchor:`middle`,fontSize:P*.86,children:e.digit},e.key))]}):(0,l.jsx)(`svg`,{className:o.default.symbol,width:A,height:g,viewBox:`0 0 ${k} ${g}`,preserveAspectRatio:`none`,shapeRendering:`crispEdges`,"aria-hidden":`true`,children:M.map(e=>e?(0,l.jsx)(`rect`,{x:e.x,y:0,width:e.width,height:g},e.x):null)}),v&&!N?(0,l.jsx)(`span`,{className:o.default.value,children:w.text}):null]})});h.displayName=`Barcode`,exports.Barcode=h;
|