@egen-civitas/esm-styleguide 3.2.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/assistant/spline-scene.component.d.ts.map +1 -1
  3. package/dist/assistant/spline-scene.component.js +15 -1
  4. package/dist/cards/card-header.stories.js +2 -2
  5. package/dist/datepicker/datepicker.stories.js +1 -1
  6. package/dist/empty-card/empty-card.stories.js +2 -2
  7. package/dist/filters/filter-bar.component.js +1 -1
  8. package/dist/icons/icon-registration.d.ts.map +1 -1
  9. package/dist/icons/icon-registration.js +0 -8
  10. package/dist/icons/icons.d.ts +4 -20
  11. package/dist/icons/icons.d.ts.map +1 -1
  12. package/dist/icons/icons.js +4 -42
  13. package/dist/internal.d.ts +0 -1
  14. package/dist/internal.d.ts.map +1 -1
  15. package/dist/internal.js +0 -1
  16. package/dist/page-header/page-header.stories.js +3 -3
  17. package/dist/pictograms/pictogram-registration.d.ts.map +1 -1
  18. package/dist/pictograms/pictogram-registration.js +2 -10
  19. package/dist/pictograms/pictograms.d.ts +1 -10
  20. package/dist/pictograms/pictograms.d.ts.map +1 -1
  21. package/dist/pictograms/pictograms.js +8 -44
  22. package/dist/pictograms/svgs/home.svg +1 -0
  23. package/dist/public.d.ts +0 -1
  24. package/dist/public.d.ts.map +1 -1
  25. package/dist/public.js +0 -1
  26. package/dist/workbench/section-nav-panel.component.d.ts +1 -1
  27. package/dist/workbench/section-nav-panel.component.d.ts.map +1 -1
  28. package/dist/workbench/section-nav-panel.component.js +18 -3
  29. package/mock-jest.tsx +0 -39
  30. package/mock.tsx +0 -39
  31. package/package.json +15 -15
  32. package/dist/icons/svgs/gender-female.svg +0 -1
  33. package/dist/icons/svgs/gender-male.svg +0 -1
  34. package/dist/icons/svgs/gender-other.svg +0 -1
  35. package/dist/icons/svgs/gender-unknown.svg +0 -1
  36. package/dist/location-picker/index.d.ts +0 -2
  37. package/dist/location-picker/index.d.ts.map +0 -1
  38. package/dist/location-picker/index.js +0 -1
  39. package/dist/location-picker/location-picker.component.d.ts +0 -11
  40. package/dist/location-picker/location-picker.component.d.ts.map +0 -1
  41. package/dist/location-picker/location-picker.component.js +0 -114
  42. package/dist/location-picker/location-picker.module.scss +0 -71
  43. package/dist/location-picker/location-picker.resource.d.ts +0 -53
  44. package/dist/location-picker/location-picker.resource.d.ts.map +0 -1
  45. package/dist/location-picker/location-picker.resource.js +0 -98
  46. package/dist/pictograms/svgs/appointments.svg +0 -1
  47. package/dist/pictograms/svgs/assessment-1.svg +0 -1
  48. package/dist/pictograms/svgs/assessment-2.svg +0 -1
  49. package/dist/pictograms/svgs/facility.svg +0 -1
  50. package/dist/pictograms/svgs/registration.svg +0 -1
package/mock-jest.tsx CHANGED
@@ -33,10 +33,6 @@ export const DownloadIcon = () => <span>DownloadIcon</span>;
33
33
  export const EditIcon = () => <span>EditIcon</span>;
34
34
  export const EventScheduleIcon = () => <span>EventScheduleIcon</span>;
35
35
  export const EventsIcon = () => <span>EventsIcon</span>;
36
- export const GenderFemaleIcon = () => <span>GenderFemaleIcon</span>;
37
- export const GenderMaleIcon = () => <span>GenderMaleIcon</span>;
38
- export const GenderOtherIcon = () => <span>GenderOtherIcon</span>;
39
- export const GenderUnknownIcon = () => <span>GenderUnknownIcon</span>;
40
36
  export const GroupIcon = () => <span>GroupIcon</span>;
41
37
  export const GroupAccessIcon = () => <span>GroupAccessIcon</span>;
42
38
  export const Icon = () => <span>Icon</span>;
@@ -57,7 +53,6 @@ export const PedestrianFamilyIcon = () => <span>PedestrianFamilyIcon</span>;
57
53
  export const PenIcon = () => <span>PenIcon</span>;
58
54
  export const PrinterIcon = () => <span>PrinterIcon</span>;
59
55
  export const ProgramsIcon = () => <span>ProgramsIcon</span>;
60
- export const RadiologyIcon = () => <span>RadiologyIcon</span>;
61
56
  export const RenewIcon = () => <span>RenewIcon</span>;
62
57
  export const ReportIcon = () => <span>ReportIcon</span>;
63
58
  export const ResetIcon = () => <span>ResetIcon</span>;
@@ -176,14 +171,8 @@ export const ViewOffIcon = () => <span>ViewOffIcon</span>;
176
171
  export const WarningIcon = () => <span>WarningIcon</span>;
177
172
 
178
173
  // Pictogram stubs
