@m4l/components 9.19.0 → 9.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/CheckableList/slots/styled.d.ts +3 -3
- package/components/DynamicForm/DynamicForm.d.ts.map +1 -1
- package/components/DynamicForm/DynamicForm.js +121 -81
- package/components/DynamicForm/DynamicForm.styles.d.ts.map +1 -1
- package/components/DynamicForm/DynamicForm.styles.js +104 -20
- package/components/DynamicForm/constants.d.ts +1 -1
- package/components/DynamicForm/constants.d.ts.map +1 -1
- package/components/DynamicForm/constants.js +10 -10
- package/components/DynamicForm/dictionary.d.ts +9 -1
- package/components/DynamicForm/dictionary.d.ts.map +1 -1
- package/components/DynamicForm/dictionary.js +14 -5
- package/components/DynamicForm/helpers/applyRequiredValidation/applyRequiredValidation.d.ts.map +1 -1
- package/components/DynamicForm/helpers/createFieldValidationSchema/createFieldValidationSchema.d.ts.map +1 -1
- package/components/DynamicForm/helpers/createFieldValidationSchema/createFieldValidationSchema.js +24 -22
- package/components/DynamicForm/helpers/createFieldValidationSchema/strategies/baseSchema/baseSchemaStrategies.d.ts +7 -0
- package/components/DynamicForm/helpers/createFieldValidationSchema/strategies/baseSchema/baseSchemaStrategies.d.ts.map +1 -1
- package/components/DynamicForm/helpers/createFieldValidationSchema/strategies/baseSchema/baseSchemaStrategies.js +46 -30
- package/components/DynamicForm/helpers/createFieldValidationSchema/strategies/baseSchema/createBaseSchema.d.ts +1 -0
- package/components/DynamicForm/helpers/createFieldValidationSchema/strategies/baseSchema/createBaseSchema.d.ts.map +1 -1
- package/components/DynamicForm/helpers/createFieldValidationSchema/strategies/baseSchema/createBaseSchema.js +8 -6
- package/components/DynamicForm/helpers/createFieldValidationSchema/strategies/validation/validationStrategies.d.ts.map +1 -1
- package/components/DynamicForm/helpers/createFieldValidationSchema/strategies/validation/validationStrategies.js +37 -37
- package/components/DynamicForm/helpers/filterUnknownFieldsFromSubmit/filterUnknownFieldsFromSubmit.d.ts +14 -0
- package/components/DynamicForm/helpers/filterUnknownFieldsFromSubmit/filterUnknownFieldsFromSubmit.d.ts.map +1 -0
- package/components/DynamicForm/helpers/filterUnknownFieldsFromSubmit/index.d.ts +2 -0
- package/components/DynamicForm/helpers/filterUnknownFieldsFromSubmit/index.d.ts.map +1 -0
- package/components/DynamicForm/helpers/getFieldTypeApiKey/getFieldTypeApiKey.d.ts +8 -0
- package/components/DynamicForm/helpers/getFieldTypeApiKey/getFieldTypeApiKey.d.ts.map +1 -0
- package/components/DynamicForm/helpers/getFieldTypeApiKey/getFieldTypeApiKey.js +24 -0
- package/components/DynamicForm/helpers/getFieldTypeApiKey/index.d.ts +2 -0
- package/components/DynamicForm/helpers/getFieldTypeApiKey/index.d.ts.map +1 -0
- package/components/DynamicForm/helpers/index.d.ts +3 -0
- package/components/DynamicForm/helpers/index.d.ts.map +1 -1
- package/components/DynamicForm/helpers/isPositiveInteger.d.ts +1 -1
- package/components/DynamicForm/helpers/mapImageSelectorValuesForSubmit/index.d.ts +2 -0
- package/components/DynamicForm/helpers/mapImageSelectorValuesForSubmit/index.d.ts.map +1 -0
- package/components/DynamicForm/helpers/mapImageSelectorValuesForSubmit/mapImageSelectorValuesForSubmit.d.ts +9 -0
- package/components/DynamicForm/helpers/mapImageSelectorValuesForSubmit/mapImageSelectorValuesForSubmit.d.ts.map +1 -0
- package/components/DynamicForm/helpers/mapImageSelectorValuesForSubmit/mapImageSelectorValuesForSubmit.js +26 -0
- package/components/DynamicForm/helpers/resolveFieldComponent/resolveFieldComponent.d.ts +4 -2
- package/components/DynamicForm/helpers/resolveFieldComponent/resolveFieldComponent.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/resolveFieldComponent.js +10 -9
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/autocompleteStrategy/autocompleteStrategy.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/autocompleteStrategy/autocompleteStrategy.js +36 -37
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/autocompleteStrategy/normalizeAutocompletePropsFromBackend.d.ts +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/autocompleteStrategy/normalizeAutocompletePropsFromBackend.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/autocompleteStrategy/normalizeAutocompletePropsFromBackend.js +25 -24
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkableListStrategy/checkableListStrategy.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkableListStrategy/checkableListStrategy.js +26 -26
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkableListStrategy/helpers/whitelist/propertyNormalizers.d.ts +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkableListStrategy/normalizeCheckableListPropsFromBackend.d.ts +3 -3
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkableListStrategy/normalizeCheckableListPropsFromBackend.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkableListStrategy/normalizeCheckableListPropsFromBackend.js +10 -9
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkableListStrategy/types.d.ts +2 -2
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkboxStrategy/checkboxStrategy.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkboxStrategy/checkboxStrategy.js +13 -13
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkboxStrategy/normalizeCheckboxPropsFromBackend.d.ts +2 -2
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkboxStrategy/normalizeCheckboxPropsFromBackend.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/checkboxStrategy/normalizeCheckboxPropsFromBackend.js +9 -8
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/dateRangePickerStrategy/dateRangePickerStrategy.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/dateRangePickerStrategy/dateRangePickerStrategy.js +12 -12
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/dateRangePickerStrategy/normalizeDateRangePickerPropsFromBackend.d.ts +4 -4
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/dateRangePickerStrategy/normalizeDateRangePickerPropsFromBackend.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/dateRangePickerStrategy/normalizeDateRangePickerPropsFromBackend.js +7 -6
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/daysOfWeekPickerStrategy/daysOfWeekPickerStrategy.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/daysOfWeekPickerStrategy/daysOfWeekPickerStrategy.js +15 -15
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/daysOfWeekPickerStrategy/normalizeDaysOfWeekPickerPropsFromBackend.d.ts +2 -2
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/daysOfWeekPickerStrategy/normalizeDaysOfWeekPickerPropsFromBackend.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/daysOfWeekPickerStrategy/normalizeDaysOfWeekPickerPropsFromBackend.js +9 -8
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/imageSelectorStrategy/imageSelectorStrategy.d.ts +7 -0
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/imageSelectorStrategy/imageSelectorStrategy.d.ts.map +1 -0
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/imageSelectorStrategy/imageSelectorStrategy.js +41 -0
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/imageSelectorStrategy/normalizeImageSelectorPropsFromBackend.d.ts +10 -0
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/imageSelectorStrategy/normalizeImageSelectorPropsFromBackend.d.ts.map +1 -0
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/imageSelectorStrategy/normalizeImageSelectorPropsFromBackend.js +70 -0
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/imageSelectorStrategy/types.d.ts +9 -0
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/imageSelectorStrategy/types.d.ts.map +1 -0
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/index.d.ts +1 -0
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/index.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/normalizeRhfLabelRelatedPropsFromBackend.d.ts +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/numberInputStrategy/normalizeNumberInputPropsFromBackend.d.ts +2 -2
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/numberInputStrategy/normalizeNumberInputPropsFromBackend.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/numberInputStrategy/normalizeNumberInputPropsFromBackend.js +6 -5
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/numberInputStrategy/numberInputStrategy.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/numberInputStrategy/numberInputStrategy.js +15 -15
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/radioGroupStrategy/normalizeRadioGroupPropsFromBackend.d.ts +4 -4
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/radioGroupStrategy/normalizeRadioGroupPropsFromBackend.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/radioGroupStrategy/normalizeRadioGroupPropsFromBackend.js +16 -15
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/radioGroupStrategy/radioGroupStrategy.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/radioGroupStrategy/radioGroupStrategy.js +16 -16
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/registry.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/registry.js +8 -6
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/selectStrategy/normalizeSelectPropsFromBackend.d.ts +3 -3
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/selectStrategy/normalizeSelectPropsFromBackend.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/selectStrategy/normalizeSelectPropsFromBackend.js +6 -5
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/selectStrategy/selectStrategy.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/selectStrategy/selectStrategy.js +16 -16
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/textFieldStrategy/normalizeTextFieldPropsFromBackend.d.ts +2 -2
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/textFieldStrategy/normalizeTextFieldPropsFromBackend.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/textFieldStrategy/normalizeTextFieldPropsFromBackend.js +13 -12
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/textFieldStrategy/textFieldStrategy.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/textFieldStrategy/textFieldStrategy.js +35 -18
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/types.d.ts +2 -0
- package/components/DynamicForm/helpers/resolveFieldComponent/strategies/types.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/types.d.ts +16 -1
- package/components/DynamicForm/helpers/resolveFieldComponent/types.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldContractAliases.d.ts +19 -0
- package/components/DynamicForm/helpers/resolveFieldContractAliases.d.ts.map +1 -0
- package/components/DynamicForm/helpers/resolveFieldContractAliases.js +23 -0
- package/components/DynamicForm/helpers/resolveFieldInputLabel/resolveFieldInputLabel.d.ts +1 -1
- package/components/DynamicForm/helpers/resolveFieldInputLabel/resolveFieldInputLabel.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveFieldInputLabel/resolveFieldInputLabel.js +6 -5
- package/components/DynamicForm/helpers/resolveInitialValue/resolveInitialValue.d.ts.map +1 -1
- package/components/DynamicForm/helpers/resolveInitialValue/resolveInitialValue.js +83 -66
- package/components/DynamicForm/helpers/resolveInitialValue/types.d.ts +9 -2
- package/components/DynamicForm/helpers/resolveInitialValue/types.d.ts.map +1 -1
- package/components/DynamicForm/hooks/useDynamicForm/useDynamicForm.d.ts.map +1 -1
- package/components/DynamicForm/hooks/useDynamicForm/useDynamicForm.js +26 -24
- package/components/DynamicForm/hooks/useDynamicFormConditionals/useDynamicFormConditionals.js +22 -22
- package/components/DynamicForm/hooks/useDynamicFormCoupled/types.d.ts +1 -1
- package/components/DynamicForm/hooks/useDynamicFormCoupled/types.d.ts.map +1 -1
- package/components/DynamicForm/hooks/useDynamicFormCoupled/useDynamicFormCoupled.d.ts.map +1 -1
- package/components/DynamicForm/hooks/useDynamicFormCoupled/useDynamicFormCoupled.js +26 -24
- package/components/DynamicForm/hooks/useDynamicFormData/types.d.ts +11 -2
- package/components/DynamicForm/hooks/useDynamicFormData/types.d.ts.map +1 -1
- package/components/DynamicForm/hooks/useDynamicFormData/useDynamicFormData.d.ts +2 -1
- package/components/DynamicForm/hooks/useDynamicFormData/useDynamicFormData.d.ts.map +1 -1
- package/components/DynamicForm/hooks/useDynamicFormData/useDynamicFormData.js +72 -50
- package/components/DynamicForm/hooks/useFieldsWithFetchedOptions/useFieldsWithFetchedOptions.d.ts.map +1 -1
- package/components/DynamicForm/hooks/useFieldsWithFetchedOptions/useFieldsWithFetchedOptions.js +3 -3
- package/components/DynamicForm/index.d.ts +1 -0
- package/components/DynamicForm/index.d.ts.map +1 -1
- package/components/DynamicForm/slots/DynamicFormEnum.d.ts +4 -1
- package/components/DynamicForm/slots/DynamicFormEnum.d.ts.map +1 -1
- package/components/DynamicForm/slots/DynamicFormEnum.js +2 -2
- package/components/DynamicForm/slots/DynamicFormSlots.d.ts +9 -0
- package/components/DynamicForm/slots/DynamicFormSlots.d.ts.map +1 -1
- package/components/DynamicForm/slots/DynamicFormSlots.js +36 -23
- package/components/DynamicForm/subcomponents/DynamicFormContent/DynamicFormContent.d.ts.map +1 -1
- package/components/DynamicForm/subcomponents/DynamicFormContent/DynamicFormContent.js +85 -46
- package/components/DynamicForm/types.d.ts +127 -34
- package/components/DynamicForm/types.d.ts.map +1 -1
- package/components/ImageSelector/ImageSelector.d.ts.map +1 -1
- package/components/ImageSelector/ImageSelector.js +103 -101
- package/components/ImageSelector/hooks/useImageSelector.d.ts +1 -1
- package/components/ImageSelector/hooks/useImageSelector.d.ts.map +1 -1
- package/components/ImageSelector/hooks/useImageSelector.js +172 -168
- package/components/ImageSelector/types.d.ts +12 -4
- package/components/ImageSelector/types.d.ts.map +1 -1
- package/components/Label/Label.d.ts.map +1 -1
- package/components/Label/Label.js +31 -28
- package/components/Label/types.d.ts +6 -0
- package/components/Label/types.d.ts.map +1 -1
- package/components/PropertyValue/PropertyValue.d.ts.map +1 -1
- package/components/PropertyValue/PropertyValue.js +39 -37
- package/components/extended/mui/Accordion/Accordion.d.ts.map +1 -1
- package/components/extended/mui/Accordion/Accordion.js +67 -53
- package/components/extended/mui/Accordion/slots/AccordionEnum.d.ts +2 -0
- package/components/extended/mui/Accordion/slots/AccordionEnum.d.ts.map +1 -1
- package/components/extended/mui/Accordion/slots/AccordionEnum.js +1 -1
- package/components/extended/mui/Accordion/slots/AccordionSlots.d.ts +6 -0
- package/components/extended/mui/Accordion/slots/AccordionSlots.d.ts.map +1 -1
- package/components/extended/mui/Accordion/slots/AccordionSlots.js +22 -14
- package/components/extended/mui/Accordion/styles.d.ts.map +1 -1
- package/components/extended/mui/Accordion/styles.js +35 -8
- package/components/extended/mui/Accordion/types.d.ts +5 -0
- package/components/extended/mui/Accordion/types.d.ts.map +1 -1
- package/components/extended/mui/Tab/constants.d.ts +1 -1
- package/components/hook-form/RHFCheckbox/slots/RHFCheckBoxSlots.d.ts +1 -1
- package/components/hook-form/RHFNumberInput/RHFNumberInput.d.ts.map +1 -1
- package/components/hook-form/RHFNumberInput/RHFNumberInput.js +38 -36
- package/components/hook-form/RHFTextField/RHFTextField.d.ts.map +1 -1
- package/components/hook-form/RHFTextField/RHFTextField.js +48 -46
- package/index.js +519 -517
- package/package.json +6 -6
|
@@ -1,179 +1,183 @@
|
|
|
1
|
-
import { useEnvironment as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { DEFAULT_TIMEOUT as
|
|
4
|
-
function $
|
|
1
|
+
import { useEnvironment as Re, useNetwork as be, getPropertyByString as _e } from "@m4l/core";
|
|
2
|
+
import { useRef as A, useState as y, useId as Fe, useMemo as M, useEffect as X, useCallback as r } from "react";
|
|
3
|
+
import { DEFAULT_TIMEOUT as ve, DEFAULT_RESULT_FIELD as xe, DEFAULT_PLACEHOLDER_IMAGE_SRC as Ue, DEFAULT_PLACEHOLDER_ALT as ke, DEFAULT_MAX_COLUMNS as Pe, DEFAULT_MAX_ROWS as Me, DEFAULT_PRESENTATION_TYPE as $e, OVERLAY_ICON as Ne } from "../constants.js";
|
|
4
|
+
function qe($) {
|
|
5
5
|
return {
|
|
6
6
|
target: {
|
|
7
|
-
value:
|
|
7
|
+
value: $
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function Be($) {
|
|
12
12
|
const {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
13
|
+
options: N,
|
|
14
|
+
value: p,
|
|
15
|
+
onChange: Y,
|
|
16
|
+
endpoint: d,
|
|
17
|
+
refetchOnOpen: J = !1,
|
|
18
|
+
getOptionLabel: le,
|
|
19
|
+
getOptionImage: ce,
|
|
20
|
+
isOptionEqualToValue: I,
|
|
21
|
+
presentationType: u = $e,
|
|
22
|
+
imageSize: g,
|
|
23
|
+
maxColumns: i = Pe,
|
|
24
|
+
maxRows: O = Me,
|
|
25
|
+
size: m = "medium",
|
|
26
|
+
disabled: o = !1,
|
|
27
|
+
error: L = !1,
|
|
28
|
+
timeout: D = ve,
|
|
29
|
+
parms: R,
|
|
30
|
+
resultField: b = xe,
|
|
31
|
+
isExternalUrl: _ = !1,
|
|
32
|
+
isRemote: F = !0,
|
|
33
|
+
responseToCamelCase: v,
|
|
34
|
+
forwardedRef: w,
|
|
35
|
+
blurHandler: W
|
|
36
|
+
} = $, { host_static_assets: j, environment_assets: Q } = Re(), { networkOperation: Z } = be(), q = A(null), H = A(null), x = A(null), K = A([]), h = A(null), U = A(!1), [ue, C] = y(!1), [n, ee] = y(!1), [s, S] = y([]), [te, re] = y(!1), [V, ae] = y(null), B = Fe(), T = Array.isArray(N), z = M(() => JSON.stringify({
|
|
37
|
+
endpoint: d,
|
|
38
|
+
isExternalUrl: _,
|
|
39
|
+
isRemote: F,
|
|
40
|
+
parms: R ?? null,
|
|
41
|
+
responseToCamelCase: v ?? null,
|
|
42
|
+
resultField: b,
|
|
43
|
+
timeout: D
|
|
43
44
|
}), [
|
|
44
|
-
|
|
45
|
-
R,
|
|
45
|
+
d,
|
|
46
46
|
_,
|
|
47
|
-
|
|
47
|
+
F,
|
|
48
|
+
R,
|
|
49
|
+
v,
|
|
48
50
|
b,
|
|
49
|
-
D
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
D
|
|
52
|
+
]), ne = u === "grid" || n;
|
|
53
|
+
if (!T && (!d || d.trim() === ""))
|
|
54
|
+
throw new Error("ImageSelector requires either the options prop or a non-empty endpoint prop.");
|
|
55
|
+
X(() => {
|
|
56
|
+
T && (q.current?.abort(), H.current = null, x.current = null, C(!1), S(N));
|
|
57
|
+
}, [T, N]), X(() => {
|
|
58
|
+
if (T || !ne || !d)
|
|
56
59
|
return;
|
|
57
|
-
if (!
|
|
58
|
-
|
|
60
|
+
if (!J && H.current === z && x.current !== null) {
|
|
61
|
+
C(!1), S(x.current);
|
|
59
62
|
return;
|
|
60
63
|
}
|
|
61
64
|
let e = !1;
|
|
62
|
-
|
|
65
|
+
q.current?.abort();
|
|
63
66
|
const t = new AbortController();
|
|
64
|
-
return
|
|
67
|
+
return q.current = t, C(!0), S([]), Z({
|
|
65
68
|
method: "GET",
|
|
66
|
-
endPoint:
|
|
67
|
-
timeout:
|
|
68
|
-
isExternalUrl:
|
|
69
|
-
parms:
|
|
70
|
-
responseToCamelCase:
|
|
71
|
-
isRemote:
|
|
69
|
+
endPoint: d,
|
|
70
|
+
timeout: D,
|
|
71
|
+
isExternalUrl: _,
|
|
72
|
+
parms: R,
|
|
73
|
+
responseToCamelCase: v,
|
|
74
|
+
isRemote: F,
|
|
72
75
|
signal: t.signal
|
|
73
76
|
}).then((l) => {
|
|
74
77
|
if (e)
|
|
75
78
|
return;
|
|
76
|
-
const c = _e(l,
|
|
77
|
-
|
|
79
|
+
const c = _e(l, b), se = Array.isArray(c) ? c : [];
|
|
80
|
+
H.current = z, x.current = se, S(se), C(!1);
|
|
78
81
|
}).catch(() => {
|
|
79
|
-
e || (
|
|
82
|
+
e || (S([]), C(!1));
|
|
80
83
|
}), () => {
|
|
81
84
|
e = !0, t.abort();
|
|
82
85
|
};
|
|
83
86
|
}, [
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
d,
|
|
88
|
+
T,
|
|
86
89
|
_,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
F,
|
|
91
|
+
Z,
|
|
92
|
+
R,
|
|
93
|
+
J,
|
|
94
|
+
z,
|
|
95
|
+
v,
|
|
91
96
|
b,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
L
|
|
97
|
+
ne,
|
|
98
|
+
D
|
|
95
99
|
]);
|
|
96
|
-
const f =
|
|
97
|
-
disabled:
|
|
98
|
-
error:
|
|
100
|
+
const f = p != null, ie = f ? ce(p) : `${j}/${Q}/${Ue}`, fe = f ? le(p) : ke, pe = `${j}/${Q}/${Ne}`, oe = i > 0 && O > 0 && s.length > i * O, de = M(() => ({
|
|
101
|
+
disabled: o,
|
|
102
|
+
error: L,
|
|
99
103
|
hasValue: f,
|
|
100
|
-
imageSize:
|
|
101
|
-
isFocused:
|
|
102
|
-
isOpen:
|
|
104
|
+
imageSize: g,
|
|
105
|
+
isFocused: te,
|
|
106
|
+
isOpen: n,
|
|
103
107
|
maxColumns: i,
|
|
104
|
-
maxRows:
|
|
108
|
+
maxRows: O,
|
|
105
109
|
presentationType: u,
|
|
106
|
-
size:
|
|
110
|
+
size: m
|
|
107
111
|
}), [
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
o,
|
|
113
|
+
L,
|
|
110
114
|
f,
|
|
111
|
-
h,
|
|
112
|
-
Q,
|
|
113
|
-
i,
|
|
114
115
|
g,
|
|
115
|
-
|
|
116
|
+
te,
|
|
117
|
+
i,
|
|
118
|
+
O,
|
|
119
|
+
n,
|
|
116
120
|
u,
|
|
117
|
-
|
|
118
|
-
]),
|
|
119
|
-
disabled:
|
|
120
|
-
error:
|
|
121
|
-
hasVerticalScroll:
|
|
122
|
-
imageSize:
|
|
121
|
+
m
|
|
122
|
+
]), he = M(() => ({
|
|
123
|
+
disabled: o,
|
|
124
|
+
error: L,
|
|
125
|
+
hasVerticalScroll: oe,
|
|
126
|
+
imageSize: g,
|
|
123
127
|
maxColumns: i,
|
|
124
|
-
maxRows:
|
|
128
|
+
maxRows: O,
|
|
125
129
|
presentationType: u,
|
|
126
|
-
size:
|
|
127
|
-
}), [
|
|
128
|
-
disabled:
|
|
129
|
-
imageSize:
|
|
130
|
-
isOpen:
|
|
130
|
+
size: m
|
|
131
|
+
}), [o, L, oe, g, i, O, u, m]), ge = M(() => ({
|
|
132
|
+
disabled: o,
|
|
133
|
+
imageSize: g,
|
|
134
|
+
isOpen: n,
|
|
131
135
|
isPlaceholder: !f,
|
|
132
136
|
presentationType: u,
|
|
133
|
-
size:
|
|
134
|
-
}), [
|
|
137
|
+
size: m
|
|
138
|
+
}), [o, f, g, n, u, m]), k = r((e = !1) => {
|
|
135
139
|
if (f) {
|
|
136
|
-
const t =
|
|
140
|
+
const t = s.findIndex((l) => I(l, p));
|
|
137
141
|
if (t >= 0)
|
|
138
142
|
return t;
|
|
139
143
|
}
|
|
140
|
-
return e &&
|
|
141
|
-
}, [f,
|
|
142
|
-
if (
|
|
144
|
+
return e && s.length > 0 ? s.length - 1 : 0;
|
|
145
|
+
}, [f, I, s, p]), P = r((e) => {
|
|
146
|
+
if (s.length === 0)
|
|
143
147
|
return;
|
|
144
|
-
const t = Math.max(0, Math.min(e,
|
|
145
|
-
|
|
146
|
-
}, [
|
|
147
|
-
if (
|
|
148
|
-
|
|
148
|
+
const t = Math.max(0, Math.min(e, s.length - 1));
|
|
149
|
+
K.current[t]?.focus();
|
|
150
|
+
}, [s.length]), Oe = r((e) => {
|
|
151
|
+
if (ae(e), typeof w == "function") {
|
|
152
|
+
w(e);
|
|
149
153
|
return;
|
|
150
154
|
}
|
|
151
|
-
|
|
152
|
-
}, [
|
|
153
|
-
|
|
154
|
-
}, [
|
|
155
|
+
w && (w.current = e);
|
|
156
|
+
}, [w]), E = r((e) => {
|
|
157
|
+
o || (typeof e < "u" && (h.current = e), ee(!0));
|
|
158
|
+
}, [o]), G = r((e = !1) => {
|
|
155
159
|
const t = e ? "selected-or-last" : "selected-or-first";
|
|
156
|
-
|
|
157
|
-
}, [
|
|
158
|
-
|
|
159
|
-
}, []),
|
|
160
|
-
if (
|
|
160
|
+
h.current = t, n && s.length > 0 && (P(k(e)), h.current = null);
|
|
161
|
+
}, [P, k, n, s.length]), a = r((e = !1) => {
|
|
162
|
+
h.current = null, U.current = e, ee(!1);
|
|
163
|
+
}, []), me = r(() => {
|
|
164
|
+
if (n) {
|
|
161
165
|
a();
|
|
162
166
|
return;
|
|
163
167
|
}
|
|
164
|
-
|
|
165
|
-
}, [a,
|
|
166
|
-
|
|
167
|
-
}, []),
|
|
168
|
-
|
|
169
|
-
}, [
|
|
170
|
-
|
|
171
|
-
const l =
|
|
172
|
-
t && c === e && (
|
|
173
|
-
}, [
|
|
174
|
-
|
|
175
|
-
}, []),
|
|
176
|
-
if (
|
|
168
|
+
E("selected-or-first");
|
|
169
|
+
}, [a, E, n]), Ee = r(() => {
|
|
170
|
+
re(!0);
|
|
171
|
+
}, []), Ae = r((e) => {
|
|
172
|
+
re(!1), W?.(e);
|
|
173
|
+
}, [W]), we = r((e, t) => {
|
|
174
|
+
K.current[e] = t;
|
|
175
|
+
const l = h.current, c = typeof l == "number" ? l : l === null ? null : k(l === "selected-or-last");
|
|
176
|
+
t && c === e && (h.current = null, t.focus());
|
|
177
|
+
}, [k]), Ce = r((e) => {
|
|
178
|
+
h.current = null;
|
|
179
|
+
}, []), Se = r((e) => `${B}-option-${e}`, [B]), Te = r((e, t) => {
|
|
180
|
+
if (o || s.length === 0)
|
|
177
181
|
return;
|
|
178
182
|
const l = typeof i == "number" && i > 0 ? i : null;
|
|
179
183
|
let c = null;
|
|
@@ -198,7 +202,7 @@ function Ke(P) {
|
|
|
198
202
|
c = 0;
|
|
199
203
|
break;
|
|
200
204
|
case "End":
|
|
201
|
-
c =
|
|
205
|
+
c = s.length - 1;
|
|
202
206
|
break;
|
|
203
207
|
case "Escape":
|
|
204
208
|
u === "standard" && (t.preventDefault(), a(!0));
|
|
@@ -206,32 +210,32 @@ function Ke(P) {
|
|
|
206
210
|
default:
|
|
207
211
|
return;
|
|
208
212
|
}
|
|
209
|
-
c !== null && (t.preventDefault(),
|
|
210
|
-
}, [
|
|
211
|
-
if (!
|
|
213
|
+
c !== null && (t.preventDefault(), P(c));
|
|
214
|
+
}, [o, P, a, i, s.length, u]), ye = r((e) => {
|
|
215
|
+
if (!o)
|
|
212
216
|
switch (e.key) {
|
|
213
217
|
case "Enter":
|
|
214
218
|
case " ": {
|
|
215
|
-
if (e.preventDefault(),
|
|
219
|
+
if (e.preventDefault(), n) {
|
|
216
220
|
a();
|
|
217
221
|
return;
|
|
218
222
|
}
|
|
219
|
-
|
|
223
|
+
E("selected-or-first");
|
|
220
224
|
return;
|
|
221
225
|
}
|
|
222
226
|
case "ArrowDown":
|
|
223
|
-
if (e.preventDefault(),
|
|
224
|
-
|
|
227
|
+
if (e.preventDefault(), n) {
|
|
228
|
+
G();
|
|
225
229
|
return;
|
|
226
230
|
}
|
|
227
|
-
|
|
231
|
+
E("selected-or-first");
|
|
228
232
|
return;
|
|
229
233
|
case "ArrowUp":
|
|
230
|
-
if (e.preventDefault(),
|
|
231
|
-
|
|
234
|
+
if (e.preventDefault(), n) {
|
|
235
|
+
G(!0);
|
|
232
236
|
return;
|
|
233
237
|
}
|
|
234
|
-
|
|
238
|
+
E("selected-or-last");
|
|
235
239
|
return;
|
|
236
240
|
case "Escape":
|
|
237
241
|
e.preventDefault(), a();
|
|
@@ -239,41 +243,41 @@ function Ke(P) {
|
|
|
239
243
|
default:
|
|
240
244
|
return;
|
|
241
245
|
}
|
|
242
|
-
}, [
|
|
243
|
-
|
|
244
|
-
}, [
|
|
246
|
+
}, [o, G, a, E, n]), Ie = r((e) => f ? I(e, p) : !1, [f, I, p]), Le = r((e) => {
|
|
247
|
+
o || (Y?.(qe(e), e), u === "standard" && a(!0));
|
|
248
|
+
}, [o, a, Y, u]), De = r(() => {
|
|
245
249
|
a();
|
|
246
250
|
}, [a]);
|
|
247
|
-
return
|
|
248
|
-
|
|
249
|
-
|
|
251
|
+
return X(() => {
|
|
252
|
+
n || (K.current = [], U.current && queueMicrotask(() => {
|
|
253
|
+
U.current && (U.current = !1, V?.focus());
|
|
250
254
|
}));
|
|
251
|
-
}, [
|
|
252
|
-
getOptionId:
|
|
253
|
-
handleBlur:
|
|
254
|
-
handleFocus:
|
|
255
|
-
handleKeyDown:
|
|
256
|
-
handleOptionFocus:
|
|
257
|
-
handleOptionKeyDown:
|
|
258
|
-
handleOptionRef:
|
|
259
|
-
handlePopoverClose:
|
|
255
|
+
}, [n, V]), {
|
|
256
|
+
getOptionId: Se,
|
|
257
|
+
handleBlur: Ae,
|
|
258
|
+
handleFocus: Ee,
|
|
259
|
+
handleKeyDown: ye,
|
|
260
|
+
handleOptionFocus: Ce,
|
|
261
|
+
handleOptionKeyDown: Te,
|
|
262
|
+
handleOptionRef: we,
|
|
263
|
+
handlePopoverClose: De,
|
|
260
264
|
handleSelect: Le,
|
|
261
|
-
handleToggle:
|
|
262
|
-
handleTriggerRef:
|
|
263
|
-
gridOwnerState:
|
|
265
|
+
handleToggle: me,
|
|
266
|
+
handleTriggerRef: Oe,
|
|
267
|
+
gridOwnerState: he,
|
|
264
268
|
isOptionSelected: Ie,
|
|
265
|
-
loading:
|
|
266
|
-
open:
|
|
267
|
-
options:
|
|
268
|
-
optionsListId:
|
|
269
|
-
overlayIconSrc:
|
|
270
|
-
previewLabel:
|
|
271
|
-
previewOwnerState:
|
|
272
|
-
previewSource:
|
|
273
|
-
rootOwnerState:
|
|
274
|
-
triggerElement:
|
|
269
|
+
loading: ue,
|
|
270
|
+
open: n,
|
|
271
|
+
options: s,
|
|
272
|
+
optionsListId: B,
|
|
273
|
+
overlayIconSrc: pe,
|
|
274
|
+
previewLabel: fe,
|
|
275
|
+
previewOwnerState: ge,
|
|
276
|
+
previewSource: ie,
|
|
277
|
+
rootOwnerState: de,
|
|
278
|
+
triggerElement: V
|
|
275
279
|
};
|
|
276
280
|
}
|
|
277
281
|
export {
|
|
278
|
-
|
|
282
|
+
Be as useImageSelector
|
|
279
283
|
};
|
|
@@ -5,6 +5,10 @@ import { ImageSelectorSlots } from './slots/ImageSelectorEnum';
|
|
|
5
5
|
export type ImageSelectorChangeHandler<T = unknown> = (event: ChangeEvent<unknown>, value: T | null) => void;
|
|
6
6
|
export type ImageSelectorPresentationType = 'standard' | 'grid';
|
|
7
7
|
export interface ImageSelectorProps<T = unknown> {
|
|
8
|
+
/**
|
|
9
|
+
* Static options rendered without a network request when provided.
|
|
10
|
+
*/
|
|
11
|
+
options?: T[];
|
|
8
12
|
/**
|
|
9
13
|
* Controlled selected option.
|
|
10
14
|
*/
|
|
@@ -14,9 +18,9 @@ export interface ImageSelectorProps<T = unknown> {
|
|
|
14
18
|
*/
|
|
15
19
|
onChange?: ImageSelectorChangeHandler<T>;
|
|
16
20
|
/**
|
|
17
|
-
* Endpoint used to fetch options for the popover grid.
|
|
21
|
+
* Endpoint used to fetch options for the popover grid when `options` are not provided.
|
|
18
22
|
*/
|
|
19
|
-
endpoint
|
|
23
|
+
endpoint?: string;
|
|
20
24
|
/**
|
|
21
25
|
* Whether the selector should refetch options every time the popover opens.
|
|
22
26
|
*/
|
|
@@ -117,6 +121,10 @@ export interface ImageSelectorStyleRuleProps {
|
|
|
117
121
|
}
|
|
118
122
|
export type ImageSelectorStyles = Record<ImageSelectorSlotsType, Interpolation<ImageSelectorStyleRuleProps>>;
|
|
119
123
|
export interface UseImageSelectorProps<T = unknown> {
|
|
124
|
+
/**
|
|
125
|
+
* Static options rendered without a network request when provided.
|
|
126
|
+
*/
|
|
127
|
+
options?: T[];
|
|
120
128
|
/**
|
|
121
129
|
* Controlled selected option.
|
|
122
130
|
*/
|
|
@@ -126,9 +134,9 @@ export interface UseImageSelectorProps<T = unknown> {
|
|
|
126
134
|
*/
|
|
127
135
|
onChange?: ImageSelectorChangeHandler<T>;
|
|
128
136
|
/**
|
|
129
|
-
* Endpoint used to fetch options for the popover grid.
|
|
137
|
+
* Endpoint used to fetch options for the popover grid when `options` are not provided.
|
|
130
138
|
*/
|
|
131
|
-
endpoint
|
|
139
|
+
endpoint?: string;
|
|
132
140
|
/**
|
|
133
141
|
* Whether the selector should refetch options every time the popover opens.
|
|
134
142
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/ImageSelector/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,WAAW,EACX,UAAU,EACV,aAAa,EACb,GAAG,EACJ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,MAAM,0BAA0B,CAAC,CAAC,GAAG,OAAO,IAAI,CACpD,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,EAC3B,KAAK,EAAE,CAAC,GAAG,IAAI,KACZ,IAAI,CAAC;AAEV,MAAM,MAAM,6BAA6B,GAAG,UAAU,GAAG,MAAM,CAAC;AAEhE,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,OAAO;IAC7C;;OAEG;IACH,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,0BAA0B,CAAC,CAAC,CAAC,CAAC;IACzC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/ImageSelector/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,WAAW,EACX,UAAU,EACV,aAAa,EACb,GAAG,EACJ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,MAAM,0BAA0B,CAAC,CAAC,GAAG,OAAO,IAAI,CACpD,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,EAC3B,KAAK,EAAE,CAAC,GAAG,IA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AE,CAAC,KAAK,EAAE,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAC3D,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,aAAa,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IACjE,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,mBAAmB,EAAE,CACnB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,aAAa,CAAC,iBAAiB,CAAC,KACpC,IAAI,CAAC;IACV,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC;IACzE,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,YAAY,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;IAClC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,gBAAgB,EAAE,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3D,cAAc,EAAE,uBAAuB,CAAC;IACxC,gBAAgB,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,uBAAuB,CAAC;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,uBAAuB,CAAC;IACxC,cAAc,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/Label/Label.tsx"],"names":[],"mappings":"AACA,OAAO,EAAmB,UAAU,EAAE,MAAM,SAAS,CAAC;AAYtD;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,OAAO,UAAU,
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/Label/Label.tsx"],"names":[],"mappings":"AACA,OAAO,EAAmB,UAAU,EAAE,MAAM,SAAS,CAAC;AAYtD;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,OAAO,UAAU,qDAyEtC,CAAC"}
|
|
@@ -1,39 +1,42 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
import { useEnvironment as
|
|
3
|
-
import
|
|
4
|
-
import { LABEL_KEY_COMPONENT as
|
|
5
|
-
import { useComponentSize as
|
|
6
|
-
import { LabelRootStyled as
|
|
7
|
-
const P = (
|
|
8
|
-
const { helperMessage: s, label:
|
|
1
|
+
import { jsx as a, jsxs as l, Fragment as p } from "@emotion/react/jsx-runtime";
|
|
2
|
+
import { useEnvironment as v, useModuleSkeleton as w } from "@m4l/core";
|
|
3
|
+
import z from "clsx";
|
|
4
|
+
import { LABEL_KEY_COMPONENT as _, classLabelRoot as k, LAB_SPECIFY as C } from "./constants.js";
|
|
5
|
+
import { useComponentSize as E } from "../../hooks/useComponentSize/index.js";
|
|
6
|
+
import { LabelRootStyled as x, TypographyStyled as I, TypographyMandatoryMessageStyled as j, IconHelperMessageStyled as A, SkeletonStyled as i } from "./slots/LabelSlots.js";
|
|
7
|
+
const P = (y) => {
|
|
8
|
+
const { helperMessage: s, label: h, symbol: c, mandatory: m, mandatoryMessage: r, htmlFor: g, id: u, error: b, size: d = "medium", disabled: t, className: f } = y, { host_static_assets: M, environment_assets: L } = v(), N = w(), { currentSize: o } = E(d), S = typeof s == "string" && s.length > 0, n = o === "small" || o === "medium" ? o : "medium", e = {
|
|
9
9
|
disabled: t,
|
|
10
|
-
size:
|
|
10
|
+
size: d
|
|
11
11
|
};
|
|
12
12
|
return /* @__PURE__ */ a(
|
|
13
|
-
|
|
13
|
+
x,
|
|
14
14
|
{
|
|
15
|
-
"aria-label":
|
|
15
|
+
"aria-label": _,
|
|
16
16
|
ownerState: { ...e },
|
|
17
|
-
htmlFor:
|
|
18
|
-
id:
|
|
19
|
-
children:
|
|
20
|
-
/* @__PURE__ */ a(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
] }) : /* @__PURE__ */
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
|
|
17
|
+
htmlFor: g,
|
|
18
|
+
id: u,
|
|
19
|
+
children: N ? /* @__PURE__ */ l(p, { children: [
|
|
20
|
+
/* @__PURE__ */ a(i, { ownerState: { ...e }, variant: "rectangular", className: "SkeletonWidthLabel" }),
|
|
21
|
+
m && /* @__PURE__ */ a(i, { ownerState: { ...e }, variant: "circular", className: "MandatoryLabel" }),
|
|
22
|
+
S && /* @__PURE__ */ a(i, { ownerState: { ...e }, variant: "circular", className: "HelperIconLabel" })
|
|
23
|
+
] }) : /* @__PURE__ */ l(p, { children: [
|
|
24
|
+
/* @__PURE__ */ l(
|
|
25
|
+
I,
|
|
26
26
|
{
|
|
27
|
-
className:
|
|
27
|
+
className: z(k, C, "M4lclassCssSpecificity", f),
|
|
28
28
|
ownerState: { ...e },
|
|
29
29
|
variant: "bodyStandard",
|
|
30
30
|
size: n,
|
|
31
31
|
disabled: t,
|
|
32
|
-
children:
|
|
32
|
+
children: [
|
|
33
|
+
h,
|
|
34
|
+
c ? ` (${c})` : ""
|
|
35
|
+
]
|
|
33
36
|
}
|
|
34
37
|
),
|
|
35
|
-
|
|
36
|
-
|
|
38
|
+
m && /* @__PURE__ */ a(
|
|
39
|
+
j,
|
|
37
40
|
{
|
|
38
41
|
ownerState: { ...e },
|
|
39
42
|
variant: "bodyStandard",
|
|
@@ -43,16 +46,16 @@ const P = (p) => {
|
|
|
43
46
|
children: r || "*"
|
|
44
47
|
}
|
|
45
48
|
),
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
S && /* @__PURE__ */ a(
|
|
50
|
+
A,
|
|
48
51
|
{
|
|
49
52
|
tooltipContent: s,
|
|
50
53
|
ownerState: { ...e },
|
|
51
54
|
placement: "right",
|
|
52
55
|
size: n,
|
|
53
|
-
className:
|
|
56
|
+
className: b ? "helper-icon-error" : "helper-icon",
|
|
54
57
|
disabled: t,
|
|
55
|
-
src: `${
|
|
58
|
+
src: `${M}/${L}/frontend/components/LabelMessage/assets/icons/infoSmall.svg`
|
|
56
59
|
}
|
|
57
60
|
)
|
|
58
61
|
] })
|
|
@@ -22,6 +22,12 @@ export interface LabelProps {
|
|
|
22
22
|
helperMessage?: boolean | string;
|
|
23
23
|
/** Main label text for the component. */
|
|
24
24
|
label?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Optional symbol rendered wrapped in parentheses right after the label text,
|
|
27
|
+
* e.g. `symbol="°C"` renders `Temperatura (°C)`. Omitted or empty keeps the
|
|
28
|
+
* label unchanged (backwards compatible).
|
|
29
|
+
*/
|
|
30
|
+
symbol?: string;
|
|
25
31
|
/** Controls whether the mandatory marker next to the label is rendered. */
|
|
26
32
|
mandatory?: boolean;
|
|
27
33
|
/** Custom mandatory marker text. Defaults to `*` when omitted. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/Label/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC;AAEvC;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI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AAE,KAAK,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/Label/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC;AAEvC;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,CAAC;AAExG,MAAM,WAAW,UAAU;IACzB,0GAA0G;IAC1G,aAAa,CAAC,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;IACjD;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kEAAkE;IAClE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,4FAA4F;IAC5F,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,qDAAqD;IACrD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,IAAI,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC;IAC1C,oDAAoD;IACpD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;AAClD,MAAM,WAAW,eAAgB,SAAQ,UAAU,EAAE,UAAU;IAC7D,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC;CAC3C;AACD,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,UAAU,CAAC;AACrD,MAAM,MAAM,WAAW,GAAG,mBAAmB,CAAC,UAAU,EAAE,OAAO,mBAAmB,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyValue.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/PropertyValue/PropertyValue.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAWlD;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"PropertyValue.d.ts","sourceRoot":"","sources":["../../../../../../packages/components/src/components/PropertyValue/PropertyValue.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAWlD;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,oDA2HtD"}
|