@bikdotai/bik-component-library 0.0.868-beta.1 → 0.0.868-beta.11
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/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +23 -10
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuItem.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/MenuList.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js.map +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js.map +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.js +1 -1
- package/dist/cjs/components/dropdown/hooks/useDropdown.js.map +1 -1
- package/dist/esm/components/ProgressChecklist/ProgressChecklist.style.d.ts +24 -59
- package/dist/esm/components/QueryBuilder/components/Connectors/Connector.styled.d.ts +1 -4
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNode.styled.d.ts +1 -4
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNode/Property/PropertyNodeUIWrapper.styled.d.ts +3 -10
- package/dist/esm/components/QueryBuilder/components/QueryBuilderNodes.styled.d.ts +2 -7
- package/dist/esm/components/TablePagination/TablePagination.styled.d.ts +3 -8
- package/dist/esm/components/TablePagination/TablePaginationCard.d.ts +2 -4
- package/dist/esm/components/TypographyStyle.d.ts +62 -141
- package/dist/esm/components/WhatsAppTextEditor/AIRephrase.styled.d.ts +2 -5
- package/dist/esm/components/WhatsAppTextEditor/CustomEditor.styled.d.ts +7 -20
- package/dist/esm/components/WhatsAppTextEditor/WhatsAppTextEditorHeader.d.ts +1 -3
- package/dist/esm/components/access-token-troubleshoot-dialog/AccessTokenTroubleshootDialog.styles.d.ts +9 -26
- package/dist/esm/components/accordion/Accordion.style.d.ts +4 -10
- package/dist/esm/components/action-button/ActionButton.styled.d.ts +2 -5
- package/dist/esm/components/adbanner/Banner.styled.d.ts +20 -88
- package/dist/esm/components/add-variableV2/AddVariableBox.styled.d.ts +1 -4
- package/dist/esm/components/add-variableV2/AddVariableV2.styled.d.ts +4 -9
- package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +186 -328
- package/dist/esm/components/agent-listing/AgentListing.styled.d.ts +49 -88
- package/dist/esm/components/alerts/Alert.styled.d.ts +5 -11
- package/dist/esm/components/analytics-card/AnalyticsCard.styled.d.ts +4 -8
- package/dist/esm/components/analytics-chips-and-dropdowns/CommonStyles.d.ts +18 -27
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/ComparisonBarChart/ComparisonBarChart.styled.d.ts +11 -26
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/FunnelChart/FunnelChart.styled.d.ts +11 -26
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.styles.d.ts +2 -5
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.d.ts +5 -12
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.styles.d.ts +3 -8
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.styles.d.ts +6 -17
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.styles.d.ts +2 -5
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMapStyled.d.ts +11 -28
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/heatmap/HeatMapVertical.d.ts +1 -3
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.d.ts +7 -18
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/scoreBlock/ScoreBlock.styled.d.ts +7 -18
- package/dist/esm/components/avatar/Avatar.styled.d.ts +2 -4
- package/dist/esm/components/bik-chatbot/components/ChatWindow.d.ts +2 -4
- package/dist/esm/components/bik-layout/BikSidebarV2/SidebarV2Styles.d.ts +18 -49
- package/dist/esm/components/bik-layout/CommonStyles.d.ts +28 -88
- package/dist/esm/components/bik-layout/SidebarStyles.d.ts +7 -17
- package/dist/esm/components/button/Button.styled.d.ts +2 -4
- package/dist/esm/components/button/themes.d.ts +2 -16
- package/dist/esm/components/buttonGroup/ButtonGroupStyle.d.ts +4 -9
- package/dist/esm/components/card-selection-modal/CardSelectionModal.styled.d.ts +2 -7
- package/dist/esm/components/card-selector/CardSelector.styled.d.ts +3 -8
- package/dist/esm/components/carousel-preview/CarouselPreview.style.d.ts +4 -9
- package/dist/esm/components/carousel-secondary/CarouselSecondary.style.d.ts +11 -23
- package/dist/esm/components/channel-playground/shell/TestingPlayground.style.d.ts +18 -74
- package/dist/esm/components/checkBox/CheckBox.styled.d.ts +4 -9
- package/dist/esm/components/checkList/CheckList.styled.d.ts +1 -4
- package/dist/esm/components/code-block/CodeBlock.styled.d.ts +20 -43
- package/dist/esm/components/colourInput/ColourInput.styled.d.ts +2 -7
- package/dist/esm/components/connected-app-dialog/ConnectedAppDialog.styled.d.ts +16 -49
- package/dist/esm/components/country-code-picker/CountryCodePicker.styled.d.ts +3 -8
- package/dist/esm/components/country-code-picker/CountryPicker.styled.d.ts +3 -8
- package/dist/esm/components/curtain/Curtain.styled.d.ts +5 -11
- package/dist/esm/components/custom-date-time/CustomDateTime.styled.d.ts +1 -4
- package/dist/esm/components/dashboard-review-popup/DashboardReviewPopUp.styled.d.ts +2 -7
- package/dist/esm/components/dashboard-review-popup/components/FiveStar.styled.d.ts +2 -7
- package/dist/esm/components/dashboard-review-popup/components/Form.styled.d.ts +7 -20
- package/dist/esm/components/data-source-panel/DataSourcePanel.style.d.ts +4 -13
- package/dist/esm/components/datePicker/DatePicker.styled.d.ts +15 -22
- package/dist/esm/components/datePicker/DatePickerWrapper.styled.d.ts +4 -8
- package/dist/esm/components/discount-modal/DiscountModal.styled.d.ts +6 -17
- package/dist/esm/components/discount-modal/DynamicCoupon/DynamicCoupon.styled.d.ts +8 -23
- package/dist/esm/components/dropdown/ChipDropdown.d.ts +2 -4
- package/dist/esm/components/dropdown/Common.styled.d.ts +6 -15
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +74 -68
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.styled.d.ts +5 -12
- package/dist/esm/components/dropdown/OpenedDropdown/components/description/Description.styled.d.ts +2 -5
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.d.ts +1 -4
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.d.ts +9 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js +157 -123
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuItem.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.d.ts +2 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js +145 -104
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/MenuList.styled.d.ts +4 -18
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js +36 -29
- package/dist/esm/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js +39 -30
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.js.map +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.d.ts +1 -4
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.d.ts +3 -16
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js +41 -24
- package/dist/esm/components/dropdown/OpenedDropdown/utils/iterationOnOptions.js.map +1 -1
- package/dist/esm/components/dropdown/hooks/useDropdown.d.ts +3 -16
- package/dist/esm/components/dropdown/hooks/useDropdown.js +159 -149
- package/dist/esm/components/dropdown/hooks/useDropdown.js.map +1 -1
- package/dist/esm/components/dropdown/type.d.ts +17 -0
- package/dist/esm/components/dropdown-button/DropdownButton.style.d.ts +5 -9
- package/dist/esm/components/dual-icon-button/DualIconButton.styled.d.ts +5 -12
- package/dist/esm/components/file-uploader/FileUploaderStyle.d.ts +4 -9
- package/dist/esm/components/floating-action-button/FloatingActionButton.styles.d.ts +13 -24
- package/dist/esm/components/half-doughnut-chart/HalfDoughnutChart.styled.d.ts +10 -29
- package/dist/esm/components/icon-button/IconButton.styled.d.ts +2 -4
- package/dist/esm/components/input/Input.styled.d.ts +29 -114
- package/dist/esm/components/keywords-input/KeywordsInput.styled.d.ts +1 -4
- package/dist/esm/components/list-item/ListItem.styled.d.ts +2 -4
- package/dist/esm/components/list-item/themes.d.ts +1 -1
- package/dist/esm/components/modals/modal.styled.d.ts +7 -16
- package/dist/esm/components/multi-level-dropdown/MultiLevelDropdown.styled.d.ts +22 -60
- package/dist/esm/components/navigation-hyperlink/NavigationHyperlink.d.ts +1 -3
- package/dist/esm/components/pagination/Pagination.styled.d.ts +1 -4
- package/dist/esm/components/plans/DurationSelectorStyles.d.ts +1 -4
- package/dist/esm/components/plans/SubscriptionPlanSelector.d.ts +2 -6
- package/dist/esm/components/plans/SubscriptionPlanStyled.d.ts +4 -9
- package/dist/esm/components/postPicker/PostPicker.styled.d.ts +13 -43
- package/dist/esm/components/product-picker/ProductPicker.styled.d.ts +2 -7
- package/dist/esm/components/product-picker-v2/style.d.ts +25 -82
- package/dist/esm/components/progress-bar/ProgressBarComponent.d.ts +2 -5
- package/dist/esm/components/radioButton/RadioButton.styled.d.ts +3 -8
- package/dist/esm/components/radioList/RadioList.styled.d.ts +1 -4
- package/dist/esm/components/shimmer/ShimmerComponent/ShimmerStyled.d.ts +4 -9
- package/dist/esm/components/side-modal/SideModal.style.d.ts +12 -25
- package/dist/esm/components/spinner/Spinner.d.ts +2 -4
- package/dist/esm/components/states/StateComponent.styled.d.ts +9 -20
- package/dist/esm/components/stepper/Stepper.styled.d.ts +4 -10
- package/dist/esm/components/switch/Switch.d.ts +6 -12
- package/dist/esm/components/tabs/Tabs.styles.d.ts +9 -30
- package/dist/esm/components/tag/Tag.styled.d.ts +2 -4
- package/dist/esm/components/template-context-mapper/Badge/index.d.ts +2 -5
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.style.d.ts +5 -14
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.d.ts +2 -4
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.d.ts +2 -7
- package/dist/esm/components/template-context-mapper/styles/TemplateAnalyticsStyles.d.ts +6 -24
- package/dist/esm/components/template-context-mapper/utils/TemplateConstants.d.ts +8 -16
- package/dist/esm/components/template-preview/EmailTemplatePreview.styled.d.ts +10 -23
- package/dist/esm/components/template-preview/RCS/RCSPreview.styled.d.ts +20 -70
- package/dist/esm/components/template-preview/SMS/SMSBubble.d.ts +2 -7
- package/dist/esm/components/template-preview/SmsTemplatePreview.styled.d.ts +10 -27
- package/dist/esm/components/template-preview/TemplatePreview.styled.d.ts +1 -4
- package/dist/esm/components/template-preview/WhatsApp/ChatHeader.style.d.ts +5 -16
- package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.d.ts +11 -53
- package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.d.ts +1 -3
- package/dist/esm/components/template-preview/WhatsApp/LimitedTimeOffer/LimitedTimeOffer.index.d.ts +3 -9
- package/dist/esm/components/template-preview/webpush/WebpushPreview.styled.d.ts +1 -4
- package/dist/esm/components/testimonial-card/TestimonialCard.style.d.ts +11 -30
- package/dist/esm/components/thumbnail/Thumbnail.styled.d.ts +2 -4
- package/dist/esm/components/toaster/Toaster.styled.d.ts +2 -4
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryCountIntentWiseModal.style.d.ts +1 -4
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.style.d.ts +1 -4
- package/dist/esm/components/variable-picker-v3/styles.d.ts +6 -15
- package/dist/esm/components/vertical-full-screen-modal/styles.d.ts +6 -15
- package/dist/esm/components/whats-new/WhatsNew.styles.d.ts +7 -18
- package/dist/esm/editor/BikEditor.styles.d.ts +7 -18
- package/dist/esm/editor/extensions/editorDropdown.styles.d.ts +12 -47
- package/package.json +4 -3
|
@@ -1,143 +1,184 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { MenuItem as
|
|
4
|
-
import { StyledGroupedLabel as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as a, Fragment as ne, jsxs as M } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as se, useRef as V, useState as N, useCallback as h, useEffect as re } from "react";
|
|
3
|
+
import { MenuItem as q } from "./MenuItem.js";
|
|
4
|
+
import { StyledGroupedLabel as le, Divider as ae } from "./MenuList.styled.js";
|
|
5
|
+
const ie = se(
|
|
6
6
|
({
|
|
7
|
-
options:
|
|
7
|
+
options: c,
|
|
8
8
|
isMultiSelect: O,
|
|
9
9
|
showDescription: b,
|
|
10
|
-
onSelect:
|
|
11
|
-
version:
|
|
12
|
-
onInfiniteScroll:
|
|
10
|
+
onSelect: x,
|
|
11
|
+
version: o,
|
|
12
|
+
onInfiniteScroll: z,
|
|
13
13
|
onDropdownItemClick: F,
|
|
14
|
-
useDefaultCursor:
|
|
15
|
-
focusedIndex:
|
|
16
|
-
isDraggable:
|
|
17
|
-
onOptionsReorder:
|
|
18
|
-
showCheckboxForCustomElement:
|
|
19
|
-
checkboxActiveColor:
|
|
20
|
-
brandSelectedRow:
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
useDefaultCursor: D,
|
|
15
|
+
focusedIndex: E = -1,
|
|
16
|
+
isDraggable: d = !1,
|
|
17
|
+
onOptionsReorder: B,
|
|
18
|
+
showCheckboxForCustomElement: j = !1,
|
|
19
|
+
checkboxActiveColor: P,
|
|
20
|
+
brandSelectedRow: T,
|
|
21
|
+
childrenLayout: R = "flyout",
|
|
22
|
+
collapsibleChildren: H = !1
|
|
23
|
+
}, l) => {
|
|
24
|
+
const f = V(null), I = V(null), [m, $] = N(null), [W, C] = N(
|
|
23
25
|
null
|
|
24
|
-
),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}),
|
|
28
|
-
}, [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}), [
|
|
32
|
-
const
|
|
33
|
-
(
|
|
34
|
-
|
|
26
|
+
), J = h(() => {
|
|
27
|
+
f.current && f.current.disconnect(), f.current = new IntersectionObserver((t) => {
|
|
28
|
+
t[0].isIntersecting && z?.();
|
|
29
|
+
}), I.current && f.current.observe(I.current);
|
|
30
|
+
}, [z]);
|
|
31
|
+
re(() => (J(), () => {
|
|
32
|
+
f.current && f.current.disconnect();
|
|
33
|
+
}), [J, c]);
|
|
34
|
+
const X = h(
|
|
35
|
+
(t) => (e) => {
|
|
36
|
+
d && ($(t), e.dataTransfer.effectAllowed = "move");
|
|
35
37
|
},
|
|
36
|
-
[
|
|
37
|
-
),
|
|
38
|
-
(
|
|
39
|
-
|
|
38
|
+
[d]
|
|
39
|
+
), Y = h(
|
|
40
|
+
(t) => (e) => {
|
|
41
|
+
d && (e.preventDefault(), e.dataTransfer.dropEffect = "move", C(t));
|
|
40
42
|
},
|
|
41
|
-
[
|
|
42
|
-
),
|
|
43
|
-
(
|
|
44
|
-
if (!(!
|
|
45
|
-
if (e.preventDefault(),
|
|
46
|
-
const
|
|
47
|
-
|
|
43
|
+
[d]
|
|
44
|
+
), Z = h(
|
|
45
|
+
(t) => (e) => {
|
|
46
|
+
if (!(!d || m === null)) {
|
|
47
|
+
if (e.preventDefault(), m !== t) {
|
|
48
|
+
const n = [...c], [r] = n.splice(m, 1);
|
|
49
|
+
n.splice(t, 0, r), B?.(n);
|
|
48
50
|
}
|
|
49
|
-
|
|
51
|
+
$(null), C(null);
|
|
50
52
|
}
|
|
51
53
|
},
|
|
52
|
-
[
|
|
53
|
-
),
|
|
54
|
-
|
|
55
|
-
}, []),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
[d, m, c, B]
|
|
55
|
+
), _ = h(() => {
|
|
56
|
+
$(null), C(null);
|
|
57
|
+
}, []), G = R === "nested", [A, w] = N([]), L = (t) => H && A.includes(t), S = (t) => {
|
|
58
|
+
w(
|
|
59
|
+
(e) => e.includes(t) ? e.filter((n) => n !== t) : [...e, t]
|
|
60
|
+
);
|
|
61
|
+
}, k = (t) => {
|
|
62
|
+
const e = t.filter((n) => n.selected).length;
|
|
63
|
+
return e > 0 && e < t.length;
|
|
64
|
+
}, u = /* @__PURE__ */ new Map();
|
|
65
|
+
let i = -1;
|
|
66
|
+
return c.forEach((t) => {
|
|
67
|
+
if (t.options)
|
|
68
|
+
t.options.forEach((e) => {
|
|
69
|
+
e.disabled || (i++, u.set(e, i));
|
|
61
70
|
});
|
|
62
71
|
else {
|
|
63
|
-
const e =
|
|
64
|
-
e.disabled || (
|
|
72
|
+
const e = t;
|
|
73
|
+
e.disabled || (i++, u.set(e, i)), G && !L(e.value) && e.children?.forEach((n) => {
|
|
74
|
+
n.disabled || (i++, u.set(n, i));
|
|
75
|
+
});
|
|
65
76
|
}
|
|
66
|
-
}), /* @__PURE__ */
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
return /* @__PURE__ */
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
}), /* @__PURE__ */ a(ne, { children: c.map((t, e) => {
|
|
78
|
+
const n = e === c.length - 1;
|
|
79
|
+
if (t.options) {
|
|
80
|
+
const s = t;
|
|
81
|
+
return /* @__PURE__ */ M("div", { style: { marginTop: o === "2.0" ? 2 : 0 }, children: [
|
|
82
|
+
/* @__PURE__ */ M(le, { version: o, children: [
|
|
83
|
+
s.leadingIcon ? /* @__PURE__ */ a("span", { style: { marginRight: 8 }, children: s.leadingIcon }) : null,
|
|
84
|
+
s.label
|
|
74
85
|
] }),
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
return /* @__PURE__ */
|
|
78
|
-
|
|
86
|
+
s.options.map((g, p) => {
|
|
87
|
+
const U = u.get(g), te = U === E && !g.disabled;
|
|
88
|
+
return /* @__PURE__ */ a(
|
|
89
|
+
q,
|
|
79
90
|
{
|
|
80
|
-
version:
|
|
81
|
-
last:
|
|
82
|
-
onSelect:
|
|
91
|
+
version: o,
|
|
92
|
+
last: p === s.options.length - 1,
|
|
93
|
+
onSelect: x,
|
|
83
94
|
showDescription: b,
|
|
84
95
|
onDropdownItemClick: F,
|
|
85
96
|
isMultiSelect: O,
|
|
86
|
-
option:
|
|
87
|
-
useDefaultCursor:
|
|
88
|
-
isFocused:
|
|
89
|
-
dataIndex:
|
|
97
|
+
option: g,
|
|
98
|
+
useDefaultCursor: D,
|
|
99
|
+
isFocused: te,
|
|
100
|
+
dataIndex: U,
|
|
90
101
|
isDraggable: !1,
|
|
91
|
-
showCheckboxForCustomElement:
|
|
92
|
-
checkboxActiveColor:
|
|
93
|
-
brandSelectedRow:
|
|
94
|
-
ref: (
|
|
95
|
-
|
|
102
|
+
showCheckboxForCustomElement: j,
|
|
103
|
+
checkboxActiveColor: P,
|
|
104
|
+
brandSelectedRow: T,
|
|
105
|
+
ref: (v) => {
|
|
106
|
+
l && typeof l == "object" && l.current && v && v && v && v && (l.current[e] = v);
|
|
96
107
|
}
|
|
97
108
|
},
|
|
98
|
-
`${e}-${
|
|
109
|
+
`${e}-${p}`
|
|
99
110
|
);
|
|
100
111
|
}),
|
|
101
|
-
|
|
112
|
+
n ? /* @__PURE__ */ a("span", { ref: I }) : null
|
|
102
113
|
] }, e);
|
|
103
114
|
}
|
|
104
|
-
const
|
|
105
|
-
return /* @__PURE__ */
|
|
106
|
-
|
|
107
|
-
/* @__PURE__ */
|
|
108
|
-
|
|
115
|
+
const r = t, K = u.get(r), ee = K === E && !r.disabled, y = G ? r.children ?? [] : [], Q = L(r.value) ? [] : y;
|
|
116
|
+
return /* @__PURE__ */ M("div", { children: [
|
|
117
|
+
r.hasDivider && /* @__PURE__ */ a(ae, {}),
|
|
118
|
+
/* @__PURE__ */ a(
|
|
119
|
+
q,
|
|
109
120
|
{
|
|
110
|
-
version:
|
|
111
|
-
last:
|
|
112
|
-
onSelect:
|
|
121
|
+
version: o,
|
|
122
|
+
last: n,
|
|
123
|
+
onSelect: x,
|
|
113
124
|
showDescription: b,
|
|
114
125
|
onDropdownItemClick: F,
|
|
115
126
|
isMultiSelect: O,
|
|
116
|
-
option:
|
|
117
|
-
useDefaultCursor:
|
|
118
|
-
isFocused:
|
|
119
|
-
dataIndex:
|
|
120
|
-
isDraggable:
|
|
121
|
-
onDragStart:
|
|
122
|
-
onDragOver:
|
|
123
|
-
onDrop:
|
|
124
|
-
onDragEnd:
|
|
125
|
-
isDraggedOver:
|
|
126
|
-
showCheckboxForCustomElement:
|
|
127
|
-
checkboxActiveColor:
|
|
128
|
-
brandSelectedRow:
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
option: r,
|
|
128
|
+
useDefaultCursor: D,
|
|
129
|
+
isFocused: ee,
|
|
130
|
+
dataIndex: K,
|
|
131
|
+
isDraggable: d,
|
|
132
|
+
onDragStart: X(e),
|
|
133
|
+
onDragOver: Y(e),
|
|
134
|
+
onDrop: Z(e),
|
|
135
|
+
onDragEnd: _,
|
|
136
|
+
isDraggedOver: W === e,
|
|
137
|
+
showCheckboxForCustomElement: j,
|
|
138
|
+
checkboxActiveColor: P,
|
|
139
|
+
brandSelectedRow: T,
|
|
140
|
+
childrenLayout: R,
|
|
141
|
+
isPartiallyChecked: y.length ? k(y) : !1,
|
|
142
|
+
isCollapsible: H && G && !!y.length,
|
|
143
|
+
isCollapsed: L(r.value),
|
|
144
|
+
onToggleCollapse: () => S(r.value),
|
|
145
|
+
ref: (s) => {
|
|
146
|
+
l && typeof l == "object" && l.current && s && (l.current[e] = s);
|
|
131
147
|
}
|
|
132
148
|
},
|
|
133
|
-
|
|
149
|
+
r.value
|
|
134
150
|
),
|
|
135
|
-
|
|
151
|
+
Q.map((s, g) => {
|
|
152
|
+
const p = u.get(s);
|
|
153
|
+
return /* @__PURE__ */ a(
|
|
154
|
+
q,
|
|
155
|
+
{
|
|
156
|
+
version: o,
|
|
157
|
+
last: n && g === Q.length - 1,
|
|
158
|
+
onSelect: x,
|
|
159
|
+
showDescription: b,
|
|
160
|
+
onDropdownItemClick: F,
|
|
161
|
+
isMultiSelect: O,
|
|
162
|
+
option: s,
|
|
163
|
+
useDefaultCursor: D,
|
|
164
|
+
isFocused: p === E && !s.disabled,
|
|
165
|
+
dataIndex: p,
|
|
166
|
+
isDraggable: !1,
|
|
167
|
+
showCheckboxForCustomElement: j,
|
|
168
|
+
checkboxActiveColor: P,
|
|
169
|
+
brandSelectedRow: T,
|
|
170
|
+
childrenLayout: R,
|
|
171
|
+
isChildRow: !0
|
|
172
|
+
},
|
|
173
|
+
s.value
|
|
174
|
+
);
|
|
175
|
+
}),
|
|
176
|
+
n ? /* @__PURE__ */ a("span", { ref: I }) : null
|
|
136
177
|
] }, e);
|
|
137
178
|
}) });
|
|
138
179
|
}
|
|
139
180
|
);
|
|
140
181
|
export {
|
|
141
|
-
|
|
182
|
+
ie as MenuList
|
|
142
183
|
};
|
|
143
184
|
//# sourceMappingURL=MenuList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuList.js","sources":["../../../../../../../src/components/dropdown/OpenedDropdown/components/menu/MenuList.tsx"],"sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';\nimport { DropdownOption, GroupedOption, SingleOption } from '../../../type';\nimport { MenuItem } from './MenuItem';\nimport { Divider, StyledGroupedLabel } from './MenuList.styled';\n\ninterface MenuListProps {\n\toptions: DropdownOption[];\n\tisMultiSelect?: boolean;\n\tshowDescription: (title?: string, description?: string) => void;\n\tonSelect: (optionSelect: SingleOption) => void;\n\tversion?: '1.0' | '2.0' | '3.0';\n\tonInfiniteScroll?: () => void;\n\tonDropdownItemClick?: (option: DropdownOption) => void;\n\tuseDefaultCursor?: boolean;\n\tfocusedIndex?: number;\n\tisDraggable?: boolean;\n\tonOptionsReorder?: (reorderedOptions: DropdownOption[]) => void;\n\tshowCheckboxForCustomElement?: boolean;\n\tcheckboxActiveColor?: string;\n\tbrandSelectedRow?: boolean;\n}\n// eslint-disable-next-line react/display-name\nexport const MenuList = forwardRef<HTMLDivElement[], MenuListProps>(\n\t(\n\t\t{\n\t\t\toptions,\n\t\t\tisMultiSelect,\n\t\t\tshowDescription,\n\t\t\tonSelect,\n\t\t\tversion,\n\t\t\tonInfiniteScroll,\n\t\t\tonDropdownItemClick,\n\t\t\tuseDefaultCursor,\n\t\t\tfocusedIndex = -1,\n\t\t\tisDraggable = false,\n\t\t\tonOptionsReorder,\n\t\t\tshowCheckboxForCustomElement = false,\n\t\t\tcheckboxActiveColor,\n\t\t\tbrandSelectedRow,\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst observer = useRef<IntersectionObserver | null>(null);\n\t\tconst spanRef = useRef<HTMLSpanElement | null>(null);\n\t\tconst [draggedIndex, setDraggedIndex] = useState<number | null>(null);\n\t\tconst [draggedOverIndex, setDraggedOverIndex] = useState<number | null>(\n\t\t\tnull,\n\t\t);\n\n\t\tconst setupObserver = useCallback(() => {\n\t\t\tif (observer.current) {\n\t\t\t\tobserver.current.disconnect();\n\t\t\t}\n\t\t\tobserver.current = new IntersectionObserver((entries) => {\n\t\t\t\tif (entries[0].isIntersecting) {\n\t\t\t\t\tonInfiniteScroll?.();\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (spanRef.current) {\n\t\t\t\tobserver.current.observe(spanRef.current);\n\t\t\t}\n\t\t}, [onInfiniteScroll]);\n\n\t\tuseEffect(() => {\n\t\t\tsetupObserver();\n\t\t\treturn () => {\n\t\t\t\tif (observer.current) {\n\t\t\t\t\tobserver.current.disconnect();\n\t\t\t\t}\n\t\t\t};\n\t\t}, [setupObserver, options]);\n\n\t\tconst handleDragStart = useCallback(\n\t\t\t(index: number) => (e: React.DragEvent<HTMLDivElement>) => {\n\t\t\t\tif (!isDraggable) return;\n\t\t\t\tsetDraggedIndex(index);\n\t\t\t\te.dataTransfer.effectAllowed = 'move';\n\t\t\t},\n\t\t\t[isDraggable],\n\t\t);\n\n\t\tconst handleDragOver = useCallback(\n\t\t\t(index: number) => (e: React.DragEvent<HTMLDivElement>) => {\n\t\t\t\tif (!isDraggable) return;\n\t\t\t\te.preventDefault();\n\t\t\t\te.dataTransfer.dropEffect = 'move';\n\t\t\t\tsetDraggedOverIndex(index);\n\t\t\t},\n\t\t\t[isDraggable],\n\t\t);\n\n\t\tconst handleDrop = useCallback(\n\t\t\t(dropIndex: number) => (e: React.DragEvent<HTMLDivElement>) => {\n\t\t\t\tif (!isDraggable || draggedIndex === null) return;\n\t\t\t\te.preventDefault();\n\n\t\t\t\tif (draggedIndex !== dropIndex) {\n\t\t\t\t\tconst newOptions = [...options];\n\t\t\t\t\tconst [item] = newOptions.splice(draggedIndex, 1);\n\t\t\t\t\tnewOptions.splice(dropIndex, 0, item);\n\t\t\t\t\tonOptionsReorder?.(newOptions);\n\t\t\t\t}\n\n\t\t\t\tsetDraggedIndex(null);\n\t\t\t\tsetDraggedOverIndex(null);\n\t\t\t},\n\t\t\t[isDraggable, draggedIndex, options, onOptionsReorder],\n\t\t);\n\n\t\tconst handleDragEnd = useCallback(() => {\n\t\t\tsetDraggedIndex(null);\n\t\t\tsetDraggedOverIndex(null);\n\t\t}, []);\n\n\t\t// Calculate flat indices for all options\n\t\tconst flatIndices = new Map<SingleOption, number>();\n\t\tlet currentIndex = -1;\n\t\toptions.forEach((option) => {\n\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t(option as GroupedOption).options.forEach((menuOption) => {\n\t\t\t\t\tif (!menuOption.disabled) {\n\t\t\t\t\t\tcurrentIndex++;\n\t\t\t\t\t\tflatIndices.set(menuOption, currentIndex);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst singleOption = option as SingleOption;\n\t\t\t\tif (!singleOption.disabled) {\n\t\t\t\t\tcurrentIndex++;\n\t\t\t\t\tflatIndices.set(singleOption, currentIndex);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{options.map((option, i) => {\n\t\t\t\t\tconst last = i === options.length - 1;\n\t\t\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t\t\tconst groupedOption = option as GroupedOption;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div key={i} style={{ marginTop: version === '2.0' ? 2 : 0 }}>\n\t\t\t\t\t\t\t\t<StyledGroupedLabel version={version}>\n\t\t\t\t\t\t\t\t\t{groupedOption.leadingIcon ? (\n\t\t\t\t\t\t\t\t\t\t<span style={{ marginRight: 8 }}>\n\t\t\t\t\t\t\t\t\t\t\t{groupedOption.leadingIcon}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t{groupedOption.label}\n\t\t\t\t\t\t\t\t</StyledGroupedLabel>\n\t\t\t\t\t\t\t\t{groupedOption.options.map((menuOption, idx) => {\n\t\t\t\t\t\t\t\t\tconst currentFlatIndex = flatIndices.get(menuOption);\n\t\t\t\t\t\t\t\t\tconst isFocused =\n\t\t\t\t\t\t\t\t\t\tcurrentFlatIndex === focusedIndex && !menuOption.disabled;\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\t\t\t\tlast={idx === groupedOption.options.length - 1}\n\t\t\t\t\t\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\t\t\t\t\t\tshowDescription={showDescription}\n\t\t\t\t\t\t\t\t\t\t\tonDropdownItemClick={onDropdownItemClick}\n\t\t\t\t\t\t\t\t\t\t\tisMultiSelect={isMultiSelect}\n\t\t\t\t\t\t\t\t\t\t\toption={menuOption}\n\t\t\t\t\t\t\t\t\t\t\tuseDefaultCursor={useDefaultCursor}\n\t\t\t\t\t\t\t\t\t\t\tkey={`${i}-${idx}`}\n\t\t\t\t\t\t\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\t\t\t\t\t\t\tdataIndex={currentFlatIndex}\n\t\t\t\t\t\t\t\t\t\t\tisDraggable={false}\n\t\t\t\t\t\t\t\t\t\t\tshowCheckboxForCustomElement={\n\t\t\t\t\t\t\t\t\t\t\t\tshowCheckboxForCustomElement\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\t\t\t\t\t\t\tif (ref && typeof ref === 'object' && ref.current) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) ref.current[i] = el;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t{last ? <span ref={spanRef} /> : null}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst singleOption = option as SingleOption;\n\t\t\t\t\tconst currentFlatIndex = flatIndices.get(singleOption);\n\t\t\t\t\tconst isFocused =\n\t\t\t\t\t\tcurrentFlatIndex === focusedIndex && !singleOption.disabled;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div key={i}>\n\t\t\t\t\t\t\t{singleOption.hasDivider && <Divider />}\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\tlast={last}\n\t\t\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\t\t\tshowDescription={showDescription}\n\t\t\t\t\t\t\t\tonDropdownItemClick={onDropdownItemClick}\n\t\t\t\t\t\t\t\tisMultiSelect={isMultiSelect}\n\t\t\t\t\t\t\t\toption={singleOption}\n\t\t\t\t\t\t\t\tuseDefaultCursor={useDefaultCursor}\n\t\t\t\t\t\t\t\tkey={singleOption.value}\n\t\t\t\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\t\t\t\tdataIndex={currentFlatIndex}\n\t\t\t\t\t\t\t\tisDraggable={isDraggable}\n\t\t\t\t\t\t\t\tonDragStart={handleDragStart(i)}\n\t\t\t\t\t\t\t\tonDragOver={handleDragOver(i)}\n\t\t\t\t\t\t\t\tonDrop={handleDrop(i)}\n\t\t\t\t\t\t\t\tonDragEnd={handleDragEnd}\n\t\t\t\t\t\t\t\tisDraggedOver={draggedOverIndex === i}\n\t\t\t\t\t\t\t\tshowCheckboxForCustomElement={showCheckboxForCustomElement}\n\t\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\t\t\t\tif (ref && typeof ref === 'object' && ref.current && el) {\n\t\t\t\t\t\t\t\t\t\tref.current[i] = el;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{last ? <span ref={spanRef} /> : null}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</>\n\t\t);\n\t},\n);\n"],"names":["MenuList","forwardRef","options","isMultiSelect","showDescription","onSelect","version","onInfiniteScroll","onDropdownItemClick","useDefaultCursor","focusedIndex","isDraggable","onOptionsReorder","showCheckboxForCustomElement","checkboxActiveColor","brandSelectedRow","ref","observer","useRef","spanRef","draggedIndex","setDraggedIndex","useState","draggedOverIndex","setDraggedOverIndex","setupObserver","useCallback","entries","useEffect","handleDragStart","index","handleDragOver","handleDrop","dropIndex","newOptions","item","handleDragEnd","flatIndices","currentIndex","option","menuOption","singleOption","jsx","Fragment","i","last","groupedOption","jsxs","StyledGroupedLabel","idx","currentFlatIndex","isFocused","MenuItem","el","Divider"],"mappings":";;;;AAsBO,MAAMA,KAAWC;AAAA,EACvB,CACC;AAAA,IACC,SAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,aAAAC,IA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AAA,YACA,aAAakB,EAAgBe,CAAC;AAAA,YAC9B,YAAYb,EAAea,CAAC;AAAA,YAC5B,QAAQZ,EAAWY,CAAC;AAAA,YACpB,WAAWR;AAAA,YACX,eAAeb,MAAqBqB;AAAA,YACpC,8BAAA/B;AAAA,YACA,qBAAAC;AAAA,YACA,kBAAAC;AAAA,YACA,KAAK,CAACsC,MAAO;AACZ,cAAIrC,KAAO,OAAOA,KAAQ,YAAYA,EAAI,WAAWqC,MACpDrC,EAAI,QAAQ4B,CAAC,IAAIS;AAAA,YAEnB;AAAA,UAAA;AAAA,UAhBKZ,EAAa;AAAA,QAAA;AAAA,QAkBlBI,IAAO,gBAAAH,EAAC,QAAA,EAAK,KAAKvB,GAAS,IAAK;AAAA,MAAA,EAAA,GA7BxByB,CA8BV;AAAA,IAEF,CAAC,EAAA,CACF;AAAA,EAEF;AACD;"}
|
|
1
|
+
{"version":3,"file":"MenuList.js","sources":["../../../../../../../src/components/dropdown/OpenedDropdown/components/menu/MenuList.tsx"],"sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';\nimport { DropdownOption, GroupedOption, SingleOption } from '../../../type';\nimport { MenuItem } from './MenuItem';\nimport { Divider, StyledGroupedLabel } from './MenuList.styled';\n\ninterface MenuListProps {\n\toptions: DropdownOption[];\n\tisMultiSelect?: boolean;\n\tshowDescription: (title?: string, description?: string) => void;\n\tonSelect: (optionSelect: SingleOption) => void;\n\tversion?: '1.0' | '2.0' | '3.0';\n\tonInfiniteScroll?: () => void;\n\tonDropdownItemClick?: (option: DropdownOption) => void;\n\tuseDefaultCursor?: boolean;\n\tfocusedIndex?: number;\n\tisDraggable?: boolean;\n\tonOptionsReorder?: (reorderedOptions: DropdownOption[]) => void;\n\tshowCheckboxForCustomElement?: boolean;\n\tcheckboxActiveColor?: string;\n\tbrandSelectedRow?: boolean;\n\tchildrenLayout?: 'flyout' | 'nested';\n\tcollapsibleChildren?: boolean;\n}\n// eslint-disable-next-line react/display-name\nexport const MenuList = forwardRef<HTMLDivElement[], MenuListProps>(\n\t(\n\t\t{\n\t\t\toptions,\n\t\t\tisMultiSelect,\n\t\t\tshowDescription,\n\t\t\tonSelect,\n\t\t\tversion,\n\t\t\tonInfiniteScroll,\n\t\t\tonDropdownItemClick,\n\t\t\tuseDefaultCursor,\n\t\t\tfocusedIndex = -1,\n\t\t\tisDraggable = false,\n\t\t\tonOptionsReorder,\n\t\t\tshowCheckboxForCustomElement = false,\n\t\t\tcheckboxActiveColor,\n\t\t\tbrandSelectedRow,\n\t\t\tchildrenLayout = 'flyout',\n\t\t\tcollapsibleChildren = false,\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst observer = useRef<IntersectionObserver | null>(null);\n\t\tconst spanRef = useRef<HTMLSpanElement | null>(null);\n\t\tconst [draggedIndex, setDraggedIndex] = useState<number | null>(null);\n\t\tconst [draggedOverIndex, setDraggedOverIndex] = useState<number | null>(\n\t\t\tnull,\n\t\t);\n\n\t\tconst setupObserver = useCallback(() => {\n\t\t\tif (observer.current) {\n\t\t\t\tobserver.current.disconnect();\n\t\t\t}\n\t\t\tobserver.current = new IntersectionObserver((entries) => {\n\t\t\t\tif (entries[0].isIntersecting) {\n\t\t\t\t\tonInfiniteScroll?.();\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (spanRef.current) {\n\t\t\t\tobserver.current.observe(spanRef.current);\n\t\t\t}\n\t\t}, [onInfiniteScroll]);\n\n\t\tuseEffect(() => {\n\t\t\tsetupObserver();\n\t\t\treturn () => {\n\t\t\t\tif (observer.current) {\n\t\t\t\t\tobserver.current.disconnect();\n\t\t\t\t}\n\t\t\t};\n\t\t}, [setupObserver, options]);\n\n\t\tconst handleDragStart = useCallback(\n\t\t\t(index: number) => (e: React.DragEvent<HTMLDivElement>) => {\n\t\t\t\tif (!isDraggable) return;\n\t\t\t\tsetDraggedIndex(index);\n\t\t\t\te.dataTransfer.effectAllowed = 'move';\n\t\t\t},\n\t\t\t[isDraggable],\n\t\t);\n\n\t\tconst handleDragOver = useCallback(\n\t\t\t(index: number) => (e: React.DragEvent<HTMLDivElement>) => {\n\t\t\t\tif (!isDraggable) return;\n\t\t\t\te.preventDefault();\n\t\t\t\te.dataTransfer.dropEffect = 'move';\n\t\t\t\tsetDraggedOverIndex(index);\n\t\t\t},\n\t\t\t[isDraggable],\n\t\t);\n\n\t\tconst handleDrop = useCallback(\n\t\t\t(dropIndex: number) => (e: React.DragEvent<HTMLDivElement>) => {\n\t\t\t\tif (!isDraggable || draggedIndex === null) return;\n\t\t\t\te.preventDefault();\n\n\t\t\t\tif (draggedIndex !== dropIndex) {\n\t\t\t\t\tconst newOptions = [...options];\n\t\t\t\t\tconst [item] = newOptions.splice(draggedIndex, 1);\n\t\t\t\t\tnewOptions.splice(dropIndex, 0, item);\n\t\t\t\t\tonOptionsReorder?.(newOptions);\n\t\t\t\t}\n\n\t\t\t\tsetDraggedIndex(null);\n\t\t\t\tsetDraggedOverIndex(null);\n\t\t\t},\n\t\t\t[isDraggable, draggedIndex, options, onOptionsReorder],\n\t\t);\n\n\t\tconst handleDragEnd = useCallback(() => {\n\t\t\tsetDraggedIndex(null);\n\t\t\tsetDraggedOverIndex(null);\n\t\t}, []);\n\n\t\tconst isNestedLayout = childrenLayout === 'nested';\n\t\tconst [collapsedParents, setCollapsedParents] = useState<string[]>([]);\n\n\t\tconst isCollapsed = (value: string) =>\n\t\t\tcollapsibleChildren && collapsedParents.includes(value);\n\n\t\tconst toggleCollapsed = (value: string) => {\n\t\t\tsetCollapsedParents((previous) =>\n\t\t\t\tprevious.includes(value)\n\t\t\t\t\t? previous.filter((entry) => entry !== value)\n\t\t\t\t\t: [...previous, value],\n\t\t\t);\n\t\t};\n\n\t\t/** A parent is partly checked when some — but not all — children are. */\n\t\tconst isPartiallySelected = (children: SingleOption[]) => {\n\t\t\tconst selectedCount = children.filter((child) => child.selected).length;\n\t\t\treturn selectedCount > 0 && selectedCount < children.length;\n\t\t};\n\n\t\t// Calculate flat indices for all options\n\t\tconst flatIndices = new Map<SingleOption, number>();\n\t\tlet currentIndex = -1;\n\t\toptions.forEach((option) => {\n\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t(option as GroupedOption).options.forEach((menuOption) => {\n\t\t\t\t\tif (!menuOption.disabled) {\n\t\t\t\t\t\tcurrentIndex++;\n\t\t\t\t\t\tflatIndices.set(menuOption, currentIndex);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst singleOption = option as SingleOption;\n\t\t\t\tif (!singleOption.disabled) {\n\t\t\t\t\tcurrentIndex++;\n\t\t\t\t\tflatIndices.set(singleOption, currentIndex);\n\t\t\t\t}\n\t\t\t\tif (isNestedLayout && !isCollapsed(singleOption.value)) {\n\t\t\t\t\tsingleOption.children?.forEach((child) => {\n\t\t\t\t\t\tif (!child.disabled) {\n\t\t\t\t\t\t\tcurrentIndex++;\n\t\t\t\t\t\t\tflatIndices.set(child, currentIndex);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{options.map((option, i) => {\n\t\t\t\t\tconst last = i === options.length - 1;\n\t\t\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t\t\tconst groupedOption = option as GroupedOption;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<div key={i} style={{ marginTop: version === '2.0' ? 2 : 0 }}>\n\t\t\t\t\t\t\t\t<StyledGroupedLabel version={version}>\n\t\t\t\t\t\t\t\t\t{groupedOption.leadingIcon ? (\n\t\t\t\t\t\t\t\t\t\t<span style={{ marginRight: 8 }}>\n\t\t\t\t\t\t\t\t\t\t\t{groupedOption.leadingIcon}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t{groupedOption.label}\n\t\t\t\t\t\t\t\t</StyledGroupedLabel>\n\t\t\t\t\t\t\t\t{groupedOption.options.map((menuOption, idx) => {\n\t\t\t\t\t\t\t\t\tconst currentFlatIndex = flatIndices.get(menuOption);\n\t\t\t\t\t\t\t\t\tconst isFocused =\n\t\t\t\t\t\t\t\t\t\tcurrentFlatIndex === focusedIndex && !menuOption.disabled;\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\t\t\t\tlast={idx === groupedOption.options.length - 1}\n\t\t\t\t\t\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\t\t\t\t\t\tshowDescription={showDescription}\n\t\t\t\t\t\t\t\t\t\t\tonDropdownItemClick={onDropdownItemClick}\n\t\t\t\t\t\t\t\t\t\t\tisMultiSelect={isMultiSelect}\n\t\t\t\t\t\t\t\t\t\t\toption={menuOption}\n\t\t\t\t\t\t\t\t\t\t\tuseDefaultCursor={useDefaultCursor}\n\t\t\t\t\t\t\t\t\t\t\tkey={`${i}-${idx}`}\n\t\t\t\t\t\t\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\t\t\t\t\t\t\tdataIndex={currentFlatIndex}\n\t\t\t\t\t\t\t\t\t\t\tisDraggable={false}\n\t\t\t\t\t\t\t\t\t\t\tshowCheckboxForCustomElement={\n\t\t\t\t\t\t\t\t\t\t\t\tshowCheckboxForCustomElement\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\t\t\t\t\t\t\tif (ref && typeof ref === 'object' && ref.current) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif (el) ref.current[i] = el;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t{last ? <span ref={spanRef} /> : null}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst singleOption = option as SingleOption;\n\t\t\t\t\tconst currentFlatIndex = flatIndices.get(singleOption);\n\t\t\t\t\tconst isFocused =\n\t\t\t\t\t\tcurrentFlatIndex === focusedIndex && !singleOption.disabled;\n\t\t\t\t\tconst nestedChildren = isNestedLayout\n\t\t\t\t\t\t? singleOption.children ?? []\n\t\t\t\t\t\t: [];\n\t\t\t\t\t// The tri-state parent still reflects every child, collapsed or not.\n\t\t\t\t\tconst visibleChildren = isCollapsed(singleOption.value)\n\t\t\t\t\t\t? []\n\t\t\t\t\t\t: nestedChildren;\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<div key={i}>\n\t\t\t\t\t\t\t{singleOption.hasDivider && <Divider />}\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\tlast={last}\n\t\t\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\t\t\tshowDescription={showDescription}\n\t\t\t\t\t\t\t\tonDropdownItemClick={onDropdownItemClick}\n\t\t\t\t\t\t\t\tisMultiSelect={isMultiSelect}\n\t\t\t\t\t\t\t\toption={singleOption}\n\t\t\t\t\t\t\t\tuseDefaultCursor={useDefaultCursor}\n\t\t\t\t\t\t\t\tkey={singleOption.value}\n\t\t\t\t\t\t\t\tisFocused={isFocused}\n\t\t\t\t\t\t\t\tdataIndex={currentFlatIndex}\n\t\t\t\t\t\t\t\tisDraggable={isDraggable}\n\t\t\t\t\t\t\t\tonDragStart={handleDragStart(i)}\n\t\t\t\t\t\t\t\tonDragOver={handleDragOver(i)}\n\t\t\t\t\t\t\t\tonDrop={handleDrop(i)}\n\t\t\t\t\t\t\t\tonDragEnd={handleDragEnd}\n\t\t\t\t\t\t\t\tisDraggedOver={draggedOverIndex === i}\n\t\t\t\t\t\t\t\tshowCheckboxForCustomElement={showCheckboxForCustomElement}\n\t\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t\tchildrenLayout={childrenLayout}\n\t\t\t\t\t\t\t\tisPartiallyChecked={\n\t\t\t\t\t\t\t\t\tnestedChildren.length\n\t\t\t\t\t\t\t\t\t\t? isPartiallySelected(nestedChildren)\n\t\t\t\t\t\t\t\t\t\t: false\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisCollapsible={\n\t\t\t\t\t\t\t\t\tcollapsibleChildren &&\n\t\t\t\t\t\t\t\t\tisNestedLayout &&\n\t\t\t\t\t\t\t\t\t!!nestedChildren.length\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisCollapsed={isCollapsed(singleOption.value)}\n\t\t\t\t\t\t\t\tonToggleCollapse={() => toggleCollapsed(singleOption.value)}\n\t\t\t\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\t\t\t\tif (ref && typeof ref === 'object' && ref.current && el) {\n\t\t\t\t\t\t\t\t\t\tref.current[i] = el;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{visibleChildren.map((child, childIdx) => {\n\t\t\t\t\t\t\t\tconst childFlatIndex = flatIndices.get(child);\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tversion={version}\n\t\t\t\t\t\t\t\t\t\tlast={last && childIdx === visibleChildren.length - 1}\n\t\t\t\t\t\t\t\t\t\tonSelect={onSelect}\n\t\t\t\t\t\t\t\t\t\tshowDescription={showDescription}\n\t\t\t\t\t\t\t\t\t\tonDropdownItemClick={onDropdownItemClick}\n\t\t\t\t\t\t\t\t\t\tisMultiSelect={isMultiSelect}\n\t\t\t\t\t\t\t\t\t\toption={child}\n\t\t\t\t\t\t\t\t\t\tuseDefaultCursor={useDefaultCursor}\n\t\t\t\t\t\t\t\t\t\tkey={child.value}\n\t\t\t\t\t\t\t\t\t\tisFocused={\n\t\t\t\t\t\t\t\t\t\t\tchildFlatIndex === focusedIndex && !child.disabled\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdataIndex={childFlatIndex}\n\t\t\t\t\t\t\t\t\t\tisDraggable={false}\n\t\t\t\t\t\t\t\t\t\tshowCheckboxForCustomElement={showCheckboxForCustomElement}\n\t\t\t\t\t\t\t\t\t\tcheckboxActiveColor={checkboxActiveColor}\n\t\t\t\t\t\t\t\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\t\t\t\t\t\t\t\tchildrenLayout={childrenLayout}\n\t\t\t\t\t\t\t\t\t\tisChildRow\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t{last ? <span ref={spanRef} /> : null}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</>\n\t\t);\n\t},\n);\n"],"names":["MenuList","forwardRef","options","isMultiSelect","showDescription","onSelect","version","onInfiniteScroll","onDropdownItemClick","useDefaultCursor","focusedIndex","isDraggable","onOptionsReorder","showCheckboxForCustomElement","checkboxActiveColor","brandSelectedRow","childrenLayout","collapsibleChildren","ref","observer","useRef","spanRef","draggedIndex","setDraggedIndex","useState","draggedOverIndex","setDraggedOverIndex","setupObserver","useCallback","entries","useEffect","handleDragStart","index","handleDragOver","handleDrop","dropIndex","newOptions","item","handleDragEnd","isNestedLayout","collapsedParents","setCollapsedParents","isCollapsed","value","toggleCollapsed","previous","entry","isPartiallySelected","children","selectedCount","child","flatIndices","currentIndex","option","menuOption","singleOption","jsx","Fragment","i","last","groupedOption","jsxs","StyledGroupedLabel","idx","currentFlatIndex","isFocused","MenuItem","el","nestedChildren","visibleChildren","Divider","childIdx","childFlatIndex"],"mappings":";;;;AAwBO,MAAMA,KAAWC;AAAA,EACvB,CACC;AAAA,IACC,SAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,UAAAC;AAAA,IACA,SAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,aAAAC,IAAc;AAAA,IACd,kBAAAC;AAAA,IACA,8BAAAC,IAA+B;AAAA,IAC/B,qBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,gBAAAC,IAAiB;AAAA,IACjB,qBAAAC,IAAsB;AAAA,EAAA,GAEvBC,MACI;AACJ,UAAMC,IAAWC,EAAoC,IAAI,GACnDC,IAAUD,EAA+B,IAAI,GAC7C,CAACE,GAAcC,CAAe,IAAIC,EAAwB,IAAI,GAC9D,CAACC,GAAkBC,CAAmB,IAAIF;AAAA,MAC/C;AAAA,IAAA,GAGKG,IAAgBC,EAAY,MAAM;AACvC,MAAIT,EAAS,WACZA,EAAS,QAAQ,WAAA,GAElBA,EAAS,UAAU,IAAI,qBAAqB,CAACU,MAAY;AACxD,QAAIA,EAAQ,CAAC,EAAE,kBACdtB,IAAA;AAAA,MAEF,CAAC,GACGc,EAAQ,WACXF,EAAS,QAAQ,QAAQE,EAAQ,OAAO;AAAA,IAE1C,GAAG,CAACd,CAAgB,CAAC;AAErB,IAAAuB,GAAU,OACTH,EAAA,GACO,MAAM;AACZ,MAAIR,EAAS,WACZA,EAAS,QAAQ,WAAA;AAAA,IAEnB,IACE,CAACQ,GA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A,QAad,CAAC;AAAA,QACAS,IAAO,gBAAAH,EAAC,QAAA,EAAK,KAAKnC,GAAS,IAAK;AAAA,MAAA,EAAA,GApExBqC,CAqEV;AAAA,IAEF,CAAC,EAAA,CACF;AAAA,EAEF;AACD;"}
|
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars | undefined;
|
|
4
|
-
}> & string;
|
|
5
|
-
export declare const StyledGroupedLabel: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Merged<Omit<Omit<import('styled-components').FastOmit<import('styled-components/dist/types').Merged<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
6
|
-
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars | undefined;
|
|
7
|
-
}, {
|
|
1
|
+
export declare const Divider: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const StyledGroupedLabel: import('styled-components').StyledComponent<"div", any, {
|
|
8
3
|
numberOfLines?: number | undefined;
|
|
9
4
|
color?: string | undefined;
|
|
10
|
-
}
|
|
11
|
-
as?: import('styled-components').WebTarget | undefined;
|
|
12
|
-
forwardedAs?: import('styled-components').WebTarget | undefined;
|
|
13
|
-
}, "ref"> & {
|
|
14
|
-
ref?: ((instance: HTMLDivElement | null) => void) | import('react').RefObject<HTMLDivElement> | null | undefined;
|
|
15
|
-
}, "style"> & {
|
|
16
|
-
style?: import('react').CSSProperties | import('styled-components/dist/types').CSSPropertiesWithVars | (import('react').CSSProperties & {
|
|
17
|
-
[key: `--${string}`]: string | number | undefined;
|
|
18
|
-
}) | undefined;
|
|
19
|
-
}, {
|
|
5
|
+
} & {
|
|
20
6
|
version?: "1.0" | "2.0" | "3.0" | undefined;
|
|
21
|
-
}
|
|
7
|
+
}, never>;
|
|
@@ -1,44 +1,51 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useEffect as u } from "react";
|
|
3
3
|
import { ListItem as S } from "../../../../list-item/ListItem.js";
|
|
4
|
-
import { CheckBox as
|
|
5
|
-
const
|
|
6
|
-
options:
|
|
7
|
-
onSelect:
|
|
8
|
-
version:
|
|
4
|
+
import { CheckBox as m } from "../../../../checkBox/CheckBox.js";
|
|
5
|
+
const g = ({
|
|
6
|
+
options: r,
|
|
7
|
+
onSelect: c,
|
|
8
|
+
version: d,
|
|
9
9
|
checkboxActiveColor: f,
|
|
10
|
-
brandSelectedRow:
|
|
10
|
+
brandSelectedRow: h
|
|
11
11
|
}) => {
|
|
12
|
-
const [
|
|
13
|
-
function
|
|
14
|
-
|
|
12
|
+
const [t, s] = p("notSelected");
|
|
13
|
+
function n() {
|
|
14
|
+
t === "partiallySelected" && c("notSelected"), t === "selectAll" && c("notSelected"), t === "notSelected" && c("selectAll");
|
|
15
15
|
}
|
|
16
16
|
return u(() => {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
const e = [];
|
|
18
|
+
r.filter((i) => !i.disabled).forEach((i) => {
|
|
19
|
+
if (i.options)
|
|
20
|
+
i.options.filter((l) => !l.disabled).forEach((l) => {
|
|
21
|
+
e.push(l.selected || !1);
|
|
22
|
+
});
|
|
23
|
+
else {
|
|
24
|
+
const l = i;
|
|
25
|
+
l.children?.length ? l.children.filter((a) => !a.disabled).forEach((a) => {
|
|
26
|
+
e.push(a.selected || !1);
|
|
27
|
+
}) : e.push(l.selected || !1);
|
|
28
|
+
}
|
|
29
|
+
}), e.every(Boolean) ? s("selectAll") : e.filter(Boolean).length > 0 ? s("partiallySelected") : s("notSelected");
|
|
30
|
+
}, [r]), /* @__PURE__ */ o(
|
|
24
31
|
S,
|
|
25
32
|
{
|
|
26
|
-
version:
|
|
27
|
-
brandSelectedRow:
|
|
28
|
-
onClick: (
|
|
29
|
-
|
|
33
|
+
version: d,
|
|
34
|
+
brandSelectedRow: h,
|
|
35
|
+
onClick: (e) => {
|
|
36
|
+
e.preventDefault(), n();
|
|
30
37
|
},
|
|
31
38
|
listItem: {
|
|
32
39
|
label: "Select All",
|
|
33
40
|
value: "All"
|
|
34
41
|
},
|
|
35
|
-
leadingIcon: /* @__PURE__ */
|
|
36
|
-
|
|
42
|
+
leadingIcon: /* @__PURE__ */ o("div", { style: { width: 18, height: 18 }, children: /* @__PURE__ */ o(
|
|
43
|
+
m,
|
|
37
44
|
{
|
|
38
|
-
size:
|
|
39
|
-
isChecked:
|
|
40
|
-
isPartiallyChecked:
|
|
41
|
-
onValueChange:
|
|
45
|
+
size: d === "2.0" ? "SMALL" : "DEFAULT",
|
|
46
|
+
isChecked: t === "selectAll" || t === "partiallySelected",
|
|
47
|
+
isPartiallyChecked: t === "partiallySelected",
|
|
48
|
+
onValueChange: n,
|
|
42
49
|
activeColor: f
|
|
43
50
|
}
|
|
44
51
|
) }),
|
|
@@ -47,6 +54,6 @@ const y = ({
|
|
|
47
54
|
);
|
|
48
55
|
};
|
|
49
56
|
export {
|
|
50
|
-
|
|
57
|
+
g as SelectAllMenu
|
|
51
58
|
};
|
|
52
59
|
//# sourceMappingURL=SelectAllMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectAllMenu.js","sources":["../../../../../../../src/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { CheckBox } from '@src/components/checkBox';\nimport { ListItem } from '@src/components/list-item';\nimport { DropdownOption, GroupedOption, SingleOption } from '../../../type';\n\nexport type SelectAllCheckboxState =\n\t| 'notSelected'\n\t| 'selectAll'\n\t| 'partiallySelected';\n\nexport const SelectAllMenu: React.FC<{\n\toptions: DropdownOption[];\n\tonSelect: (newState: SelectAllCheckboxState) => void;\n\tversion?: '1.0' | '2.0' | '3.0';\n\tcheckboxActiveColor?: string;\n\tbrandSelectedRow?: boolean;\n}> = ({\n\toptions,\n\tonSelect,\n\tversion,\n\tcheckboxActiveColor,\n\tbrandSelectedRow,\n}) => {\n\tconst [checkStatus, setCheckStatus] =\n\t\tuseState<SelectAllCheckboxState>('notSelected');\n\n\tfunction onCheckHandler() {\n\t\tif (checkStatus === 'partiallySelected') {\n\t\t\tonSelect('notSelected');\n\t\t}\n\n\t\tif (checkStatus === 'selectAll') {\n\t\t\tonSelect('notSelected');\n\t\t}\n\n\t\tif (checkStatus === 'notSelected') {\n\t\t\tonSelect('selectAll');\n\t\t}\n\t}\n\n\tuseEffect(() => {\n\t\tconst allOptions: boolean[] = [];\n\n\t\toptions\n\t\t\t.filter((option) => !(option as SingleOption).disabled)\n\t\t\t.forEach((option) => {\n\t\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t\t(option as GroupedOption).options\n\t\t\t\t\t\t.filter((op) => !op.disabled)\n\t\t\t\t\t\t.forEach((nestedOption) => {\n\t\t\t\t\t\t\tallOptions.push(nestedOption.selected || false);\n\t\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tallOptions.push(
|
|
1
|
+
{"version":3,"file":"SelectAllMenu.js","sources":["../../../../../../../src/components/dropdown/OpenedDropdown/components/menu/SelectAllMenu.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { CheckBox } from '@src/components/checkBox';\nimport { ListItem } from '@src/components/list-item';\nimport { DropdownOption, GroupedOption, SingleOption } from '../../../type';\n\nexport type SelectAllCheckboxState =\n\t| 'notSelected'\n\t| 'selectAll'\n\t| 'partiallySelected';\n\nexport const SelectAllMenu: React.FC<{\n\toptions: DropdownOption[];\n\tonSelect: (newState: SelectAllCheckboxState) => void;\n\tversion?: '1.0' | '2.0' | '3.0';\n\tcheckboxActiveColor?: string;\n\tbrandSelectedRow?: boolean;\n}> = ({\n\toptions,\n\tonSelect,\n\tversion,\n\tcheckboxActiveColor,\n\tbrandSelectedRow,\n}) => {\n\tconst [checkStatus, setCheckStatus] =\n\t\tuseState<SelectAllCheckboxState>('notSelected');\n\n\tfunction onCheckHandler() {\n\t\tif (checkStatus === 'partiallySelected') {\n\t\t\tonSelect('notSelected');\n\t\t}\n\n\t\tif (checkStatus === 'selectAll') {\n\t\t\tonSelect('notSelected');\n\t\t}\n\n\t\tif (checkStatus === 'notSelected') {\n\t\t\tonSelect('selectAll');\n\t\t}\n\t}\n\n\tuseEffect(() => {\n\t\tconst allOptions: boolean[] = [];\n\n\t\toptions\n\t\t\t.filter((option) => !(option as SingleOption).disabled)\n\t\t\t.forEach((option) => {\n\t\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t\t(option as GroupedOption).options\n\t\t\t\t\t\t.filter((op) => !op.disabled)\n\t\t\t\t\t\t.forEach((nestedOption) => {\n\t\t\t\t\t\t\tallOptions.push(nestedOption.selected || false);\n\t\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tconst singleOption = option as SingleOption;\n\t\t\t\t\t// For a nested option the children carry the truth — the parent is\n\t\t\t\t\t// only selected when all of them are, so counting it alone would\n\t\t\t\t\t// read a partly-selected group as nothing selected.\n\t\t\t\t\tif (singleOption.children?.length) {\n\t\t\t\t\t\tsingleOption.children\n\t\t\t\t\t\t\t.filter((child) => !child.disabled)\n\t\t\t\t\t\t\t.forEach((child) => {\n\t\t\t\t\t\t\t\tallOptions.push(child.selected || false);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tallOptions.push(singleOption.selected || false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\tif (allOptions.every(Boolean)) {\n\t\t\tsetCheckStatus('selectAll');\n\t\t} else if (allOptions.filter(Boolean).length > 0) {\n\t\t\tsetCheckStatus('partiallySelected');\n\t\t} else {\n\t\t\tsetCheckStatus('notSelected');\n\t\t}\n\t}, [options]);\n\n\treturn (\n\t\t<ListItem\n\t\t\tversion={version}\n\t\t\tbrandSelectedRow={brandSelectedRow}\n\t\t\tonClick={(e) => {\n\t\t\t\te.preventDefault();\n\t\t\t\tonCheckHandler();\n\t\t\t}}\n\t\t\tlistItem={{\n\t\t\t\tlabel: 'Select All',\n\t\t\t\tvalue: 'All',\n\t\t\t}}\n\t\t\tleadingIcon={\n\t\t\t\t<div style={{ width: 18, height: 18 }}>\n\t\t\t\t\t<CheckBox\n\t\t\t\t\t\tsize={version === '2.0' ? 'SMALL' : 'DEFAULT'}\n\t\t\t\t\t\tisChecked={\n\t\t\t\t\t\t\tcheckStatus === 'selectAll' || checkStatus === 'partiallySelected'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisPartiallyChecked={checkStatus === 'partiallySelected'}\n\t\t\t\t\t\tonValueChange={onCheckHandler}\n\t\t\t\t\t\tactiveColor={checkboxActiveColor}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t}\n\t\t\tvariant={'default'}\n\t\t/>\n\t);\n};\n"],"names":["SelectAllMenu","options","onSelect","version","checkboxActiveColor","brandSelectedRow","checkStatus","setCheckStatus","useState","onCheckHandler","useEffect","allOptions","option","op","nestedOption","singleOption","child","jsx","ListItem","CheckBox"],"mappings":";;;;AAUO,MAAMA,IAMR,CAAC;AAAA,EACL,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,kBAAAC;AACD,MAAM;AACL,QAAM,CAACC,GAAaC,CAAc,IACjCC,EAAiC,aAAa;AAE/C,WAASC,IAAiB;AACzB,IAAIH,MAAgB,uBACnBJ,EAAS,aAAa,GAGnBI,MAAgB,eACnBJ,EAAS,aAAa,GAGnBI,MAAgB,iBACnBJ,EAAS,WAAW;AAAA,EAEtB;AAEA,SAAAQ,EAAU,MAAM;AACf,UAAMC,IAAwB,CAAA;AAE9B,IAAAV,EACE,OAAO,CAACW,MAAW,CAAEA,EAAwB,QAAQ,EACrD,QAAQ,CAACA,MAAW;AACpB,UAA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
8
|
buttonOptions?: ButtonOptions;
|
|
9
9
|
hideClearButton?: boolean;
|
|
10
|
+
hideSelectedCount?: boolean;
|
|
10
11
|
}
|
|
11
12
|
declare const MultiSelectDropdownBottomBar: React.FC<MultiSelectDropdownBottomBarProps>;
|
|
12
13
|
export default MultiSelectDropdownBottomBar;
|
|
@@ -1,43 +1,52 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { BodySecondary as
|
|
3
|
-
import { COLORS as
|
|
4
|
-
import { BottomBarContainer as
|
|
5
|
-
import { Button as
|
|
6
|
-
const
|
|
7
|
-
const {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { jsxs as i, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { BodySecondary as b } from "../../../../TypographyStyle.js";
|
|
3
|
+
import { COLORS as g } from "../../../../../constants/Theme.js";
|
|
4
|
+
import { BottomBarContainer as O } from "./MultiSelectDropdownBottomBar.styled.js";
|
|
5
|
+
import { Button as s } from "../../../../button/Button.js";
|
|
6
|
+
const A = (c) => {
|
|
7
|
+
const {
|
|
8
|
+
onClear: p,
|
|
9
|
+
onApply: u,
|
|
10
|
+
list: d,
|
|
11
|
+
buttonText: y,
|
|
12
|
+
buttonOptions: a,
|
|
13
|
+
hideClearButton: m,
|
|
14
|
+
hideSelectedCount: f
|
|
15
|
+
} = c, {
|
|
16
|
+
primaryButtonText: x,
|
|
17
|
+
primaryButtonType: B,
|
|
18
|
+
secondaryButtonText: h,
|
|
19
|
+
secondaryButtonType: T
|
|
20
|
+
} = a ?? {}, l = d.reduce((t, e) => {
|
|
13
21
|
if (e.options) {
|
|
14
|
-
const
|
|
15
|
-
(
|
|
22
|
+
const r = e.options.filter(
|
|
23
|
+
(C) => C.selected === !0
|
|
16
24
|
).length;
|
|
17
|
-
return t +
|
|
25
|
+
return t + r;
|
|
18
26
|
}
|
|
19
|
-
|
|
27
|
+
const o = e;
|
|
28
|
+
return o.children?.length ? t + o.children.filter((r) => r.selected).length : o.selected ? t + 1 : t;
|
|
20
29
|
}, 0);
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
!
|
|
25
|
-
|
|
30
|
+
return /* @__PURE__ */ i(O, { style: { justifyContent: "space-between" }, children: [
|
|
31
|
+
/* @__PURE__ */ n(b, { style: { flex: 1, color: g.content.primary }, children: l && !f ? `${l} selected` : "" }),
|
|
32
|
+
/* @__PURE__ */ i("div", { style: { flexDirection: "row", display: "flex", gap: 12 }, children: [
|
|
33
|
+
!m && /* @__PURE__ */ n(
|
|
34
|
+
s,
|
|
26
35
|
{
|
|
27
36
|
size: "small",
|
|
28
|
-
buttonType:
|
|
29
|
-
buttonText:
|
|
30
|
-
onClick:
|
|
37
|
+
buttonType: T || "primary",
|
|
38
|
+
buttonText: h || "Clear",
|
|
39
|
+
onClick: p
|
|
31
40
|
}
|
|
32
41
|
),
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
|
|
42
|
+
/* @__PURE__ */ n(
|
|
43
|
+
s,
|
|
35
44
|
{
|
|
36
45
|
size: "small",
|
|
37
|
-
buttonText:
|
|
38
|
-
buttonType:
|
|
46
|
+
buttonText: x || y || "Apply",
|
|
47
|
+
buttonType: B || "primary",
|
|
39
48
|
onClick: () => {
|
|
40
|
-
|
|
49
|
+
u();
|
|
41
50
|
}
|
|
42
51
|
}
|
|
43
52
|
)
|
|
@@ -45,6 +54,6 @@ const k = (i) => {
|
|
|
45
54
|
] });
|
|
46
55
|
};
|
|
47
56
|
export {
|
|
48
|
-
|
|
57
|
+
A as default
|
|
49
58
|
};
|
|
50
59
|
//# sourceMappingURL=MultiSelectDropdownBottomBar.js.map
|