@headless-adminapp/fluent 0.0.17-alpha.53 → 0.0.17-alpha.55

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 (179) hide show
  1. package/App/App.js +11 -7
  2. package/App/AppHeaderContianer.js +50 -44
  3. package/App/AppLogo.js +12 -9
  4. package/App/AppStringContext.js +13 -9
  5. package/App/AppUI.js +15 -11
  6. package/App/LayoutProvider.js +16 -24
  7. package/App/NavigationContainer.js +28 -28
  8. package/App/QuickActionItem.js +10 -6
  9. package/App/index.js +5 -1
  10. package/App/utils.d.ts +1 -1
  11. package/App/utils.js +7 -5
  12. package/CommandBar/Button.js +17 -14
  13. package/CommandBar/Divider.js +9 -6
  14. package/CommandBar/IconButton.js +16 -13
  15. package/CommandBar/Label.js +11 -8
  16. package/CommandBar/MenuButton.js +20 -17
  17. package/CommandBar/MenuItem.js +19 -16
  18. package/CommandBar/MenuItems.js +10 -10
  19. package/CommandBar/MenuList.js +12 -9
  20. package/CommandBar/Wrapper.js +10 -7
  21. package/CommandBar/index.js +15 -13
  22. package/DataForm/SectionControl.js +7 -4
  23. package/DataGrid/ActionCell.js +14 -11
  24. package/DataGrid/CommandContainer.js +10 -6
  25. package/DataGrid/CustomizeColumns/AddColumns.js +61 -59
  26. package/DataGrid/CustomizeColumns/ColumnItem.js +23 -19
  27. package/DataGrid/CustomizeColumns/CustomizeColumns.js +41 -36
  28. package/DataGrid/CustomizeColumns/index.js +5 -1
  29. package/DataGrid/FormSubgridCommandContainer.js +17 -13
  30. package/DataGrid/FormSubgridViewSelector.js +21 -21
  31. package/DataGrid/GridColumnHeader/ConditionValueControl.js +33 -33
  32. package/DataGrid/GridColumnHeader/FilterForm.js +28 -27
  33. package/DataGrid/GridColumnHeader/OperatorSelect.js +19 -13
  34. package/DataGrid/GridColumnHeader/TableHeaderFilterCell.js +35 -31
  35. package/DataGrid/GridColumnHeader/index.js +5 -1
  36. package/DataGrid/GridColumnHeader/utils.js +6 -2
  37. package/DataGrid/GridHeaderContainer.js +8 -4
  38. package/DataGrid/GridHeaderDesktop.js +28 -28
  39. package/DataGrid/GridHeaderMobile.js +20 -19
  40. package/DataGrid/GridListContainer.js +50 -44
  41. package/DataGrid/GridPaginationContainer.js +16 -13
  42. package/DataGrid/GridTableContainer.js +98 -89
  43. package/DataGrid/TableCell/TableCellAction.js +15 -11
  44. package/DataGrid/TableCell/TableCellBase.js +13 -4
  45. package/DataGrid/TableCell/TableCellCheckbox.js +11 -8
  46. package/DataGrid/TableCell/TableCellChoice.js +15 -13
  47. package/DataGrid/TableCell/TableCellLink.js +14 -11
  48. package/DataGrid/TableCell/TableCellText.js +10 -7
  49. package/DataGrid/TableCell/index.js +20 -4
  50. package/DataGrid/index.js +11 -4
  51. package/DataGrid/types.js +2 -1
  52. package/DataGrid/useTableColumns.js +98 -103
  53. package/DataGrid/utils.js +5 -1
  54. package/DialogContainer/AlertDialog.js +11 -11
  55. package/DialogContainer/ConfirmDialog.js +13 -14
  56. package/DialogContainer/DialogContainer.js +19 -26
  57. package/DialogContainer/ErrorDialog.js +15 -15
  58. package/DialogContainer/PromptDialog.js +76 -58
  59. package/DialogContainer/index.js +5 -1
  60. package/Insights/CommandBarContainer.js +17 -11
  61. package/Insights/FilterBarContainer.js +32 -37
  62. package/Insights/Grid.js +13 -9
  63. package/Insights/InsightsContainer.js +22 -19
  64. package/Insights/WidgetChartContainer.js +34 -30
  65. package/Insights/WidgetDataGridContainer.js +45 -33
  66. package/Insights/WidgetTableContainer.js +29 -26
  67. package/Insights/WidgetTileContainer.js +16 -12
  68. package/Insights/WidgetTitleBar.js +15 -10
  69. package/Insights/Widgets.js +28 -25
  70. package/Insights/charts/AreaChart.js +15 -12
  71. package/Insights/charts/BarChart.js +15 -12
  72. package/Insights/charts/ComposedChart.js +15 -13
  73. package/Insights/charts/CustomTooltipContent.js +13 -9
  74. package/Insights/charts/GaugeChart.js +6 -3
  75. package/Insights/charts/LineChart.js +15 -12
  76. package/Insights/charts/OhlcChart.js +46 -40
  77. package/Insights/charts/PieChart.js +25 -26
  78. package/Insights/charts/RadarChart.js +19 -17
  79. package/Insights/charts/ScatterChart.js +26 -28
  80. package/Insights/charts/constants.js +4 -1
  81. package/Insights/charts/formatters.js +33 -23
  82. package/Insights/charts/index.js +2 -1
  83. package/Insights/charts/renderers.js +36 -26
  84. package/Insights/hooks/useQueriesData.js +27 -30
  85. package/Insights/hooks/useWidgetDetail.js +24 -15
  86. package/OverflowCommandBar/OverflowCommandBar.js +19 -12
  87. package/OverflowCommandBar/OverflowMenu.js +22 -30
  88. package/OverflowCommandBar/OverflowMenuDivider.js +10 -6
  89. package/OverflowCommandBar/index.js +9 -3
  90. package/OverflowCommandBar/render.js +15 -10
  91. package/OverflowCommandBar/utils.js +6 -4
  92. package/PageBoard/BoardColumn.js +8 -5
  93. package/PageBoard/BoardColumnCard.d.ts +1 -1
  94. package/PageBoard/BoardColumnCard.js +15 -11
  95. package/PageBoard/BoardColumnUI.js +45 -46
  96. package/PageBoard/BoardingColumnCardLoading.js +13 -10
  97. package/PageBoard/Header.js +23 -28
  98. package/PageBoard/PageBoard.js +28 -26
  99. package/PageBoard/index.js +5 -1
  100. package/PageEntityForm/CommandContainer.js +25 -21
  101. package/PageEntityForm/FormTabRelated.js +20 -17
  102. package/PageEntityForm/PageEntityForm.js +20 -16
  103. package/PageEntityForm/PageEntityFormDesktopContainer.js +77 -70
  104. package/PageEntityForm/PageEntityFormStringContext.js +9 -5
  105. package/PageEntityForm/ProcessFlow.js +24 -21
  106. package/PageEntityForm/RecordCard.js +31 -24
  107. package/PageEntityForm/RecordCardLoading.js +13 -11
  108. package/PageEntityForm/RecordSetNavigatorContainer.js +34 -31
  109. package/PageEntityForm/RelatedViewSelector.js +34 -36
  110. package/PageEntityForm/SectionContainer.js +35 -31
  111. package/PageEntityForm/StandardControl.js +84 -76
  112. package/PageEntityForm/SubgridControl.js +23 -21
  113. package/PageEntityForm/index.js +5 -1
  114. package/PageEntityView/FormSubgridContainer.js +26 -22
  115. package/PageEntityView/PageEntityView.js +19 -15
  116. package/PageEntityView/PageEntityViewDesktopContainer.js +13 -9
  117. package/PageEntityView/PageEntityViewDesktopFrame.js +21 -17
  118. package/PageEntityView/PageEntityViewMobileContainer.js +13 -9
  119. package/PageEntityView/PageEntityViewStringContext.js +9 -5
  120. package/PageEntityView/index.js +5 -1
  121. package/PageInsights/PageInsights.js +13 -9
  122. package/PageInsights/index.js +6 -1
  123. package/ProgressIndicatorContainer/index.js +14 -10
  124. package/ToastNotificationContainer/index.js +18 -15
  125. package/componentStore.js +5 -2
  126. package/components/BodyLoading.js +11 -7
  127. package/components/DialogLogin.js +8 -5
  128. package/components/DndProvider.d.ts +12 -0
  129. package/components/DndProvider.js +68 -0
  130. package/components/LoginForm.js +46 -36
  131. package/components/PageBroken.js +8 -5
  132. package/components/PageLoading.js +8 -5
  133. package/components/PageLogin.js +17 -14
  134. package/form/FormControl.js +44 -50
  135. package/form/FormControlLoading.js +8 -4
  136. package/form/controls/AttachmentControl.js +72 -77
  137. package/form/controls/AttachmentsControl.js +24 -30
  138. package/form/controls/CurrencyControl.js +16 -13
  139. package/form/controls/DateControl.js +24 -18
  140. package/form/controls/DateRangeControl.js +22 -18
  141. package/form/controls/DateTimeControl.js +49 -43
  142. package/form/controls/DecimalControl.js +14 -11
  143. package/form/controls/DurationControl.js +18 -14
  144. package/form/controls/EmailControl.js +14 -11
  145. package/form/controls/IntegerControl.js +11 -8
  146. package/form/controls/LookupControl.js +58 -56
  147. package/form/controls/MultiSelectControl.js +12 -9
  148. package/form/controls/MultiSelectLookupControl.js +55 -53
  149. package/form/controls/PasswordControl.js +11 -8
  150. package/form/controls/RichTextControl.js +32 -5
  151. package/form/controls/SelectControl.js +15 -13
  152. package/form/controls/SwitchControl.js +7 -4
  153. package/form/controls/TelephoneControl.js +10 -7
  154. package/form/controls/TextAreaControl.js +11 -8
  155. package/form/controls/TextControl.js +12 -9
  156. package/form/controls/UrlControl.js +10 -7
  157. package/form/controls/types.js +2 -1
  158. package/form/controls/useLookupData.js +43 -54
  159. package/form/layout/FormBody/FormBody.js +10 -6
  160. package/form/layout/FormBody/index.js +17 -1
  161. package/form/layout/FormSection/FormSection.js +31 -20
  162. package/form/layout/FormSection/FormSectionColumn.js +7 -3
  163. package/form/layout/FormSection/FormSectionLoading.js +5 -1
  164. package/form/layout/FormSection/index.js +5 -1
  165. package/form/layout/FormTab/FormTab.js +21 -17
  166. package/form/layout/FormTab/FormTabColumn.js +9 -5
  167. package/form/layout/FormTab/index.js +5 -1
  168. package/form/layout/TabContext.js +5 -2
  169. package/form/layout/index.js +9 -3
  170. package/form/types.js +2 -1
  171. package/package.json +4 -12
  172. package/types/index.js +2 -1
  173. package/utils/avatar.js +4 -1
  174. package/DataGrid/ScrollbarWithMoreDataRequest.d.ts +0 -9
  175. package/DataGrid/ScrollbarWithMoreDataRequest.js +0 -33
  176. package/form/controls/NumberControl.d.ts +0 -4
  177. package/form/controls/NumberControl.js +0 -16
  178. package/form/controls/utils.d.ts +0 -4
  179. package/form/controls/utils.js +0 -42