179
- export const AppointmentsPictogram = () => <span>AppointmentsPictogram</span>;
180
- export const AppointmentsAltPictogram = () => <span>AppointmentsAltPictogram</span>;
181
- export const Assessment1Pictogram = () => <span>Assessment1Pictogram</span>;
182
- export const Assessment2Pictogram = () => <span>Assessment2Pictogram</span>;
183
- export const FacilityPictogram = () => <span>FacilityPictogram</span>;
184
174
  export const HomePictogram = () => <span>HomePictogram</span>;
185
175
  export const PaymentsDeskPictogram = () => <span>PaymentsDeskPictogram</span>;
186
- export const RegistrationPictogram = () => <span>RegistrationPictogram</span>;
187
176
  export const ServiceQueuesPictogram = () => <span>ServiceQueuesPictogram</span>;
188
177
  export const StockManagementPictogram = () => <span>StockManagementPictogram</span>;
189
178
  export const TransferPictogram = () => <span>TransferPictogram</span>;
@@ -222,34 +211,6 @@ export { CardHeader, ErrorCard, Pagination, PageHeader, PageHeaderContent } from
222
211
  export const EgenDatePicker = () => <span>EgenDatePicker</span>;
223
212
  export const EgenDateRangePicker = () => <span>EgenDateRangePicker</span>;
224
213
 
225
- export const LocationPicker = jest.fn(({ onChange, selectedLocationUuid }) => {
226
- const locations = [
227
- {
228
- uuid: 'uuid_1',
229
- name: 'location_1',
230
- },
231
- {
232
- uuid: 'uuid_2',
233
- name: 'location_2',
234
- },
235
- ];
236
- return (
237
- <div>
238
- {locations.map((location) => (
239
- <label key={location.uuid}>
240
- <input
241
- type="radio"
242
- name="location"
243
- value={location.uuid}
244
- checked={location.uuid === selectedLocationUuid}
245
- onChange={() => onChange(location.uuid)}
246
- />
247
- {location.name}
248
- </label>
249
- ))}
250
- </div>
251
- );
252
- });
253
214
 
