@m4l/gclick 0.28.0 → 0.29.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.
Files changed (139) hide show
  1. package/@types/types.d.ts +19 -0
  2. package/_virtual/react-dom-server-legacy.browser.development.js +4 -0
  3. package/_virtual/react-dom-server-legacy.browser.production.js +4 -0
  4. package/_virtual/react-dom-server.browser.development.js +4 -0
  5. package/_virtual/react-dom-server.browser.production.js +4 -0
  6. package/_virtual/server.browser.js +5 -0
  7. package/_virtual/server.browser2.js +4 -0
  8. package/components/CheckableDevicesPicker/CheckableDevicesPicker.d.ts +13 -0
  9. package/components/CheckableDevicesPicker/CheckableDevicesPicker.d.ts.map +1 -0
  10. package/components/CheckableDevicesPicker/CheckableDevicesPicker.js +237 -0
  11. package/components/CheckableDevicesPicker/CheckableDevicesPicker.styles.d.ts +3 -0
  12. package/components/CheckableDevicesPicker/CheckableDevicesPicker.styles.d.ts.map +1 -0
  13. package/components/CheckableDevicesPicker/CheckableDevicesPicker.styles.js +157 -0
  14. package/components/CheckableDevicesPicker/constants.d.ts +22 -0
  15. package/components/CheckableDevicesPicker/constants.d.ts.map +1 -0
  16. package/components/CheckableDevicesPicker/constants.js +13 -0
  17. package/components/CheckableDevicesPicker/dictionary.d.ts +15 -0
  18. package/components/CheckableDevicesPicker/dictionary.d.ts.map +1 -0
  19. package/components/CheckableDevicesPicker/dictionary.js +15 -0
  20. package/components/CheckableDevicesPicker/helpers/resolveDeviceGroup.d.ts +11 -0
  21. package/components/CheckableDevicesPicker/helpers/resolveDeviceGroup.d.ts.map +1 -0
  22. package/components/CheckableDevicesPicker/helpers/resolveDeviceGroup.js +23 -0
  23. package/components/CheckableDevicesPicker/helpers/toDeviceArray.d.ts +7 -0
  24. package/components/CheckableDevicesPicker/helpers/toDeviceArray.d.ts.map +1 -0
  25. package/components/CheckableDevicesPicker/helpers/toDeviceArray.js +6 -0
  26. package/components/CheckableDevicesPicker/hooks/types.d.ts +178 -0
  27. package/components/CheckableDevicesPicker/hooks/types.d.ts.map +1 -0
  28. package/components/CheckableDevicesPicker/hooks/useDeviceGroups.d.ts +13 -0
  29. package/components/CheckableDevicesPicker/hooks/useDeviceGroups.d.ts.map +1 -0
  30. package/components/CheckableDevicesPicker/hooks/useDeviceGroups.js +51 -0
  31. package/components/CheckableDevicesPicker/hooks/useDevicesAsyncOptions.d.ts +13 -0
  32. package/components/CheckableDevicesPicker/hooks/useDevicesAsyncOptions.d.ts.map +1 -0
  33. package/components/CheckableDevicesPicker/hooks/useDevicesAsyncOptions.js +69 -0
  34. package/components/CheckableDevicesPicker/hooks/useDevicesSelection.d.ts +12 -0
  35. package/components/CheckableDevicesPicker/hooks/useDevicesSelection.d.ts.map +1 -0
  36. package/components/CheckableDevicesPicker/hooks/useDevicesSelection.js +26 -0
  37. package/components/CheckableDevicesPicker/hooks/usePanelColumns.d.ts +12 -0
  38. package/components/CheckableDevicesPicker/hooks/usePanelColumns.d.ts.map +1 -0
  39. package/components/CheckableDevicesPicker/hooks/usePanelColumns.js +30 -0
  40. package/components/CheckableDevicesPicker/index.d.ts +7 -0
  41. package/components/CheckableDevicesPicker/index.d.ts.map +1 -0
  42. package/components/CheckableDevicesPicker/slots/CheckableDevicesPickerEnum.d.ts +23 -0
  43. package/components/CheckableDevicesPicker/slots/CheckableDevicesPickerEnum.d.ts.map +1 -0
  44. package/components/CheckableDevicesPicker/slots/CheckableDevicesPickerEnum.js +4 -0
  45. package/components/CheckableDevicesPicker/slots/CheckableDevicesPickerSlots.d.ts +31 -0
  46. package/components/CheckableDevicesPicker/slots/CheckableDevicesPickerSlots.d.ts.map +1 -0
  47. package/components/CheckableDevicesPicker/slots/CheckableDevicesPickerSlots.js +49 -0
  48. package/components/CheckableDevicesPicker/slots/index.d.ts +3 -0
  49. package/components/CheckableDevicesPicker/slots/index.d.ts.map +1 -0
  50. package/components/CheckableDevicesPicker/types.d.ts +210 -0
  51. package/components/CheckableDevicesPicker/types.d.ts.map +1 -0
  52. package/components/DevicesPicker/DevicesPicker.d.ts +15 -0
  53. package/components/DevicesPicker/DevicesPicker.d.ts.map +1 -0
  54. package/components/DevicesPicker/DevicesPicker.js +311 -0
  55. package/components/DevicesPicker/DevicesPicker.styles.d.ts +3 -0
  56. package/components/DevicesPicker/DevicesPicker.styles.d.ts.map +1 -0
  57. package/components/DevicesPicker/DevicesPicker.styles.js +373 -0
  58. package/components/DevicesPicker/constants.d.ts +51 -0
  59. package/components/DevicesPicker/constants.d.ts.map +1 -0
  60. package/components/DevicesPicker/constants.js +30 -0
  61. package/components/DevicesPicker/dictionary.d.ts +17 -0
  62. package/components/DevicesPicker/dictionary.d.ts.map +1 -0
  63. package/components/DevicesPicker/dictionary.js +17 -0
  64. package/components/DevicesPicker/index.d.ts +8 -0
  65. package/components/DevicesPicker/index.d.ts.map +1 -0
  66. package/components/DevicesPicker/slots/DevicesPickerEnum.d.ts +61 -0
  67. package/components/DevicesPicker/slots/DevicesPickerEnum.d.ts.map +1 -0
  68. package/components/DevicesPicker/slots/DevicesPickerEnum.js +4 -0
  69. package/components/DevicesPicker/slots/DevicesPickerSlots.d.ts +88 -0
  70. package/components/DevicesPicker/slots/DevicesPickerSlots.d.ts.map +1 -0
  71. package/components/DevicesPicker/slots/DevicesPickerSlots.js +125 -0
  72. package/components/DevicesPicker/slots/index.d.ts +3 -0
  73. package/components/DevicesPicker/slots/index.d.ts.map +1 -0
  74. package/components/DevicesPicker/subcomponents/DeviceCard/DeviceCard.d.ts +8 -0
  75. package/components/DevicesPicker/subcomponents/DeviceCard/DeviceCard.d.ts.map +1 -0
  76. package/components/DevicesPicker/subcomponents/DeviceCard/DeviceCard.js +77 -0
  77. package/components/DevicesPicker/subcomponents/DeviceCard/index.d.ts +3 -0
  78. package/components/DevicesPicker/subcomponents/DeviceCard/index.d.ts.map +1 -0
  79. package/components/DevicesPicker/subcomponents/DeviceCard/types.d.ts +42 -0
  80. package/components/DevicesPicker/subcomponents/DeviceCard/types.d.ts.map +1 -0
  81. package/components/DevicesPicker/subcomponents/DevicesPickerSkeleton/DevicesPickerSkeleton.d.ts +10 -0
  82. package/components/DevicesPicker/subcomponents/DevicesPickerSkeleton/DevicesPickerSkeleton.d.ts.map +1 -0
  83. package/components/DevicesPicker/subcomponents/DevicesPickerSkeleton/DevicesPickerSkeleton.js +35 -0
  84. package/components/DevicesPicker/subcomponents/DevicesPickerSkeleton/index.d.ts +3 -0
  85. package/components/DevicesPicker/subcomponents/DevicesPickerSkeleton/index.d.ts.map +1 -0
  86. package/components/DevicesPicker/subcomponents/DevicesPickerSkeleton/types.d.ts +11 -0
  87. package/components/DevicesPicker/subcomponents/DevicesPickerSkeleton/types.d.ts.map +1 -0
  88. package/components/DevicesPicker/subcomponents/SelectedDevicesList/SelectedDevicesList.d.ts +11 -0
  89. package/components/DevicesPicker/subcomponents/SelectedDevicesList/SelectedDevicesList.d.ts.map +1 -0
  90. package/components/DevicesPicker/subcomponents/SelectedDevicesList/SelectedDevicesList.js +61 -0
  91. package/components/DevicesPicker/subcomponents/SelectedDevicesList/index.d.ts +3 -0
  92. package/components/DevicesPicker/subcomponents/SelectedDevicesList/index.d.ts.map +1 -0
  93. package/components/DevicesPicker/subcomponents/SelectedDevicesList/types.d.ts +32 -0
  94. package/components/DevicesPicker/subcomponents/SelectedDevicesList/types.d.ts.map +1 -0
  95. package/components/DevicesPicker/types.d.ts +91 -0
  96. package/components/DevicesPicker/types.d.ts.map +1 -0
  97. package/components/RHFs/RHFCheckableDevicesPicker/RHFCheckableDevicesPicker.d.ts +23 -0
  98. package/components/RHFs/RHFCheckableDevicesPicker/RHFCheckableDevicesPicker.d.ts.map +1 -0
  99. package/components/RHFs/RHFCheckableDevicesPicker/RHFCheckableDevicesPicker.js +6 -0
  100. package/components/RHFs/RHFCheckableDevicesPicker/index.d.ts +3 -0
  101. package/components/RHFs/RHFCheckableDevicesPicker/index.d.ts.map +1 -0
  102. package/components/RHFs/RHFCheckableDevicesPicker/types.d.ts +10 -0
  103. package/components/RHFs/RHFCheckableDevicesPicker/types.d.ts.map +1 -0
  104. package/components/RHFs/RHFDevicesPicker/RHFDevicesPicker.d.ts +21 -0
  105. package/components/RHFs/RHFDevicesPicker/RHFDevicesPicker.d.ts.map +1 -0
  106. package/components/RHFs/RHFDevicesPicker/RHFDevicesPicker.js +6 -0
  107. package/components/RHFs/RHFDevicesPicker/index.d.ts +3 -0
  108. package/components/RHFs/RHFDevicesPicker/index.d.ts.map +1 -0
  109. package/components/RHFs/RHFDevicesPicker/types.d.ts +9 -0
  110. package/components/RHFs/RHFDevicesPicker/types.d.ts.map +1 -0
  111. package/components/RHFs/renderAsRegistry.d.ts +33 -0
  112. package/components/RHFs/renderAsRegistry.d.ts.map +1 -0
  113. package/components/RHFs/renderAsRegistry.js +7 -0
  114. package/components/index.d.ts +6 -0
  115. package/components/index.d.ts.map +1 -1
  116. package/helpers/index.d.ts +3 -0
  117. package/helpers/index.d.ts.map +1 -0
  118. package/helpers/resolveDeviceIcon/constants.d.ts +31 -0
  119. package/helpers/resolveDeviceIcon/constants.d.ts.map +1 -0
  120. package/helpers/resolveDeviceIcon/constants.js +8 -0
  121. package/helpers/resolveDeviceIcon/deviceIconComponents.d.ts +19 -0
  122. package/helpers/resolveDeviceIcon/deviceIconComponents.d.ts.map +1 -0
  123. package/helpers/resolveDeviceIcon/deviceIconComponents.js +19 -0
  124. package/helpers/resolveDeviceIcon/index.d.ts +3 -0
  125. package/helpers/resolveDeviceIcon/index.d.ts.map +1 -0
  126. package/helpers/resolveDeviceIcon/resolveDeviceIcon.d.ts +28 -0
  127. package/helpers/resolveDeviceIcon/resolveDeviceIcon.d.ts.map +1 -0
  128. package/helpers/resolveDeviceIcon/resolveDeviceIcon.js +42 -0
  129. package/helpers/resolveDeviceLabels/index.d.ts +3 -0
  130. package/helpers/resolveDeviceLabels/index.d.ts.map +1 -0
  131. package/helpers/resolveDeviceLabels/resolveDeviceLabels.d.ts +22 -0
  132. package/helpers/resolveDeviceLabels/resolveDeviceLabels.d.ts.map +1 -0
  133. package/helpers/resolveDeviceLabels/resolveDeviceLabels.js +10 -0
  134. package/helpers/resolveDeviceLabels/types.d.ts +19 -0
  135. package/helpers/resolveDeviceLabels/types.d.ts.map +1 -0
  136. package/index.d.ts +1 -0
  137. package/index.d.ts.map +1 -1
  138. package/index.js +275 -221
  139. package/package.json +2 -2
