@helsevestikt/hviktor-angular 0.0.12 → 0.0.14

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.
@@ -3,6 +3,7 @@ import { Input, Component, booleanAttribute, Directive, CUSTOM_ELEMENTS_SCHEMA,
3
3
  import '@u-elements/u-details';
4
4
  import { FormGroupDirective, NgControl, ControlContainer, Validators, ReactiveFormsModule } from '@angular/forms';
5
5
  import { HttpClient } from '@angular/common/http';
6
+ import { computePosition, offset, flip, shift, autoUpdate } from '@floating-ui/dom';
6
7
 
7
8
  /**
8
9
  * Alert provides users with information that is especially important for them to see and understand.
@@ -842,6 +843,19 @@ class HviErrorSummary {
842
843
  focus() {
843
844
  this.container?.nativeElement.focus();
844
845
  }
846
+ /**
847
+ * Handles click on error links to prevent Angular Router navigation
848
+ * and instead focus/scroll to the target element.
849
+ */
850
+ onLinkClick(event, href) {
851
+ event.preventDefault();
852
+ const id = href.startsWith('#') ? href.slice(1) : href;
853
+ const target = document.getElementById(id);
854
+ if (target) {
855
+ target.focus();
856
+ target.scrollIntoView({ behavior: 'smooth', block: 'center' });
857
+ }
858
+ }
845
859
  get computedErrors() {
846
860
  // 1) Manual mode wins
847
861
  if (this.errors?.length)
@@ -936,7 +950,13 @@ class HviErrorSummary {
936
950
  <ul class="ds-list">
937
951
  @for (err of computedErrors; track err.href) {
938
952
  <li>
939
- <a class="ds-link" data-color="neutral" [href]="err.href">{{ err.message }}</a>
953
+ <a
954
+ class="ds-link"
955
+ data-color="neutral"
956
+ [href]="err.href"
957
+ (click)="onLinkClick($event, err.href)"
958
+ >{{ err.message }}</a
959
+ >
940
960
  </li>
941
961
  }
942
962
  </ul>
@@ -980,7 +1000,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
980
1000
  <ul class="ds-list">
981
1001
  @for (err of computedErrors; track err.href) {
982
1002
  <li>
983
- <a class="ds-link" data-color="neutral" [href]="err.href">{{ err.message }}</a>
1003
+ <a
1004
+ class="ds-link"
1005
+ data-color="neutral"
1006
+ [href]="err.href"
1007
+ (click)="onLinkClick($event, err.href)"
1008
+ >{{ err.message }}</a
1009
+ >
984
1010
  </li>
985
1011
  }
986
1012
  </ul>
@@ -1010,117 +1036,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
1010
1036
  args: ['container', { static: true }]
1011
1037
  }] } });
1012
1038
 
