@digigov/react-modules 1.2.0-daaf7bdf → 1.2.0-e7d30530

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 (87) hide show
  1. package/Faq/Faq.stories.d.ts +8 -0
  2. package/Faq/Results/index.js +29 -0
  3. package/{ReactModules.stories → Faq/Results}/package.json +1 -1
  4. package/Faq/Results.d.ts +9 -0
  5. package/Faq/Results.js.map +7 -0
  6. package/Faq/__stories__/Default.d.ts +2 -0
  7. package/Faq/hooks/index.js +66 -0
  8. package/{FilteredResults/__stories__/Default → Faq/hooks}/package.json +1 -1
  9. package/Faq/hooks.d.ts +15 -0
  10. package/Faq/hooks.js.map +7 -0
  11. package/Faq/index.d.ts +43 -0
  12. package/Faq/index.js +169 -0
  13. package/Faq/index.js.map +7 -0
  14. package/Faq/index.test.d.ts +1 -0
  15. package/{FilteredResults/FilteredResults.stories → Faq}/package.json +1 -1
  16. package/Faq/slug/index.js +97 -0
  17. package/Faq/slug/package.json +6 -0
  18. package/Faq/slug.d.ts +1 -0
  19. package/Faq/slug.js.map +7 -0
  20. package/Faq/splitted.test.d.ts +1 -0
  21. package/Faq/utils/index.js +8 -0
  22. package/Faq/utils/package.json +6 -0
  23. package/Faq/utils.d.ts +1 -0
  24. package/Faq/utils.js.map +7 -0
  25. package/FilteredResults/__stories__/Default.d.ts +1 -1
  26. package/FilteredResults/hooks/index.js +1 -1
  27. package/FilteredResults/hooks.js.map +2 -2
  28. package/FilteredResults/index.js +1 -3
  29. package/FilteredResults/index.js.map +2 -2
  30. package/cjs/Faq/Results/index.js +58 -0
  31. package/cjs/Faq/Results.js.map +7 -0
  32. package/cjs/Faq/hooks/index.js +90 -0
  33. package/cjs/Faq/hooks.js.map +7 -0
  34. package/cjs/Faq/index.js +194 -0
  35. package/cjs/Faq/index.js.map +7 -0
  36. package/cjs/Faq/slug/index.js +120 -0
  37. package/cjs/Faq/slug.js.map +7 -0
  38. package/cjs/{ReactModules.stories → Faq/utils}/index.js +12 -7
  39. package/cjs/Faq/utils.js.map +7 -0
  40. package/cjs/FilteredResults/hooks/index.js +1 -1
  41. package/cjs/FilteredResults/hooks.js.map +2 -2
  42. package/cjs/FilteredResults/index.js +1 -3
  43. package/cjs/FilteredResults/index.js.map +3 -3
  44. package/cjs/index.js +3 -1
  45. package/cjs/index.js.map +2 -2
  46. package/cjs/lazy/index.js +6 -5
  47. package/cjs/lazy.js.map +3 -3
  48. package/cjs/registry/index.js +13 -3
  49. package/cjs/registry.js.map +3 -3
  50. package/index.d.ts +1 -0
  51. package/index.js +2 -1
  52. package/index.js.map +2 -2
  53. package/lazy/index.js +10 -13
  54. package/package.json +8 -10
  55. package/registry/index.js +25 -16
  56. package/src/Faq/Faq.stories.js +7 -0
  57. package/src/Faq/Results.tsx +53 -0
  58. package/src/Faq/__stories__/Default.tsx +292 -0
  59. package/src/Faq/hooks.ts +89 -0
  60. package/src/Faq/index.test.tsx +24 -0
  61. package/src/Faq/index.tsx +286 -0
  62. package/src/Faq/slug.ts +140 -0
  63. package/src/Faq/splitted.test.tsx +19 -0
  64. package/src/Faq/utils.ts +5 -0
  65. package/src/FilteredResults/__stories__/Default.tsx +8 -7
  66. package/src/FilteredResults/hooks.ts +1 -1
  67. package/src/FilteredResults/index.test.tsx +4 -0
  68. package/src/FilteredResults/index.tsx +1 -6
  69. package/src/FilteredResults/splitted.test.tsx +4 -0
  70. package/src/index.ts +1 -0
  71. package/src/lazy.js +10 -10
  72. package/src/registry.js +18 -10
  73. package/FilteredResults/FilteredResults.stories/index.js +0 -12
  74. package/FilteredResults/FilteredResults.stories.js.map +0 -7
  75. package/FilteredResults/__stories__/Default/index.js +0 -220
  76. package/FilteredResults/__stories__/Default.js.map +0 -7
  77. package/ReactModules.stories/index.js +0 -7
  78. package/ReactModules.stories.js.map +0 -7
  79. package/cjs/FilteredResults/FilteredResults.stories/index.js +0 -45
  80. package/cjs/FilteredResults/FilteredResults.stories.js.map +0 -7
  81. package/cjs/FilteredResults/__stories__/Default/index.js +0 -250
  82. package/cjs/FilteredResults/__stories__/Default.js.map +0 -7
  83. package/cjs/ReactModules.stories.js.map +0 -7
  84. package/lazy.d.ts +0 -16
  85. package/lazy.js.map +0 -7
  86. package/registry.d.ts +0 -9
  87. package/registry.js.map +0 -7
