@inseefr/lunatic 3.0.0-rc.1 → 3.0.0-rc.11

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 (186) hide show
  1. package/lib/components/CheckboxBoolean/CheckboxBoolean.js +39 -19
  2. package/lib/components/CheckboxGroup/CheckboxGroup.js +3 -2
  3. package/lib/components/CheckboxGroup/CustomCheckboxGroup.js +4 -5
  4. package/lib/components/CheckboxGroup/CustomCheckboxGroup.spec.js +3 -0
  5. package/lib/components/CheckboxOne/CheckboxOne.js +6 -7
  6. package/lib/components/Datepicker/Datepicker.js +43 -29
  7. package/lib/components/Dropdown/Dropdown.js +37 -37
  8. package/lib/components/Duration/Duration.js +41 -17
  9. package/lib/components/FilterDescription/FilterDescription.js +2 -3
  10. package/lib/components/Input/Input.js +39 -22
  11. package/lib/components/InputNumber/InputNumber.js +45 -35
  12. package/lib/components/InputNumber/__snapshots__/InputNumber.spec.tsx.snap +0 -2
  13. package/lib/components/Loop/Loop.js +52 -29
  14. package/lib/components/LunaticComponents.js +60 -51
  15. package/lib/components/Question/Question.js +23 -14
  16. package/lib/components/Radio/Radio.js +2 -2
  17. package/lib/components/RosterForLoop/RosterForLoop.js +13 -36
  18. package/lib/components/Roundabout/CustomRoundabout.js +2 -2
  19. package/lib/components/Roundabout/Roundabout.js +0 -1
  20. package/lib/components/Roundabout/RoundaboutItButton.js +2 -2
  21. package/lib/components/Roundabout/extra.js +6 -6
  22. package/lib/components/Sequence/Sequence.js +2 -3
  23. package/lib/components/Subsequence/Subsequence.js +2 -2
  24. package/lib/components/Subsequence/Subsequence.spec.js +1 -1
  25. package/lib/components/Suggester/CustomSuggester.js +9 -6
  26. package/lib/components/Suggester/Suggester.js +67 -4
  27. package/lib/components/Suggester/SuggesterNotification.js +2 -2
  28. package/lib/components/Summary/Summary.js +3 -3
  29. package/lib/components/Switch/Switch.js +42 -22
  30. package/lib/components/Textarea/Textarea.js +43 -24
  31. package/lib/components/library.js +0 -2
  32. package/lib/components/shared/Button/Button.js +2 -3
  33. package/lib/components/shared/Button/IconButton.js +0 -1
  34. package/lib/components/shared/Checkbox/CheckboxOption.js +2 -3
  35. package/lib/components/shared/Combobox/Combobox.js +5 -4
  36. package/lib/components/shared/Combobox/ComboboxContainer.js +2 -2
  37. package/lib/components/shared/Combobox/ComboboxContentBox.js +2 -2
  38. package/lib/components/shared/Combobox/Panel/ComboboxOption.js +2 -2
  39. package/lib/components/shared/Combobox/Panel/ComboboxPanelContainer.js +2 -2
  40. package/lib/components/shared/Combobox/Selection/ComboboxClearButton.js +2 -2
  41. package/lib/components/shared/Combobox/Selection/ComboboxInput.js +2 -2
  42. package/lib/components/shared/Combobox/Selection/ComboboxLabelSelection.js +2 -2
  43. package/lib/components/shared/ComponentErrors/ComponentErrors.js +0 -1
  44. package/lib/components/shared/Declarations/Declarations.js +6 -7
  45. package/lib/components/shared/Declarations/Declarations.spec.js +5 -5
  46. package/lib/components/shared/Fieldset/Fieldset.js +2 -3
  47. package/lib/components/shared/HOC/{customizedComponent.js → slottableComponent.js} +35 -13
  48. package/lib/components/shared/Icons/lunatic-icon.js +0 -1
  49. package/lib/components/shared/Label/Label.js +2 -3
  50. package/lib/components/shared/MDLabel/RouterLink.js +2 -2
  51. package/lib/components/shared/Missing/Missing.js +0 -1
  52. package/lib/components/shared/ModalControls/ModalControls.js +0 -1
  53. package/lib/components/shared/Notification.js +2 -2
  54. package/lib/components/shared/Radio/RadioGroup.js +4 -4
  55. package/lib/components/shared/Radio/RadioOption.js +2 -2
  56. package/lib/components/shared/Table/Table.js +2 -3
  57. package/lib/components/shared/Table/Tbody.js +2 -2
  58. package/lib/components/shared/Table/Td.js +2 -2
  59. package/lib/components/shared/Table/Th.js +2 -2
  60. package/lib/components/shared/Table/Thead.js +2 -2
  61. package/lib/components/shared/Table/Tr.js +2 -2
  62. package/lib/components/shared/VariableStatus/VariableStatus.js +0 -1
  63. package/lib/components/shared/suggester-loader-widget/dragger/dragger.js +0 -1
  64. package/lib/components/shared/suggester-loader-widget/widget.js +0 -1
  65. package/lib/css/components/Button.scss +24 -0
  66. package/lib/css/components/CheckboxGroup.scss +13 -0
  67. package/lib/css/components/CheckboxOne.scss +19 -0
  68. package/lib/css/components/CheckboxOption.scss +19 -0
  69. package/lib/css/components/Combobox.scss +206 -0
  70. package/lib/css/components/ComponentErrors.scss +5 -0
  71. package/lib/css/components/Datepicker.scss +19 -0
  72. package/lib/css/components/Declarations.scss +42 -0
  73. package/lib/css/components/Dragger.scss +8 -0
  74. package/lib/css/components/Dropdown.scss +38 -0
  75. package/lib/css/components/Duration.scss +9 -0
  76. package/lib/css/components/Fieldset.scss +5 -0
  77. package/lib/css/components/IconButton.scss +38 -0
  78. package/lib/css/components/Input.scss +42 -0
  79. package/lib/css/components/InputNumber.scss +11 -0
  80. package/lib/css/components/Label.scss +6 -0
  81. package/lib/css/components/Missing.scss +27 -0
  82. package/lib/css/components/ModalControls.scss +48 -0
  83. package/lib/css/components/RadioGroup.scss +21 -0
  84. package/lib/css/components/RosterForLoop.scss +39 -0
  85. package/lib/css/components/Roundabout.scss +13 -0
  86. package/lib/css/components/Sequence.scss +10 -0
  87. package/lib/css/components/Suggester.scss +170 -0
  88. package/lib/css/components/SuggesterWidget.scss +176 -0
  89. package/lib/css/components/Table.scss +27 -0
  90. package/lib/css/components/Textarea.scss +8 -0
  91. package/lib/css/components/VariableStatus.scss +36 -0
  92. package/lib/css/main.scss +181 -0
  93. package/lib/hooks/useSuggesterInfo.js +14 -12
  94. package/lib/main.css +1063 -0
  95. package/lib/main.css.map +1 -0
  96. package/lib/src/components/CheckboxBoolean/CheckboxBoolean.d.ts +10 -5
  97. package/lib/src/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
  98. package/lib/src/components/CheckboxOne/CheckboxOne.d.ts +5 -12
  99. package/lib/src/components/Datepicker/Datepicker.d.ts +8 -10
  100. package/lib/src/components/Dropdown/Dropdown.d.ts +9 -12
  101. package/lib/src/components/Duration/Duration.d.ts +9 -7
  102. package/lib/src/components/FilterDescription/FilterDescription.d.ts +1 -1
  103. package/lib/src/components/Input/Input.d.ts +9 -8
  104. package/lib/src/components/InputNumber/InputNumber.d.ts +9 -10
  105. package/lib/src/components/Loop/Loop.d.ts +11 -18
  106. package/lib/src/components/LunaticComponents.d.ts +4 -2
  107. package/lib/src/components/Question/Question.d.ts +6 -4
  108. package/lib/src/components/RosterForLoop/RosterForLoop.d.ts +2 -22
  109. package/lib/src/components/Roundabout/Roundabout.d.ts +0 -1
  110. package/lib/src/components/Sequence/Sequence.d.ts +1 -2
  111. package/lib/src/components/Subsequence/Subsequence.d.ts +1 -1
  112. package/lib/src/components/Suggester/CustomSuggester.d.ts +7 -3
  113. package/lib/src/components/Suggester/Suggester.d.ts +1 -2
  114. package/lib/src/components/Suggester/SuggesterType.d.ts +6 -0
  115. package/lib/src/components/Suggester/helpers.d.ts +2 -2
  116. package/lib/src/components/Switch/Switch.d.ts +9 -0
  117. package/lib/src/components/Textarea/Textarea.d.ts +9 -10
  118. package/lib/src/components/library.d.ts +26 -93
  119. package/lib/src/components/shared/Button/Button.d.ts +0 -1
  120. package/lib/src/components/shared/Button/IconButton.d.ts +0 -1
  121. package/lib/src/components/shared/Checkbox/CheckboxOption.d.ts +0 -1
  122. package/lib/src/components/shared/Combobox/Combobox.d.ts +1 -1
  123. package/lib/src/components/shared/ComponentErrors/ComponentErrors.d.ts +0 -1
  124. package/lib/src/components/shared/Declarations/Declarations.d.ts +2 -3
  125. package/lib/src/components/shared/Fieldset/Fieldset.d.ts +0 -1
  126. package/lib/src/components/shared/HOC/slottableComponent.d.ts +105 -0
  127. package/lib/src/components/shared/Icons/lunatic-icon.d.ts +0 -1
  128. package/lib/src/components/shared/Label/Label.d.ts +0 -1
  129. package/lib/src/components/shared/Missing/Missing.d.ts +0 -1
  130. package/lib/src/components/shared/ModalControls/ModalControls.d.ts +0 -1
  131. package/lib/src/components/shared/Radio/RadioGroup.d.ts +1 -1
  132. package/lib/src/components/shared/Table/Table.d.ts +0 -1
  133. package/lib/src/components/shared/VariableStatus/VariableStatus.d.ts +0 -1
  134. package/lib/src/components/shared/suggester-loader-widget/dragger/dragger.d.ts +0 -1
  135. package/lib/src/components/shared/suggester-loader-widget/widget.d.ts +0 -1
  136. package/lib/src/components/type.d.ts +7 -7
  137. package/lib/src/hooks/use-track-changes.d.ts +9 -1
  138. package/lib/src/hooks/useSuggesterInfo.d.ts +1 -1
  139. package/lib/src/index.d.ts +1 -1
  140. package/lib/src/use-lunatic/commons/fill-components/fill-component-required.d.ts +106 -59
  141. package/lib/src/use-lunatic/commons/fill-components/fill-from-state.d.ts +87 -58
  142. package/lib/src/use-lunatic/commons/fill-components/fill-iterations.d.ts +47 -38
  143. package/lib/src/use-lunatic/commons/fill-components/fill-specific-expression.d.ts +159 -87
  144. package/lib/src/use-lunatic/commons/use-components-from-state.d.ts +1 -1
  145. package/lib/src/use-lunatic/lunatic-context.d.ts +1 -4
  146. package/lib/src/use-lunatic/replace-component-sequence.d.ts +23 -5
  147. package/lib/src/use-lunatic/type-source.d.ts +55 -46
  148. package/lib/src/use-lunatic/type.d.ts +4 -4
  149. package/lib/src/use-lunatic/use-lunatic.d.ts +63 -32
  150. package/lib/src/utils/variables.d.ts +10 -2
  151. package/lib/stories/{component-set/component-set.stories.js → behaviour/slots.stories.js} +36 -25
  152. package/lib/stories/checkbox-group/checkbox-group.stories.js +1 -6
  153. package/lib/stories/disabled/source.json +1 -1
  154. package/lib/stories/loop/source-roster.json +2 -2
  155. package/lib/stories/pairwise/pairwise-links.stories.js +1 -9
  156. package/lib/stories/suggester/fakeReferentiel.json +12 -0
  157. package/lib/stories/suggester/source-option-responses.json +145 -0
  158. package/lib/stories/suggester/suggester.stories.js +45 -7
  159. package/lib/stories/utils/orchestrator.js +4 -4
  160. package/lib/use-lunatic/commons/fill-components/fill-specific-expression.js +0 -1
  161. package/lib/use-lunatic/lunatic-context.js +2 -10
  162. package/lib/use-lunatic/replace-component-sequence.js +2 -3
  163. package/lib/use-lunatic/use-lunatic.js +1 -4
  164. package/lib/use-lunatic/use-lunatic.test.js +12 -37
  165. package/lib/use-lunatic/use-suggesters.js +23 -24
  166. package/package.json +2 -2
  167. package/lib/components/ComponentSet/ComponentSet.js +0 -68
  168. package/lib/components/Dropdown/DropdownWritable.js +0 -58
  169. package/lib/components/Dropdown/renderer/WritableLabelRenderer.js +0 -38
  170. package/lib/components/Dropdown/renderer/WritableOptionRenderer.js +0 -140
  171. package/lib/src/components/ComponentSet/ComponentSet.d.ts +0 -7
  172. package/lib/src/components/Dropdown/DropdownWritable.d.ts +0 -17
  173. package/lib/src/components/Dropdown/renderer/WritableLabelRenderer.d.ts +0 -8
  174. package/lib/src/components/Dropdown/renderer/WritableOptionRenderer.d.ts +0 -8
  175. package/lib/src/components/shared/HOC/customizedComponent.d.ts +0 -5
  176. package/lib/src/components/type-custom.d.ts +0 -101
  177. package/lib/stories/checkbox-group/sourceComponentset.json +0 -424
  178. package/lib/stories/component-set/data-loop.json +0 -18
  179. package/lib/stories/component-set/data-roundabout.json +0 -25
  180. package/lib/stories/component-set/data.json +0 -25
  181. package/lib/stories/component-set/source-loop.json +0 -308
  182. package/lib/stories/component-set/source-roundabout.json +0 -434
  183. package/lib/stories/component-set/source.json +0 -113
  184. package/lib/stories/pairwise/source-componentset.json +0 -292
  185. package/lib/stories/suggester/source-component-set.json +0 -113
  186. /package/lib/components/{type-custom.js → Suggester/SuggesterType.js} +0 -0