1013
- /**
1014
- * Decorative affix container displayed alongside a text input.
1015
- *
1016
- * @remarks
1017
- * Used together with the `hvi-field-affixes` component to wrap leading and trailing adornments.
1018
- *
1019
- * @example
1020
- * ```html
1021
- * <hvi-field-affixes>
1022
- * <hvi-field-affix>NOK</hvi-field-affix>
1023
- * <input hviInput type="text" placeholder="Amount" />
1024
- * <hvi-field-affix>per month</hvi-field-affix>
1025
- * </hvi-field-affixes>
1026
- * ```
1027
- *
1028
- * Documentation: https://designsystemet.no/en/components/docs/field/code#prefixsuffix
1029
- */
1030
- class HviFieldAffix {
1031
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldAffix, deps: [], target: i0.ɵɵFactoryTarget.Component });
1032
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: HviFieldAffix, isStandalone: true, selector: "hvi-field-affix", host: { properties: { "aria-hidden": "true" }, classAttribute: "ds-field-affix" }, ngImport: i0, template: `<ng-content />`, isInline: true });
1033
- }
1034
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldAffix, decorators: [{
1035
- type: Component,
1036
- args: [{
1037
- selector: 'hvi-field-affix',
1038
- template: `<ng-content />`,
1039
- host: {
1040
- class: 'ds-field-affix',
1041
- '[aria-hidden]': 'true',
1042
- },
1043
- }]
1044
- }] });
1045
-
1046
- /**
1047
- * Container for decorative affixes displayed alongside a text input.
1048
- *
1049
- * @remarks
1050
- * Wraps leading and trailing adornments provided by `hvi-field-affix` components.
1051
- *
1052
- * @example
1053
- * ```html
1054
- * <hvi-field-affixes>
1055
- * <hvi-field-affix>NOK</hvi-field-affix>
1056
- * <input hviInput type="text" placeholder="Amount" />
1057
- * <hvi-field-affix>per month</hvi-field-affix>
1058
- * </hvi-field-affixes>
1059
- * ```
1060
- *
1061
- * Documentation: https://designsystemet.no/en/components/docs/field/code#prefixsuffix
1062
- */
1063
- class HviFieldAffixes {
1064
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldAffixes, deps: [], target: i0.ɵɵFactoryTarget.Component });
1065
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: HviFieldAffixes, isStandalone: true, selector: "hvi-field-affixes", host: { classAttribute: "ds-field-affixes" }, ngImport: i0, template: `<ng-content />`, isInline: true });
1066
- }
1067
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldAffixes, decorators: [{
1068
- type: Component,
1069
- args: [{
1070
- selector: 'hvi-field-affixes',
1071
- template: `<ng-content />`,
1072
- host: {
1073
- class: 'ds-field-affixes',
1074
- },
1075
- }]
1076
- }] });
1077
-
1078
- class HviFieldDescription {
1079
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldDescription, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1080
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.2", type: HviFieldDescription, isStandalone: true, selector: "[hviFieldDescription]", host: { attributes: { "data-field": "description" } }, ngImport: i0 });
1081
- }
1082
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldDescription, decorators: [{
1083
- type: Directive,
1084
- args: [{
1085
- selector: '[hviFieldDescription]',
1086
- standalone: true,
1087
- host: {
1088
- 'data-field': 'description',
1089
- },
1090
- }]
1091
- }] });
1092
-
1093
- class HviFieldOptional {
1094
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldOptional, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1095
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.2", type: HviFieldOptional, isStandalone: true, selector: "[hviFieldOptional]", host: { attributes: { "data-field": "optional" } }, ngImport: i0 });
1096
- }
1097
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldOptional, decorators: [{
1098
- type: Directive,
1099
- args: [{
1100
- selector: '[hviFieldOptional]',
1101
- standalone: true,
1102
- host: {
1103
- 'data-field': 'optional',
1104
- },
1105
- }]
1106
- }] });
1107
-
1108
- class HviFieldValidation {
1109
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldValidation, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1110
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.2", type: HviFieldValidation, isStandalone: true, selector: "[hviFieldValidation]", host: { attributes: { "data-field": "validation" }, classAttribute: "ds-validation-message" }, ngImport: i0 });
1111
- }
1112
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldValidation, decorators: [{
1113
- type: Directive,
1114
- args: [{
1115
- selector: '[hviFieldValidation]',
1116
- standalone: true,
1117
- host: {
1118
- class: 'ds-validation-message',
1119
- 'data-field': 'validation',
1120
- },
1121
- }]
1122
- }] });
1123
-
1124
1039
  // Copied from https://github.com/digdir/designsystemet/blob/main/packages/react/src/components/field/field-observer.ts
