@onemrvapublic/design-system 22.6.0-develop.2 → 22.7.0-develop.1

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.
@@ -1,5 +1,5 @@
1
1
  // Auto-generated — do not edit
2
- const VERSION = '22.6.0-develop.2';
2
+ const VERSION = '22.7.0-develop.1';
3
3
 
4
4
  const ɵɵtsModuleIndicatorApiExtractorWorkaround = true;
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"onemrvapublic-design-system.mjs","sources":["../../../../projects/onemrva/design-system/version.ts","../../../../projects/onemrva/design-system/index.ts","../../../../projects/onemrva/design-system/onemrvapublic-design-system.ts"],"sourcesContent":["// Auto-generated — do not edit\nexport const VERSION = '22.6.0-develop.2';\n","export { VERSION } from './version';\n\nexport const ɵɵtsModuleIndicatorApiExtractorWorkaround = true;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;AACO,MAAM,OAAO,GAAG;;ACChB,MAAM,yCAAyC,GAAG;;ACFzD;;AAEG;;;;"}
1
+ {"version":3,"file":"onemrvapublic-design-system.mjs","sources":["../../../../projects/onemrva/design-system/version.ts","../../../../projects/onemrva/design-system/index.ts","../../../../projects/onemrva/design-system/onemrvapublic-design-system.ts"],"sourcesContent":["// Auto-generated — do not edit\nexport const VERSION = '22.7.0-develop.1';\n","export { VERSION } from './version';\n\nexport const ɵɵtsModuleIndicatorApiExtractorWorkaround = true;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;AACO,MAAM,OAAO,GAAG;;ACChB,MAAM,yCAAyC,GAAG;;ACFzD;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onemrvapublic/design-system",
3
- "version": "22.6.0-develop.2",
3
+ "version": "22.7.0-develop.1",
4
4
  "description": "Design System Onem/Rva without theme included",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,7 +20,8 @@
20
20
  "@ngrx/component-store": ">=21.0.0 <23.0.0",
21
21
  "ngx-mask": ">=22.0.0 <23.0.0",
22
22
  "ibantools": ">=4.5.0 <5.0.0",
23
- "libphonenumber-js": ">=1.11.0 <2.0.0"
23
+ "libphonenumber-js": ">=1.11.0 <2.0.0",
24
+ "orejime": ">=3.2.0 <4.0.0"
24
25
  },
25
26
  "peerDependenciesMeta": {
26
27
  "@angular/material-luxon-adapter": {
@@ -31,6 +32,9 @@
31
32
  },
32
33
  "ngx-mask": {
33
34
  "optional": true
35
+ },
36
+ "orejime": {
37
+ "optional": true
34
38
  }
35
39
  },
36
40
  "dependencies": {
@@ -58,6 +62,10 @@
58
62
  "types": "./types/onemrvapublic-design-system-collapsible-page-divider.d.ts",
59
63
  "default": "./fesm2022/onemrvapublic-design-system-collapsible-page-divider.mjs"
60
64
  },
65
+ "./cookie-consent": {
66
+ "types": "./types/onemrvapublic-design-system-cookie-consent.d.ts",
67
+ "default": "./fesm2022/onemrvapublic-design-system-cookie-consent.mjs"
68
+ },
61
69
  "./flag-icon": {
62
70
  "types": "./types/onemrvapublic-design-system-flag-icon.d.ts",
63
71
  "default": "./fesm2022/onemrvapublic-design-system-flag-icon.mjs"
package/theme/index.scss CHANGED
@@ -5,6 +5,7 @@
5
5
  @forward './overrides/card' as cards-*;
6
6
  @forward './overrides/checkbox' as checkbox-*;
7
7
  @forward './overrides/chips' as chips-*;
8
+ @forward './overrides/cookie-consent' as cookie-consent-*;
8
9
  @forward './overrides/datepicker' as datepicker-*;
9
10
  @forward './overrides/drag-and-drop' as drag-and-drop-*;
10
11
  @forward './overrides/dialogs' as dialogs-*;
@@ -54,6 +55,7 @@
54
55
  @use './overrides/card';
55
56
  @use './overrides/carousel';
56
57
  @use './overrides/chips';
58
+ @use './overrides/cookie-consent';
57
59
  @use './overrides/datepicker';
58
60
  @use './overrides/timepicker';
59
61
  @use './overrides/dialogs';
@@ -196,6 +198,7 @@
196
198
  @include card.override();
197
199
  @include chips.override();
198
200
  @include carousel.override();
201
+ @include cookie-consent.override();
199
202
  @include datepicker.override();
200
203
  @include timepicker.override();
201
204
  @include dialogs.override();
@@ -0,0 +1,173 @@
1
+ // Orejime (cookie consent) restyled to the design system.
2
+ // Applies on top of orejime/dist/orejime-standard.css, see the cookie-consent entry point.
3
+
4
+ @mixin override() {
5
+ .orejime-Env {
6
+ h1 {
7
+ --orejime-space-s: 8px;
8
+ }
9
+ .orejime-Modal {
10
+ padding: var(--triple-spacer) !important;
11
+ }
12
+
13
+ .orejime-Modal-header {
14
+ margin-bottom: var(--double-spacer);
15
+ }
16
+
17
+ .orejime-Modal-body {
18
+ margin-bottom: var(--double-spacer);
19
+ }
20
+
21
+ .orejime-Modal-title {
22
+ margin-bottom: var(--spacer);
23
+ }
24
+
25
+ .orejime-ModalWrapper {
26
+ border: 1px solid var(--mat-sys-outline);
27
+ border-radius: 16px;
28
+ }
29
+
30
+ .orejime-Modal-poweredByLink {
31
+ display: none;
32
+ }
33
+
34
+ .orejime-Modal-footer {
35
+ justify-content: flex-end;
36
+ }
37
+
38
+ p {
39
+ font: var(--mat-sys-body-medium) !important;
40
+ color: var(--mat-sys-on-surface);
41
+ }
42
+
43
+ @media (min-width: 960px) {
44
+ .orejime-Banner-body {
45
+ max-width: 35vw;
46
+ }
47
+ }
48
+
49
+ .orejime-Banner-actions {
50
+ display: flex;
51
+ }
52
+
53
+ // "Decline optional cookies" before "Accept all cookies"
54
+ .orejime-Banner-actionItem--decline {
55
+ order: 1;
56
+ }
57
+
58
+ .orejime-Banner-actionItem--save {
59
+ order: 2;
60
+ }
61
+
62
+ .orejime-PurposeToggles {
63
+ flex-direction: row-reverse;
64
+ gap: var(--spacer);
65
+ justify-content: center;
66
+ }
67
+
68
+ .orejime-Button {
69
+ box-sizing: border-box;
70
+ min-height: 2.25rem;
71
+ padding-inline: var(--double-spacer);
72
+ border-radius: var(--button-border-radius);
73
+ font-family: var(--brand-font);
74
+ font-size: 1rem;
75
+ font-weight: 500;
76
+ cursor: pointer;
77
+
78
+ &:hover,
79
+ &:active {
80
+ box-shadow: var(--mat-sys-level2) !important;
81
+ }
82
+
83
+ &:not([disabled]):not([aria-disabled='true']):hover,
84
+ &:not([disabled]):not([aria-disabled='true']):focus:not(:focus-visible) {
85
+ outline: none;
86
+ }
87
+
88
+ &:focus-visible {
89
+ outline: 5px solid var(--mat-sys-primary-fixed-dim);
90
+ outline-offset: 1px;
91
+ }
92
+
93
+ &:disabled {
94
+ background: var(--background-gradient);
95
+ color: var(--mat-sys-on-primary);
96
+ opacity: 0.4;
97
+ cursor: default;
98
+ box-shadow: none;
99
+ }
100
+ }
101
+
102
+ // Secondary actions, like mat-stroked-button
103
+ .orejime-Modal-saveButton,
104
+ .orejime-Button--info,
105
+ .orejime-Button--decline {
106
+ border: 2px solid var(--mat-sys-primary);
107
+ background: var(--mat-sys-surface);
108
+ color: var(--mat-sys-primary);
109
+ }
110
+
111
+ // Primary actions, like mat-flat-button color="accent"
112
+ .orejime-PurposeToggles-enableAll,
113
+ .orejime-Banner-saveButton {
114
+ border: 0;
115
+ background: var(--background-gradient);
116
+ color: var(--on-background-gradient);
117
+ }
118
+
119
+ // Purpose checkboxes rendered as Material slide toggles
120
+ .orejime-Purpose-input[type='checkbox'] {
121
+ appearance: none;
122
+ box-sizing: border-box;
123
+ flex: none;
124
+ position: relative;
125
+ width: 52px;
126
+ height: 32px;
127
+ margin: 0;
128
+ border: 2px solid var(--mat-sys-outline);
129
+ border-radius: 16px;
130
+ background: var(--mat-sys-surface-container-highest);
131
+ cursor: pointer;
132
+ transition:
133
+ background-color 0.2s cubic-bezier(0.2, 0, 0, 1),
134
+ border-color 0.2s cubic-bezier(0.2, 0, 0, 1);
135
+
136
+ // thumb
137
+ &::before {
138
+ content: '';
139
+ position: absolute;
140
+ top: 50%;
141
+ left: 4px;
142
+ width: 16px;
143
+ height: 16px;
144
+ border-radius: 50%;
145
+ background: var(--mat-sys-outline);
146
+ transform: translateY(-50%);
147
+ transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
148
+ }
149
+
150
+ &:checked {
151
+ background: var(--background-gradient);
152
+ border-color: var(--on-background-gradient);
153
+
154
+ &::before {
155
+ left: 20px;
156
+ width: 24px;
157
+ height: 24px;
158
+ background: var(--mat-sys-on-primary);
159
+ }
160
+ }
161
+
162
+ &:focus-visible {
163
+ outline: 3px solid var(--mat-sys-secondary);
164
+ outline-offset: 2px;
165
+ }
166
+
167
+ &:disabled {
168
+ opacity: 0.38;
169
+ cursor: not-allowed;
170
+ }
171
+ }
172
+ }
173
+ }
@@ -0,0 +1,143 @@
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, EnvironmentProviders } from '@angular/core';
3
+ import { Observable } from 'rxjs';
4
+
5
+ /**
6
+ * A cookie Orejime deletes when consent for its purpose is withdrawn: a name,
7
+ * a regex (also accepted as a `'/…/flags'` string), or `[name, path, domain]`
8
+ * for cookies set outside of `/` or the current domain.
9
+ */
10
+ type CookieConsentCookie = string | RegExp | [string, string, string];
11
+ interface CookieConsentPurpose {
12
+ id: string;
13
+ /** Translation key, resolved with ngx-translate when the banner is built. */
14
+ title: string;
15
+ /** Translation key, resolved with ngx-translate when the banner is built. */
16
+ description?: string;
17
+ cookies?: CookieConsentCookie[];
18
+ isMandatory?: boolean;
19
+ isExempt?: boolean;
20
+ default?: boolean;
21
+ runsOnce?: boolean;
22
+ }
23
+ interface CookieConsentOptions {
24
+ /**
25
+ * The purposes the user can consent to. The essential purpose
26
+ * (`ESSENTIAL_COOKIE_PURPOSE`) is prepended unless `essentialPurpose` is false.
27
+ */
28
+ purposes: CookieConsentPurpose[];
29
+ /**
30
+ * Link shown in the banner and the modal, either a single URL or one per
31
+ * language. Defaults to the ONEM cookie policy.
32
+ */
33
+ privacyPolicyUrl?: string | Partial<Record<string, string>>;
34
+ /** Adds the mandatory essential-cookies purpose. Defaults to true. */
35
+ essentialPurpose?: boolean;
36
+ /**
37
+ * Cookie in which Orejime stores the consent. The name is required so that
38
+ * applications sharing a domain never share their consent. Bump it to ask
39
+ * every user for consent again, e.g. after adding a purpose.
40
+ */
41
+ cookie: {
42
+ name: string;
43
+ duration?: number;
44
+ domain?: string;
45
+ sameSite?: 'strict' | 'lax' | 'none';
46
+ };
47
+ forceModal?: boolean;
48
+ forceBanner?: boolean;
49
+ /**
50
+ * Where Orejime mounts itself. Defaults to a new element at the start of
51
+ * `<body>`, which must then carry the `onemrva-theme` class to be styled.
52
+ */
53
+ orejimeElement?: string | HTMLElement;
54
+ /**
55
+ * Raw Orejime translations, deep-merged over the library labels.
56
+ * Use it for app-specific wording; the defaults live under the
57
+ * `cookieConsent` key of the design-system translation files.
58
+ */
59
+ translations?: OrejimeTranslations;
60
+ }
61
+ type OrejimeTranslations = Record<string, Record<string, string>>;
62
+ /** The configuration object `loadOrejime()` expects. */
63
+ interface OrejimeConfig {
64
+ privacyPolicyUrl: string;
65
+ purposes: CookieConsentPurpose[];
66
+ cookie?: CookieConsentOptions['cookie'];
67
+ forceModal?: boolean;
68
+ forceBanner?: boolean;
69
+ orejimeElement?: string | HTMLElement;
70
+ translations?: OrejimeTranslations;
71
+ }
72
+ interface OrejimeManager {
73
+ getConsent(purposeId: string): boolean;
74
+ setConsent(purposeId: string, consent: boolean): void;
75
+ clearConsents(): void;
76
+ acceptAll(): void;
77
+ declineAll(): void;
78
+ on(event: 'update', callback: (updated: Record<string, boolean>, all: Record<string, boolean>) => void): void;
79
+ on(event: 'clear', callback: () => void): void;
80
+ }
81
+ interface OrejimeInstance {
82
+ prompt(): void;
83
+ manager: OrejimeManager;
84
+ }
85
+ /** Signature of the global installed by `orejime/dist/orejime-standard-*.js`. */
86
+ type LoadOrejime = (config: OrejimeConfig) => OrejimeInstance;
87
+
88
+ declare const COOKIE_CONSENT_OPTIONS: InjectionToken<CookieConsentOptions>;
89
+ /**
90
+ * Configures the cookie consent banner. Nothing is shown until
91
+ * `CookieConsentService.init()` is called, so the app decides when
92
+ * (typically after authentication and once translations are loaded).
93
+ */
94
+ declare function provideCookieConsent(options: CookieConsentOptions): EnvironmentProviders;
95
+
96
+ declare const ESSENTIAL_COOKIE_PURPOSE = "essential";
97
+ /**
98
+ * Angular wrapper around Orejime (https://orejime.boscop.fr).
99
+ *
100
+ * Orejime is not bundled: the app loads `orejime/dist/orejime-standard-en.js`
101
+ * and `orejime/dist/orejime-standard.css` through the `scripts` and `styles`
102
+ * of its `angular.json`, which installs the global `loadOrejime()` used here.
103
+ *
104
+ * The orejime-standard-<lang>.js bundles only differ by their default texts,
105
+ * and every text is overridden from the `cookieConsent` translations of the
106
+ * current language, so a single bundle serves every language.
107
+ *
108
+ * Labels are resolved once, in `init()`. Orejime cannot be re-translated in
109
+ * place, so apps that switch language at runtime should reload the page.
110
+ */
111
+ declare class CookieConsentService {
112
+ private readonly options;
113
+ private readonly translate;
114
+ private readonly document;
115
+ private instance?;
116
+ private initialization?;
117
+ private readonly consentsSubject;
118
+ /** Consent per purpose id; empty until `init()` has resolved. */
119
+ readonly consents: i0.Signal<Record<string, boolean>>;
120
+ /**
121
+ * Shows the banner if the user has not decided yet, and starts tracking
122
+ * consent. Waits for the current language's translations. Safe to call
123
+ * more than once.
124
+ */
125
+ init(): Promise<void>;
126
+ /** Emits the consent for one purpose now and on every change. */
127
+ consent$(purposeId: string): Observable<boolean>;
128
+ hasConsent(purposeId: string): boolean;
129
+ /**
130
+ * Opens the preferences modal, e.g. from a "Cookie settings" footer link.
131
+ * Initializes first if needed, so a misconfiguration surfaces as an error
132
+ * instead of a button that does nothing.
133
+ */
134
+ openPreferences(): Promise<void>;
135
+ private load;
136
+ private createConfig;
137
+ private privacyPolicyUrl;
138
+ static ɵfac: i0.ɵɵFactoryDeclaration<CookieConsentService, never>;
139
+ static ɵprov: i0.ɵɵInjectableDeclaration<CookieConsentService>;
140
+ }
141
+
142
+ export { COOKIE_CONSENT_OPTIONS, CookieConsentService, ESSENTIAL_COOKIE_PURPOSE, provideCookieConsent };
143
+ export type { CookieConsentCookie, CookieConsentOptions, CookieConsentPurpose, LoadOrejime, OrejimeConfig, OrejimeInstance, OrejimeManager, OrejimeTranslations };
@@ -1,4 +1,4 @@
1
- declare const VERSION = "22.6.0-develop.2";
1
+ declare const VERSION = "22.7.0-develop.1";
2
2
 
3
3
  declare const ɵɵtsModuleIndicatorApiExtractorWorkaround = true;
4
4