@@ -0,0 +1,170 @@
1
+ @mixin defaultFont {
2
+ font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
3
+ }
4
+
5
+ @mixin selection() {
6
+ @include defaultFont();
7
+ }
8
+
9
+ @mixin placeholderList {
10
+ color: gray;
11
+ @include defaultFont();
12
+ font-size: 15px;
13
+ line-height: 34px;
14
+ vertical-align: middle;
15
+ font-weight: normal;
16
+ }
17
+
18
+ @mixin icon($name) {
19
+ &::before {
20
+ --icon-size: 2rem;
21
+ display: block;
22
+ float: left;
23
+ flex: 0 0 auto;
24
+ background-color: white;
25
+ width: var(--icon-size);
26
+ height: var(--icon-size);
27
+ -webkit-mask-size: 100% 100%;
28
+ mask-size: 100% 100%;
29
+ -webkit-mask-image: url($name);
30
+ mask-image: url($name);
31
+ content: '';
32
+ margin-left: -48px;
33
+ margin-top: 12px;
34
+ }
35
+ }
36
+
37
+ .lunatic-component {
38
+ .lunatic-suggester-message-error {
39
+ border: solid 1px darkred;
40
+ color: darkred;
41
+ background-color: tomato;
42
+ display: inline-block;
43
+ border-radius: 3px;
44
+ padding: 4px 8px;
45
+ margin: 4px 4px;
46
+ }
47
+
48
+ .lunatic-suggester-default-style {
49
+ &.lunatic-suggester-container {
50
+ margin-bottom: 10px;
51
+ .lunatic-suggester {
52
+ min-height: 30px;
53
+ min-width: 260px;
54
+ width: 100%;
55
+ .lunatic-suggester-content {
56
+
57
+ &.focused {
58
+ .lunatic-suggester-selection {
59
+ }
60
+ }
61
+
62
+ .lunatic-suggester-selection {
63
+ border-radius: 5px;
64
+ border: 2px solid var(--color-primary-dark);
65
+ background-color: white;
66
+ &:hover {
67
+ border-color: var(--color-primary-main);
68
+ }
69
+ .lunatic-suggester-input {
70
+ height: 34px;
71
+ line-height: 34px;
72
+ font-size: 15px;
73
+ padding-left: 4px;
74
+ @include selection();
75
+
76
+ &::placeholder {
77
+ @include placeholderList();
78
+ }
79
+ }
80
+
81
+ .lunatic-suggester-selected {
82
+ height: 34px;
83
+ line-height: 34px;
84
+ background-color: white;
85
+ border-radius: 5px;
86
+ padding-left: 4px;
87
+ @include selection();
88
+
89
+ .placeholderList {
90
+ display: block;
91
+ @include placeholderList();
92
+ }
93
+ .selection {
94
+ display: block;
95
+ line-height: 34px;
96
+ font-size: 15px;
97
+ }
98
+
99
+ &.disabled {
100
+ background-color: var(--color-disabled);
101
+ }
102
+ }
103
+ }
104
+
105
+ .lunatic-suggester-panel {
106
+ @include defaultFont();
107
+ height: 0;
108
+ opacity: 0;
109
+ background-color: white;
110
+ transition: opacity 267ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
111
+ transform 178ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
112
+ &.expended {
113
+ border: solid 1px var(--color-primary-light);
114
+ opacity: 1;
115
+ min-height: 30px;
116
+ height: max-content;
117
+ box-shadow: 0 2px 2px grey;
118
+ border-radius: 4px;
119
+ }
120
+ .lunatic-suggester-option {
121
+ text-overflow: ellipsis;
122
+ white-space: nowrap;
123
+ overflow: hidden;
124
+ margin-bottom: 0.1em;
125
+ line-height: 2rem;
126
+ display: block;
127
+ &.selected {
128
+ color: var(--color-primary-dark);
129
+ background-color: var(--color-dropdown-selected);
130
+ }
131
+ &:hover {
132
+ background-color: var(--color-primary-main);
133
+ color: white;
134
+ }
135
+ }
136
+ }
137
+ }
138
+ }
139
+ }
140
+ }
141
+
142
+ .lunatic-notification {
143
+ line-height: 34px;
144
+ margin: 2px 2px;
145
+ padding: 1px 1px 1px 60px;
146
+
147
+ &.info {
148
+ background-color: lightblue;
149
+ @include icon('./icons/wait-icon.svg');
150
+ }
151
+ &.warn {
152
+ background-color: orange;
153
+ @include icon('./icons/warn-icon.svg');
154
+ }
155
+ &.error {
156
+ background-color: crimson;
157
+ @include icon('./icons/alert-icon.svg');
158
+ }
159
+
160
+ .lunatic-notification-container {
161
+ background-color: white;
162
+ padding: 0 15px;
163
+ .title {
164
+ font-weight: bold;
165
+ font-size: large;
166
+ margin-bottom: 3px;
167
+ }
168
+ }
169
+ }
170
+ }
@@ -0,0 +1,176 @@
1
+ $colorA: #e9d0d0;
2
+ $colorB: darkred;
3
+ $colorC: #320000;
4
+ $colorD: goldenrod;
5
+
6
+ @mixin preventSelect() {
7
+ -moz-user-select: -moz-none;
8
+ -khtml-user-select: none;
9
+ -webkit-user-select: none;
10
+ }
11
+
12
+ @mixin onDrag() {
13
+ &.drag {
14
+ box-shadow: $colorD 0px 3px 8px;
15
+ transition: box-shadow 0.5s;
16
+ }
17
+ }
18
+
19
+ .lunatic-suggester-widget-container {
20
+ &.absolute {
21
+ position: fixed;
22
+ z-index: 1;
23
+ }
24
+ .lunatic-suggester-widget {
25
+ position: relative;
26
+ border: solid $colorB 2px;
27
+ background-color: $colorA;
28
+ padding: 4px 4px;
29
+ border: 2px 2px;
30
+ width: 400px;
31
+ box-shadow: $colorC 0px 3px 8px;
32
+
33
+ @include onDrag();
34
+
35
+ .widget-row {
36
+ height: 22px;
37
+ display: flex;
38
+ flex-direction: row;
39
+ margin-bottom: 1px;
40
+ .store-name {
41
+ width: 60%;
42
+ color: $colorB;
43
+ font-size: 18px;
44
+ white-space: nowrap;
45
+ overflow-x: hidden;
46
+ }
47
+ .stats {
48
+ color: $colorB;
49
+ font-size: 18px;
50
+ white-space: nowrap;
51
+ overflow-x: hidden;
52
+ width: 40%;
53
+ }
54
+ .widget-button {
55
+ margin: 0 1px 0 0;
56
+ padding: 0;
57
+ border: none;
58
+ width: 18px;
59
+ height: 18px;
60
+ background-color: $colorB;
61
+
62
+ &.disabled {
63
+ background-color: gray;
64
+ cursor: default;
65
+ }
66
+
67
+ &:hover {
68
+ background-color: $colorC;
69
+ transition: background-color 1s;
70
+ cursor: pointer;
71
+ }
72
+
73
+ .lunatic-suggester-icon {
74
+ svg {
75
+ width: 18px;
76
+ height: 18px;
77
+ fill: $colorA;
78
+ }
79
+ }
80
+ }
81
+
82
+ .lunatic-suggester-loader-progress {
83
+ height: inherit;
84
+ border: solid 1px $colorB;
85
+ border-radius: 2px;
86
+ width: 70%;
87
+
88
+ &.done {
89
+ &:hover {
90
+ border-color: $colorC;
91
+ transition: border-color 1s;
92
+ .progress {
93
+ background-color: $colorC;
94
+ transition: background-color 1s;
95
+ }
96
+
97
+ cursor: pointer;
98
+ }
99
+ }
100
+
101
+ .content {
102
+ padding: 2px 2px;
103
+ height: calc(100%);
104
+ width: 100%;
105
+ .progress {
106
+ background-color: $colorB;
107
+ height: 100%;
108
+ }
109
+ }
110
+ }
111
+ }
112
+
113
+ .suggester-widget-network {
114
+ position: absolute;
115
+ border: solid $colorB 2px;
116
+ left: 6px;
117
+ background-color: $colorA;
118
+ border-radius: 50%;
119
+ padding: 2px 2px;
120
+ left: -22px;
121
+ top: -22px;
122
+ box-shadow: $colorC 0px 3px 8px;
123
+
124
+ &.online {
125
+ svg {
126
+ fill: forestgreen;
127
+ }
128
+ }
129
+
130
+ svg {
131
+ width: 24px;
132
+ height: 24px;
133
+ fill: $colorB;
134
+ }
135
+
136
+ @include onDrag();
137
+ }
138
+
139
+ .lunatic-widget-tools {
140
+ position: absolute;
141
+ right: 0;
142
+ top: -18px;
143
+ margin-top: -4px;
144
+
145
+ .lunatic-action-tool {
146
+ display: inline-block;
147
+ height: 18px;
148
+ width: 18px;
149
+ background-color: $colorB;
150
+ border-radius: 50%;
151
+ margin-left: 2px;
152
+
153
+ &:hover {
154
+ box-shadow: $colorC 0px 3px 8px;
155
+ }
156
+
157
+ &.drag {
158
+ background-color: $colorD;
159
+ transition: background-color 0.5s;
160
+ }
161
+
162
+ .on-drag-icon {
163
+ cursor: grab;
164
+ &.drag {
165
+ cursor: grabbing;
166
+ }
167
+ svg {
168
+ width: 16px;
169
+ height: 16px;
170
+ fill: $colorA;
171
+ }
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }
@@ -0,0 +1,27 @@
1
+ .lunatic-component {
2
+ .lunatic-table {
3
+ table-layout: fixed;
4
+ border-collapse: collapse;
5
+ margin-top: 0.3em;
6
+ margin-bottom: 0.3em;
7
+ & td,
8
+ th {
9
+ border: 0.15em solid var(--color-primary-dark);
10
+ padding: 0.2em;
11
+ font-size: 13px;
12
+ }
13
+ & td {
14
+ .field,
15
+ .field-with-tooltip {
16
+ display: flex;
17
+ justify-content: center;
18
+ align-items: center;
19
+ }
20
+ }
21
+ }
22
+
23
+ .table-lunatic .tooltip-lunatic img {
24
+ height: 20px;
25
+ width: 20px;
26
+ }
27
+ }
@@ -0,0 +1,8 @@
1
+ // see input.scss
2
+
3
+ .lunatic-component {
4
+ .textarea-lunatic {
5
+ height: 3em;
6
+ width: 100%;
7
+ }
8
+ }
@@ -0,0 +1,36 @@
1
+ .lunatic-component-container-test {
2
+ display: flex;
3
+
4
+ .lunatic-component-body {
5
+ width: 80%;
6
+ }
7
+
8
+ /* Tooltip container */
9
+ .tooltip-lunatic {
10
+ margin: auto;
11
+ width: 20%;
12
+ position: relative;
13
+ display: block;
14
+ margin-left: auto;
15
+ margin-right: auto;
16
+ }
17
+
18
+ /* Tooltip text */
19
+ .tooltip-lunatic .tooltip-text {
20
+ min-width: 10em;
21
+ max-width: 20em;
22
+ background-color: var(--color-primary-dark);
23
+ color: #fff;
24
+ padding: 0.5em;
25
+ border-radius: 6px;
26
+ font-size: 1em;
27
+ &.place-left {
28
+ &::before {
29
+ border-left: 10px solid var(--color-primary-dark);
30
+ }
31
+ &::after {
32
+ content: none;
33
+ }
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,181 @@
1
+ * {
2
+ box-sizing: border-box;
3
+ --color-primary-dark: #2a5885;
4
+ --color-primary-light: #5181b8;
5
+ --color-primary-main: #4a73a4;
6
+ --color-primary-contrast-text: #ffffff;
7
+
8
+ --color-secondary-dark: #14202d;
9
+ --color-secondary-light: #f7f8fa;
10
+ --color-secondary-main: #1a293b;
11
+ --color-secondary-contrast-text: #ffffff;
12
+
13
+ --color-very-light: #dbe4ef;
14
+ --color-very-very-light: #e6eaee;
15
+ --color-current-item: #0d823e;
16
+
17
+ --color-error: #f50c0c;
18
+ --color-disabled: rgb(235, 235, 228);
19
+ --color-prefix: cornflowerblue;
20
+ --color-dropdown-active: rgba(0, 0, 0, 0.04);
21
+ --color-dropdown-selected: rgba(0, 0, 0, 0.08);
22
+
23
+ --dropdown-transition-time: 0.5s;
24
+ }
25
+
26
+ @mixin vertical-placement($reverse: false) {
27
+ display: flex;
28
+ flex-direction: if($reverse, column-reverse, column);
29
+ }
30
+
31
+ @mixin horizontal-placement($reverse: false) {
32
+ display: flex;
33
+ flex-direction: if($reverse, row-reverse, row);
34
+ align-items: baseline;
35
+
36
+ :first-child {
37
+ margin-right: 1rem;
38
+ }
39
+ }
40
+
41
+ .lunatic-component {
42
+ .mandatory:after {
43
+ content: ' *';
44
+ color: red;
45
+ }
46
+ .horizontal-options {
47
+ display: inline-block;
48
+ margin-right: 2em;
49
+ }
50
+
51
+ // Label & Legend
52
+ label,
53
+ legend,
54
+ .subsequence-lunatic,
55
+ .lunatic-dropdown-label,
56
+ .lunatic-dropdown-label focused {
57
+ color: var(--color-primary-dark);
58
+ background-color: var(--color-primary-contrast-text);
59
+ border: 0;
60
+ padding: 0;
61
+ font-size: 0.75rem;
62
+ font-family: 'Roboto', 'Helvetica', 'Arial', sans-serif;
63
+ font-weight: bold;
64
+ margin-bottom: 0.375rem;
65
+ }
66
+
67
+ /* refactor proposition */
68
+
69
+ // .lunatic-component {
70
+ // width: fit-content;
71
+ // }
72
+
73
+ .lunatic-component-container {
74
+ display: flex;
75
+
76
+ &.label-left-ex {
77
+ flex-direction: row;
78
+ align-items: baseline;
79
+ .lunatic-label {
80
+ margin-right: 1em;
81
+ }
82
+ }
83
+ &.label-right-ex {
84
+ flex-direction: row-reverse;
85
+ align-items: baseline;
86
+ .lunatic-label {
87
+ margin-left: 1em;
88
+ }
89
+ }
90
+ &.label-top-ex {
91
+ flex-direction: column;
92
+ }
93
+ &.label-bottom-ex {
94
+ flex-direction: column-reverse;
95
+ }
96
+ }
97
+
98
+ /******/
99
+
100
+ .label-top {
101
+ @include vertical-placement();
102
+ }
103
+ .label-bottom {
104
+ @include vertical-placement(true);
105
+ }
106
+ .label-right {
107
+ justify-content: flex-end;
108
+ @include horizontal-placement(true);
109
+ }
110
+ .label-left {
111
+ @include horizontal-placement();
112
+ }
113
+
114
+ .field-container {
115
+ display: flex;
116
+ }
117
+
118
+ .modality-label p {
119
+ display: inline;
120
+ }
121
+
122
+ .field {
123
+ width: 100%;
124
+ position: relative;
125
+ }
126
+
127
+ .link-md {
128
+ border-bottom: dashed 0.1em var(--color-primary-dark);
129
+ &:hover {
130
+ cursor: help;
131
+ color: var(--color-primary-contrast-text);
132
+ background-color: var(--color-primary-dark);
133
+ }
134
+ }
135
+
136
+ .tooltip-content {
137
+ min-width: 15em;
138
+ max-width: 25em;
139
+ background: var(--color-primary-dark);
140
+ color: var(--color-primary-contrast-text);
141
+ padding: 0.5em;
142
+ border-radius: 6px;
143
+ font-size: 1em;
144
+ &.place-bottom {
145
+ &::before {
146
+ border-bottom: 10px solid var(--color-primary-dark);
147
+ }
148
+ &::after {
149
+ content: none;
150
+ }
151
+ }
152
+ }
153
+ }
154
+
155
+ @import "./components/Button.scss";
156
+ @import "./components/CheckboxGroup.scss";
157
+ @import "./components/CheckboxOne.scss";
158
+ @import "./components/CheckboxOption.scss";
159
+ @import "./components/Combobox.scss";
160
+ @import "./components/ComponentErrors.scss";
161
+ @import "./components/Datepicker.scss";
162
+ @import "./components/Declarations.scss";
163
+ @import "./components/Dropdown.scss";
164
+ @import "./components/Duration.scss";
165
+ @import "./components/Fieldset.scss";
166
+ @import "./components/IconButton.scss";
167
+ @import "./components/Input.scss";
168
+ @import "./components/InputNumber.scss";
169
+ @import "./components/Label.scss";
170
+ @import "./components/Missing.scss";
171
+ @import "./components/ModalControls.scss";
172
+ @import "./components/RadioGroup.scss";
173
+ @import "./components/RosterForLoop.scss";
174
+ @import "./components/Roundabout.scss";
175
+ @import "./components/Sequence.scss";
176
+ @import "./components/Suggester.scss";
177
+ @import "./components/Table.scss";
178
+ @import "./components/Textarea.scss";
179
+ @import "./components/VariableStatus.scss";
180
+ @import "./components/Dragger";
181
+ @import "./components/SuggesterWidget";
@@ -21,14 +21,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
21
  * Retrieves suggester info from indexedDB
22
22
  */
23
23
  function useSuggesterInfo(storeName, version) {
24
- var _useState = (0, _react.useState)(),
24
+ var _useState = (0, _react.useState)({
25
+ type: 'Loading'
26
+ }),
25
27
  _useState2 = _slicedToArray(_useState, 2),
26
- infos = _useState2[0],
27
- setInfos = _useState2[1];
28
- var _useState3 = (0, _react.useState)('Loading'),
29
- _useState4 = _slicedToArray(_useState3, 2),
30
- state = _useState4[0],
31
- setState = _useState4[1];
28
+ state = _useState2[0],
29
+ setState = _useState2[1];
32
30
  var fetchInfos = (0, _react.useCallback)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
33
31
  var db, info;
34
32
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -44,15 +42,19 @@ function useSuggesterInfo(storeName, version) {
44
42
  case 6:
45
43
  info = _context.sent;
46
44
  if (db && info) {
47
- setState('Ready');
48
- setInfos(info);
45
+ setState({
46
+ type: 'Ready',
47
+ info: info
48
+ });
49
49
  }
50
50
  _context.next = 13;
51
51
  break;
52
52
  case 10:
53
53
  _context.prev = 10;
54
54
  _context.t0 = _context["catch"](0);
55
- setState('Error');
55
+ setState({
56
+ type: 'Error'
57
+ });
56
58
  case 13:
57
59
  case "end":
58
60
  return _context.stop();
@@ -60,8 +62,8 @@ function useSuggesterInfo(storeName, version) {
60
62
  }, _callee, null, [[0, 10]]);
61
63
  })), [storeName, version]);
62
64
  return {
63
- infos: infos,
64
- state: state,
65
+ state: state.type,
66
+ infos: 'info' in state ? state.info : undefined,
65
67
  fetchInfos: fetchInfos
66
68
  };
67
69
  }