wimui 0.70.0 → 0.71.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/useAnnounce.cjs +1 -1
- package/dist/components/_internal/useAnnounce.d.ts +22 -0
- package/dist/components/_internal/useAnnounce.js +36 -19
- package/dist/components/ai/CodeDiffViewer/CodeDiffViewer.cjs +2 -2
- package/dist/components/ai/CodeDiffViewer/CodeDiffViewer.js +106 -105
- package/dist/components/ai/StreamingText/StreamingText.cjs +1 -1
- package/dist/components/ai/StreamingText/StreamingText.d.ts +1 -1
- package/dist/components/ai/StreamingText/StreamingText.js +37 -23
- package/dist/components/data-display/DataGrid/DataGrid.cjs +1 -1
- package/dist/components/data-display/DataGrid/DataGrid.js +41 -40
- package/dist/components/data-display/InfiniteScroll/InfiniteScroll.cjs +1 -1
- package/dist/components/data-display/InfiniteScroll/InfiniteScroll.d.ts +1 -1
- package/dist/components/data-display/InfiniteScroll/InfiniteScroll.js +37 -26
- package/dist/components/feedback/Spinner/Spinner.cjs +1 -1
- package/dist/components/feedback/Spinner/Spinner.js +53 -43
- package/dist/components/form/Combobox/Combobox.cjs +1 -1
- package/dist/components/form/Combobox/Combobox.js +48 -47
- package/dist/components/form/Transfer/Transfer.cjs +1 -1
- package/dist/components/form/Transfer/Transfer.js +0 -1
- package/dist/components/media/Gallery/Gallery.cjs +1 -1
- package/dist/components/media/Gallery/Gallery.js +111 -110
- package/dist/hooks/useBreakpoint.d.ts +1 -0
- package/dist/i18n/generated/data-display.cjs +1 -1
- package/dist/i18n/generated/data-display.d.ts +1 -1
- package/dist/i18n/generated/data-display.js +6 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +18 -18
- package/dist/llms/AIResponseFeedback.md +26 -0
- package/dist/llms/Accordion.md +47 -0
- package/dist/llms/Affix.md +25 -0
- package/dist/llms/AgentStatus.md +25 -0
- package/dist/llms/Alert.md +28 -0
- package/dist/llms/Anchor.md +30 -0
- package/dist/llms/AppShell.md +52 -0
- package/dist/llms/AreaChart.md +27 -0
- package/dist/llms/ArtifactsOverlay.md +27 -0
- package/dist/llms/AspectRatio.md +22 -0
- package/dist/llms/Audio.md +44 -0
- package/dist/llms/Autosave.md +23 -0
- package/dist/llms/Avatar.md +27 -0
- package/dist/llms/AvatarGroup.md +28 -0
- package/dist/llms/BackTop.md +32 -0
- package/dist/llms/Badge.md +28 -0
- package/dist/llms/Banner.md +28 -0
- package/dist/llms/BarChart.md +26 -0
- package/dist/llms/Barcode.md +26 -0
- package/dist/llms/BentoGrid.md +25 -0
- package/dist/llms/Blockquote.md +26 -0
- package/dist/llms/BottomSheet.md +26 -0
- package/dist/llms/Box.md +44 -0
- package/dist/llms/BoxPlot.md +25 -0
- package/dist/llms/Breadcrumb.md +31 -0
- package/dist/llms/Button.md +33 -0
- package/dist/llms/ButtonGroup.md +27 -0
- package/dist/llms/Calendar.md +34 -0
- package/dist/llms/CalendarHeatmap.md +33 -0
- package/dist/llms/CandlestickChart.md +25 -0
- package/dist/llms/Canvas.md +13 -0
- package/dist/llms/Card.md +41 -0
- package/dist/llms/Carousel.md +33 -0
- package/dist/llms/Cascader.md +40 -0
- package/dist/llms/Center.md +40 -0
- package/dist/llms/Charts.md +13 -0
- package/dist/llms/ChatUI.md +17 -0
- package/dist/llms/Checkbox.md +24 -0
- package/dist/llms/CheckboxGroup.md +32 -0
- package/dist/llms/Chip.md +36 -0
- package/dist/llms/Code.md +25 -0
- package/dist/llms/CodeBlock.md +27 -0
- package/dist/llms/CodeDiffViewer.md +30 -0
- package/dist/llms/ColorInput.md +48 -0
- package/dist/llms/ColorPicker.md +46 -0
- package/dist/llms/Combobox.md +37 -0
- package/dist/llms/CommandPalette.md +25 -0
- package/dist/llms/Comment.md +35 -0
- package/dist/llms/Container.md +45 -0
- package/dist/llms/ContextMenu.md +25 -0
- package/dist/llms/ContrastChecker.md +13 -0
- package/dist/llms/Controls.md +13 -0
- package/dist/llms/CopyButton.md +26 -0
- package/dist/llms/Countdown.md +31 -0
- package/dist/llms/CounterTextarea.md +32 -0
- package/dist/llms/CreditCardInput.md +42 -0
- package/dist/llms/Dashboard.md +31 -0
- package/dist/llms/DataGrid.md +43 -0
- package/dist/llms/DatePicker.md +39 -0
- package/dist/llms/DateRangePicker.md +30 -0
- package/dist/llms/DescriptionList.md +26 -0
- package/dist/llms/Dialog.md +57 -0
- package/dist/llms/Divider.md +24 -0
- package/dist/llms/Drawer.md +29 -0
- package/dist/llms/Dropdown.md +50 -0
- package/dist/llms/Dropzone.md +36 -0
- package/dist/llms/EmptyState.md +23 -0
- package/dist/llms/ErrorBoundary.md +25 -0
- package/dist/llms/FAQSection.md +24 -0
- package/dist/llms/FieldError.md +19 -0
- package/dist/llms/FieldTemplate.md +30 -0
- package/dist/llms/Fieldset.md +24 -0
- package/dist/llms/FileUpload.md +40 -0
- package/dist/llms/Flex.md +23 -0
- package/dist/llms/FloatButton.md +36 -0
- package/dist/llms/FocusTrap.md +20 -0
- package/dist/llms/Footer.md +32 -0
- package/dist/llms/FunnelChart.md +24 -0
- package/dist/llms/Gallery.md +30 -0
- package/dist/llms/GanttChart.md +29 -0
- package/dist/llms/GaugeChart.md +30 -0
- package/dist/llms/Grid.md +30 -0
- package/dist/llms/Group.md +22 -0
- package/dist/llms/HamburgerMenu.md +30 -0
- package/dist/llms/Header.md +30 -0
- package/dist/llms/Heatmap.md +25 -0
- package/dist/llms/Highlight.md +26 -0
- package/dist/llms/HoverCard.md +26 -0
- package/dist/llms/Icon.md +25 -0
- package/dist/llms/IconButton.md +30 -0
- package/dist/llms/Image.md +46 -0
- package/dist/llms/ImageCompare.md +35 -0
- package/dist/llms/ImageCropper.md +34 -0
- package/dist/llms/Indicator.md +28 -0
- package/dist/llms/InfiniteScroll.md +28 -0
- package/dist/llms/InlineEdit.md +32 -0
- package/dist/llms/Input.md +46 -0
- package/dist/llms/InputBase.md +39 -0
- package/dist/llms/InputGroup.md +23 -0
- package/dist/llms/InputMask.md +44 -0
- package/dist/llms/InteractiveArea.md +32 -0
- package/dist/llms/InteractiveGraph.md +28 -0
- package/dist/llms/JsonDiffViewer.md +24 -0
- package/dist/llms/JsonViewer.md +26 -0
- package/dist/llms/Kanban.md +25 -0
- package/dist/llms/Kbd.md +23 -0
- package/dist/llms/KeyboardShortcuts.md +25 -0
- package/dist/llms/Label.md +27 -0
- package/dist/llms/Leaderboard.md +24 -0
- package/dist/llms/Legend.md +27 -0
- package/dist/llms/Lightbox.md +47 -0
- package/dist/llms/LineChart.md +26 -0
- package/dist/llms/Link.md +28 -0
- package/dist/llms/LinkButton.md +23 -0
- package/dist/llms/List.md +35 -0
- package/dist/llms/Loader.md +23 -0
- package/dist/llms/LoadingOverlay.md +30 -0
- package/dist/llms/Markdown.md +24 -0
- package/dist/llms/MarkdownRenderer.md +24 -0
- package/dist/llms/Marquee.md +27 -0
- package/dist/llms/Masonry.md +18 -0
- package/dist/llms/Mentions.md +24 -0
- package/dist/llms/Menu.md +30 -0
- package/dist/llms/Menubar.md +50 -0
- package/dist/llms/Meta.md +13 -0
- package/dist/llms/ModelSelector.md +31 -0
- package/dist/llms/MultiSelect.md +38 -0
- package/dist/llms/Navbar.md +58 -0
- package/dist/llms/NodeGraph.md +38 -0
- package/dist/llms/Notification.md +30 -0
- package/dist/llms/NumberInput.md +23 -0
- package/dist/llms/OtpInput.md +33 -0
- package/dist/llms/OverflowList.md +31 -0
- package/dist/llms/Pagination.md +39 -0
- package/dist/llms/PasswordInput.md +39 -0
- package/dist/llms/PasswordStrength.md +34 -0
- package/dist/llms/PhoneInput.md +35 -0
- package/dist/llms/PieChart.md +23 -0
- package/dist/llms/PivotTable.md +41 -0
- package/dist/llms/PlatformIcons.md +13 -0
- package/dist/llms/Popconfirm.md +30 -0
- package/dist/llms/Popover.md +27 -0
- package/dist/llms/Portal.md +18 -0
- package/dist/llms/Presence.md +26 -0
- package/dist/llms/Progress.md +29 -0
- package/dist/llms/ProgressRing.md +27 -0
- package/dist/llms/PromptInput.md +37 -0
- package/dist/llms/PullToRefresh.md +26 -0
- package/dist/llms/QRCode.md +30 -0
- package/dist/llms/QueryBuilder.md +31 -0
- package/dist/llms/RadarChart.md +24 -0
- package/dist/llms/Radio.md +23 -0
- package/dist/llms/RadioGroup.md +32 -0
- package/dist/llms/RangeCalendar.md +26 -0
- package/dist/llms/RangeSlider.md +39 -0
- package/dist/llms/Rating.md +37 -0
- package/dist/llms/Reaction.md +26 -0
- package/dist/llms/RefTable.md +13 -0
- package/dist/llms/RelativeTime.md +24 -0
- package/dist/llms/Result.md +29 -0
- package/dist/llms/RichTextEditor.md +59 -0
- package/dist/llms/SankeyChart.md +26 -0
- package/dist/llms/ScatterChart.md +26 -0
- package/dist/llms/ScheduleView.md +35 -0
- package/dist/llms/ScrollArea.md +24 -0
- package/dist/llms/ScrollProgress.md +22 -0
- package/dist/llms/SearchInput.md +44 -0
- package/dist/llms/SegmentedControl.md +40 -0
- package/dist/llms/Select.md +44 -0
- package/dist/llms/SelectionBar.md +28 -0
- package/dist/llms/Sidebar.md +47 -0
- package/dist/llms/SignaturePad.md +36 -0
- package/dist/llms/SimpleGrid.md +24 -0
- package/dist/llms/Skeleton.md +26 -0
- package/dist/llms/Slider.md +36 -0
- package/dist/llms/SmartSearchInput.md +35 -0
- package/dist/llms/Snackbar.md +30 -0
- package/dist/llms/SortableList.md +33 -0
- package/dist/llms/SourceCitation.md +28 -0
- package/dist/llms/SourceCode.md +13 -0
- package/dist/llms/Span.md +29 -0
- package/dist/llms/Sparkline.md +27 -0
- package/dist/llms/SpeedDial.md +28 -0
- package/dist/llms/Spinner.md +26 -0
- package/dist/llms/SplitButton.md +29 -0
- package/dist/llms/Splitter.md +37 -0
- package/dist/llms/Spoiler.md +26 -0
- package/dist/llms/Stack.md +48 -0
- package/dist/llms/Stats.md +44 -0
- package/dist/llms/Stepper.md +32 -0
- package/dist/llms/StreamingText.md +24 -0
- package/dist/llms/SwipeAction.md +28 -0
- package/dist/llms/SwipeableList.md +21 -0
- package/dist/llms/Switch.md +27 -0
- package/dist/llms/SwitchGroup.md +31 -0
- package/dist/llms/T.md +13 -0
- package/dist/llms/TabBar.md +33 -0
- package/dist/llms/TabNavigation.md +30 -0
- package/dist/llms/Table.md +73 -0
- package/dist/llms/Tabs.md +40 -0
- package/dist/llms/Tag.md +30 -0
- package/dist/llms/TagInput.md +37 -0
- package/dist/llms/Terminal.md +29 -0
- package/dist/llms/Text.md +31 -0
- package/dist/llms/Textarea.md +30 -0
- package/dist/llms/ThemeToggle.md +31 -0
- package/dist/llms/ThoughtProcess.md +27 -0
- package/dist/llms/ThreadList.md +27 -0
- package/dist/llms/TimePicker.md +41 -0
- package/dist/llms/Timeline.md +24 -0
- package/dist/llms/Title.md +27 -0
- package/dist/llms/Toast.md +32 -0
- package/dist/llms/ToggleGroup.md +39 -0
- package/dist/llms/Toolbar.md +35 -0
- package/dist/llms/Tooltip.md +29 -0
- package/dist/llms/Tour.md +24 -0
- package/dist/llms/Transfer.md +35 -0
- package/dist/llms/Transition.md +34 -0
- package/dist/llms/TreeDiagram.md +33 -0
- package/dist/llms/TreeSelect.md +43 -0
- package/dist/llms/TreeView.md +50 -0
- package/dist/llms/Treemap.md +27 -0
- package/dist/llms/UsageMeter.md +31 -0
- package/dist/llms/Video.md +46 -0
- package/dist/llms/VirtualList.md +31 -0
- package/dist/llms/VisuallyHidden.md +19 -0
- package/dist/llms/VoiceVisualizer.md +30 -0
- package/dist/llms/WaterfallChart.md +25 -0
- package/dist/llms/Watermark.md +27 -0
- package/dist/llms/colorSwatch.md +13 -0
- package/dist/llms-full.txt +6 -3
- package/dist/llms.txt +4 -2
- package/dist/locales/en/data-display.json +3 -0
- package/dist/locales/ja/data-display.json +3 -0
- package/dist/locales/pt/data-display.json +3 -0
- package/dist/styles.css +1 -1
- package/dist/wimui.umd.js +5 -5
- package/package.json +10 -3
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
3
|
import { commonNs as t } from "../../../i18n/generated/common.js";
|
|
4
4
|
import { Checkbox as n } from "../../form/Checkbox/Checkbox.js";
|
|
5
|
-
import { useAnnounce as r } from "../../_internal/useAnnounce.js";
|
|
6
|
-
import { Pagination as
|
|
7
|
-
import { Table as
|
|
8
|
-
import { useFixedColumns as
|
|
9
|
-
import { useDataGridKeyboard as
|
|
10
|
-
import { useInfiniteScroll as
|
|
5
|
+
import { useAnnounce as r, useAnnounceAppearance as i } from "../../_internal/useAnnounce.js";
|
|
6
|
+
import { Pagination as a } from "../../navigation/Pagination/Pagination.js";
|
|
7
|
+
import { Table as o } from "../Table/Table.js";
|
|
8
|
+
import { useFixedColumns as s } from "./useFixedColumns.js";
|
|
9
|
+
import { useDataGridKeyboard as c } from "./useDataGridKeyboard.js";
|
|
10
|
+
import { useInfiniteScroll as ee } from "./useInfiniteScroll.js";
|
|
11
11
|
import l from "./datagrid.module.js";
|
|
12
12
|
import u, { useCallback as d, useMemo as f, useState as p } from "react";
|
|
13
13
|
import m from "classnames";
|
|
14
14
|
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
15
15
|
//#region src/components/data-display/DataGrid/DataGrid.tsx
|
|
16
|
-
function _({ columns: _, data: v, rowKey: y = "id", loading: b = !1, striped:
|
|
16
|
+
function _({ columns: _, data: v, rowKey: y = "id", loading: b = !1, striped: te = !1, bordered: x = !1, hoverable: S = !0, stickyHeader: C = !0, height: w, maxHeight: T, emptyMessage: E, mobileCard: D = !1, selection: O, selectedRowKeys: k, onSelectionChange: A, sortConfig: j, onSortChange: M, pagination: N, infiniteScroll: P, className: F, ariaLabel: I, "aria-label": L, "aria-labelledby": R }) {
|
|
17
17
|
let { t: z } = e(t), B = b !== !1 && b !== void 0, V = b === !0 || b === "blocking", H = f(() => O ? O === !0 ? {
|
|
18
18
|
type: "checkbox",
|
|
19
19
|
selectedRowKeys: k ?? [],
|
|
@@ -31,7 +31,7 @@ function _({ columns: _, data: v, rowKey: y = "id", loading: b = !1, striped: x
|
|
|
31
31
|
let t = new ResizeObserver(() => G(e.offsetWidth));
|
|
32
32
|
return t.observe(e, { box: "border-box" }), () => t.disconnect();
|
|
33
33
|
}, [K]);
|
|
34
|
-
let { fixedLeftOffsets: q, fixedRightOffsets: J } =
|
|
34
|
+
let { fixedLeftOffsets: q, fixedRightOffsets: J } = s(_, !!H, W), Y = (e, t = !1) => {
|
|
35
35
|
let n = q[e];
|
|
36
36
|
if (n) return {
|
|
37
37
|
stickyLeft: !0,
|
|
@@ -50,25 +50,26 @@ function _({ columns: _, data: v, rowKey: y = "id", loading: b = !1, striped: x
|
|
|
50
50
|
v,
|
|
51
51
|
H,
|
|
52
52
|
X
|
|
53
|
-
]),
|
|
53
|
+
]), ne = f(() => H ? !Z && v.some((e) => H.selectedRowKeys.includes(X(e))) : !1, [
|
|
54
54
|
v,
|
|
55
55
|
H,
|
|
56
56
|
Z,
|
|
57
57
|
X
|
|
58
|
-
]),
|
|
58
|
+
]), re = (e) => {
|
|
59
59
|
if (!H) return;
|
|
60
60
|
let t = e.target.checked, n = t ? v.map(X) : [], r = t ? v : [];
|
|
61
61
|
H.onChange(n, r);
|
|
62
|
-
},
|
|
62
|
+
}, ie = (e, t) => {
|
|
63
63
|
if (!H) return;
|
|
64
64
|
let n = t.target.checked, r = X(e), i = n ? [...H.selectedRowKeys, r] : H.selectedRowKeys.filter((e) => e !== r), a = v.filter((e) => i.includes(X(e)));
|
|
65
65
|
H.onChange(i, a);
|
|
66
|
-
}, { focusedCell:
|
|
66
|
+
}, { focusedCell: Q, handleKeyDown: ae, containerRef: oe } = c(_, v, !!H), { loaderRef: se } = ee(P), ce = _.length + +!!H, { announce: le, region: ue } = r(), $ = v.length === 0 && !!E, { ref: de, region: fe } = i($);
|
|
67
67
|
return /* @__PURE__ */ g("div", {
|
|
68
68
|
className: m("wim-data-grid", l.root, V && l.loading, D === "md" ? l.mobileCardMd : D && l.mobileCard, F),
|
|
69
69
|
"aria-busy": B || void 0,
|
|
70
70
|
children: [
|
|
71
|
-
|
|
71
|
+
ue,
|
|
72
|
+
fe,
|
|
72
73
|
/* @__PURE__ */ g("div", {
|
|
73
74
|
className: l.container,
|
|
74
75
|
style: {
|
|
@@ -77,24 +78,24 @@ function _({ columns: _, data: v, rowKey: y = "id", loading: b = !1, striped: x
|
|
|
77
78
|
},
|
|
78
79
|
inert: V || void 0,
|
|
79
80
|
children: [
|
|
80
|
-
/* @__PURE__ */ g(
|
|
81
|
-
ref:
|
|
82
|
-
onKeyDown:
|
|
81
|
+
/* @__PURE__ */ g(o, {
|
|
82
|
+
ref: oe,
|
|
83
|
+
onKeyDown: ae,
|
|
83
84
|
tabIndex: 0,
|
|
84
85
|
role: "grid",
|
|
85
86
|
"aria-label": R ? void 0 : L ?? I ?? z("a11y.data_grid"),
|
|
86
87
|
"aria-labelledby": R,
|
|
87
88
|
"aria-rowcount": v.length + 1,
|
|
88
|
-
"aria-colcount":
|
|
89
|
-
striped:
|
|
90
|
-
bordered:
|
|
89
|
+
"aria-colcount": ce,
|
|
90
|
+
striped: te,
|
|
91
|
+
bordered: x,
|
|
91
92
|
hoverable: S,
|
|
92
93
|
stickyHeader: C,
|
|
93
94
|
mobileCard: D,
|
|
94
95
|
fullWidth: !0,
|
|
95
96
|
className: m("wim-table", l.table),
|
|
96
97
|
containerClassName: l.tableContainer,
|
|
97
|
-
children: [/* @__PURE__ */ h(
|
|
98
|
+
children: [/* @__PURE__ */ h(o.Header, { children: /* @__PURE__ */ g(o.Row, { children: [H && /* @__PURE__ */ h(o.Head, {
|
|
98
99
|
ref: U,
|
|
99
100
|
role: "columnheader",
|
|
100
101
|
selection: !0,
|
|
@@ -104,16 +105,16 @@ function _({ columns: _, data: v, rowKey: y = "id", loading: b = !1, striped: x
|
|
|
104
105
|
"data-row": -1,
|
|
105
106
|
"data-col": -1,
|
|
106
107
|
"aria-label": z("a11y.select_all_rows"),
|
|
107
|
-
tabIndex:
|
|
108
|
+
tabIndex: Q.row === -1 && Q.col === -1 ? 0 : -1,
|
|
108
109
|
children: (H.type ?? "checkbox") === "checkbox" && /* @__PURE__ */ h(n, {
|
|
109
110
|
checked: Z,
|
|
110
|
-
indeterminate:
|
|
111
|
-
onChange:
|
|
111
|
+
indeterminate: ne,
|
|
112
|
+
onChange: re,
|
|
112
113
|
"aria-label": z("a11y.select_all_rows")
|
|
113
114
|
})
|
|
114
115
|
}), _.map((e, t) => {
|
|
115
116
|
let n = Y(e.key, !0);
|
|
116
|
-
return /* @__PURE__ */ h(
|
|
117
|
+
return /* @__PURE__ */ h(o.Head, {
|
|
117
118
|
role: "columnheader",
|
|
118
119
|
style: {
|
|
119
120
|
width: e.width,
|
|
@@ -124,19 +125,19 @@ function _({ columns: _, data: v, rowKey: y = "id", loading: b = !1, striped: x
|
|
|
124
125
|
onSort: () => {
|
|
125
126
|
if (!e.sortable || !M) return;
|
|
126
127
|
let t = j?.key === e.key ? j.direction === "asc" ? "desc" : j.direction === "desc" ? "none" : "asc" : "asc", n = typeof e.title == "string" ? e.title : e.key;
|
|
127
|
-
|
|
128
|
+
le(z(t === "asc" ? "dataGrid.sorted_ascending" : t === "desc" ? "dataGrid.sorted_descending" : "dataGrid.sort_cleared", { column: n })), M(e.key, t);
|
|
128
129
|
},
|
|
129
130
|
...n,
|
|
130
|
-
tabIndex:
|
|
131
|
+
tabIndex: Q.row === -1 && Q.col === (H ? t + 1 : t) ? 0 : -1,
|
|
131
132
|
"data-row": -1,
|
|
132
133
|
"data-col": H ? t + 1 : t,
|
|
133
134
|
children: e.title
|
|
134
135
|
}, e.key);
|
|
135
|
-
})] }) }), /* @__PURE__ */ h(
|
|
136
|
+
})] }) }), /* @__PURE__ */ h(o.Body, { children: v.map((e, t) => {
|
|
136
137
|
let r = X(e), i = H?.selectedRowKeys.includes(r);
|
|
137
|
-
return /* @__PURE__ */ g(
|
|
138
|
+
return /* @__PURE__ */ g(o.Row, {
|
|
138
139
|
selected: i,
|
|
139
|
-
children: [H && /* @__PURE__ */ h(
|
|
140
|
+
children: [H && /* @__PURE__ */ h(o.Cell, {
|
|
140
141
|
role: "gridcell",
|
|
141
142
|
selection: !0,
|
|
142
143
|
stickyLeft: !0,
|
|
@@ -144,37 +145,37 @@ function _({ columns: _, data: v, rowKey: y = "id", loading: b = !1, striped: x
|
|
|
144
145
|
stickyZIndex: 150,
|
|
145
146
|
"data-row": t,
|
|
146
147
|
"data-col": -1,
|
|
147
|
-
tabIndex:
|
|
148
|
+
tabIndex: Q.row === t && Q.col === -1 ? 0 : -1,
|
|
148
149
|
children: /* @__PURE__ */ h(n, {
|
|
149
150
|
checked: i,
|
|
150
|
-
onChange: (t) =>
|
|
151
|
+
onChange: (t) => ie(e, t),
|
|
151
152
|
"aria-label": z("a11y.select_row_numbered", { row: t + 1 })
|
|
152
153
|
})
|
|
153
154
|
}), _.map((n, r) => {
|
|
154
|
-
let i = Y(n.key, !1),
|
|
155
|
-
return /* @__PURE__ */ h(
|
|
155
|
+
let i = Y(n.key, !1), a = e[n.dataIndex ?? n.key];
|
|
156
|
+
return /* @__PURE__ */ h(o.Cell, {
|
|
156
157
|
role: "gridcell",
|
|
157
158
|
label: typeof n.title == "string" ? n.title : void 0,
|
|
158
159
|
...i,
|
|
159
160
|
"data-row": t,
|
|
160
161
|
"data-col": H ? r + 1 : r,
|
|
161
|
-
tabIndex:
|
|
162
|
-
children: n.maxWidth == null ? n.render ? n.render(
|
|
162
|
+
tabIndex: Q.row === t && Q.col === (H ? r + 1 : r) ? 0 : -1,
|
|
163
|
+
children: n.maxWidth == null ? n.render ? n.render(a, e, t) : a : /* @__PURE__ */ h("div", {
|
|
163
164
|
style: { maxWidth: n.maxWidth },
|
|
164
|
-
children: n.render ? n.render(
|
|
165
|
+
children: n.render ? n.render(a, e, t) : a
|
|
165
166
|
})
|
|
166
167
|
}, n.key);
|
|
167
168
|
})]
|
|
168
169
|
}, r);
|
|
169
170
|
}) })]
|
|
170
171
|
}),
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
$ && /* @__PURE__ */ h("div", {
|
|
173
|
+
ref: de,
|
|
173
174
|
className: l.empty,
|
|
174
175
|
children: E
|
|
175
176
|
}),
|
|
176
177
|
P?.hasMore && /* @__PURE__ */ h("div", {
|
|
177
|
-
ref:
|
|
178
|
+
ref: se,
|
|
178
179
|
className: l.loader,
|
|
179
180
|
children: P.hasMore && z("dataGrid.loading_more")
|
|
180
181
|
})
|
|
@@ -194,7 +195,7 @@ function _({ columns: _, data: v, rowKey: y = "id", loading: b = !1, striped: x
|
|
|
194
195
|
})]
|
|
195
196
|
}), /* @__PURE__ */ h("div", {
|
|
196
197
|
className: l.pagination,
|
|
197
|
-
children: /* @__PURE__ */ h(
|
|
198
|
+
children: /* @__PURE__ */ h(a, {
|
|
198
199
|
className: l.paginationContent,
|
|
199
200
|
current: N.current,
|
|
200
201
|
total: N.total,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("./infinite-scroll.module.cjs");let
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../_internal/useAnnounce.cjs"),r=require("../../feedback/Spinner/Spinner.cjs"),i=require("../../../i18n/generated/data-display.cjs"),a=require("./infinite-scroll.module.cjs");let o=require("react");o=e.__toESM(o,1);let s=require("classnames");s=e.__toESM(s,1);let c=require("react/jsx-runtime");var l=({children:e,hasMore:l=!1,loading:u=!1,onLoadMore:d,loader:f,threshold:p=250,className:m,container:h})=>{let g=(0,o.useRef)(null),{t:_}=t.useWimTranslation(i.dataDisplayNs),{ref:v,region:y}=n.useAnnounceAppearance(u),b=(0,o.useCallback)(e=>{let[t]=e;t.isIntersecting&&l&&d()},[l,d]);return(0,o.useEffect)(()=>{let e={root:h?.current||null,rootMargin:`0px 0px ${p}px 0px`,threshold:0},t=new IntersectionObserver(b,e),n=g.current;return n&&t.observe(n),()=>{n&&t.unobserve(n)}},[b,h,p]),(0,c.jsxs)(`div`,{className:(0,s.default)(`wim-infinite-scroll`,a.default.root,m),children:[y,e,u&&(0,c.jsx)(`div`,{ref:v,className:a.default.loader,children:(0,c.jsx)(n.AnnouncedByParent.Provider,{value:!0,children:f??(0,c.jsx)(r.Spinner,{size:`sm`,label:_(`infinite_scroll.loading`)})})}),l&&(0,c.jsx)(`div`,{ref:g,className:a.default.loader})]})};exports.InfiniteScroll=l;
|
|
@@ -8,7 +8,7 @@ export interface InfiniteScrollProps {
|
|
|
8
8
|
loading?: boolean;
|
|
9
9
|
/** Callback to load the next batch of data. */
|
|
10
10
|
onLoadMore: () => void;
|
|
11
|
-
/** Element shown while loading. */
|
|
11
|
+
/** Element shown while loading. Defaults to a spinner with a localized "Loading more…" text. Its text is announced to screen readers when loading starts. */
|
|
12
12
|
loader?: React.ReactNode;
|
|
13
13
|
/** Scroll threshold (px). onLoadMore is called when the scroll position gets this close to the bottom. */
|
|
14
14
|
threshold?: number;
|
|
@@ -1,42 +1,53 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import e from "
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
2
|
+
import { useWimTranslation as e } from "../../../i18n/useWimTranslation.js";
|
|
3
|
+
import { AnnouncedByParent as t, useAnnounceAppearance as n } from "../../_internal/useAnnounce.js";
|
|
4
|
+
import { Spinner as r } from "../../feedback/Spinner/Spinner.js";
|
|
5
|
+
import { dataDisplayNs as i } from "../../../i18n/generated/data-display.js";
|
|
6
|
+
import a from "./infinite-scroll.module.js";
|
|
7
|
+
import { useCallback as o, useEffect as s, useRef as c } from "react";
|
|
8
|
+
import l from "classnames";
|
|
9
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
6
10
|
//#region src/components/data-display/InfiniteScroll/InfiniteScroll.tsx
|
|
7
|
-
var
|
|
8
|
-
let
|
|
11
|
+
var f = ({ children: f, hasMore: p = !1, loading: m = !1, onLoadMore: h, loader: g, threshold: _ = 250, className: v, container: y }) => {
|
|
12
|
+
let b = c(null), { t: x } = e(i), { ref: S, region: C } = n(m), w = o((e) => {
|
|
9
13
|
let [t] = e;
|
|
10
|
-
t.isIntersecting &&
|
|
11
|
-
}, [
|
|
12
|
-
return
|
|
14
|
+
t.isIntersecting && p && h();
|
|
15
|
+
}, [p, h]);
|
|
16
|
+
return s(() => {
|
|
13
17
|
let e = {
|
|
14
|
-
root:
|
|
15
|
-
rootMargin: `0px 0px ${
|
|
18
|
+
root: y?.current || null,
|
|
19
|
+
rootMargin: `0px 0px ${_}px 0px`,
|
|
16
20
|
threshold: 0
|
|
17
|
-
}, t = new IntersectionObserver(
|
|
21
|
+
}, t = new IntersectionObserver(w, e), n = b.current;
|
|
18
22
|
return n && t.observe(n), () => {
|
|
19
23
|
n && t.unobserve(n);
|
|
20
24
|
};
|
|
21
25
|
}, [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
]), /* @__PURE__ */
|
|
26
|
-
className:
|
|
26
|
+
w,
|
|
27
|
+
y,
|
|
28
|
+
_
|
|
29
|
+
]), /* @__PURE__ */ d("div", {
|
|
30
|
+
className: l("wim-infinite-scroll", a.root, v),
|
|
27
31
|
children: [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
C,
|
|
33
|
+
f,
|
|
34
|
+
m && /* @__PURE__ */ u("div", {
|
|
35
|
+
ref: S,
|
|
36
|
+
className: a.loader,
|
|
37
|
+
children: /* @__PURE__ */ u(t.Provider, {
|
|
38
|
+
value: !0,
|
|
39
|
+
children: g ?? /* @__PURE__ */ u(r, {
|
|
40
|
+
size: "sm",
|
|
41
|
+
label: x("infinite_scroll.loading")
|
|
42
|
+
})
|
|
43
|
+
})
|
|
33
44
|
}),
|
|
34
|
-
|
|
35
|
-
ref:
|
|
36
|
-
className:
|
|
45
|
+
p && /* @__PURE__ */ u("div", {
|
|
46
|
+
ref: b,
|
|
47
|
+
className: a.loader
|
|
37
48
|
})
|
|
38
49
|
]
|
|
39
50
|
});
|
|
40
51
|
};
|
|
41
52
|
//#endregion
|
|
42
|
-
export {
|
|
53
|
+
export { f as InfiniteScroll };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../utilities/style-utils.cjs"),n=require("./spinner.module.cjs");let
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../utilities/style-utils.cjs"),n=require("../../_internal/useAnnounce.cjs"),r=require("./spinner.module.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("classnames");a=e.__toESM(a,1);let o=require("react/jsx-runtime");var s=500,c=({size:e=`md`,color:c=`primary`,label:l,labelPosition:u=`right`,className:d,style:f,...p})=>{let m=typeof c==`string`&&[`primary`,`secondary`,`success`,`warning`,`danger`,`neutral`].includes(c),h=(0,i.useContext)(n.AnnouncedByParent),g=!!l&&!h,{announce:_,clear:v,region:y}=n.useAnnounce();return(0,i.useEffect)(()=>{g&&l?_(l,{delay:s}):v()},[g,l,_,v]),(0,o.jsxs)(`div`,{className:(0,a.default)(r.default.container,l&&r.default[`label-${u}`],d),style:{color:m?void 0:t.getColorValue(c),...f},...p,children:[(0,o.jsxs)(`svg`,{className:(0,a.default)(`wim-spinner`,r.default.root,r.default[e],m&&r.default[c]),viewBox:`0 0 50 50`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,children:[(0,o.jsx)(`circle`,{className:r.default.track,cx:`25`,cy:`25`,r:`20`,stroke:`currentColor`,strokeWidth:`4`}),(0,o.jsx)(`circle`,{className:r.default.head,cx:`25`,cy:`25`,r:`20`,stroke:`currentColor`,strokeWidth:`4`,strokeLinecap:`round`,strokeDasharray:`126`,strokeDashoffset:`100`})]}),l&&(0,o.jsx)(`span`,{className:r.default.label,children:l}),g&&y]})};exports.Spinner=c;
|
|
@@ -1,57 +1,67 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { getColorValue as e } from "../../../utilities/style-utils.js";
|
|
3
|
-
import t from "
|
|
4
|
-
import "
|
|
5
|
-
import
|
|
6
|
-
import
|
|
3
|
+
import { AnnouncedByParent as t, useAnnounce as n } from "../../_internal/useAnnounce.js";
|
|
4
|
+
import r from "./spinner.module.js";
|
|
5
|
+
import { useContext as i, useEffect as a } from "react";
|
|
6
|
+
import o from "classnames";
|
|
7
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
8
|
//#region src/components/feedback/Spinner/Spinner.tsx
|
|
8
|
-
var
|
|
9
|
-
let
|
|
9
|
+
var l = 500, u = ({ size: u = "md", color: d = "primary", label: f, labelPosition: p = "right", className: m, style: h, ...g }) => {
|
|
10
|
+
let _ = typeof d == "string" && [
|
|
10
11
|
"primary",
|
|
11
12
|
"secondary",
|
|
12
13
|
"success",
|
|
13
14
|
"warning",
|
|
14
15
|
"danger",
|
|
15
16
|
"neutral"
|
|
16
|
-
].includes(
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
].includes(d), v = i(t), y = !!f && !v, { announce: b, clear: x, region: S } = n();
|
|
18
|
+
return a(() => {
|
|
19
|
+
y && f ? b(f, { delay: l }) : x();
|
|
20
|
+
}, [
|
|
21
|
+
y,
|
|
22
|
+
f,
|
|
23
|
+
b,
|
|
24
|
+
x
|
|
25
|
+
]), /* @__PURE__ */ c("div", {
|
|
26
|
+
className: o(r.container, f && r[`label-${p}`], m),
|
|
21
27
|
style: {
|
|
22
|
-
color:
|
|
23
|
-
...
|
|
28
|
+
color: _ ? void 0 : e(d),
|
|
29
|
+
...h
|
|
24
30
|
},
|
|
25
|
-
...
|
|
26
|
-
children: [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
31
|
+
...g,
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ c("svg", {
|
|
34
|
+
className: o("wim-spinner", r.root, r[u], _ && r[d]),
|
|
35
|
+
viewBox: "0 0 50 50",
|
|
36
|
+
fill: "none",
|
|
37
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
children: [/* @__PURE__ */ s("circle", {
|
|
40
|
+
className: r.track,
|
|
41
|
+
cx: "25",
|
|
42
|
+
cy: "25",
|
|
43
|
+
r: "20",
|
|
44
|
+
stroke: "currentColor",
|
|
45
|
+
strokeWidth: "4"
|
|
46
|
+
}), /* @__PURE__ */ s("circle", {
|
|
47
|
+
className: r.head,
|
|
48
|
+
cx: "25",
|
|
49
|
+
cy: "25",
|
|
50
|
+
r: "20",
|
|
51
|
+
stroke: "currentColor",
|
|
52
|
+
strokeWidth: "4",
|
|
53
|
+
strokeLinecap: "round",
|
|
54
|
+
strokeDasharray: "126",
|
|
55
|
+
strokeDashoffset: "100"
|
|
56
|
+
})]
|
|
57
|
+
}),
|
|
58
|
+
f && /* @__PURE__ */ s("span", {
|
|
59
|
+
className: r.label,
|
|
60
|
+
children: f
|
|
61
|
+
}),
|
|
62
|
+
y && S
|
|
63
|
+
]
|
|
54
64
|
});
|
|
55
65
|
};
|
|
56
66
|
//#endregion
|
|
57
|
-
export {
|
|
67
|
+
export { u as Spinner };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../hooks/useMergedRef.cjs"),n=require("../../_internal/useInlineFloating.cjs"),r=require("../../_internal/BaseListItem/BaseListItem.cjs"),i=require("../InputBase/InputBase.cjs"),a=require("../FieldTemplate/FieldTemplate.cjs"),o=require("./combobox.module.cjs");let
|
|
2
|
+
const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../hooks/useMergedRef.cjs"),n=require("../../_internal/useInlineFloating.cjs"),r=require("../../_internal/BaseListItem/BaseListItem.cjs"),i=require("../InputBase/InputBase.cjs"),a=require("../FieldTemplate/FieldTemplate.cjs"),o=require("../../_internal/useAnnounce.cjs"),s=require("./combobox.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=({options:e=[],onChange:d,placeholder:f,showSearchIcon:p=!0,allowClear:m=!0,defaultValue:h=``,className:g,disabled:_=!1,label:v,error:y,required:b,layout:x,fullWidth:S=!1,id:C,labels:w={},...T})=>{let{noResults:E=`No results found`}=w,[D,O]=(0,c.useState)(!1),[k,A]=(0,c.useState)(h),[j,M]=(0,c.useState)(-1),[N,P]=(0,c.useState)(!1),F=(0,c.useRef)(null),I=(0,c.useId)(),L=C||`wim-combobox-${I}`,R=`${L}-list`,z=v?`${L}-label`:void 0,B=y?`${L}-error`:void 0,V=(0,c.useMemo)(()=>{let t=(k||``).toLowerCase();return e.filter(e=>e.label.toLowerCase().includes(t))},[e,k]);(0,c.useEffect)(()=>{let e=e=>{F.current&&!F.current.contains(e.target)&&O(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]);let H=e=>{let t=e.target.value;A(t),O(!0),M(-1)},U=e=>{A(e.label),O(!1),d&&d(e)},W=e=>{if(P(!0),!D&&e.key===`ArrowDown`)O(!0);else switch(e.key){case`ArrowDown`:M(e=>e<V.length-1?e+1:0);break;case`ArrowUp`:M(e=>e<=0?V.length-1:e-1);break;case`Enter`:j>=0&&j<V.length&&U(V[j]);break;case`Escape`:O(!1);break;case`Tab`:O(!1)}},{setReference:G,setFloating:K,floatingProps:q}=n.useInlineFloating({open:D}),J=t.useMergedRef(F,G),Y=D&&V.length===0,{ref:X,region:Z}=o.useAnnounceAppearance(Y);return(0,u.jsx)(a.FieldTemplate,{label:v,error:y,required:b,layout:x,labelId:z,htmlFor:L,errorId:B,className:g,children:(0,u.jsxs)(`div`,{className:(0,l.default)(`wim-combobox`,s.default.root,S&&s.default.fullWidth),ref:J,onMouseMove:()=>P(!1),"data-keyboard-nav":N,children:[Z,(0,u.jsx)(i.InputBase,{disabled:_,allowClear:m,hasValue:!!k,onClear:()=>A(``),intent:y?`danger`:`default`,leftIcon:p?`SearchIcon`:void 0,fullWidth:S,rightIcons:[{name:`ChevronDownIcon`,rotated:D,onClick:()=>O(!D),decorative:!0}],children:(0,u.jsx)(`input`,{id:L,className:s.default.input,placeholder:f,value:k,onChange:H,onKeyDown:W,onFocus:()=>O(!0),disabled:_,autoComplete:`off`,role:`combobox`,"aria-autocomplete":`list`,"aria-expanded":D,"aria-controls":D?R:void 0,"aria-labelledby":z,"aria-describedby":B,required:b,"aria-invalid":!!y,"aria-activedescendant":D&&j>=0?`${R}-option-${j}`:void 0,...T})}),D&&V.length>0&&(0,u.jsx)(`div`,{className:s.default.dropdown,ref:K,...q,children:(0,u.jsx)(`ul`,{id:R,className:s.default.list,role:`listbox`,"aria-labelledby":z,children:V.map((e,t)=>(0,u.jsx)(r.BaseListItem,{asChild:!0,id:`${R}-option-${t}`,className:(0,l.default)(s.default.option,t===j&&s.default.selected),active:t===j,onClick:()=>U(e),onMouseEnter:()=>M(t),role:`option`,"aria-selected":t===j,children:(0,u.jsx)(`li`,{children:e.label})},e.value))})}),Y&&(0,u.jsx)(`div`,{className:s.default.dropdown,ref:K,...q,children:(0,u.jsx)(`div`,{className:s.default.empty,ref:X,children:E})})]})})};d.displayName=`Combobox`,exports.Combobox=d;
|
|
@@ -4,17 +4,18 @@ import { useInlineFloating as t } from "../../_internal/useInlineFloating.js";
|
|
|
4
4
|
import { BaseListItem as n } from "../../_internal/BaseListItem/BaseListItem.js";
|
|
5
5
|
import { InputBase as r } from "../InputBase/InputBase.js";
|
|
6
6
|
import { FieldTemplate as i } from "../FieldTemplate/FieldTemplate.js";
|
|
7
|
-
import a from "
|
|
8
|
-
import
|
|
9
|
-
import d from "
|
|
10
|
-
import
|
|
7
|
+
import { useAnnounceAppearance as a } from "../../_internal/useAnnounce.js";
|
|
8
|
+
import o from "./combobox.module.js";
|
|
9
|
+
import { useEffect as s, useId as c, useMemo as l, useRef as u, useState as d } from "react";
|
|
10
|
+
import f from "classnames";
|
|
11
|
+
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
11
12
|
//#region src/components/form/Combobox/Combobox.tsx
|
|
12
|
-
var
|
|
13
|
-
let { noResults: A = "No results found" } =
|
|
13
|
+
var h = ({ options: h = [], onChange: g, placeholder: _, showSearchIcon: v = !0, allowClear: y = !0, defaultValue: b = "", className: x, disabled: S = !1, label: C, error: w, required: T, layout: E, fullWidth: D = !1, id: O, labels: k = {}, ...ee }) => {
|
|
14
|
+
let { noResults: A = "No results found" } = k, [j, M] = d(!1), [N, P] = d(b), [F, I] = d(-1), [L, R] = d(!1), z = u(null), B = c(), V = O || `wim-combobox-${B}`, H = `${V}-list`, U = C ? `${V}-label` : void 0, W = w ? `${V}-error` : void 0, G = l(() => {
|
|
14
15
|
let e = (N || "").toLowerCase();
|
|
15
|
-
return
|
|
16
|
-
}, [
|
|
17
|
-
|
|
16
|
+
return h.filter((t) => t.label.toLowerCase().includes(e));
|
|
17
|
+
}, [h, N]);
|
|
18
|
+
s(() => {
|
|
18
19
|
let e = (e) => {
|
|
19
20
|
z.current && !z.current.contains(e.target) && M(!1);
|
|
20
21
|
};
|
|
@@ -24,7 +25,7 @@ var m = ({ options: m = [], onChange: h, placeholder: g, showSearchIcon: _ = !0,
|
|
|
24
25
|
let t = e.target.value;
|
|
25
26
|
P(t), M(!0), I(-1);
|
|
26
27
|
}, q = (e) => {
|
|
27
|
-
P(e.label), M(!1),
|
|
28
|
+
P(e.label), M(!1), g && g(e);
|
|
28
29
|
}, J = (e) => {
|
|
29
30
|
if (R(!0), !j && e.key === "ArrowDown") M(!0);
|
|
30
31
|
else switch (e.key) {
|
|
@@ -42,45 +43,46 @@ var m = ({ options: m = [], onChange: h, placeholder: g, showSearchIcon: _ = !0,
|
|
|
42
43
|
break;
|
|
43
44
|
case "Tab": M(!1);
|
|
44
45
|
}
|
|
45
|
-
}, { setReference: Y, setFloating: X, floatingProps: Z } = t({ open: j }), Q = e(z, Y);
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
label:
|
|
48
|
-
error:
|
|
49
|
-
required:
|
|
50
|
-
layout:
|
|
46
|
+
}, { setReference: Y, setFloating: X, floatingProps: Z } = t({ open: j }), Q = e(z, Y), $ = j && G.length === 0, { ref: te, region: ne } = a($);
|
|
47
|
+
return /* @__PURE__ */ p(i, {
|
|
48
|
+
label: C,
|
|
49
|
+
error: w,
|
|
50
|
+
required: T,
|
|
51
|
+
layout: E,
|
|
51
52
|
labelId: U,
|
|
52
53
|
htmlFor: V,
|
|
53
54
|
errorId: W,
|
|
54
|
-
className:
|
|
55
|
-
children: /* @__PURE__ */
|
|
56
|
-
className:
|
|
55
|
+
className: x,
|
|
56
|
+
children: /* @__PURE__ */ m("div", {
|
|
57
|
+
className: f("wim-combobox", o.root, D && o.fullWidth),
|
|
57
58
|
ref: Q,
|
|
58
59
|
onMouseMove: () => R(!1),
|
|
59
60
|
"data-keyboard-nav": L,
|
|
60
61
|
children: [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
ne,
|
|
63
|
+
/* @__PURE__ */ p(r, {
|
|
64
|
+
disabled: S,
|
|
65
|
+
allowClear: y,
|
|
64
66
|
hasValue: !!N,
|
|
65
67
|
onClear: () => P(""),
|
|
66
|
-
intent:
|
|
67
|
-
leftIcon:
|
|
68
|
-
fullWidth:
|
|
68
|
+
intent: w ? "danger" : "default",
|
|
69
|
+
leftIcon: v ? "SearchIcon" : void 0,
|
|
70
|
+
fullWidth: D,
|
|
69
71
|
rightIcons: [{
|
|
70
72
|
name: "ChevronDownIcon",
|
|
71
73
|
rotated: j,
|
|
72
74
|
onClick: () => M(!j),
|
|
73
75
|
decorative: !0
|
|
74
76
|
}],
|
|
75
|
-
children: /* @__PURE__ */
|
|
77
|
+
children: /* @__PURE__ */ p("input", {
|
|
76
78
|
id: V,
|
|
77
|
-
className:
|
|
78
|
-
placeholder:
|
|
79
|
+
className: o.input,
|
|
80
|
+
placeholder: _,
|
|
79
81
|
value: N,
|
|
80
82
|
onChange: K,
|
|
81
83
|
onKeyDown: J,
|
|
82
84
|
onFocus: () => M(!0),
|
|
83
|
-
disabled:
|
|
85
|
+
disabled: S,
|
|
84
86
|
autoComplete: "off",
|
|
85
87
|
role: "combobox",
|
|
86
88
|
"aria-autocomplete": "list",
|
|
@@ -88,42 +90,41 @@ var m = ({ options: m = [], onChange: h, placeholder: g, showSearchIcon: _ = !0,
|
|
|
88
90
|
"aria-controls": j ? H : void 0,
|
|
89
91
|
"aria-labelledby": U,
|
|
90
92
|
"aria-describedby": W,
|
|
91
|
-
required:
|
|
92
|
-
"aria-invalid": !!
|
|
93
|
+
required: T,
|
|
94
|
+
"aria-invalid": !!w,
|
|
93
95
|
"aria-activedescendant": j && F >= 0 ? `${H}-option-${F}` : void 0,
|
|
94
|
-
...
|
|
96
|
+
...ee
|
|
95
97
|
})
|
|
96
98
|
}),
|
|
97
|
-
j && G.length > 0 && /* @__PURE__ */
|
|
98
|
-
className:
|
|
99
|
+
j && G.length > 0 && /* @__PURE__ */ p("div", {
|
|
100
|
+
className: o.dropdown,
|
|
99
101
|
ref: X,
|
|
100
102
|
...Z,
|
|
101
|
-
children: /* @__PURE__ */
|
|
103
|
+
children: /* @__PURE__ */ p("ul", {
|
|
102
104
|
id: H,
|
|
103
|
-
className:
|
|
105
|
+
className: o.list,
|
|
104
106
|
role: "listbox",
|
|
105
107
|
"aria-labelledby": U,
|
|
106
|
-
children: G.map((e, t) => /* @__PURE__ */
|
|
108
|
+
children: G.map((e, t) => /* @__PURE__ */ p(n, {
|
|
107
109
|
asChild: !0,
|
|
108
110
|
id: `${H}-option-${t}`,
|
|
109
|
-
className:
|
|
111
|
+
className: f(o.option, t === F && o.selected),
|
|
110
112
|
active: t === F,
|
|
111
113
|
onClick: () => q(e),
|
|
112
114
|
onMouseEnter: () => I(t),
|
|
113
115
|
role: "option",
|
|
114
116
|
"aria-selected": t === F,
|
|
115
|
-
children: /* @__PURE__ */
|
|
117
|
+
children: /* @__PURE__ */ p("li", { children: e.label })
|
|
116
118
|
}, e.value))
|
|
117
119
|
})
|
|
118
120
|
}),
|
|
119
|
-
|
|
120
|
-
className:
|
|
121
|
+
$ && /* @__PURE__ */ p("div", {
|
|
122
|
+
className: o.dropdown,
|
|
121
123
|
ref: X,
|
|
122
124
|
...Z,
|
|
123
|
-
children: /* @__PURE__ */
|
|
124
|
-
className:
|
|
125
|
-
|
|
126
|
-
"aria-live": "polite",
|
|
125
|
+
children: /* @__PURE__ */ p("div", {
|
|
126
|
+
className: o.empty,
|
|
127
|
+
ref: te,
|
|
127
128
|
children: A
|
|
128
129
|
})
|
|
129
130
|
})
|
|
@@ -131,6 +132,6 @@ var m = ({ options: m = [], onChange: h, placeholder: g, showSearchIcon: _ = !0,
|
|
|
131
132
|
})
|
|
132
133
|
});
|
|
133
134
|
};
|
|
134
|
-
|
|
135
|
+
h.displayName = "Combobox";
|
|
135
136
|
//#endregion
|
|
136
|
-
export {
|
|
137
|
+
export { h as Combobox };
|