1125
1040
  function fieldObserver(fieldElement) {
1126
1041
  if (!fieldElement)
@@ -1235,6 +1150,117 @@ function createOptimizedMutationObserver(callback) {
1235
1150
  return observer;
1236
1151
  }
1237
1152
 
1153
+ /**
1154
+ * Decorative affix container displayed alongside a text input.
1155
+ *
1156
+ * @remarks
1157
+ * Used together with the `hvi-field-affixes` component to wrap leading and trailing adornments.
1158
+ *
1159
+ * @example
1160
+ * ```html
1161
+ * <hvi-field-affixes>
1162
+ * <hvi-field-affix>NOK</hvi-field-affix>
1163
+ * <input hviInput type="text" placeholder="Amount" />
1164
+ * <hvi-field-affix>per month</hvi-field-affix>
1165
+ * </hvi-field-affixes>
1166
+ * ```
1167
+ *
1168
+ * Documentation: https://designsystemet.no/en/components/docs/field/code#prefixsuffix
1169
+ */
1170
+ class HviFieldAffix {
1171
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldAffix, deps: [], target: i0.ɵɵFactoryTarget.Component });
1172
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: HviFieldAffix, isStandalone: true, selector: "hvi-field-affix", host: { properties: { "aria-hidden": "true" }, classAttribute: "ds-field-affix" }, ngImport: i0, template: `<ng-content />`, isInline: true });
1173
+ }
1174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldAffix, decorators: [{
1175
+ type: Component,
1176
+ args: [{
1177
+ selector: 'hvi-field-affix',
1178
+ template: `<ng-content />`,
1179
+ host: {
1180
+ class: 'ds-field-affix',
1181
+ '[aria-hidden]': 'true',
1182
+ },
1183
+ }]
1184
+ }] });
1185
+
1186
+ /**
1187
+ * Container for decorative affixes displayed alongside a text input.
1188
+ *
1189
+ * @remarks
1190
+ * Wraps leading and trailing adornments provided by `hvi-field-affix` components.
1191
+ *
1192
+ * @example
1193
+ * ```html
1194
+ * <hvi-field-affixes>
1195
+ * <hvi-field-affix>NOK</hvi-field-affix>
1196
+ * <input hviInput type="text" placeholder="Amount" />
1197
+ * <hvi-field-affix>per month</hvi-field-affix>
1198
+ * </hvi-field-affixes>
1199
+ * ```
1200
+ *
1201
+ * Documentation: https://designsystemet.no/en/components/docs/field/code#prefixsuffix
1202
+ */
1203
+ class HviFieldAffixes {
1204
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldAffixes, deps: [], target: i0.ɵɵFactoryTarget.Component });
1205
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: HviFieldAffixes, isStandalone: true, selector: "hvi-field-affixes", host: { classAttribute: "ds-field-affixes" }, ngImport: i0, template: `<ng-content />`, isInline: true });
1206
+ }
1207
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldAffixes, decorators: [{
1208
+ type: Component,
1209
+ args: [{
1210
+ selector: 'hvi-field-affixes',
1211
+ template: `<ng-content />`,
1212
+ host: {
1213
+ class: 'ds-field-affixes',
1214
+ },
1215
+ }]
1216
+ }] });
1217
+
1218
+ class HviFieldDescription {
1219
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldDescription, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1220
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.2", type: HviFieldDescription, isStandalone: true, selector: "[hviFieldDescription]", host: { attributes: { "data-field": "description" } }, ngImport: i0 });
1221
+ }
1222
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldDescription, decorators: [{
1223
+ type: Directive,
1224
+ args: [{
1225
+ selector: '[hviFieldDescription]',
1226
+ standalone: true,
1227
+ host: {
1228
+ 'data-field': 'description',
1229
+ },
1230
+ }]
1231
+ }] });
1232
+
1233
+ class HviFieldOptional {
1234
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldOptional, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1235
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.2", type: HviFieldOptional, isStandalone: true, selector: "[hviFieldOptional]", host: { attributes: { "data-field": "optional" } }, ngImport: i0 });
1236
+ }
1237
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldOptional, decorators: [{
1238
+ type: Directive,
1239
+ args: [{
1240
+ selector: '[hviFieldOptional]',
1241
+ standalone: true,
1242
+ host: {
1243
+ 'data-field': 'optional',
1244
+ },
1245
+ }]
1246
+ }] });
1247
+
1248
+ class HviFieldValidation {
1249
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldValidation, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1250
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.2", type: HviFieldValidation, isStandalone: true, selector: "[hviFieldValidation]", host: { attributes: { "data-field": "validation" }, classAttribute: "ds-validation-message" }, ngImport: i0 });
1251
+ }
1252
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviFieldValidation, decorators: [{
1253
+ type: Directive,
1254
+ args: [{
1255
+ selector: '[hviFieldValidation]',
1256
+ standalone: true,
1257
+ host: {
1258
+ class: 'ds-validation-message',
1259
+ 'data-field': 'validation',
1260
+ },
1261
+ }]
1262
+ }] });
1263
+
1238
1264
  /**
1239
1265
  * Field is a helper component to automatically associate a field with hviLabel, hviFieldDescription and hviFieldValidation.
1240
1266
  *
@@ -1907,6 +1933,333 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
1907
1933
  type: Input
1908
1934
  }] } });
1909
1935
 
1936
+ const arrowPseudoElement = {
1937
+ name: 'ArrowPseudoElement',
1938
+ fn(data) {
1939
+ const { elements, rects, placement } = data;
1940
+ let arrowX = `${Math.round(rects.reference.width / 2 + rects.reference.x - data.x)}px`;
1941
+ let arrowY = `${Math.round(rects.reference.height / 2 + rects.reference.y - data.y)}px`;
1942
+ if (rects.reference.width > rects.floating.width) {
1943
+ arrowX = `${Math.round(rects.floating.width / 2)}px`;
1944
+ }
1945
+ if (rects.reference.height > rects.floating.height) {
1946
+ arrowY = `${Math.round(rects.floating.height / 2)}px`;
1947
+ }
1948
+ switch (placement.split('-')[0]) {
1949
+ case 'top':
1950
+ arrowY = '100%';
1951
+ break;
1952
+ case 'right':
1953
+ arrowX = '0';
1954
+ break;
1955
+ case 'bottom':
1956
+ arrowY = '0';
1957
+ break;
1958
+ case 'left':
1959
+ arrowX = '100%';
1960
+ break;
1961
+ }
1962
+ elements.floating.setAttribute('data-placement', placement.split('-')[0]);
1963
+ elements.floating.style.setProperty('--ds-popover-arrow-x', arrowX);
1964
+ elements.floating.style.setProperty('--ds-popover-arrow-y', arrowY);
1965
+ return data;
1966
+ },
1967
+ };
1968
+ /**
1969
+ * @summary
1970
+ * Popover vises over andre elementer i grensesnittet og er koblet til et spesifikt element.
1971
+ * Den brukes til å vise tilleggsinformasjon, interaktive elementer eller korte forklaringer uten å navigere bort fra siden.
1972
+ *
1973
+ * @example
1974
+ * ```html
1975
+ * <button hviButton popovertarget="popover1">Open popover</button>
1976
+ * <hvi-popover id="popover1"> Popover content </hvi-popover>
1977
+ * ```
1978
+ *
1979
+ * @see {@link https://designsystemet.no/en/components/docs/popover/code}
1980
+ */
1981
+ class HviPopover {
1982
+ el = inject((ElementRef));
1983
+ cleanupAutoUpdate;
1984
+ boundHandleClick;
1985
+ boundHandleKeydown;
1986
+ /** Popover type - 'manual' krever manuell lukking, 'auto' lukkes ved klikk utenfor */
1987
+ type = 'manual';
1988
+ /** Visuell variant */
1989
+ variant = 'default';
1990
+ /** Farge-tema */
1991
+ color = 'neutral';
1992
+ /** Plassering av popover relativt til trigger */
1993
+ placement = 'top';
1994
+ /** Aktiver automatisk repositjonering hvis det ikke er plass */
1995
+ autoPlacement = true;
1996
+ /** Event når popover åpnes */
1997
+ opened = new EventEmitter();
1998
+ /** Event når popover lukkes */
1999
+ closed = new EventEmitter();
2000
+ get popoverElement() {
2001
+ return this.el.nativeElement;
2002
+ }
2003
+ get triggerElement() {
2004
+ const id = this.popoverElement.id;
2005
+ return id ? document.querySelector(`[popovertarget="${id}"]`) : null;
2006
+ }
2007
+ ngOnInit() {
2008
+ this.setupEventListeners();
2009
+ }
2010
+ ngOnDestroy() {
2011
+ this.stopAutoUpdate();
2012
+ this.removeEventListeners();
2013
+ }
2014
+ setupEventListeners() {
2015
+ const popover = this.popoverElement;
2016
+ // Click utenfor lukker popover
2017
+ this.boundHandleClick = (event) => {
2018
+ const el = event.target;
2019
+ const isTrigger = el?.closest?.(`[popovertarget="${popover.id}"]`);
2020
+ const isOutside = !isTrigger && !popover.contains(el);
2021
+ if (isTrigger) {
2022
+ event.preventDefault();
2023
+ popover.togglePopover?.();
2024
+ }
2025
+ if (isOutside && popover.matches(':popover-open')) {
2026
+ popover.togglePopover?.();
2027
+ }
2028
+ };
2029
+ // Escape lukker popover
2030
+ this.boundHandleKeydown = (event) => {
2031
+ if (event.key !== 'Escape' || !popover.matches(':popover-open'))
2032
+ return;
2033
+ event.preventDefault();
2034
+ popover.togglePopover?.();
2035
+ };
2036
+ addEventListener('click', this.boundHandleClick);
2037
+ addEventListener('keydown', this.boundHandleKeydown);
2038
+ // Toggle events
2039
+ popover.addEventListener('beforetoggle', this.handleBeforeToggle);
2040
+ popover.addEventListener('toggle', this.handleToggle);
2041
+ }
2042
+ removeEventListeners() {
2043
+ if (this.boundHandleClick) {
2044
+ removeEventListener('click', this.boundHandleClick);
2045
+ }
2046
+ if (this.boundHandleKeydown) {
2047
+ removeEventListener('keydown', this.boundHandleKeydown);
2048
+ }
2049
+ this.popoverElement.removeEventListener('beforetoggle', this.handleBeforeToggle);
2050
+ this.popoverElement.removeEventListener('toggle', this.handleToggle);
2051
+ }
2052
+ handleBeforeToggle = (event) => {
2053
+ const toggleEvent = event;
2054
+ if (toggleEvent.newState === 'open') {
2055
+ this.updatePosition();
2056
+ }
2057
+ };
2058
+ handleToggle = (event) => {
2059
+ const toggleEvent = event;
2060
+ if (toggleEvent.newState === 'open') {
2061
+ this.startAutoUpdate();
2062
+ this.opened.emit();
2063
+ }
2064
+ else {
2065
+ this.stopAutoUpdate();
2066
+ this.closed.emit();
2067
+ }
2068
+ };
2069
+ updatePosition() {
2070
+ const trigger = this.triggerElement;
2071
+ const popover = this.popoverElement;
2072
+ if (!trigger || !popover)
2073
+ return;
2074
+ computePosition(trigger, popover, {
2075
+ placement: this.placement,
2076
+ strategy: 'fixed',
2077
+ middleware: [
2078
+ offset((data) => {
2079
+ const styles = getComputedStyle(data.elements.floating, '::before');
2080
+ return parseFloat(styles.height) || 12;
2081
+ }),
2082
+ ...(this.autoPlacement ? [flip({ fallbackAxisSideDirection: 'start' }), shift()] : []),
2083
+ arrowPseudoElement,
2084
+ ],
2085
+ }).then(({ x, y }) => {
2086
+ popover.style.translate = `${x}px ${y}px`;
2087
+ });
2088
+ }
2089
+ startAutoUpdate() {
2090
+ this.stopAutoUpdate();
2091
+ const trigger = this.triggerElement;
2092
+ const popover = this.popoverElement;
2093
+ if (!trigger || !popover)
2094
+ return;
2095
+ this.cleanupAutoUpdate = autoUpdate(trigger, popover, () => this.updatePosition());
2096
+ }
2097
+ stopAutoUpdate() {
2098
+ if (this.cleanupAutoUpdate) {
2099
+ this.cleanupAutoUpdate();
2100
+ this.cleanupAutoUpdate = undefined;
2101
+ }
2102
+ }
2103
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviPopover, deps: [], target: i0.ɵɵFactoryTarget.Component });
2104
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: HviPopover, isStandalone: true, selector: "hvi-popover", inputs: { type: "type", variant: "variant", color: "color", placement: "placement", autoPlacement: "autoPlacement" }, outputs: { opened: "opened", closed: "closed" }, host: { properties: { "attr.popover": "type", "attr.data-variant": "variant", "attr.data-color": "color" }, classAttribute: "ds-popover" }, ngImport: i0, template: '<ng-content />', isInline: true });
2105
+ }
2106
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviPopover, decorators: [{
2107
+ type: Component,
2108
+ args: [{
2109
+ selector: 'hvi-popover',
2110
+ standalone: true,
2111
+ template: '<ng-content />',
2112
+ host: {
2113
+ class: 'ds-popover',
2114
+ '[attr.popover]': 'type',
2115
+ '[attr.data-variant]': 'variant',
2116
+ '[attr.data-color]': 'color',
2117
+ },
2118
+ }]
2119
+ }], propDecorators: { type: [{
2120
+ type: Input
2121
+ }], variant: [{
2122
+ type: Input
2123
+ }], color: [{
2124
+ type: Input
2125
+ }], placement: [{
2126
+ type: Input
2127
+ }], autoPlacement: [{
2128
+ type: Input
2129
+ }], opened: [{
2130
+ type: Output
2131
+ }], closed: [{
2132
+ type: Output
2133
+ }] } });
2134
+
2135
+ /**
2136
+ * @summary
2137
+ * Select allows users to choose an option from a list.
2138
+ *
2139
+ * @example
2140
+ * ```html
2141
+ * <select hviSelect width="auto" id="select">
2142
+ * <option value="" disabled="" selected="">Select an option</option>
2143
+ * <option value="option1">Option 1</option>
2144
+ * <option value="option2">Option 2</option>
2145
+ * </select>
2146
+ * ```
2147
+ *
2148
+ * Documentation: https://designsystemet.no/en/components/docs/select/code
2149
+ */
2150
+ class HviSelect {
2151
+ /** Defines the width of Select, where "auto" matches the content width. */
2152
+ width;
2153
+ _readOnly = false;
2154
+ _disabled = false;
2155
+ /** Disabled Select. */
2156
+ set disabled(value) {
2157
+ this._disabled = value;
2158
+ }
2159
+ get disabled() {
2160
+ return this._disabled;
2161
+ }
2162
+ /** Readonly Select. */
2163
+ set readOnly(value) {
2164
+ this._readOnly = value;
2165
+ }
2166
+ get readOnly() {
2167
+ return this._readOnly;
2168
+ }
2169
+ onMouseDown(event) {
2170
+ if (this._readOnly) {
2171
+ event.preventDefault();
2172
+ event.stopImmediatePropagation();
2173
+ }
2174
+ }
2175
+ onChange(event) {
2176
+ if (this._readOnly) {
2177
+ event.preventDefault();
2178
+ event.stopImmediatePropagation();
2179
+ }
2180
+ }
2181
+ onKeydown(event) {
2182
+ if (!this._readOnly)
2183
+ return;
2184
+ if (event.key === ' ' || event.key === 'Spacebar' || event.key === 'Enter') {
2185
+ event.preventDefault();
2186
+ event.stopImmediatePropagation();
2187
+ }
2188
+ }
2189
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviSelect, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2190
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "21.1.2", type: HviSelect, isStandalone: true, selector: "select[hviSelect]", inputs: { width: "width", disabled: ["disabled", "disabled", booleanAttribute], readOnly: ["readOnly", "readOnly", booleanAttribute] }, host: { listeners: { "mousedown": "onMouseDown($event)", "change": "onChange($event)", "keydown": "onKeydown($event)" }, properties: { "attr.data-width": "width", "attr.readonly": "_readOnly ? \"\" : null", "attr.disabled": "_disabled ? \"\" : null" }, classAttribute: "ds-select ds-input" }, ngImport: i0 });
2191
+ }
2192
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviSelect, decorators: [{
2193
+ type: Directive,
2194
+ args: [{
2195
+ selector: 'select[hviSelect]',
2196
+ standalone: true,
2197
+ host: {
2198
+ class: 'ds-select ds-input',
2199
+ '[attr.data-width]': 'width',
2200
+ '[attr.readonly]': '_readOnly ? "" : null',
2201
+ '[attr.disabled]': '_disabled ? "" : null',
2202
+ },
2203
+ }]
2204
+ }], propDecorators: { width: [{
2205
+ type: Input
2206
+ }], disabled: [{
2207
+ type: Input,
2208
+ args: [{ transform: booleanAttribute }]
2209
+ }], readOnly: [{
2210
+ type: Input,
2211
+ args: [{ transform: booleanAttribute }]
2212
+ }], onMouseDown: [{
2213
+ type: HostListener,
2214
+ args: ['mousedown', ['$event']]
2215
+ }], onChange: [{
2216
+ type: HostListener,
2217
+ args: ['change', ['$event']]
2218
+ }], onKeydown: [{
2219
+ type: HostListener,
2220
+ args: ['keydown', ['$event']]
2221
+ }] } });
2222
+
2223
+ /**
2224
+ * @summary
2225
+ * Skeleton component description.
2226
+ *
2227
+ * @example
2228
+ * ```html
2229
+ * <hvi-skeleton variant="rectangle" width="100px" height="20px"></hvi-skeleton>
2230
+ * ```
2231
+ *
2232
+ * @see {@link https://designsystemet.no/en/components/docs/skeleton/code}
2233
+ */
2234
+ class HviSkeleton {
2235
+ variant = 'rectangle';
2236
+ width;
2237
+ height;
2238
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviSkeleton, deps: [], target: i0.ɵɵFactoryTarget.Component });
2239
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: HviSkeleton, isStandalone: true, selector: "hvi-skeleton", inputs: { variant: "variant", width: "width", height: "height" }, host: { properties: { "attr.aria-hidden": "true", "attr.data-variant": "variant", "style.width": "width", "style.height": "height" }, classAttribute: "ds-skeleton" }, ngImport: i0, template: '<ng-content />', isInline: true });
2240
+ }
2241
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: HviSkeleton, decorators: [{
2242
+ type: Component,
2243
+ args: [{
2244
+ selector: 'hvi-skeleton',
2245
+ standalone: true,
2246
+ template: '<ng-content />',
2247
+ host: {
2248
+ class: 'ds-skeleton',
2249
+ '[attr.aria-hidden]': 'true',
2250
+ '[attr.data-variant]': 'variant',
2251
+ '[style.width]': 'width',
2252
+ '[style.height]': 'height',
2253
+ },
2254
+ }]
2255
+ }], propDecorators: { variant: [{
2256
+ type: Input
2257
+ }], width: [{
2258
+ type: Input
2259
+ }], height: [{
2260
+ type: Input
2261
+ }] } });
2262
+
1910
2263
  /**
1911
2264
  * @summary
1912
2265
  * Tag is a label that can be used to categorize items or communicate progress, status, or process. Tags can provide users with a quicker overview of content.
@@ -1957,5 +2310,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
1957
2310
  * Generated bundle index. Do not edit.
1958
2311
  */