@@ -0,0 +1,286 @@
1
+ import React, { useEffect, useContext } from 'react';
2
+ import { Field } from '@digigov/form/Field';
3
+ import FormBuilder from '@digigov/form/FormBuilder';
4
+ import { FormContext } from '@digigov/form/FormContext';
5
+ import Results from '@digigov/react-modules/Faq/Results';
6
+ import { createId } from '@digigov/react-modules/Faq/utils';
7
+ import PageTitleContainer, {
8
+ PageTitleHeading,
9
+ } from '@digigov/ui/app/PageTitleContainer';
10
+ import {
11
+ Accordion,
12
+ AccordionSection,
13
+ AccordionSectionContent,
14
+ AccordionSectionSummary,
15
+ AccordionSectionSummaryHeading,
16
+ } from '@digigov/ui/content/Accordion';
17
+ import { useAccordion } from '@digigov/ui/content/Accordion/hooks';
18
+ import Markdown from '@digigov/ui/content/Markdown';
19
+ import { SearchButton } from '@digigov/ui/form/SearchContainer';
20
+ import { Stack } from '@digigov/ui/layouts';
21
+ import { Aside } from '@digigov/ui/layouts/Basic/Aside';
22
+ import { Container } from '@digigov/ui/layouts/Basic/Container';
23
+ import { Main } from '@digigov/ui/layouts/Basic/Main';
24
+ import Grid from '@digigov/ui/layouts/Grid';
25
+ import SectionBreak from '@digigov/ui/layouts/SectionBreak';
26
+ import { BackToTop } from '@digigov/ui/navigation/BackToTopLink';
27
+ import NavList, { NavListItemAction } from '@digigov/ui/navigation/NavList';
28
+ import { Heading } from '@digigov/ui/typography/Heading';
29
+ import Hint from '@digigov/ui/typography/Hint';
30
+
31
+ export interface sectionsConfigType {
32
+ sections: SectionType[];
33
+ }
34
+
35
+ export interface QaType {
36
+ id?: string;
37
+ question: string;
38
+ answer: string;
39
+ }
40
+
41
+ export interface SectionType {
42
+ id: string;
43
+ title: string;
44
+ qa: QaType[];
45
+ }
46
+
47
+ export interface TocType {
48
+ title: string;
49
+ placement: 'top' | 'left' | 'right' | 'none';
50
+ }
51
+
52
+ export interface SearchFilterType {
53
+ title?: string;
54
+ }
55
+
56
+ export interface ContentsType {
57
+ title: string;
58
+ toc: TocType;
59
+ search?: SearchFilterType;
60
+ }
61
+
62
+ export interface NavigationListProps {
63
+ title?: string;
64
+ sections: SectionType[];
65
+ }
66
+
67
+ export interface FaqProps {
68
+ contents: ContentsType;
69
+ sections: SectionType[];
70
+ initialSections: sectionsConfigType;
71
+ search: (values: Record<string, string>) => void;
72
+ submitValues: { text: string };
73
+ activeQa: string;
74
+ onActiveQa: (v: string) => void;
75
+ }
76
+
77
+ const FormBuilderSyncValues = ({ values, autoSubmit }) => {
78
+ const form = useContext(FormContext);
79
+ const previousValues = form.getValues();
80
+ useEffect(() => {
81
+ const mergedObject = { ...values, ...previousValues };
82
+ let shouldSubmit = false;
83
+ for (const key in mergedObject) {
84
+ // catching the filters that have been parsed from url & avoid continuous submitting
85
+ if (values[key] !== undefined && previousValues[key] !== values[key]) {
86
+ shouldSubmit = true;
87
+ previousValues[key] = values[key];
88
+ form.setValue(key, values[key]);
89
+ }
90
+ }
91
+ if (autoSubmit && shouldSubmit) {
92
+ form.submit();
93
+ }
94
+ }, [autoSubmit, form, previousValues, values]);
95
+ return <></>;
96
+ };
97
+
98
+ const NavigationList = React.forwardRef<HTMLUListElement, NavigationListProps>(
99
+ function NavigationList({ title, sections }, ref) {
100
+ return (
101
+ <NavList ref={ref} layout="vertical" marginBottom={10}>
102
+ {title && (
103
+ <Heading size="md" id="contents" marginBottom={4}>
104
+ {title}
105
+ </Heading>
106
+ )}
107
+ {sections &&
108
+ sections.length > 0 &&
109
+ sections.map(({ id, title }, index) => (
110
+ <NavListItemAction key={index} href={`#${createId(id, title)}`}>
111
+ {title}
112
+ </NavListItemAction>
113
+ ))}
114
+ </NavList>
115
+ );
116
+ }
117
+ );
118
+
119
+ export const Faq = React.forwardRef<HTMLDivElement, FaqProps>(function FAQ(
120
+ {
121
+ contents,
122
+ sections,
123
+ initialSections,
124
+ submitValues,
125
+ activeQa,
126
+ onActiveQa,
127
+ search,
128
+ },
129
+ ref
130
+ ) {
131
+ const { section, currentOpen, onOpen, close } = useAccordion({
132
+ singleOpen: true,
133
+ defaultOpen: 0,
134
+ });
135
+ const placement = contents.toc?.placement || 'none';
136
+ const filteredSections = sections.reduce(
137
+ (acc, section) => acc + (section.qa.length || 0),
138
+ 0
139
+ );
140
+ const primarySections = initialSections.sections.reduce(
141
+ (acc, section) => acc + (section.qa.length || 0),
142
+ 0
143
+ );
144
+ const hash = window.location.hash.slice(1);
145
+ const currentId = activeQa ? activeQa : hash;
146
+
147
+ useEffect(() => {
148
+ if (onActiveQa) {
149
+ if (currentOpen && activeQa !== currentOpen) {
150
+ onActiveQa(currentOpen as string);
151
+ }
152
+ }
153
+ }, [activeQa, currentOpen, onActiveQa]);
154
+
155
+ useEffect(() => {
156
+ if (activeQa && activeQa !== currentOpen) {
157
+ onOpen(activeQa);
158
+ }
159
+ }, [activeQa, currentOpen, onOpen]);
160
+
161
+ useEffect(() => {
162
+ // Scroll to the target element if it exists
163
+ if (currentId) {
164
+ const element = document.getElementById(currentId);
165
+ if (element) {
166
+ element.scrollIntoView({ behavior: 'smooth', block: 'start' });
167
+ }
168
+ }
169
+ }, [activeQa, currentId, hash]);
170
+
171
+ const Onclose = (activeQa) => {
172
+ const urlParams = new URLSearchParams(window.location.search);
173
+ urlParams.delete('text');
174
+ urlParams.delete('activeQa');
175
+ window.history.pushState({}, '', '?' + urlParams.toString());
176
+ onActiveQa('');
177
+ close(activeQa);
178
+ };
179
+ const handleSubmit = (data) => {
180
+ search(data);
181
+ onActiveQa('');
182
+ close(activeQa);
183
+ const urlParams = new URLSearchParams(window.location.search);
184
+ urlParams.delete('activeQa');
185
+ window.history.replaceState({}, '', '?' + urlParams.toString());
186
+ };
187
+
188
+ return (
189
+ <Container ref={ref}>
190
+ {placement !== 'none' && placement === 'left' && (
191
+ <Aside sticky={false}>
192
+ <NavigationList title={contents.toc?.title} sections={sections} />
193
+ </Aside>
194
+ )}
195
+ <Main>
196
+ <PageTitleContainer>
197
+ <PageTitleHeading size="xl" id="faq">
198
+ {contents?.title}
199
+ </PageTitleHeading>
200
+ </PageTitleContainer>
201
+ {placement !== 'none' && placement === 'top' && (
202
+ <NavigationList title={contents?.toc?.title} sections={sections} />
203
+ )}
204
+
205
+ {contents.search && (
206
+ <FormBuilder onSubmit={handleSubmit} initial={{ text: '' }}>
207
+ {submitValues && (
208
+ <FormBuilderSyncValues values={submitValues} autoSubmit={true} />
209
+ )}
210
+ <Stack
211
+ direction="row"
212
+ flexWrap="nowrap"
213
+ alignItems="flex-end"
214
+ spacing={4}
215
+ >
216
+ <Grid container style={{ width: '100%' }}>
217
+ <Field
218
+ type="string"
219
+ key="text"
220
+ name="text"
221
+ placeholder="Αναζητήστε σχετικά με την ερώτησή σας"
222
+ label={{ primary: contents.search.title }}
223
+ />
224
+ </Grid>
225
+ <SearchButton
226
+ type="submit"
227
+ mb={{ md: 10 }}
228
+ style={{ minHeight: '2.75rem' }}
229
+ />
230
+ </Stack>
231
+ {filteredSections !== primarySections && (
232
+ <Results
233
+ filteredSections={filteredSections}
234
+ primarySections={primarySections}
235
+ Onclose={Onclose}
236
+ activeQa={activeQa}
237
+ />
238
+ )}
239
+ </FormBuilder>
240
+ )}
241
+ <Grid>
242
+ {sections && sections.length > 0 ? (
243
+ sections.map(({ id: sectionId, title, qa }, index) => (
244
+ <React.Fragment key={index}>
245
+ <Heading id={createId(sectionId, title)} size="lg">
246
+ {title}
247
+ </Heading>
248
+ <Accordion marginBottom={qa && qa.length > 0 ? 12 : 0}>
249
+ {qa?.map(({ id, question, answer }, indx) => (
250
+ <AccordionSection
251
+ key={indx}
252
+ {...section(createId(id, question))}
253
+ >
254
+ <AccordionSectionSummary>
255
+ <AccordionSectionSummaryHeading
256
+ aria-controls={createId(id, question)}
257
+ >
258
+ {question}
259
+ </AccordionSectionSummaryHeading>
260
+ </AccordionSectionSummary>
261
+ <AccordionSectionContent id={createId(id, question)}>
262
+ <Markdown content={answer} />
263
+ </AccordionSectionContent>
264
+ </AccordionSection>
265
+ ))}
266
+ </Accordion>
267
+ <SectionBreak visible={false} />
268
+ </React.Fragment>
269
+ ))
270
+ ) : (
271
+ <Hint marginBottom={10}>Δεν βρέθηκαν αποτελέσματα.</Hint>
272
+ )}
273
+ </Grid>
274
+ <BackToTop topLimitId="contents" id="back-to-top">
275
+ Επιστροφή στα Περιεχόμενα
276
+ </BackToTop>
277
+ </Main>
278
+ {placement !== 'none' && placement === 'right' && (
279
+ <Aside sticky={false}>
280
+ <NavigationList title={contents?.toc?.title} sections={sections} />
281
+ </Aside>
282
+ )}
283
+ </Container>
284
+ );
285
+ });
286
+ export default Faq;
@@ -0,0 +1,140 @@
1
+ export function slug(text: string, maxWidth = 50): string {
2
+ // Greek to Latin character mapping
3
+ const greekToLatinMap: Record<string, string> = {
4
+ α: 'a',
5
+ β: 'b',
6
+ γ: 'g',
7
+ δ: 'd',
8
+ ε: 'e',
9
+ ζ: 'z',
10
+ η: 'i',
11
+ θ: 'th',
12
+ ι: 'i',
13
+ κ: 'k',
14
+ λ: 'l',
15
+ μ: 'm',
16
+ ν: 'n',
17
+ ξ: 'x',
18
+ ο: 'o',
19
+ π: 'p',
20
+ ρ: 'r',
21
+ σ: 's',
22
+ τ: 't',
23
+ υ: 'y',
24
+ φ: 'f',
25
+ χ: 'ch',
26
+ ψ: 'ps',
27
+ ω: 'o',
28
+ ά: 'a',
29
+ έ: 'e',
30
+ ί: 'i',
31
+ ό: 'o',
32
+ ύ: 'y',
33
+ ή: 'i',
34
+ ώ: 'o',
35
+ ς: 's',
36
+ ϊ: 'i',
37
+ ΰ: 'y',
38
+ ϋ: 'y',
39
+ ΐ: 'i',
40
+ Α: 'A',
41
+ Β: 'B',
42
+ Γ: 'G',
43
+ Δ: 'D',
44
+ Ε: 'E',
45
+ Ζ: 'Z',
46
+ Η: 'I',
47
+ Θ: 'TH',
48
+ Ι: 'I',
49
+ Κ: 'K',
50
+ Λ: 'L',
51
+ Μ: 'M',
52
+ Ν: 'N',
53
+ Ξ: 'X',
54
+ Ο: 'O',
55
+ Π: 'P',
56
+ Ρ: 'R',
57
+ Σ: 'S',
58
+ Τ: 'T',
59
+ Υ: 'Y',
60
+ Φ: 'F',
61
+ Χ: 'CH',
62
+ Ψ: 'PS',
63
+ Ω: 'O',
64
+ Ά: 'A',
65
+ Έ: 'E',
66
+ Ί: 'I',
67
+ Ό: 'O',
68
+ Ύ: 'Y',
69
+ Ή: 'I',
70
+ Ώ: 'O',
71
+ Ϊ: 'I',
72
+ Ϋ: 'Y',
73
+ };
74
+
75
+ // Convert Greek characters to Latin
76
+ const latinText = text
77
+ .split('')
78
+ .map((char) => greekToLatinMap[char] || char)
79
+ .join('');
80
+
81
+ // Convert to lowercase, replace spaces with hyphens, remove special characters
82
+ const processedText = latinText
83
+ .toLowerCase()
84
+ .replace(/\s+/g, '-')
85
+ .replace(/[^\w-]+/g, '')
86
+ .replace(/--+/g, '-')
87
+ .replace(/^-+/, '')
88
+ .replace(/-+$/, '');
89
+
90
+ // Calculate the available width for the slug (subtracting 1 for the hyphen and at least 8 for the ID)
91
+ // const availableWidth = Math.max(0, maxWidth - 9);
92
+
93
+ // Split the processed text into slug and remaining text for ID
94
+ let slug = processedText.substring(0, maxWidth);
95
+ const remainingText = processedText.substring(maxWidth);
96
+
97
+ // Remove trailing hyphens from the slug
98
+ slug = slug.replace(/-+$/, '');
99
+
100
+ // Generate ID from the remaining text
101
+ const id = generateIDFromText(remainingText);
102
+
103
+ // Combine the slug and ID
104
+ return `${slug}${id && '-'}${id}`;
105
+ }
106
+ function generateIDFromText(text: string): string {
107
+ // If text is empty or maxLength is 0 or less, return a default ID
108
+ if (!text) return '';
109
+
110
+ // Remove hyphens and take only alphanumeric characters
111
+ let processedText = text.replace(/-/g, '').replace(/[^a-z0-9]/g, '');
112
+
113
+ // If processed text is empty, use a default base
114
+ if (!processedText) processedText = 'default';
115
+
116
+ // Calculate a simple hash of the processed text
117
+ let hash = 0;
118
+ for (let i = 0; i < processedText.length; i++) {
119
+ const char = processedText.charCodeAt(i);
120
+ hash = (hash << 5) - hash + char;
121
+ hash = hash & hash; // Convert to 32-bit integer
122
+ }
123
+
124
+ // Convert hash to a positive number and then to base 36 (0-9 and a-z)
125
+ const id = Math.abs(hash).toString(36);
126
+
127
+ // Ensure the ID is at least 8 characters long, padding with '0' if necessary
128
+ return id;
129
+ // return id.padEnd(8, '0').substring(0, maxLength);
130
+ }
131
+
132
+ // Test the function
133
+ // console.log(createSlugWithID('Καλημέρα κόσμε! Hello world!', 10));
134
+ // console.log(createSlugWithID('Ελληνικά και English mixed', 80));
135
+ // console.log(
136
+ // createSlugWithID(
137
+ // 'Αυτό είναι ένα πολύ μεγάλο κείμενο για να δοκιμάσουμε το όριο πλάτους',
138
+ // 90
139
+ // )
140
+ // );
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { test, expect } from '@playwright/experimental-ct-react';
3
+
4
+ import { Default } from '@digigov/react-modules/Faq/__stories__/Default';
5
+
6
+ test('renders the Default', async ({ mount, page }) => {
7
+ await mount(
8
+ <Default />
9
+ )
10
+ await page.evaluate(() => document.fonts.ready);
11
+
12
+ // Move the mouse to the top-left corner to avoid random hover issues
13
+ await page.mouse.move(0, 0);
14
+
15
+
16
+ const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
17
+ expect(screenshot).toMatchSnapshot();
18
+ });
19
+
@@ -0,0 +1,5 @@
1
+ import { slug } from '@digigov/react-modules/Faq/slug';
2
+
3
+ export const createId = (id: string | undefined, text: string) => {
4
+ return id ? id : slug(text); // Fallback to slug(text) when id is undefined
5
+ };
@@ -130,13 +130,13 @@ const displayRights = (value) => {
130
130
  return <>{value ? <CheckIcon /> : <UncheckIcon />}</>;
131
131
  };
