@arquimedes.co/eureka-forms 3.0.59-new-steps → 3.0.59

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 (133) hide show
  1. package/dist/@Types/FormStep.d.ts +2 -7
  2. package/dist/@Types/FormStep.js +1 -2
  3. package/dist/@Types/GenericFormSteps.d.ts +7 -0
  4. package/dist/App/App.cbr.test.js +78 -0
  5. package/dist/App/App.d.ts +6 -1
  6. package/dist/App/AppHooks.js +2 -2
  7. package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +2 -1
  8. package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.module.css +1 -2
  9. package/dist/FormSteps/CheckBoxStep/CheckBoxStep.mobileLabel.test.js +123 -0
  10. package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +34 -7
  11. package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.module.css +30 -0
  12. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElementComponent.js +1 -1
  13. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PagedMapperElement/PagedMapperElement.js +2 -1
  14. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PagedMapperElement/PagedMapperElement.module.css +1 -2
  15. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.js +2 -0
  16. package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.module.css +1 -2
  17. package/dist/FormSteps/PhoneInputStep/MaterialTextInputStep/MaterialPhoneInputStep.js +5 -4
  18. package/dist/FormSteps/Step.js +4 -19
  19. package/dist/FormSteps/StepFunctions.d.ts +16 -1
  20. package/dist/FormSteps/StepFunctions.js +58 -14
  21. package/dist/FormSteps/StepFunctions.test.js +32 -55
  22. package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +5 -4
  23. package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +4 -4
  24. package/dist/FormSteps/Utils/@StepFiller/StepFiller.js +5 -4
  25. package/dist/FormSteps/Utils/MaterialInputContainer/MaterialInputContainer.js +5 -4
  26. package/dist/Shared/ErkDatePicker/ErkDatePicker.js +10 -8
  27. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.d.ts +3 -2
  28. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.js +7 -6
  29. package/dist/Shared/ErkTimePicker/ErkTimePicker.js +1 -0
  30. package/dist/Shared/ErkTimePicker/ErkTimePicker.module.css +0 -1
  31. package/dist/Utils/CBRFunctions.js +4 -2
  32. package/dist/Utils/CBRFunctions.test.d.ts +1 -0
  33. package/dist/Utils/CBRFunctions.test.js +123 -0
  34. package/dist/Utils/MaterialProviders.js +6 -0
  35. package/dist/Utils/SurfaceStyle.d.ts +11 -0
  36. package/dist/Utils/SurfaceStyle.js +14 -0
  37. package/dist/constants/FormStepTypes.d.ts +1 -5
  38. package/dist/constants/FormStepTypes.js +0 -4
  39. package/dist/hooks.d.ts +1 -0
  40. package/dist/hooks.js +1 -0
  41. package/dist/index.lib.d.ts +2 -4
  42. package/dist/index.lib.js +1 -3
  43. package/package.json +7 -8
  44. package/dist/@Types/AvailabilityFormStep.d.ts +0 -48
  45. package/dist/@Types/AvailabilityFormStep.js +0 -24
  46. package/dist/@Types/BankAccountFormStep.d.ts +0 -67
  47. package/dist/@Types/BankAccountFormStep.js +0 -14
  48. package/dist/@Types/BookingFormStep.d.ts +0 -166
  49. package/dist/@Types/BookingFormStep.js +0 -44
  50. package/dist/@Types/CalendarFormStep.d.ts +0 -209
  51. package/dist/@Types/CalendarFormStep.js +0 -55
  52. package/dist/@Types/CommunicationChannelFormStep.d.ts +0 -51
  53. package/dist/@Types/CommunicationChannelFormStep.js +0 -15
  54. package/dist/@Types/ConsentFormStep.d.ts +0 -36
  55. package/dist/@Types/ConsentFormStep.js +0 -8
  56. package/dist/@Types/EntityFormFormStep.d.ts +0 -66
  57. package/dist/@Types/EntityFormFormStep.js +0 -20
  58. package/dist/@Types/EventFormStep.d.ts +0 -52
  59. package/dist/@Types/EventFormStep.js +0 -13
  60. package/dist/@Types/ExternalReferenceFormStep.d.ts +0 -74
  61. package/dist/@Types/ExternalReferenceFormStep.js +0 -20
  62. package/dist/@Types/LocationFormStep.d.ts +0 -159
  63. package/dist/@Types/LocationFormStep.js +0 -46
  64. package/dist/@Types/NumericFormSteps.d.ts +0 -108
  65. package/dist/@Types/NumericFormSteps.js +0 -20
  66. package/dist/@Types/PredefinedSelectorFormStep.d.ts +0 -51
  67. package/dist/@Types/PredefinedSelectorFormStep.js +0 -39
  68. package/dist/@Types/StepRef.d.ts +0 -135
  69. package/dist/@Types/StepRef.js +0 -49
  70. package/dist/FormSteps/AvailabilityStep/AvailabilityStep.d.ts +0 -7
  71. package/dist/FormSteps/AvailabilityStep/AvailabilityStep.js +0 -14
  72. package/dist/FormSteps/AvailabilityStep/MaterialAvailabilityStep/MaterialAvailabilityStep.d.ts +0 -8
  73. package/dist/FormSteps/AvailabilityStep/MaterialAvailabilityStep/MaterialAvailabilityStep.js +0 -32
  74. package/dist/FormSteps/BookingStep/BookingStep.d.ts +0 -17
  75. package/dist/FormSteps/BookingStep/BookingStep.js +0 -14
  76. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.d.ts +0 -7
  77. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.js +0 -32
  78. package/dist/FormSteps/LocationStep/LocationStep.d.ts +0 -10
  79. package/dist/FormSteps/LocationStep/LocationStep.js +0 -14
  80. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.d.ts +0 -3
  81. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.js +0 -54
  82. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.module.css +0 -18
  83. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.d.ts +0 -3
  84. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.js +0 -168
  85. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.module.css +0 -94
  86. package/dist/FormSteps/NumberStep/NumberStep.d.ts +0 -10
  87. package/dist/FormSteps/NumberStep/NumberStep.js +0 -14
  88. package/dist/Icons/AddIcon.d.ts +0 -3
  89. package/dist/Icons/AddIcon.js +0 -7
  90. package/dist/Icons/EditIcon.d.ts +0 -3
  91. package/dist/Icons/EditIcon.js +0 -7
  92. package/dist/Icons/RemoveIcon.d.ts +0 -3
  93. package/dist/Icons/RemoveIcon.js +0 -7
  94. package/dist/Icons/ViewDayIcon.d.ts +0 -3
  95. package/dist/Icons/ViewDayIcon.js +0 -7
  96. package/dist/Icons/ViewWeekIcon.d.ts +0 -3
  97. package/dist/Icons/ViewWeekIcon.js +0 -7
  98. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.d.ts +0 -19
  99. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.js +0 -80
  100. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.module.css +0 -88
  101. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.d.ts +0 -29
  102. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.js +0 -139
  103. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.d.ts +0 -25
  104. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.js +0 -112
  105. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.module.css +0 -88
  106. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.test.js +0 -75
  107. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.d.ts +0 -31
  108. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.js +0 -223
  109. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.module.css +0 -608
  110. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.d.ts +0 -28
  111. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.js +0 -117
  112. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.test.js +0 -49
  113. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.test.d.ts +0 -1
  114. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.test.js +0 -107
  115. package/dist/Shared/ErkIconButton/ErkIconButton.d.ts +0 -17
  116. package/dist/Shared/ErkIconButton/ErkIconButton.js +0 -11
  117. package/dist/Shared/ErkIconButton/ErkIconButton.module.css +0 -41
  118. package/dist/Shared/ErkLocationField/ErkLocationField.d.ts +0 -24
  119. package/dist/Shared/ErkLocationField/ErkLocationField.js +0 -128
  120. package/dist/Shared/ErkLocationField/ErkLocationField.module.css +0 -164
  121. package/dist/Shared/ErkLocationField/ErkLocationField.test.d.ts +0 -1
  122. package/dist/Shared/ErkLocationField/ErkLocationField.test.js +0 -82
  123. package/dist/Shared/ErkLocationField/addressFields.d.ts +0 -12
  124. package/dist/Shared/ErkLocationField/addressFields.js +0 -34
  125. package/dist/Shared/ErkLocationField/locationRestrictions.d.ts +0 -6
  126. package/dist/Shared/ErkLocationField/locationRestrictions.js +0 -51
  127. package/dist/Shared/ErkLocationInput/ErkLocationInput.d.ts +0 -15
  128. package/dist/Shared/ErkLocationInput/ErkLocationInput.js +0 -502
  129. package/dist/Shared/ErkLocationInput/ErkLocationInput.module.css +0 -115
  130. package/dist/Shared/ErkNumberField/ErkNumberField.d.ts +0 -42
  131. package/dist/Shared/ErkNumberField/ErkNumberField.js +0 -170
  132. /package/dist/{Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.test.d.ts → App/App.cbr.test.d.ts} +0 -0
  133. /package/dist/{Shared/ErkBookingPicker/ErkBookingPicker.stories.test.d.ts → FormSteps/CheckBoxStep/CheckBoxStep.mobileLabel.test.d.ts} +0 -0