@@ -1,66 +1,72 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { tokens } from '@fluentui/react-components';
3
- import { DatePicker } from '@fluentui/react-datepicker-compat';
4
- import { TimePicker } from '@fluentui/react-timepicker-compat';
5
- import { useLocale } from '@headless-adminapp/app/locale';
6
- import { Icons } from '@headless-adminapp/icons';
7
- import dayjs from 'dayjs';
8
- import customParseFormat from 'dayjs/plugin/customParseFormat';
9
- import timezone from 'dayjs/plugin/timezone';
10
- import utc from 'dayjs/plugin/utc';
11
- import { useEffect, useRef, useState } from 'react';
12
- dayjs.extend(customParseFormat);
13
- dayjs.extend(utc);
14
- dayjs.extend(timezone);
15
- export function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }) {
16
- const { dateFormats: { short: dateFormat }, timeFormats: { short: timeFormat }, timezone, } = useLocale();
17
- const [internalTimeValue, setInternalTimeValue] = useState(value ? dayjs(value).tz(timezone).format(timeFormat) : '');
18
- const internalTimeValueRef = useRef(internalTimeValue);
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DateTimeControl = DateTimeControl;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_components_1 = require("@fluentui/react-components");
9
+ const react_datepicker_compat_1 = require("@fluentui/react-datepicker-compat");
10
+ const react_timepicker_compat_1 = require("@fluentui/react-timepicker-compat");
11
+ const locale_1 = require("@headless-adminapp/app/locale");
12
+ const icons_1 = require("@headless-adminapp/icons");
13
+ const dayjs_1 = __importDefault(require("dayjs"));
14
+ const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
15
+ const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
16
+ const utc_1 = __importDefault(require("dayjs/plugin/utc"));
17
+ const react_1 = require("react");
18
+ dayjs_1.default.extend(customParseFormat_1.default);
19
+ dayjs_1.default.extend(utc_1.default);
20
+ dayjs_1.default.extend(timezone_1.default);
21
+ function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, readOnly, }) {
22
+ const { dateFormats: { short: dateFormat }, timeFormats: { short: timeFormat }, timezone, } = (0, locale_1.useLocale)();
23
+ const [internalTimeValue, setInternalTimeValue] = (0, react_1.useState)(value ? (0, dayjs_1.default)(value).tz(timezone).format(timeFormat) : '');
24
+ const internalTimeValueRef = (0, react_1.useRef)(internalTimeValue);
19
25
  internalTimeValueRef.current = internalTimeValue;
20
- useEffect(() => {
26
+ (0, react_1.useEffect)(() => {
21
27
  const updatedValue = value
22
- ? dayjs(value).tz(timezone).format(timeFormat)
28
+ ? (0, dayjs_1.default)(value).tz(timezone).format(timeFormat)
23
29
  : '';
24
30
  if (internalTimeValueRef.current !== updatedValue) {
25
31
  setInternalTimeValue(updatedValue);
26
32
  }
27
33
  }, [value, timezone, timeFormat]);
28
- return (_jsxs("div", { style: {
34
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
29
35
  display: 'flex',
30
36
  alignItems: 'center',
31
- gap: tokens.spacingHorizontalS,
32
- }, children: [_jsx(DatePicker, { id: id, name: name, onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), placeholder: placeholder, appearance: "filled-darker", formatDate: (date) => date ? dayjs(date).tz(timezone).format(dateFormat) : '', disabled: disabled, readOnly: readOnly, value: value ? new Date(value) : null, onSelectDate: (date) => {
37
+ gap: react_components_1.tokens.spacingHorizontalS,
38
+ }, children: [(0, jsx_runtime_1.jsx)(react_datepicker_compat_1.DatePicker, { id: id, name: name, onFocus: () => onFocus?.(), onBlur: () => onBlur?.(), placeholder: placeholder, appearance: "filled-darker", formatDate: (date) => date ? (0, dayjs_1.default)(date).tz(timezone).format(dateFormat) : '', disabled: disabled, readOnly: readOnly, value: value ? new Date(value) : null, onSelectDate: (date) => {
33
39
  if (!date) {
34
- onChange === null || onChange === void 0 ? void 0 : onChange(null);
40
+ onChange?.(null);
35
41
  }
36
42
  else if (!value) {
37
- onChange === null || onChange === void 0 ? void 0 : onChange(dayjs(date).tz(timezone, true).toISOString());
43
+ onChange?.((0, dayjs_1.default)(date).tz(timezone, true).toISOString());
38
44
  }
39
45
  else {
40
- onChange === null || onChange === void 0 ? void 0 : onChange(dayjs(date)
46
+ onChange?.((0, dayjs_1.default)(date)
41
47
  .tz(timezone, true)
42
- .set('hour', dayjs(value).tz(timezone).hour())
43
- .set('minute', dayjs(value).tz(timezone).minute())
48
+ .set('hour', (0, dayjs_1.default)(value).tz(timezone).hour())
49
+ .set('minute', (0, dayjs_1.default)(value).tz(timezone).minute())
44
50
  .toISOString());
45
51
  }
46
52
  },
47
53
  // allowTextInput={true}
48
- contentAfter: _jsx("div", { style: {
54
+ contentAfter: (0, jsx_runtime_1.jsx)("div", { style: {
49
55
  display: 'flex',
50
56
  alignItems: 'center',
51
57
  justifyContent: 'center',
52
58
  marginRight: -4,
53
- color: tokens.colorNeutralForeground2,
54
- }, children: _jsx(Icons.Calendar, { size: 20 }) }), style: { flex: 1 }, input: {
59
+ color: react_components_1.tokens.colorNeutralForeground2,
60
+ }, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Calendar, { size: 20 }) }), style: { flex: 1 }, input: {
55
61
  style: { minWidth: 0, width: '100%' },
56
- } }), _jsx(TimePicker, { appearance: "filled-darker", style: { flex: 1, minWidth: 0 }, input: {
62
+ } }), (0, jsx_runtime_1.jsx)(react_timepicker_compat_1.TimePicker, { appearance: "filled-darker", style: { flex: 1, minWidth: 0 }, input: {
57
63
  style: { minWidth: 0 },
58
64
  }, readOnly: readOnly || disabled || !value, selectedTime: value ? new Date(value) : null, freeform: true, value: internalTimeValue, onTimeChange: (_, data) => {
59
65
  const dateValue = value
60
- ? dayjs(value).tz(timezone)
61
- : dayjs().tz(timezone);
66
+ ? (0, dayjs_1.default)(value).tz(timezone)
67
+ : (0, dayjs_1.default)().tz(timezone);
62
68
  if (data.selectedTime) {
63
- onChange === null || onChange === void 0 ? void 0 : onChange(dateValue
69
+ onChange?.(dateValue
64
70
  .set('hour', data.selectedTime.getHours())
65
71
  .set('minute', data.selectedTime.getMinutes())
66
72
  .toISOString());
@@ -68,7 +74,7 @@ export function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, pl
68
74
  else if (data.selectedTimeText) {
69
75
  let resolvedTime = resolveTimeValue(data.selectedTimeText, timeFormat);
70
76
  if (!resolvedTime) {
71
- setInternalTimeValue(value ? dayjs(value).format(timeFormat) : '');
77
+ setInternalTimeValue(value ? (0, dayjs_1.default)(value).format(timeFormat) : '');
72
78
  return;
73
79
  }
74
80
  const newValue = dateValue
@@ -76,27 +82,27 @@ export function DateTimeControl({ value, onChange, id, name, onBlur, onFocus, pl
76
82
  .set('minute', resolvedTime.getMinutes())
77
83
  .toISOString();
78
84
  if (newValue !== value) {
79
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
85
+ onChange?.(newValue);
80
86
  }
81
- setInternalTimeValue(newValue ? dayjs(newValue).tz(timezone).format(timeFormat) : '');
87
+ setInternalTimeValue(newValue ? (0, dayjs_1.default)(newValue).tz(timezone).format(timeFormat) : '');
82
88
  }
83
89
  }, onInput: (e) => {
84
90
  setInternalTimeValue(e.currentTarget.value);
85
91
  }, onBlur: () => {
86
- onBlur === null || onBlur === void 0 ? void 0 : onBlur();
87
- }, expandIcon: _jsx("div", { style: {
92
+ onBlur?.();
93
+ }, expandIcon: (0, jsx_runtime_1.jsx)("div", { style: {
88
94
  display: 'flex',
89
95
  alignItems: 'center',
90
96
  justifyContent: 'center',
91
97
  marginRight: -4,
92
- color: tokens.colorNeutralForeground2,
93
- }, children: _jsx(Icons.Clock, { size: 20 }) }) })] }));
98
+ color: react_components_1.tokens.colorNeutralForeground2,
99
+ }, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Clock, { size: 20 }) }) })] }));
94
100
  }
95
101
  function resolveTimeValue(value, timeFormat) {
96
102
  if (!value) {
97
103
  return;
98
104
  }
99
- const time = dayjs(value, timeFormat);
105
+ const time = (0, dayjs_1.default)(value, timeFormat);
100
106
  if (!time.isValid()) {
101
107
  return;
102
108
  }
@@ -1,12 +1,15 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DecimalControl = DecimalControl;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
2
5
  /* eslint-disable unused-imports/no-unused-vars */
3
- import { Input } from '@fluentui/react-components';
4
- import { useEffect, useRef, useState } from 'react';
5
- export function DecimalControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, decimalPlaces, }) {
6
- const [internalValue, setInternalValue] = useState(value ? value.toString() : '');
7
- const internalValueRef = useRef(internalValue);
6
+ const react_components_1 = require("@fluentui/react-components");
7
+ const react_1 = require("react");
8
+ function DecimalControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, decimalPlaces, }) {
9
+ const [internalValue, setInternalValue] = (0, react_1.useState)(value ? value.toString() : '');
10
+ const internalValueRef = (0, react_1.useRef)(internalValue);
8
11
  internalValueRef.current = internalValue;
9
- useEffect(() => {
12
+ (0, react_1.useEffect)(() => {
10
13
  let _value = '';
11
14
  if (typeof value === 'number') {
12
15
  _value = value.toString();
@@ -22,13 +25,13 @@ export function DecimalControl({ value, onChange, id, name, onBlur, onFocus, err
22
25
  let value = e.target.value;
23
26
  if (!value) {
24
27
  setInternalValue('');
25
- onChange === null || onChange === void 0 ? void 0 : onChange(null);
28
+ onChange?.(null);
26
29
  return;
27
30
  }
28
31
  value = value.replace(',', '');
29
32
  if (value === '-') {
30
33
  setInternalValue('-');
31
- onChange === null || onChange === void 0 ? void 0 : onChange(null);
34
+ onChange?.(null);
32
35
  return;
33
36
  }
34
37
  if (isNaN(Number(value))) {
@@ -41,9 +44,9 @@ export function DecimalControl({ value, onChange, id, name, onBlur, onFocus, err
41
44
  }
42
45
  }
43
46
  setInternalValue(value);
44
- onChange === null || onChange === void 0 ? void 0 : onChange(Number(value));
47
+ onChange?.(Number(value));
45
48
  };
46
- return (_jsx(Input, { placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: internalValue, onChange: handleChange, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), disabled: disabled, readOnly: readOnly, style: {
49
+ return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { placeholder: placeholder, id: id, appearance: "filled-darker", name: name, value: internalValue, onChange: handleChange, onBlur: () => onBlur?.(), onFocus: () => onFocus?.(), disabled: disabled, readOnly: readOnly, style: {
47
50
  width: '100%',
48
51
  } }));
49
52
  }
@@ -1,7 +1,10 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Combobox, makeStyles, Option } from '@fluentui/react-components';
3
- import { useEffect, useMemo, useState } from 'react';
4
- const useStyles = makeStyles({
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DurationControl = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const react_1 = require("react");
7
+ const useStyles = (0, react_components_1.makeStyles)({
5
8
  listbox: {
6
9
  maxHeight: '300px !important',
7
10
  },
@@ -97,20 +100,20 @@ const options = [
97
100
  value: '4320',
98
101
  },
99
102
  ];
100
- export const DurationControl = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, }) => {
101
- const [searchText, setSearchText] = useState('');
102
- const [filterEnabled, setFilterEnabled] = useState(false);
103
+ const DurationControl = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, }) => {
104
+ const [searchText, setSearchText] = (0, react_1.useState)('');
105
+ const [filterEnabled, setFilterEnabled] = (0, react_1.useState)(false);
103
106
  const styles = useStyles();
104
- useEffect(() => {
107
+ (0, react_1.useEffect)(() => {
105
108
  setSearchText(getDisplayValue(value));
106
109
  }, [value]);
107
- const filteredItems = useMemo(() => {
110
+ const filteredItems = (0, react_1.useMemo)(() => {
108
111
  if (!filterEnabled) {
109
112
  return options;
110
113
  }
111
114
  return options.filter((item) => item.text.toLowerCase().includes(searchText.toLowerCase()));
112
115
  }, [searchText, filterEnabled]);
113
- return (_jsx("div", { style: { position: 'relative', width: '100%' }, children: _jsx(Combobox, { name: name, appearance: "filled-darker", placeholder: placeholder, inputMode: "search", style: { width: '100%', minWidth: 'unset' }, listbox: { className: styles.listbox }, autoComplete: "off", readOnly: readOnly || disabled, value: searchText, disableAutoFocus: true, selectedOptions: value ? [value.toString()] : [], onBlur: () => {
116
+ return ((0, jsx_runtime_1.jsx)("div", { style: { position: 'relative', width: '100%' }, children: (0, jsx_runtime_1.jsx)(react_components_1.Combobox, { name: name, appearance: "filled-darker", placeholder: placeholder, inputMode: "search", style: { width: '100%', minWidth: 'unset' }, listbox: { className: styles.listbox }, autoComplete: "off", readOnly: readOnly || disabled, value: searchText, disableAutoFocus: true, selectedOptions: value ? [value.toString()] : [], onBlur: () => {
114
117
  let newValue = null;
115
118
  if (searchText) {
116
119
  newValue = resolveValue(searchText);
@@ -120,11 +123,11 @@ export const DurationControl = ({ value, onChange, id, name, onBlur, onFocus, pl
120
123
  }
121
124
  if (newValue !== null) {
122
125
  console.log('onBlur', newValue);
123
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
126
+ onChange?.(newValue);
124
127
  }
125
128
  setSearchText(getDisplayValue(newValue));
126
129
  setFilterEnabled(false);
127
- onBlur === null || onBlur === void 0 ? void 0 : onBlur();
130
+ onBlur?.();
128
131
  }, onFocus: onFocus, id: id, autoFocus: autoFocus, onChange: (e) => {
129
132
  setFilterEnabled(true);
130
133
  setSearchText(e.target.value);
@@ -134,11 +137,12 @@ export const DurationControl = ({ value, onChange, id, name, onBlur, onFocus, pl
134
137
  return;
135
138
  }
136
139
  else {
137
- onChange === null || onChange === void 0 ? void 0 : onChange(Number(item.optionValue));
140
+ onChange?.(Number(item.optionValue));
138
141
  }
139
142
  setSearchText('');
140
- }, children: filteredItems.map((item) => (_jsx(Option, { value: item.value, children: item.text }, item.value))) }) }));
143
+ }, children: filteredItems.map((item) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: item.value, children: item.text }, item.value))) }) }));
141
144
  };
145
+ exports.DurationControl = DurationControl;
142
146
  function getDisplayValue(value) {
143
147
  if (!value) {
144
148
  return '';
@@ -1,19 +1,22 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Button, Input, tokens } from '@fluentui/react-components';
3
- import { Icons } from '@headless-adminapp/icons';
4
- export function EmailControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, textTransform, readOnly, }) {
5
- return (_jsx(Input, { type: "email", placeholder: placeholder, id: id, appearance: "filled-darker", name: name,
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmailControl = EmailControl;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const icons_1 = require("@headless-adminapp/icons");
7
+ function EmailControl({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoComplete, textTransform, readOnly, }) {
8
+ return ((0, jsx_runtime_1.jsx)(react_components_1.Input, { type: "email", placeholder: placeholder, id: id, appearance: "filled-darker", name: name,
6
9
  // size="sm"
7
10
  value: value || '', onChange: (e) => {
8
11
  textTransform === 'uppercase'
9
- ? onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value.toUpperCase())
12
+ ? onChange?.(e.target.value.toUpperCase())
10
13
  : textTransform === 'lowercase'
11
- ? onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value.toLowerCase())
12
- : onChange === null || onChange === void 0 ? void 0 : onChange(e.target.value);
13
- }, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(),
14
+ ? onChange?.(e.target.value.toLowerCase())
15
+ : onChange?.(e.target.value);
16
+ }, onBlur: () => onBlur?.(), onFocus: () => onFocus?.(),
14
17
  // invalid={error}
15
18
  disabled: disabled, readOnly: readOnly, autoComplete: autoComplete, style: {
16
19
  flex: 1,
17
- paddingRight: tokens.spacingHorizontalXS,
18
- }, contentAfter: !!value ? (_jsx(Button, { onClick: () => window.open(`mailto:${value}`, '_blank'), color: "primary", appearance: "transparent", icon: _jsx(Icons.Mail, {}), size: "small" })) : undefined }));
20
+ paddingRight: react_components_1.tokens.spacingHorizontalXS,
21
+ }, contentAfter: !!value ? ((0, jsx_runtime_1.jsx)(react_components_1.Button, { onClick: () => window.open(`mailto:${value}`, '_blank'), color: "primary", appearance: "transparent", icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Mail, {}), size: "small" })) : undefined }));
19
22
  }
@@ -1,22 +1,25 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IntegerControl = IntegerControl;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
2
5
  /* eslint-disable unused-imports/no-unused-vars */
3
- import { SpinButton } from '@fluentui/react-components';
4
- export function IntegerControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, }) {
5
- return (_jsx(SpinButton, { appearance: "filled-darker", placeholder: placeholder, id: id, name: name, value: value !== null && value !== void 0 ? value : null, onChange: (e, data) => {
6
+ const react_components_1 = require("@fluentui/react-components");
7
+ function IntegerControl({ value, onChange, id, name, onBlur, onFocus, error, disabled, placeholder, borderOnFocusOnly, readOnly, }) {
8
+ return ((0, jsx_runtime_1.jsx)(react_components_1.SpinButton, { appearance: "filled-darker", placeholder: placeholder, id: id, name: name, value: value ?? null, onChange: (e, data) => {
6
9
  if (data.value !== undefined) {
7
- onChange === null || onChange === void 0 ? void 0 : onChange(data.value);
10
+ onChange?.(data.value);
8
11
  }
9
12
  else if (!data.displayValue) {
10
- onChange === null || onChange === void 0 ? void 0 : onChange(null);
13
+ onChange?.(null);
11
14
  }
12
15
  else if (data.displayValue !== undefined) {
13
16
  const newValue = parseFloat(data.displayValue);
14
17
  if (!Number.isNaN(newValue)) {
15
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
18
+ onChange?.(newValue);
16
19
  }
17
20
  }
18
21
  else {
19
- onChange === null || onChange === void 0 ? void 0 : onChange(null);
22
+ onChange?.(null);
20
23
  }
21
24
  } }));
22
25
  }
@@ -1,27 +1,30 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Avatar, Body1, Combobox, Divider, Link, makeStyles, mergeClasses, Option, Spinner, Tag, TagGroup, tokens, ToolbarButton, } from '@fluentui/react-components';
3
- import { useAppContext } from '@headless-adminapp/app/app';
4
- import { useDebouncedValue } from '@headless-adminapp/app/hooks';
5
- import { useRouter, useRouteResolver, } from '@headless-adminapp/app/route/hooks';
6
- import { PageType } from '@headless-adminapp/core/experience/app';
7
- import { IconPlaceholder, Icons } from '@headless-adminapp/icons';
8
- import { useCallback, useEffect, useMemo, useState } from 'react';
9
- import { useAppStrings } from '../../App/AppStringContext';
10
- import { RecordCard } from '../../PageEntityForm/RecordCard';
11
- import { getAvatarColor } from '../../utils/avatar';
12
- import { useGetLookupView, useLookupData } from './useLookupData';
13
- export function LookupControl(props) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LookupControl = LookupControl;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const app_1 = require("@headless-adminapp/app/app");
7
+ const hooks_1 = require("@headless-adminapp/app/hooks");
8
+ const hooks_2 = require("@headless-adminapp/app/route/hooks");
9
+ const app_2 = require("@headless-adminapp/core/experience/app");
10
+ const icons_1 = require("@headless-adminapp/icons");
11
+ const react_1 = require("react");
12
+ const AppStringContext_1 = require("../../App/AppStringContext");
13
+ const RecordCard_1 = require("../../PageEntityForm/RecordCard");
14
+ const avatar_1 = require("../../utils/avatar");
15
+ const useLookupData_1 = require("./useLookupData");
16
+ function LookupControl(props) {
14
17
  const Control = LookupControlMd;
15
- return _jsx(Control, Object.assign({}, props));
18
+ return (0, jsx_runtime_1.jsx)(Control, { ...props });
16
19
  }
17
- const useStyles = makeStyles({
20
+ const useStyles = (0, react_components_1.makeStyles)({
18
21
  option: {
19
22
  padding: 0,
20
23
  '& .fui-Option__checkIcon': {
21
24
  display: 'none',
22
25
  },
23
26
  '&[data-activedescendant-focusvisible]': {
24
- background: tokens.colorNeutralBackground1Hover,
27
+ background: react_components_1.tokens.colorNeutralBackground1Hover,
25
28
  '&:after': {
26
29
  border: 'none !important',
27
30
  // background: tokens.colorNeutralBackground1Hover,
@@ -30,13 +33,13 @@ const useStyles = makeStyles({
30
33
  },
31
34
  });
32
35
  const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placeholder, disabled, autoFocus, readOnly, dataService, schema, viewId, allowNavigation, allowNewRecord, }) => {
33
- const [lookupEnabled, setLookupEnabled] = useState(false);
34
- const [open, setOpen] = useState(false);
35
- const [searchText, setSearchText] = useState('');
36
- const { loockupStrings } = useAppStrings();
37
- const routeResolver = useRouteResolver();
38
- const router = useRouter();
39
- const path = useMemo(() => {
36
+ const [lookupEnabled, setLookupEnabled] = (0, react_1.useState)(false);
37
+ const [open, setOpen] = (0, react_1.useState)(false);
38
+ const [searchText, setSearchText] = (0, react_1.useState)('');
39
+ const { loockupStrings } = (0, AppStringContext_1.useAppStrings)();
40
+ const routeResolver = (0, hooks_2.useRouteResolver)();
41
+ const router = (0, hooks_2.useRouter)();
42
+ const path = (0, react_1.useMemo)(() => {
40
43
  if (!value) {
41
44
  return '';
42
45
  }
@@ -45,11 +48,11 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
45
48
  }
46
49
  return routeResolver({
47
50
  logicalName: schema.logicalName,
48
- type: PageType.EntityForm,
51
+ type: app_2.PageType.EntityForm,
49
52
  id: value.id,
50
53
  });
51
54
  }, [allowNavigation, routeResolver, schema.logicalName, value]);
52
- const handleOpenRecord = useCallback((event) => {
55
+ const handleOpenRecord = (0, react_1.useCallback)((event) => {
53
56
  event.preventDefault();
54
57
  event.stopPropagation();
55
58
  if (!path) {
@@ -57,11 +60,11 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
57
60
  }
58
61
  router.push(path);
59
62
  }, [path, router]);
60
- useEffect(() => {
63
+ (0, react_1.useEffect)(() => {
61
64
  if (open)
62
65
  setLookupEnabled(true);
63
66
  }, [open]);
64
- const [debouncedSearchText] = useDebouncedValue(searchText, 500);
67
+ const [debouncedSearchText] = (0, hooks_1.useDebouncedValue)(searchText, 500);
65
68
  const styles = useStyles();
66
69
  // const useLookupData = useMemo(
67
70
  // () =>
@@ -81,15 +84,15 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
81
84
  // search: async ? debouncedSearchText : '',
82
85
  // enabled: lookupEnabled,
83
86
  // });
84
- const { isLoading: isViewLoading, view } = useGetLookupView(schema.logicalName, viewId);
85
- const { data, isLoading } = useLookupData({
87
+ const { isLoading: isViewLoading, view } = (0, useLookupData_1.useGetLookupView)(schema.logicalName, viewId);
88
+ const { data, isLoading } = (0, useLookupData_1.useLookupData)({
86
89
  schema,
87
- view: view === null || view === void 0 ? void 0 : view.experience,
90
+ view: view?.experience,
88
91
  searchText: debouncedSearchText,
89
92
  dataService,
90
93
  enabled: lookupEnabled && !isViewLoading && !value && !readOnly && !disabled,
91
94
  });
92
- useEffect(() => {
95
+ (0, react_1.useEffect)(() => {
93
96
  if (value) {
94
97
  setSearchText(value.name);
95
98
  }
@@ -100,55 +103,54 @@ const LookupControlMd = ({ value, onChange, id, name, onBlur, onFocus, placehold
100
103
  const handleChange = (value) => {
101
104
  setSearchText('');
102
105
  if (!value) {
103
- return onChange === null || onChange === void 0 ? void 0 : onChange(null);
106
+ return onChange?.(null);
104
107
  }
105
108
  else {
106
- return onChange === null || onChange === void 0 ? void 0 : onChange({
109
+ return onChange?.({
107
110
  id: value[schema.idAttribute],
108
111
  name: value[schema.primaryAttribute],
109
112
  logicalName: schema.logicalName,
110
113
  });
111
114
  }
112
115
  };
113
- return (_jsxs("div", { style: { position: 'relative', width: '100%' }, children: [_jsxs(Combobox, { name: name, appearance: "filled-darker", expandIcon: readOnly || disabled ? null : isLoading ? (_jsx(Spinner, { size: "extra-tiny" })) : (_jsx(Icons.Search, { size: 18 })), placeholder: !value ? placeholder : '', inputMode: "search", style: { width: '100%', minWidth: 'unset' }, autoComplete: "off", readOnly: readOnly || disabled,
116
+ return ((0, jsx_runtime_1.jsxs)("div", { style: { position: 'relative', width: '100%' }, children: [(0, jsx_runtime_1.jsxs)(react_components_1.Combobox, { name: name, appearance: "filled-darker", expandIcon: readOnly || disabled ? null : isLoading ? ((0, jsx_runtime_1.jsx)(react_components_1.Spinner, { size: "extra-tiny" })) : ((0, jsx_runtime_1.jsx)(icons_1.Icons.Search, { size: 18 })), placeholder: !value ? placeholder : '', inputMode: "search", style: { width: '100%', minWidth: 'unset' }, autoComplete: "off", readOnly: readOnly || disabled,
114
117
  // disabled={disabled}
115
118
  open: open && !value && !readOnly && !disabled, value: !value ? searchText : '', onOpenChange: (e, data) => setOpen(data.open), onChange: (e) => {
116
119
  setSearchText(e.target.value);
117
120
  }, onOptionSelect: (e, item) => {
118
- const _item = data === null || data === void 0 ? void 0 : data.records.find((x) => String(x[schema.idAttribute]) === String(item.optionValue));
119
- handleChange(_item !== null && _item !== void 0 ? _item : null);
120
- }, disableAutoFocus: true, onBlur: onBlur, onFocus: onFocus, id: id, autoFocus: autoFocus, children: [data === null || data === void 0 ? void 0 : data.records.map((item) => (_jsx(Option, { value: item[schema.idAttribute], className: mergeClasses(styles.option), text: item[schema.primaryAttribute], children: _jsx(RecordCard, { cardView: view === null || view === void 0 ? void 0 : view.experience.card, record: item, schema: schema }) }, item[schema.idAttribute]))), !isLoading && !(data === null || data === void 0 ? void 0 : data.records.length) && (_jsx("div", { style: {
121
- paddingInline: tokens.spacingHorizontalL,
122
- paddingBlock: tokens.spacingVerticalS,
123
- }, children: _jsx(Body1, { children: loockupStrings.noRecordsFound }) })), allowNewRecord && (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsx("div", { style: { marginTop: tokens.spacingVerticalXXS }, children: _jsx(ToolbarButton, { style: { fontWeight: 'normal' }, icon: _jsx(Icons.Add, {}), children: loockupStrings.newRecord }) })] }))] }), !!value && (_jsx("div", { style: {
121
+ const _item = data?.records.find((x) => String(x[schema.idAttribute]) === String(item.optionValue));
122
+ handleChange(_item ?? null);
123
+ }, disableAutoFocus: true, onBlur: onBlur, onFocus: onFocus, id: id, autoFocus: autoFocus, children: [data?.records.map((item) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: item[schema.idAttribute], className: (0, react_components_1.mergeClasses)(styles.option), text: item[schema.primaryAttribute], children: (0, jsx_runtime_1.jsx)(RecordCard_1.RecordCard, { cardView: view?.experience.card, record: item, schema: schema }) }, item[schema.idAttribute]))), !isLoading && !data?.records.length && ((0, jsx_runtime_1.jsx)("div", { style: {
124
+ paddingInline: react_components_1.tokens.spacingHorizontalL,
125
+ paddingBlock: react_components_1.tokens.spacingVerticalS,
126
+ }, children: (0, jsx_runtime_1.jsx)(react_components_1.Body1, { children: loockupStrings.noRecordsFound }) })), allowNewRecord && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_components_1.Divider, {}), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: react_components_1.tokens.spacingVerticalXXS }, children: (0, jsx_runtime_1.jsx)(react_components_1.ToolbarButton, { style: { fontWeight: 'normal' }, icon: (0, jsx_runtime_1.jsx)(icons_1.Icons.Add, {}), children: loockupStrings.newRecord }) })] }))] }), !!value && ((0, jsx_runtime_1.jsx)("div", { style: {
124
127
  position: 'absolute',
125
128
  inset: 0,
126
129
  alignItems: 'center',
127
130
  paddingInline: 4,
128
131
  display: 'flex',
129
- }, children: _jsx(TagGroup, { as: "div", children: _jsx(Tag, { as: "span", appearance: "brand", size: "small", dismissible: !disabled && !readOnly, value: value.id, style: { paddingRight: !disabled && !readOnly ? 0 : 5 }, dismissIcon: _jsx("div", { style: { display: 'flex', cursor: 'pointer' }, onClick: () => {
130
- onChange === null || onChange === void 0 ? void 0 : onChange(null);
131
- }, children: _jsx(Icons.Close, { size: 16 }) }), primaryText: {
132
+ }, children: (0, jsx_runtime_1.jsx)(react_components_1.TagGroup, { as: "div", children: (0, jsx_runtime_1.jsx)(react_components_1.Tag, { as: "span", appearance: "brand", size: "small", dismissible: !disabled && !readOnly, value: value.id, style: { paddingRight: !disabled && !readOnly ? 0 : 5 }, dismissIcon: (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', cursor: 'pointer' }, onClick: () => {
133
+ onChange?.(null);
134
+ }, children: (0, jsx_runtime_1.jsx)(icons_1.Icons.Close, { size: 16 }) }), primaryText: {
132
135
  style: {
133
136
  paddingBottom: 0,
134
137
  },
135
- }, children: allowNavigation && path ? (_jsxs(Link, { href: path, onClick: handleOpenRecord, style: {
138
+ }, children: allowNavigation && path ? ((0, jsx_runtime_1.jsxs)(react_components_1.Link, { href: path, onClick: handleOpenRecord, style: {
136
139
  display: 'flex',
137
140
  alignItems: 'center',
138
- gap: tokens.spacingHorizontalXS,
139
- }, children: [_jsx(LookupAvatar, { schema: schema, logicalName: schema.logicalName, value: value }), _jsx(Body1, { style: {
141
+ gap: react_components_1.tokens.spacingHorizontalXS,
142
+ }, children: [(0, jsx_runtime_1.jsx)(LookupAvatar, { schema: schema, logicalName: schema.logicalName, value: value }), (0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: {
140
143
  overflow: 'hidden',
141
144
  textOverflow: 'ellipsis',
142
145
  whiteSpace: 'nowrap',
143
- }, children: value === null || value === void 0 ? void 0 : value.name })] })) : (_jsx(Body1, { style: { overflow: 'hidden', textOverflow: 'ellipsis' }, children: value === null || value === void 0 ? void 0 : value.name })) }) }) }))] }));
146
+ }, children: value?.name })] })) : ((0, jsx_runtime_1.jsx)(react_components_1.Body1, { style: { overflow: 'hidden', textOverflow: 'ellipsis' }, children: value?.name })) }) }) }))] }));
144
147
  };
145
148
  const LookupAvatar = ({ logicalName, schema, value, }) => {
146
- var _a, _b;
147
- const { schemaMetadataDic } = useAppContext();
149
+ const { schemaMetadataDic } = (0, app_1.useAppContext)();
148
150
  if (!schema.avatarAttribute) {
149
151
  const experienceSchema = schemaMetadataDic[logicalName];
150
- const Icon = (_b = (_a = experienceSchema.icon) !== null && _a !== void 0 ? _a : Icons.Entity) !== null && _b !== void 0 ? _b : IconPlaceholder;
151
- return (_jsx(Avatar, { style: {
152
+ const Icon = experienceSchema.icon ?? icons_1.Icons.Entity ?? icons_1.IconPlaceholder;
153
+ return ((0, jsx_runtime_1.jsx)(react_components_1.Avatar, { style: {
152
154
  width: 20,
153
155
  height: 20,
154
156
  }, icon: {
@@ -156,15 +158,15 @@ const LookupAvatar = ({ logicalName, schema, value, }) => {
156
158
  background: 'transparent',
157
159
  color: 'inherit',
158
160
  },
159
- children: _jsx(Icon, { size: 20 }),
161
+ children: (0, jsx_runtime_1.jsx)(Icon, { size: 20 }),
160
162
  } }));
161
163
  }
162
- return (_jsx(Avatar, { style: {
164
+ return ((0, jsx_runtime_1.jsx)(react_components_1.Avatar, { style: {
163
165
  width: 20,
164
166
  height: 20,
165
- fontSize: tokens.fontSizeBase100,
167
+ fontSize: react_components_1.tokens.fontSizeBase100,
166
168
  backgroundColor: 'transparent',
167
- }, name: value === null || value === void 0 ? void 0 : value.name, color: getAvatarColor(value === null || value === void 0 ? void 0 : value.name), image: {
168
- src: value === null || value === void 0 ? void 0 : value.avatar,
169
+ }, name: value?.name, color: (0, avatar_1.getAvatarColor)(value?.name), image: {
170
+ src: value?.avatar,
169
171
  } }));
170
172
  };
@@ -1,14 +1,17 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Dropdown, Option } from '@fluentui/react-components';
3
- import { useMemo } from 'react';
4
- export default function MultiSelectControl({ value, onChange, options, id, name, disabled, onBlur, onFocus, placeholder, }) {
5
- const transformedOptions = useMemo(() => options.map((x) => ({ label: x.label, value: String(x.value) })), [options]);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = MultiSelectControl;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_components_1 = require("@fluentui/react-components");
6
+ const react_1 = require("react");
7
+ function MultiSelectControl({ value, onChange, options, id, name, disabled, onBlur, onFocus, placeholder, }) {
8
+ const transformedOptions = (0, react_1.useMemo)(() => options.map((x) => ({ label: x.label, value: String(x.value) })), [options]);
6
9
  const handleChange = (value) => {
7
10
  const selectedOptions = options.filter((x) => value.includes(String(x.value)));
8
- onChange === null || onChange === void 0 ? void 0 : onChange(selectedOptions.map((x) => x.value));
11
+ onChange?.(selectedOptions.map((x) => x.value));
9
12
  };
10
- const selectedOptions = useMemo(() => options.filter((x) => value === null || value === void 0 ? void 0 : value.includes(x.value)), [options, value]);
11
- return (_jsx(Dropdown, { placeholder: placeholder, id: id, name: name, appearance: "filled-darker", multiselect: true, value: selectedOptions.map((x) => x.label).join(', '), selectedOptions: value ? value.map(String) : [], onOptionSelect: (event, data) => {
13
+ const selectedOptions = (0, react_1.useMemo)(() => options.filter((x) => value?.includes(x.value)), [options, value]);
14
+ return ((0, jsx_runtime_1.jsx)(react_components_1.Dropdown, { placeholder: placeholder, id: id, name: name, appearance: "filled-darker", multiselect: true, value: selectedOptions.map((x) => x.label).join(', '), selectedOptions: value ? value.map(String) : [], onOptionSelect: (event, data) => {
12
15
  handleChange(data.selectedOptions);
13
- }, onBlur: () => onBlur === null || onBlur === void 0 ? void 0 : onBlur(), onFocus: () => onFocus === null || onFocus === void 0 ? void 0 : onFocus(), disabled: disabled, children: transformedOptions.map((x) => (_jsx(Option, { value: x.value, children: x.label }, x.value))) }));
16
+ }, onBlur: () => onBlur?.(), onFocus: () => onFocus?.(), disabled: disabled, children: transformedOptions.map((x) => ((0, jsx_runtime_1.jsx)(react_components_1.Option, { value: x.value, children: x.label }, x.value))) }));
14
17
  }