@digdir/designsystemet-web 0.0.0-feat-export-all-20260304131545

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 (68) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +277 -0
  3. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -0
  4. package/dist/cjs/breadcrumbs/breadcrumbs.cjs +2 -0
  5. package/dist/cjs/breadcrumbs/breadcrumbs.cjs.map +1 -0
  6. package/dist/cjs/clickdelegatefor/clickdelegatefor.cjs +2 -0
  7. package/dist/cjs/clickdelegatefor/clickdelegatefor.cjs.map +1 -0
  8. package/dist/cjs/dialog/dialog.cjs +2 -0
  9. package/dist/cjs/dialog/dialog.cjs.map +1 -0
  10. package/dist/cjs/error-summary/error-summary.cjs +2 -0
  11. package/dist/cjs/error-summary/error-summary.cjs.map +1 -0
  12. package/dist/cjs/field/field.cjs +2 -0
  13. package/dist/cjs/field/field.cjs.map +1 -0
  14. package/dist/cjs/index.cjs +2 -0
  15. package/dist/cjs/index.cjs.map +1 -0
  16. package/dist/cjs/pagination/pagination.cjs +2 -0
  17. package/dist/cjs/pagination/pagination.cjs.map +1 -0
  18. package/dist/cjs/popover/popover.cjs +2 -0
  19. package/dist/cjs/popover/popover.cjs.map +1 -0
  20. package/dist/cjs/readonly/readonly.cjs +2 -0
  21. package/dist/cjs/readonly/readonly.cjs.map +1 -0
  22. package/dist/cjs/suggestion/suggestion.cjs +2 -0
  23. package/dist/cjs/suggestion/suggestion.cjs.map +1 -0
  24. package/dist/cjs/tabs/tabs.cjs +2 -0
  25. package/dist/cjs/tabs/tabs.cjs.map +1 -0
  26. package/dist/cjs/toggle-group/toggle-group.cjs +2 -0
  27. package/dist/cjs/toggle-group/toggle-group.cjs.map +1 -0
  28. package/dist/cjs/tooltip/tooltip.cjs +2 -0
  29. package/dist/cjs/tooltip/tooltip.cjs.map +1 -0
  30. package/dist/cjs/utils/utils.cjs +2 -0
  31. package/dist/cjs/utils/utils.cjs.map +1 -0
  32. package/dist/custom-elements.json +531 -0
  33. package/dist/esm/breadcrumbs/breadcrumbs.js +2 -0
  34. package/dist/esm/breadcrumbs/breadcrumbs.js.map +1 -0
  35. package/dist/esm/clickdelegatefor/clickdelegatefor.js +2 -0
  36. package/dist/esm/clickdelegatefor/clickdelegatefor.js.map +1 -0
  37. package/dist/esm/dialog/dialog.js +2 -0
  38. package/dist/esm/dialog/dialog.js.map +1 -0
  39. package/dist/esm/error-summary/error-summary.js +2 -0
  40. package/dist/esm/error-summary/error-summary.js.map +1 -0
  41. package/dist/esm/field/field.js +2 -0
  42. package/dist/esm/field/field.js.map +1 -0
  43. package/dist/esm/index.js +2 -0
  44. package/dist/esm/index.js.map +1 -0
  45. package/dist/esm/pagination/pagination.js +2 -0
  46. package/dist/esm/pagination/pagination.js.map +1 -0
  47. package/dist/esm/popover/popover.js +2 -0
  48. package/dist/esm/popover/popover.js.map +1 -0
  49. package/dist/esm/readonly/readonly.js +2 -0
  50. package/dist/esm/readonly/readonly.js.map +1 -0
  51. package/dist/esm/suggestion/suggestion.js +2 -0
  52. package/dist/esm/suggestion/suggestion.js.map +1 -0
  53. package/dist/esm/tabs/tabs.js +2 -0
  54. package/dist/esm/tabs/tabs.js.map +1 -0
  55. package/dist/esm/toggle-group/toggle-group.js +2 -0
  56. package/dist/esm/toggle-group/toggle-group.js.map +1 -0
  57. package/dist/esm/tooltip/tooltip.js +2 -0
  58. package/dist/esm/tooltip/tooltip.js.map +1 -0
  59. package/dist/esm/utils/utils.js +2 -0
  60. package/dist/esm/utils/utils.js.map +1 -0
  61. package/dist/index.d.ts +321 -0
  62. package/dist/index.js +716 -0
  63. package/dist/umd/index.js +15 -0
  64. package/dist/umd/index.js.map +1 -0
  65. package/dist/vscode.html-custom-data.json +60 -0
  66. package/dist/web.manifest.json +977 -0
  67. package/dist/web.vscode.json +60 -0
  68. package/package.json +106 -0