@@ -1,4 +1,3 @@
1
- import { NumberStepType, } from '../@Types/FormStep';
2
1
  import FormStepTypes, { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueDataTypes, EntityValueOptionTypes, OptionTypes, } from '../constants/FormStepTypes';
3
2
  import CBRFormStepTypes from '../constants/CBRFormStepTypes';
4
3
  import AYFFormStepTypes from '../constants/AYFFormStepTypes';
@@ -88,8 +87,6 @@ function recursivelyCheckOpenSize(idStep, steps, values) {
88
87
  return size;
89
88
  }
90
89
  case FormStepTypes.DATEPICKER:
91
- case FormStepTypes.LOCATION:
92
- case FormStepTypes.NUMBER:
93
90
  case FormStepTypes.TEXTINPUT: {
94
91
  return step.size;
95
92
  }
@@ -100,6 +97,64 @@ function recursivelyCheckOpenSize(idStep, steps, values) {
100
97
  export const calcStepWidth = (stepSize, size) => {
101
98
  return size.blockSize * stepSize + size.spacingSize * (stepSize - 1);
102
99
  };
100
+ const clampSpan = (span, columns) => Math.max(1, Math.min(span, columns));
101
+ /**
102
+ * Columns the form grid has on each screen — the editor's model, mirrored so both sides agree on
103
+ * what fits: desktop uses the form's configured `blockNum`, tablet caps it at 2, and mobile is the
104
+ * single column this renderer has always collapsed to.
105
+ */
106
+ function columnsForBreakpoint(formSize, breakpoint) {
107
+ switch (breakpoint) {
108
+ case 'desktop':
109
+ return formSize.blockNum;
110
+ case 'tablet':
111
+ return clampSpan(formSize.blockNum, 2);
112
+ case 'mobile':
113
+ return 1;
114
+ }
115
+ }
116
+ /**
117
+ * Span a step gets on a screen when it has no explicit override — the legacy model translated to
118
+ * the responsive one: desktop keeps the step's `size` (falling back to full width, as steps
119
+ * without one have always rendered), and the other screens shrink that span to fit their column
120
+ * count.
121
+ */
122
+ function deriveDefaultSpan(step, breakpoint, formSize) {
123
+ const desktopSpan = clampSpan(step.size ?? formSize.blockNum, formSize.blockNum);
124
+ if (breakpoint === 'desktop')
125
+ return desktopSpan;
126
+ return clampSpan(desktopSpan, columnsForBreakpoint(formSize, breakpoint));
127
+ }
128
+ /**
129
+ * Maps the renderer's width model onto the editor's. The editor lays out exactly three screens,
130
+ * while `currentBreakPoint` counts how many columns currently fit, so the two need a bridge:
131
+ * `isMobile` is the editor's mobile screen, and because the editor's tablet layout is a 2-column
132
+ * grid (see `columnsForBreakpoint`) its overrides apply only once at most 2 columns fit.
133
+ * Reduced-but-wider states (e.g. 3 columns of a 4-column form) keep the desktop spans — the
134
+ * editor has no screen for them, and this keeps forms without overrides rendering exactly as
135
+ * they always have.
136
+ */
137
+ function breakpointForWidthStats(widthStats, formSize) {
138
+ if (widthStats.isMobile)
139
+ return 'mobile';
140
+ if (widthStats.currentBreakPoint < formSize.blockNum && widthStats.currentBreakPoint <= 2)
141
+ return 'tablet';
142
+ return 'desktop';
143
+ }
144
+ /**
145
+ * Effective column span of a step at the current width: its explicit `sizes` override for the
146
+ * screen when present (clamped to that screen's columns), the derived legacy default otherwise.
147
+ * Desktop never reads `sizes` — its source of truth stays the legacy `size` field.
148
+ */
149
+ export function resolveStepSpan(step, widthStats, formSize) {
150
+ const breakpoint = breakpointForWidthStats(widthStats, formSize);
151
+ if (breakpoint !== 'desktop') {
152
+ const override = step.sizes?.[breakpoint];
153
+ if (override !== undefined)
154
+ return clampSpan(override, columnsForBreakpoint(formSize, breakpoint));
155
+ }
156
+ return deriveDefaultSpan(step, breakpoint, formSize);
157
+ }
103
158
  export const calcDefaultValue = (step) => {
104
159
  switch (step.type) {
105
160
  case FormStepTypes.CHECKBOX:
@@ -120,17 +175,6 @@ export const calcDefaultValue = (step) => {
120
175
  return getRawText();
121
176
  else
122
177
  return '';
123
- case FormStepTypes.LOCATION:
124
- return step.defaultValue ?? null;
125
- case FormStepTypes.NUMBER: {
126
- const numStep = step;
127
- if (numStep.numberType === NumberStepType.MONEY ||
128
- numStep.numberType === NumberStepType.MEASURE ||
129
- numStep.numberType === NumberStepType.UNIT_PRICE) {
130
- return numStep.defaultValue ?? null;
131
- }
132
- return numStep.defaultValue ?? '';
133
- }
134
178
  case FormStepTypes.RATING:
135
179
  case FormStepTypes.DATEPICKER:
136
180
  case FormStepTypes.DATEPICKER_RANGE:
@@ -1,9 +1,8 @@
1
- import * as Steps from '../@Types/FormStep';
2
1
  import AYFFormStepTypes from '../constants/AYFFormStepTypes';
3
2
  import CBRFormStepTypes from '../constants/CBRFormStepTypes';
4
3
  import FormStepTypes, { ApiSelectorOptionTypes, ClassifierOptionTypes, EntityValueOptionTypes, OptionTypes, } from '../constants/FormStepTypes';
5
4
  import { describe, expect, test, vi } from 'vitest';
6
- import { calcDefaultValue, calcFillerSize, calcStepWidth, calcSubSteps, iterateNestedSteps } from './StepFunctions';
5
+ import { calcDefaultValue, calcFillerSize, calcStepWidth, calcSubSteps, iterateNestedSteps, resolveStepSpan, } from './StepFunctions';
7
6
  import { stringToDraft } from '../Utils/DraftFunctions';
8
7
  describe('StepFunctions', function () {
9
8
  describe('calcFillerSize', function () {
@@ -412,6 +411,37 @@ describe('StepFunctions', function () {
412
411
  expect(size).toBe(440);
413
412
  });
414
413
  });
414
+ describe('resolveStepSpan', function () {
415
+ const fourColumns = { blockNum: 4, blockSize: 210, spacingSize: 20 };
416
+ const desktop = { currentBreakPoint: 4, isMobile: false };
417
+ const threeColumns = { currentBreakPoint: 3, isMobile: false };
418
+ const tablet = { currentBreakPoint: 2, isMobile: false };
419
+ const mobile = { currentBreakPoint: 1, isMobile: true };
420
+ test('Legacy step derives every screen from the scalar size', async () => {
421
+ const step = { size: 3 };
422
+ expect(resolveStepSpan(step, desktop, fourColumns)).toBe(3);
423
+ expect(resolveStepSpan(step, tablet, fourColumns)).toBe(2);
424
+ expect(resolveStepSpan(step, mobile, fourColumns)).toBe(1);
425
+ });
426
+ test('Step without size falls back to full width', async () => {
427
+ expect(resolveStepSpan({}, desktop, fourColumns)).toBe(4);
428
+ expect(resolveStepSpan({}, tablet, fourColumns)).toBe(2);
429
+ });
430
+ test('Tablet override applies once at most 2 columns fit', async () => {
431
+ const step = { size: 2, sizes: { tablet: 1 } };
432
+ expect(resolveStepSpan(step, tablet, fourColumns)).toBe(1);
433
+ expect(resolveStepSpan(step, desktop, fourColumns)).toBe(2);
434
+ });
435
+ test('Reduced-but-wider states keep the desktop span', async () => {
436
+ const step = { size: 3, sizes: { tablet: 1 } };
437
+ expect(resolveStepSpan(step, threeColumns, fourColumns)).toBe(3);
438
+ });
439
+ test('Overrides are clamped to the columns of their screen', async () => {
440
+ const step = { size: 1, sizes: { tablet: 4, mobile: 3 } };
441
+ expect(resolveStepSpan(step, tablet, fourColumns)).toBe(2);
442
+ expect(resolveStepSpan(step, mobile, fourColumns)).toBe(1);
443
+ });
444
+ });
415
445
  describe('calcDefaultValue', function () {
416
446
  test('CheckBox', async () => {
417
447
  const defaultValue = calcDefaultValue({
@@ -497,13 +527,6 @@ describe('StepFunctions', function () {
497
527
  const defaultValue = calcDefaultValue(step);
498
528
  expect(defaultValue).toBe(null);
499
529
  });
500
- test('Location step type', async () => {
501
- const step = {
502
- type: FormStepTypes.LOCATION,
503
- };
504
- const defaultValue = calcDefaultValue(step);
505
- expect(defaultValue).toBe(null);
506
- });
507
530
  test('Mapper, FileUpload, CBRFormStep types', async () => {
508
531
  const step1 = {
509
532
  type: FormStepTypes.MAPPER,
@@ -535,52 +558,6 @@ describe('StepFunctions', function () {
535
558
  const defaultValue = calcDefaultValue(step);
536
559
  expect(defaultValue).toBeUndefined();
537
560
  });
538
- test('Number step type without defaultValue', async () => {
539
- const step1 = {
540
- type: FormStepTypes.NUMBER,
541
- numberType: Steps.NumberStepType.INTEGER,
542
- };
543
- const step2 = {
544
- type: FormStepTypes.NUMBER,
545
- numberType: Steps.NumberStepType.DECIMAL,
546
- };
547
- const step3 = {
548
- type: FormStepTypes.NUMBER,
549
- numberType: Steps.NumberStepType.PERCENTAGE,
550
- };
551
- const step4 = {
552
- type: FormStepTypes.NUMBER,
553
- numberType: Steps.NumberStepType.MONEY,
554
- };
555
- const step5 = {
556
- type: FormStepTypes.NUMBER,
557
- numberType: Steps.NumberStepType.MEASURE,
558
- };
559
- const step6 = {
560
- type: FormStepTypes.NUMBER,
561
- numberType: Steps.NumberStepType.UNIT_PRICE,
562
- };
563
- expect(calcDefaultValue(step1)).toBe('');
564
- expect(calcDefaultValue(step2)).toBe('');
565
- expect(calcDefaultValue(step3)).toBe('');
566
- expect(calcDefaultValue(step4)).toBe(null);
567
- expect(calcDefaultValue(step5)).toBe(null);
568
- expect(calcDefaultValue(step6)).toBe(null);
569
- });
570
- test('Number step type with defaultValue', async () => {
571
- const step1 = {
572
- type: FormStepTypes.NUMBER,
573
- numberType: Steps.NumberStepType.INTEGER,
574
- defaultValue: 42,
575
- };
576
- const step2 = {
577
- type: FormStepTypes.NUMBER,
578
- numberType: Steps.NumberStepType.MONEY,
579
- defaultValue: { value: 100, currency: 'USD' },
580
- };
581
- expect(calcDefaultValue(step1)).toBe(42);
582
- expect(calcDefaultValue(step2)).toEqual({ value: 100, currency: 'USD' });
583
- });
584
561
  });
585
562
  describe('iterateNestedSteps', function () {
586
563
  test('should iterate over nested steps', async () => {
@@ -1,15 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import ErkTextField from '../../../Shared/ErkTextField/ErkTextField';
3
3
  import styles from './MaterialTextInputStep.module.css';
4
- import { calcStepWidth } from '../../StepFunctions';
4
+ import { calcStepWidth, resolveStepSpan } from '../../StepFunctions';
5
5
  import { useContext } from 'react';
6
6
  import FormContext from '../../../Contexts/FormContext';
7
- import { selectBreakPoint, useAppSelector } from '../../../hooks';
7
+ import { selectWidthStats, useAppSelector } from '../../../hooks';
8
8
  import { useFormStep } from '../../StepHooks';
9
9
  function TextInputStep({ step, editable, maxLength, IconComponent, defaultValue = step.defaultValue, validation = step.validation, }) {
10
- const currentBreakPoint = useAppSelector(selectBreakPoint);
10
+ const widthStats = useAppSelector(selectWidthStats);
11
11
  const { postview } = useAppSelector((state) => state.global);
12
12
  const form = useContext(FormContext);
13
+ const span = resolveStepSpan(step, widthStats, form.size);
13
14
  const { ref, value, onChange, error, field } = useFormStep(step, {
14
15
  defaultValue: defaultValue ?? '',
15
16
  debounce: true,
@@ -27,7 +28,7 @@ function TextInputStep({ step, editable, maxLength, IconComponent, defaultValue
27
28
  },
28
29
  });
29
30
  return (_jsx("div", { className: styles.container, style: {
30
- width: currentBreakPoint <= step.size ? '100%' : calcStepWidth(step.size, form.size),
31
+ width: widthStats.currentBreakPoint <= span ? '100%' : calcStepWidth(span, form.size),
31
32
  minHeight: step.description || (!postview && editable && (step.required || validation)) ? '55px' : '43px',
32
33
  }, children: _jsx(ErkTextField, { ...field, value: value, inputRef: ref, labelMargin: 0, error: !!error, label: step.label, onChange: onChange, maxLength: maxLength, "data-testid": step.id, required: step.required, readOnly: !editable || postview, helperText: error?.message ?? step.description, IconComponent: step.showIcon ? IconComponent : undefined }) }));
33
34
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { calcStepWidth } from '../../StepFunctions';
2
+ import { calcStepWidth, resolveStepSpan } from '../../StepFunctions';
3
3
  import styles from './MaterialTitleStep.module.css';
4
4
  import { useAppSelector } from '../../../hooks';
5
5
  import FormContext from '../../../Contexts/FormContext';
@@ -16,7 +16,7 @@ function TitleStep({ step }) {
16
16
  const { formStyle } = useAppSelector((state) => state.global);
17
17
  const form = useContext(FormContext);
18
18
  const widthStats = useAppSelector((state) => state.widthStats);
19
- const size = step.size ?? form.size.blockNum;
19
+ const span = resolveStepSpan(step, widthStats, form.size);
20
20
  const title = useMemo(() => calcBaseDraft(value?.title ?? step.title), //Usa por defecto lo que venga en el value, pero no escucha cambios
21
21
  [step.title, value?.title]);
22
22
  const sourceTitle = useMemo(() => calcBaseDraft(step.title), [step.title]);
@@ -36,9 +36,9 @@ function TitleStep({ step }) {
36
36
  const path = useMemo(() => [...step.stepPath, step.id].join('.'), [step.stepPath, step.id]);
37
37
  return (_jsxs("div", { className: styles.container, style: {
38
38
  color: formStyle.textColor,
39
- width: widthStats.currentBreakPoint <= size ? '100%' : calcStepWidth(size, form.size),
39
+ width: widthStats.currentBreakPoint <= span ? '100%' : calcStepWidth(span, form.size),
40
40
  }, children: [_jsx("div", { className: styles.titleLbl, style: {
41
- textAlign: widthStats.isMobile && widthStats.currentBreakPoint <= size ? 'center' : 'start',
41
+ textAlign: widthStats.isMobile && widthStats.currentBreakPoint <= span ? 'center' : 'start',
42
42
  }, children: _jsx(SmartDraftRenderer, { draft: title, sourceDraft: sourceTitle, dependencies: values, property: `${path}.title`, onChange: (title) => onChange({ ...value, title }) }) }), _jsx("div", { className: styles.descriptionPar, children: _jsx(SmartDraftRenderer, { draft: description, sourceDraft: sourceDescription, dependencies: values, margin: title ? '10px 0px' : '0px 0px 5px 0px', property: `${path}.description`, onChange: (description) => onChange({ ...value, description }) }) })] }));
43
43
  }
44
44
  export default TitleStep;
@@ -1,23 +1,24 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useCallback, useContext, useState } from 'react';
3
3
  import { useFormContext } from 'react-hook-form';
4
- import { calcFillerSize } from '../../StepFunctions';
4
+ import { calcFillerSize, resolveStepSpan } from '../../StepFunctions';
5
5
  import FormContext from '../../../Contexts/FormContext';
6
6
  import styles from './StepFiller.module.css';
7
- import { selectBreakPoint, useAppSelector } from '../../../hooks';
7
+ import { selectWidthStats, useAppSelector } from '../../../hooks';
8
8
  import { SizeChangeContext } from './StepFillerContext';
9
9
  function StepFiller({ step, children }) {
10
10
  const { getValues } = useFormContext();
11
11
  const form = useContext(FormContext);
12
12
  const [fillerSize, setFillerSize] = useState(calcFillerSize(step, form.steps, getValues(), form.size));
13
- const currentBreakPoint = useAppSelector(selectBreakPoint);
13
+ const widthStats = useAppSelector(selectWidthStats);
14
+ const span = resolveStepSpan(step, widthStats, form.size);
14
15
  const handleSizeChange = useCallback(() => {
15
16
  setFillerSize(calcFillerSize(step, form.steps, getValues(), form.size));
16
17
  // eslint-disable-next-line react-hooks/exhaustive-deps
17
18
  }, []);
18
19
  if (step.maxSize && step.maxSize < form.size.blockNum) {
19
20
  return (_jsxs("div", { className: styles.firstLvlContainer, style: {
20
- width: currentBreakPoint <= step.size ? '100%' : 'fit-content',
21
+ width: widthStats.currentBreakPoint <= span ? '100%' : 'fit-content',
21
22
  }, children: [_jsx(SizeChangeContext.Provider, { value: handleSizeChange, children: children }), fillerSize > 0 && (_jsx("div", { className: styles.smallSeparator, style: {
22
23
  width: fillerSize,
23
24
  } }))] }));
@@ -1,15 +1,16 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useContext } from 'react';
3
3
  import FormContext from '../../../Contexts/FormContext';
4
- import { useAppSelector, selectBreakPoint } from '../../../hooks';
5
- import { calcStepWidth } from '../../StepFunctions';
4
+ import { useAppSelector, selectWidthStats } from '../../../hooks';
5
+ import { calcStepWidth, resolveStepSpan } from '../../StepFunctions';
6
6
  import styles from './MaterialInputContainer.module.css';
7
7
  function MaterialInputContainer({ step, editable, children, onClick, maxHeight = true, }) {
8
8
  const form = useContext(FormContext);
9
- const currentBreakPoint = useAppSelector(selectBreakPoint);
9
+ const widthStats = useAppSelector(selectWidthStats);
10
10
  const postview = useAppSelector((state) => state.global.postview);
11
+ const span = resolveStepSpan(step, widthStats, form.size);
11
12
  return (_jsx("div", { className: styles.container, style: {
12
- width: currentBreakPoint <= step.size ? '100%' : calcStepWidth(step.size, form.size),
13
+ width: widthStats.currentBreakPoint <= span ? '100%' : calcStepWidth(span, form.size),
13
14
  minHeight: maxHeight
14
15
  ? step.description || (!postview && editable && step.required)
15
16
  ? '55px'
@@ -2,9 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { useMemo } from 'react';
3
3
  import { format as dateFnsFormat, isValid } from 'date-fns';
4
4
  import { InputAdornment, styled, Dialog as MuiDialog } from '@mui/material';
5
- import { MobileDatePicker as MuiDatePicker, MobileDateTimePicker as MuiDateTimePicker, DatePickerToolbar as MuiDatePickerToolbar, DateTimePickerToolbar as MuiDateTimePickerToolbar, usePickerContext, PickerDay as MuiPickerDay, renderTimeViewClock, } from '@mui/x-date-pickers';
5
+ import { MobileDatePicker as MuiDatePicker, MobileDateTimePicker as MuiDateTimePicker, DatePickerToolbar as MuiDatePickerToolbar, DateTimePickerToolbar as MuiDateTimePickerToolbar, usePickerContext, } from '@mui/x-date-pickers';
6
+ import { PickerDay as MuiPickerDay } from '@mui/x-date-pickers/PickerDay';
6
7
  import { StyledTextField } from '../ErkTextField/ErkTextField';
7
8
  import CalendarIcon from '../../Icons/CalendarIcon';
9
+ import { renderTimeViewClock } from '@mui/x-date-pickers/timeViewRenderers';
8
10
  const StyledDateTimePicker = styled(MuiDateTimePicker, {
9
11
  shouldForwardProp: (propName) => propName !== 'size',
10
12
  })(({ disabled, readOnly, size }) => ({
@@ -126,11 +128,11 @@ const StyledDay = styled(MuiPickerDay)(({ theme }) => ({
126
128
  fontWeight: 500,
127
129
  fontSize: '0.9rem',
128
130
  lineHeight: 'normal',
129
- '&.Erk-MuiPickersDay-today': {
131
+ '&.Erk-MuiPickerDay-today': {
130
132
  backgroundColor: theme.palette.primary.main + '33',
131
133
  },
132
- '&.Erk-MuiPickersDay-dayOutsideMonth': {
133
- color: 'rgb(0,0,0,0.4)',
134
+ '&.Erk-MuiPickerDay-dayOutsideMonth': {
135
+ color: theme.palette.text.disabled,
134
136
  '&.Mui-selected': {
135
137
  color: theme.palette.primary.contrastText,
136
138
  },
@@ -169,14 +171,14 @@ function CustomDatePicker({ error, required, disabled, readOnly, helperText, siz
169
171
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
170
172
  orientation: _orientation, ...others }) {
171
173
  if (pickTime) {
172
- return (_jsx(StyledDateTimePicker, { ampm: true, size: size, reduceAnimations: true, ...others, label: label, disabled: disabled, readOnly: readOnly, showDaysOutsideCurrentMonth: true, slotProps: {
174
+ return (_jsx(StyledDateTimePicker, { ampm: true, size: size, reduceAnimations: true, orientation: "portrait", ...others, label: label, disabled: disabled, readOnly: readOnly, showDaysOutsideCurrentMonth: true, slotProps: {
173
175
  actionBar: {
174
176
  actions: ['clear', 'accept'],
175
177
  },
176
178
  layout: {
177
179
  sx: {
178
180
  //Pasar esto al componente de layout?
179
- backgroundColor: '#ffffff',
181
+ backgroundColor: 'background.paper',
180
182
  textTransform: 'capitalize',
181
183
  '& .Erk-MuiDayCalendar-weekDayLabel': {
182
184
  gridColumn: 1,
@@ -229,13 +231,13 @@ orientation: _orientation, ...others }) {
229
231
  } }));
230
232
  }
231
233
  else {
232
- return (_jsx(StyledDatePicker, { ...others, label: label, size: size, reduceAnimations: true, readOnly: readOnly, disabled: disabled, showDaysOutsideCurrentMonth: true, views: ['year', 'month', 'day'], slotProps: {
234
+ return (_jsx(StyledDatePicker, { ...others, label: label, size: size, reduceAnimations: true, orientation: "portrait", readOnly: readOnly, disabled: disabled, showDaysOutsideCurrentMonth: true, views: ['year', 'month', 'day'], slotProps: {
233
235
  actionBar: {
234
236
  actions: ['clear', 'accept'],
235
237
  },
236
238
  layout: {
237
239
  sx: {
238
- backgroundColor: '#ffffff',
240
+ backgroundColor: 'background.paper',
239
241
  textTransform: 'capitalize',
240
242
  '& .Erk-MuiDayCalendar-weekDayLabel': {
241
243
  cursor: 'default',
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { PickersShortcutsItem } from '@mui/x-date-pickers';
3
- import { MobileDateRangePickerProps as MuiDateRangePickerProps, DateRange } from '@mui/x-date-pickers-pro';
2
+ import { MobileDateRangePickerProps as MuiDateRangePickerProps } from '@mui/x-date-pickers-pro/MobileDateRangePicker';
3
+ import { DateRange } from '@mui/x-date-pickers-pro';
4
+ import { PickersShortcutsItem } from '@mui/x-date-pickers/PickersShortcuts';
4
5
  import { ErkTextFieldProps } from '../ErkTextField/ErkTextField';
5
6
  interface ErkDateRangePickerProps extends Omit<MuiDateRangePickerProps, 'ref' | 'onChange' | 'value' | 'slotProps'>, Pick<ErkTextFieldProps, 'error' | 'required' | 'helperText' | 'size'> {
6
7
  onChange?: (dateRange: DateRange<Date>) => void;
@@ -2,7 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React, { useMemo } from 'react';
3
3
  import { InputAdornment, styled, Dialog as MuiDialog } from '@mui/material';
4
4
  import { DatePickerToolbar as MuiDatePickerToolbar, usePickerContext, } from '@mui/x-date-pickers';
5
- import { MobileDateRangePicker as MuiDateRangePicker, DateRangePickerDay as MuiDateRangePickerDay, } from '@mui/x-date-pickers-pro';
5
+ import { MobileDateRangePicker as MuiDateRangePicker, } from '@mui/x-date-pickers-pro/MobileDateRangePicker';
6
+ import { DateRangePickerDay as MuiDateRangePickerDay } from '@mui/x-date-pickers-pro';
6
7
  import { format, isValid } from 'date-fns';
7
8
  import { StyledTextField } from '../ErkTextField/ErkTextField';
8
9
  import CalendarIcon from '../../Icons/CalendarIcon';
@@ -70,11 +71,11 @@ const StyledDay = styled(MuiDateRangePickerDay)(({ theme }) => ({
70
71
  fontWeight: 500,
71
72
  fontSize: '0.9rem',
72
73
  lineHeight: 'normal',
73
- '&.Erk-MuiPickersDay-today:not(.Erk-MuiDateRangePickerDay-rangeIntervalDayHighlight)': {
74
+ '&.Erk-MuiDateRangePickerDay-today:not(.Erk-MuiDateRangePickerDay-rangeIntervalDayHighlight)': {
74
75
  backgroundColor: theme.palette.primary.main + '33',
75
76
  },
76
- '&.Erk-MuiPickersDay-dayOutsideMonth': {
77
- color: 'rgb(0,0,0,0.4)',
77
+ '&.Erk-MuiDateRangePickerDay-dayOutsideMonth': {
78
+ color: theme.palette.text.disabled,
78
79
  '&.Mui-selected': {
79
80
  color: theme.palette.primary.contrastText,
80
81
  },
@@ -83,7 +84,7 @@ const StyledDay = styled(MuiDateRangePickerDay)(({ theme }) => ({
83
84
  backgroundColor: theme.palette.primary.main + '1a',
84
85
  },
85
86
  }));
86
- const CustomRangePickerField = React.forwardRef(function CustomRangePickerField({ error, required, helperText, size = 'small', labelMargin = 5, fullWidth = true, inputRef, }, ref) {
87
+ const CustomRangePickerField = React.forwardRef(function CustomRangePickerField({ error, required, helperText, size = 'small', labelMargin = 5, fullWidth = true, inputRef }, ref) {
87
88
  const { value, fieldFormat, setOpen, disabled, readOnly, label } = usePickerContext();
88
89
  const { displayValue, isInvalid } = useMemo(() => {
89
90
  const [startDate, endDate] = value ?? [null, null];
@@ -151,7 +152,7 @@ function CustomDatePickerRange({ error, disabled, readOnly, helperText, size = '
151
152
  shortcuts: shortcuts ? { items: shortcuts } : undefined,
152
153
  layout: {
153
154
  sx: {
154
- backgroundColor: '#ffffff',
155
+ backgroundColor: 'background.paper',
155
156
  textTransform: 'capitalize',
156
157
  '& .Erk-MuiDayCalendar-weekDayLabel': {
157
158
  cursor: 'default',
@@ -46,6 +46,7 @@ function CustomSelect({ value, onChange, label, error, required, pickDays, helpe
46
46
  },
47
47
  ], style: { zIndex: 1301 }, children: _jsxs("div", { className: styles.container, style: {
48
48
  paddingTop: error && helperText ? '0px' : '30px',
49
+ backgroundColor: palette.background.paper,
49
50
  }, children: [error && helperText && (_jsx("div", { className: styles.errorMessage, style: {
50
51
  color: palette.error.main,
51
52
  }, children: helperText })), pickDays && (_jsx("div", { className: styles.numberPickerContainer, children: _jsx(StyledTextField, { label: "D\u00EDas", type: "number", labelMargin: 0, value: (value?.days ?? minDays) + '', onChange: (event) => handleChange({ ...value, days: parseInt(event.target.value) }), slotProps: { htmlInput: { min: minDays, max: maxDays } } }) })), pickHours && (_jsx("div", { className: styles.numberPickerContainer, children: _jsx(StyledTextField, { label: "Horas", type: "number", labelMargin: 0, value: (value?.hours ?? minHours) + '', onChange: (event) => handleChange({ ...value, hours: parseInt(event.target.value) }), slotProps: { htmlInput: { min: minHours, max: maxHours } } }) })), pickMinutes && (_jsx("div", { className: styles.numberPickerContainer, children: _jsx(StyledTextField, { type: "number", label: "Minutos", labelMargin: 0, slotProps: { htmlInput: { min: minMinutes, max: maxMinutes } }, value: (value?.minutes ?? minMinutes) + '', onChange: (event) => handleChange({ ...value, minutes: parseInt(event.target.value) }) }) })), working === undefined && (_jsxs("div", { className: styles.workingContainer, children: ["H\u00E1biles:", _jsx(ErkToggle, { checked: !!value?.working, disabled: working !== undefined, onChange: (working) => {
@@ -6,7 +6,6 @@
6
6
  border-radius: 10px;
7
7
  overflow: hidden;
8
8
  position: relative;
9
- background-color: white;
10
9
  width: 130px;
11
10
  padding: 0px 35px 30px 30px;
12
11
  display: flex;
@@ -1,17 +1,19 @@
1
1
  import CBRFormStepTypes from '../constants/CBRFormStepTypes';
2
2
  export const calcCbrForm = (form, formValues) => {
3
+ /** Callers pass the form straight out of `createNextState`, whose result Immer deep-freezes. */
4
+ const steps = { ...form.steps };
3
5
  for (const step of Object.values(form.steps)) {
4
6
  if (step.type === CBRFormStepTypes.CBR_INCIDENCIAS) {
5
7
  const incidentStep = step;
6
8
  const incValue = formValues[incidentStep.id ?? ''];
7
9
  if (incValue) {
8
10
  for (const incident of incValue) {
9
- handleAddIncident(incident, incidentStep, form.steps, formValues);
11
+ handleAddIncident(incident, incidentStep, steps, formValues);
10
12
  }
11
13
  }
12
14
  }
13
15
  }
14
- return form;
16
+ return { ...form, steps };
15
17
  };
16
18
  const handleAddIncident = (incident, step, steps, formValues) => {
17
19
  const spaceStep = {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,123 @@
1
+ import { createNextState } from '@reduxjs/toolkit';
2
+ import { describe, expect, test } from 'vitest';
3
+ import CBRFormStepTypes from '../constants/CBRFormStepTypes';
4
+ import { calcCbrForm } from './CBRFunctions';
5
+ const INCIDENT = {
6
+ idSpaceStep: 'CBR_TIPO_ESPACIO-space1',
7
+ idElementStep: 'CBR_LOCATIVAS-element1',
8
+ idCommentStep: 'CBR_COMENTARIO-comment1',
9
+ num: 1,
10
+ };
11
+ /** Second element level, reached through the element value's `subStep` pointer. */
12
+ const ID_SUB_ELEMENT_STEP = 'CBR_LOCATIVAS-subElement1';
13
+ const FORM_VALUES = {
14
+ CBR_INCIDENCIAS: [INCIDENT],
15
+ [INCIDENT.idSpaceStep]: { id: '35362', label: 'Sala' },
16
+ [INCIDENT.idCommentStep]: 'GRAN HUMEDAD',
17
+ [INCIDENT.idElementStep]: {
18
+ id: '06',
19
+ label: 'CIELOS',
20
+ subStep: ID_SUB_ELEMENT_STEP,
21
+ },
22
+ [ID_SUB_ELEMENT_STEP]: { id: '0601', label: 'Cielo Falso' },
23
+ };
24
+ function buildForm() {
25
+ return {
26
+ name: 'Formulario PosVenta',
27
+ firstSection: 'FIRST',
28
+ sections: {
29
+ FIRST: {
30
+ id: 'FIRST',
31
+ name: '',
32
+ nextSection: null,
33
+ steps: ['CBR_INCIDENCIAS'],
34
+ },
35
+ },
36
+ steps: {
37
+ CBR_INCIDENCIAS: {
38
+ id: 'CBR_INCIDENCIAS',
39
+ type: CBRFormStepTypes.CBR_INCIDENCIAS,
40
+ label: 'Incidencias',
41
+ description: null,
42
+ addBtnLabel: 'Agregar',
43
+ required: true,
44
+ unitLabel: 'Incidencia',
45
+ dependencies: ['CBR_PROYECTO'],
46
+ spaceStep: {
47
+ label: 'Espacio',
48
+ description: null,
49
+ size: 1,
50
+ required: true,
51
+ showIcon: true,
52
+ searchable: true,
53
+ },
54
+ commentStep: {
55
+ label: 'Comentario',
56
+ description: null,
57
+ size: 1,
58
+ required: true,
59
+ },
60
+ elementStep: {
61
+ label: 'Elemento',
62
+ description: null,
63
+ size: 1,
64
+ required: true,
65
+ showIcon: true,
66
+ searchable: true,
67
+ subStep: {
68
+ label: 'Elemento Hijo',
69
+ description: null,
70
+ size: 1,
71
+ required: true,
72
+ showIcon: true,
73
+ searchable: true,
74
+ },
75
+ },
76
+ },
77
+ },
78
+ size: { blockNum: 4, blockSize: 210, spacingSize: 20 },
79
+ };
80
+ }
81
+ describe('calcCbrForm', function () {
82
+ test('expands every incident into its own space, comment and element steps', () => {
83
+ const result = calcCbrForm(buildForm(), FORM_VALUES);
84
+ expect(result.steps[INCIDENT.idSpaceStep]).toMatchObject({
85
+ id: INCIDENT.idSpaceStep,
86
+ type: CBRFormStepTypes.CBR_TIPO_ESPACIO,
87
+ });
88
+ expect(result.steps[INCIDENT.idCommentStep]).toMatchObject({
89
+ id: INCIDENT.idCommentStep,
90
+ type: CBRFormStepTypes.CBR_COMENTARIO,
91
+ });
92
+ expect(result.steps[INCIDENT.idElementStep]).toMatchObject({
93
+ id: INCIDENT.idElementStep,
94
+ type: CBRFormStepTypes.CBR_LOCATIVAS,
95
+ subStep: ID_SUB_ELEMENT_STEP,
96
+ });
97
+ expect(result.steps[ID_SUB_ELEMENT_STEP]).toMatchObject({
98
+ id: ID_SUB_ELEMENT_STEP,
99
+ type: CBRFormStepTypes.CBR_LOCATIVAS,
100
+ });
101
+ });
102
+ test('leaves the form it was given untouched', () => {
103
+ const form = buildForm();
104
+ calcCbrForm(form, FORM_VALUES);
105
+ expect(Object.keys(form.steps)).toEqual(['CBR_INCIDENCIAS']);
106
+ });
107
+ /**
108
+ * The caller hands the form straight out of `createNextState`, whose result Immer deep-freezes, so
109
+ * expanding the incidents by writing into that same `steps` object throws and leaves the form stuck
110
+ * loading forever.
111
+ */
112
+ test('expands a form frozen by createNextState', () => {
113
+ const frozenForm = createNextState(buildForm(), (draft) => {
114
+ draft.steps.CBR_INCIDENCIAS.idSection = 'FIRST';
115
+ });
116
+ expect(Object.isFrozen(frozenForm.steps)).toBe(true);
117
+ const result = calcCbrForm(frozenForm, FORM_VALUES);
118
+ expect(result.steps[INCIDENT.idSpaceStep]).toBeDefined();
119
+ expect(result.steps[INCIDENT.idCommentStep]).toBeDefined();
120
+ expect(result.steps[INCIDENT.idElementStep]).toBeDefined();
121
+ expect(result.steps[ID_SUB_ELEMENT_STEP]).toBeDefined();
122
+ });
123
+ });
@@ -42,6 +42,12 @@ function MaterialProviders({ children, formStyle = InternalFormStyle }) {
42
42
  primary: formStyle.textColor,
43
43
  secondary: formStyle.descriptionTextColor,
44
44
  },
45
+ // Paper follows the form surface so menus, pickers and dialogs match a non-white form
46
+ // (the admin's dark scheme in particular) instead of MUI's default white.
47
+ background: {
48
+ default: formStyle.standAloneBackgroundColor,
49
+ paper: formStyle.backgroundColor,
50
+ },
45
51
  },
46
52
  }, DatePickersEs //Potencialmente cambiar esto dependiendo de la empresa?
47
53
  ), children: _jsx(LocalizationProvider, { dateAdapter: AdapterDateFns, adapterLocale: getLocale(), children: children }) }));
@@ -0,0 +1,11 @@
1
+ import { FormStyle } from '../@Types/Form';
2
+ /**
3
+ * Inline surface for "pill" containers (mapper elements, incidents) that sit on a step.
4
+ * The tint and border are mixed from the form's own colors so they work on any form style,
5
+ * including the admin's dark scheme, instead of a fixed light grey.
6
+ * On the default light style this resolves to roughly #f0f0f0 / #d6d6d6, the previous fixed values.
7
+ */
8
+ export declare function pillSurfaceStyle(formStyle: FormStyle): {
9
+ backgroundColor: string;
10
+ borderColor: string;
11
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Inline surface for "pill" containers (mapper elements, incidents) that sit on a step.
3
+ * The tint and border are mixed from the form's own colors so they work on any form style,
4
+ * including the admin's dark scheme, instead of a fixed light grey.
5
+ * On the default light style this resolves to roughly #f0f0f0 / #d6d6d6, the previous fixed values.
6
+ */
7
+ export function pillSurfaceStyle(formStyle) {
8
+ const base = formStyle.stepBackgroundColor;
9
+ const text = formStyle.textColor;
10
+ return {
11
+ backgroundColor: `color-mix(in srgb, ${text} 7%, ${base})`,
12
+ borderColor: `color-mix(in srgb, ${text} 20%, ${base})`,
13
+ };
14
+ }