package/@types/types.d.ts CHANGED
@@ -13,6 +13,11 @@ import { CameraStreamOwnerState, CameraStreamSlotsStyledType } from '../componen
13
13
  import { MapOwnerState, MapSlotsType } from '../components/maps/components/GpsMap/types';
14
14
  import { ReportsViewerOwnerState, ReportsViewerSlotsType } from '../components/ReportsViewer/types';
15
15
  import { AddressLocationOwnerState, AddressLocationSlotsType } from '../components/AddressLocation/types';
16
+ import {
17
+ CheckableDevicesPickerOwnerState,
18
+ CheckableDevicesPickerSlotsType,
19
+ } from '../components/CheckableDevicesPicker/types';
20
+ import { DevicesPickerOwnerState, DevicesPickerSlotsType } from '../components/DevicesPicker/types';
16
21
  import {
17
22
  GeofenceAddEditOwnerState,
18
23
  GeofenceAddEditSlotsType,
@@ -36,6 +41,8 @@ declare module '@mui/material/styles' {
36
41
  M4LIndicatorValueAndMagnitude: IndicatorValueAndMagnitudeSlotsType;
37
42
  M4LReportsViewer: ReportsViewerSlotsType;
38
43
  M4LAddressLocation: AddressLocationSlotsType;
44
+ M4LCheckableDevicesPicker: CheckableDevicesPickerSlotsType;
45
+ M4LDevicesPicker: DevicesPickerSlotsType;
39
46
  }
40
47
  interface ComponentsPropsList {
41
48
  // Extend ComponentsProps or ComponentsOwnerState(this extend ComponentProps)
@@ -54,6 +61,8 @@ declare module '@mui/material/styles' {
54
61
  M4LIndicatorValueAndMagnitude: Partial<IndicatorValueAndMagnitudeOwnerState>;
55
62
  M4LReportsViewer: Partial<ReportsViewerOwnerState>;
56
63
  M4LAddressLocation: Partial<AddressLocationOwnerState>;
64
+ M4LCheckableDevicesPicker: Partial<CheckableDevicesPickerOwnerState>;
65
+ M4LDevicesPicker: Partial<DevicesPickerOwnerState>;
57
66
  }
58
67
  interface Components {
59
68
  M4LMap?: {
@@ -131,5 +140,15 @@ declare module '@mui/material/styles' {
131
140
  styleOverrides?: ComponentsOverrides<Theme>['M4LAddressLocation'];
132
141
  variants?: ComponentsVariants['M4LAddressLocation'];
133
142
  };
143
+ M4LCheckableDevicesPicker?: {
144
+ defaultProps?: ComponentsPropsList['M4LCheckableDevicesPicker'];
145
+ styleOverrides?: ComponentsOverrides<Theme>['M4LCheckableDevicesPicker'];
146
+ variants?: ComponentsVariants['M4LCheckableDevicesPicker'];
147
+ };
148
+ M4LDevicesPicker?: {
149
+ defaultProps?: ComponentsPropsList['M4LDevicesPicker'];
150
+ styleOverrides?: ComponentsOverrides<Theme>['M4LDevicesPicker'];
151
+ variants?: ComponentsVariants['M4LDevicesPicker'];
152
+ };
134
153
  }
135
154
  }
@@ -0,0 +1,4 @@
1
+ var e = {};
2
+ export {
3
+ e as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var r = {};
2
+ export {
3
+ r as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var e = {};
2
+ export {
3
+ e as __exports
4
+ };
@@ -0,0 +1,4 @@
1
+ var r = {};
2
+ export {
3
+ r as __exports
4
+ };
@@ -0,0 +1,5 @@
1
+ import { __require as r } from "../node_modules/react-dom/server.browser.js";
2
+ var s = r();
3
+ export {
4
+ s
5
+ };
@@ -0,0 +1,4 @@
1
+ var r = {};
2
+ export {
3
+ r as __exports
4
+ };
@@ -0,0 +1,13 @@
1
+ import { CheckableDevicesPickerProps, DevicePickerOption } from './types';
2
+ /**
3
+ * CheckableDevicesPicker: grouped device selector built on top of the shared
4
+ * CheckableList.
5
+ *
6
+ * It is self-sufficient: it fetches the devices with the very same async
7
+ * engine as AutocompleteAsync, groups them by department, decides which column
8
+ * switches the data can offer, and translates between the ids the list works
9
+ * with and the device objects it reports. That is why it can be dropped inside
10
+ * the DevicesPicker popover and, just as well, bound to a form on its own.
11
+ */
12
+ export declare function CheckableDevicesPicker<T extends DevicePickerOption = DevicePickerOption>(props: CheckableDevicesPickerProps<T>): import("@emotion/react/jsx-runtime").JSX.Element;
13
+ //# sourceMappingURL=CheckableDevicesPicker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckableDevicesPicker.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/CheckableDevicesPicker/CheckableDevicesPicker.tsx"],"names":[],"mappings":"AA4BA,OAAO,EAEL,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,EACtF,KAAK,EAAE,2BAA2B,CAAC,CAAC,CAAC,oDAiRtC"}
@@ -0,0 +1,237 @@
1
+ import { jsxs as d, Fragment as se, jsx as a } from "@emotion/react/jsx-runtime";
2
+ import { useRef as le, useEffect as c, useImperativeHandle as re, useCallback as m } from "react";
3
+ import ne from "clsx";
4
+ import { useModuleDictionary as ie } from "@m4l/core";
5
+ import { useDevicesAsyncOptions as de } from "./hooks/useDevicesAsyncOptions.js";
6
+ import { useDeviceGroups as ce } from "./hooks/useDeviceGroups.js";
7
+ import { useDevicesSelection as me } from "./hooks/useDevicesSelection.js";
8
+ import { usePanelColumns as he } from "./hooks/usePanelColumns.js";
9
+ import { resolveDeviceGroup as pe } from "./helpers/resolveDeviceGroup.js";
10
+ import { CHECKABLE_DEVICES_PICKER_CLASSES as t } from "./constants.js";
11
+ import { DICCTIONARY as h } from "./dictionary.js";
12
+ import { resolveDeviceIcon as ue } from "../../helpers/resolveDeviceIcon/resolveDeviceIcon.js";
13
+ import { RowNameStyled as ge, RowSubtitleStyled as we, RowIdStyled as Se, GroupRowStyled as be, GroupLabelStyled as fe, GroupBadgeStyled as ve, RootStyled as Ce, HeaderStyled as De, ColumnSwitchStyled as _, ListStyled as Ie } from "./slots/CheckableDevicesPickerSlots.js";
14
+ import { resolveDeviceSubtitle as ye, resolveDeviceTitle as Re } from "../../helpers/resolveDeviceLabels/resolveDeviceLabels.js";
15
+ function He(L) {
16
+ const {
17
+ endPoint: k,
18
+ timeout: E,
19
+ parms: P,
20
+ resultField: $,
21
+ isRemote: x,
22
+ isExternalUrl: A,
23
+ responseToCamelCase: G,
24
+ shouldFetch: O,
25
+ onChangeFilterParms: S,
26
+ open: b = !0,
27
+ value: F,
28
+ onChange: B,
29
+ multiple: p = !0,
30
+ loading: f = !1,
31
+ size: l = "medium",
32
+ searchable: T = !0,
33
+ showDepartments: H,
34
+ showIds: j,
35
+ selectAllLabel: K,
36
+ width: z = "100%",
37
+ // The surface is usually mounted the moment it becomes visible, so the
38
+ // first measurement cannot wait for the 200ms throttle or the list shows a
39
+ // blank gap on every open.
40
+ measureImmediately: M = !0,
41
+ className: U,
42
+ "data-testid": V,
43
+ onSearchChange: v,
44
+ onLoadingChange: C,
45
+ onOptionsChange: D,
46
+ ref: Y,
47
+ getDeviceGroup: I = pe,
48
+ ...y
49
+ } = L;
50
+ if (p && S)
51
+ throw new Error(
52
+ "multiple cannot be enabled when onChangeFilterParms is defined; define the filter in parms if needed."
53
+ );
54
+ const { getLabel: r } = ie(), {
55
+ options: s,
56
+ loading: n,
57
+ onOpen: u,
58
+ onClose: g,
59
+ refresh: R,
60
+ onSearchChange: N
61
+ } = de({
62
+ endPoint: k,
63
+ timeout: E,
64
+ parms: P,
65
+ resultField: $,
66
+ isRemote: x,
67
+ isExternalUrl: A,
68
+ responseToCamelCase: G,
69
+ shouldFetch: O,
70
+ onChangeFilterParms: S
71
+ }), w = le({ onOpen: u, onClose: g });
72
+ c(() => {
73
+ w.current = { onOpen: u, onClose: g };
74
+ }, [u, g]), c(() => {
75
+ if (b)
76
+ return w.current.onOpen(), () => w.current.onClose();
77
+ }, [b]), c(() => {
78
+ C?.(n);
79
+ }, [n, C]), c(() => {
80
+ D?.(s);
81
+ }, [s, D]), re(Y, () => ({ refresh: R }), [R]);
82
+ const J = m(
83
+ (e) => ue(e.deviceIcon?.iconId),
84
+ []
85
+ ), { selectedIds: Q, handleSelectionChange: W } = me({
86
+ value: F,
87
+ options: s,
88
+ multiple: p,
89
+ onChange: B
90
+ }), o = he({
91
+ options: s,
92
+ showDepartments: H,
93
+ showIds: j,
94
+ getDeviceGroup: I
95
+ }), { groups: X, items: Z } = ce({
96
+ options: s,
97
+ grouped: o.showDepartments,
98
+ getDeviceGroup: I,
99
+ defaultGroupLabel: r(h.label_default_department),
100
+ // Alias first, name below: the shared contract is resolved here and nowhere
101
+ // else, so a module never paints the device in a different order than the
102
+ // picker.
103
+ getOptionLabel: Re,
104
+ getDeviceSubtitle: ye,
105
+ getDeviceIcon: J
106
+ }), q = s.length, ee = m(
107
+ (e) => {
108
+ N(e), v?.(e);
109
+ },
110
+ [N, v]
111
+ ), te = m(
112
+ ({ item: e }) => {
113
+ const i = e.metadata?.subtitle;
114
+ return /* @__PURE__ */ d(se, { children: [
115
+ /* @__PURE__ */ a(
116
+ ge,
117
+ {
118
+ "data-testid": `${t.rowName}-${e.id}`,
119
+ variant: "bodyStandard",
120
+ color: "text.primary",
121
+ children: e.label
122
+ }
123
+ ),
124
+ i && /* @__PURE__ */ a(
125
+ we,
126
+ {
127
+ "data-testid": `${t.rowSubtitle}-${e.id}`,
128
+ variant: "microSlim",
129
+ color: "text.secondary",
130
+ children: i
131
+ }
132
+ ),
133
+ o.showIds && /* @__PURE__ */ a(
134
+ Se,
135
+ {
136
+ "data-testid": `${t.rowId}-${e.id}`,
137
+ variant: "microSlim",
138
+ color: "text.secondary",
139
+ children: `ID: ${e.metadata?.deviceId ?? e.id}`
140
+ }
141
+ )
142
+ ] });
143
+ },
144
+ [o.showIds]
145
+ ), oe = m(
146
+ ({ group: e, totalCount: i }) => /* @__PURE__ */ d(be, { className: t.groupRow, children: [
147
+ /* @__PURE__ */ a(fe, { variant: "captionDens", children: e.label }),
148
+ /* @__PURE__ */ a(
149
+ ve,
150
+ {
151
+ ownerState: { color: e.color },
152
+ className: t.groupBadge,
153
+ "data-testid": `${t.groupBadge}-${e.id}`,
154
+ variant: "bodyDens",
155
+ children: i
156
+ }
157
+ )
158
+ ] }),
159
+ []
160
+ ), ae = {
161
+ size: l,
162
+ disabled: y.disabled,
163
+ loading: f || n,
164
+ showDepartments: o.showDepartments,
165
+ showIds: o.showIds
166
+ };
167
+ return /* @__PURE__ */ d(
168
+ Ce,
169
+ {
170
+ ownerState: ae,
171
+ className: ne(U, t.root),
172
+ "data-testid": V ?? t.root,
173
+ children: [
174
+ /* @__PURE__ */ d(
175
+ De,
176
+ {
177
+ className: t.header,
178
+ "data-testid": t.header,
179
+ children: [
180
+ o.canShowDepartments && /* @__PURE__ */ a(
181
+ _,
182
+ {
183
+ className: t.columnSwitch,
184
+ "data-testid": "checkable-devices-picker-column-switch-departments",
185
+ label: r(h.label_show_departments),
186
+ labelPlacement: "start",
187
+ size: l,
188
+ checked: o.showDepartments,
189
+ onChange: o.toggleDepartments
190
+ }
191
+ ),
192
+ o.canShowIds && /* @__PURE__ */ a(
193
+ _,
194
+ {
195
+ className: t.columnSwitch,
196
+ "data-testid": "checkable-devices-picker-column-switch-ids",
197
+ label: r(h.label_show_ids),
198
+ labelPlacement: "start",
199
+ size: l,
200
+ checked: o.showIds,
201
+ onChange: o.toggleIds
202
+ }
203
+ )
204
+ ]
205
+ }
206
+ ),
207
+ /* @__PURE__ */ a(
208
+ Ie,
209
+ {
210
+ ...y,
211
+ className: t.list,
212
+ "data-testid": t.list,
213
+ groups: X,
214
+ items: Z,
215
+ value: Q,
216
+ onChange: W,
217
+ multiple: p,
218
+ loading: f || n,
219
+ searchable: T,
220
+ onSearchChange: ee,
221
+ size: l,
222
+ width: z,
223
+ measureImmediately: M,
224
+ selectAll: o.showDepartments,
225
+ selectAllLabel: K ?? r(h.label_select_all),
226
+ selectAllCount: q,
227
+ renderItem: te,
228
+ renderGroup: oe
229
+ }
230
+ )
231
+ ]
232
+ }
233
+ );
234
+ }
235
+ export {
236
+ He as CheckableDevicesPicker
237
+ };
@@ -0,0 +1,3 @@
1
+ import { CheckableDevicesPickerStyles } from './types';
2
+ export declare const checkableDevicesPickerStyles: CheckableDevicesPickerStyles;
3
+ //# sourceMappingURL=CheckableDevicesPicker.styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckableDevicesPicker.styles.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/CheckableDevicesPicker/CheckableDevicesPicker.styles.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAEvD,eAAO,MAAM,4BAA4B,EAAE,4BAwJ1C,CAAC"}
@@ -0,0 +1,157 @@
1
+ import { getContrastTextColor as i } from "@m4l/graphics";
2
+ import { CHECKABLE_LIST_CLASSES as o, SWITCH_CLASSES as a } from "@m4l/components";
3
+ import { CHECKABLE_DEVICES_PICKER_WIDTH as s, CHECKABLE_DEVICES_PICKER_LIST_HEIGHT as n } from "./constants.js";
4
+ const d = {
5
+ /**
6
+ * root: Surface of the picker. Fixed width taken from the Figma master; the
7
+ * height follows the content and the list scrolls inside.
8
+ */
9
+ root: ({ theme: e }) => ({
10
+ width: s,
11
+ display: "flex",
12
+ flexDirection: "column",
13
+ borderRadius: e.vars.size.borderRadius.r3,
14
+ // `clip` instead of `hidden`: hidden still leaves a scrollable area, so
15
+ // focusing a control inside could scroll the surface sideways.
16
+ overflowY: "hidden",
17
+ overflowX: "clip"
18
+ }),
19
+ /**
20
+ * header: Row with the "Ver departamentos" and "Ver ID" switches.
21
+ */
22
+ header: ({ theme: e }) => ({
23
+ display: "flex",
24
+ alignItems: "center",
25
+ justifyContent: "space-between",
26
+ gap: e.vars.size.baseSpacings.sp2,
27
+ padding: e.vars.size.baseSpacings.sp2
28
+ }),
29
+ /**
30
+ * columnSwitch: Each column switch inside the header. The master wraps the
31
+ * label and the toggle in their own outlined pill, so the Switch root is
32
+ * given the stroke and the padding here. `r4` is the largest radius token and
33
+ * CSS clamps it to half the 28px height, which is what fully rounds the box.
34
+ */
35
+ columnSwitch: ({ theme: e }) => ({
36
+ // Pinning the pills made the header wider than the fixed surface, and
37
+ // focusing a switch scrolled the whole panel sideways.
38
+ minWidth: 0,
39
+ height: e.vars.size.baseSpacings.sp7,
40
+ padding: `0 ${e.vars.size.baseSpacings.sp2}`,
41
+ borderRadius: e.vars.size.borderRadius.r4,
42
+ border: e.vars.size.borderStroke.container,
43
+ borderColor: e.vars.palette.border.disabled,
44
+ [`& .${a.label}`]: {
45
+ minWidth: 0,
46
+ overflow: "hidden",
47
+ textOverflow: "ellipsis",
48
+ whiteSpace: "nowrap"
49
+ },
50
+ [`& .${a.muiSwitch}`]: {
51
+ flexShrink: 0
52
+ }
53
+ }),
54
+ /**
55
+ * list: Wrapper of the CheckableList; caps the height so long fleets scroll
56
+ * instead of growing the surface past the viewport.
57
+ * The master draws no dividers inside the panel and no stroke around the
58
+ * search field, so both are cleared here instead of in the shared list.
59
+ */
60
+ list: ({ theme: e }) => ({
61
+ display: "flex",
62
+ flexDirection: "column",
63
+ minHeight: 0,
64
+ height: n,
65
+ padding: e.vars.size.baseSpacings.sp1,
66
+ [`& .${o.selectAllContainer}`]: {
67
+ borderBottom: "none"
68
+ },
69
+ // Sin esto un nombre largo ensancha la fila en vez de recortarse: un flex
70
+ // item no encoge por debajo de su contenido salvo que se le permita.
71
+ [`& .${o.itemContentWrapper}`]: {
72
+ minWidth: 0
73
+ },
74
+ [`&&& .${o.searchInput} .MuiInputBase-root`]: {
75
+ border: "none",
76
+ // Sin borde el foco solo deja el halo suave; hay que devolverlo para que
77
+ // el TextField pinte su `primary.selected`.
78
+ // Stroke and color go in one shorthand on purpose: when a `border`
79
+ // shorthand built from a `var()` is followed by `borderColor` in the same
80
+ // block, Chrome drops the pending shorthand and only the color survives,
81
+ // so the field rendered `0px none` with the right color and the halo
82
+ // looked like a pale border.
83
+ "&:focus-within": {
84
+ border: `${e.vars.size.borderStroke.actionInput} ${e.vars.palette.primary.selected}`
85
+ }
86
+ }
87
+ }),
88
+ /**
89
+ * rowName: Device name inside a row.
90
+ * The variant already carries the master's line box, so no override is
91
+ * needed here.
92
+ */
93
+ rowName: () => ({
94
+ // La superficie nunca hace scroll horizontal: lo que no cabe salta de
95
+ // renglón y la fila crece, porque TanStack mide su alto real.
96
+ whiteSpace: "normal",
97
+ overflowWrap: "anywhere"
98
+ }),
99
+ /**
100
+ * rowSubtitle: Device plate inside a row, below the alias.
101
+ */
102
+ rowSubtitle: () => ({
103
+ whiteSpace: "normal",
104
+ overflowWrap: "anywhere"
105
+ }),
106
+ /**
107
+ * rowId: Device id inside a row.
108
+ */
109
+ rowId: () => ({
110
+ whiteSpace: "normal",
111
+ overflowWrap: "anywhere"
112
+ }),
113
+ /**
114
+ * groupRow: Lays out the group header. The CheckableList drops custom group
115
+ * content into a plain block, so the flex row that separates the label from
116
+ * the count badge has to be provided here.
117
+ */
118
+ groupRow: ({ theme: e }) => ({
119
+ display: "flex",
120
+ alignItems: "center",
121
+ justifyContent: "space-between",
122
+ gap: e.vars.size.baseSpacings.sp2
123
+ }),
124
+ /**
125
+ * groupLabel: Group header label.
126
+ */
127
+ groupLabel: () => ({
128
+ flex: 1,
129
+ minWidth: 0,
130
+ whiteSpace: "normal",
131
+ overflowWrap: "anywhere"
132
+ }),
133
+ /**
134
+ * groupBadge: Group count badge. The background comes from the department
135
+ * color when the endpoint provides it, same contract the geofences
136
+ * assignment already feeds into CheckableListGroup.color.
137
+ * The specificity bump is needed because Typography resolves its own color
138
+ * from the `color` prop, which defaults to text.primary.
139
+ */
140
+ groupBadge: ({ theme: e, ownerState: r }) => ({
141
+ flexShrink: 0,
142
+ padding: `0 ${e.vars.size.baseSpacings.sp1}`,
143
+ borderRadius: e.vars.size.borderRadius.r3,
144
+ "&&": {
145
+ ...r?.color ? {
146
+ backgroundColor: r.color,
147
+ color: i(r.color)
148
+ } : {
149
+ backgroundColor: e.vars.palette.action.hover,
150
+ color: e.vars.palette.text.secondary
151
+ }
152
+ }
153
+ })
154
+ };
155
+ export {
156
+ d as checkableDevicesPickerStyles
157
+ };
@@ -0,0 +1,22 @@
1
+ export declare const CHECKABLE_DEVICES_PICKER_KEY_COMPONENT = "M4LCheckableDevicesPicker";
2
+ export declare const CHECKABLE_DEVICES_PICKER_CLASSES: Record<"root" | "header" | "list" | "columnSwitch" | "rowName" | "rowSubtitle" | "rowId" | "groupRow" | "groupLabel" | "groupBadge", string>;
3
+ /**
4
+ * Fixed width of the picker surface.
5
+ * Situational measure taken from the Figma master; it is a layout decision,
6
+ * not a design token. Consumers that need another width pass the inherited
7
+ * CheckableList `width` prop.
8
+ */
9
+ export declare const CHECKABLE_DEVICES_PICKER_WIDTH = 320;
10
+ /**
11
+ * Height reserved for the list.
12
+ * The CheckableList is virtualized and needs a measurable height; capping it
13
+ * here keeps long fleets scrolling instead of growing the surface past the
14
+ * viewport.
15
+ */
16
+ export declare const CHECKABLE_DEVICES_PICKER_LIST_HEIGHT = 320;
17
+ /**
18
+ * Group id used for devices with no department.
19
+ * It is rendered last so a selection is never hidden by the grouping.
20
+ */
21
+ export declare const CHECKABLE_DEVICES_PICKER_DEFAULT_GROUP_ID = "default";
22
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/CheckableDevicesPicker/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,sCAAsC,8BAA8B,CAAC;AAElF,eAAO,MAAM,gCAAgC,8IAG5C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAElD;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,MAAM,CAAC;AAQxD;;;GAGG;AACH,eAAO,MAAM,yCAAyC,YAAY,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { getComponentClasses as E } from "@m4l/components";
2
+ import { CheckableDevicesPickerSlots as C } from "./slots/CheckableDevicesPickerEnum.js";
3
+ const _ = "M4LCheckableDevicesPicker", o = E(
4
+ _,
5
+ C
6
+ ), t = 320, c = 320, s = "default";
7
+ export {
8
+ o as CHECKABLE_DEVICES_PICKER_CLASSES,
9
+ s as CHECKABLE_DEVICES_PICKER_DEFAULT_GROUP_ID,
10
+ _ as CHECKABLE_DEVICES_PICKER_KEY_COMPONENT,
11
+ c as CHECKABLE_DEVICES_PICKER_LIST_HEIGHT,
12
+ t as CHECKABLE_DEVICES_PICKER_WIDTH
13
+ };
@@ -0,0 +1,15 @@
1
+ export declare const CHECKABLE_DEVICES_PICKER_DICTIONARY_ID = "checkable_devices_picker";
2
+ /**
3
+ * getCheckableDevicesPickerComponentsDictionary: Returns the dictionary ids
4
+ * used by the CheckableDevicesPicker component.
5
+ */
6
+ export declare function getCheckableDevicesPickerComponentsDictionary(): string[];
7
+ export declare const DICCTIONARY: {
8
+ readonly label_show_departments: "checkable_devices_picker.label_show_departments";
9
+ readonly label_show_ids: "checkable_devices_picker.label_show_ids";
10
+ readonly label_search_placeholder: "checkable_devices_picker.label_search_placeholder";
11
+ readonly label_select_all: "checkable_devices_picker.label_select_all";
12
+ readonly label_default_department: "checkable_devices_picker.label_default_department";
13
+ };
14
+ export type TypeDictionary = typeof DICCTIONARY;
15
+ //# sourceMappingURL=dictionary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../../../../packages/gclick/src/components/CheckableDevicesPicker/dictionary.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sCAAsC,6BAA6B,CAAC;AAEjF;;;GAGG;AACH,wBAAgB,6CAA6C,aAE5D;AAED,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,OAAO,WAAW,CAAC"}
@@ -0,0 +1,15 @@
1
+ const e = "checkable_devices_picker";
2
+ function l() {
3
+ return [e];
4
+ }
5
+ const _ = {
6
+ label_show_departments: `${e}.label_show_departments`,
7
+ label_show_ids: `${e}.label_show_ids`,
8
+ label_select_all: `${e}.label_select_all`,
9
+ label_default_department: `${e}.label_default_department`
10
+ };
11
+ export {
12
+ e as CHECKABLE_DEVICES_PICKER_DICTIONARY_ID,
13
+ _ as DICCTIONARY,
14
+ l as getCheckableDevicesPickerComponentsDictionary
15
+ };
@@ -0,0 +1,11 @@
1
+ import { DevicePickerGroupRef, DevicePickerOption } from '../types';
2
+ /**
3
+ * Default group resolver for a device option.
4
+ * Accepts the department both as a plain name and as an object, because the
5
+ * devices endpoints in the workspace expose it in either shape: the geofences
6
+ * assignment consumes `{ id, name, color }` while the GPS history module
7
+ * receives it as a plain string. Returns null when the device has none, so the
8
+ * caller can place it in the default group.
9
+ */
10
+ export declare function resolveDeviceGroup(option: DevicePickerOption): DevicePickerGroupRef | null;
11
+ //# sourceMappingURL=resolveDeviceGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveDeviceGroup.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/CheckableDevicesPicker/helpers/resolveDeviceGroup.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAmB5F;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,kBAAkB,GACzB,oBAAoB,GAAG,IAAI,CA2B7B"}
@@ -0,0 +1,23 @@
1
+ function i(t) {
2
+ return typeof t == "object" && t !== null;
3
+ }
4
+ function o(t) {
5
+ return typeof t == "string" && t.startsWith("#") ? t : void 0;
6
+ }
7
+ function l(t) {
8
+ const { department: e } = t;
9
+ if (!e)
10
+ return null;
11
+ if (i(e)) {
12
+ const r = e.name?.trim() || void 0, n = e.id ?? r;
13
+ return n === void 0 ? null : {
14
+ id: n,
15
+ label: r ?? String(n),
16
+ color: o(e.color)
17
+ };
18
+ }
19
+ return { id: e, label: e };
20
+ }
21
+ export {
22
+ l as resolveDeviceGroup
23
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Normalizes the picker value into an array.
3
+ * The value mirrors the AutocompleteAsync contract, so it can arrive as an
4
+ * array (multiple), as a single option (single) or as null/undefined.
5
+ */
6
+ export declare function toDeviceArray<T>(value: T | T[] | null | undefined): T[];
7
+ //# sourceMappingURL=toDeviceArray.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toDeviceArray.d.ts","sourceRoot":"","sources":["../../../../../../../packages/gclick/src/components/CheckableDevicesPicker/helpers/toDeviceArray.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,EAAE,CAMvE"}
@@ -0,0 +1,6 @@
1
+ function t(r) {
2
+ return Array.isArray(r) ? r : r ? [r] : [];
3
+ }
4
+ export {
5
+ t as toDeviceArray
6
+ };