254
215
  export const ClassificationTags = jest.fn(({ classifications }: { classifications: Array<Classification> }) => (
255
216
  <>
package/mock.tsx CHANGED
@@ -34,10 +34,6 @@ export const DownloadIcon = () => <span>DownloadIcon</span>;
34
34
  export const EditIcon = () => <span>EditIcon</span>;
35
35
  export const EventScheduleIcon = () => <span>EventScheduleIcon</span>;
36
36
  export const EventsIcon = () => <span>EventsIcon</span>;
37
- export const GenderFemaleIcon = () => <span>GenderFemaleIcon</span>;
38
- export const GenderMaleIcon = () => <span>GenderMaleIcon</span>;
39
- export const GenderOtherIcon = () => <span>GenderOtherIcon</span>;
40
- export const GenderUnknownIcon = () => <span>GenderUnknownIcon</span>;
41
37
  export const GroupIcon = () => <span>GroupIcon</span>;
42
38
  export const GroupAccessIcon = () => <span>GroupAccessIcon</span>;
43
39
  export const Icon = () => <span>Icon</span>;
@@ -58,7 +54,6 @@ export const PedestrianFamilyIcon = () => <span>PedestrianFamilyIcon</span>;
58
54
  export const PenIcon = () => <span>PenIcon</span>;
59
55
  export const PrinterIcon = () => <span>PrinterIcon</span>;
60
56
  export const ProgramsIcon = () => <span>ProgramsIcon</span>;
61
- export const RadiologyIcon = () => <span>RadiologyIcon</span>;
62
57
  export const RenewIcon = () => <span>RenewIcon</span>;
63
58
  export const ReportIcon = () => <span>ReportIcon</span>;
64
59
  export const ResetIcon = () => <span>ResetIcon</span>;
@@ -178,14 +173,8 @@ export const ViewOffIcon = () => <span>ViewOffIcon</span>;
178
173
  export const WarningIcon = () => <span>WarningIcon</span>;
179
174
 
180
175
  // Pictogram stubs
181
- export const AppointmentsPictogram = () => <span>AppointmentsPictogram</span>;
182
- export const AppointmentsAltPictogram = () => <span>AppointmentsAltPictogram</span>;
183
- export const Assessment1Pictogram = () => <span>Assessment1Pictogram</span>;
184
- export const Assessment2Pictogram = () => <span>Assessment2Pictogram</span>;
185
- export const FacilityPictogram = () => <span>FacilityPictogram</span>;
186
176
  export const HomePictogram = () => <span>HomePictogram</span>;
187
177
  export const PaymentsDeskPictogram = () => <span>PaymentsDeskPictogram</span>;
188
- export const RegistrationPictogram = () => <span>RegistrationPictogram</span>;
189
178
  export const ServiceQueuesPictogram = () => <span>ServiceQueuesPictogram</span>;
190
179
  export const StockManagementPictogram = () => <span>StockManagementPictogram</span>;
191
180
  export const TransferPictogram = () => <span>TransferPictogram</span>;
@@ -224,34 +213,6 @@ export { CardHeader, ErrorCard, Pagination, PageHeader, PageHeaderContent } from
224
213
  export const EgenDatePicker = () => <span>EgenDatePicker</span>;
225
214
  export const EgenDateRangePicker = () => <span>EgenDateRangePicker</span>;
226
215
 
227
- export const LocationPicker = vi.fn(({ onChange, selectedLocationUuid }) => {
228
- const locations = [
229
- {
230
- uuid: 'uuid_1',
231
- name: 'location_1',
232
- },
233
- {
234
- uuid: 'uuid_2',
235
- name: 'location_2',
236
- },
237
- ];
238
- return (
239
- <div>
240
- {locations.map((location) => (
241
- <label key={location.uuid}>
242
- <input
243
- type="radio"
244
- name="location"
245
- value={location.uuid}
246
- checked={location.uuid === selectedLocationUuid}
247
- onChange={() => onChange(location.uuid)}
248
- />
249
- {location.name}
250
- </label>
251
- ))}
252
- </div>
253
- );
254
- });
255
216
 
256
217
  export const ClassificationTags = vi.fn(({ classifications }: { classifications: Array<Classification> }) => (
257
218
  <>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@egen-civitas/esm-styleguide",
3
- "version": "3.2.0",
3
+ "version": "4.0.0",
4
4
  "license": "MPL-2.0",
5
5
  "description": "The styleguide for Egen SPA",
6
6
  "main": "dist/internal.js",
@@ -96,17 +96,17 @@
96
96
  "uuid": "^14.0.1"
97
97
  },
98
98
  "peerDependencies": {
99
- "@egen-civitas/esm-api": "^2.0.0",
99
+ "@egen-civitas/esm-api": "^3.0.0",
100
100
  "@egen-civitas/esm-config": "^2.0.0",
101
- "@egen-civitas/esm-data-api": "^2.0.0",
101
+ "@egen-civitas/esm-data-api": "^3.0.0",
102
102
  "@egen-civitas/esm-error-handling": "^1.0.2",
103
- "@egen-civitas/esm-extensions": "^2.3.0",
104
- "@egen-civitas/esm-globals": "^2.0.0",
103
+ "@egen-civitas/esm-extensions": "^2.4.1",
104
+ "@egen-civitas/esm-globals": "^2.1.0",
105
105
  "@egen-civitas/esm-navigation": "^1.0.2",
106
- "@egen-civitas/esm-react-utils": "^3.0.0",
107
- "@egen-civitas/esm-routes": "^1.1.0",
106
+ "@egen-civitas/esm-react-utils": "^3.0.1",
107
+ "@egen-civitas/esm-routes": "^1.2.0",
108
108
  "@egen-civitas/esm-state": "^1.0.3",
109
- "@egen-civitas/esm-translations": "^1.0.3",
109
+ "@egen-civitas/esm-translations": "^1.0.4",
110
110
  "@egen-civitas/esm-utils": "^2.0.0",
111
111
  "dayjs": "1.x",
112
112
  "i18next": "25.x",
@@ -118,18 +118,18 @@
118
118
  "swr": "2.x"
119
119
  },
120
120
  "devDependencies": {
121
- "@egen-civitas/esm-api": "^2.0.0",
121
+ "@egen-civitas/esm-api": "^3.0.0",
122
122
  "@egen-civitas/esm-config": "^2.0.0",
123
- "@egen-civitas/esm-data-api": "^2.0.0",
123
+ "@egen-civitas/esm-data-api": "^3.0.0",
124
124
  "@egen-civitas/esm-error-handling": "^1.0.2",
125
125
  "@egen-civitas/esm-expression-evaluator": "^1.0.0",
126
- "@egen-civitas/esm-extensions": "^2.3.0",
127
- "@egen-civitas/esm-globals": "^2.0.0",
126
+ "@egen-civitas/esm-extensions": "^2.4.1",
127
+ "@egen-civitas/esm-globals": "^2.1.0",
128
128
  "@egen-civitas/esm-navigation": "^1.0.2",
129
- "@egen-civitas/esm-react-utils": "^3.0.0",
130
- "@egen-civitas/esm-routes": "^1.1.0",
129
+ "@egen-civitas/esm-react-utils": "^3.0.1",
130
+ "@egen-civitas/esm-routes": "^1.2.0",
131
131
  "@egen-civitas/esm-state": "^1.0.3",
132
- "@egen-civitas/esm-translations": "^1.0.3",
132
+ "@egen-civitas/esm-translations": "^1.0.4",
133
133
  "@egen-civitas/esm-utils": "^2.0.0",
134
134
  "@swc/cli": "0.8.1",
135
135
  "@swc/core": "1.15.21",
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg"><path d="M8.5 9.965a4 4 0 1 0-1 0V11H5v1h2.5v2h1v-2H11v-1H8.5zM5 6a3 3 0 1 1 6 0 3 3 0 0 1-6 0"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg"><path d="M9 2v1h3.293L8.449 6.844a4.014 4.014 0 1 0 .707.707L13 3.707V7h1V2zM6 13a3 3 0 1 1 0-6 3 3 0 0 1 0 6"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg"><path d="M11 1v1h2.293l-3.2 3.2a3.47 3.47 0 0 0-4.185 0l-.7-.7L6.5 3.207 5.793 2.5 4.5 3.793 2.707 2H5V1H1v4h1V2.707L3.793 4.5 2.5 5.793l.707.707L4.5 5.207l.7.7a3.49 3.49 0 0 0 2.3 5.553v1.04h-2v1h2V15h1v-1.5h2v-1h-2v-1.04a3.49 3.49 0 0 0 2.3-5.552L14 2.707V5h1V1zm-3 9.5a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg"><path d="M8 12a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M8.5 9.5h-1v-2h1a1 1 0 0 0 0-2h-1a1 1 0 0 0-1 1v.25h-1V6.5a2 2 0 0 1 2-2h1a2 2 0 1 1 0 4z"/><path d="M8 15a1.04 1.04 0 0 1-.737-.305L1.305 8.737a1.043 1.043 0 0 1 0-1.474l5.958-5.958a1.043 1.043 0 0 1 1.474 0l5.958 5.958a1.043 1.043 0 0 1 0 1.474l-5.958 5.958A1.04 1.04 0 0 1 8 15M8 2a.04.04 0 0 0-.03.012L2.012 7.97a.04.04 0 0 0 0 .06l5.958 5.958a.04.04 0 0 0 .06 0l5.958-5.958a.04.04 0 0 0 0-.06L8.03 2.012A.04.04 0 0 0 8 2"/></svg>
@@ -1,2 +0,0 @@
1
- export * from './location-picker.component.js';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/location-picker/index.tsx"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
@@ -1 +0,0 @@
1
- export * from "./location-picker.component.js";
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- interface LocationPickerProps {
3
- selectedLocationUuid?: string;
4
- defaultLocationUuid?: string;
5
- locationTag?: string;
6
- locationsPerRequest?: number;
7
- onChange: (locationUuid?: string) => void;
8
- }
9
- export declare const LocationPicker: React.FC<LocationPickerProps>;
10
- export {};
11
- //# sourceMappingURL=location-picker.component.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"location-picker.component.d.ts","sourceRoot":"","sources":["../../src/location-picker/location-picker.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgD,MAAM,OAAO,CAAC;AAcrE,UAAU,mBAAmB;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAuHxD,CAAC"}
@@ -1,114 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import React, { useCallback, useId, useMemo, useState } from "react";
3
- import { InlineLoading, InlineNotification, RadioButton, RadioButtonGroup, RadioButtonSkeleton, Search } from "@carbon/react";
4
- import { getCoreTranslation } from "@egen-civitas/esm-translations";
5
- import { useOnVisible } from "@egen-civitas/esm-react-utils";
6
- import { useLocationByUuid, useLocations } from "./location-picker.resource.js";
7
- import styles from "./location-picker.module.scss";
8
- export const LocationPicker = ({ selectedLocationUuid, defaultLocationUuid, locationTag, locationsPerRequest = 50, onChange })=>{
9
- const [searchTerm, setSearchTerm] = useState('');
10
- const searchId = useId();
11
- const { location: defaultLocation } = useLocationByUuid(defaultLocationUuid);
12
- const { locations: fetchedLocations, isLoading, hasMore, loadingNewData, error, setPage } = useLocations(locationTag, locationsPerRequest, searchTerm);
13
- const locations = useMemo(()=>{
14
- if (defaultLocation && !searchTerm && defaultLocationUuid) {
15
- return [
16
- defaultLocation,
17
- ...fetchedLocations.filter(({ resource })=>resource.id !== defaultLocationUuid)
18
- ];
19
- }
20
- return fetchedLocations ?? [];
21
- }, [
22
- defaultLocation,
23
- fetchedLocations,
24
- defaultLocationUuid,
25
- searchTerm
26
- ]);
27
- const handleSearchChange = useCallback((searchQuery)=>{
28
- onChange();
29
- setSearchTerm(searchQuery.trim());
30
- }, [
31
- onChange
32
- ]);
33
- const loadMore = useCallback(()=>{
34
- if (loadingNewData || !hasMore) {
35
- return;
36
- }
37
- setPage((page)=>page + 1);
38
- }, [
39
- loadingNewData,
40
- hasMore,
41
- setPage
42
- ]);
43
- const loadingIconRef = useOnVisible(loadMore);
44
- const infiniteScrollTriggerIndex = hasMore ? Math.max(0, Math.floor(locations.length - locationsPerRequest / 2)) : -1;
45
- return /*#__PURE__*/ _jsxs(_Fragment, {
46
- children: [
47
- /*#__PURE__*/ _jsx(Search, {
48
- "aria-describedby": error ? `${searchId}-error` : undefined,
49
- labelText: getCoreTranslation('searchForLocation'),
50
- id: searchId,
51
- placeholder: getCoreTranslation('searchForLocation'),
52
- onChange: (event)=>handleSearchChange(event.target.value),
53
- size: "lg"
54
- }),
55
- error && /*#__PURE__*/ _jsx("div", {
56
- className: styles.errorNotification,
57
- id: `${searchId}-error`,
58
- children: /*#__PURE__*/ _jsx(InlineNotification, {
59
- kind: "error",
60
- subtitle: getCoreTranslation('errorLoadingLoginLocations', 'Unable to load login locations. Please try again or contact support if the problem persists.'),
61
- title: getCoreTranslation('error', 'Error')
62
- })
63
- }),
64
- /*#__PURE__*/ _jsx("div", {
65
- className: styles.searchResults,
66
- children: isLoading ? /*#__PURE__*/ _jsx("div", {
67
- className: styles.loadingContainer,
68
- children: Array.from({
69
- length: 5
70
- }).map((_, index)=>/*#__PURE__*/ _jsx(RadioButtonSkeleton, {
71
- className: styles.radioButtonSkeleton,
72
- role: "progressbar"
73
- }, index))
74
- }) : /*#__PURE__*/ _jsxs(_Fragment, {
75
- children: [
76
- /*#__PURE__*/ _jsx("div", {
77
- className: styles.locationResultsContainer,
78
- children: locations.length > 0 ? /*#__PURE__*/ _jsx(RadioButtonGroup, {
79
- name: "loginLocations",
80
- onChange: (value)=>{
81
- onChange(value?.toString());
82
- },
83
- orientation: "vertical",
84
- valueSelected: selectedLocationUuid,
85
- children: locations.map((entry, i)=>/*#__PURE__*/ _jsx(RadioButton, {
86
- className: styles.locationRadioButton,
87
- id: entry.resource.id,
88
- labelText: /*#__PURE__*/ _jsx("span", {
89
- ref: i === infiniteScrollTriggerIndex ? loadingIconRef : null,
90
- children: entry.resource.name
91
- }),
92
- name: entry.resource.name,
93
- value: entry.resource.id
94
- }, entry.resource.id))
95
- }) : /*#__PURE__*/ _jsx("div", {
96
- className: styles.emptyState,
97
- children: /*#__PURE__*/ _jsx("p", {
98
- className: styles.locationNotFound,
99
- children: getCoreTranslation('noResultsToDisplay')
100
- })
101
- })
102
- }),
103
- loadingNewData && /*#__PURE__*/ _jsx("div", {
104
- className: styles.loadingIcon,
105
- children: /*#__PURE__*/ _jsx(InlineLoading, {
106
- description: getCoreTranslation('loading')
107
- })
108
- })
109
- ]
110
- })
111
- })
112
- ]
113
- });
114
- };
@@ -1,71 +0,0 @@
1
- @use '@carbon/layout';
2
- @use '@carbon/type';
3
- @use '../vars' as *;
4
-
5
- .bodyCompact01 {
6
- @include type.type-style('body-compact-01');
7
- }
8
-
9
- .searchResults {
10
- @include type.type-style('body-compact-02');
11
- max-height: 100%;
12
- overflow-y: auto;
13
- padding: 0 layout.$spacing-06;
14
- background-color: $ui-01;
15
- height: 25.5rem;
16
- }
17
-
18
- .locationResultsContainer {
19
- display: flex;
20
- overflow-y: auto;
21
- padding: layout.$spacing-03 layout.$spacing-01 0;
22
- }
23
-
24
- .locationRadioButton {
25
- display: flex;
26
- height: layout.$spacing-09;
27
- align-items: center;
28
- @extend .bodyCompact01;
29
- }
30
-
31
- .locationNotFound {
32
- @include type.type-style('heading-compact-01');
33
- color: $text-02;
34
- margin-bottom: layout.$spacing-05;
35
- }
36
-
37
- .radioButtonSkeleton {
38
- margin-right: 0 !important;
39
- margin-bottom: layout.$spacing-07;
40
- }
41
-
42
- .radioButtonSkeleton span {
43
- width: 100% !important;
44
- }
45
-
46
- .loadingIcon {
47
- display: flex;
48
- justify-content: center;
49
- align-items: center;
50
- max-width: 50%;
51
- margin: layout.$spacing-05 auto;
52
-
53
- :global(.cds--loading__stroke) {
54
- @include brand-03(stroke);
55
- }
56
- }
57
-
58
- .loadingContainer {
59
- margin-top: layout.$spacing-06;
60
- }
61
-
62
- .emptyState {
63
- display: flex;
64
- flex-direction: column;
65
- justify-content: center;
66
- margin: layout.$spacing-06 auto 0;
67
- }
68
-
69
- .errorNotification {
70
- margin: layout.$spacing-03 0;
71
- }
@@ -1,53 +0,0 @@
1
- import { type FetchResponse } from '@egen-civitas/esm-api';
2
- import { type FHIRLocationResource } from '@egen-civitas/esm-data-api';
3
- export interface LocationResponse {
4
- type: string;
5
- total: number;
6
- resourceType: string;
7
- meta: {
8
- lastUpdated: string;
9
- };
10
- link: Array<{
11
- relation: string;
12
- url: string;
13
- }>;
14
- id: string;
15
- entry: Array<FHIRLocationResource>;
16
- }
17
- export interface LoginLocationData {
18
- locations: Array<FHIRLocationResource>;
19
- isLoading: boolean;
20
- totalResults?: number;
21
- hasMore: boolean;
22
- loadingNewData: boolean;
23
- error: Error | null;
24
- setPage: (size: number | ((_size: number) => number)) => Promise<FetchResponse<LocationResponse>[] | undefined>;
25
- }
26
- /**
27
- * A React hook that fetches a location by its UUID using the FHIR API.
28
- *
29
- * @param locationUuid Optional UUID of the location to fetch. If not provided,
30
- * the hook returns null for the location without making a request.
31
- * @returns An object containing the location data, loading state, and any error.
32
- *
33
- * @category API
34
- */
35
- export declare function useLocationByUuid(locationUuid?: string): {
36
- location: FHIRLocationResource | null;
37
- error: any;
38
- isLoading: boolean;
39
- };
40
- /**
41
- * A React hook that fetches locations from the FHIR API with support for
42
- * pagination, filtering by tag, and searching by name. Uses SWR infinite
43
- * loading for efficient pagination.
44
- *
45
- * @param locationTag Optional tag to filter locations (e.g., 'Login Location').
46
- * @param count The number of locations to fetch per page. Defaults to 0 (no limit).
47
- * @param searchQuery Optional search string to filter locations by name.
48
- * @returns An object containing the locations array, loading states, pagination info, and any error.
49
- *
50
- * @category API
51
- */
52
- export declare function useLocations(locationTag?: string, count?: number, searchQuery?: string): LoginLocationData;
53
- //# sourceMappingURL=location-picker.resource.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"location-picker.resource.d.ts","sourceRoot":"","sources":["../../src/location-picker/location-picker.resource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAA0B,MAAM,uBAAuB,CAAC;AACnF,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGvE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE;QACJ,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,IAAI,EAAE,KAAK,CAAC;QACV,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC,CAAC;IACH,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;CACpC;AACD,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,OAAO,CAAC;IACxB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,KAAK,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC;CACjH;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,CAAC,EAAE,MAAM;;;;EAoBtD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,EAAE,WAAW,GAAE,MAAW,GAAG,iBAAiB,CAgEjH"}
@@ -1,98 +0,0 @@
1
- import { useMemo } from "react";
2
- import useSwrImmutable from "swr/immutable";
3
- import useSwrInfinite from "swr/infinite";
4
- import { fhirBaseUrl, egenFetch } from "@egen-civitas/esm-api";
5
- import { useDebounce } from "@egen-civitas/esm-react-utils";
6
- /**
7
- * A React hook that fetches a location by its UUID using the FHIR API.
8
- *
9
- * @param locationUuid Optional UUID of the location to fetch. If not provided,
10
- * the hook returns null for the location without making a request.
11
- * @returns An object containing the location data, loading state, and any error.
12
- *
13
- * @category API
14
- */ export function useLocationByUuid(locationUuid) {
15
- const url = locationUuid ? `/ws/fhir2/R4/Location?_id=${locationUuid}` : null;
16
- const { data, error, isLoading } = useSwrImmutable(url, egenFetch, {
17
- shouldRetryOnError (err) {
18
- if (err?.response?.status) {
19
- return err.response.status >= 500;
20
- }
21
- return false;
22
- }
23
- });
24
- return useMemo(()=>({
25
- location: data?.data?.entry ? data.data.entry[0] : null,
26
- error: url ? error : null,
27
- isLoading: url ? isLoading : false
28
- }), [
29
- data,
30
- isLoading,
31
- error,
32
- url
33
- ]);
34
- }
35
- /**
36
- * A React hook that fetches locations from the FHIR API with support for
37
- * pagination, filtering by tag, and searching by name. Uses SWR infinite
38
- * loading for efficient pagination.
39
- *
40
- * @param locationTag Optional tag to filter locations (e.g., 'Login Location').
41
- * @param count The number of locations to fetch per page. Defaults to 0 (no limit).
42
- * @param searchQuery Optional search string to filter locations by name.
43
- * @returns An object containing the locations array, loading states, pagination info, and any error.
44
- *
45
- * @category API
46
- */ export function useLocations(locationTag, count = 0, searchQuery = '') {
47
- const debouncedSearchQuery = useDebounce(searchQuery);
48
- function constructUrl(page, prevPageData) {
49
- if (prevPageData) {
50
- const nextLink = prevPageData.data?.link?.find((link)=>link.relation === 'next');
51
- if (!nextLink) {
52
- return null;
53
- }
54
- const nextUrl = new URL(nextLink.url);
55
- // default for production
56
- if (nextUrl.origin === window.location.origin) {
57
- return nextLink.url;
58
- }
59
- // in development, the request should be funnelled through the local proxy
60
- return new URL(`${nextUrl.pathname}${nextUrl.search ? `?${nextUrl.search}` : ''}`, window.location.origin).toString();
61
- }
62
- let url = `${fhirBaseUrl}/Location?`;
63
- let urlSearchParameters = new URLSearchParams();
64
- urlSearchParameters.append('_summary', 'data');
65
- if (count) {
66
- urlSearchParameters.append('_count', '' + count);
67
- }
68
- if (page) {
69
- urlSearchParameters.append('_getpagesoffset', '' + page * count);
70
- }
71
- if (locationTag) {
72
- urlSearchParameters.append('_tag', locationTag);
73
- }
74
- if (typeof debouncedSearchQuery === 'string' && debouncedSearchQuery !== '') {
75
- urlSearchParameters.append('name:contains', debouncedSearchQuery);
76
- }
77
- return url + urlSearchParameters.toString();
78
- }
79
- const { data, isLoading, isValidating, setSize, error } = useSwrInfinite(constructUrl, egenFetch);
80
- const memoizedLocations = useMemo(()=>{
81
- return {
82
- locations: data?.length ? data?.flatMap((entries)=>entries?.data?.entry ?? []) : [],
83
- isLoading,
84
- totalResults: data?.[0]?.data?.total,
85
- hasMore: data?.length ? data?.[data.length - 1]?.data?.link?.some((link)=>link.relation === 'next') : false,
86
- loadingNewData: isValidating,
87
- error: error || null,
88
- setPage: setSize
89
- };
90
- }, [
91
- isLoading,
92
- data,
93
- isValidating,
94
- setSize,
95
- error
96
- ]);
97
- return memoizedLocations;
98
- }
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg"><path fill="#CEE6E5" d="M59.73 22.18H19.85c-.28 0-.51.23-.51.51v38.45c0 .28.23.51.51.51h39.88c.28 0 .51-.23.51-.51V22.7c0-.28-.23-.51-.51-.51z"/><path fill="#7BBCB9" d="M54.03 46.4h-11.4a.51.51 0 0 0-.51.51v5.7c0 .282.228.51.51.51h11.4a.51.51 0 0 0 .51-.51v-5.7a.51.51 0 0 0-.51-.51M36.94 46.4h-11.4a.51.51 0 0 0-.51.51v5.7c0 .282.228.51.51.51h11.4a.51.51 0 0 0 .51-.51v-5.7a.51.51 0 0 0-.51-.51M54.03 33.58h-11.4a.51.51 0 0 0-.51.51v5.7c0 .282.228.51.51.51h11.4a.51.51 0 0 0 .51-.51v-5.7a.51.51 0 0 0-.51-.51M36.94 33.58h-11.4a.51.51 0 0 0-.51.51v5.7c0 .282.228.51.51.51h11.4a.51.51 0 0 0 .51-.51v-5.7a.51.51 0 0 0-.51-.51M49.76 27.48c-1.07 0-1.94-.87-1.94-1.94v-5.69c0-1.07.87-1.94 1.94-1.94s1.94.87 1.94 1.94v5.7c0 1.07-.87 1.94-1.94 1.94zM29.82 27.48c-1.07 0-1.94-.87-1.94-1.94v-5.69c0-1.07.87-1.94 1.94-1.94s1.94.87 1.94 1.94v5.7c0 1.07-.87 1.94-1.94 1.94z"/><path fill="#CEE6E5" d="M45.48 22.18H34.09v1.03h11.39z"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg"><path fill="#7BBCB9" d="M37.08 22.95a5.046 5.046 0 0 1-4.96 4.13c-2.78 0-5.04-2.26-5.04-5.04 0-.33.03-.66.09-.97 1.92 1.17 3.6 1.83 5.35 2.06 1.48.2 2.95.09 4.56-.18M28.27 18.79a5.04 5.04 0 0 1 8.63 1.64c-1.59.28-2.84.38-4.04.21-1.36-.19-2.76-.72-4.59-1.85M27.71 28.35c-3.45 0-6.18 2.1-7.93 4.65-1.76 2.57-2.78 5.89-2.78 9.18 0 1.75.81 3.79 1.39 5.07.32.71.64 1.33.87 1.78.1.2.19.36.26.49v10.35c0 1.39 1.13 2.52 2.52 2.52s2.52-1.13 2.52-2.52V45.43c.37-3.04 1.23-5.79 2.22-8.04l.83 3.22a2.525 2.525 0 0 0 2.44 1.89h6.48c1.39 0 2.52-1.13 2.52-2.52s-1.13-2.52-2.52-2.52H32l-1.85-7.22a2.525 2.525 0 0 0-2.44-1.89"/><path fill="#CEE6E5" d="M56.07 32.13c2.78 0 5.04-2.26 5.04-5.04s-2.26-5.04-5.04-5.04-5.04 2.26-5.04 5.04 2.26 5.04 5.04 5.04"/><path fill="#CEE6E5" fill-rule="evenodd" d="M48.79 32.18a2.53 2.53 0 0 1 2.83 1.43l3.34 7.42h4.9c1.39 0 2.52 1.13 2.52 2.52s-1.13 2.52-2.52 2.52h-6.53c-.99 0-1.89-.58-2.3-1.49l-1.81-4.02c-.58 1.06-.96 2.04-1.2 3.05-.25 1.06-.36 2.22-.34 3.64.41.17.86.34 1.34.51a49 49 0 0 0 3.67 1.07c.28.07.53.14.74.2.16.04.33.09.48.14h.01c.08.03.41.13.73.32.41.25.69.58.75.65.12.15.24.3.34.44.22.29.47.66.74 1.07.55.81 1.21 1.85 1.85 2.86s1.27 2.02 1.73 2.76c.23.37.42.68.56.9l.21.34-2.15 1.32 2.15-1.32a2.52 2.52 0 0 1-.83 3.47 2.52 2.52 0 0 1-3.47-.83l-.21-.33c-.13-.21-.32-.52-.55-.89-.46-.74-1.07-1.73-1.71-2.72-.63-1-1.27-1.99-1.78-2.74-.17-.25-.32-.47-.44-.64-.13-.03-.27-.07-.42-.11-.16-.04-.33-.09-.52-.14-.96-.26-2.25-.61-3.53-1.06l-.13-.05v9.89h-2.52v-8.82H30.85v8.82h-2.52V49.75h13.91c-.11-.11-.22-.23-.32-.36-.5-.61-.98-1.48-.98-2.58 0-5.93 1.6-9.61 3.55-11.85.96-1.1 1.95-1.79 2.74-2.2.39-.21.74-.35 1.01-.44.13-.05.25-.08.34-.11q.075-.015.12-.03c.02 0 .03 0 .05-.01h.02l.54 2.46-.53-2.46zm3.61 21.83s-.02 0-.04-.02c.03.01.04.02.04.02m-.83-.54s-.05-.06-.01-.02v.02z" clip-rule="evenodd"/><path fill="#7BBCB9" d="M39.05 24.56c1.04 0 1.89-1.41 1.89-3.15s-.85-3.15-1.89-3.15-1.89 1.41-1.89 3.15.85 3.15 1.89 3.15"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg"><path fill="#CEE6E5" d="M25.983 23.69c1.29 0 2.34-1.05 2.34-2.34a2.343 2.343 0 0 0-4.37-1.17h-.31c-1.94 0-3.52 1.57-3.52 3.52v10.55c-.64-.02-1.17.51-1.12 1.15.27 2.99 1.58 5.8 3.72 7.94 1.57 1.57 3.5 2.69 5.6 3.29v2.83c0 1.53.98 2.83 2.34 3.32a8.49 8.49 0 0 0 8.49 8.4c4.66 0 8.49-3.8 8.49-8.49V48a4.39 4.39 0 1 1 8.78 0v2.84a3.5 3.5 0 0 0-2.34 3.32c0 1.94 1.57 3.52 3.52 3.52s3.52-1.57 3.52-3.52c0-1.53-.98-2.83-2.34-3.32V48c0-3.72-3.02-6.74-6.74-6.74s-6.74 3.02-6.74 6.74v4.69c0 3.4-2.75 6.15-6.15 6.15s-6.1-2.7-6.15-6.06a3.51 3.51 0 0 0 2.34-3.31v-2.83c2.1-.59 4.03-1.72 5.6-3.29 2.14-2.14 3.45-4.95 3.72-7.94.06-.64-.47-1.17-1.12-1.17V23.69c0-1.94-1.57-3.52-3.52-3.52h-.31a2.343 2.343 0 0 0-4.37 1.17 2.343 2.343 0 0 0 4.37 1.17h.31c.65 0 1.17.52 1.17 1.17v10.55h.25c-.65 0-1.16.53-1.25 1.17a8.5 8.5 0 0 1-2.39 4.81 8.447 8.447 0 0 1-11.94 0c-1.31-1.31-2.14-3-2.39-4.81-.09-.64-.61-1.17-1.25-1.17h.25V23.69c0-.65.52-1.17 1.17-1.17h.31c.41.7 1.16 1.17 2.03 1.17"/><path fill="#7BBCB9" d="M57.943 58.5a3.88 3.88 0 1 0 0-7.76 3.88 3.88 0 0 0 0 7.76M26.073 24.14a2.57 2.57 0 1 0 0-5.14 2.57 2.57 0 0 0 0 5.14M37.503 24.14a2.57 2.57 0 1 0 0-5.14 2.57 2.57 0 0 0 0 5.14"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg"><path fill="#CEE6E5" d="M61.48 62H18.52c-.29 0-.52-.23-.52-.52V28.54c0-.29.23-.52.52-.52h30.99v-9.5c0-.29.23-.52.52-.52h11.46c.28 0 .52.23.52.52v42.96c0 .28-.23.52-.52.52z"/><path fill="#7BBCB9" d="M39.63 51.97h-6.85v8.99h6.85zM56.41 52.89h-1.03v-2.87h1.03zM48.54 52.89h-1.03v-2.87h1.03zM24.9 50.02h-1.03v2.86h1.03zM56.41 47.16h-1.03v-2.87h1.03zM48.54 47.16h-1.03v-2.87h1.03zM40.66 44.29h-1.03v2.86h1.03zM32.78 44.29h-1.03v2.86h1.03zM24.9 44.29h-1.03v2.86h1.03zM56.41 41.43h-1.03v-2.86h1.03zM48.54 41.43h-1.03v-2.86h1.03zM40.66 38.57h-1.03v2.86h1.03zM32.78 38.57h-1.03v2.86h1.03zM24.9 38.57h-1.03v2.86h1.03zM56.41 35.7h-1.03v-2.86h1.03zM48.54 35.7h-1.03v-2.86h1.03zM40.66 32.84h-1.03v2.86h1.03zM32.78 32.84h-1.03v2.86h1.03zM24.9 32.84h-1.03v2.86h1.03zM56.41 26.39h-1.03v-2.35h-2.35v-1.03h2.35v-2.35h1.03v2.35h2.35v1.03h-2.35z"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg"><path fill="#CEE6E5" d="M53.975 60.797H24.762a.525.525 0 0 1-.525-.524V23.762c0-.295.24-.525.525-.525h11.154v-6.773c0-.295.24-.524.524-.524h5.845c.295 0 .525.24.525.524v6.773h11.154c.295 0 .524.24.524.525v36.51c0 .296-.24.525-.524.525z"/><path fill="#7BBCB9" d="M40.57 55.367H30.344v1.05H40.57zM47.868 52.45H30.344v1.05h17.524zM42.242 40.04a5.73 5.73 0 0 0 2.83-4.927 5.726 5.726 0 0 0-5.715-5.714 5.726 5.726 0 0 0-5.713 5.714 5.7 5.7 0 0 0 2.84 4.927c-4.25 1.278-7.265 5.145-7.265 9.417h20.298c0-4.272-3.026-8.14-7.265-9.417zM54.5 65.462h4.096v-4.38c0-.154.12-.285.284-.285h4.38V56.7h-4.38a.28.28 0 0 1-.284-.284v-4.38h-4.097v4.38c0 .153-.12.284-.284.284h-4.38v4.097h4.38c.153 0 .284.12.284.284z"/></svg>