@dso-toolkit/core 61.0.0 → 62.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 (51) hide show
  1. package/dist/cjs/dso-date-picker.cjs.entry.js +22 -79
  2. package/dist/cjs/dso-date-picker.cjs.entry.js.map +1 -1
  3. package/dist/cjs/dso-info_2.cjs.entry.js +8 -1
  4. package/dist/cjs/dso-info_2.cjs.entry.js.map +1 -1
  5. package/dist/cjs/dso-map-overlays.cjs.entry.js +1 -1
  6. package/dist/cjs/dso-map-overlays.cjs.entry.js.map +1 -1
  7. package/dist/cjs/dso-toolkit.cjs.js +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/collection/components/date-picker/date-picker.interfaces.js.map +1 -1
  10. package/dist/collection/components/date-picker/date-picker.js +17 -28
  11. package/dist/collection/components/date-picker/date-picker.js.map +1 -1
  12. package/dist/collection/components/date-picker/date-utils.js +7 -53
  13. package/dist/collection/components/date-picker/date-utils.js.map +1 -1
  14. package/dist/collection/components/map-overlays/map-overlays.js +1 -1
  15. package/dist/collection/components/map-overlays/map-overlays.js.map +1 -1
  16. package/dist/collection/components/selectable/selectable.interfaces.js.map +1 -1
  17. package/dist/collection/components/selectable/selectable.js +8 -1
  18. package/dist/collection/components/selectable/selectable.js.map +1 -1
  19. package/dist/components/dso-date-picker.js +23 -80
  20. package/dist/components/dso-date-picker.js.map +1 -1
  21. package/dist/components/dso-map-overlays.js +1 -1
  22. package/dist/components/dso-map-overlays.js.map +1 -1
  23. package/dist/components/selectable.js +8 -1
  24. package/dist/components/selectable.js.map +1 -1
  25. package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
  26. package/dist/dso-toolkit/dso-toolkit.esm.js.map +1 -1
  27. package/dist/dso-toolkit/{p-e45febe8.entry.js → p-a91673a9.entry.js} +2 -2
  28. package/dist/dso-toolkit/p-a91673a9.entry.js.map +1 -0
  29. package/dist/dso-toolkit/p-c47aea93.entry.js +2 -0
  30. package/dist/dso-toolkit/p-c47aea93.entry.js.map +1 -0
  31. package/dist/dso-toolkit/p-e729bdf2.entry.js +2 -0
  32. package/dist/dso-toolkit/p-e729bdf2.entry.js.map +1 -0
  33. package/dist/esm/dso-date-picker.entry.js +22 -79
  34. package/dist/esm/dso-date-picker.entry.js.map +1 -1
  35. package/dist/esm/dso-info_2.entry.js +8 -1
  36. package/dist/esm/dso-info_2.entry.js.map +1 -1
  37. package/dist/esm/dso-map-overlays.entry.js +1 -1
  38. package/dist/esm/dso-map-overlays.entry.js.map +1 -1
  39. package/dist/esm/dso-toolkit.js +1 -1
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/types/components/date-picker/date-picker.d.ts +0 -1
  42. package/dist/types/components/date-picker/date-picker.interfaces.d.ts +30 -3
  43. package/dist/types/components/date-picker/date-utils.d.ts +3 -13
  44. package/dist/types/components/selectable/selectable.d.ts +1 -0
  45. package/dist/types/components/selectable/selectable.interfaces.d.ts +3 -1
  46. package/package.json +2 -2
  47. package/dist/dso-toolkit/p-8b24f933.entry.js +0 -2
  48. package/dist/dso-toolkit/p-8b24f933.entry.js.map +0 -1
  49. package/dist/dso-toolkit/p-aadd6311.entry.js +0 -2
  50. package/dist/dso-toolkit/p-aadd6311.entry.js.map +0 -1
  51. package/dist/dso-toolkit/p-e45febe8.entry.js.map +0 -1
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-d46ec033.js');
6
6
 
7
7
  /**
8
- * @param value date string in Dutch format DD-MM-YYYY
8
+ * dd-mm-yyyy to yyyy-mm-dd
9
9
  */