132
132
 
133
- type DataType = {
133
+ interface DataType {
134
134
  name: string;
135
135
  case_id: number;
136
136
  role: string;
137
137
  email: string;
138
138
  rights: boolean;
139
- };
139
+ }
140
140
 
141
141
  const data: DataType[] = [
142
142
  {
@@ -194,9 +194,7 @@ const dataConfig: DataConfigType[] = [
194
194
  },
195
195
  ];
196
196
 
197
- type InitialFiltersType = {
198
- [K in (typeof dataConfig)[number]['key']]: string;
199
- };
197
+ type InitialFiltersType = Record<(typeof dataConfig)[number]['key'], string>;
200
198
 
201
199
  const initialFilters: InitialFiltersType = {
202
200
  name: '',
@@ -206,8 +204,11 @@ const initialFilters: InitialFiltersType = {
206
204
  rights: '',
207
205
  };
208
206
 
209
- export const Default = () => {
210
- const { search, results } = useStaticSearch<DataType, InitialFiltersType>({
207
+ export const Default = (_: any) => {
208
+ const { search, results } = useStaticSearch<
209
+ Record<string, any>,
210
+ InitialFiltersType
211
+ >({
211
212
  fields,
212
213
  data,
213
214
  initialFilters,
@@ -38,7 +38,7 @@ export const useURLParamsSearch = (searchFunc, { navigate, fields }) => {
38
38
  new URLSearchParams(
39
39
  // @ts-ignore
40
40
  Object.entries({ ...currentParams, ...params }).filter(
41
- ([_, value]) => !!value
41
+ ([, value]) => !!value
42
42
  )
43
43
  ).toString()
44
44
  );
@@ -14,6 +14,10 @@ test('renders the All FilteredResults variants', async ({ mount, page }) => {
14
14
  )
15
15
  await page.evaluate(() => document.fonts.ready);
16
16
 
17
+ // Move the mouse to the top-left corner to avoid random hover issues
18
+ await page.mouse.move(0, 0);
19
+
20
+
17
21
  const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
18
22
  expect(screenshot).toMatchSnapshot();
19
23
  });
@@ -4,14 +4,12 @@ import { FormContext } from '@digigov/form/FormContext';
4
4
  import { FieldSpec } from '@digigov/form/types';
5
5
  import { FilterChips } from '@digigov/react-modules/FilteredResults/FilterChips';
6
6
  import { FilterFields } from '@digigov/react-modules/FilteredResults/FilterFields';
7
- import CloseButton from '@digigov/ui/app/CloseButton';
8
7
  import FilterContainer, {
9
8
  FilterContent,
10
9
  FilterHeadingContainer,
11
10
  } from '@digigov/ui/app/FilterContainer';
12
11
  import { Button } from '@digigov/ui/form/Button';
13
12
  import { Grid } from '@digigov/ui/layouts/Grid';
14
- import { Hidden } from '@digigov/ui/layouts/Hidden';
15
13
  import { SectionBreak } from '@digigov/ui/layouts/SectionBreak';
16
14
  import { Drawer, DrawerHeading } from '@digigov/ui/navigation/Drawer';
17
15
  import { useDrawer } from '@digigov/ui/navigation/Drawer/hooks';
@@ -109,10 +107,7 @@ export const BlockFilteredResults = React.forwardRef<HTMLDivElement, unknown>(
109
107
  return (
110
108
  <Grid item xs={12} ref={ref}>
111
109
  <FilterContainer open={open}>
112
- <FilterHeadingContainer>
113
- <Hidden mdUp>
114
- <CloseButton onClick={() => setOpen(false)}>Κλείσιμο</CloseButton>
115
- </Hidden>
110
+ <FilterHeadingContainer onClick={() => setOpen(false)}>
116
111
  <Heading size="md">Φίλτρα</Heading>
117
112
  </FilterHeadingContainer>
118
113
  <FilterContent>
@@ -9,6 +9,10 @@ test('renders the Default', async ({ mount, page }) => {
9
9
  )
10
10
  await page.evaluate(() => document.fonts.ready);
11
11
 
12
+ // Move the mouse to the top-left corner to avoid random hover issues
13
+ await page.mouse.move(0, 0);
14
+
15
+
12
16
  const screenshot = await page.screenshot({ fullPage: true, animations: 'disabled' });
13
17
  expect(screenshot).toMatchSnapshot();
14
18
  });
package/src/index.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from '@digigov/react-modules/FilteredResults';
2
+ export * from '@digigov/react-modules/Faq';
package/src/lazy.js CHANGED
@@ -1,11 +1,11 @@
1
- import {lazy} from 'react';
1
+ import { lazy } from 'react';
2
2
  export default {
3
- 'DataTable': lazy(() => import('@digigov/react-modules/FilteredResults/DataTable').then((module)=> ({default: module['DataTable']}))),
4
- 'FilterChips': lazy(() => import('@digigov/react-modules/FilteredResults/FilterChips').then((module)=> ({default: module['FilterChips']}))),
5
- 'FilterFields': lazy(() => import('@digigov/react-modules/FilteredResults/FilterFields').then((module)=> ({default: module['FilterFields']}))),
6
- 'BlockFilteredResults': lazy(() => import('@digigov/react-modules/FilteredResults').then((module)=> ({default: module['BlockFilteredResults']}))),
7
- 'DrawerFilteredResults': lazy(() => import('@digigov/react-modules/FilteredResults').then((module)=> ({default: module['DrawerFilteredResults']}))),
8
- 'FilteredResults': lazy(() => import('@digigov/react-modules/FilteredResults').then((module)=> ({default: module['FilteredResults']}))),
9
- 'FormBuilderSyncValues': lazy(() => import('@digigov/react-modules/FilteredResults').then((module)=> ({default: module['FormBuilderSyncValues']}))),
10
-
11
- }
3
+ 'FormBuilderSyncValues': lazy(() => import('@digigov/react-modules/FilteredResults').then((module) => ({ default: module['FormBuilderSyncValues'] }))),
4
+ 'DrawerFilteredResults': lazy(() => import('@digigov/react-modules/FilteredResults').then((module) => ({ default: module['DrawerFilteredResults'] }))),
5
+ 'BlockFilteredResults': lazy(() => import('@digigov/react-modules/FilteredResults').then((module) => ({ default: module['BlockFilteredResults'] }))),
6
+ 'FilteredResults': lazy(() => import('@digigov/react-modules/FilteredResults').then((module) => ({ default: module['FilteredResults'] }))),
7
+ 'Faq': lazy(() => import('@digigov/react-modules/Faq').then((module) => ({ default: module['Faq'] }))),
8
+ 'DataTable': lazy(() => import('@digigov/react-modules/FilteredResults/DataTable').then((module) => ({ default: module['DataTable'] }))),
9
+ 'FilterChips': lazy(() => import('@digigov/react-modules/FilteredResults/FilterChips').then((module) => ({ default: module['FilterChips'] }))),
10
+ 'FilterFields': lazy(() => import('@digigov/react-modules/FilteredResults/FilterFields').then((module) => ({ default: module['FilterFields'] })))
11
+ };
package/src/registry.js CHANGED
@@ -1,12 +1,16 @@
1
1
 
2
- import * as _digigov_react_modules_FilteredResults_DataTable from '@digigov/react-modules/FilteredResults/DataTable';
3
- import * as _digigov_react_modules_FilteredResults_FilterChips from '@digigov/react-modules/FilteredResults/FilterChips';
4
- import * as _digigov_react_modules_FilteredResults_FilterFields from '@digigov/react-modules/FilteredResults/FilterFields';
5
- import * as _digigov_react_modules_FilteredResults_hooks from '@digigov/react-modules/FilteredResults/hooks';
6
- import * as _digigov_react_modules_FilteredResults from '@digigov/react-modules/FilteredResults';
7
- import * as _digigov_react_modules from '@digigov/react-modules'
2
+ import * as _digigov_react_modules from "@digigov/react-modules";
3
+ import * as _digigov_react_modules_Faq_Results from "@digigov/react-modules/Faq/Results";
4
+ import * as _digigov_react_modules_Faq_hooks from "@digigov/react-modules/Faq/hooks";
5
+ import * as _digigov_react_modules_Faq from "@digigov/react-modules/Faq";
6
+ import * as _digigov_react_modules_Faq_slug from "@digigov/react-modules/Faq/slug";
7
+ import * as _digigov_react_modules_Faq_utils from "@digigov/react-modules/Faq/utils";
8
+ import * as _digigov_react_modules_FilteredResults_DataTable from "@digigov/react-modules/FilteredResults/DataTable";
9
+ import * as _digigov_react_modules_FilteredResults_FilterChips from "@digigov/react-modules/FilteredResults/FilterChips";
10
+ import * as _digigov_react_modules_FilteredResults_FilterFields from "@digigov/react-modules/FilteredResults/FilterFields";
11
+ import * as _digigov_react_modules_FilteredResults_hooks from "@digigov/react-modules/FilteredResults/hooks";
12
+ import * as _digigov_react_modules_FilteredResults from "@digigov/react-modules/FilteredResults";
8
13
  function lazyImport(pkgImport) {
9
- // eslint-disable-next-line no-undef
10
14
  return new Proxy(
11
15
  {},
12
16
  {
@@ -25,11 +29,15 @@ function lazyImport(pkgImport) {
25
29
  )
26
30
  }
27
31
  export default {
32
+ '@digigov/react-modules': lazyImport(_digigov_react_modules),
33
+ '@digigov/react-modules/Faq/Results': lazyImport(_digigov_react_modules_Faq_Results),
34
+ '@digigov/react-modules/Faq/hooks': lazyImport(_digigov_react_modules_Faq_hooks),
35
+ '@digigov/react-modules/Faq': lazyImport(_digigov_react_modules_Faq),
36
+ '@digigov/react-modules/Faq/slug': lazyImport(_digigov_react_modules_Faq_slug),
37
+ '@digigov/react-modules/Faq/utils': lazyImport(_digigov_react_modules_Faq_utils),
28
38
  '@digigov/react-modules/FilteredResults/DataTable': lazyImport(_digigov_react_modules_FilteredResults_DataTable),
29
39
  '@digigov/react-modules/FilteredResults/FilterChips': lazyImport(_digigov_react_modules_FilteredResults_FilterChips),
30
40
  '@digigov/react-modules/FilteredResults/FilterFields': lazyImport(_digigov_react_modules_FilteredResults_FilterFields),
31
41
  '@digigov/react-modules/FilteredResults/hooks': lazyImport(_digigov_react_modules_FilteredResults_hooks),
32
- '@digigov/react-modules/FilteredResults': lazyImport(_digigov_react_modules_FilteredResults),
33
- '@digigov/react-modules': lazyImport(_digigov_react_modules)
42
+ '@digigov/react-modules/FilteredResults': lazyImport(_digigov_react_modules_FilteredResults)
34
43
  };
35
-
@@ -1,12 +0,0 @@
1
- import FilteredResults from "@digigov/react-modules/FilteredResults";
2
- var FilteredResults_stories_default = {
3
- title: "Digigov React Modules/FilteredResults",
4
- component: FilteredResults,
5
- displayName: "FilteredResults"
6
- };
7
- import { Default } from "@digigov/react-modules/FilteredResults/__stories__/Default";
8
- export {
9
- Default,
10
- FilteredResults_stories_default as default
11
- };
12
- //# sourceMappingURL=FilteredResults.stories.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/FilteredResults/FilteredResults.stories.js"],
4
- "sourcesContent": ["import FilteredResults from '@digigov/react-modules/FilteredResults';\nexport default {\n title: 'Digigov React Modules/FilteredResults',\n component: FilteredResults,\n displayName: 'FilteredResults',\n};\nexport { Default } from '@digigov/react-modules/FilteredResults/__stories__/Default';\n"],
5
- "mappings": "AAAA,OAAO,qBAAqB;AAC5B,IAAO,kCAAQ;AAAA,EACb,OAAO;AAAA,EACP,WAAW;AAAA,EACX,aAAa;AACf;AACA,SAAS,eAAe;",
6
- "names": []
7
- }