1959
2312
 
1960
- export { HviAlert, HviAvatar, HviBadge, HviBadgePosition, HviBreadcrumbs, HviButton, HviCard, HviCardBlock, HviChipButton, HviChipLabel, HviControlInvalid, HviDetails, HviDetailsContent, HviDetailsSummary, HviDialog, HviDialogBlock, HviDivider, HviErrorSummary, HviField, HviFieldAffix, HviFieldAffixes, HviFieldDescription, HviFieldKit, HviFieldOptional, HviFieldValidation, HviFieldset, HviForm, HviForms, HviHeading, HviIcon, HviInput, HviLabel, HviLink, HviList, HviParagraph, HviTag, HviValidationKit, HviValidationMessage, fieldObserver, hviCustom, hviEmail, hviExtractMessages, hviExtractValidators, hviMax, hviMaxLength, hviMin, hviMinLength, hviNullValidator, hviPattern, hviRequired, hviRequiredTrue, hviValidators, isElement, isInputLike, isLabel };
2313
+ export { HviAlert, HviAvatar, HviBadge, HviBadgePosition, HviBreadcrumbs, HviButton, HviCard, HviCardBlock, HviChipButton, HviChipLabel, HviControlInvalid, HviDetails, HviDetailsContent, HviDetailsSummary, HviDialog, HviDialogBlock, HviDivider, HviErrorSummary, HviField, HviFieldAffix, HviFieldAffixes, HviFieldDescription, HviFieldKit, HviFieldOptional, HviFieldValidation, HviFieldset, HviForm, HviForms, HviHeading, HviIcon, HviInput, HviLabel, HviLink, HviList, HviParagraph, HviPopover, HviSelect, HviSkeleton, HviTag, HviValidationKit, HviValidationMessage, fieldObserver, hviCustom, hviEmail, hviExtractMessages, hviExtractValidators, hviMax, hviMaxLength, hviMin, hviMinLength, hviNullValidator, hviPattern, hviRequired, hviRequiredTrue, hviValidators, isElement, isInputLike, isLabel };
1961
2314
  //# sourceMappingURL=helsevestikt-hviktor-angular.mjs.map