10
10
  function parseToValueFormat(value) {
11
11
  if (!value) {
@@ -24,63 +24,17 @@ function parseToValueFormat(value) {
24
24
  }
25
25
  return value;
26
26
  }
27
- function createDate(year, month, day) {
28
- const dayInt = parseInt(day, 10);
29
- const monthInt = parseInt(month, 10);
30
- const yearInt = parseInt(year, 10);
31
- const isValid = Number.isInteger(yearInt) && // all parts should be integers
32
- Number.isInteger(monthInt) &&
33
- Number.isInteger(dayInt) &&
34
- monthInt > 0 && // month must be 1-12
35
- monthInt <= 12 &&
36
- dayInt > 0 && // day must be 1-31
37
- dayInt <= 31 &&
38
- yearInt > 0;
39
- if (isValid) {
40
- return new Date(yearInt, monthInt - 1, dayInt);
41
- }
42
- }
43
- /**
44
- * @param value date string in format D-M-YYYY
45
- */
46
- function parseDate(value) {
47
- if (!value) {
48
- return;
49
- }
50
- const matches = value.split("-");
51
- if (matches.length === 3 &&
52
- typeof matches[0] === "string" &&
53
- typeof matches[1] === "string" &&
54
- typeof matches[2] === "string" &&
55
- matches[0].length === 4) {
56
- return createDate(matches[0], matches[1], matches[2]);
57
- }
58
- }
59
27
  /**
60
- * print date in format DD-MM-YYYY
61
- * @param date
28
+ * yyyy-mm-dd to dd-mm-yyyy
62
29
  */
63
- function printDutchDate(date) {
30
+ function parseToDutchFormat(date) {
64
31
  if (!date) {
65
32
  return "";
66
33
  }
67
- const d = date.getDate().toString(10).padStart(2, "0");
68
- const m = (date.getMonth() + 1).toString(10).padStart(2, "0");
69
- const y = date.getFullYear().toString(10).padStart(2, "0");
70
- return `${d}-${m}-${y}`;
71
- }
72
- /**
73
- * Ensures date is within range, returns min or max if out of bounds
74
- */
75
- function clamp(date, min, max) {
76
- const time = date.getTime();
77
- if (min && min instanceof Date && time < min.getTime()) {
78
- return min;
79
- }
80
- if (max && max instanceof Date && time > max.getTime()) {
81
- return max;
82
- }
83
- return date;
34
+ const dd = date.getDate().toString(10).padStart(2, "0");
35
+ const mm = (date.getMonth() + 1).toString(10).padStart(2, "0");
36
+ const yyyy = date.getFullYear().toString(10);
37
+ return `${dd}-${mm}-${yyyy}`;
84
38
  }
85
39
 
86
40
  const datePickerCss = ".sc-dso-date-picker-h{display:block}[invalid].sc-dso-date-picker-h:not([invalid=false]) .dso-date__input.sc-dso-date-picker{border-color:#ce3f51}.dso-date__input.sc-dso-date-picker{display:block;width:100%;height:40px;padding:6px 14px;font-size:1rem;line-height:1.5;color:#191919;background-color:#fff;background-image:none;border:1px solid #275937;border-radius:4px;transition:border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s}.dso-date__input.sc-dso-date-picker::-moz-placeholder{color:#666;opacity:1}.dso-date__input.sc-dso-date-picker:-ms-input-placeholder{color:#666}.dso-date__input.sc-dso-date-picker::-webkit-input-placeholder{color:#666}.dso-date__input.sc-dso-date-picker::-ms-expand{background-color:transparent;border:0}.dso-date__input.sc-dso-date-picker:focus{border-color:#275937;outline:0;box-shadow:inset 0 0 0 1px #275937}.dso-date__input[disabled].sc-dso-date-picker,.dso-date__input[readonly].sc-dso-date-picker,fieldset[disabled].sc-dso-date-picker .dso-date__input.sc-dso-date-picker{background-color:#fff;opacity:1}.dso-date__input[disabled].sc-dso-date-picker,fieldset[disabled].sc-dso-date-picker .dso-date__input.sc-dso-date-picker{cursor:default}.dso-date__input[disabled].sc-dso-date-picker{border-color:#e5e5e5;color:#999}.dso-date__input[readonly].sc-dso-date-picker{border-width:1px}.dso-date__input[type=text].sc-dso-date-picker{line-height:40px}.dso-date__input[size].sc-dso-date-picker{width:auto}.dso-date__input.sc-dso-date-picker::-webkit-calendar-picker-indicator{position:relative;inset-inline-end:-8px;font-size:1.75rem;filter:invert(50%) sepia(66%) saturate(6528%) hue-rotate(71deg) brightness(94%) contrast(91%)}";
@@ -126,40 +80,29 @@ const DsoDatePicker = class {
126
80
  if (!(target instanceof HTMLInputElement)) {
127
81
  return;
128
82
  }
129
- const { value } = target;
83
+ const { valueAsDate, validity } = target;
130
84
  const event = {
131
- originalEvent: e,
132
85
  component: "dso-date-picker",
133
- value,
134
- valueAsDate: parseDate(value),
86
+ originalEvent: e,
87
+ validity,
88
+ value: parseToDutchFormat(valueAsDate),
89
+ valueAsDate: valueAsDate !== null && valueAsDate !== void 0 ? valueAsDate : undefined,
135
90
  };
136
- if (event.valueAsDate) {
137
- event.value = printDutchDate(event.valueAsDate);
138
- }
139
- if (!event.valueAsDate && this.required) {
91
+ if (validity.valueMissing) {
140
92
  event.error = "required";
141
93
  }
142
- if (event.value && !event.valueAsDate) {
143
- event.error = "invalid";
94
+ else if (validity.rangeUnderflow) {
95
+ event.error = "min-range";
96
+ event.valueAsDate = undefined;
144
97
  }
145
- if (event.valueAsDate && (this.min || this.max)) {
146
- const min = parseDate(this.min);
147
- const max = parseDate(this.max);
148
- const clampValue = clamp(event.valueAsDate, min, max);
149
- if (clampValue !== event.valueAsDate && clampValue === min) {
150
- event.valueAsDate = undefined;
151
- event.error = "min-range";
152
- }
153
- else if (clampValue !== event.valueAsDate && clampValue === max) {
154
- event.valueAsDate = undefined;
155
- event.error = "max-range";
156
- }
98
+ else if (validity.rangeOverflow) {
99
+ event.error = "max-range";
100
+ event.valueAsDate = undefined;
157
101
  }
158
- this.value = typeof value === "string" ? value : event.value;
159
- if (this.value !== this.previousValue) {
160
- this.dsoDateChange.emit(event);
161
- this.previousValue = this.value;
102
+ else if (!validity.valid) {
103
+ event.error = "invalid";
162
104
  }
105
+ this.dsoDateChange.emit(event);
163
106
  };
164
107
  this.name = "dso-date";
165
108
  this.identifier = undefined;
@@ -1 +1 @@
1
- {"file":"dso-date-picker.entry.cjs.js","mappings":";;;;;;AAAA;;;SAGgB,kBAAkB,CAAC,KAAyB;EAC1D,IAAI,CAAC,KAAK,EAAE;IACV,OAAO;GACR;EAED,MAAM,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;EAEjC,IACE,OAAO,CAAC,MAAM,KAAK,CAAC;IACpB,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,QAAQ;IAC9B,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,QAAQ;IAC9B,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,QAAQ;IAC9B,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EACvB;IACA,OAAO,OAAO;OACX,GAAG,CAAC,CAAC,KAAK,MAAM,KAAK,CAAC,MAAM,KAAK,CAAC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KAAK,EAAE,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EACrC,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,GAAG,EAAE,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,EACjC,GAAG,EAAE,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,EACjC,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,SAAS,EACpC,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,SAAS,uBAClB,MAAM,kBACV,MAAA,IAAI,CAAC,OAAO,0CAAE,QAAQ,EAAE,sBACpB,IAAI,CAAC,WAAW,EAClC,YAAY,EAAC,KAAK,EAClB,SAAS,EAAE,IAAI,CAAC,YAAY,IAAI,SAAS,EACzC,MAAM,EAAE,IAAI,CAAC,UAAU,EACvB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,SAAS,EAAE,IAAI,CAAC,aAAa,EAC7B,QAAQ,EAAE,IAAI,CAAC,iBAAiB,GAChC,EACF;GACH;;;;;;;","names":["h"],"sources":["src/components/date-picker/date-utils.ts","src/components/date-picker/date-picker.scss?tag=dso-date-picker&encapsulation=scoped","src/components/date-picker/date-picker.tsx"],"sourcesContent":["/**\r\n * @param value date string in Dutch format DD-MM-YYYY\r\n */\r\nexport function parseToValueFormat(value: string | undefined): string | undefined {\r\n if (!value) {\r\n return;\r\n }\r\n\r\n const matches = value.split(\"-\");\r\n\r\n if (\r\n matches.length === 3 &&\r\n typeof matches[0] === \"string\" &&\r\n typeof matches[1] === \"string\" &&\r\n typeof matches[2] === \"string\" &&\r\n matches[2].length === 4\r\n ) {\r\n return matches\r\n .map((match) => (match.length === 1 ? `0${match}` : match))\r\n .reverse()\r\n .join(\"-\");\r\n }\r\n\r\n return value;\r\n}\r\n\r\nexport function createDate(year: string, month: string, day: string): Date | undefined {\r\n const dayInt = parseInt(day, 10);\r\n const monthInt = parseInt(month, 10);\r\n const yearInt = parseInt(year, 10);\r\n\r\n const isValid =\r\n Number.isInteger(yearInt) && // all parts should be integers\r\n Number.isInteger(monthInt) &&\r\n Number.isInteger(dayInt) &&\r\n monthInt > 0 && // month must be 1-12\r\n monthInt <= 12 &&\r\n dayInt > 0 && // day must be 1-31\r\n dayInt <= 31 &&\r\n yearInt > 0;\r\n\r\n if (isValid) {\r\n return new Date(yearInt, monthInt - 1, dayInt);\r\n }\r\n}\r\n\r\n/**\r\n * @param value date string in format D-M-YYYY\r\n */\r\nexport function parseDate(value: string | undefined): Date | undefined {\r\n if (!value) {\r\n return;\r\n }\r\n\r\n const matches = value.split(\"-\");\r\n\r\n if (\r\n matches.length === 3 &&\r\n typeof matches[0] === \"string\" &&\r\n typeof matches[1] === \"string\" &&\r\n typeof matches[2] === \"string\" &&\r\n matches[0].length === 4\r\n ) {\r\n return createDate(matches[0], matches[1], matches[2]);\r\n }\r\n}\r\n\r\n/**\r\n * print date in format DD-MM-YYYY\r\n * @param date\r\n */\r\nexport function printDutchDate(date: Date | undefined): string {\r\n if (!date) {\r\n return \"\";\r\n }\r\n\r\n const d = date.getDate().toString(10).padStart(2, \"0\");\r\n const m = (date.getMonth() + 1).toString(10).padStart(2, \"0\");\r\n const y = date.getFullYear().toString(10).padStart(2, \"0\");\r\n\r\n return `${d}-${m}-${y}`;\r\n}\r\n\r\n/**\r\n * Ensures date is within range, returns min or max if out of bounds\r\n */\r\nexport function clamp(date: Date, min?: Date, max?: Date): Date {\r\n const time = date.getTime();\r\n\r\n if (min && min instanceof Date && time < min.getTime()) {\r\n return min;\r\n }\r\n\r\n if (max && max instanceof Date && time > max.getTime()) {\r\n return max;\r\n }\r\n\r\n return date;\r\n}\r\n","@use \"~dso-toolkit/src/variables/units\";\r\n@use \"~dso-toolkit/src/variables/colors\";\r\n@use \"~dso-toolkit/src/variables/zindex\";\r\n@use \"~dso-toolkit/src/components/form-control\";\r\n\r\n@use \"date-picker.variables\" as core-date-picker-variables;\r\n\r\n:host {\r\n display: block;\r\n\r\n &[invalid]:not([invalid=\"false\"]) {\r\n .dso-date__input {\r\n border-color: colors.$danger-color;\r\n }\r\n }\r\n}\r\n\r\n.dso-date__input {\r\n @include form-control.root();\r\n\r\n &::-webkit-calendar-picker-indicator {\r\n position: relative;\r\n inset-inline-end: -8px;\r\n\r\n font-size: 1.75rem;\r\n\r\n filter: invert(50%) sepia(66%) saturate(6528%) hue-rotate(71deg) brightness(94%) contrast(91%);\r\n }\r\n}\r\n","import { Component, ComponentInterface, Prop, Element, h, Event, EventEmitter } from \"@stencil/core\";\r\n\r\nimport { DatePickerChangeEvent, DatePickerFocusEvent, DatePickerKeyboardEvent } from \"./date-picker.interfaces\";\r\nimport { clamp, parseDate, parseToValueFormat, printDutchDate } from \"./date-utils\";\r\n\r\n@Component({\r\n tag: \"dso-date-picker\",\r\n styleUrl: \"date-picker.scss\",\r\n shadow: false,\r\n scoped: true,\r\n})\r\nexport class DsoDatePicker implements ComponentInterface {\r\n private previousValue?: string;\r\n\r\n /**\r\n * Reference to host HTML element.\r\n */\r\n @Element()\r\n element!: HTMLDsoDatePickerElement;\r\n\r\n /**\r\n * Name of the date picker input.\r\n */\r\n @Prop()\r\n name = \"dso-date\";\r\n\r\n /**\r\n * Adds a unique identifier for the date picker input. Use this instead of html `id` attribute.\r\n */\r\n @Prop()\r\n identifier: string | undefined;\r\n\r\n /**\r\n * Makes the date picker input component disabled. This prevents users from being able to\r\n * interact with the input, and conveys its inactive state to assistive technologies.\r\n */\r\n @Prop({ reflect: true })\r\n disabled = false;\r\n\r\n /**\r\n * Should the input be marked as required?\r\n */\r\n @Prop({ reflect: true })\r\n required = false;\r\n\r\n /**\r\n * Is input invalid?\r\n */\r\n @Prop({ reflect: true })\r\n invalid?: boolean;\r\n\r\n /**\r\n * ID of element that describes the input element\r\n */\r\n @Prop()\r\n describedBy?: string;\r\n\r\n /**\r\n * Should the input be focused on load?\r\n */\r\n @Prop()\r\n dsoAutofocus = false;\r\n\r\n /**\r\n * Date value. Must be in Dutch date format: DD-MM-YYYY.\r\n */\r\n @Prop()\r\n value = \"\";\r\n\r\n /**\r\n * Minimum date allowed to be picked. Must be in Dutch date format: DD-MM-YYYY.\r\n * This setting can be used alone or together with the max property.\r\n */\r\n @Prop()\r\n min: string | undefined;\r\n\r\n /**\r\n * Maximum date allowed to be picked. Must be in Dutch date format: DD-MM-YYYY.\r\n * This setting can be used alone or together with the min property.\r\n */\r\n @Prop()\r\n max: string | undefined;\r\n\r\n /**\r\n * Events section.\r\n */\r\n\r\n /**\r\n * Event emitted when a date is selected.\r\n */\r\n @Event()\r\n dsoDateChange!: EventEmitter<DatePickerChangeEvent>;\r\n\r\n /**\r\n * Event emitted the date picker input is blurred.\r\n */\r\n @Event()\r\n dsoBlur!: EventEmitter<DatePickerFocusEvent>;\r\n\r\n /**\r\n * Event emitted on key up in the date picker input.\r\n */\r\n @Event()\r\n dsoKeyUp!: EventEmitter<DatePickerKeyboardEvent>;\r\n\r\n /**\r\n * Event emitted on key down in the date picker input.\r\n */\r\n @Event()\r\n dsoKeyDown!: EventEmitter<DatePickerKeyboardEvent>;\r\n\r\n /**\r\n * Event emitted the date picker input is focused.\r\n */\r\n @Event()\r\n dsoFocus!: EventEmitter<DatePickerFocusEvent>;\r\n\r\n private handleBlur = (event: FocusEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoBlur.emit({\r\n originalEvent: event,\r\n component: \"dso-date-picker\",\r\n });\r\n };\r\n\r\n private handleFocus = (event: FocusEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoFocus.emit({\r\n originalEvent: event,\r\n component: \"dso-date-picker\",\r\n });\r\n };\r\n\r\n private handleKeyUp = (event: KeyboardEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoKeyUp.emit({\r\n component: \"dso-date-picker\",\r\n originalEvent: event,\r\n });\r\n };\r\n\r\n private handleKeyDown = (event: KeyboardEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoKeyDown.emit({\r\n component: \"dso-date-picker\",\r\n originalEvent: event,\r\n });\r\n };\r\n\r\n private handleInputChange = (e: Event) => {\r\n const target = e.target;\r\n\r\n if (!(target instanceof HTMLInputElement)) {\r\n return;\r\n }\r\n\r\n const { value } = target;\r\n\r\n const event: DatePickerChangeEvent = {\r\n originalEvent: e,\r\n component: \"dso-date-picker\",\r\n value,\r\n valueAsDate: parseDate(value),\r\n };\r\n\r\n if (event.valueAsDate) {\r\n event.value = printDutchDate(event.valueAsDate);\r\n }\r\n\r\n if (!event.valueAsDate && this.required) {\r\n event.error = \"required\";\r\n }\r\n\r\n if (event.value && !event.valueAsDate) {\r\n event.error = \"invalid\";\r\n }\r\n\r\n if (event.valueAsDate && (this.min || this.max)) {\r\n const min = parseDate(this.min);\r\n const max = parseDate(this.max);\r\n const clampValue = clamp(event.valueAsDate, min, max);\r\n\r\n if (clampValue !== event.valueAsDate && clampValue === min) {\r\n event.valueAsDate = undefined;\r\n event.error = \"min-range\";\r\n } else if (clampValue !== event.valueAsDate && clampValue === max) {\r\n event.valueAsDate = undefined;\r\n event.error = \"max-range\";\r\n }\r\n }\r\n\r\n this.value = typeof value === \"string\" ? value : event.value;\r\n\r\n if (this.value !== this.previousValue) {\r\n this.dsoDateChange.emit(event);\r\n this.previousValue = this.value;\r\n }\r\n };\r\n\r\n render() {\r\n return (\r\n <input\r\n type=\"date\"\r\n id={this.identifier}\r\n class=\"dso-date__input\"\r\n value={parseToValueFormat(this.value)}\r\n name={this.name}\r\n min={parseToValueFormat(this.min)}\r\n max={parseToValueFormat(this.max)}\r\n disabled={this.disabled || undefined}\r\n required={this.required || undefined}\r\n aria-autocomplete=\"none\"\r\n aria-invalid={this.invalid?.toString()}\r\n aria-describedby={this.describedBy}\r\n autoComplete=\"off\"\r\n autofocus={this.dsoAutofocus || undefined}\r\n onBlur={this.handleBlur}\r\n onFocus={this.handleFocus}\r\n onKeyUp={this.handleKeyUp}\r\n onKeyDown={this.handleKeyDown}\r\n onChange={this.handleInputChange}\r\n />\r\n );\r\n }\r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AW,EACzB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,SAAS,EAAE,IAAI,CAAC,aAAa,EAC7B,QAAQ,EAAE,IAAI,CAAC,iBAAiB,GAChC,EACF;GACH;;;;;;;","names":["h"],"sources":["src/components/date-picker/date-utils.ts","src/components/date-picker/date-picker.scss?tag=dso-date-picker&encapsulation=scoped","src/components/date-picker/date-picker.tsx"],"sourcesContent":["/**\r\n * dd-mm-yyyy to yyyy-mm-dd\r\n */\r\nexport function parseToValueFormat(value: string | undefined): string | undefined {\r\n if (!value) {\r\n return;\r\n }\r\n\r\n const matches = value.split(\"-\");\r\n\r\n if (\r\n matches.length === 3 &&\r\n typeof matches[0] === \"string\" &&\r\n typeof matches[1] === \"string\" &&\r\n typeof matches[2] === \"string\" &&\r\n matches[2].length === 4\r\n ) {\r\n return matches\r\n .map((match) => (match.length === 1 ? `0${match}` : match))\r\n .reverse()\r\n .join(\"-\");\r\n }\r\n\r\n return value;\r\n}\r\n\r\n/**\r\n * yyyy-mm-dd to dd-mm-yyyy\r\n */\r\nexport function parseToDutchFormat(date: Date | null): string {\r\n if (!date) {\r\n return \"\";\r\n }\r\n\r\n const dd = date.getDate().toString(10).padStart(2, \"0\");\r\n const mm = (date.getMonth() + 1).toString(10).padStart(2, \"0\");\r\n const yyyy = date.getFullYear().toString(10);\r\n\r\n return `${dd}-${mm}-${yyyy}`;\r\n}\r\n","@use \"~dso-toolkit/src/variables/units\";\r\n@use \"~dso-toolkit/src/variables/colors\";\r\n@use \"~dso-toolkit/src/variables/zindex\";\r\n@use \"~dso-toolkit/src/components/form-control\";\r\n\r\n@use \"date-picker.variables\" as core-date-picker-variables;\r\n\r\n:host {\r\n display: block;\r\n\r\n &[invalid]:not([invalid=\"false\"]) {\r\n .dso-date__input {\r\n border-color: colors.$danger-color;\r\n }\r\n }\r\n}\r\n\r\n.dso-date__input {\r\n @include form-control.root();\r\n\r\n &::-webkit-calendar-picker-indicator {\r\n position: relative;\r\n inset-inline-end: -8px;\r\n\r\n font-size: 1.75rem;\r\n\r\n filter: invert(50%) sepia(66%) saturate(6528%) hue-rotate(71deg) brightness(94%) contrast(91%);\r\n }\r\n}\r\n","import { Component, ComponentInterface, Prop, Element, h, Event, EventEmitter } from \"@stencil/core\";\r\n\r\nimport { DatePickerChangeEvent, DatePickerFocusEvent, DatePickerKeyboardEvent } from \"./date-picker.interfaces\";\r\nimport { parseToValueFormat, parseToDutchFormat } from \"./date-utils\";\r\n\r\n@Component({\r\n tag: \"dso-date-picker\",\r\n styleUrl: \"date-picker.scss\",\r\n shadow: false,\r\n scoped: true,\r\n})\r\nexport class DsoDatePicker implements ComponentInterface {\r\n /**\r\n * Reference to host HTML element.\r\n */\r\n @Element()\r\n element!: HTMLDsoDatePickerElement;\r\n\r\n /**\r\n * Name of the date picker input.\r\n */\r\n @Prop()\r\n name = \"dso-date\";\r\n\r\n /**\r\n * Adds a unique identifier for the date picker input. Use this instead of html `id` attribute.\r\n */\r\n @Prop()\r\n identifier: string | undefined;\r\n\r\n /**\r\n * Makes the date picker input component disabled. This prevents users from being able to\r\n * interact with the input, and conveys its inactive state to assistive technologies.\r\n */\r\n @Prop({ reflect: true })\r\n disabled = false;\r\n\r\n /**\r\n * Should the input be marked as required?\r\n */\r\n @Prop({ reflect: true })\r\n required = false;\r\n\r\n /**\r\n * Is input invalid?\r\n */\r\n @Prop({ reflect: true })\r\n invalid?: boolean;\r\n\r\n /**\r\n * ID of element that describes the input element\r\n */\r\n @Prop()\r\n describedBy?: string;\r\n\r\n /**\r\n * Should the input be focused on load?\r\n */\r\n @Prop()\r\n dsoAutofocus = false;\r\n\r\n /**\r\n * Date value. Must be in Dutch date format: DD-MM-YYYY.\r\n */\r\n @Prop({ reflect: true })\r\n value = \"\";\r\n\r\n /**\r\n * Minimum date allowed to be picked. Must be in Dutch date format: DD-MM-YYYY.\r\n * This setting can be used alone or together with the max property.\r\n */\r\n @Prop()\r\n min: string | undefined;\r\n\r\n /**\r\n * Maximum date allowed to be picked. Must be in Dutch date format: DD-MM-YYYY.\r\n * This setting can be used alone or together with the min property.\r\n */\r\n @Prop()\r\n max: string | undefined;\r\n\r\n /**\r\n * Events section.\r\n */\r\n\r\n /**\r\n * Event emitted when a date is selected.\r\n */\r\n @Event()\r\n dsoDateChange!: EventEmitter<DatePickerChangeEvent>;\r\n\r\n /**\r\n * Event emitted the date picker input is blurred.\r\n */\r\n @Event()\r\n dsoBlur!: EventEmitter<DatePickerFocusEvent>;\r\n\r\n /**\r\n * Event emitted on key up in the date picker input.\r\n */\r\n @Event()\r\n dsoKeyUp!: EventEmitter<DatePickerKeyboardEvent>;\r\n\r\n /**\r\n * Event emitted on key down in the date picker input.\r\n */\r\n @Event()\r\n dsoKeyDown!: EventEmitter<DatePickerKeyboardEvent>;\r\n\r\n /**\r\n * Event emitted the date picker input is focused.\r\n */\r\n @Event()\r\n dsoFocus!: EventEmitter<DatePickerFocusEvent>;\r\n\r\n private handleBlur = (event: FocusEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoBlur.emit({\r\n originalEvent: event,\r\n component: \"dso-date-picker\",\r\n });\r\n };\r\n\r\n private handleFocus = (event: FocusEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoFocus.emit({\r\n originalEvent: event,\r\n component: \"dso-date-picker\",\r\n });\r\n };\r\n\r\n private handleKeyUp = (event: KeyboardEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoKeyUp.emit({\r\n component: \"dso-date-picker\",\r\n originalEvent: event,\r\n });\r\n };\r\n\r\n private handleKeyDown = (event: KeyboardEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoKeyDown.emit({\r\n component: \"dso-date-picker\",\r\n originalEvent: event,\r\n });\r\n };\r\n\r\n private handleInputChange = (e: Event) => {\r\n const target = e.target;\r\n\r\n if (!(target instanceof HTMLInputElement)) {\r\n return;\r\n }\r\n\r\n const { valueAsDate, validity } = target;\r\n\r\n const event: DatePickerChangeEvent = {\r\n component: \"dso-date-picker\",\r\n originalEvent: e,\r\n validity,\r\n value: parseToDutchFormat(valueAsDate),\r\n valueAsDate: valueAsDate ?? undefined,\r\n };\r\n\r\n if (validity.valueMissing) {\r\n event.error = \"required\";\r\n } else if (validity.rangeUnderflow) {\r\n event.error = \"min-range\";\r\n event.valueAsDate = undefined;\r\n } else if (validity.rangeOverflow) {\r\n event.error = \"max-range\";\r\n event.valueAsDate = undefined;\r\n } else if (!validity.valid) {\r\n event.error = \"invalid\";\r\n }\r\n\r\n this.dsoDateChange.emit(event);\r\n };\r\n\r\n render() {\r\n return (\r\n <input\r\n type=\"date\"\r\n id={this.identifier}\r\n class=\"dso-date__input\"\r\n value={parseToValueFormat(this.value)}\r\n name={this.name}\r\n min={parseToValueFormat(this.min)}\r\n max={parseToValueFormat(this.max)}\r\n disabled={this.disabled || undefined}\r\n required={this.required || undefined}\r\n aria-autocomplete=\"none\"\r\n aria-invalid={this.invalid?.toString()}\r\n aria-describedby={this.describedBy}\r\n autoComplete=\"off\"\r\n autofocus={this.dsoAutofocus || undefined}\r\n onBlur={this.handleBlur}\r\n onFocus={this.handleFocus}\r\n onKeyUp={this.handleKeyUp}\r\n onKeyDown={this.handleKeyDown}\r\n onChange={this.handleInputChange}\r\n />\r\n );\r\n }\r\n}\r\n"],"version":3}
@@ -41,6 +41,13 @@ const Selectable = class {
41
41
  index.registerInstance(this, hostRef);
42
42
  this.dsoChange = index.createEvent(this, "dsoChange", 7);
43
43
  this.fallbackIdentifier = createIdentifier("DsoSelectable");
44
+ this.handleOnChange = (e) => {
45
+ const { target } = e;
46
+ this.dsoChange.emit({
47
+ originalEvent: e,
48
+ checked: target instanceof HTMLInputElement && target.checked,
49
+ });
50
+ };
44
51
  this.type = undefined;
45
52
  this.identifier = undefined;
46
53
  this.name = undefined;
@@ -87,7 +94,7 @@ const Selectable = class {
87
94
  render() {
88
95
  var _a;
89
96
  const hasInfo = !!this.host.querySelector('[slot="info"]');
90
- return (index.h(index.Fragment, null, index.h("div", { class: clsx.clsx("dso-selectable-container", { "has-info-button": hasInfo }) }, index.h("div", { class: clsx.clsx("dso-selectable-input-wrapper", { "dso-keyboard-focus": this.keyboardFocus }) }, index.h("input", { type: this.type, id: this.getIdentifier(), value: this.value, name: this.name, "aria-invalid": (_a = this.invalid) === null || _a === void 0 ? void 0 : _a.toString(), "aria-describedby": hasInfo && this.infoFixed ? this.describedById : undefined, "aria-labelledBy": this.labelledById, disabled: this.disabled, required: this.required, checked: this.checked, onChange: (e) => this.dsoChange.emit(e), onBlur: () => (this.keyboardFocus = false), onKeyUp: () => (this.keyboardFocus = true), ref: (el) => (this.input = el) }), !this.labelledById ? (index.h("label", { htmlFor: this.getIdentifier() }, index.h("slot", null))) : (index.h("label", null))), hasInfo && (index.h(index.Fragment, null, !this.infoFixed && (index.h("dso-info-button", { active: this.infoActive, onDsoToggle: (e) => (this.infoActive = e.detail.active) }))))), hasInfo && (index.h("dso-info", { id: hasInfo && this.infoFixed ? this.describedById : undefined, fixed: this.infoFixed, active: this.infoActive, onDsoClose: () => (this.infoActive = false) }, index.h("div", null, index.h("slot", { name: "info" }))))));
97
+ return (index.h(index.Fragment, null, index.h("div", { class: clsx.clsx("dso-selectable-container", { "has-info-button": hasInfo }) }, index.h("div", { class: clsx.clsx("dso-selectable-input-wrapper", { "dso-keyboard-focus": this.keyboardFocus }) }, index.h("input", { type: this.type, id: this.getIdentifier(), value: this.value, name: this.name, "aria-invalid": (_a = this.invalid) === null || _a === void 0 ? void 0 : _a.toString(), "aria-describedby": hasInfo && this.infoFixed ? this.describedById : undefined, "aria-labelledBy": this.labelledById, disabled: this.disabled, required: this.required, checked: this.checked, onChange: this.handleOnChange, onBlur: () => (this.keyboardFocus = false), onKeyUp: () => (this.keyboardFocus = true), ref: (el) => (this.input = el) }), !this.labelledById ? (index.h("label", { htmlFor: this.getIdentifier() }, index.h("slot", null))) : (index.h("label", null))), hasInfo && (index.h(index.Fragment, null, !this.infoFixed && (index.h("dso-info-button", { active: this.infoActive, onDsoToggle: (e) => (this.infoActive = e.detail.active) }))))), hasInfo && (index.h("dso-info", { id: hasInfo && this.infoFixed ? this.describedById : undefined, fixed: this.infoFixed, active: this.infoActive, onDsoClose: () => (this.infoActive = false) }, index.h("div", null, index.h("slot", { name: "info" }))))));
91
98
  }
92
99
  getIdentifier() {
93
100
  var _a;
@@ -1 +1 @@
1
- {"file":"dso-info.dso-selectable.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,OAAO,GAAG,iqBAAiqB;;MCOpqB,IAAI;;;;;;;EAmBf,MAAM;IACJ,QACEA,QAACC,cAAQ,QACPD,qBAAa,EACZ,CAAC,IAAI,CAAC,KAAK,KACVA,oBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IACzDA,sBAAU,IAAI,EAAC,OAAO,GAAY,EAClCA,kBAAM,KAAK,EAAC,SAAS,cAAe,CAC7B,CACV,CACQ,EACX;GACH;;;;ACtCH;;;SAGgB,IAAI;EAClB,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED;;;;SAIgB,gBAAgB,CAAC,MAAc;EAC7C,OAAO,GAAG,MAAM,IAAI,IAAI,EAAE,GAAG,IAAI,EAAE,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC;AAClG;;ACbA,MAAM,aAAa,GAAG,wtLAAwtL;;MCsBjuL,UAAU;;;;IA0Gb,uBAAkB,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC;;;;;;;;;;;;;sBAlBlD,KAAK;yBAGF,KAAK;;;;;;;;EASrB,MAAM,UAAU,CAAC,MAAgB;IAC/B,IAAI,CAAC,UAAU,GAAG,MAAM,aAAN,MAAM,c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GACnD;;;;;;;;;;;","names":["h","Fragment","forceUpdate","clsx"],"sources":["src/components/info/info.scss?tag=dso-info&encapsulation=shadow","src/components/info/info.tsx","src/utils/create-identifier.ts","src/components/selectable/selectable.scss?tag=dso-selectable&encapsulation=scoped","src/components/selectable/selectable.tsx"],"sourcesContent":["@use \"~dso-toolkit/src/utilities\";\r\n@use \"~dso-toolkit/src/components/button\";\r\n@use \"~dso-toolkit/src/components/info\";\r\n\r\n:host {\r\n display: block;\r\n\r\n @include info.root();\r\n}\r\n\r\n:host(:not([active]):not([fixed])) {\r\n display: none;\r\n}\r\n\r\nbutton {\r\n @include button.element();\r\n}\r\n\r\n@include utilities.box-sizing();\r\n\r\n.sr-only {\r\n @include utilities.sr-only();\r\n}\r\n","import { h, Component, Event, Prop, EventEmitter, Fragment } from \"@stencil/core\";\r\n\r\n@Component({\r\n tag: \"dso-info\",\r\n styleUrl: \"./info.scss\",\r\n shadow: true,\r\n})\r\nexport class Info {\r\n /**\r\n * Set to true if the Info should not be toggled and always visible.\r\n */\r\n @Prop({ reflect: true })\r\n fixed?: boolean;\r\n\r\n /**\r\n * Whether the Info is active.\r\n */\r\n @Prop({ reflect: true })\r\n active?: boolean;\r\n\r\n /**\r\n * Emitted when the user activates the close button.\r\n */\r\n @Event()\r\n dsoClose!: EventEmitter<MouseEvent>;\r\n\r\n render() {\r\n return (\r\n <Fragment>\r\n <slot></slot>\r\n {!this.fixed && (\r\n <button type=\"button\" onClick={(e) => this.dsoClose.emit(e)}>\r\n <dso-icon icon=\"times\"></dso-icon>\r\n <span class=\"sr-only\">Sluiten</span>\r\n </button>\r\n )}\r\n </Fragment>\r\n );\r\n }\r\n}\r\n","/**\r\n * Form random hash\r\n */\r\nexport function chr4() {\r\n return Math.random().toString(16).slice(-4);\r\n}\r\n\r\n/**\r\n * Create random identifier with a prefix\r\n * @param prefix\r\n */\r\nexport function createIdentifier(prefix: string): string {\r\n return `${prefix}-${chr4()}${chr4()}-${chr4()}-${chr4()}-${chr4()}-${chr4()}${chr4()}${chr4()}`;\r\n}\r\n","@use \"~dso-toolkit/src/utilities\";\r\n@use \"~dso-toolkit/src/components/selectable\";\r\n@use \"~dso-toolkit/src/variables/units\";\r\n\r\n:host {\r\n @include selectable.root(\"dso-info\", false);\r\n\r\n &[invalid]:not([invalid=\"false\"]) {\r\n @include selectable.invalid();\r\n }\r\n}\r\n\r\n:host(:not(:last-child)) {\r\n @include selectable.notLastChild();\r\n}\r\n\r\n@include utilities.box-sizing();\r\n\r\n.dso-selectable-container {\r\n display: inline-block;\r\n position: relative;\r\n padding-inline-start: units.$u4;\r\n\r\n &.has-info-button {\r\n padding-inline-end: units.$u4;\r\n }\r\n\r\n .dso-selectable-input-wrapper {\r\n display: inline-block;\r\n min-height: units.$u3;\r\n\r\n &:focus-within.dso-keyboard-focus {\r\n @include utilities.focus-outline();\r\n }\r\n\r\n input[type=\"radio\"],\r\n input[type=\"checkbox\"] {\r\n &:focus + label::before {\r\n @include selectable.selectableBoxShadow(\r\n selectable.$border-width,\r\n var(--dso-selectable-color, selectable.$valid-color)\r\n );\r\n }\r\n }\r\n }\r\n}\r\n\r\ndso-info-button {\r\n position: absolute;\r\n right: 0;\r\n top: 0;\r\n}\r\n","import {\r\n h,\r\n Component,\r\n Prop,\r\n Event,\r\n EventEmitter,\r\n Fragment,\r\n Element,\r\n State,\r\n forceUpdate,\r\n Watch,\r\n Method,\r\n} from \"@stencil/core\";\r\nimport clsx from \"clsx\";\r\nimport { createIdentifier } from \"../../utils/create-identifier\";\r\nimport { SelectableChangeEvent } from \"./selectable.interfaces\";\r\n\r\n@Component({\r\n tag: \"dso-selectable\",\r\n styleUrl: \"selectable.scss\",\r\n scoped: true,\r\n})\r\nexport class Selectable {\r\n /**\r\n * Type of Selectable.\r\n *\r\n * `checkbox`: Multiple options\r\n * `radio`: Single option.\r\n */\r\n @Prop()\r\n type!: \"checkbox\" | \"radio\";\r\n\r\n /**\r\n * To set `<input id>` attribute for external references.\r\n */\r\n @Prop()\r\n identifier?: string;\r\n\r\n /**\r\n * Name of the Selectable. Can be used to group Selectables.\r\n */\r\n @Prop()\r\n name?: string;\r\n\r\n /**\r\n * The value of the Selectable.\r\n */\r\n @Prop()\r\n value!: string;\r\n\r\n /**\r\n * Set to true of the current value is not valid.\r\n */\r\n @Prop()\r\n invalid?: boolean;\r\n\r\n /**\r\n * To link this control to an element that describes it.\r\n */\r\n @Prop()\r\n describedById?: string;\r\n\r\n /**\r\n * To link this control to an element that labels it.\r\n */\r\n @Prop()\r\n labelledById?: string;\r\n\r\n /**\r\n * To disable the Selectable.\r\n */\r\n @Prop()\r\n disabled?: boolean;\r\n\r\n /**\r\n * To mark the Selectable as required.\r\n */\r\n @Prop()\r\n required?: boolean;\r\n\r\n /**\r\n * Mark the Selectable as checked\r\n */\r\n @Prop()\r\n checked?: boolean;\r\n\r\n /**\r\n * An indeterminate state is neither true or false. It means the answer is somewhere in between.\r\n *\r\n * Can be used to indicate child Selectables that are a mix of checked and unchecked.\r\n */\r\n @Prop()\r\n indeterminate?: boolean;\r\n\r\n /**\r\n * Set to true if the Info should not be toggled and always visible.\r\n */\r\n @Prop()\r\n infoFixed?: boolean;\r\n\r\n /**\r\n * Emitted when the user checks or unchecks the Selectable.\r\n */\r\n @Event()\r\n dsoChange!: EventEmitter<SelectableChangeEvent>;\r\n\r\n @Element()\r\n host!: HTMLDsoSelectableElement;\r\n\r\n @State()\r\n infoActive = false;\r\n\r\n @State()\r\n keyboardFocus = false;\r\n\r\n /**\r\n * Method to toggle the Info. Is set to `active` when passed.\r\n *\r\n * If `active` is not passed, Info is toggled to opposite value.\r\n * @param active\r\n */\r\n @Method()\r\n async toggleInfo(active?: boolean) {\r\n this.infoActive = active ?? !this.infoActive;\r\n }\r\n\r\n private mutationObserver?: MutationObserver;\r\n\r\n private fallbackIdentifier = createIdentifier(\"DsoSelectable\");\r\n\r\n private input: HTMLInputElement | undefined;\r\n\r\n componentDidLoad() {\r\n this.mutationObserver?.disconnect();\r\n\r\n this.mutationObserver = new MutationObserver(() => forceUpdate(this.host));\r\n this.mutationObserver.observe(this.host, {\r\n childList: true,\r\n });\r\n\r\n this.setIndeterminate();\r\n }\r\n\r\n disconnectedCallback() {\r\n this.mutationObserver?.disconnect();\r\n }\r\n\r\n @Watch(\"indeterminate\")\r\n setIndeterminate() {\r\n if (!(this.input instanceof HTMLInputElement) || this.type !== \"checkbox\") {\r\n return;\r\n }\r\n\r\n this.input.indeterminate = !!this.indeterminate;\r\n }\r\n\r\n render() {\r\n const hasInfo = !!this.host.querySelector('[slot=\"info\"]');\r\n\r\n return (\r\n <Fragment>\r\n <div class={clsx(\"dso-selectable-container\", { \"has-info-button\": hasInfo })}>\r\n <div class={clsx(\"dso-selectable-input-wrapper\", { \"dso-keyboard-focus\": this.keyboardFocus })}>\r\n <input\r\n type={this.type}\r\n id={this.getIdentifier()}\r\n value={this.value}\r\n name={this.name}\r\n aria-invalid={this.invalid?.toString()}\r\n aria-describedby={hasInfo && this.infoFixed ? this.describedById : undefined}\r\n aria-labelledBy={this.labelledById}\r\n disabled={this.disabled}\r\n required={this.required}\r\n checked={this.checked}\r\n onChange={(e) => this.dsoChange.emit(e)}\r\n onBlur={() => (this.keyboardFocus = false)}\r\n onKeyUp={() => (this.keyboardFocus = true)}\r\n ref={(el) => (this.input = el)}\r\n />\r\n {!this.labelledById ? (\r\n <label htmlFor={this.getIdentifier()}>\r\n <slot></slot>\r\n </label>\r\n ) : (\r\n <label></label>\r\n )}\r\n </div>\r\n {hasInfo && (\r\n <Fragment>\r\n {!this.infoFixed && (\r\n <dso-info-button\r\n active={this.infoActive}\r\n onDsoToggle={(e) => (this.infoActive = e.detail.active)}\r\n ></dso-info-button>\r\n )}\r\n </Fragment>\r\n )}\r\n </div>\r\n {hasInfo && (\r\n <dso-info\r\n id={hasInfo && this.infoFixed ? this.describedById : undefined}\r\n fixed={this.infoFixed}\r\n active={this.infoActive}\r\n onDsoClose={() => (this.infoActive = false)}\r\n >\r\n <div>\r\n <slot name=\"info\"></slot>\r\n </div>\r\n </dso-info>\r\n )}\r\n </Fragment>\r\n );\r\n }\r\n\r\n private getIdentifier(): string {\r\n return this.identifier ?? this.fallbackIdentifier;\r\n }\r\n}\r\n"],"version":3}
1
+ {"file":"dso-info.dso-selectable.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,OAAO,GAAG,iqBAAiqB;;MCOpqB,IAAI;;;;;;;EAmBf,MAAM;IACJ,QACEA,QAACC,cAAQ,QACPD,qBAAa,EACZ,CAAC,IAAI,CAAC,KAAK,KACVA,oBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IACzDA,sBAAU,IAAI,EAAC,OAAO,GAAY,EAClCA,kBAAM,KAAK,EAAC,SAAS,cAAe,CAC7B,CACV,CACQ,EACX;GACH;;;;ACtCH;;;SAGgB,IAAI;EAClB,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED;;;;SAIgB,gBAAgB,CAAC,MAAc;EAC7C,OAAO,GAAG,MAAM,IAAI,IAAI,EAAE,GAAG,IAAI,EAAE,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC;AAClG;;ACbA,MAAM,aAAa,GAAG,wtLAAwtL;;MCsBjuL,UAAU;;;;IA0Gb,uBAAkB,GAAG,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAIvD,mBAAc,GAAG,CAAC,CAAQ;MAChC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;MAErB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;QAClB,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE,MAAM,YAAY,gBAAgB,IAAI,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,EAAC,MAAM,GAAQ,CACrB,CACG,CACZ,CACQ,EACX;GACH;EAEO,aAAa;;IACnB,OAAO,MAAA,IAAI,CAAC,UAAU,mCAAI,IAAI,CAAC,kBAAkB,CAAC;GACnD;;;;;;;;;;;","names":["h","Fragment","forceUpdate","clsx"],"sources":["src/components/info/info.scss?tag=dso-info&encapsulation=shadow","src/components/info/info.tsx","src/utils/create-identifier.ts","src/components/selectable/selectable.scss?tag=dso-selectable&encapsulation=scoped","src/components/selectable/selectable.tsx"],"sourcesContent":["@use \"~dso-toolkit/src/utilities\";\r\n@use \"~dso-toolkit/src/components/button\";\r\n@use \"~dso-toolkit/src/components/info\";\r\n\r\n:host {\r\n display: block;\r\n\r\n @include info.root();\r\n}\r\n\r\n:host(:not([active]):not([fixed])) {\r\n display: none;\r\n}\r\n\r\nbutton {\r\n @include button.element();\r\n}\r\n\r\n@include utilities.box-sizing();\r\n\r\n.sr-only {\r\n @include utilities.sr-only();\r\n}\r\n","import { h, Component, Event, Prop, EventEmitter, Fragment } from \"@stencil/core\";\r\n\r\n@Component({\r\n tag: \"dso-info\",\r\n styleUrl: \"./info.scss\",\r\n shadow: true,\r\n})\r\nexport class Info {\r\n /**\r\n * Set to true if the Info should not be toggled and always visible.\r\n */\r\n @Prop({ reflect: true })\r\n fixed?: boolean;\r\n\r\n /**\r\n * Whether the Info is active.\r\n */\r\n @Prop({ reflect: true })\r\n active?: boolean;\r\n\r\n /**\r\n * Emitted when the user activates the close button.\r\n */\r\n @Event()\r\n dsoClose!: EventEmitter<MouseEvent>;\r\n\r\n render() {\r\n return (\r\n <Fragment>\r\n <slot></slot>\r\n {!this.fixed && (\r\n <button type=\"button\" onClick={(e) => this.dsoClose.emit(e)}>\r\n <dso-icon icon=\"times\"></dso-icon>\r\n <span class=\"sr-only\">Sluiten</span>\r\n </button>\r\n )}\r\n </Fragment>\r\n );\r\n }\r\n}\r\n","/**\r\n * Form random hash\r\n */\r\nexport function chr4() {\r\n return Math.random().toString(16).slice(-4);\r\n}\r\n\r\n/**\r\n * Create random identifier with a prefix\r\n * @param prefix\r\n */\r\nexport function createIdentifier(prefix: string): string {\r\n return `${prefix}-${chr4()}${chr4()}-${chr4()}-${chr4()}-${chr4()}-${chr4()}${chr4()}${chr4()}`;\r\n}\r\n","@use \"~dso-toolkit/src/utilities\";\r\n@use \"~dso-toolkit/src/components/selectable\";\r\n@use \"~dso-toolkit/src/variables/units\";\r\n\r\n:host {\r\n @include selectable.root(\"dso-info\", false);\r\n\r\n &[invalid]:not([invalid=\"false\"]) {\r\n @include selectable.invalid();\r\n }\r\n}\r\n\r\n:host(:not(:last-child)) {\r\n @include selectable.notLastChild();\r\n}\r\n\r\n@include utilities.box-sizing();\r\n\r\n.dso-selectable-container {\r\n display: inline-block;\r\n position: relative;\r\n padding-inline-start: units.$u4;\r\n\r\n &.has-info-button {\r\n padding-inline-end: units.$u4;\r\n }\r\n\r\n .dso-selectable-input-wrapper {\r\n display: inline-block;\r\n min-height: units.$u3;\r\n\r\n &:focus-within.dso-keyboard-focus {\r\n @include utilities.focus-outline();\r\n }\r\n\r\n input[type=\"radio\"],\r\n input[type=\"checkbox\"] {\r\n &:focus + label::before {\r\n @include selectable.selectableBoxShadow(\r\n selectable.$border-width,\r\n var(--dso-selectable-color, selectable.$valid-color)\r\n );\r\n }\r\n }\r\n }\r\n}\r\n\r\ndso-info-button {\r\n position: absolute;\r\n right: 0;\r\n top: 0;\r\n}\r\n","import {\r\n h,\r\n Component,\r\n Prop,\r\n Event,\r\n EventEmitter,\r\n Fragment,\r\n Element,\r\n State,\r\n forceUpdate,\r\n Watch,\r\n Method,\r\n} from \"@stencil/core\";\r\nimport clsx from \"clsx\";\r\nimport { createIdentifier } from \"../../utils/create-identifier\";\r\nimport { SelectableChangeEvent } from \"./selectable.interfaces\";\r\n\r\n@Component({\r\n tag: \"dso-selectable\",\r\n styleUrl: \"selectable.scss\",\r\n scoped: true,\r\n})\r\nexport class Selectable {\r\n /**\r\n * Type of Selectable.\r\n *\r\n * `checkbox`: Multiple options\r\n * `radio`: Single option.\r\n */\r\n @Prop()\r\n type!: \"checkbox\" | \"radio\";\r\n\r\n /**\r\n * To set `<input id>` attribute for external references.\r\n */\r\n @Prop()\r\n identifier?: string;\r\n\r\n /**\r\n * Name of the Selectable. Can be used to group Selectables.\r\n */\r\n @Prop()\r\n name?: string;\r\n\r\n /**\r\n * The value of the Selectable.\r\n */\r\n @Prop()\r\n value!: string;\r\n\r\n /**\r\n * Set to true of the current value is not valid.\r\n */\r\n @Prop()\r\n invalid?: boolean;\r\n\r\n /**\r\n * To link this control to an element that describes it.\r\n */\r\n @Prop()\r\n describedById?: string;\r\n\r\n /**\r\n * To link this control to an element that labels it.\r\n */\r\n @Prop()\r\n labelledById?: string;\r\n\r\n /**\r\n * To disable the Selectable.\r\n */\r\n @Prop()\r\n disabled?: boolean;\r\n\r\n /**\r\n * To mark the Selectable as required.\r\n */\r\n @Prop()\r\n required?: boolean;\r\n\r\n /**\r\n * Mark the Selectable as checked\r\n */\r\n @Prop()\r\n checked?: boolean;\r\n\r\n /**\r\n * An indeterminate state is neither true or false. It means the answer is somewhere in between.\r\n *\r\n * Can be used to indicate child Selectables that are a mix of checked and unchecked.\r\n */\r\n @Prop()\r\n indeterminate?: boolean;\r\n\r\n /**\r\n * Set to true if the Info should not be toggled and always visible.\r\n */\r\n @Prop()\r\n infoFixed?: boolean;\r\n\r\n /**\r\n * Emitted when the user checks or unchecks the Selectable.\r\n */\r\n @Event()\r\n dsoChange!: EventEmitter<SelectableChangeEvent>;\r\n\r\n @Element()\r\n host!: HTMLDsoSelectableElement;\r\n\r\n @State()\r\n infoActive = false;\r\n\r\n @State()\r\n keyboardFocus = false;\r\n\r\n /**\r\n * Method to toggle the Info. Is set to `active` when passed.\r\n *\r\n * If `active` is not passed, Info is toggled to opposite value.\r\n * @param active\r\n */\r\n @Method()\r\n async toggleInfo(active?: boolean) {\r\n this.infoActive = active ?? !this.infoActive;\r\n }\r\n\r\n private mutationObserver?: MutationObserver;\r\n\r\n private fallbackIdentifier = createIdentifier(\"DsoSelectable\");\r\n\r\n private input: HTMLInputElement | undefined;\r\n\r\n private handleOnChange = (e: Event) => {\r\n const { target } = e;\r\n\r\n this.dsoChange.emit({\r\n originalEvent: e,\r\n checked: target instanceof HTMLInputElement && target.checked,\r\n });\r\n };\r\n\r\n componentDidLoad() {\r\n this.mutationObserver?.disconnect();\r\n\r\n this.mutationObserver = new MutationObserver(() => forceUpdate(this.host));\r\n this.mutationObserver.observe(this.host, {\r\n childList: true,\r\n });\r\n\r\n this.setIndeterminate();\r\n }\r\n\r\n disconnectedCallback() {\r\n this.mutationObserver?.disconnect();\r\n }\r\n\r\n @Watch(\"indeterminate\")\r\n setIndeterminate() {\r\n if (!(this.input instanceof HTMLInputElement) || this.type !== \"checkbox\") {\r\n return;\r\n }\r\n\r\n this.input.indeterminate = !!this.indeterminate;\r\n }\r\n\r\n render() {\r\n const hasInfo = !!this.host.querySelector('[slot=\"info\"]');\r\n\r\n return (\r\n <Fragment>\r\n <div class={clsx(\"dso-selectable-container\", { \"has-info-button\": hasInfo })}>\r\n <div class={clsx(\"dso-selectable-input-wrapper\", { \"dso-keyboard-focus\": this.keyboardFocus })}>\r\n <input\r\n type={this.type}\r\n id={this.getIdentifier()}\r\n value={this.value}\r\n name={this.name}\r\n aria-invalid={this.invalid?.toString()}\r\n aria-describedby={hasInfo && this.infoFixed ? this.describedById : undefined}\r\n aria-labelledBy={this.labelledById}\r\n disabled={this.disabled}\r\n required={this.required}\r\n checked={this.checked}\r\n onChange={this.handleOnChange}\r\n onBlur={() => (this.keyboardFocus = false)}\r\n onKeyUp={() => (this.keyboardFocus = true)}\r\n ref={(el) => (this.input = el)}\r\n />\r\n {!this.labelledById ? (\r\n <label htmlFor={this.getIdentifier()}>\r\n <slot></slot>\r\n </label>\r\n ) : (\r\n <label></label>\r\n )}\r\n </div>\r\n {hasInfo && (\r\n <Fragment>\r\n {!this.infoFixed && (\r\n <dso-info-button\r\n active={this.infoActive}\r\n onDsoToggle={(e) => (this.infoActive = e.detail.active)}\r\n ></dso-info-button>\r\n )}\r\n </Fragment>\r\n )}\r\n </div>\r\n {hasInfo && (\r\n <dso-info\r\n id={hasInfo && this.infoFixed ? this.describedById : undefined}\r\n fixed={this.infoFixed}\r\n active={this.infoActive}\r\n onDsoClose={() => (this.infoActive = false)}\r\n >\r\n <div>\r\n <slot name=\"info\"></slot>\r\n </div>\r\n </dso-info>\r\n )}\r\n </Fragment>\r\n );\r\n }\r\n\r\n private getIdentifier(): string {\r\n return this.identifier ?? this.fallbackIdentifier;\r\n }\r\n}\r\n"],"version":3}
@@ -16,7 +16,7 @@ const MapOverlays = class {
16
16
  this.overlays = undefined;
17
17
  }
18
18
  overlayChangeHandler(overlay, e) {
19
- const checked = e.detail.target instanceof HTMLInputElement ? !!e.detail.target.checked : false;
19
+ const { checked } = e.detail;
20
20
  this.dsoToggleOverlay.emit({ overlay, checked });
21
21
  }
22
22
  componentDidRender() {
@@ -1 +1 @@
1
- {"file":"dso-map-overlays.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,cAAc,GAAG,4WAA4W;;MCYtX,WAAW;;;;IAEd,mBAAc,GAA+C,EAAE,CAAC;iBAMhEA,KAAM,EAAE;;;EAcR,oBAAoB,CAAC,OAAgB,EAAE,CAAqC;IAClF,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,YAAY,gBAAgB,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,GAAG,KAAK,CAAC;IAEhG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;GAClD;EAED,kBAAkB;IAChB,IAAI,CAAC,QAAQ;OACV,MAAM,CAAC,CAAC,CAAC,mBAAK,OAAA,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAA,MAAA,MAAA,IAAI,CAAC,gBAAgB,0CAAE,IAAI,CAAC,CAAC,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GAAG,IAAI,CACzC,CAClB,CAAC,CACE,CACG,EACX;GACH;;;;;;","names":["uuidv4","h"],"sources":["src/components/map-overlays/map-overlays.scss?tag=dso-map-overlays&encapsulation=shadow","src/components/map-overlays/map-overlays.tsx"],"sourcesContent":["@use \"~dso-toolkit/src/utilities\";\r\n@use \"~dso-toolkit/src/variables/units\";\r\n\r\n:host {\r\n display: block;\r\n}\r\n\r\n@include utilities.box-sizing();\r\n\r\n.sr-only {\r\n @include utilities.sr-only();\r\n}\r\n\r\n// Todo #1194\r\nfieldset {\r\n border: 0;\r\n margin: 0;\r\n min-width: 0;\r\n padding: 0;\r\n\r\n .control-label {\r\n display: inline-block;\r\n font-weight: bold;\r\n margin-bottom: units.$u1;\r\n max-width: 100%;\r\n text-align: left;\r\n }\r\n}\r\n\r\np[slot=\"info\"] {\r\n margin: 0;\r\n}\r\n","import { Component, Event, EventEmitter, Prop, h, ComponentInterface } from \"@stencil/core\";\r\nimport { v4 as uuidv4 } from \"uuid\";\r\n\r\nimport { Overlay, OverlayChangeEvent } from \"./map-overlays.interfaces\";\r\n\r\nimport { SelectableChangeEvent } from \"../selectable/selectable.interfaces\";\r\n\r\n@Component({\r\n tag: \"dso-map-overlays\",\r\n styleUrl: \"./map-overlays.scss\",\r\n shadow: true,\r\n})\r\nexport class MapOverlays implements ComponentInterface {\r\n private previousOverlays: Overlay[] | undefined;\r\n private selectableRefs: { [id: number]: HTMLDsoSelectableElement } = {};\r\n\r\n /**\r\n * To group the overlays together. Generally the default value suffices.\r\n */\r\n @Prop()\r\n group = uuidv4();\r\n\r\n /**\r\n * The overlays.\r\n */\r\n @Prop()\r\n overlays!: Overlay[];\r\n\r\n /**\r\n * Emitted when the user selects a different overlay.\r\n */\r\n @Event()\r\n dsoToggleOverlay!: EventEmitter<OverlayChangeEvent>;\r\n\r\n private overlayChangeHandler(overlay: Overlay, e: CustomEvent<SelectableChangeEvent>) {\r\n const checked = e.detail.target instanceof HTMLInputElement ? !!e.detail.target.checked : false;\r\n\r\n this.dsoToggleOverlay.emit({ overlay, checked });\r\n }\r\n\r\n componentDidRender() {\r\n this.overlays\r\n .filter((o) => !o.disabled && this.previousOverlays?.find((p) => p.id === o.id)?.disabled === true)\r\n .forEach((o) => {\r\n this.selectableRefs[o.id]?.toggleInfo(false);\r\n });\r\n\r\n this.previousOverlays = this.overlays;\r\n }\r\n\r\n render() {\r\n for (const ref in this.selectableRefs) {\r\n delete this.selectableRefs[ref];\r\n }\r\n\r\n return (\r\n <fieldset class=\"form-group dso-checkboxes\">\r\n <legend class=\"sr-only\">Kaartlagen</legend>\r\n <div class=\"dso-label-container\">\r\n <span class=\"control-label\" aria-hidden=\"true\">\r\n Kaartlagen\r\n </span>\r\n </div>\r\n <div class=\"dso-field-container\">\r\n {this.overlays.map((overlay) => (\r\n <dso-selectable\r\n key={overlay.id}\r\n type=\"checkbox\"\r\n value={overlay.name}\r\n checked={overlay.checked}\r\n disabled={overlay.disabled}\r\n name={this.group}\r\n ref={(ref) => ref && (this.selectableRefs[overlay.id] = ref)}\r\n onDsoChange={(e) => this.overlayChangeHandler(overlay, e)}\r\n >\r\n {overlay.name}\r\n {overlay.info ? <p slot=\"info\">{overlay.info}</p> : null}\r\n </dso-selectable>\r\n ))}\r\n </div>\r\n </fieldset>\r\n );\r\n }\r\n}\r\n"],"version":3}
1
+ {"file":"dso-map-overlays.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,cAAc,GAAG,4WAA4W;;MCYtX,WAAW;;;;IAEd,mBAAc,GAA+C,EAAE,CAAC;iBAMhEA,KAAM,EAAE;;;EAcR,oBAAoB,CAAC,OAAgB,EAAE,CAAqC;IAClF,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC;IAE7B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;GAClD;EAED,kBAAkB;IAChB,IAAI,CAAC,QAAQ;OACV,MAAM,CAAC,CAAC,C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AC,IAExD,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,IAAI,GAAGA,eAAG,IAAI,EAAC,MAAM,IAAE,OAAO,CAAC,IAAI,CAAK,GAAG,IAAI,CACzC,CAClB,CAAC,CACE,CACG,EACX;GACH;;;;;;","names":["uuidv4","h"],"sources":["src/components/map-overlays/map-overlays.scss?tag=dso-map-overlays&encapsulation=shadow","src/components/map-overlays/map-overlays.tsx"],"sourcesContent":["@use \"~dso-toolkit/src/utilities\";\r\n@use \"~dso-toolkit/src/variables/units\";\r\n\r\n:host {\r\n display: block;\r\n}\r\n\r\n@include utilities.box-sizing();\r\n\r\n.sr-only {\r\n @include utilities.sr-only();\r\n}\r\n\r\n// Todo #1194\r\nfieldset {\r\n border: 0;\r\n margin: 0;\r\n min-width: 0;\r\n padding: 0;\r\n\r\n .control-label {\r\n display: inline-block;\r\n font-weight: bold;\r\n margin-bottom: units.$u1;\r\n max-width: 100%;\r\n text-align: left;\r\n }\r\n}\r\n\r\np[slot=\"info\"] {\r\n margin: 0;\r\n}\r\n","import { Component, Event, EventEmitter, Prop, h, ComponentInterface } from \"@stencil/core\";\r\nimport { v4 as uuidv4 } from \"uuid\";\r\n\r\nimport { Overlay, OverlayChangeEvent } from \"./map-overlays.interfaces\";\r\n\r\nimport { SelectableChangeEvent } from \"../selectable/selectable.interfaces\";\r\n\r\n@Component({\r\n tag: \"dso-map-overlays\",\r\n styleUrl: \"./map-overlays.scss\",\r\n shadow: true,\r\n})\r\nexport class MapOverlays implements ComponentInterface {\r\n private previousOverlays: Overlay[] | undefined;\r\n private selectableRefs: { [id: number]: HTMLDsoSelectableElement } = {};\r\n\r\n /**\r\n * To group the overlays together. Generally the default value suffices.\r\n */\r\n @Prop()\r\n group = uuidv4();\r\n\r\n /**\r\n * The overlays.\r\n */\r\n @Prop()\r\n overlays!: Overlay[];\r\n\r\n /**\r\n * Emitted when the user selects a different overlay.\r\n */\r\n @Event()\r\n dsoToggleOverlay!: EventEmitter<OverlayChangeEvent>;\r\n\r\n private overlayChangeHandler(overlay: Overlay, e: CustomEvent<SelectableChangeEvent>) {\r\n const { checked } = e.detail;\r\n\r\n this.dsoToggleOverlay.emit({ overlay, checked });\r\n }\r\n\r\n componentDidRender() {\r\n this.overlays\r\n .filter((o) => !o.disabled && this.previousOverlays?.find((p) => p.id === o.id)?.disabled === true)\r\n .forEach((o) => {\r\n this.selectableRefs[o.id]?.toggleInfo(false);\r\n });\r\n\r\n this.previousOverlays = this.overlays;\r\n }\r\n\r\n render() {\r\n for (const ref in this.selectableRefs) {\r\n delete this.selectableRefs[ref];\r\n }\r\n\r\n return (\r\n <fieldset class=\"form-group dso-checkboxes\">\r\n <legend class=\"sr-only\">Kaartlagen</legend>\r\n <div class=\"dso-label-container\">\r\n <span class=\"control-label\" aria-hidden=\"true\">\r\n Kaartlagen\r\n </span>\r\n </div>\r\n <div class=\"dso-field-container\">\r\n {this.overlays.map((overlay) => (\r\n <dso-selectable\r\n key={overlay.id}\r\n type=\"checkbox\"\r\n value={overlay.name}\r\n checked={overlay.checked}\r\n disabled={overlay.disabled}\r\n name={this.group}\r\n ref={(ref) => ref && (this.selectableRefs[overlay.id] = ref)}\r\n onDsoChange={(e) => this.overlayChangeHandler(overlay, e)}\r\n >\r\n {overlay.name}\r\n {overlay.info ? <p slot=\"info\">{overlay.info}</p> : null}\r\n </dso-selectable>\r\n ))}\r\n </div>\r\n </fieldset>\r\n );\r\n }\r\n}\r\n"],"version":3}
@@ -17,7 +17,7 @@ const patchBrowser = () => {
17
17
  };
18
18
 
19
19
  patchBrowser().then(options => {
20
- return index.bootstrapLazy([["dsot-document-component-demo.cjs",[[2,"dsot-document-component-demo",{"showCanvas":[516,"show-canvas"],"jsonFile":[1,"json-file"],"openDefault":[4,"open-default"],"response":[32],"openOrClosed":[32],"openedAnnotation":[32],"filtered":[32],"notApplicable":[32],"activeAnnotationSelectables":[32]}]]],["dso-map-base-layers.cjs",[[1,"dso-map-base-layers",{"group":[1],"baseLayers":[16]}]]],["dso-map-overlays.cjs",[[1,"dso-map-overlays",{"group":[1],"overlays":[16]}]]],["dso-toggletip.cjs",[[1,"dso-toggletip",{"label":[1],"position":[1],"small":[4],"secondary":[4],"active":[32]}]]],["dso-accordion-section.cjs",[[1,"dso-accordion-section",{"handleTitle":[1,"handle-title"],"heading":[1],"handleUrl":[1,"handle-url"],"status":[1],"attachmentCount":[2,"attachment-count"],"icon":[1],"statusDescription":[1,"status-description"],"open":[516],"hasNestedAccordion":[32],"hover":[32]}]]],["dso-header.cjs",[[6,"dso-header",{"mainMenu":[16],"useDropDownMenu":[1,"use-drop-down-menu"],"authStatus":[1,"auth-status"],"loginUrl":[1,"login-url"],"logoutUrl":[1,"logout-url"],"userProfileName":[1,"user-profile-name"],"userProfileUrl":[1,"user-profile-url"],"userHomeUrl":[1,"user-home-url"],"userHomeActive":[4,"user-home-active"],"showDropDown":[32],"overflowMenuItems":[32],"dropdownOptionsOffset":[32]}]]],["dso-map-controls.cjs",[[1,"dso-map-controls",{"open":[1540],"disableZoom":[1,"disable-zoom"],"hideContent":[32],"toggleVisibility":[64]}]]],["dso-modal.cjs",[[1,"dso-modal",{"fullscreen":[516],"modalTitle":[1,"modal-title"],"role":[1],"showCloseButton":[4,"show-close-button"],"ariaId":[32],"hasFooter":[32]}]]],["dso-pagination.cjs",[[1,"dso-pagination",{"totalPages":[2,"total-pages"],"currentPage":[2,"current-page"],"formatHref":[16],"availablePositions":[32]},[[0,"dsoSizeChange","sizeChangeHandler"]]]]],["dso-tree-view.cjs",[[1,"dso-tree-view",{"collection":[16],"focusItem":[64]}]]],["dso-action-list-item.cjs",[[1,"dso-action-list-item",{"step":[2],"itemTitle":[1,"item-title"],"flowLine":[4,"flow-line"],"warning":[4],"divider":[4]}]]],["dso-attachments-counter.cjs",[[1,"dso-attachments-counter",{"count":[2]}]]],["dso-autosuggest.cjs",[[6,"dso-autosuggest",{"suggestions":[16],"loading":[4],"loadingLabel":[1,"loading-label"],"loadingDelayed":[2,"loading-delayed"],"notFoundLabel":[1,"not-found-label"],"suggestOnFocus":[4,"suggest-on-focus"],"showSuggestions":[32],"selectedSuggestion":[32],"notFound":[32],"showLoading":[32]},[[4,"click","onDocumentClick"]]]]],["dso-helpcenter-panel.cjs",[[1,"dso-helpcenter-panel",{"label":[1],"url":[1],"visibility":[32],"isOpen":[32],"slideState":[32],"loadIframe":[32]},[[8,"keydown","keyDownListener"]]]]],["dso-image-overlay.cjs",[[1,"dso-image-overlay",{"active":[32],"zoomable":[32]},[[2,"load","loadListener"]]]]],["dso-list-button.cjs",[[1,"dso-list-button",{"label":[1],"sublabel":[1],"count":[2],"min":[8],"max":[8],"checked":[516],"disabled":[516],"manual":[4],"manualInputWrapperElement":[32],"manualCount":[32]}]]],["dso-table.cjs",[[1,"dso-table",{"noModal":[516,"no-modal"],"isResponsive":[516,"is-responsive"],"modalActive":[32],"placeholderHeight":[32]}]]],["dso-accordion.cjs",[[1,"dso-accordion",{"variant":[513],"reverseAlign":[516,"reverse-align"],"_getState":[64]}]]],["dso-action-list.cjs",[[1,"dso-action-list",{"listTitle":[1,"list-title"]}]]],["dso-banner.cjs",[[1,"dso-banner",{"status":[513],"compact":[4],"noIcon":[4,"no-icon"]}]]],["dso-card.cjs",[[1,"dso-card",{"isSelectable":[516,"is-selectable"],"hasImage":[516,"has-image"],"clickable":[4],"imageShape":[513,"image-shape"]}]]],["dso-card-container.cjs",[[1,"dso-card-container",{"mode":[513]}]]],["dso-date-picker.cjs",[[2,"dso-date-picker",{"name":[1],"identifier":[1],"disabled":[516],"required":[516],"invalid":[516],"describedBy":[1,"described-by"],"dsoAutofocus":[4,"dso-autofocus"],"value":[1],"min":[1],"max":[1]}]]],["dso-highlight-box.cjs",[[1,"dso-highlight-box",{"yellow":[4],"border":[4],"white":[4],"dropShadow":[4,"drop-shadow"],"step":[2]}]]],["dso-logo.cjs",[[1,"dso-logo",{"label":[1],"ribbon":[1]}]]],["dso-progress-bar.cjs",[[1,"dso-progress-bar",{"progress":[2],"min":[2],"max":[2]}]]],["dso-viewer-grid.cjs",[[1,"dso-viewer-grid",{"mode":[513],"filterpanelOpen":[516,"filterpanel-open"],"overlayOpen":[516,"overlay-open"],"documentPanelOpen":[516,"document-panel-open"],"mainSize":[513,"main-size"],"activeTab":[1,"active-tab"],"documentPanelSize":[513,"document-panel-size"],"mainPanelExpanded":[4,"main-panel-expanded"],"mainPanelHidden":[4,"main-panel-hidden"],"tabView":[32],"_checkMainPanelVisibility":[64]}]]],["dso-dropdown-menu.cjs",[[1,"dso-dropdown-menu",{"open":[1540],"dropdownAlign":[1,"dropdown-align"],"dropdownOptionsOffset":[2,"dropdown-options-offset"],"checkable":[4],"boundary":[1],"placement":[1],"strategy":[1]}]]],["dso-progress-indicator.cjs",[[1,"dso-progress-indicator",{"label":[1],"size":[513],"block":[4]}]]],["dso-scrollable.cjs",[[1,"dso-scrollable",{"scrollPosition":[32],"_setScrollState":[64]}]]],["dso-expandable.cjs",[[1,"dso-expandable",{"open":[516],"enableAnimation":[4,"enable-animation"],"minimumHeight":[2,"minimum-height"],"animationReady":[32]}]]],["dso-responsive-element.cjs",[[1,"dso-responsive-element",{"sizeAlias":[32],"sizeWidth":[32],"getSize":[64]}]]],["dso-info-button.cjs",[[1,"dso-info-button",{"active":[1540],"secondary":[4],"label":[1],"hover":[32],"setFocus":[64]}]]],["dso-tooltip.cjs",[[1,"dso-tooltip",{"descriptive":[516],"position":[1],"strategy":[1],"noArrow":[4,"no-arrow"],"stateless":[4],"small":[4],"active":[1540],"hidden":[32],"activate":[64],"deactivate":[64]}]]],["dso-icon.cjs",[[1,"dso-icon",{"icon":[1]}]]],["dso-info_2.cjs",[[6,"dso-selectable",{"type":[1],"identifier":[1],"name":[1],"value":[1],"invalid":[4],"describedById":[1,"described-by-id"],"labelledById":[1,"labelled-by-id"],"disabled":[4],"required":[4],"checked":[4],"indeterminate":[4],"infoFixed":[4,"info-fixed"],"infoActive":[32],"keyboardFocus":[32],"toggleInfo":[64]}],[1,"dso-info",{"fixed":[516],"active":[516]}]]],["dso-alert_5.cjs",[[1,"dso-label",{"compact":[4],"removable":[4],"status":[1],"truncate":[4],"removeHover":[32],"removeFocus":[32],"textHover":[32],"textFocus":[32],"isTruncated":[32],"labelText":[32],"_truncateLabel":[64]},[[4,"keydown","keyDownListener"]]],[1,"dso-alert",{"status":[1],"roleAlert":[4,"role-alert"]}],[0,"dso-annotation-button",{"identifier":[1],"open":[4]}],[1,"dso-badge",{"status":[1]}],[1,"dso-ozon-content",{"content":[1],"inline":[516],"state":[32]}]]],["dso-annotation-output_3.cjs",[[1,"dso-document-component",{"heading":[1],"label":[1],"nummer":[1],"opschrift":[1],"inhoud":[1],"open":[516],"filtered":[516],"notApplicable":[516,"not-applicable"],"genesteOntwerpInformatie":[516,"geneste-ontwerp-informatie"],"bevatOntwerpInformatie":[516,"bevat-ontwerp-informatie"],"annotated":[516],"gereserveerd":[4],"vervallen":[4],"openAnnotation":[4,"open-annotation"],"alternativeTitle":[1,"alternative-title"],"type":[513],"wijzigactie":[513]}],[4,"dso-annotation-output",{"identifier":[513],"annotationPrefix":[513,"annotation-prefix"],"open":[516]}],[4,"dso-slide-toggle",{"checked":[4],"disabled":[4],"accessibleLabel":[1,"accessible-label"],"labelledbyId":[1,"labelledby-id"],"identifier":[1],"hasVisibleLabel":[32]}]]]], options);
20
+ return index.bootstrapLazy([["dsot-document-component-demo.cjs",[[2,"dsot-document-component-demo",{"showCanvas":[516,"show-canvas"],"jsonFile":[1,"json-file"],"openDefault":[4,"open-default"],"response":[32],"openOrClosed":[32],"openedAnnotation":[32],"filtered":[32],"notApplicable":[32],"activeAnnotationSelectables":[32]}]]],["dso-map-base-layers.cjs",[[1,"dso-map-base-layers",{"group":[1],"baseLayers":[16]}]]],["dso-map-overlays.cjs",[[1,"dso-map-overlays",{"group":[1],"overlays":[16]}]]],["dso-toggletip.cjs",[[1,"dso-toggletip",{"label":[1],"position":[1],"small":[4],"secondary":[4],"active":[32]}]]],["dso-accordion-section.cjs",[[1,"dso-accordion-section",{"handleTitle":[1,"handle-title"],"heading":[1],"handleUrl":[1,"handle-url"],"status":[1],"attachmentCount":[2,"attachment-count"],"icon":[1],"statusDescription":[1,"status-description"],"open":[516],"hasNestedAccordion":[32],"hover":[32]}]]],["dso-header.cjs",[[6,"dso-header",{"mainMenu":[16],"useDropDownMenu":[1,"use-drop-down-menu"],"authStatus":[1,"auth-status"],"loginUrl":[1,"login-url"],"logoutUrl":[1,"logout-url"],"userProfileName":[1,"user-profile-name"],"userProfileUrl":[1,"user-profile-url"],"userHomeUrl":[1,"user-home-url"],"userHomeActive":[4,"user-home-active"],"showDropDown":[32],"overflowMenuItems":[32],"dropdownOptionsOffset":[32]}]]],["dso-map-controls.cjs",[[1,"dso-map-controls",{"open":[1540],"disableZoom":[1,"disable-zoom"],"hideContent":[32],"toggleVisibility":[64]}]]],["dso-modal.cjs",[[1,"dso-modal",{"fullscreen":[516],"modalTitle":[1,"modal-title"],"role":[1],"showCloseButton":[4,"show-close-button"],"ariaId":[32],"hasFooter":[32]}]]],["dso-pagination.cjs",[[1,"dso-pagination",{"totalPages":[2,"total-pages"],"currentPage":[2,"current-page"],"formatHref":[16],"availablePositions":[32]},[[0,"dsoSizeChange","sizeChangeHandler"]]]]],["dso-tree-view.cjs",[[1,"dso-tree-view",{"collection":[16],"focusItem":[64]}]]],["dso-action-list-item.cjs",[[1,"dso-action-list-item",{"step":[2],"itemTitle":[1,"item-title"],"flowLine":[4,"flow-line"],"warning":[4],"divider":[4]}]]],["dso-attachments-counter.cjs",[[1,"dso-attachments-counter",{"count":[2]}]]],["dso-autosuggest.cjs",[[6,"dso-autosuggest",{"suggestions":[16],"loading":[4],"loadingLabel":[1,"loading-label"],"loadingDelayed":[2,"loading-delayed"],"notFoundLabel":[1,"not-found-label"],"suggestOnFocus":[4,"suggest-on-focus"],"showSuggestions":[32],"selectedSuggestion":[32],"notFound":[32],"showLoading":[32]},[[4,"click","onDocumentClick"]]]]],["dso-helpcenter-panel.cjs",[[1,"dso-helpcenter-panel",{"label":[1],"url":[1],"visibility":[32],"isOpen":[32],"slideState":[32],"loadIframe":[32]},[[8,"keydown","keyDownListener"]]]]],["dso-image-overlay.cjs",[[1,"dso-image-overlay",{"active":[32],"zoomable":[32]},[[2,"load","loadListener"]]]]],["dso-list-button.cjs",[[1,"dso-list-button",{"label":[1],"sublabel":[1],"count":[2],"min":[8],"max":[8],"checked":[516],"disabled":[516],"manual":[4],"manualInputWrapperElement":[32],"manualCount":[32]}]]],["dso-table.cjs",[[1,"dso-table",{"noModal":[516,"no-modal"],"isResponsive":[516,"is-responsive"],"modalActive":[32],"placeholderHeight":[32]}]]],["dso-accordion.cjs",[[1,"dso-accordion",{"variant":[513],"reverseAlign":[516,"reverse-align"],"_getState":[64]}]]],["dso-action-list.cjs",[[1,"dso-action-list",{"listTitle":[1,"list-title"]}]]],["dso-banner.cjs",[[1,"dso-banner",{"status":[513],"compact":[4],"noIcon":[4,"no-icon"]}]]],["dso-card.cjs",[[1,"dso-card",{"isSelectable":[516,"is-selectable"],"hasImage":[516,"has-image"],"clickable":[4],"imageShape":[513,"image-shape"]}]]],["dso-card-container.cjs",[[1,"dso-card-container",{"mode":[513]}]]],["dso-date-picker.cjs",[[2,"dso-date-picker",{"name":[1],"identifier":[1],"disabled":[516],"required":[516],"invalid":[516],"describedBy":[1,"described-by"],"dsoAutofocus":[4,"dso-autofocus"],"value":[513],"min":[1],"max":[1]}]]],["dso-highlight-box.cjs",[[1,"dso-highlight-box",{"yellow":[4],"border":[4],"white":[4],"dropShadow":[4,"drop-shadow"],"step":[2]}]]],["dso-logo.cjs",[[1,"dso-logo",{"label":[1],"ribbon":[1]}]]],["dso-progress-bar.cjs",[[1,"dso-progress-bar",{"progress":[2],"min":[2],"max":[2]}]]],["dso-viewer-grid.cjs",[[1,"dso-viewer-grid",{"mode":[513],"filterpanelOpen":[516,"filterpanel-open"],"overlayOpen":[516,"overlay-open"],"documentPanelOpen":[516,"document-panel-open"],"mainSize":[513,"main-size"],"activeTab":[1,"active-tab"],"documentPanelSize":[513,"document-panel-size"],"mainPanelExpanded":[4,"main-panel-expanded"],"mainPanelHidden":[4,"main-panel-hidden"],"tabView":[32],"_checkMainPanelVisibility":[64]}]]],["dso-dropdown-menu.cjs",[[1,"dso-dropdown-menu",{"open":[1540],"dropdownAlign":[1,"dropdown-align"],"dropdownOptionsOffset":[2,"dropdown-options-offset"],"checkable":[4],"boundary":[1],"placement":[1],"strategy":[1]}]]],["dso-progress-indicator.cjs",[[1,"dso-progress-indicator",{"label":[1],"size":[513],"block":[4]}]]],["dso-scrollable.cjs",[[1,"dso-scrollable",{"scrollPosition":[32],"_setScrollState":[64]}]]],["dso-expandable.cjs",[[1,"dso-expandable",{"open":[516],"enableAnimation":[4,"enable-animation"],"minimumHeight":[2,"minimum-height"],"animationReady":[32]}]]],["dso-responsive-element.cjs",[[1,"dso-responsive-element",{"sizeAlias":[32],"sizeWidth":[32],"getSize":[64]}]]],["dso-info-button.cjs",[[1,"dso-info-button",{"active":[1540],"secondary":[4],"label":[1],"hover":[32],"setFocus":[64]}]]],["dso-tooltip.cjs",[[1,"dso-tooltip",{"descriptive":[516],"position":[1],"strategy":[1],"noArrow":[4,"no-arrow"],"stateless":[4],"small":[4],"active":[1540],"hidden":[32],"activate":[64],"deactivate":[64]}]]],["dso-icon.cjs",[[1,"dso-icon",{"icon":[1]}]]],["dso-info_2.cjs",[[6,"dso-selectable",{"type":[1],"identifier":[1],"name":[1],"value":[1],"invalid":[4],"describedById":[1,"described-by-id"],"labelledById":[1,"labelled-by-id"],"disabled":[4],"required":[4],"checked":[4],"indeterminate":[4],"infoFixed":[4,"info-fixed"],"infoActive":[32],"keyboardFocus":[32],"toggleInfo":[64]}],[1,"dso-info",{"fixed":[516],"active":[516]}]]],["dso-alert_5.cjs",[[1,"dso-label",{"compact":[4],"removable":[4],"status":[1],"truncate":[4],"removeHover":[32],"removeFocus":[32],"textHover":[32],"textFocus":[32],"isTruncated":[32],"labelText":[32],"_truncateLabel":[64]},[[4,"keydown","keyDownListener"]]],[1,"dso-alert",{"status":[1],"roleAlert":[4,"role-alert"]}],[0,"dso-annotation-button",{"identifier":[1],"open":[4]}],[1,"dso-badge",{"status":[1]}],[1,"dso-ozon-content",{"content":[1],"inline":[516],"state":[32]}]]],["dso-annotation-output_3.cjs",[[1,"dso-document-component",{"heading":[1],"label":[1],"nummer":[1],"opschrift":[1],"inhoud":[1],"open":[516],"filtered":[516],"notApplicable":[516,"not-applicable"],"genesteOntwerpInformatie":[516,"geneste-ontwerp-informatie"],"bevatOntwerpInformatie":[516,"bevat-ontwerp-informatie"],"annotated":[516],"gereserveerd":[4],"vervallen":[4],"openAnnotation":[4,"open-annotation"],"alternativeTitle":[1,"alternative-title"],"type":[513],"wijzigactie":[513]}],[4,"dso-annotation-output",{"identifier":[513],"annotationPrefix":[513,"annotation-prefix"],"open":[516]}],[4,"dso-slide-toggle",{"checked":[4],"disabled":[4],"accessibleLabel":[1,"accessible-label"],"labelledbyId":[1,"labelledby-id"],"identifier":[1],"hasVisibleLabel":[32]}]]]], options);
21
21
  });
22
22
 
23
23
  exports.setNonce = index.setNonce;
@@ -6,7 +6,7 @@ const index = require('./index-d46ec033.js');
6
6
 
7
7
  const defineCustomElements = (win, options) => {
8
8
  if (typeof window === 'undefined') return undefined;
9
- return index.bootstrapLazy([["dsot-document-component-demo.cjs",[[2,"dsot-document-component-demo",{"showCanvas":[516,"show-canvas"],"jsonFile":[1,"json-file"],"openDefault":[4,"open-default"],"response":[32],"openOrClosed":[32],"openedAnnotation":[32],"filtered":[32],"notApplicable":[32],"activeAnnotationSelectables":[32]}]]],["dso-map-base-layers.cjs",[[1,"dso-map-base-layers",{"group":[1],"baseLayers":[16]}]]],["dso-map-overlays.cjs",[[1,"dso-map-overlays",{"group":[1],"overlays":[16]}]]],["dso-toggletip.cjs",[[1,"dso-toggletip",{"label":[1],"position":[1],"small":[4],"secondary":[4],"active":[32]}]]],["dso-accordion-section.cjs",[[1,"dso-accordion-section",{"handleTitle":[1,"handle-title"],"heading":[1],"handleUrl":[1,"handle-url"],"status":[1],"attachmentCount":[2,"attachment-count"],"icon":[1],"statusDescription":[1,"status-description"],"open":[516],"hasNestedAccordion":[32],"hover":[32]}]]],["dso-header.cjs",[[6,"dso-header",{"mainMenu":[16],"useDropDownMenu":[1,"use-drop-down-menu"],"authStatus":[1,"auth-status"],"loginUrl":[1,"login-url"],"logoutUrl":[1,"logout-url"],"userProfileName":[1,"user-profile-name"],"userProfileUrl":[1,"user-profile-url"],"userHomeUrl":[1,"user-home-url"],"userHomeActive":[4,"user-home-active"],"showDropDown":[32],"overflowMenuItems":[32],"dropdownOptionsOffset":[32]}]]],["dso-map-controls.cjs",[[1,"dso-map-controls",{"open":[1540],"disableZoom":[1,"disable-zoom"],"hideContent":[32],"toggleVisibility":[64]}]]],["dso-modal.cjs",[[1,"dso-modal",{"fullscreen":[516],"modalTitle":[1,"modal-title"],"role":[1],"showCloseButton":[4,"show-close-button"],"ariaId":[32],"hasFooter":[32]}]]],["dso-pagination.cjs",[[1,"dso-pagination",{"totalPages":[2,"total-pages"],"currentPage":[2,"current-page"],"formatHref":[16],"availablePositions":[32]},[[0,"dsoSizeChange","sizeChangeHandler"]]]]],["dso-tree-view.cjs",[[1,"dso-tree-view",{"collection":[16],"focusItem":[64]}]]],["dso-action-list-item.cjs",[[1,"dso-action-list-item",{"step":[2],"itemTitle":[1,"item-title"],"flowLine":[4,"flow-line"],"warning":[4],"divider":[4]}]]],["dso-attachments-counter.cjs",[[1,"dso-attachments-counter",{"count":[2]}]]],["dso-autosuggest.cjs",[[6,"dso-autosuggest",{"suggestions":[16],"loading":[4],"loadingLabel":[1,"loading-label"],"loadingDelayed":[2,"loading-delayed"],"notFoundLabel":[1,"not-found-label"],"suggestOnFocus":[4,"suggest-on-focus"],"showSuggestions":[32],"selectedSuggestion":[32],"notFound":[32],"showLoading":[32]},[[4,"click","onDocumentClick"]]]]],["dso-helpcenter-panel.cjs",[[1,"dso-helpcenter-panel",{"label":[1],"url":[1],"visibility":[32],"isOpen":[32],"slideState":[32],"loadIframe":[32]},[[8,"keydown","keyDownListener"]]]]],["dso-image-overlay.cjs",[[1,"dso-image-overlay",{"active":[32],"zoomable":[32]},[[2,"load","loadListener"]]]]],["dso-list-button.cjs",[[1,"dso-list-button",{"label":[1],"sublabel":[1],"count":[2],"min":[8],"max":[8],"checked":[516],"disabled":[516],"manual":[4],"manualInputWrapperElement":[32],"manualCount":[32]}]]],["dso-table.cjs",[[1,"dso-table",{"noModal":[516,"no-modal"],"isResponsive":[516,"is-responsive"],"modalActive":[32],"placeholderHeight":[32]}]]],["dso-accordion.cjs",[[1,"dso-accordion",{"variant":[513],"reverseAlign":[516,"reverse-align"],"_getState":[64]}]]],["dso-action-list.cjs",[[1,"dso-action-list",{"listTitle":[1,"list-title"]}]]],["dso-banner.cjs",[[1,"dso-banner",{"status":[513],"compact":[4],"noIcon":[4,"no-icon"]}]]],["dso-card.cjs",[[1,"dso-card",{"isSelectable":[516,"is-selectable"],"hasImage":[516,"has-image"],"clickable":[4],"imageShape":[513,"image-shape"]}]]],["dso-card-container.cjs",[[1,"dso-card-container",{"mode":[513]}]]],["dso-date-picker.cjs",[[2,"dso-date-picker",{"name":[1],"identifier":[1],"disabled":[516],"required":[516],"invalid":[516],"describedBy":[1,"described-by"],"dsoAutofocus":[4,"dso-autofocus"],"value":[1],"min":[1],"max":[1]}]]],["dso-highlight-box.cjs",[[1,"dso-highlight-box",{"yellow":[4],"border":[4],"white":[4],"dropShadow":[4,"drop-shadow"],"step":[2]}]]],["dso-logo.cjs",[[1,"dso-logo",{"label":[1],"ribbon":[1]}]]],["dso-progress-bar.cjs",[[1,"dso-progress-bar",{"progress":[2],"min":[2],"max":[2]}]]],["dso-viewer-grid.cjs",[[1,"dso-viewer-grid",{"mode":[513],"filterpanelOpen":[516,"filterpanel-open"],"overlayOpen":[516,"overlay-open"],"documentPanelOpen":[516,"document-panel-open"],"mainSize":[513,"main-size"],"activeTab":[1,"active-tab"],"documentPanelSize":[513,"document-panel-size"],"mainPanelExpanded":[4,"main-panel-expanded"],"mainPanelHidden":[4,"main-panel-hidden"],"tabView":[32],"_checkMainPanelVisibility":[64]}]]],["dso-dropdown-menu.cjs",[[1,"dso-dropdown-menu",{"open":[1540],"dropdownAlign":[1,"dropdown-align"],"dropdownOptionsOffset":[2,"dropdown-options-offset"],"checkable":[4],"boundary":[1],"placement":[1],"strategy":[1]}]]],["dso-progress-indicator.cjs",[[1,"dso-progress-indicator",{"label":[1],"size":[513],"block":[4]}]]],["dso-scrollable.cjs",[[1,"dso-scrollable",{"scrollPosition":[32],"_setScrollState":[64]}]]],["dso-expandable.cjs",[[1,"dso-expandable",{"open":[516],"enableAnimation":[4,"enable-animation"],"minimumHeight":[2,"minimum-height"],"animationReady":[32]}]]],["dso-responsive-element.cjs",[[1,"dso-responsive-element",{"sizeAlias":[32],"sizeWidth":[32],"getSize":[64]}]]],["dso-info-button.cjs",[[1,"dso-info-button",{"active":[1540],"secondary":[4],"label":[1],"hover":[32],"setFocus":[64]}]]],["dso-tooltip.cjs",[[1,"dso-tooltip",{"descriptive":[516],"position":[1],"strategy":[1],"noArrow":[4,"no-arrow"],"stateless":[4],"small":[4],"active":[1540],"hidden":[32],"activate":[64],"deactivate":[64]}]]],["dso-icon.cjs",[[1,"dso-icon",{"icon":[1]}]]],["dso-info_2.cjs",[[6,"dso-selectable",{"type":[1],"identifier":[1],"name":[1],"value":[1],"invalid":[4],"describedById":[1,"described-by-id"],"labelledById":[1,"labelled-by-id"],"disabled":[4],"required":[4],"checked":[4],"indeterminate":[4],"infoFixed":[4,"info-fixed"],"infoActive":[32],"keyboardFocus":[32],"toggleInfo":[64]}],[1,"dso-info",{"fixed":[516],"active":[516]}]]],["dso-alert_5.cjs",[[1,"dso-label",{"compact":[4],"removable":[4],"status":[1],"truncate":[4],"removeHover":[32],"removeFocus":[32],"textHover":[32],"textFocus":[32],"isTruncated":[32],"labelText":[32],"_truncateLabel":[64]},[[4,"keydown","keyDownListener"]]],[1,"dso-alert",{"status":[1],"roleAlert":[4,"role-alert"]}],[0,"dso-annotation-button",{"identifier":[1],"open":[4]}],[1,"dso-badge",{"status":[1]}],[1,"dso-ozon-content",{"content":[1],"inline":[516],"state":[32]}]]],["dso-annotation-output_3.cjs",[[1,"dso-document-component",{"heading":[1],"label":[1],"nummer":[1],"opschrift":[1],"inhoud":[1],"open":[516],"filtered":[516],"notApplicable":[516,"not-applicable"],"genesteOntwerpInformatie":[516,"geneste-ontwerp-informatie"],"bevatOntwerpInformatie":[516,"bevat-ontwerp-informatie"],"annotated":[516],"gereserveerd":[4],"vervallen":[4],"openAnnotation":[4,"open-annotation"],"alternativeTitle":[1,"alternative-title"],"type":[513],"wijzigactie":[513]}],[4,"dso-annotation-output",{"identifier":[513],"annotationPrefix":[513,"annotation-prefix"],"open":[516]}],[4,"dso-slide-toggle",{"checked":[4],"disabled":[4],"accessibleLabel":[1,"accessible-label"],"labelledbyId":[1,"labelledby-id"],"identifier":[1],"hasVisibleLabel":[32]}]]]], options);
9
+ return index.bootstrapLazy([["dsot-document-component-demo.cjs",[[2,"dsot-document-component-demo",{"showCanvas":[516,"show-canvas"],"jsonFile":[1,"json-file"],"openDefault":[4,"open-default"],"response":[32],"openOrClosed":[32],"openedAnnotation":[32],"filtered":[32],"notApplicable":[32],"activeAnnotationSelectables":[32]}]]],["dso-map-base-layers.cjs",[[1,"dso-map-base-layers",{"group":[1],"baseLayers":[16]}]]],["dso-map-overlays.cjs",[[1,"dso-map-overlays",{"group":[1],"overlays":[16]}]]],["dso-toggletip.cjs",[[1,"dso-toggletip",{"label":[1],"position":[1],"small":[4],"secondary":[4],"active":[32]}]]],["dso-accordion-section.cjs",[[1,"dso-accordion-section",{"handleTitle":[1,"handle-title"],"heading":[1],"handleUrl":[1,"handle-url"],"status":[1],"attachmentCount":[2,"attachment-count"],"icon":[1],"statusDescription":[1,"status-description"],"open":[516],"hasNestedAccordion":[32],"hover":[32]}]]],["dso-header.cjs",[[6,"dso-header",{"mainMenu":[16],"useDropDownMenu":[1,"use-drop-down-menu"],"authStatus":[1,"auth-status"],"loginUrl":[1,"login-url"],"logoutUrl":[1,"logout-url"],"userProfileName":[1,"user-profile-name"],"userProfileUrl":[1,"user-profile-url"],"userHomeUrl":[1,"user-home-url"],"userHomeActive":[4,"user-home-active"],"showDropDown":[32],"overflowMenuItems":[32],"dropdownOptionsOffset":[32]}]]],["dso-map-controls.cjs",[[1,"dso-map-controls",{"open":[1540],"disableZoom":[1,"disable-zoom"],"hideContent":[32],"toggleVisibility":[64]}]]],["dso-modal.cjs",[[1,"dso-modal",{"fullscreen":[516],"modalTitle":[1,"modal-title"],"role":[1],"showCloseButton":[4,"show-close-button"],"ariaId":[32],"hasFooter":[32]}]]],["dso-pagination.cjs",[[1,"dso-pagination",{"totalPages":[2,"total-pages"],"currentPage":[2,"current-page"],"formatHref":[16],"availablePositions":[32]},[[0,"dsoSizeChange","sizeChangeHandler"]]]]],["dso-tree-view.cjs",[[1,"dso-tree-view",{"collection":[16],"focusItem":[64]}]]],["dso-action-list-item.cjs",[[1,"dso-action-list-item",{"step":[2],"itemTitle":[1,"item-title"],"flowLine":[4,"flow-line"],"warning":[4],"divider":[4]}]]],["dso-attachments-counter.cjs",[[1,"dso-attachments-counter",{"count":[2]}]]],["dso-autosuggest.cjs",[[6,"dso-autosuggest",{"suggestions":[16],"loading":[4],"loadingLabel":[1,"loading-label"],"loadingDelayed":[2,"loading-delayed"],"notFoundLabel":[1,"not-found-label"],"suggestOnFocus":[4,"suggest-on-focus"],"showSuggestions":[32],"selectedSuggestion":[32],"notFound":[32],"showLoading":[32]},[[4,"click","onDocumentClick"]]]]],["dso-helpcenter-panel.cjs",[[1,"dso-helpcenter-panel",{"label":[1],"url":[1],"visibility":[32],"isOpen":[32],"slideState":[32],"loadIframe":[32]},[[8,"keydown","keyDownListener"]]]]],["dso-image-overlay.cjs",[[1,"dso-image-overlay",{"active":[32],"zoomable":[32]},[[2,"load","loadListener"]]]]],["dso-list-button.cjs",[[1,"dso-list-button",{"label":[1],"sublabel":[1],"count":[2],"min":[8],"max":[8],"checked":[516],"disabled":[516],"manual":[4],"manualInputWrapperElement":[32],"manualCount":[32]}]]],["dso-table.cjs",[[1,"dso-table",{"noModal":[516,"no-modal"],"isResponsive":[516,"is-responsive"],"modalActive":[32],"placeholderHeight":[32]}]]],["dso-accordion.cjs",[[1,"dso-accordion",{"variant":[513],"reverseAlign":[516,"reverse-align"],"_getState":[64]}]]],["dso-action-list.cjs",[[1,"dso-action-list",{"listTitle":[1,"list-title"]}]]],["dso-banner.cjs",[[1,"dso-banner",{"status":[513],"compact":[4],"noIcon":[4,"no-icon"]}]]],["dso-card.cjs",[[1,"dso-card",{"isSelectable":[516,"is-selectable"],"hasImage":[516,"has-image"],"clickable":[4],"imageShape":[513,"image-shape"]}]]],["dso-card-container.cjs",[[1,"dso-card-container",{"mode":[513]}]]],["dso-date-picker.cjs",[[2,"dso-date-picker",{"name":[1],"identifier":[1],"disabled":[516],"required":[516],"invalid":[516],"describedBy":[1,"described-by"],"dsoAutofocus":[4,"dso-autofocus"],"value":[513],"min":[1],"max":[1]}]]],["dso-highlight-box.cjs",[[1,"dso-highlight-box",{"yellow":[4],"border":[4],"white":[4],"dropShadow":[4,"drop-shadow"],"step":[2]}]]],["dso-logo.cjs",[[1,"dso-logo",{"label":[1],"ribbon":[1]}]]],["dso-progress-bar.cjs",[[1,"dso-progress-bar",{"progress":[2],"min":[2],"max":[2]}]]],["dso-viewer-grid.cjs",[[1,"dso-viewer-grid",{"mode":[513],"filterpanelOpen":[516,"filterpanel-open"],"overlayOpen":[516,"overlay-open"],"documentPanelOpen":[516,"document-panel-open"],"mainSize":[513,"main-size"],"activeTab":[1,"active-tab"],"documentPanelSize":[513,"document-panel-size"],"mainPanelExpanded":[4,"main-panel-expanded"],"mainPanelHidden":[4,"main-panel-hidden"],"tabView":[32],"_checkMainPanelVisibility":[64]}]]],["dso-dropdown-menu.cjs",[[1,"dso-dropdown-menu",{"open":[1540],"dropdownAlign":[1,"dropdown-align"],"dropdownOptionsOffset":[2,"dropdown-options-offset"],"checkable":[4],"boundary":[1],"placement":[1],"strategy":[1]}]]],["dso-progress-indicator.cjs",[[1,"dso-progress-indicator",{"label":[1],"size":[513],"block":[4]}]]],["dso-scrollable.cjs",[[1,"dso-scrollable",{"scrollPosition":[32],"_setScrollState":[64]}]]],["dso-expandable.cjs",[[1,"dso-expandable",{"open":[516],"enableAnimation":[4,"enable-animation"],"minimumHeight":[2,"minimum-height"],"animationReady":[32]}]]],["dso-responsive-element.cjs",[[1,"dso-responsive-element",{"sizeAlias":[32],"sizeWidth":[32],"getSize":[64]}]]],["dso-info-button.cjs",[[1,"dso-info-button",{"active":[1540],"secondary":[4],"label":[1],"hover":[32],"setFocus":[64]}]]],["dso-tooltip.cjs",[[1,"dso-tooltip",{"descriptive":[516],"position":[1],"strategy":[1],"noArrow":[4,"no-arrow"],"stateless":[4],"small":[4],"active":[1540],"hidden":[32],"activate":[64],"deactivate":[64]}]]],["dso-icon.cjs",[[1,"dso-icon",{"icon":[1]}]]],["dso-info_2.cjs",[[6,"dso-selectable",{"type":[1],"identifier":[1],"name":[1],"value":[1],"invalid":[4],"describedById":[1,"described-by-id"],"labelledById":[1,"labelled-by-id"],"disabled":[4],"required":[4],"checked":[4],"indeterminate":[4],"infoFixed":[4,"info-fixed"],"infoActive":[32],"keyboardFocus":[32],"toggleInfo":[64]}],[1,"dso-info",{"fixed":[516],"active":[516]}]]],["dso-alert_5.cjs",[[1,"dso-label",{"compact":[4],"removable":[4],"status":[1],"truncate":[4],"removeHover":[32],"removeFocus":[32],"textHover":[32],"textFocus":[32],"isTruncated":[32],"labelText":[32],"_truncateLabel":[64]},[[4,"keydown","keyDownListener"]]],[1,"dso-alert",{"status":[1],"roleAlert":[4,"role-alert"]}],[0,"dso-annotation-button",{"identifier":[1],"open":[4]}],[1,"dso-badge",{"status":[1]}],[1,"dso-ozon-content",{"content":[1],"inline":[516],"state":[32]}]]],["dso-annotation-output_3.cjs",[[1,"dso-document-component",{"heading":[1],"label":[1],"nummer":[1],"opschrift":[1],"inhoud":[1],"open":[516],"filtered":[516],"notApplicable":[516,"not-applicable"],"genesteOntwerpInformatie":[516,"geneste-ontwerp-informatie"],"bevatOntwerpInformatie":[516,"bevat-ontwerp-informatie"],"annotated":[516],"gereserveerd":[4],"vervallen":[4],"openAnnotation":[4,"open-annotation"],"alternativeTitle":[1,"alternative-title"],"type":[513],"wijzigactie":[513]}],[4,"dso-annotation-output",{"identifier":[513],"annotationPrefix":[513,"annotation-prefix"],"open":[516]}],[4,"dso-slide-toggle",{"checked":[4],"disabled":[4],"accessibleLabel":[1,"accessible-label"],"labelledbyId":[1,"labelledby-id"],"identifier":[1],"hasVisibleLabel":[32]}]]]], options);
10
10
  };
11
11
 
12
12
  exports.setNonce = index.setNonce;
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.interfaces.js","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker.interfaces.ts"],"names":[],"mappings":"","sourcesContent":["export interface DatePickerChangeEvent {\r\n originalEvent: Event;\r\n component: \"dso-date-picker\";\r\n valueAsDate: Date | undefined;\r\n value: string;\r\n error?: \"invalid\" | \"required\" | \"min-range\" | \"max-range\";\r\n}\r\n\r\nexport interface DatePickerFocusEvent {\r\n originalEvent: FocusEvent;\r\n component: \"dso-date-picker\";\r\n}\r\n\r\nexport interface DatePickerKeyboardEvent {\r\n originalEvent: KeyboardEvent;\r\n component: \"dso-date-picker\";\r\n}\r\n"]}
1
+ {"version":3,"file":"date-picker.interfaces.js","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker.interfaces.ts"],"names":[],"mappings":"","sourcesContent":["export interface DatePickerChangeEvent {\r\n component: \"dso-date-picker\";\r\n\r\n /**\r\n * The original event that the change event of the `<input type=\"date\">` emitted.\r\n */\r\n originalEvent: Event;\r\n\r\n /**\r\n * The entered date in DD-MM-YYYY.\r\n *\r\n * Also set if the entered date is out of bounds, but empty `\"\"` if the date is invalid.\r\n */\r\n value: string;\r\n\r\n /**\r\n * The entered date as Date object.\r\n *\r\n * `undefined` if the date is out of bounds or invalid.\r\n */\r\n valueAsDate: Date | undefined;\r\n\r\n /**\r\n * The original validity object. Only for convienience, this object equals `detail.originalEvent.target.validity`.\r\n */\r\n validity: ValidityState;\r\n\r\n /**\r\n * If the input causes an error this property is set:\r\n *\r\n * * `required`: If the date is required but no date is given. Equals `validity.valueMissing`.\r\n * * `min-range`: The entered date is sooner than the minimum date set in `min`. Equals `validity.rangeUnderflow`.\r\n * * `max-range`: The entered date is later than the maximum date set in `max`. Equals `validity.rangeOverflow`.\r\n * * `invalid`: If the entered date is invalid. Equals `validity.invalid === false`.\r\n *\r\n * For more data on the validity of the input, refer to the property `validity`.\r\n */\r\n error?: \"required\" | \"min-range\" | \"max-range\" | \"invalid\";\r\n}\r\n\r\nexport interface DatePickerFocusEvent {\r\n originalEvent: FocusEvent;\r\n component: \"dso-date-picker\";\r\n}\r\n\r\nexport interface DatePickerKeyboardEvent {\r\n originalEvent: KeyboardEvent;\r\n component: \"dso-date-picker\";\r\n}\r\n"]}
@@ -1,5 +1,5 @@
1
1
  import { h } from "@stencil/core";
2
- import { clamp, parseDate, parseToValueFormat, printDutchDate } from "./date-utils";
2
+ import { parseToValueFormat, parseToDutchFormat } from "./date-utils";
3
3
  export class DsoDatePicker {
4
4
  constructor() {
5
5
  this.handleBlur = (event) => {
@@ -35,40 +35,29 @@ export class DsoDatePicker {
35
35
  if (!(target instanceof HTMLInputElement)) {
36
36
  return;
37
37
  }
38
- const { value } = target;
38
+ const { valueAsDate, validity } = target;
39
39
  const event = {
40
- originalEvent: e,
41
40
  component: "dso-date-picker",
42
- value,
43
- valueAsDate: parseDate(value),
41
+ originalEvent: e,
42
+ validity,
43
+ value: parseToDutchFormat(valueAsDate),
44
+ valueAsDate: valueAsDate !== null && valueAsDate !== void 0 ? valueAsDate : undefined,
44
45
  };
45
- if (event.valueAsDate) {
46
- event.value = printDutchDate(event.valueAsDate);
47
- }
48
- if (!event.valueAsDate && this.required) {
46
+ if (validity.valueMissing) {
49
47
  event.error = "required";
50
48
  }
51
- if (event.value && !event.valueAsDate) {
52
- event.error = "invalid";
49
+ else if (validity.rangeUnderflow) {
50
+ event.error = "min-range";
51
+ event.valueAsDate = undefined;
53
52
  }
54
- if (event.valueAsDate && (this.min || this.max)) {
55
- const min = parseDate(this.min);
56
- const max = parseDate(this.max);
57
- const clampValue = clamp(event.valueAsDate, min, max);
58
- if (clampValue !== event.valueAsDate && clampValue === min) {
59
- event.valueAsDate = undefined;
60
- event.error = "min-range";
61
- }
62
- else if (clampValue !== event.valueAsDate && clampValue === max) {
63
- event.valueAsDate = undefined;
64
- event.error = "max-range";
65
- }
53
+ else if (validity.rangeOverflow) {
54
+ event.error = "max-range";
55
+ event.valueAsDate = undefined;
66
56
  }
67
- this.value = typeof value === "string" ? value : event.value;
68
- if (this.value !== this.previousValue) {
69
- this.dsoDateChange.emit(event);
70
- this.previousValue = this.value;
57
+ else if (!validity.valid) {
58
+ event.error = "invalid";
71
59
  }
60
+ this.dsoDateChange.emit(event);
72
61
  };
73
62
  this.name = "dso-date";
74
63
  this.identifier = undefined;
@@ -237,7 +226,7 @@ export class DsoDatePicker {
237
226
  "text": "Date value. Must be in Dutch date format: DD-MM-YYYY."
238
227
  },
239
228
  "attribute": "value",
240
- "reflect": false,
229
+ "reflect": true,
241
230
  "defaultValue": "\"\""
242
231
  },
243
232
  "min": {
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.js","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAGrG,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAQpF,MAAM,OAAO,aAAa;;IA0Gh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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, ComponentInterface, Prop, Element, h, Event, EventEmitter } from \"@stencil/core\";\r\n\r\nimport { DatePickerChangeEvent, DatePickerFocusEvent, DatePickerKeyboardEvent } from \"./date-picker.interfaces\";\r\nimport { clamp, parseDate, parseToValueFormat, printDutchDate } from \"./date-utils\";\r\n\r\n@Component({\r\n tag: \"dso-date-picker\",\r\n styleUrl: \"date-picker.scss\",\r\n shadow: false,\r\n scoped: true,\r\n})\r\nexport class DsoDatePicker implements ComponentInterface {\r\n private previousValue?: string;\r\n\r\n /**\r\n * Reference to host HTML element.\r\n */\r\n @Element()\r\n element!: HTMLDsoDatePickerElement;\r\n\r\n /**\r\n * Name of the date picker input.\r\n */\r\n @Prop()\r\n name = \"dso-date\";\r\n\r\n /**\r\n * Adds a unique identifier for the date picker input. Use this instead of html `id` attribute.\r\n */\r\n @Prop()\r\n identifier: string | undefined;\r\n\r\n /**\r\n * Makes the date picker input component disabled. This prevents users from being able to\r\n * interact with the input, and conveys its inactive state to assistive technologies.\r\n */\r\n @Prop({ reflect: true })\r\n disabled = false;\r\n\r\n /**\r\n * Should the input be marked as required?\r\n */\r\n @Prop({ reflect: true })\r\n required = false;\r\n\r\n /**\r\n * Is input invalid?\r\n */\r\n @Prop({ reflect: true })\r\n invalid?: boolean;\r\n\r\n /**\r\n * ID of element that describes the input element\r\n */\r\n @Prop()\r\n describedBy?: string;\r\n\r\n /**\r\n * Should the input be focused on load?\r\n */\r\n @Prop()\r\n dsoAutofocus = false;\r\n\r\n /**\r\n * Date value. Must be in Dutch date format: DD-MM-YYYY.\r\n */\r\n @Prop()\r\n value = \"\";\r\n\r\n /**\r\n * Minimum date allowed to be picked. Must be in Dutch date format: DD-MM-YYYY.\r\n * This setting can be used alone or together with the max property.\r\n */\r\n @Prop()\r\n min: string | undefined;\r\n\r\n /**\r\n * Maximum date allowed to be picked. Must be in Dutch date format: DD-MM-YYYY.\r\n * This setting can be used alone or together with the min property.\r\n */\r\n @Prop()\r\n max: string | undefined;\r\n\r\n /**\r\n * Events section.\r\n */\r\n\r\n /**\r\n * Event emitted when a date is selected.\r\n */\r\n @Event()\r\n dsoDateChange!: EventEmitter<DatePickerChangeEvent>;\r\n\r\n /**\r\n * Event emitted the date picker input is blurred.\r\n */\r\n @Event()\r\n dsoBlur!: EventEmitter<DatePickerFocusEvent>;\r\n\r\n /**\r\n * Event emitted on key up in the date picker input.\r\n */\r\n @Event()\r\n dsoKeyUp!: EventEmitter<DatePickerKeyboardEvent>;\r\n\r\n /**\r\n * Event emitted on key down in the date picker input.\r\n */\r\n @Event()\r\n dsoKeyDown!: EventEmitter<DatePickerKeyboardEvent>;\r\n\r\n /**\r\n * Event emitted the date picker input is focused.\r\n */\r\n @Event()\r\n dsoFocus!: EventEmitter<DatePickerFocusEvent>;\r\n\r\n private handleBlur = (event: FocusEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoBlur.emit({\r\n originalEvent: event,\r\n component: \"dso-date-picker\",\r\n });\r\n };\r\n\r\n private handleFocus = (event: FocusEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoFocus.emit({\r\n originalEvent: event,\r\n component: \"dso-date-picker\",\r\n });\r\n };\r\n\r\n private handleKeyUp = (event: KeyboardEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoKeyUp.emit({\r\n component: \"dso-date-picker\",\r\n originalEvent: event,\r\n });\r\n };\r\n\r\n private handleKeyDown = (event: KeyboardEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoKeyDown.emit({\r\n component: \"dso-date-picker\",\r\n originalEvent: event,\r\n });\r\n };\r\n\r\n private handleInputChange = (e: Event) => {\r\n const target = e.target;\r\n\r\n if (!(target instanceof HTMLInputElement)) {\r\n return;\r\n }\r\n\r\n const { value } = target;\r\n\r\n const event: DatePickerChangeEvent = {\r\n originalEvent: e,\r\n component: \"dso-date-picker\",\r\n value,\r\n valueAsDate: parseDate(value),\r\n };\r\n\r\n if (event.valueAsDate) {\r\n event.value = printDutchDate(event.valueAsDate);\r\n }\r\n\r\n if (!event.valueAsDate && this.required) {\r\n event.error = \"required\";\r\n }\r\n\r\n if (event.value && !event.valueAsDate) {\r\n event.error = \"invalid\";\r\n }\r\n\r\n if (event.valueAsDate && (this.min || this.max)) {\r\n const min = parseDate(this.min);\r\n const max = parseDate(this.max);\r\n const clampValue = clamp(event.valueAsDate, min, max);\r\n\r\n if (clampValue !== event.valueAsDate && clampValue === min) {\r\n event.valueAsDate = undefined;\r\n event.error = \"min-range\";\r\n } else if (clampValue !== event.valueAsDate && clampValue === max) {\r\n event.valueAsDate = undefined;\r\n event.error = \"max-range\";\r\n }\r\n }\r\n\r\n this.value = typeof value === \"string\" ? value : event.value;\r\n\r\n if (this.value !== this.previousValue) {\r\n this.dsoDateChange.emit(event);\r\n this.previousValue = this.value;\r\n }\r\n };\r\n\r\n render() {\r\n return (\r\n <input\r\n type=\"date\"\r\n id={this.identifier}\r\n class=\"dso-date__input\"\r\n value={parseToValueFormat(this.value)}\r\n name={this.name}\r\n min={parseToValueFormat(this.min)}\r\n max={parseToValueFormat(this.max)}\r\n disabled={this.disabled || undefined}\r\n required={this.required || undefined}\r\n aria-autocomplete=\"none\"\r\n aria-invalid={this.invalid?.toString()}\r\n aria-describedby={this.describedBy}\r\n autoComplete=\"off\"\r\n autofocus={this.dsoAutofocus || undefined}\r\n onBlur={this.handleBlur}\r\n onFocus={this.handleFocus}\r\n onKeyUp={this.handleKeyUp}\r\n onKeyDown={this.handleKeyDown}\r\n onChange={this.handleInputChange}\r\n />\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"date-picker.js","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsB,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAGrG,OAAO,EAAE,kBAAkB,EAAE,kBAAk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SAAS,EAAE,IAAI,CAAC,YAAY,IAAI,SAAS,EACzC,MAAM,EAAE,IAAI,CAAC,UAAU,EACvB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,SAAS,EAAE,IAAI,CAAC,aAAa,EAC7B,QAAQ,EAAE,IAAI,CAAC,iBAAiB,GAChC,CACH,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, ComponentInterface, Prop, Element, h, Event, EventEmitter } from \"@stencil/core\";\r\n\r\nimport { DatePickerChangeEvent, DatePickerFocusEvent, DatePickerKeyboardEvent } from \"./date-picker.interfaces\";\r\nimport { parseToValueFormat, parseToDutchFormat } from \"./date-utils\";\r\n\r\n@Component({\r\n tag: \"dso-date-picker\",\r\n styleUrl: \"date-picker.scss\",\r\n shadow: false,\r\n scoped: true,\r\n})\r\nexport class DsoDatePicker implements ComponentInterface {\r\n /**\r\n * Reference to host HTML element.\r\n */\r\n @Element()\r\n element!: HTMLDsoDatePickerElement;\r\n\r\n /**\r\n * Name of the date picker input.\r\n */\r\n @Prop()\r\n name = \"dso-date\";\r\n\r\n /**\r\n * Adds a unique identifier for the date picker input. Use this instead of html `id` attribute.\r\n */\r\n @Prop()\r\n identifier: string | undefined;\r\n\r\n /**\r\n * Makes the date picker input component disabled. This prevents users from being able to\r\n * interact with the input, and conveys its inactive state to assistive technologies.\r\n */\r\n @Prop({ reflect: true })\r\n disabled = false;\r\n\r\n /**\r\n * Should the input be marked as required?\r\n */\r\n @Prop({ reflect: true })\r\n required = false;\r\n\r\n /**\r\n * Is input invalid?\r\n */\r\n @Prop({ reflect: true })\r\n invalid?: boolean;\r\n\r\n /**\r\n * ID of element that describes the input element\r\n */\r\n @Prop()\r\n describedBy?: string;\r\n\r\n /**\r\n * Should the input be focused on load?\r\n */\r\n @Prop()\r\n dsoAutofocus = false;\r\n\r\n /**\r\n * Date value. Must be in Dutch date format: DD-MM-YYYY.\r\n */\r\n @Prop({ reflect: true })\r\n value = \"\";\r\n\r\n /**\r\n * Minimum date allowed to be picked. Must be in Dutch date format: DD-MM-YYYY.\r\n * This setting can be used alone or together with the max property.\r\n */\r\n @Prop()\r\n min: string | undefined;\r\n\r\n /**\r\n * Maximum date allowed to be picked. Must be in Dutch date format: DD-MM-YYYY.\r\n * This setting can be used alone or together with the min property.\r\n */\r\n @Prop()\r\n max: string | undefined;\r\n\r\n /**\r\n * Events section.\r\n */\r\n\r\n /**\r\n * Event emitted when a date is selected.\r\n */\r\n @Event()\r\n dsoDateChange!: EventEmitter<DatePickerChangeEvent>;\r\n\r\n /**\r\n * Event emitted the date picker input is blurred.\r\n */\r\n @Event()\r\n dsoBlur!: EventEmitter<DatePickerFocusEvent>;\r\n\r\n /**\r\n * Event emitted on key up in the date picker input.\r\n */\r\n @Event()\r\n dsoKeyUp!: EventEmitter<DatePickerKeyboardEvent>;\r\n\r\n /**\r\n * Event emitted on key down in the date picker input.\r\n */\r\n @Event()\r\n dsoKeyDown!: EventEmitter<DatePickerKeyboardEvent>;\r\n\r\n /**\r\n * Event emitted the date picker input is focused.\r\n */\r\n @Event()\r\n dsoFocus!: EventEmitter<DatePickerFocusEvent>;\r\n\r\n private handleBlur = (event: FocusEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoBlur.emit({\r\n originalEvent: event,\r\n component: \"dso-date-picker\",\r\n });\r\n };\r\n\r\n private handleFocus = (event: FocusEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoFocus.emit({\r\n originalEvent: event,\r\n component: \"dso-date-picker\",\r\n });\r\n };\r\n\r\n private handleKeyUp = (event: KeyboardEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoKeyUp.emit({\r\n component: \"dso-date-picker\",\r\n originalEvent: event,\r\n });\r\n };\r\n\r\n private handleKeyDown = (event: KeyboardEvent) => {\r\n event.stopPropagation();\r\n\r\n this.dsoKeyDown.emit({\r\n component: \"dso-date-picker\",\r\n originalEvent: event,\r\n });\r\n };\r\n\r\n private handleInputChange = (e: Event) => {\r\n const target = e.target;\r\n\r\n if (!(target instanceof HTMLInputElement)) {\r\n return;\r\n }\r\n\r\n const { valueAsDate, validity } = target;\r\n\r\n const event: DatePickerChangeEvent = {\r\n component: \"dso-date-picker\",\r\n originalEvent: e,\r\n validity,\r\n value: parseToDutchFormat(valueAsDate),\r\n valueAsDate: valueAsDate ?? undefined,\r\n };\r\n\r\n if (validity.valueMissing) {\r\n event.error = \"required\";\r\n } else if (validity.rangeUnderflow) {\r\n event.error = \"min-range\";\r\n event.valueAsDate = undefined;\r\n } else if (validity.rangeOverflow) {\r\n event.error = \"max-range\";\r\n event.valueAsDate = undefined;\r\n } else if (!validity.valid) {\r\n event.error = \"invalid\";\r\n }\r\n\r\n this.dsoDateChange.emit(event);\r\n };\r\n\r\n render() {\r\n return (\r\n <input\r\n type=\"date\"\r\n id={this.identifier}\r\n class=\"dso-date__input\"\r\n value={parseToValueFormat(this.value)}\r\n name={this.name}\r\n min={parseToValueFormat(this.min)}\r\n max={parseToValueFormat(this.max)}\r\n disabled={this.disabled || undefined}\r\n required={this.required || undefined}\r\n aria-autocomplete=\"none\"\r\n aria-invalid={this.invalid?.toString()}\r\n aria-describedby={this.describedBy}\r\n autoComplete=\"off\"\r\n autofocus={this.dsoAutofocus || undefined}\r\n onBlur={this.handleBlur}\r\n onFocus={this.handleFocus}\r\n onKeyUp={this.handleKeyUp}\r\n onKeyDown={this.handleKeyDown}\r\n onChange={this.handleInputChange}\r\n />\r\n );\r\n }\r\n}\r\n"]}