@inseefr/lunatic 3.5.1 → 3.5.3
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/FilterDescription/FilterDescription.d.ts +5 -7
- package/components/FilterDescription/FilterDescription.js +10 -3
- package/components/FilterDescription/FilterDescription.js.map +1 -1
- package/components/InputNumber/InputNumber.js +2 -2
- package/components/InputNumber/InputNumber.js.map +1 -1
- package/components/InputNumber/InputNumberThousand.d.ts +2 -1
- package/components/InputNumber/InputNumberThousand.js +14 -6
- package/components/InputNumber/InputNumberThousand.js.map +1 -1
- package/components/library.d.ts +2 -4
- package/components/shared/HOC/slottableComponent.d.ts +2 -0
- package/components/shared/HOC/slottableComponent.js.map +1 -1
- package/esm/components/FilterDescription/FilterDescription.d.ts +5 -7
- package/esm/components/FilterDescription/FilterDescription.js +8 -1
- package/esm/components/FilterDescription/FilterDescription.js.map +1 -1
- package/esm/components/InputNumber/InputNumber.js +2 -2
- package/esm/components/InputNumber/InputNumber.js.map +1 -1
- package/esm/components/InputNumber/InputNumberThousand.d.ts +2 -1
- package/esm/components/InputNumber/InputNumberThousand.js +14 -6
- package/esm/components/InputNumber/InputNumberThousand.js.map +1 -1
- package/esm/components/library.d.ts +2 -4
- package/esm/components/shared/HOC/slottableComponent.d.ts +2 -0
- package/esm/components/shared/HOC/slottableComponent.js.map +1 -1
- package/esm/type.source.d.ts +5 -1
- package/esm/use-lunatic/commons/fill-components/fill-component.spec.d.ts +1 -0
- package/esm/use-lunatic/commons/fill-components/fill-component.spec.js +485 -0
- package/esm/use-lunatic/commons/fill-components/fill-component.spec.js.map +1 -0
- package/esm/use-lunatic/commons/fill-components/fill-components.d.ts +3 -3
- package/esm/use-lunatic/commons/fill-components/fill-components.js +29 -5
- package/esm/use-lunatic/commons/fill-components/fill-components.js.map +1 -1
- package/esm/use-lunatic/props/getComponentTypeProps.d.ts +4 -4
- package/esm/use-lunatic/props/getComponentTypeProps.js +1 -1
- package/esm/use-lunatic/props/getComponentTypeProps.js.map +1 -1
- package/esm/use-lunatic/props/propOptions.d.ts +1 -1
- package/esm/use-lunatic/props/propOptions.js +5 -3
- package/esm/use-lunatic/props/propOptions.js.map +1 -1
- package/esm/use-lunatic/props/propOptions.spec.js +100 -2
- package/esm/use-lunatic/props/propOptions.spec.js.map +1 -1
- package/esm/use-lunatic/reducer/reducerInitializer.d.ts +2 -1
- package/esm/use-lunatic/reducer/reducerInitializer.js +3 -3
- package/esm/use-lunatic/reducer/reducerInitializer.js.map +1 -1
- package/esm/use-lunatic/replace-component-sequence.d.ts +1 -1
- package/esm/use-lunatic/type.d.ts +3 -0
- package/esm/use-lunatic/use-lunatic.js +3 -1
- package/esm/use-lunatic/use-lunatic.js.map +1 -1
- package/package.json +8 -2
- package/src/components/FilterDescription/FilterDescription.tsx +24 -13
- package/src/components/InputNumber/InputNumber.tsx +2 -0
- package/src/components/InputNumber/InputNumberThousand.tsx +13 -5
- package/src/components/shared/HOC/slottableComponent.tsx +2 -0
- package/src/stories/behaviour/paste/test.stories.jsx +5 -0
- package/src/stories/filter-description/filter-description.stories.jsx +7 -3
- package/src/stories/loop/roster-for-loop.stories.jsx +1 -4
- package/src/stories/loop/source-roster.json +65 -2
- package/src/stories/utils/default-arg-types.js +1 -1
- package/src/stories/utils/orchestrator.jsx +3 -3
- package/src/type.source.ts +6 -1
- package/src/use-lunatic/commons/fill-components/fill-component.spec.ts +581 -0
- package/src/use-lunatic/commons/fill-components/fill-components.ts +39 -7
- package/src/use-lunatic/props/getComponentTypeProps.ts +15 -11
- package/src/use-lunatic/props/propOptions.spec.ts +140 -2
- package/src/use-lunatic/props/propOptions.ts +8 -3
- package/src/use-lunatic/reducer/reducerInitializer.tsx +4 -2
- package/src/use-lunatic/type.ts +5 -0
- package/src/use-lunatic/use-lunatic.ts +3 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/type.source.d.ts +5 -1
- package/use-lunatic/commons/fill-components/fill-component.spec.d.ts +1 -0
- package/use-lunatic/commons/fill-components/fill-component.spec.js +487 -0
- package/use-lunatic/commons/fill-components/fill-component.spec.js.map +1 -0
- package/use-lunatic/commons/fill-components/fill-components.d.ts +3 -3
- package/use-lunatic/commons/fill-components/fill-components.js +26 -5
- package/use-lunatic/commons/fill-components/fill-components.js.map +1 -1
- package/use-lunatic/props/getComponentTypeProps.d.ts +4 -4
- package/use-lunatic/props/getComponentTypeProps.js +1 -1
- package/use-lunatic/props/getComponentTypeProps.js.map +1 -1
- package/use-lunatic/props/propOptions.d.ts +1 -1
- package/use-lunatic/props/propOptions.js +5 -3
- package/use-lunatic/props/propOptions.js.map +1 -1
- package/use-lunatic/props/propOptions.spec.js +100 -2
- package/use-lunatic/props/propOptions.spec.js.map +1 -1
- package/use-lunatic/reducer/reducerInitializer.d.ts +2 -1
- package/use-lunatic/reducer/reducerInitializer.js +3 -3
- package/use-lunatic/reducer/reducerInitializer.js.map +1 -1
- package/use-lunatic/replace-component-sequence.d.ts +1 -1
- package/use-lunatic/type.d.ts +3 -0
- package/use-lunatic/use-lunatic.js +3 -1
- package/use-lunatic/use-lunatic.js.map +1 -1
- package/src/stories/loop/source-with-header.json +0 -128
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export declare const FilterDescription: ({ id, label }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
1
|
+
import { LunaticComponentProps } from '../type';
|
|
2
|
+
export declare function FilterDescription({ ...props }: LunaticComponentProps<'FilterDescription'>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const CustomFilterDescription: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "label" | "id"> & import("../type").LunaticExtraProps & {
|
|
4
|
+
componentType?: "FilterDescription";
|
|
5
|
+
}>;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const FilterDescription = ({ id, label }) => ((0, jsx_runtime_1.jsx)("div", { id: `filter-description-${id}`, "aria-label": `filter-description`, className: "filter-description-lunatic", children: label }));
|
|
3
|
+
exports.CustomFilterDescription = void 0;
|
|
6
4
|
exports.FilterDescription = FilterDescription;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const slottableComponent_1 = require("../shared/HOC/slottableComponent");
|
|
7
|
+
function FilterDescription({ ...props }) {
|
|
8
|
+
return (0, jsx_runtime_1.jsx)(exports.CustomFilterDescription, { ...props });
|
|
9
|
+
}
|
|
10
|
+
exports.CustomFilterDescription = (0, slottableComponent_1.slottableComponent)('FilterDescription', (props) => {
|
|
11
|
+
const { id, label } = props;
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)("div", { id: `filter-description-${id}`, "aria-label": `filter-description`, className: "filter-description-lunatic", children: label }));
|
|
13
|
+
});
|
|
7
14
|
//# sourceMappingURL=FilterDescription.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterDescription.js","sourceRoot":"","sources":["../../src/components/FilterDescription/FilterDescription.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilterDescription.js","sourceRoot":"","sources":["../../src/components/FilterDescription/FilterDescription.tsx"],"names":[],"mappings":";;;AAKA,8CAIC;;AATD,yEAAsE;AAKtE,SAAgB,iBAAiB,CAAC,EACjC,GAAG,KAAK,EACoC;IAC5C,OAAO,uBAAC,+BAAuB,OAAK,KAAK,GAAI,CAAC;AAC/C,CAAC;AAEY,QAAA,uBAAuB,GAAG,IAAA,uCAAkB,EACxD,mBAAmB,EACnB,CAAC,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAE5B,OAAO,CACN,gCACC,EAAE,EAAE,sBAAsB,EAAE,EAAE,gBAClB,oBAAoB,EAChC,SAAS,EAAC,4BAA4B,YAErC,KAAK,GACD,CACN,CAAC;AACH,CAAC,CACD,CAAC"}
|
|
@@ -12,8 +12,8 @@ function InputNumber({ handleChanges, response, errors, decimals, ...props }) {
|
|
|
12
12
|
return ((0, jsx_runtime_1.jsx)(exports.CustomInputNumber, { ...props, decimals: decimals ?? 0, onChange: (value) => handleChanges([{ name: response.name, value }]), errors: (0, ComponentErrors_1.getComponentErrors)(errors, props.id) }));
|
|
13
13
|
}
|
|
14
14
|
exports.CustomInputNumber = (0, slottableComponent_1.slottableComponent)('InputNumber', (props) => {
|
|
15
|
-
const { id, value, onChange, disabled, readOnly, max, decimals, unit, label, errors, required, description, declarations, } = props;
|
|
15
|
+
const { id, value, onChange, disabled, readOnly, min, max, decimals, unit, label, errors, required, description, declarations, } = props;
|
|
16
16
|
const labelId = `label-${id}`;
|
|
17
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: "lunatic-input-number", children: [(0, jsx_runtime_1.jsx)(Label_1.Label, { htmlFor: id, id: labelId, description: description, children: label }), (0, jsx_runtime_1.jsx)(Declarations_1.Declarations, { type: "AFTER_QUESTION_TEXT", declarations: declarations, id: id }), (0, jsx_runtime_1.jsx)(InputNumberThousand_1.InputNumberThousand, { id: id, value: value, onChange: onChange, disabled: !!disabled, readOnly: !!readOnly, required: !!required, labelId: labelId, max: max, decimals: decimals, invalid: !!errors, unit: unit }), unit && (0, jsx_runtime_1.jsx)("span", { children: unit }), (0, jsx_runtime_1.jsx)(ComponentErrors_1.ComponentErrors, { errors: errors })] }));
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "lunatic-input-number", children: [(0, jsx_runtime_1.jsx)(Label_1.Label, { htmlFor: id, id: labelId, description: description, children: label }), (0, jsx_runtime_1.jsx)(Declarations_1.Declarations, { type: "AFTER_QUESTION_TEXT", declarations: declarations, id: id }), (0, jsx_runtime_1.jsx)(InputNumberThousand_1.InputNumberThousand, { id: id, value: value, onChange: onChange, disabled: !!disabled, readOnly: !!readOnly, required: !!required, labelId: labelId, min: min, max: max, decimals: decimals, invalid: !!errors, unit: unit }), unit && (0, jsx_runtime_1.jsx)("span", { children: unit }), (0, jsx_runtime_1.jsx)(ComponentErrors_1.ComponentErrors, { errors: errors })] }));
|
|
18
18
|
});
|
|
19
19
|
//# sourceMappingURL=InputNumber.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputNumber.js","sourceRoot":"","sources":["../../src/components/InputNumber/InputNumber.tsx"],"names":[],"mappings":";;;AAWA,kCAeC;;AA1BD,+DAA4D;AAE5D,iDAA8C;AAC9C,+EAGmD;AACnD,yEAAsE;AACtE,sEAAmE;AAGnE,SAAgB,WAAW,CAAC,EAC3B,aAAa,EACb,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,GAAG,KAAK,EAC8B;IACtC,OAAO,CACN,uBAAC,yBAAiB,OACb,KAAK,EACT,QAAQ,EAAE,QAAQ,IAAI,CAAC,EACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,EACpE,MAAM,EAAE,IAAA,oCAAkB,EAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,GAC3C,CACF,CAAC;AACH,CAAC;AAUY,QAAA,iBAAiB,GAAG,IAAA,uCAAkB,EAClD,aAAa,EACb,CAAC,KAAK,EAAE,EAAE;IACT,MAAM,EACL,EAAE,EACF,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,WAAW,EACX,YAAY,GACZ,GAAG,KAAK,CAAC;IACV,MAAM,OAAO,GAAG,SAAS,EAAE,EAAE,CAAC;IAC9B,OAAO,CACN,iCAAK,SAAS,EAAC,sBAAsB,aACpC,uBAAC,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|
+
min?: number;
|
|
9
10
|
max?: number;
|
|
10
11
|
decimals?: number;
|
|
11
12
|
invalid?: boolean;
|
|
12
13
|
unit?: string;
|
|
13
14
|
};
|
|
14
|
-
export declare const InputNumberThousand: ({ id, onChange, value, disabled, readOnly, required, labelId, max, decimals, invalid, unit, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const InputNumberThousand: ({ id, onChange, value, disabled, readOnly, required, labelId, min, max, decimals, invalid, unit, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -9,24 +9,32 @@ const classnames_1 = __importDefault(require("classnames"));
|
|
|
9
9
|
const react_1 = require("react");
|
|
10
10
|
const react_number_format_1 = require("react-number-format");
|
|
11
11
|
const i18n_1 = require("../../i18n");
|
|
12
|
-
const InputNumberThousand = ({ id, onChange, value, disabled, readOnly, required, labelId, max, decimals, invalid, unit, }) => {
|
|
12
|
+
const InputNumberThousand = ({ id, onChange, value, disabled, readOnly, required, labelId, min = -Infinity, max = Infinity, decimals, invalid, unit, }) => {
|
|
13
13
|
const handleChange = (0, react_1.useCallback)(function (e) {
|
|
14
14
|
const val = e.floatValue ?? null;
|
|
15
15
|
onChange(Number.isNaN(val) ? null : val);
|
|
16
16
|
}, [onChange]);
|
|
17
17
|
const isAllowed = (0, react_1.useCallback)((values) => {
|
|
18
18
|
const { floatValue } = values;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
// we accept empty value
|
|
20
|
+
if (floatValue === undefined)
|
|
21
|
+
return true;
|
|
22
|
+
// if both min & max are negative, accept only negative above min
|
|
23
|
+
if (min < 0 && max < 0)
|
|
24
|
+
return floatValue >= min && floatValue < 0;
|
|
25
|
+
// if both min & max are positive, accept only positive below max
|
|
26
|
+
if (min > 0 && max > 0)
|
|
27
|
+
return floatValue <= max && floatValue > 0;
|
|
28
|
+
// if min & max have different sign or equal to 0, check if value is within the min-max range
|
|
29
|
+
return floatValue >= min && floatValue <= max;
|
|
30
|
+
}, [min, max]);
|
|
23
31
|
// we want to display the user input and its unit on hover
|
|
24
32
|
let title;
|
|
25
33
|
if (value !== undefined && value !== null) {
|
|
26
34
|
const unitTitle = unit ? ` ${unit}` : '';
|
|
27
35
|
title = `${value.toLocaleString()}${unitTitle}`;
|
|
28
36
|
}
|
|
29
|
-
return ((0, jsx_runtime_1.jsx)(react_number_format_1.NumericFormat, { id: id, className: (0, classnames_1.default)({ disabled }), onValueChange: handleChange, value: value ?? '', title: title, "aria-labelledby": labelId, disabled: disabled, readOnly: readOnly, required: required, lang: "en", isAllowed: isAllowed, allowedDecimalSeparators: i18n_1.inputNumberPropsI18N.allDecimalSeparators, decimalSeparator: i18n_1.inputNumberPropsI18N.decimalSeparator, decimalScale: decimals, allowLeadingZeros: true, thousandSeparator: i18n_1.inputNumberPropsI18N.thousandSeparator, inputMode: decimals ? 'decimal' : 'numeric', "aria-invalid": invalid, onBlur: (e) => {
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(react_number_format_1.NumericFormat, { id: id, className: (0, classnames_1.default)({ disabled }), onValueChange: handleChange, value: value ?? '', title: title, "aria-labelledby": labelId, disabled: disabled, readOnly: readOnly, required: required, lang: "en", isAllowed: isAllowed, allowNegative: min < 0, allowedDecimalSeparators: i18n_1.inputNumberPropsI18N.allDecimalSeparators, decimalSeparator: i18n_1.inputNumberPropsI18N.decimalSeparator, decimalScale: decimals, allowLeadingZeros: true, thousandSeparator: i18n_1.inputNumberPropsI18N.thousandSeparator, inputMode: decimals ? 'decimal' : 'numeric', "aria-invalid": invalid, onBlur: (e) => {
|
|
30
38
|
e.target.setSelectionRange(0, 0);
|
|
31
39
|
} }));
|
|
32
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputNumberThousand.js","sourceRoot":"","sources":["../../src/components/InputNumber/InputNumberThousand.tsx"],"names":[],"mappings":";;;;;;;AAAA,4DAAoC;AACpC,iCAAoC;AACpC,6DAI6B;AA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Textarea';
|
|
8
8
|
import type { LunaticComponentProps } from './type';
|
|
9
9
|
import type { ComponentType } from 'react';
|
|
10
|
+
import { FilterDescription } from './FilterDescription/FilterDescription';
|
|
10
11
|
import { InputNumber } from './InputNumber/InputNumber';
|
|
11
12
|
import { Duration } from './Duration/Duration';
|
|
12
13
|
import { Loop } from './Loop/Loop';
|
|
@@ -55,10 +56,7 @@ export declare const library: {
|
|
|
55
56
|
componentType?: "Switch";
|
|
56
57
|
}>;
|
|
57
58
|
Question: (props: LunaticComponentProps<"Question">) => import("react/jsx-runtime").JSX.Element;
|
|
58
|
-
FilterDescription:
|
|
59
|
-
id: string;
|
|
60
|
-
label?: import("react").ReactNode;
|
|
61
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
FilterDescription: typeof FilterDescription;
|
|
62
60
|
Dropdown: typeof Dropdown;
|
|
63
61
|
PairwiseLinks: ({ declarations, xAxisIterations, yAxisIterations, id, getComponents, }: LunaticComponentProps<"PairwiseLinks">) => import("react/jsx-runtime").JSX.Element;
|
|
64
62
|
Roundabout: typeof Roundabout;
|
|
@@ -38,6 +38,7 @@ import type { LunaticComponentProps } from '../../type';
|
|
|
38
38
|
import type { MarkdownLink } from '../MDLabel/MarkdownLink';
|
|
39
39
|
import type { Accordion } from '../../Accordion/Accordion';
|
|
40
40
|
import type { CustomDatepickerFields } from '../../Datepicker/DatepickerFields';
|
|
41
|
+
import type { CustomFilterDescription } from '../../FilterDescription/FilterDescription';
|
|
41
42
|
/**
|
|
42
43
|
* Contain the type of every customizable components.
|
|
43
44
|
*/
|
|
@@ -55,6 +56,7 @@ export type LunaticSlotComponents = {
|
|
|
55
56
|
Dropdown: typeof CustomDropdown;
|
|
56
57
|
Radio: typeof Radio;
|
|
57
58
|
Suggester: typeof CustomSuggester;
|
|
59
|
+
FilterDescription: typeof CustomFilterDescription;
|
|
58
60
|
CheckboxBoolean: typeof CustomCheckboxBoolean;
|
|
59
61
|
CheckboxGroup: typeof CustomCheckboxGroup;
|
|
60
62
|
CheckboxOption: typeof CheckboxOption;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slottableComponent.js","sourceRoot":"","sources":["../../../src/components/shared/HOC/slottableComponent.tsx"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"slottableComponent.js","sourceRoot":"","sources":["../../../src/components/shared/HOC/slottableComponent.tsx"],"names":[],"mappings":";;;AA8IA,gDAkBC;;AAhKD,iCAMe;AAiHf,MAAM,KAAK,GAAG,EAAgD,CAAC;AAE/D,MAAM,YAAY,GAAG,IAAA,qBAAa,EAAC,KAAK,CAAC,CAAC;AAEnC,MAAM,aAAa,GAAG,CAAC,EAC7B,KAAK,EACL,QAAQ,GACuD,EAAE,EAAE;IACnE,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,2DAAG,QAAQ,GAAI,CAAC;IACxB,CAAC;IACD,OAAO,CACN,uBAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,IAAI,KAAK,YAC1C,QAAQ,GACc,CACxB,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,aAAa,iBAYxB;AAEF;;;;GAIG;AACH,SAAgB,kBAAkB,CACjC,IAAiC,EACjC,iBAAuC;IAEvC,MAAM,kBAAkB,GAAG,CAAC,KAAQ,EAAE,EAAE;QACvC,MAAM,MAAM,GAAG,IAAA,kBAAU,EAAC,YAAY,CAAC,IAAI,KAAK,CAAC;QAEjD,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;YAC9B,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAqB,CAAC;YACvD,uCAAuC;YACvC,OAAO,uBAAC,aAAa,OAAK,KAAK,GAAI,CAAC;QACrC,CAAC;QAED,uCAAuC;QACvC,OAAO,uBAAC,iBAAiB,OAAK,KAAK,GAAI,CAAC;IACzC,CAAC,CAAC;IACF,kBAAkB,CAAC,WAAW,GAAG,IAAI,CAAC;IACtC,OAAO,kBAAkB,CAAC;AAC3B,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export declare const FilterDescription: ({ id, label }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
1
|
+
import { LunaticComponentProps } from '../type';
|
|
2
|
+
export declare function FilterDescription({ ...props }: LunaticComponentProps<'FilterDescription'>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const CustomFilterDescription: import("react").ComponentType<Pick<import("../type").LunaticBaseProps<string>, "label" | "id"> & import("../type").LunaticExtraProps & {
|
|
4
|
+
componentType?: "FilterDescription";
|
|
5
|
+
}>;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
import { slottableComponent } from '../shared/HOC/slottableComponent';
|
|
3
|
+
export function FilterDescription({ ...props }) {
|
|
4
|
+
return _jsx(CustomFilterDescription, { ...props });
|
|
5
|
+
}
|
|
6
|
+
export const CustomFilterDescription = slottableComponent('FilterDescription', (props) => {
|
|
7
|
+
const { id, label } = props;
|
|
8
|
+
return (_jsx("div", { id: `filter-description-${id}`, "aria-label": `filter-description`, className: "filter-description-lunatic", children: label }));
|
|
9
|
+
});
|
|
3
10
|
//# sourceMappingURL=FilterDescription.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterDescription.js","sourceRoot":"","sources":["../../../src/components/FilterDescription/FilterDescription.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"FilterDescription.js","sourceRoot":"","sources":["../../../src/components/FilterDescription/FilterDescription.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAKtE,MAAM,UAAU,iBAAiB,CAAC,EACjC,GAAG,KAAK,EACoC;IAC5C,OAAO,KAAC,uBAAuB,OAAK,KAAK,GAAI,CAAC;AAC/C,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CACxD,mBAAmB,EACnB,CAAC,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAE5B,OAAO,CACN,cACC,EAAE,EAAE,sBAAsB,EAAE,EAAE,gBAClB,oBAAoB,EAChC,SAAS,EAAC,4BAA4B,YAErC,KAAK,GACD,CACN,CAAC;AACH,CAAC,CACD,CAAC"}
|
|
@@ -8,8 +8,8 @@ export function InputNumber({ handleChanges, response, errors, decimals, ...prop
|
|
|
8
8
|
return (_jsx(CustomInputNumber, { ...props, decimals: decimals !== null && decimals !== void 0 ? decimals : 0, onChange: (value) => handleChanges([{ name: response.name, value }]), errors: getComponentErrors(errors, props.id) }));
|
|
9
9
|
}
|
|
10
10
|
export const CustomInputNumber = slottableComponent('InputNumber', (props) => {
|
|
11
|
-
const { id, value, onChange, disabled, readOnly, max, decimals, unit, label, errors, required, description, declarations, } = props;
|
|
11
|
+
const { id, value, onChange, disabled, readOnly, min, max, decimals, unit, label, errors, required, description, declarations, } = props;
|
|
12
12
|
const labelId = `label-${id}`;
|
|
13
|
-
return (_jsxs("div", { className: "lunatic-input-number", children: [_jsx(Label, { htmlFor: id, id: labelId, description: description, children: label }), _jsx(Declarations, { type: "AFTER_QUESTION_TEXT", declarations: declarations, id: id }), _jsx(InputNumberThousand, { id: id, value: value, onChange: onChange, disabled: !!disabled, readOnly: !!readOnly, required: !!required, labelId: labelId, max: max, decimals: decimals, invalid: !!errors, unit: unit }), unit && _jsx("span", { children: unit }), _jsx(ComponentErrors, { errors: errors })] }));
|
|
13
|
+
return (_jsxs("div", { className: "lunatic-input-number", children: [_jsx(Label, { htmlFor: id, id: labelId, description: description, children: label }), _jsx(Declarations, { type: "AFTER_QUESTION_TEXT", declarations: declarations, id: id }), _jsx(InputNumberThousand, { id: id, value: value, onChange: onChange, disabled: !!disabled, readOnly: !!readOnly, required: !!required, labelId: labelId, min: min, max: max, decimals: decimals, invalid: !!errors, unit: unit }), unit && _jsx("span", { children: unit }), _jsx(ComponentErrors, { errors: errors })] }));
|
|
14
14
|
});
|
|
15
15
|
//# sourceMappingURL=InputNumber.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputNumber.js","sourceRoot":"","sources":["../../../src/components/InputNumber/InputNumber.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EACN,eAAe,EACf,kBAAkB,GAClB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAGnE,MAAM,UAAU,WAAW,CAAC,EAC3B,aAAa,EACb,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,GAAG,KAAK,EAC8B;IACtC,OAAO,CACN,KAAC,iBAAiB,OACb,KAAK,EACT,QAAQ,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,CAAC,EACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,EACpE,MAAM,EAAE,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,GAC3C,CACF,CAAC;AACH,CAAC;AAUD,MAAM,CAAC,MAAM,iBAAiB,GAAG,kBAAkB,CAClD,aAAa,EACb,CAAC,KAAK,EAAE,EAAE;IACT,MAAM,EACL,EAAE,EACF,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,WAAW,EACX,YAAY,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QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,CAAC,MAAM,EACjB,IAAI,EAAE,IAAI,GACT,EACD,IAAI,IAAI,yBAAO,IAAI,GAAQ,EAC5B,KAAC,eAAe,IAAC,MAAM,EAAE,MAAM,GAAI,IAC9B,CACN,CAAC;AACH,CAAC,CACD,CAAC"}
|
|
@@ -6,10 +6,11 @@ type Props = {
|
|
|
6
6
|
readOnly?: boolean;
|
|
7
7
|
required?: boolean;
|
|
8
8
|
labelId?: string;
|
|
9
|
+
min?: number;
|
|
9
10
|
max?: number;
|
|
10
11
|
decimals?: number;
|
|
11
12
|
invalid?: boolean;
|
|
12
13
|
unit?: string;
|
|
13
14
|
};
|
|
14
|
-
export declare const InputNumberThousand: ({ id, onChange, value, disabled, readOnly, required, labelId, max, decimals, invalid, unit, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const InputNumberThousand: ({ id, onChange, value, disabled, readOnly, required, labelId, min, max, decimals, invalid, unit, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
import { NumericFormat, } from 'react-number-format';
|
|
5
5
|
import { inputNumberPropsI18N } from '../../i18n';
|
|
6
|
-
export const InputNumberThousand = ({ id, onChange, value, disabled, readOnly, required, labelId, max, decimals, invalid, unit, }) => {
|
|
6
|
+
export const InputNumberThousand = ({ id, onChange, value, disabled, readOnly, required, labelId, min = -Infinity, max = Infinity, decimals, invalid, unit, }) => {
|
|
7
7
|
const handleChange = useCallback(function (e) {
|
|
8
8
|
var _a;
|
|
9
9
|
const val = (_a = e.floatValue) !== null && _a !== void 0 ? _a : null;
|
|
@@ -11,17 +11,25 @@ export const InputNumberThousand = ({ id, onChange, value, disabled, readOnly, r
|
|
|
11
11
|
}, [onChange]);
|
|
12
12
|
const isAllowed = useCallback((values) => {
|
|
13
13
|
const { floatValue } = values;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
// we accept empty value
|
|
15
|
+
if (floatValue === undefined)
|
|
16
|
+
return true;
|
|
17
|
+
// if both min & max are negative, accept only negative above min
|
|
18
|
+
if (min < 0 && max < 0)
|
|
19
|
+
return floatValue >= min && floatValue < 0;
|
|
20
|
+
// if both min & max are positive, accept only positive below max
|
|
21
|
+
if (min > 0 && max > 0)
|
|
22
|
+
return floatValue <= max && floatValue > 0;
|
|
23
|
+
// if min & max have different sign or equal to 0, check if value is within the min-max range
|
|
24
|
+
return floatValue >= min && floatValue <= max;
|
|
25
|
+
}, [min, max]);
|
|
18
26
|
// we want to display the user input and its unit on hover
|
|
19
27
|
let title;
|
|
20
28
|
if (value !== undefined && value !== null) {
|
|
21
29
|
const unitTitle = unit ? ` ${unit}` : '';
|
|
22
30
|
title = `${value.toLocaleString()}${unitTitle}`;
|
|
23
31
|
}
|
|
24
|
-
return (_jsx(NumericFormat, { id: id, className: classNames({ disabled }), onValueChange: handleChange, value: value !== null && value !== void 0 ? value : '', title: title, "aria-labelledby": labelId, disabled: disabled, readOnly: readOnly, required: required, lang: "en", isAllowed: isAllowed, allowedDecimalSeparators: inputNumberPropsI18N.allDecimalSeparators, decimalSeparator: inputNumberPropsI18N.decimalSeparator, decimalScale: decimals, allowLeadingZeros: true, thousandSeparator: inputNumberPropsI18N.thousandSeparator, inputMode: decimals ? 'decimal' : 'numeric', "aria-invalid": invalid, onBlur: (e) => {
|
|
32
|
+
return (_jsx(NumericFormat, { id: id, className: classNames({ disabled }), onValueChange: handleChange, value: value !== null && value !== void 0 ? value : '', title: title, "aria-labelledby": labelId, disabled: disabled, readOnly: readOnly, required: required, lang: "en", isAllowed: isAllowed, allowNegative: min < 0, allowedDecimalSeparators: inputNumberPropsI18N.allDecimalSeparators, decimalSeparator: inputNumberPropsI18N.decimalSeparator, decimalScale: decimals, allowLeadingZeros: true, thousandSeparator: inputNumberPropsI18N.thousandSeparator, inputMode: decimals ? 'decimal' : 'numeric', "aria-invalid": invalid, onBlur: (e) => {
|
|
25
33
|
e.target.setSelectionRange(0, 0);
|
|
26
34
|
} }));
|
|
27
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputNumberThousand.js","sourceRoot":"","sources":["../../../src/components/InputNumber/InputNumberThousand.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EACN,aAAa,GAGb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"InputNumberThousand.js","sourceRoot":"","sources":["../../../src/components/InputNumber/InputNumberThousand.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EACN,aAAa,GAGb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAiBlD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EACnC,EAAE,EACF,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,GAAG,GAAG,CAAC,QAAQ,EACf,GAAG,GAAG,QAAQ,EACd,QAAQ,EACR,OAAO,EACP,IAAI,GACG,EAAE,EAAE;IACX,MAAM,YAAY,GAAG,WAAW,CAC/B,UAAU,CAAC;;QACV,MAAM,GAAG,GAAG,MAAA,CAAC,CAAC,UAAU,mCAAI,IAAI,CAAC;QACjC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC,EACD,CAAC,QAAQ,CAAC,CACV,CAAC;IAEF,MAA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G,CAAC,EACtB,wBAAwB,EAAE,oBAAoB,CAAC,oBAAoB,EACnE,gBAAgB,EAAE,oBAAoB,CAAC,gBAAgB,EACvD,YAAY,EAAE,QAAQ,EACtB,iBAAiB,QACjB,iBAAiB,EAAE,oBAAoB,CAAC,iBAAiB,EACzD,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,kBAC7B,OAAO,EACrB,MAAM,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClC,CAAC,GACA,CACF,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { Text } from './Text/Text';
|
|
|
7
7
|
import { Textarea } from './Textarea/Textarea';
|
|
8
8
|
import type { LunaticComponentProps } from './type';
|
|
9
9
|
import type { ComponentType } from 'react';
|
|
10
|
+
import { FilterDescription } from './FilterDescription/FilterDescription';
|
|
10
11
|
import { InputNumber } from './InputNumber/InputNumber';
|
|
11
12
|
import { Duration } from './Duration/Duration';
|
|
12
13
|
import { Loop } from './Loop/Loop';
|
|
@@ -55,10 +56,7 @@ export declare const library: {
|
|
|
55
56
|
componentType?: "Switch";
|
|
56
57
|
}>;
|
|
57
58
|
Question: (props: LunaticComponentProps<"Question">) => import("react/jsx-runtime").JSX.Element;
|
|
58
|
-
FilterDescription:
|
|
59
|
-
id: string;
|
|
60
|
-
label?: import("react").ReactNode;
|
|
61
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
FilterDescription: typeof FilterDescription;
|
|
62
60
|
Dropdown: typeof Dropdown;
|
|
63
61
|
PairwiseLinks: ({ declarations, xAxisIterations, yAxisIterations, id, getComponents, }: LunaticComponentProps<"PairwiseLinks">) => import("react/jsx-runtime").JSX.Element;
|
|
64
62
|
Roundabout: typeof Roundabout;
|
|
@@ -38,6 +38,7 @@ import type { LunaticComponentProps } from '../../type';
|
|
|
38
38
|
import type { MarkdownLink } from '../MDLabel/MarkdownLink';
|
|
39
39
|
import type { Accordion } from '../../Accordion/Accordion';
|
|
40
40
|
import type { CustomDatepickerFields } from '../../Datepicker/DatepickerFields';
|
|
41
|
+
import type { CustomFilterDescription } from '../../FilterDescription/FilterDescription';
|
|
41
42
|
/**
|
|
42
43
|
* Contain the type of every customizable components.
|
|
43
44
|
*/
|
|
@@ -55,6 +56,7 @@ export type LunaticSlotComponents = {
|
|
|
55
56
|
Dropdown: typeof CustomDropdown;
|
|
56
57
|
Radio: typeof Radio;
|
|
57
58
|
Suggester: typeof CustomSuggester;
|
|
59
|
+
FilterDescription: typeof CustomFilterDescription;
|
|
58
60
|
CheckboxBoolean: typeof CustomCheckboxBoolean;
|
|
59
61
|
CheckboxGroup: typeof CustomCheckboxGroup;
|
|
60
62
|
CheckboxOption: typeof CheckboxOption;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slottableComponent.js","sourceRoot":"","sources":["../../../../src/components/shared/HOC/slottableComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEN,aAAa,EAGb,UAAU,GACV,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"slottableComponent.js","sourceRoot":"","sources":["../../../../src/components/shared/HOC/slottableComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEN,aAAa,EAGb,UAAU,GACV,MAAM,OAAO,CAAC;AAiHf,MAAM,KAAK,GAAG,EAAgD,CAAC;AAE/D,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC7B,KAAK,EACL,QAAQ,GACuD,EAAE,EAAE;IACnE,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,OAAO,4BAAG,QAAQ,GAAI,CAAC;IACxB,CAAC;IACD,OAAO,CACN,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,KAAK,YAC1C,QAAQ,GACc,CACxB,CAAC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CACjC,IAAiC,EACjC,iBAAuC;IAEvC,MAAM,kBAAkB,GAAG,CAAC,KAAQ,EAAE,EAAE;;QACvC,MAAM,MAAM,GAAG,MAAA,UAAU,CAAC,YAAY,CAAC,mCAAI,KAAK,CAAC;QAEjD,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;YAC9B,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAqB,CAAC;YACvD,uCAAuC;YACvC,OAAO,KAAC,aAAa,OAAK,KAAK,GAAI,CAAC;QACrC,CAAC;QAED,uCAAuC;QACvC,OAAO,KAAC,iBAAiB,OAAK,KAAK,GAAI,CAAC;IACzC,CAAC,CAAC;IACF,kBAAkB,CAAC,WAAW,GAAG,IAAI,CAAC;IACtC,OAAO,kBAAkB,CAAC;AAC3B,CAAC"}
|
package/esm/type.source.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export type ComponentDefinitionWithPage = ComponentDefinition & ({
|
|
|
8
8
|
} | {
|
|
9
9
|
goToPage: string;
|
|
10
10
|
});
|
|
11
|
-
export type ComponentDefinition = ComponentInputDefinition | ComponentSequenceDefinition | ComponentRoundaboutDefinition | ComponentLoopDefinition | ComponentRosterForLoopDefinition | ComponentTableDefinition | ComponentNumberDefinition | ComponentDurationDefinition | ComponentDatePickerDefinition | ComponentCheckboxGroupDefinition | ComponentCheckboxBooleanDefinition | ComponentRadioDefinition | ComponentDropdownDefinition | ComponentQuestionDefinition | ComponentCheckboxOneDefinition | ComponentSuggesterDefinition | ComponentPairWiseLinksDefinition | ComponentSummaryDefinition | ComponentText | ComponentAccordion;
|
|
11
|
+
export type ComponentDefinition = ComponentInputDefinition | ComponentSequenceDefinition | ComponentRoundaboutDefinition | ComponentLoopDefinition | ComponentRosterForLoopDefinition | ComponentTableDefinition | ComponentNumberDefinition | ComponentDurationDefinition | ComponentDatePickerDefinition | ComponentCheckboxGroupDefinition | ComponentCheckboxBooleanDefinition | ComponentRadioDefinition | ComponentDropdownDefinition | ComponentQuestionDefinition | ComponentCheckboxOneDefinition | ComponentSuggesterDefinition | ComponentPairWiseLinksDefinition | ComponentSummaryDefinition | ComponentText | ComponentAccordion | ComponentFilterDescriptionDefinition;
|
|
12
12
|
export type ComponentInputDefinition = ComponentDefinitionBaseWithResponse & {
|
|
13
13
|
componentType: 'Input' | 'Textarea';
|
|
14
14
|
maxLength?: number;
|
|
@@ -332,6 +332,10 @@ export type ComponentAccordion = {
|
|
|
332
332
|
body: VTLExpression;
|
|
333
333
|
}[];
|
|
334
334
|
};
|
|
335
|
+
export type ComponentFilterDescriptionDefinition = {
|
|
336
|
+
componentType: 'FilterDescription';
|
|
337
|
+
label: VTLExpression;
|
|
338
|
+
};
|
|
335
339
|
export type SuggesterDefinition = {
|
|
336
340
|
/**
|
|
337
341
|
* Name of the list (will be used as storeName for suggester)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|