@@ -0,0 +1,531 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/index.ts",
8
+ "declarations": [],
9
+ "exports": [
10
+ {
11
+ "kind": "js",
12
+ "name": "*",
13
+ "declaration": {
14
+ "name": "*",
15
+ "package": "@u-elements/u-datalist"
16
+ }
17
+ },
18
+ {
19
+ "kind": "js",
20
+ "name": "*",
21
+ "declaration": {
22
+ "name": "*",
23
+ "module": "src/breadcrumbs/breadcrumbs"
24
+ }
25
+ },
26
+ {
27
+ "kind": "js",
28
+ "name": "*",
29
+ "declaration": {
30
+ "name": "*",
31
+ "module": "src/error-summary/error-summary"
32
+ }
33
+ },
34
+ {
35
+ "kind": "js",
36
+ "name": "*",
37
+ "declaration": {
38
+ "name": "*",
39
+ "module": "src/field/field"
40
+ }
41
+ },
42
+ {
43
+ "kind": "js",
44
+ "name": "*",
45
+ "declaration": {
46
+ "name": "*",
47
+ "module": "src/pagination/pagination"
48
+ }
49
+ },
50
+ {
51
+ "kind": "js",
52
+ "name": "*",
53
+ "declaration": {
54
+ "name": "*",
55
+ "module": "src/suggestion/suggestion"
56
+ }
57
+ },
58
+ {
59
+ "kind": "js",
60
+ "name": "*",
61
+ "declaration": {
62
+ "name": "*",
63
+ "module": "src/tabs/tabs"
64
+ }
65
+ },
66
+ {
67
+ "kind": "js",
68
+ "name": "*",
69
+ "declaration": {
70
+ "name": "*",
71
+ "module": "src/tooltip/tooltip"
72
+ }
73
+ }
74
+ ]
75
+ },
76
+ {
77
+ "kind": "javascript-module",
78
+ "path": "src/breadcrumbs/breadcrumbs.ts",
79
+ "declarations": [
80
+ {
81
+ "kind": "class",
82
+ "description": "",
83
+ "name": "DSBreadcrumbsElement",
84
+ "members": [
85
+ {
86
+ "kind": "field",
87
+ "name": "_items",
88
+ "type": {
89
+ "text": "HTMLCollectionOf<HTMLAnchorElement> | undefined"
90
+ }
91
+ },
92
+ {
93
+ "kind": "field",
94
+ "name": "_label",
95
+ "type": {
96
+ "text": "string | null"
97
+ },
98
+ "default": "null"
99
+ },
100
+ {
101
+ "kind": "field",
102
+ "name": "_render",
103
+ "type": {
104
+ "text": "() => void | undefined"
105
+ }
106
+ },
107
+ {
108
+ "kind": "field",
109
+ "name": "_unresize",
110
+ "type": {
111
+ "text": "() => void | undefined"
112
+ }
113
+ },
114
+ {
115
+ "kind": "field",
116
+ "name": "_unmutate",
117
+ "type": {
118
+ "text": "() => void | undefined"
119
+ }
120
+ }
121
+ ],
122
+ "superclass": {
123
+ "name": "DSElement",
124
+ "module": "/src/utils/utils"
125
+ },
126
+ "tagName": "ds-breadcrumbs",
127
+ "customElement": true
128
+ }
129
+ ],
130
+ "exports": [
131
+ {
132
+ "kind": "js",
133
+ "name": "DSBreadcrumbsElement",
134
+ "declaration": {
135
+ "name": "DSBreadcrumbsElement",
136
+ "module": "src/breadcrumbs/breadcrumbs.ts"
137
+ }
138
+ },
139
+ {
140
+ "kind": "custom-element-definition",
141
+ "name": "ds-breadcrumbs",
142
+ "declaration": {
143
+ "name": "DSBreadcrumbsElement",
144
+ "module": "src/breadcrumbs/breadcrumbs.ts"
145
+ }
146
+ }
147
+ ]
148
+ },
149
+ {
150
+ "kind": "javascript-module",
151
+ "path": "src/dialog/dialog.ts",
152
+ "declarations": [],
153
+ "exports": []
154
+ },
155
+ {
156
+ "kind": "javascript-module",
157
+ "path": "src/clickdelegatefor/clickdelegatefor.ts",
158
+ "declarations": [],
159
+ "exports": []
160
+ },
161
+ {
162
+ "kind": "javascript-module",
163
+ "path": "src/error-summary/error-summary.ts",
164
+ "declarations": [
165
+ {
166
+ "kind": "class",
167
+ "description": "",
168
+ "name": "DSErrorSummaryElement",
169
+ "members": [
170
+ {
171
+ "kind": "method",
172
+ "name": "handleEvent",
173
+ "parameters": [
174
+ {
175
+ "name": "{ target }",
176
+ "type": {
177
+ "text": "Partial<Event>"
178
+ }
179
+ }
180
+ ]
181
+ }
182
+ ],
183
+ "superclass": {
184
+ "name": "DSElement",
185
+ "module": "/src/utils/utils"
186
+ },
187
+ "tagName": "ds-error-summary",
188
+ "customElement": true
189
+ }
190
+ ],
191
+ "exports": [
192
+ {
193
+ "kind": "js",
194
+ "name": "DSErrorSummaryElement",
195
+ "declaration": {
196
+ "name": "DSErrorSummaryElement",
197
+ "module": "src/error-summary/error-summary.ts"
198
+ }
199
+ },
200
+ {
201
+ "kind": "custom-element-definition",
202
+ "name": "ds-error-summary",
203
+ "declaration": {
204
+ "name": "DSErrorSummaryElement",
205
+ "module": "src/error-summary/error-summary.ts"
206
+ }
207
+ }
208
+ ]
209
+ },
210
+ {
211
+ "kind": "javascript-module",
212
+ "path": "src/field/field.ts",
213
+ "declarations": [
214
+ {
215
+ "kind": "class",
216
+ "description": "",
217
+ "name": "DSFieldElement",
218
+ "superclass": {
219
+ "name": "DSElement",
220
+ "module": "/src/utils/utils"
221
+ },
222
+ "tagName": "ds-field",
223
+ "customElement": true
224
+ }
225
+ ],
226
+ "exports": [
227
+ {
228
+ "kind": "js",
229
+ "name": "DSFieldElement",
230
+ "declaration": {
231
+ "name": "DSFieldElement",
232
+ "module": "src/field/field.ts"
233
+ }
234
+ },
235
+ {
236
+ "kind": "custom-element-definition",
237
+ "name": "ds-field",
238
+ "declaration": {
239
+ "name": "DSFieldElement",
240
+ "module": "src/field/field.ts"
241
+ }
242
+ }
243
+ ]
244
+ },
245
+ {
246
+ "kind": "javascript-module",
247
+ "path": "src/pagination/pagination.ts",
248
+ "declarations": [
249
+ {
250
+ "kind": "function",
251
+ "name": "pagination",
252
+ "parameters": [
253
+ {
254
+ "name": "{ current = 1, total = 10, show = 7 }"
255
+ }
256
+ ]
257
+ },
258
+ {
259
+ "kind": "class",
260
+ "description": "",
261
+ "name": "DSPaginationElement",
262
+ "members": [
263
+ {
264
+ "kind": "field",
265
+ "name": "_unmutate",
266
+ "type": {
267
+ "text": "() => void | undefined"
268
+ }
269
+ },
270
+ {
271
+ "kind": "field",
272
+ "name": "_render",
273
+ "type": {
274
+ "text": "() => void | undefined"
275
+ }
276
+ }
277
+ ],
278
+ "superclass": {
279
+ "name": "DSElement",
280
+ "module": "/src/utils/utils"
281
+ },
282
+ "tagName": "ds-pagination",
283
+ "customElement": true
284
+ }
285
+ ],
286
+ "exports": [
287
+ {
288
+ "kind": "js",
289
+ "name": "pagination",
290
+ "declaration": {
291
+ "name": "pagination",
292
+ "module": "src/pagination/pagination.ts"
293
+ }
294
+ },
295
+ {
296
+ "kind": "js",
297
+ "name": "DSPaginationElement",
298
+ "declaration": {
299
+ "name": "DSPaginationElement",
300
+ "module": "src/pagination/pagination.ts"
301
+ }
302
+ },
303
+ {
304
+ "kind": "custom-element-definition",
305
+ "name": "ds-pagination",
306
+ "declaration": {
307
+ "name": "DSPaginationElement",
308
+ "module": "src/pagination/pagination.ts"
309
+ }
310
+ }
311
+ ]
312
+ },
313
+ {
314
+ "kind": "javascript-module",
315
+ "path": "src/popover/popover.ts",
316
+ "declarations": [
317
+ {
318
+ "kind": "variable",
319
+ "name": "placement"
320
+ }
321
+ ],
322
+ "exports": []
323
+ },
324
+ {
325
+ "kind": "javascript-module",
326
+ "path": "src/readonly/readonly.ts",
327
+ "declarations": [],
328
+ "exports": []
329
+ },
330
+ {
331
+ "kind": "javascript-module",
332
+ "path": "src/suggestion/suggestion.ts",
333
+ "declarations": [
334
+ {
335
+ "kind": "class",
336
+ "description": "",
337
+ "name": "DSSuggestionElement",
338
+ "members": [
339
+ {
340
+ "kind": "field",
341
+ "name": "_unmutate",
342
+ "type": {
343
+ "text": "ReturnType<typeof onMutation> | undefined"
344
+ }
345
+ },
346
+ {
347
+ "kind": "field",
348
+ "name": "_render",
349
+ "type": {
350
+ "text": "() => void | undefined"
351
+ }
352
+ }
353
+ ],
354
+ "superclass": {
355
+ "name": "UHTMLComboboxElement",
356
+ "package": "@u-elements/u-combobox"
357
+ },
358
+ "tagName": "ds-suggestion",
359
+ "customElement": true
360
+ }
361
+ ],
362
+ "exports": [
363
+ {
364
+ "kind": "js",
365
+ "name": "DSSuggestionElement",
366
+ "declaration": {
367
+ "name": "DSSuggestionElement",
368
+ "module": "src/suggestion/suggestion.ts"
369
+ }
370
+ },
371
+ {
372
+ "kind": "custom-element-definition",
373
+ "name": "ds-suggestion",
374
+ "declaration": {
375
+ "name": "DSSuggestionElement",
376
+ "module": "src/suggestion/suggestion.ts"
377
+ }
378
+ }
379
+ ]
380
+ },
381
+ {
382
+ "kind": "javascript-module",
383
+ "path": "src/tabs/tabs.ts",
384
+ "declarations": [
385
+ {
386
+ "kind": "class",
387
+ "description": "",
388
+ "name": "DSTabsElement",
389
+ "superclass": {
390
+ "module": "src/tabs/tabs.ts"
391
+ },
392
+ "tagName": "ds-tabs",
393
+ "customElement": true
394
+ },
395
+ {
396
+ "kind": "class",
397
+ "description": "",
398
+ "name": "DSTabListElement",
399
+ "superclass": {
400
+ "module": "src/tabs/tabs.ts"
401
+ },
402
+ "tagName": "ds-tablist",
403
+ "customElement": true
404
+ },
405
+ {
406
+ "kind": "class",
407
+ "description": "",
408
+ "name": "DSTabElement",
409
+ "superclass": {
410
+ "module": "src/tabs/tabs.ts"
411
+ },
412
+ "tagName": "ds-tab",
413
+ "customElement": true
414
+ },
415
+ {
416
+ "kind": "class",
417
+ "description": "",
418
+ "name": "DSTabPanelElement",
419
+ "superclass": {
420
+ "module": "src/tabs/tabs.ts"
421
+ },
422
+ "tagName": "ds-tabpanel",
423
+ "customElement": true
424
+ }
425
+ ],
426
+ "exports": [
427
+ {
428
+ "kind": "js",
429
+ "name": "DSTabsElement",
430
+ "declaration": {
431
+ "name": "DSTabsElement",
432
+ "module": "src/tabs/tabs.ts"
433
+ }
434
+ },
435
+ {
436
+ "kind": "js",
437
+ "name": "DSTabListElement",
438
+ "declaration": {
439
+ "name": "DSTabListElement",
440
+ "module": "src/tabs/tabs.ts"
441
+ }
442
+ },
443
+ {
444
+ "kind": "js",
445
+ "name": "DSTabElement",
446
+ "declaration": {
447
+ "name": "DSTabElement",
448
+ "module": "src/tabs/tabs.ts"
449
+ }
450
+ },
451
+ {
452
+ "kind": "js",
453
+ "name": "DSTabPanelElement",
454
+ "declaration": {
455
+ "name": "DSTabPanelElement",
456
+ "module": "src/tabs/tabs.ts"
457
+ }
458
+ },
459
+ {
460
+ "kind": "custom-element-definition",
461
+ "name": "ds-tabs",
462
+ "declaration": {
463
+ "name": "DSTabsElement",
464
+ "module": "src/tabs/tabs.ts"
465
+ }
466
+ },
467
+ {
468
+ "kind": "custom-element-definition",
469
+ "name": "ds-tablist",
470
+ "declaration": {
471
+ "name": "DSTabListElement",
472
+ "module": "src/tabs/tabs.ts"
473
+ }
474
+ },
475
+ {
476
+ "kind": "custom-element-definition",
477
+ "name": "ds-tab",
478
+ "declaration": {
479
+ "name": "DSTabElement",
480
+ "module": "src/tabs/tabs.ts"
481
+ }
482
+ },
483
+ {
484
+ "kind": "custom-element-definition",
485
+ "name": "ds-tabpanel",
486
+ "declaration": {
487
+ "name": "DSTabPanelElement",
488
+ "module": "src/tabs/tabs.ts"
489
+ }
490
+ }
491
+ ]
492
+ },
493
+ {
494
+ "kind": "javascript-module",
495
+ "path": "src/toggle-group/toggle-group.ts",
496
+ "declarations": [],
497
+ "exports": []
498
+ },
499
+ {
500
+ "kind": "javascript-module",
501
+ "path": "src/tooltip/tooltip.ts",
502
+ "declarations": [
503
+ {
504
+ "kind": "function",
505
+ "name": "setTooltipElement",
506
+ "parameters": [
507
+ {
508
+ "name": "el",
509
+ "optional": true,
510
+ "type": {
511
+ "text": "HTMLElement | null"
512
+ },
513
+ "description": "The HTMLElement to use as tooltip"
514
+ }
515
+ ],
516
+ "description": "setTooltipElement"
517
+ }
518
+ ],
519
+ "exports": [
520
+ {
521
+ "kind": "js",
522
+ "name": "setTooltipElement",
523
+ "declaration": {
524
+ "name": "setTooltipElement",
525
+ "module": "src/tooltip/tooltip.ts"
526
+ }
527
+ }
528
+ ]
529
+ }
530
+ ]
531
+ }
@@ -0,0 +1,2 @@
1
+ import{DSElement as e,attr as t,attrOrCSS as n,customElements as r,debounce as i,on as a,onMutation as o}from"../utils/utils.js";const s=`aria-label`;var c=class extends e{_items;_label=null;_render;_unresize;_unmutate;static get observedAttributes(){return[s]}connectedCallback(){this._label=n(this,s),this._items=this.getElementsByTagName(`a`),this._render=i(()=>l(this),100),this._unresize=a(window,`resize`,this._render),this._unmutate=o(this,this._render,{childList:!0,subtree:!0})}attributeChangedCallback(e,t,n){n&&(this._label=n),this._render?.()}disconnectedCallback(){this._unresize?.(),this._unmutate?.(),this._unresize=this._unmutate=this._render=this._items=void 0}};const l=e=>{let n=e._items?.[e._items.length-1],r=n?.parentElement===e?null:n,i=!r?.offsetHeight;t(e,`role`,i?null:`navigation`),t(e,s,i?null:e._label);for(let n of e._items||[])t(n,`aria-current`,n===r?`page`:null)};r.define(`ds-breadcrumbs`,c);export{c as DSBreadcrumbsElement};
2
+ //# sourceMappingURL=breadcrumbs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breadcrumbs.js","names":[],"sources":["../../../src/breadcrumbs/breadcrumbs.ts"],"sourcesContent":["import {\n attr,\n attrOrCSS,\n customElements,\n DSElement,\n debounce,\n on,\n onMutation,\n} from '../utils/utils';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ds-breadcrumbs': DSBreadcrumbsElement;\n }\n}\n\nconst ATTR_LABEL = 'aria-label';\n\nexport class DSBreadcrumbsElement extends DSElement {\n _items?: HTMLCollectionOf<HTMLAnchorElement>; // Using underscore instead of private fields for backwards compatibility\n _label: string | null = null;\n _render?: () => void;\n _unresize?: () => void;\n _unmutate?: () => void;\n\n static get observedAttributes() {\n return [ATTR_LABEL]; // Using ES2015 syntax for backwards compatibility\n }\n connectedCallback() {\n this._label = attrOrCSS(this, ATTR_LABEL); // Cache label for when list is hidden to prevent expensive DOM reads during resize\n this._items = this.getElementsByTagName('a'); // Speed up by caching HTMLCollection\n this._render = debounce(() => render(this), 100); // Debounce render to prevent multiple calls during resize and mutation observer calls\n this._unresize = on(window, 'resize', this._render);\n this._unmutate = onMutation(this, this._render, {\n childList: true,\n subtree: true,\n });\n }\n attributeChangedCallback(_name: string, _prev?: string, next?: string) {\n if (next) this._label = next; // Update cacheed label if aria-label attribute changes\n this._render?.();\n }\n disconnectedCallback() {\n this._unresize?.();\n this._unmutate?.();\n this._unresize = this._unmutate = this._render = this._items = undefined;\n }\n}\n\nconst render = (self: DSBreadcrumbsElement) => {\n const lastItem = self._items?.[self._items.length - 1];\n const lastItemInList = lastItem?.parentElement === self ? null : lastItem;\n const isListHidden = !lastItemInList?.offsetHeight;\n\n attr(self, 'role', isListHidden ? null : 'navigation');\n attr(self, ATTR_LABEL, isListHidden ? null : self._label); // Remove aria-label if list is hidden to prevent screen readers from announcing as breadcrumbs\n\n for (const item of self._items || [])\n attr(item, 'aria-current', item === lastItemInList ? 'page' : null);\n};\n\ncustomElements.define('ds-breadcrumbs', DSBreadcrumbsElement);\n"],"mappings":"iIAgBA,MAAM,EAAa,aAEnB,IAAa,EAAb,cAA0C,CAAU,CAClD,OACA,OAAwB,KACxB,QACA,UACA,UAEA,WAAW,oBAAqB,CAC9B,MAAO,CAAC,EAAW,CAErB,mBAAoB,CAClB,KAAK,OAAS,EAAU,KAAM,EAAW,CACzC,KAAK,OAAS,KAAK,qBAAqB,IAAI,CAC5C,KAAK,QAAU,MAAe,EAAO,KAAK,CAAE,IAAI,CAChD,KAAK,UAAY,EAAG,OAAQ,SAAU,KAAK,QAAQ,CACnD,KAAK,UAAY,EAAW,KAAM,KAAK,QAAS,CAC9C,UAAW,GACX,QAAS,GACV,CAAC,CAEJ,yBAAyB,EAAe,EAAgB,EAAe,CACjE,IAAM,KAAK,OAAS,GACxB,KAAK,WAAW,CAElB,sBAAuB,CACrB,KAAK,aAAa,CAClB,KAAK,aAAa,CAClB,KAAK,UAAY,KAAK,UAAY,KAAK,QAAU,KAAK,OAAS,IAAA,KAInE,MAAM,EAAU,GAA+B,CAC7C,IAAM,EAAW,EAAK,SAAS,EAAK,OAAO,OAAS,GAC9C,EAAiB,GAAU,gBAAkB,EAAO,KAAO,EAC3D,EAAe,CAAC,GAAgB,aAEtC,EAAK,EAAM,OAAQ,EAAe,KAAO,aAAa,CACtD,EAAK,EAAM,EAAY,EAAe,KAAO,EAAK,OAAO,CAEzD,IAAK,IAAM,KAAQ,EAAK,QAAU,EAAE,CAClC,EAAK,EAAM,eAAgB,IAAS,EAAiB,OAAS,KAAK,EAGvE,EAAe,OAAO,iBAAkB,EAAqB"}
@@ -0,0 +1,2 @@
1
+ import{QUICK_EVENT as e,on as t,onHotReload as n}from"../utils/utils.js";const r=`:click-delegate-hover`,i=`data-clickdelegatefor`,a=`[${i}]`,o=e=>{let t=e.button===1||e.metaKey||e.ctrlKey,n=e.isTrusted&&e.button<2&&l(e);if(!(!n||n.contains(e.target))){if(t&&n instanceof HTMLAnchorElement)return window.open(n.href,void 0,n.rel);e.stopImmediatePropagation(),n.click()}};let s;const c=e=>{let t=l(e);s!==t&&(s&&s.classList.remove(r),t&&t.classList.add(r),s=t)},l=({target:e})=>{let t=(e instanceof Element?e.closest(a):null)?.getAttribute(i),n=t&&document.getElementById(t)||void 0,r=n&&e.closest(`a,button,label,input,select,textarea,details,dialog,[role="button"],[popover],[contenteditable]`);return(!r||r===n)&&!n?.disabled?n:void 0};n(`clickdelegatefor`,()=>[t(window,`click auxclick`,o,!0),t(document,`mouseover`,c,e)]);
2
+ //# sourceMappingURL=clickdelegatefor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clickdelegatefor.js","names":[],"sources":["../../../src/clickdelegatefor/clickdelegatefor.ts"],"sourcesContent":["// Adding support for click deletagtion, following\n// https://open-ui.org/components/link-area-delegation-explainer/\n// and https://github.com/openui/open-ui/issues/1104#issuecomment-3151387080\nimport { on, onHotReload, QUICK_EVENT } from '../utils/utils';\n\nconst CLASS_HOVER = ':click-delegate-hover';\nconst ATTR_CLICKDELEGATEFOR = 'data-clickdelegatefor';\nconst SELECTOR_CLICKDELEGATEFOR = `[${ATTR_CLICKDELEGATEFOR}]`;\nconst SELECTOR_SKIP =\n 'a,button,label,input,select,textarea,details,dialog,[role=\"button\"],[popover],[contenteditable]';\n\nconst handleClickDelegateFor = (event: MouseEvent) => {\n const isNewTab = event.button === 1 || event.metaKey || event.ctrlKey; // Middle click or cmd/ctrl + click should open in new tab\n const isUserLeftOrMiddleClick = event.isTrusted && event.button < 2; // Only accept left or middle clicks, and ignore the programatic .click() we're about to trigger\n const delegateTarget = isUserLeftOrMiddleClick && getDelegateTarget(event);\n\n if (!delegateTarget || delegateTarget.contains(event.target as Node)) return; // Only proxy event if delegated target isn't part of the original target\n if (isNewTab && delegateTarget instanceof HTMLAnchorElement)\n return window.open(delegateTarget.href, undefined, delegateTarget.rel); // If middle click or cmd/ctrl click on link, open in new tab\n event.stopImmediatePropagation(); // We'll trigger a new click event anyway, so prevent actions on this one\n delegateTarget.click(); // Forward click to the clickable element\n};\n\nlet HOVER: Element | undefined;\nconst handleMouseOver = (event: Event) => {\n const delegateTarget = getDelegateTarget(event);\n if (HOVER === delegateTarget) return; // No change\n if (HOVER) HOVER.classList.remove(CLASS_HOVER);\n if (delegateTarget) delegateTarget.classList.add(CLASS_HOVER);\n HOVER = delegateTarget;\n};\n\nconst getDelegateTarget = ({ target: el }: Event) => {\n const scope =\n el instanceof Element ? el.closest(SELECTOR_CLICKDELEGATEFOR) : null;\n const id = scope?.getAttribute(ATTR_CLICKDELEGATEFOR);\n const target = (id && document.getElementById(id)) || undefined;\n const skip = target && (el as Element).closest(SELECTOR_SKIP); // Ignore if interactive\n\n return (!skip || skip === target) && !(target as HTMLInputElement)?.disabled\n ? target\n : undefined; // Skip disabled inputs\n};\n\nonHotReload('clickdelegatefor', () => [\n on(window, 'click auxclick', handleClickDelegateFor as EventListener, true), // Use capture to ensure we run before other click listeners\n on(document, 'mouseover', handleMouseOver, QUICK_EVENT), // Use passive for better performance\n]);\n"],"mappings":"yEAKA,MAAM,EAAc,wBACd,EAAwB,wBACxB,EAA4B,IAAI,EAAsB,GAItD,EAA0B,GAAsB,CACpD,IAAM,EAAW,EAAM,SAAW,GAAK,EAAM,SAAW,EAAM,QAExD,EAD0B,EAAM,WAAa,EAAM,OAAS,GAChB,EAAkB,EAAM,CAEtE,MAAC,GAAkB,EAAe,SAAS,EAAM,OAAe,EACpE,IAAI,GAAY,aAA0B,kBACxC,OAAO,OAAO,KAAK,EAAe,KAAM,IAAA,GAAW,EAAe,IAAI,CACxE,EAAM,0BAA0B,CAChC,EAAe,OAAO,GAGxB,IAAI,EACJ,MAAM,EAAmB,GAAiB,CACxC,IAAM,EAAiB,EAAkB,EAAM,CAC3C,IAAU,IACV,GAAO,EAAM,UAAU,OAAO,EAAY,CAC1C,GAAgB,EAAe,UAAU,IAAI,EAAY,CAC7D,EAAQ,IAGJ,GAAqB,CAAE,OAAQ,KAAgB,CAGnD,IAAM,GADJ,aAAc,QAAU,EAAG,QAAQ,EAA0B,CAAG,OAChD,aAAa,EAAsB,CAC/C,EAAU,GAAM,SAAS,eAAe,EAAG,EAAK,IAAA,GAChD,EAAO,GAAW,EAAe,QAAQ,kGAAc,CAE7D,OAAQ,CAAC,GAAQ,IAAS,IAAW,CAAE,GAA6B,SAChE,EACA,IAAA,IAGN,EAAY,uBAA0B,CACpC,EAAG,OAAQ,iBAAkB,EAAyC,GAAK,CAC3E,EAAG,SAAU,YAAa,EAAiB,EAAY,CACxD,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{QUICK_EVENT as e,attr as t,on as n,onHotReload as r,onMutation as i}from"../utils/utils.js";let a=!1;const o=({type:e,target:n,clientX:r=0,clientY:i=0})=>{if(e===`pointerdown`){let e=n?.closest?.(`dialog`)?.getBoundingClientRect();a=!!(e&&e.top<=i&&i<=e.bottom&&e.left<=r&&r<=e.right)}else{let e=n instanceof HTMLDialogElement&&!a&&t(n,`closedby`)===`any`;a=!1,e&&requestAnimationFrame(()=>n.open&&n.close())}},s=()=>{for(let e of document.querySelectorAll(`button[command="show-modal"]`))t(e,`aria-haspopup`,`dialog`)},c=({command:e,target:t})=>e===`--show-non-modal`&&t instanceof HTMLDialogElement&&t.show();r(`dialog`,()=>[n(document,`command`,c,e),n(document,`pointerdown pointerup`,o,e),i(document,s,{attributeFilter:[`command`],attributes:!0,childList:!0,subtree:!0})]);
2
+ //# sourceMappingURL=dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.js","names":[],"sources":["../../../src/dialog/dialog.ts"],"sourcesContent":["import { attr, on, onHotReload, onMutation, QUICK_EVENT } from '../utils/utils';\n\n// Polyfill closedby functionaliy in Safari\n// Also in Safari 26.2 where `closedBy` property is supported natively,\n// but no corresponding functionality/behavior is implemented.\nlet DOWN_INSIDE = false; // Prevent close if selecting text inside dialog\nconst handleClosedbyAny = ({\n type,\n target: el,\n clientX: x = 0,\n clientY: y = 0,\n}: Partial<MouseEvent>) => {\n if (type === 'pointerdown') {\n const r = (el as Element)?.closest?.('dialog')?.getBoundingClientRect();\n const isInside =\n r && r.top <= y && y <= r.bottom && r.left <= x && x <= r.right;\n\n DOWN_INSIDE = !!isInside;\n } else {\n const isDialog = el instanceof HTMLDialogElement;\n const isClose = isDialog && !DOWN_INSIDE && attr(el, 'closedby') === 'any';\n\n DOWN_INSIDE = false; // Reset on every pointerup\n if (isClose) requestAnimationFrame(() => el.open && el.close()); // Close if browser did not do it\n }\n};\n\n// Ensure buttons that trigger a modeal dialog has aria-haspopup=\"dialog\" for better screen reader experience\nconst handleAriaAttributes = () => {\n for (const btn of document.querySelectorAll('button[command=\"show-modal\"]'))\n attr(btn, 'aria-haspopup', 'dialog');\n};\n\nconst handleCommand = ({ command, target }: Event & { command?: string }) =>\n command === '--show-non-modal' &&\n target instanceof HTMLDialogElement &&\n target.show();\n\nonHotReload('dialog', () => [\n on(document, 'command', handleCommand, QUICK_EVENT),\n on(document, 'pointerdown pointerup', handleClosedbyAny, QUICK_EVENT),\n onMutation(document, handleAriaAttributes, {\n attributeFilter: ['command'],\n attributes: true,\n childList: true,\n subtree: true,\n }),\n]);\n"],"mappings":"mGAKA,IAAI,EAAc,GAClB,MAAM,GAAqB,CACzB,OACA,OAAQ,EACR,QAAS,EAAI,EACb,QAAS,EAAI,KACY,CACzB,GAAI,IAAS,cAAe,CAC1B,IAAM,EAAK,GAAgB,UAAU,SAAS,EAAE,uBAAuB,CAIvE,EAAc,CAAC,EAFb,GAAK,EAAE,KAAO,GAAK,GAAK,EAAE,QAAU,EAAE,MAAQ,GAAK,GAAK,EAAE,WAGvD,CAEL,IAAM,EADW,aAAc,mBACH,CAAC,GAAe,EAAK,EAAI,WAAW,GAAK,MAErE,EAAc,GACV,GAAS,0BAA4B,EAAG,MAAQ,EAAG,OAAO,CAAC,GAK7D,MAA6B,CACjC,IAAK,IAAM,KAAO,SAAS,iBAAiB,+BAA+B,CACzE,EAAK,EAAK,gBAAiB,SAAS,EAGlC,GAAiB,CAAE,UAAS,YAChC,IAAY,oBACZ,aAAkB,mBAClB,EAAO,MAAM,CAEf,EAAY,aAAgB,CAC1B,EAAG,SAAU,UAAW,EAAe,EAAY,CACnD,EAAG,SAAU,wBAAyB,EAAmB,EAAY,CACrE,EAAW,SAAU,EAAsB,CACzC,gBAAiB,CAAC,UAAU,CAC5B,WAAY,GACZ,UAAW,GACX,QAAS,GACV,CAAC,CACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{DSElement as e,QUICK_EVENT as t,attr as n,customElements as r,off as i,on as a,useId as o}from"../utils/utils.js";var s=class extends e{connectedCallback(){a(this,`animationend`,this,t),requestAnimationFrame(()=>this.handleEvent({target:this}))}handleEvent({target:e}){if(e!==this)return;let t=this.querySelector(`h2,h3,h4,h5,h6`);t&&n(this,`aria-labelledby`,o(t)),n(this,`tabindex`,`-1`),this.focus()}disconnectedCallback(){i(this,`animationend`,this,t)}};r.define(`ds-error-summary`,s);export{s as DSErrorSummaryElement};
2
+ //# sourceMappingURL=error-summary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-summary.js","names":[],"sources":["../../../src/error-summary/error-summary.ts"],"sourcesContent":["import {\n attr,\n customElements,\n DSElement,\n off,\n on,\n QUICK_EVENT,\n useId,\n} from '../utils/utils';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ds-error-summary': DSErrorSummaryElement;\n }\n}\n\nexport class DSErrorSummaryElement extends DSElement {\n connectedCallback() {\n on(this, 'animationend', this, QUICK_EVENT); // Using animationend to detect when element is visible\n requestAnimationFrame(() => this.handleEvent({ target: this })); // Initial setup when children has rendered\n }\n handleEvent({ target }: Partial<Event>) {\n if (target !== this) return; // Ignore if animation event was triggered by child\n const heading = this.querySelector('h2,h3,h4,h5,h6');\n if (heading) attr(this, 'aria-labelledby', useId(heading));\n attr(this, 'tabindex', '-1');\n this.focus();\n }\n disconnectedCallback() {\n off(this, 'animationend', this, QUICK_EVENT);\n }\n}\n\ncustomElements.define('ds-error-summary', DSErrorSummaryElement);\n"],"mappings":"yHAgBA,IAAa,EAAb,cAA2C,CAAU,CACnD,mBAAoB,CAClB,EAAG,KAAM,eAAgB,KAAM,EAAY,CAC3C,0BAA4B,KAAK,YAAY,CAAE,OAAQ,KAAM,CAAC,CAAC,CAEjE,YAAY,CAAE,UAA0B,CACtC,GAAI,IAAW,KAAM,OACrB,IAAM,EAAU,KAAK,cAAc,iBAAiB,CAChD,GAAS,EAAK,KAAM,kBAAmB,EAAM,EAAQ,CAAC,CAC1D,EAAK,KAAM,WAAY,KAAK,CAC5B,KAAK,OAAO,CAEd,sBAAuB,CACrB,EAAI,KAAM,eAAgB,KAAM,EAAY,GAIhD,EAAe,OAAO,mBAAoB,EAAsB"}
@@ -0,0 +1,2 @@
1
+ import{DSElement as e,QUICK_EVENT as t,attr as n,attrOrCSS as r,customElements as i,debounce as a,isBrowser as o,isWindows as s,on as c,onHotReload as l,onMutation as u,setTextWithoutMutation as d,tag as f,useId as p,warn as m}from"../utils/utils.js";const h=`data-indeterminate`,g=new Set,_=new WeakMap,v=o()?document.getElementsByTagName(`fieldset`):[],y=o()&&CSS.supports(`field-sizing`,`content`),b=s()?800:200,x=new WeakSet,S=a(()=>{for(let e of v)n(e,`aria-labelledby`,`${p(e.querySelector(`legend`))} ${p(e.querySelector(`:scope > :is([data-field="description"],legend + p)`))}`.trim()||null);for(let e of g){let t=[],r=[],i,a,o=!1,s=!1;for(let n of e.getElementsByTagName(`*`))if(n instanceof HTMLLabelElement&&r.push(n),!n.hidden)if(D(n))i?m(`Fields should only have one input element. Use <fieldset> to group multiple fields:`,e):i=n;else{let e=n.getAttribute(`data-field`);e===`counter`&&(a=n),e===`validation`?(t.unshift(n),o=!0,s||=E(n)):e&&t.push(n)}if(!i)m(`Field is missing input element:`,e);else{a&&_.set(i,a);for(let e of r)n(e,`for`,p(i));let c=i.type===`radio`||i.type===`checkbox`,l=e.closest(`fieldset`)?.querySelector(`:scope > [data-field="validation"]`);l&&!l?.hidden&&(o=!0,s||=E(l),t.unshift(l));let u=n(i,h);u&&(i.indeterminate=u===`true`),n(e,`data-clickdelegatefor`,c?p(i):null),n(i,`aria-describedby`,t.map(p).join(` `)||null),(o||x.has(i))&&(x[o?`add`:`delete`](i),n(i,`aria-invalid`,`${s}`)),w(i)}}},0),C=o()?f(`div`,{"aria-live":`polite`,style:`position:fixed;white-space:nowrap;clip:rect(0 0 0 0)`}):null,w=e=>{let t=e.target||e,i=_.get(t);if(i?.isConnected){let a=(Number(n(i,`data-limit`))||0)-t.value.length,o=a<0?`over`:`under`,s=r(i,`data-${o}`)?.replace(`%d`,`${Math.abs(a)}`);n(i,`data-label`,s),n(i,`data-state`,o),n(i,`data-color`,a<0?`danger`:null),e.type===`input`&&C&&s&&(C?.isConnected||document.body.appendChild(C),T(t,s))}!y&&t instanceof HTMLTextAreaElement&&(t.style.setProperty(`--_ds-field-sizing`,`auto`),t.style.setProperty(`--_ds-field-sizing`,`${t.scrollHeight}px`))},T=a((e,t)=>{let n=document.activeElement===e;C?.isConnected&&n&&d(C,t)},b),E=e=>e.getAttribute(`data-color`)!==`success`,D=e=>e instanceof HTMLElement&&`validity`in e&&!(e instanceof HTMLButtonElement)&&e.type!==`hidden`;var O=class extends e{connectedCallback(){g.add(this),S()}disconnectedCallback(){g.delete(this)}};i.define(`ds-field`,O),l(`field`,()=>[c(document,`input`,w,t),u(document,S,{attributeFilter:[`data-field`,`data-limit`,`hidden`,`value`,h],attributes:!0,childList:!0,subtree:!0})]);export{O as DSFieldElement};
2
+ //# sourceMappingURL=field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field.js","names":[],"sources":["../../../src/field/field.ts"],"sourcesContent":["import {\n attr,\n attrOrCSS,\n customElements,\n DSElement,\n debounce,\n isBrowser,\n isWindows,\n on,\n onHotReload,\n onMutation,\n QUICK_EVENT,\n setTextWithoutMutation,\n tag,\n useId,\n warn,\n} from '../utils/utils';\n\n// TODO: Document that Validation must be hidden with \"hidden\" attribute (or completely removed from DOM), not display: none\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ds-field': DSFieldElement;\n }\n}\n\nconst INDETERMINATE = 'data-indeterminate';\nconst FIELDS = new Set<DSFieldElement>(); // Set of Field\nconst COUNTS = new WeakMap<HTMLInputElement, Element>(); // Using WeakMap so removed inputs/counts does not cause memory leaks\nconst FIELDSETS = isBrowser() ? document.getElementsByTagName('fieldset') : [];\nconst HAS_FIELD_SIZING = isBrowser() && CSS.supports('field-sizing', 'content');\nconst COUNTER_DEBOUNCE = isWindows() ? 800 : 200; // Longer debounce on Windows due to NVDA performance\nconst HAS_VALIDATION = new WeakSet<HTMLInputElement>(); // Used to store inputs that have/had validation elements to manage aria-invalid\n\nconst handleMutations = debounce(() => {\n for (const el of FIELDSETS) {\n const labelledby = `${useId(el.querySelector('legend'))} ${useId(el.querySelector(':scope > :is([data-field=\"description\"],legend + p)'))}`;\n attr(el, 'aria-labelledby', labelledby.trim() || null);\n }\n for (const field of FIELDS) {\n const descs: Element[] = [];\n const labels: HTMLLabelElement[] = [];\n let input: HTMLInputElement | undefined;\n let counter: Element | undefined;\n let hasValidation = false;\n let invalid = false;\n\n for (const el of field.getElementsByTagName('*')) {\n if (el instanceof HTMLLabelElement) labels.push(el);\n if ((el as HTMLElement).hidden) continue; // Skip hidden elements except labels\n if (isInputLike(el)) {\n if (input)\n warn(\n `Fields should only have one input element. Use <fieldset> to group multiple fields:`,\n field,\n );\n else input = el; // Only register if visible input\n } else {\n const type = el.getAttribute('data-field'); // Using getAttribute instead of attr for best performance\n if (type === 'counter') counter = el;\n if (type === 'validation') {\n descs.unshift(el);\n hasValidation = true;\n invalid = invalid || isInvalid(el);\n } else if (type) descs.push(el); // Adds both counter and descriptions\n }\n }\n\n if (!input) warn(`Field is missing input element:`, field);\n else {\n if (counter) COUNTS.set(input, counter);\n for (const label of labels) attr(label, 'for', useId(input));\n\n const isBoolish = input.type === 'radio' || input.type === 'checkbox';\n const fieldsetValidation = field\n .closest('fieldset')\n ?.querySelector<HTMLElement>(':scope > [data-field=\"validation\"]');\n if (fieldsetValidation && !fieldsetValidation?.hidden) {\n hasValidation = true;\n invalid = invalid || isInvalid(fieldsetValidation);\n descs.unshift(fieldsetValidation);\n }\n\n const indeterminate = attr(input, INDETERMINATE);\n if (indeterminate) input.indeterminate = indeterminate === 'true';\n\n attr(field, 'data-clickdelegatefor', isBoolish ? useId(input) : null); // Expand click area to ds-field if radio/checkbox\n attr(input, 'aria-describedby', descs.map(useId).join(' ') || null);\n if (hasValidation || HAS_VALIDATION.has(input)) {\n HAS_VALIDATION[hasValidation ? 'add' : 'delete'](input); // Track if field has validation elements to avoid managing aria-invalid on every mutation\n attr(input, 'aria-invalid', `${invalid}`); // Only manage aria-invalid when field has validation elements\n }\n updateField(input); // Update counter and textarea sizing\n }\n }\n}, 0); // Debounce to merge multiple mutations\n\nconst SR_ONLY = 'position:fixed;white-space:nowrap;clip:rect(0 0 0 0)';\nconst SR_LIVE = isBrowser()\n ? tag('div', { 'aria-live': 'polite', style: SR_ONLY })\n : null;\n\nconst updateField = (e: Event | Element) => {\n const input = ((e as Event).target || e) as HTMLInputElement;\n const counter = COUNTS.get(input);\n\n if (counter?.isConnected) {\n const limit = Number(attr(counter, 'data-limit')) || 0;\n const count = limit - input.value.length;\n const state = count < 0 ? 'over' : 'under';\n const label = attrOrCSS(counter, `data-${state}`)?.replace(\n '%d',\n `${Math.abs(count)}`,\n );\n\n attr(counter, 'data-label', label); // Using attribute to prevent hydation errors, not using aria-label to make axe tests happy\n attr(counter, 'data-state', state);\n attr(counter, 'data-color', count < 0 ? 'danger' : null);\n\n // Only update live region when user is actually typing\n if ((e as Event).type === 'input' && SR_LIVE && label) {\n if (!SR_LIVE?.isConnected) document.body.appendChild(SR_LIVE); // Prepare live region\n debouncedCounterLiveRegion(input, label); // Debounce live region to avoid NVDA interupting announcing typed text\n }\n }\n if (!HAS_FIELD_SIZING && input instanceof HTMLTextAreaElement) {\n input.style.setProperty('--_ds-field-sizing', 'auto');\n input.style.setProperty('--_ds-field-sizing', `${input.scrollHeight}px`);\n }\n};\n\nconst debouncedCounterLiveRegion = debounce((input: Element, text: string) => {\n const hasFocus = document.activeElement === input; // Only announce if input is still focused\n if (SR_LIVE?.isConnected && hasFocus) setTextWithoutMutation(SR_LIVE, text);\n}, COUNTER_DEBOUNCE);\n\nconst isInvalid = (el: Element) => el.getAttribute('data-color') !== 'success';\nconst isInputLike = (el: unknown): el is HTMLInputElement =>\n el instanceof HTMLElement &&\n 'validity' in el && // Adds support for custom elements implemeted with attachInternals()\n !(el instanceof HTMLButtonElement) && // But skip <button> elements\n (el as HTMLInputElement).type !== 'hidden'; // And skip input type=\"hidden\"\n\n// Custom element is used to performantly keep track of fields on the page\nexport class DSFieldElement extends DSElement {\n connectedCallback() {\n FIELDS.add(this); // Register field\n handleMutations(); // Initial setup\n }\n disconnectedCallback() {\n FIELDS.delete(this);\n }\n}\n\ncustomElements.define('ds-field', DSFieldElement);\n\n// Listen for hidden to detect hidden validations, and listen for value to detect controlled React inputs\nonHotReload('field', () => [\n on(document, 'input', updateField, QUICK_EVENT),\n onMutation(document, handleMutations, {\n attributeFilter: [\n 'data-field',\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CAEd,EAAa,GAAgB,EAAG,aAAa,aAAa,GAAK,UAC/D,EAAe,GACnB,aAAc,aACd,aAAc,GACd,EAAE,aAAc,oBACf,EAAwB,OAAS,SAGpC,IAAa,EAAb,cAAoC,CAAU,CAC5C,mBAAoB,CAClB,EAAO,IAAI,KAAK,CAChB,GAAiB,CAEnB,sBAAuB,CACrB,EAAO,OAAO,KAAK,GAIvB,EAAe,OAAO,WAAY,EAAe,CAGjD,EAAY,YAAe,CACzB,EAAG,SAAU,QAAS,EAAa,EAAY,CAC/C,EAAW,SAAU,EAAiB,CACpC,gBAAiB,CACf,aACA,aACA,SACA,QACA,EACD,CACD,WAAY,GACZ,UAAW,GACX,QAAS,GACV,CAAC,CACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{isBrowser as e}from"./utils/utils.js";import"./clickdelegatefor/clickdelegatefor.js";import"./dialog/dialog.js";import"./popover/popover.js";import"./readonly/readonly.js";import"./toggle-group/toggle-group.js";import{setTooltipElement as t}from"./tooltip/tooltip.js";import{DSBreadcrumbsElement as n}from"./breadcrumbs/breadcrumbs.js";import{DSErrorSummaryElement as r}from"./error-summary/error-summary.js";import{DSFieldElement as i}from"./field/field.js";import{DSPaginationElement as a,pagination as o}from"./pagination/pagination.js";import{DSSuggestionElement as s}from"./suggestion/suggestion.js";import{DSTabElement as c,DSTabListElement as l,DSTabPanelElement as u,DSTabsElement as d}from"./tabs/tabs.js";import{apply as f,isSupported as p}from"invokers-polyfill/fn";import"@u-elements/u-details/polyfill";export*from"@u-elements/u-datalist";e()&&!p()&&f();export{n as DSBreadcrumbsElement,r as DSErrorSummaryElement,i as DSFieldElement,a as DSPaginationElement,s as DSSuggestionElement,c as DSTabElement,l as DSTabListElement,u as DSTabPanelElement,d as DSTabsElement,o as pagination,t as setTooltipElement};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import { isSupported, apply as polyfillInvokers } from 'invokers-polyfill/fn';\nimport { isBrowser } from './utils/utils';\nimport '@u-elements/u-details/polyfill'; // Polyfill for <details> element for Android Firefox + Talkback\nimport './clickdelegatefor/clickdelegatefor';\nimport './dialog/dialog';\nimport './popover/popover';\nimport './readonly/readonly';\nimport './toggle-group/toggle-group';\nimport './tooltip/tooltip';\n\nexport * from '@u-elements/u-datalist'; // Re-export u-datalist since this is a pure polyfill and not custom Designsystemet elements\nexport * from './breadcrumbs/breadcrumbs';\nexport * from './error-summary/error-summary';\nexport * from './field/field';\nexport * from './pagination/pagination';\nexport * from './suggestion/suggestion';\nexport * from './tabs/tabs';\nexport * from './tooltip/tooltip';\n\nif (isBrowser() && !isSupported()) polyfillInvokers(); // Ensure invoker commands polyfill is loaded in browser environment only\n"],"mappings":"21BAmBI,GAAW,EAAI,CAAC,GAAa,EAAE,GAAkB"}
@@ -0,0 +1,2 @@
1
+ import{DSElement as e,attr as t,attrOrCSS as n,customElements as r,debounce as i,onMutation as a,warn as o}from"../utils/utils.js";const s=`aria-label`,c=`data-current`,l=`data-total`,u=`data-href`,d=({current:e=1,total:t=10,show:n=7})=>({prev:e>1?e-1:0,next:e<t?e+1:0,pages:m(e,t,n).map((t,n)=>({current:t===e&&`page`,key:`key-${t}-${n}`,page:t}))});var f=class extends e{_unmutate;_render;static get observedAttributes(){return[s,c,l,u]}connectedCallback(){let e=t(this,l),r=t(this,c);r&&!e&&o(`Missing ${l} attribute on:`,this),e&&!r&&o(`Missing ${c} attribute on:`,this),t(this,s,n(this,s)),t(this,`role`,`navigation`),this._render=i(()=>p(this),0),this._unmutate=a(this,this._render,{childList:!0,subtree:!0})}attributeChangedCallback(){this._render?.()}disconnectedCallback(){this._unmutate?.(),this._unmutate=this._render=void 0}};const p=e=>{let n=Number(t(e,c)),r=Number(t(e,l));if(n&&r){let i=e.querySelectorAll(`button,a`),a=i.length-2,o=t(e,u),{next:s,prev:c,pages:l}=d({current:n,total:r,show:a});i.forEach((e,n)=>{let r=n?i[n+1]?l[n-1]?.page:s:c;t(e,`aria-current`,l[n-1]?.current?`true`:null),t(e,`aria-label`,`${r??`hidden`}`),t(e,`role`,r?null:`none`),t(e,`tabindex`,r?null:`-1`),e instanceof HTMLButtonElement&&t(e,`value`,`${r}`),o&&e instanceof HTMLAnchorElement&&t(e,`href`,o.replace(`%d`,`${r}`))})}},m=(e,t,n=1/0)=>{let r=(n-1)/2,i=Math.max(Math.min(e-Math.floor(r),t-n+1),1),a=Math.min(Math.max(e+Math.ceil(r),n),t),o=Array.from({length:a+1-i},(e,t)=>t+i);return n>4&&i>1&&o.splice(0,2,1,0),n>3&&a<t&&o.splice(-2,2,0,t),o};r.define(`ds-pagination`,f);export{f as DSPaginationElement,d as pagination};
2
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.js","names":[],"sources":["../../../src/pagination/pagination.ts"],"sourcesContent":["import {\n attr,\n attrOrCSS,\n customElements,\n DSElement,\n debounce,\n onMutation,\n warn,\n} from '../utils/utils';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ds-pagination': DSPaginationElement;\n }\n}\n\nconst ATTR_LABEL = 'aria-label';\nconst ATTR_CURRENT = 'data-current';\nconst ATTR_TOTAL = 'data-total';\nconst ATTR_HREF = 'data-href';\n\n// Expose pagination logic if wanting to do custom rendering (i.e. in React/Vue/etc)\nexport const pagination = ({ current = 1, total = 10, show = 7 }) => ({\n prev: current > 1 ? current - 1 : 0,\n next: current < total ? current + 1 : 0,\n pages: getSteps(current, total, show).map((page, index) => ({\n current: page === current && ('page' as const),\n key: `key-${page}-${index}`,\n page,\n })),\n});\n\nexport class DSPaginationElement extends DSElement {\n _unmutate?: () => void; // Using underscore instead of private fields for backwards compatibility\n _render?: () => void;\n\n static get observedAttributes() {\n return [ATTR_LABEL, ATTR_CURRENT, ATTR_TOTAL, ATTR_HREF]; // Using ES2015 syntax for backwards compatibility\n }\n connectedCallback() {\n // Check for required attributes\n const total = attr(this, ATTR_TOTAL);\n const current = attr(this, ATTR_CURRENT);\n if (current && !total) warn(`Missing ${ATTR_TOTAL} attribute on:`, this);\n if (total && !current) warn(`Missing ${ATTR_CURRENT} attribute on:`, this);\n\n attr(this, ATTR_LABEL, attrOrCSS(this, ATTR_LABEL));\n attr(this, 'role', 'navigation');\n this._render = debounce(() => render(this), 0); // Debounce groups mutation observer calls and attributeChangedCallback calls\n this._unmutate = onMutation(this, this._render, {\n childList: true,\n subtree: true,\n });\n }\n attributeChangedCallback() {\n this._render?.();\n }\n disconnectedCallback() {\n this._unmutate?.();\n this._unmutate = this._render = undefined;\n }\n}\n\nconst render = (self: DSPaginationElement) => {\n const current = Number(attr(self, ATTR_CURRENT));\n const total = Number(attr(self, ATTR_TOTAL));\n\n // Allowing server side generated pagination, buy only doing client side updates if total/current attributes are provided\n if (current && total) {\n const items = self.querySelectorAll('button,a');\n const show = items.length - 2;\n const href = attr(self, ATTR_HREF);\n const { next, prev, pages } = pagination({ current, total, show });\n items.forEach((item, i) => {\n const page = i ? (items[i + 1] ? pages[i - 1]?.page : next) : prev; // First is prev, last is next\n attr(item, 'aria-current', pages[i - 1]?.current ? 'true' : null);\n attr(item, 'aria-label', `${page ?? 'hidden'}`); // Used for CSS content and to hide if more items than pages, using aria-label to make Axe tests and VoiceOver rotor happy\n attr(item, 'role', page ? null : 'none'); // Prevent validation errors for aria-hidden buttons\n attr(item, 'tabindex', page ? null : '-1');\n if (item instanceof HTMLButtonElement) attr(item, 'value', `${page}`);\n if (href && item instanceof HTMLAnchorElement)\n attr(item, 'href', href.replace('%d', `${page}`));\n });\n }\n};\n\nconst getSteps = (\n now: number,\n max: number,\n show = Number.POSITIVE_INFINITY,\n) => {\n const offset = (show - 1) / 2;\n const start = Math.max(Math.min(now - Math.floor(offset), max - show + 1), 1);\n const end = Math.min(Math.max(now + Math.ceil(offset), show), max);\n const pages = Array.from({ length: end + 1 - start }, (_, i) => i + start);\n\n if (show > 4 && start > 1) pages.splice(0, 2, 1, 0);\n if (show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tB,EAAO,EAAK,EAAM,EAAU,CAC5B,CAAE,OAAM,OAAM,SAAU,EAAW,CAAE,UAAS,QAAO,OAAM,CAAC,CAClE,EAAM,SAAS,EAAM,IAAM,CACzB,IAAM,EAAO,EAAK,EAAM,EAAI,GAAK,EAAM,EAAI,IAAI,KAAO,EAAQ,EAC9D,EAAK,EAAM,eAAgB,EAAM,EAAI,IAAI,QAAU,OAAS,KAAK,CACjE,EAAK,EAAM,aAAc,GAAG,GAAQ,WAAW,CAC/C,EAAK,EAAM,OAAQ,EAAO,KAAO,OAAO,CACxC,EAAK,EAAM,WAAY,EAAO,KAAO,KAAK,CACtC,aAAgB,mBAAmB,EAAK,EAAM,QAAS,GAAG,IAAO,CACjE,GAAQ,aAAgB,mBAC1B,EAAK,EAAM,OAAQ,EAAK,QAAQ,KAAM,GAAG,IAAO,CAAC,EACnD,GAIA,GACJ,EACA,EACA,EAAO,MACJ,CACH,IAAM,GAAU,EAAO,GAAK,EACtB,EAAQ,KAAK,IAAI,KAAK,IAAI,EAAM,KAAK,MAAM,EAAO,CAAE,EAAM,EAAO,EAAE,CAAE,EAAE,CACvE,EAAM,KAAK,IAAI,KAAK,IAAI,EAAM,KAAK,KAAK,EAAO,CAAE,EAAK,CAAE,EAAI,CAC5D,EAAQ,MAAM,KAAK,CAAE,OAAQ,EAAM,EAAI,EAAO,EAAG,EAAG,IAAM,EAAI,EAAM,CAI1E,OAFI,EAAO,GAAK,EAAQ,GAAG,EAAM,OAAO,EAAG,EAAG,EAAG,EAAE,CAC/C,EAAO,GAAK,EAAM,GAAK,EAAM,OAAO,GAAI,EAAG,EAAG,EAAI,CAC/C,GAGT,EAAe,OAAO,gBAAiB,EAAoB"}
@@ -0,0 +1,2 @@
1
+ import{QUICK_EVENT as e,attr as t,on as n,onHotReload as r}from"../utils/utils.js";import{autoUpdate as i,computePosition as a,flip as o,limitShift as s,offset as c,shift as l,size as u}from"@floating-ui/dom";const d=`data-placement`,f=`data-autoplacement`,p=new Map;function m(e){let{newState:n,oldState:r,target:m,source:h=e.detail}=e,g=m instanceof HTMLElement&&_(m,`--_ds-floating`);if(!g)return;if(n===`closed`)return p.get(m)?.();if(!h){let e=m.getRootNode(),t=`[popovertarget="${m.id}"],[commandfor="${m.id}"]`;h=m.id&&e?.querySelector?.(t)||void 0}if(!h||h===m||r&&r===n)return;let y=_(m,`--_ds-floating-overscroll`),b=t(m,d)||t(h,d)||g,x=t(m,f)||t(h,f),S=parseFloat(getComputedStyle(m,`::before`).height)||0,C=b.match(/left|right/gi)?`Height`:`Width`,w=h[`offset${C}`]/2+S;if(b===`none`)return;let T={strategy:`absolute`,placement:b,middleware:[c(S||0),l({padding:10,limiter:s({offset:{mainAxis:w}})}),v(),...x===`false`?[]:[o({padding:10,crossAxis:!1})],...y?[u({apply({availableHeight:e}){y===`fit`&&(m.style.width=`${h.clientWidth}px`),m.style.maxHeight=`${Math.max(50,e-20)}px`}})]:[]]},E=i(h,m,async()=>{if(!h?.isConnected)return p.get(m)?.();let{x:e,y:t}=await a(h,m,T);m.style.translate=`${e}px ${t}px`});p.set(m,()=>p.delete(m)&&E())}let h;const g=({type:e})=>{if(e===`mousedown`&&(h=!1),e===`scroll`&&h===!1&&(h=!0),e===`mouseup`&&h)for(let[e]of p)e.showPopover()};r(`popover`,()=>[n(document,`mousedown scroll mouseup`,g,!0),n(document,`toggle ds-toggle-source`,m,e)]);const _=(e,t)=>getComputedStyle(e).getPropertyValue(t).trim(),v=()=>({name:`arrowPseudo`,fn(e){let n=e.elements.floating,r=e.rects.reference,i=`${Math.round(r.width/2+r.x-e.x)}px`,a=`${Math.round(r.height/2+r.y-e.y)}px`;return n.style.setProperty(`--_ds-floating-arrow-x`,i),n.style.setProperty(`--_ds-floating-arrow-y`,a),t(n,`data-floating`,e.placement),e}});
2
+ //# sourceMappingURL=popover.js.map