@ds-autonomie/web-components 2.21.1 → 2.21.2

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 (29) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/cdn/chunks/chunk.5KKFNICD.js +121 -0
  3. package/cdn/chunks/{chunk.XXFCN6MW.js → chunk.EBMR5RUP.js} +1 -1
  4. package/cdn/chunks/{chunk.24NXLHSI.js → chunk.U4A36HDQ.js} +1 -1
  5. package/cdn/chunks/{chunk.3Q73BJS5.js → chunk.UUN3KGYB.js} +1 -1
  6. package/cdn/components/filter-counter/filter-counter.js +1 -1
  7. package/cdn/components/filter-date/filter-date.js +1 -1
  8. package/cdn/components/filter-select/filter-select.d.ts +0 -1
  9. package/cdn/components/filter-select/filter-select.js +1 -1
  10. package/cdn/components/tree/tree.js +1 -1
  11. package/cdn/custom-elements.json +261 -267
  12. package/cdn/design-system.js +1 -1
  13. package/cdn/vscode.html-custom-data.json +41 -41
  14. package/cdn/web-types.json +144 -148
  15. package/dist/chunks/{chunk.FTIQ3KCK.js → chunk.H7FCKWK4.js} +12 -24
  16. package/dist/components/filter-counter/filter-counter.js +2 -2
  17. package/dist/components/filter-date/filter-date.js +2 -2
  18. package/dist/components/filter-select/filter-select.d.ts +0 -1
  19. package/dist/components/filter-select/filter-select.js +2 -2
  20. package/dist/components/tree/tree.js +2 -2
  21. package/dist/custom-elements.json +261 -267
  22. package/dist/design-system.js +23 -23
  23. package/dist/vscode.html-custom-data.json +41 -41
  24. package/dist/web-types.json +144 -148
  25. package/package.json +1 -1
  26. package/cdn/chunks/chunk.DLQV224B.js +0 -121
  27. package/dist/chunks/{chunk.YOK7OXBS.js → chunk.4EG67OAK.js} +3 -3
  28. package/dist/chunks/{chunk.RKGIZ4JZ.js → chunk.BJPQ42FM.js} +3 -3
  29. package/dist/chunks/{chunk.Z4TGH2YA.js → chunk.XSZCCDGA.js} +3 -3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json.schemastore.org/web-types",
3
3
  "name": "@ds-autonomie/web-components",
4
- "version": "2.21.1",
4
+ "version": "2.21.2",
5
5
  "description-markup": "markdown",
6
6
  "framework-config": {
7
7
  "enable-when": {
@@ -6466,10 +6466,6 @@
6466
6466
  "type": "ReturnType<typeof setTimeout> | null"
6467
6467
  }
6468
6468
  },
6469
- {
6470
- "name": "optionsByValue",
6471
- "value": {}
6472
- },
6473
6469
  {
6474
6470
  "name": "normalizedLabelsByValue",
6475
6471
  "value": {}
@@ -17067,115 +17063,131 @@
17067
17063
  "attributes": []
17068
17064
  },
17069
17065
  {
17070
- "js": {
17071
- "properties": [],
17072
- "events": []
17073
- },
17074
- "attributes": []
17075
- },
17076
- {
17077
- "js": {
17078
- "properties": [],
17079
- "events": []
17080
- },
17081
- "attributes": []
17082
- },
17083
- {
17084
- "name": "dsa-tag",
17066
+ "name": "dsa-tag-button",
17085
17067
  "description": "",
17086
17068
  "js": {
17087
17069
  "properties": [
17088
17070
  {
17089
- "name": "dependencies",
17071
+ "name": "tagButton",
17090
17072
  "value": {
17091
- "type": "object"
17073
+ "type": "HTMLButtonElement | HTMLLinkElement"
17092
17074
  }
17093
17075
  },
17094
17076
  {
17095
- "name": "localize",
17096
- "value": {}
17097
- },
17098
- {
17099
- "name": "iconButtonSize",
17077
+ "name": "label",
17078
+ "description": "The tag's label",
17100
17079
  "value": {
17101
17080
  "type": "string"
17102
17081
  }
17103
17082
  },
17104
17083
  {
17105
- "name": "content",
17084
+ "name": "variant",
17085
+ "description": "The tag's theme variant.",
17106
17086
  "value": {
17107
- "type": "HTMLElement"
17087
+ "type": "'neutral' | 'active'"
17108
17088
  }
17109
17089
  },
17110
17090
  {
17111
- "name": "removeButton",
17091
+ "name": "size",
17092
+ "description": "The tag's size.",
17112
17093
  "value": {
17113
- "type": "HTMLElement"
17094
+ "type": "'small' | 'medium' | 'large'"
17114
17095
  }
17115
17096
  },
17116
17097
  {
17117
- "name": "variant",
17118
- "description": "The tag's theme variant.",
17098
+ "name": "accessibleName",
17099
+ "description": "Provides an accessible label for the element",
17119
17100
  "value": {
17120
- "type": "| (typeof TAG_VARIANTS)[number]\n | (typeof DEPRECATED_TAG_VARIANTS)[number]"
17101
+ "type": "string"
17121
17102
  }
17122
17103
  },
17123
17104
  {
17124
- "name": "size",
17125
- "description": "The tag's size.",
17105
+ "name": "description",
17106
+ "description": "Provides an accessible description for the element",
17126
17107
  "value": {
17127
- "type": "'small' | 'medium' | 'large'"
17108
+ "type": "string"
17128
17109
  }
17129
17110
  },
17130
17111
  {
17131
- "name": "removable",
17132
- "description": "Makes the tag removable and shows a remove button.",
17112
+ "name": "href",
17113
+ "description": "(Link) Change thetag role to link. Specifies the URL of the page the link goes to.",
17133
17114
  "value": {
17134
- "type": "boolean"
17115
+ "type": "string"
17135
17116
  }
17136
17117
  },
17137
17118
  {
17138
- "name": "label",
17119
+ "name": "rel",
17120
+ "description": "(Link) Determines the relationship between the current document and the linked document",
17139
17121
  "value": {
17140
17122
  "type": "string"
17141
17123
  }
17142
17124
  },
17143
17125
  {
17144
- "name": "accessibleName",
17145
- "description": "(Optional) An accessible name for the tag",
17126
+ "name": "download",
17127
+ "description": "(Link) Specifies that the target will be downloaded when a user clicks on the hyperlink",
17146
17128
  "value": {
17147
- "type": "string"
17129
+ "type": "string | undefined"
17148
17130
  }
17149
17131
  },
17150
17132
  {
17151
- "name": "tooltip",
17152
- "description": "Display the tag label in a tooltip",
17133
+ "name": "target",
17134
+ "description": "(Link) Specifies where to open the linked document.",
17153
17135
  "value": {
17154
- "type": "boolean"
17136
+ "type": "'_blank' | '_parent' | '_self' | '_top'"
17155
17137
  }
17156
17138
  },
17157
17139
  {
17158
- "name": "handleRemoveClick",
17140
+ "name": "isLink",
17159
17141
  "value": {}
17160
17142
  },
17161
17143
  {
17162
- "name": "updateIconButtonSize",
17144
+ "name": "handleBlur",
17145
+ "value": {}
17146
+ },
17147
+ {
17148
+ "name": "handleFocus",
17149
+ "value": {}
17150
+ },
17151
+ {
17152
+ "name": "click",
17153
+ "description": "Simulates a click on the tag button.",
17154
+ "value": {}
17155
+ },
17156
+ {
17157
+ "name": "focus",
17158
+ "description": "Sets focus on the tag button.",
17159
+ "value": {}
17160
+ },
17161
+ {
17162
+ "name": "blur",
17163
+ "description": "Removes focus from the tag button.",
17163
17164
  "value": {}
17164
17165
  }
17165
17166
  ],
17166
17167
  "events": [
17167
17168
  {
17168
- "name": "dsa-remove",
17169
- "description": "Emitted when the remove button is activated."
17169
+ "name": "dsa-blur",
17170
+ "description": "Emitted when the tag loses focus."
17171
+ },
17172
+ {
17173
+ "name": "dsa-focus",
17174
+ "description": "Emitted when the tag gains focus."
17170
17175
  }
17171
17176
  ]
17172
17177
  },
17173
17178
  "attributes": [
17179
+ {
17180
+ "name": "label",
17181
+ "description": "The tag's label",
17182
+ "value": {
17183
+ "type": "string"
17184
+ }
17185
+ },
17174
17186
  {
17175
17187
  "name": "variant",
17176
17188
  "description": "The tag's theme variant.",
17177
17189
  "value": {
17178
- "type": "| (typeof TAG_VARIANTS)[number]\n | (typeof DEPRECATED_TAG_VARIANTS)[number]"
17190
+ "type": "'neutral' | 'active'"
17179
17191
  }
17180
17192
  },
17181
17193
  {
@@ -17186,160 +17198,159 @@
17186
17198
  }
17187
17199
  },
17188
17200
  {
17189
- "name": "removable",
17190
- "description": "Makes the tag removable and shows a remove button.",
17201
+ "name": "accessible-name",
17202
+ "description": "Provides an accessible label for the element",
17191
17203
  "value": {
17192
- "type": "boolean"
17204
+ "type": "string"
17193
17205
  }
17194
17206
  },
17195
17207
  {
17196
- "name": "label",
17208
+ "name": "description",
17209
+ "description": "Provides an accessible description for the element",
17197
17210
  "value": {
17198
17211
  "type": "string"
17199
17212
  }
17200
17213
  },
17201
17214
  {
17202
- "name": "accessible-name",
17203
- "description": "(Optional) An accessible name for the tag",
17215
+ "name": "href",
17216
+ "description": "(Link) Change thetag role to link. Specifies the URL of the page the link goes to.",
17204
17217
  "value": {
17205
17218
  "type": "string"
17206
17219
  }
17207
17220
  },
17208
17221
  {
17209
- "name": "tooltip",
17210
- "description": "Display the tag label in a tooltip",
17222
+ "name": "rel",
17223
+ "description": "(Link) Determines the relationship between the current document and the linked document",
17211
17224
  "value": {
17212
- "type": "boolean"
17225
+ "type": "string"
17226
+ }
17227
+ },
17228
+ {
17229
+ "name": "download",
17230
+ "description": "(Link) Specifies that the target will be downloaded when a user clicks on the hyperlink",
17231
+ "value": {
17232
+ "type": "string | undefined"
17233
+ }
17234
+ },
17235
+ {
17236
+ "name": "target",
17237
+ "description": "(Link) Specifies where to open the linked document.",
17238
+ "value": {
17239
+ "type": "'_blank' | '_parent' | '_self' | '_top'"
17213
17240
  }
17214
17241
  }
17215
17242
  ]
17216
17243
  },
17217
17244
  {
17218
- "name": "dsa-tag-button",
17245
+ "js": {
17246
+ "properties": [],
17247
+ "events": []
17248
+ },
17249
+ "attributes": []
17250
+ },
17251
+ {
17252
+ "js": {
17253
+ "properties": [],
17254
+ "events": []
17255
+ },
17256
+ "attributes": []
17257
+ },
17258
+ {
17259
+ "name": "dsa-tag",
17219
17260
  "description": "",
17220
17261
  "js": {
17221
17262
  "properties": [
17222
17263
  {
17223
- "name": "tagButton",
17264
+ "name": "dependencies",
17224
17265
  "value": {
17225
- "type": "HTMLButtonElement | HTMLLinkElement"
17266
+ "type": "object"
17226
17267
  }
17227
17268
  },
17228
17269
  {
17229
- "name": "label",
17230
- "description": "The tag's label",
17270
+ "name": "localize",
17271
+ "value": {}
17272
+ },
17273
+ {
17274
+ "name": "iconButtonSize",
17231
17275
  "value": {
17232
17276
  "type": "string"
17233
17277
  }
17234
17278
  },
17235
17279
  {
17236
- "name": "variant",
17237
- "description": "The tag's theme variant.",
17280
+ "name": "content",
17238
17281
  "value": {
17239
- "type": "'neutral' | 'active'"
17282
+ "type": "HTMLElement"
17240
17283
  }
17241
17284
  },
17242
17285
  {
17243
- "name": "size",
17244
- "description": "The tag's size.",
17286
+ "name": "removeButton",
17245
17287
  "value": {
17246
- "type": "'small' | 'medium' | 'large'"
17288
+ "type": "HTMLElement"
17247
17289
  }
17248
17290
  },
17249
17291
  {
17250
- "name": "accessibleName",
17251
- "description": "Provides an accessible label for the element",
17292
+ "name": "variant",
17293
+ "description": "The tag's theme variant.",
17252
17294
  "value": {
17253
- "type": "string"
17295
+ "type": "| (typeof TAG_VARIANTS)[number]\n | (typeof DEPRECATED_TAG_VARIANTS)[number]"
17254
17296
  }
17255
17297
  },
17256
17298
  {
17257
- "name": "description",
17258
- "description": "Provides an accessible description for the element",
17299
+ "name": "size",
17300
+ "description": "The tag's size.",
17259
17301
  "value": {
17260
- "type": "string"
17302
+ "type": "'small' | 'medium' | 'large'"
17261
17303
  }
17262
17304
  },
17263
17305
  {
17264
- "name": "href",
17265
- "description": "(Link) Change thetag role to link. Specifies the URL of the page the link goes to.",
17306
+ "name": "removable",
17307
+ "description": "Makes the tag removable and shows a remove button.",
17266
17308
  "value": {
17267
- "type": "string"
17309
+ "type": "boolean"
17268
17310
  }
17269
17311
  },
17270
17312
  {
17271
- "name": "rel",
17272
- "description": "(Link) Determines the relationship between the current document and the linked document",
17313
+ "name": "label",
17273
17314
  "value": {
17274
17315
  "type": "string"
17275
17316
  }
17276
17317
  },
17277
17318
  {
17278
- "name": "download",
17279
- "description": "(Link) Specifies that the target will be downloaded when a user clicks on the hyperlink",
17319
+ "name": "accessibleName",
17320
+ "description": "(Optional) An accessible name for the tag",
17280
17321
  "value": {
17281
- "type": "string | undefined"
17322
+ "type": "string"
17282
17323
  }
17283
17324
  },
17284
17325
  {
17285
- "name": "target",
17286
- "description": "(Link) Specifies where to open the linked document.",
17326
+ "name": "tooltip",
17327
+ "description": "Display the tag label in a tooltip",
17287
17328
  "value": {
17288
- "type": "'_blank' | '_parent' | '_self' | '_top'"
17329
+ "type": "boolean"
17289
17330
  }
17290
17331
  },
17291
17332
  {
17292
- "name": "isLink",
17293
- "value": {}
17294
- },
17295
- {
17296
- "name": "handleBlur",
17297
- "value": {}
17298
- },
17299
- {
17300
- "name": "handleFocus",
17301
- "value": {}
17302
- },
17303
- {
17304
- "name": "click",
17305
- "description": "Simulates a click on the tag button.",
17306
- "value": {}
17307
- },
17308
- {
17309
- "name": "focus",
17310
- "description": "Sets focus on the tag button.",
17333
+ "name": "handleRemoveClick",
17311
17334
  "value": {}
17312
17335
  },
17313
17336
  {
17314
- "name": "blur",
17315
- "description": "Removes focus from the tag button.",
17337
+ "name": "updateIconButtonSize",
17316
17338
  "value": {}
17317
17339
  }
17318
17340
  ],
17319
17341
  "events": [
17320
17342
  {
17321
- "name": "dsa-blur",
17322
- "description": "Emitted when the tag loses focus."
17323
- },
17324
- {
17325
- "name": "dsa-focus",
17326
- "description": "Emitted when the tag gains focus."
17343
+ "name": "dsa-remove",
17344
+ "description": "Emitted when the remove button is activated."
17327
17345
  }
17328
17346
  ]
17329
17347
  },
17330
17348
  "attributes": [
17331
- {
17332
- "name": "label",
17333
- "description": "The tag's label",
17334
- "value": {
17335
- "type": "string"
17336
- }
17337
- },
17338
17349
  {
17339
17350
  "name": "variant",
17340
17351
  "description": "The tag's theme variant.",
17341
17352
  "value": {
17342
- "type": "'neutral' | 'active'"
17353
+ "type": "| (typeof TAG_VARIANTS)[number]\n | (typeof DEPRECATED_TAG_VARIANTS)[number]"
17343
17354
  }
17344
17355
  },
17345
17356
  {
@@ -17350,45 +17361,30 @@
17350
17361
  }
17351
17362
  },
17352
17363
  {
17353
- "name": "accessible-name",
17354
- "description": "Provides an accessible label for the element",
17355
- "value": {
17356
- "type": "string"
17357
- }
17358
- },
17359
- {
17360
- "name": "description",
17361
- "description": "Provides an accessible description for the element",
17364
+ "name": "removable",
17365
+ "description": "Makes the tag removable and shows a remove button.",
17362
17366
  "value": {
17363
- "type": "string"
17367
+ "type": "boolean"
17364
17368
  }
17365
17369
  },
17366
17370
  {
17367
- "name": "href",
17368
- "description": "(Link) Change thetag role to link. Specifies the URL of the page the link goes to.",
17371
+ "name": "label",
17369
17372
  "value": {
17370
17373
  "type": "string"
17371
17374
  }
17372
17375
  },
17373
17376
  {
17374
- "name": "rel",
17375
- "description": "(Link) Determines the relationship between the current document and the linked document",
17377
+ "name": "accessible-name",
17378
+ "description": "(Optional) An accessible name for the tag",
17376
17379
  "value": {
17377
17380
  "type": "string"
17378
17381
  }
17379
17382
  },
17380
17383
  {
17381
- "name": "download",
17382
- "description": "(Link) Specifies that the target will be downloaded when a user clicks on the hyperlink",
17383
- "value": {
17384
- "type": "string | undefined"
17385
- }
17386
- },
17387
- {
17388
- "name": "target",
17389
- "description": "(Link) Specifies where to open the linked document.",
17384
+ "name": "tooltip",
17385
+ "description": "Display the tag label in a tooltip",
17390
17386
  "value": {
17391
- "type": "'_blank' | '_parent' | '_self' | '_top'"
17387
+ "type": "boolean"
17392
17388
  }
17393
17389
  }
17394
17390
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ds-autonomie/web-components",
3
- "version": "2.21.1",
3
+ "version": "2.21.2",
4
4
  "homepage": "https://dsa.service-public-autonomie.fr",
5
5
  "bugs": "https://lindie.app/share/c220b6cb46f514a79413a6438af2a82e263a0c10",
6
6
  "author": "CNSA",
@@ -1,121 +0,0 @@
1
- import{a as f}from"./chunk.TMUGGTVF.js";import{a as L}from"./chunk.RVJ7GEHV.js";import{a as O}from"./chunk.YQETGEXV.js";import{a as V}from"./chunk.2OZWUNZO.js";import{c as w}from"./chunk.3RLUYXJN.js";import{a as _}from"./chunk.PIG773U2.js";import{a as C}from"./chunk.W6E7LGND.js";import{c as $}from"./chunk.AM2ZR2Y2.js";import{a as m}from"./chunk.QTD6NQFL.js";import{a as v}from"./chunk.2RF4WD6T.js";import{a as c}from"./chunk.BWEPOOQP.js";import{a as y,b as h,c as r,d as u}from"./chunk.KBZ32KWP.js";import{a as o}from"./chunk.GP725TPQ.js";import{a as g,b,f as a}from"./chunk.IZ2HVRME.js";var p="dsa-option",i=class extends O{constructor(){super(...arguments);this.displayLabel="";this.allOptions=[];this.selectedOptions=[];this.displayedOptions=[];this.searchValue="";this.nbOptions=0;this.seeAll=!1;this.debounceTimerId=null;this.optionsByValue=new Map;this.normalizedLabelsByValue=new Map;this.value="";this.multiple=!1;this.maxVisibleListLength=5;this.searchable=!1;this.debounceTimeout=300;this.optionGender="masculine";this.columnsFilter=!1}connectedCallback(){super.connectedCallback(),this.allOptions=this.getAllOptions(),this.nbOptions=this.allOptions.length,this.filterOptions()}disconnectedCallback(){super.disconnectedCallback(),this.debounceTimerId!==null&&(clearTimeout(this.debounceTimerId),this.debounceTimerId=null)}handleKeyDown(e){super.handleKeyDown(e);let l=e.composedPath(),t=l.some(n=>n instanceof V),s=l.some(n=>n instanceof f);if((e.key==="Enter"||e.key===" ")&&t&&this.currentOption&&!this.currentOption.disabled&&(e.preventDefault(),this.multiple||this.value.includes(this.currentOption.value)?this.toggleOptionSelection(this.currentOption):this.setSelectedOptions(this.currentOption),this.updateComplete.then(()=>{this.emit("dsa-change")}),!this.multiple&&!this.drawer&&(this.hide(),this.filterTrigger.focus({preventScroll:!0}))),!this.multiple&&t&&["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let n=this.displayedOptions.indexOf(this.currentOption),d=Math.max(0,n);!(n===0&&e.key==="ArrowUp")&&!(n===this.displayedOptions.length-1&&e.key==="ArrowDown")&&e.preventDefault(),e.key==="ArrowDown"&&n<this.displayedOptions.length-1?d=n+1:e.key==="ArrowUp"&&n>0?d=n-1:e.key==="Home"?d=0:e.key==="End"&&(d=this.displayedOptions.length-1),this.setCurrentOption(this.displayedOptions[d])}s&&e.stopPropagation()}handleSearchInput(e){e.stopPropagation(),this.searchValue=this.searchInput.value,this.debounceTimerId!==null&&clearTimeout(this.debounceTimerId),this.debounceTimerId=setTimeout(()=>{this.emit("dsa-input")},this.debounceTimeout)}handleOptionFocus(e){let t=e.target.closest(p);t&&this.setCurrentOption(t)}handleOptionClick(e){let t=e.target.closest(p),s=this.value;t&&!t.disabled&&(this.multiple||this.value.includes(t.value)?this.toggleOptionSelection(t):this.setSelectedOptions(t),this.value!==s&&this.updateComplete.then(()=>{this.emit("dsa-change")}),!this.multiple&&!this.drawer&&(this.updateComplete.then(()=>this.filterTrigger.focus({preventScroll:!0})),this.hide()))}filterOptions(){if(this.searchValue.length>0){let e=m(this.searchValue);this.displayedOptions=this.allOptions.filter(l=>{var s;return((s=this.normalizedLabelsByValue.get(l.value))!=null?s:m(l.innerText)).includes(e)})}else!this.seeAll&&this.maxVisibleListLength>0?this.displayedOptions=this.allOptions.slice(0,this.maxVisibleListLength):this.displayedOptions=this.allOptions;this.displayedOptions.forEach(e=>e.tabIndex=0)}handleMultipleHeaderButtonClick(){this.selectedOptions.length>0?this.allOptions.forEach(e=>e.selected=!1):this.allOptions.forEach(e=>e.selected=!0),this.selectionChanged(),this.updateComplete.then(()=>{this.emit("dsa-change")})}handleSearchClear(){this.searchValue=""}handleSeeAllClick(){this.seeAll=!0,this.filterOptions()}handleDefaultSlotChange(){if(customElements.get(p)){this.allOptions=this.getAllOptions(),this.nbOptions=this.allOptions.length;let e=Array.isArray(this.value)?this.value:[this.value];this.setSelectedOptions(this.allOptions.filter(l=>e.includes(l.value))),this.filterOptions()}else customElements.whenDefined(p).then(()=>this.handleDefaultSlotChange())}getAllOptions(){let e=this.querySelectorAll(p),l=[];return this.optionsByValue.clear(),this.normalizedLabelsByValue.clear(),e.forEach(t=>{t.role=this.multiple?"checkbox":"radio";let s=t.cloneNode(!0);s.selected=t.selected,s.multiple=this.multiple,s.role=this.multiple?"checkbox":"radio",s.classList.add("filter-select__option"),s.onfocus=this.handleOptionFocus.bind(this),l.push(s),this.optionsByValue.set(t.value,t),this.normalizedLabelsByValue.set(t.value,m(s.innerText))}),l}getFirstOption(){return this.querySelector(p)}setCurrentOption(e){this.displayedOptions.forEach(l=>{l.current=!1}),e&&(this.currentOption=e,e.current=!0,e.focus())}setSelectedOptions(e){let l=Array.isArray(e)?e:[e];this.allOptions.forEach(t=>t.selected=!1),l.length&&l.forEach(t=>{let s=this.optionsByValue.get(t.value);s&&(t.selected=!0,s.selected=!0)}),this.selectionChanged()}toggleOptionSelection(e,l){let t=this.optionsByValue.get(e.value);t&&(l===!0||l===!1?t.selected=l:t.selected=!e.selected,this.selectionChanged())}selectionChanged(){var l,t;this.selectedOptions=this.allOptions.filter(s=>s.selected),this.filterOptions();let e=new Set(this.selectedOptions.map(s=>s.value));this.displayedOptions.forEach(s=>{s.selected=e.has(s.value)}),this.multiple?this.value=this.selectedOptions.map(s=>s.value):this.value=(t=(l=this.selectedOptions[0])==null?void 0:l.value)!=null?t:"",this.selectedOptions[0]?this.selectedOptions[0].updateComplete.then(()=>{var s,n;this.displayLabel=(n=(s=this.selectedOptions[0])==null?void 0:s.getTextLabel())!=null?n:""}):this.displayLabel=""}getDisplayedOptionsList(){return this.multiple?o`<div role="list">
2
- ${this.displayedOptions.map(e=>o`<div role="listitem">${e}</div>`)}
3
- </div>`:this.displayedOptions}handleSearchValueChange(){this.searchValue.length>0&&(this.seeAll=!0),this.filterOptions()}handleValueChange(){let e=Array.isArray(this.value)?this.value:[this.value];this.setSelectedOptions(this.allOptions.filter(l=>e.includes(l.value)))}async handleOpenChange(){this.open&&(this.selectedOptions.length>0&&(this.seeAll=!0),this.filterOptions(),this.setCurrentOption(this.selectedOptions[0]||this.getFirstOption())),await super.handleOpenChange(),this.open&&(requestAnimationFrame(()=>{this.setCurrentOption(this.currentOption)}),this.currentOption&&w(this.currentOption,this.listbox,"vertical","auto"))}handleSeeAllChange(){this.seeAll&&this.displayedOptions[this.maxVisibleListLength]!==void 0&&setTimeout(()=>this.displayedOptions[this.maxVisibleListLength].focus())}handleMultipleChange(){this.handleDefaultSlotChange()}async hide(){await super.hide(),this.searchValue=""}renderTrigger(){if(this.columnsFilter)return o`
4
- <dsa-button
5
- slot="anchor"
6
- class="filter__trigger"
7
- aria-expanded=${this.open?"true":"false"}
8
- aria-controls="filter__panel"
9
- ?disabled=${this.disabled}
10
- @focus=${this.handleFocus}
11
- @blur=${this.handleBlur}
12
- @mousedown=${this.handleFilterTriggerMouseDown}
13
- variant="tertiary"
14
- caret
15
- >
16
- <dsa-icon
17
- name="view_column"
18
- slot="prefix"
19
- library="system"
20
- ></dsa-icon>
21
- ${this.label!==""?this.label:this.localize.term("columns")}
22
- </dsa-button>
23
- `;{let e=this.selectedOptions.length;return o`
24
- <dsa-filter-button
25
- slot="anchor"
26
- class="filter__trigger"
27
- label=${this.label}
28
- selected-option=${e===1?this.displayLabel:""}
29
- selection-count=${e}
30
- aria-expanded=${this.open?"true":"false"}
31
- aria-controls="filter__panel"
32
- ?disabled=${this.disabled}
33
- ?readonly=${this.readonly}
34
- ?drawer=${this.drawer}
35
- @focus=${this.handleFocus}
36
- @blur=${this.handleBlur}
37
- @mousedown=${this.handleFilterTriggerMouseDown}
38
- ></dsa-filter-button>
39
- `}}renderDeSelectAll(){let e=this.selectedOptions.length;return o`
40
- <dsa-button
41
- class="filter__multiselect-header__deselect-all"
42
- variant="tertiary"
43
- size="small"
44
- @click=${this.handleMultipleHeaderButtonClick}
45
- >
46
- ${e===0?o` ${this.localize.term("selectAll")} `:o`
47
- <dsa-icon
48
- name="restart_alt"
49
- slot="prefix"
50
- library="system"
51
- ></dsa-icon>
52
- ${this.localize.term("deselectAll")}
53
- `}
54
- </dsa-button>
55
- `}renderPanelContent(){let e=this.selectedOptions.length;return o`
56
- ${this.multiple&&!this.drawer?o`
57
- <div class="filter__multiselect-header">
58
- <span role="status"
59
- >${this.localize.term("numberSelected",e,this.optionGender)}</span
60
- >
61
- ${this.renderDeSelectAll()}
62
- </div>
63
- `:""}
64
- ${this.searchable?o`
65
- <dsa-input
66
- type="search"
67
- accessible-name=${this.localize.term("search")}
68
- placeholder=${this.localize.term("search")}
69
- variant="layer"
70
- .value=${this.searchValue}
71
- @input=${this.handleSearchInput}
72
- clearable
73
- @dsa-clear=${this.handleSearchClear}
74
- ></dsa-input>
75
- <dsa-visually-hidden>
76
- <span
77
- role="status"
78
- aria-live="polite"
79
- aria-relevant="all"
80
- .live=${this.searchValue}
81
- >${this.searchValue.length>0?`${this.displayedOptions.length} ${this.localize.term("optionsAvailable")}`:""}</span
82
- >
83
- </dsa-visually-hidden>
84
- `:""}
85
-
86
- <div
87
- id="listbox"
88
- role=${this.multiple?"group":"radiogroup"}
89
- aria-multiselectable=${v(this.multiple?"true":void 0)}
90
- aria-label=${this.localize.term("selectValue",this.multiple)}
91
- part="listbox"
92
- class="filter__listbox"
93
- @mouseup=${this.handleOptionClick}
94
- >
95
- ${this.displayedOptions.length>0?this.getDisplayedOptionsList():o`<div class="filter__empty_text">
96
- <p>${this.localize.term("noMatchFound")}</p>
97
- </div>`}
98
- </div>
99
-
100
- <div
101
- class="filter__options"
102
- tabindex="-1"
103
- role=${this.multiple?"group":"radiogroup"}
104
- >
105
- <slot @slotchange=${this.handleDefaultSlotChange}></slot>
106
- </div>
107
-
108
- <div class="filter-select__footer">
109
- ${this.maxVisibleListLength>0&&this.nbOptions>this.maxVisibleListLength&&!this.seeAll?o`
110
- <dsa-button
111
- variant="tertiary"
112
- size="small"
113
- class="filter__see-all-button"
114
- @click=${this.handleSeeAllClick}
115
- >
116
- ${this.localize.term("seeAll",this.nbOptions)}
117
- </dsa-button>
118
- `:""}
119
- ${this.drawer&&this.multiple?this.renderDeSelectAll():""}
120
- </div>
121
- `}};i.styles=L,i.dependencies=b(g({},O.dependencies),{"dsa-button":C,"dsa-icon":$,"dsa-input":f,"dsa-visually-hidden":_}),a([u(".filter__multiselect-header__deselect-all")],i.prototype,"deselectAllButton",2),a([u("dsa-input")],i.prototype,"searchInput",2),a([u(".filter__listbox")],i.prototype,"listbox",2),a([u(".filter__see-all-button")],i.prototype,"seeAllButton",2),a([r()],i.prototype,"displayLabel",2),a([r()],i.prototype,"allOptions",2),a([r()],i.prototype,"currentOption",2),a([r()],i.prototype,"selectedOptions",2),a([r()],i.prototype,"displayedOptions",2),a([r()],i.prototype,"searchValue",2),a([r()],i.prototype,"nbOptions",2),a([r()],i.prototype,"seeAll",2),a([r()],i.prototype,"debounceTimerId",2),a([h({converter:{fromAttribute:e=>e.split(" "),toAttribute:e=>typeof e=="string"?e:e.join(" ")}})],i.prototype,"value",2),a([h({type:Boolean,reflect:!0})],i.prototype,"multiple",2),a([h({attribute:"max-visible-list-length",type:Number})],i.prototype,"maxVisibleListLength",2),a([h({type:Boolean})],i.prototype,"searchable",2),a([h({type:Number,attribute:"debounce-timeout"})],i.prototype,"debounceTimeout",2),a([h({attribute:"option-gender"})],i.prototype,"optionGender",2),a([h({type:Boolean,attribute:"columns-filter"})],i.prototype,"columnsFilter",2),a([c("searchValue",{waitUntilFirstUpdate:!0})],i.prototype,"handleSearchValueChange",1),a([c("value",{waitUntilFirstUpdate:!0})],i.prototype,"handleValueChange",1),a([c("seeAll")],i.prototype,"handleSeeAllChange",1),a([c("multiple")],i.prototype,"handleMultipleChange",1),i=a([y("dsa-filter-select")],i);export{i as a};
@@ -1,12 +1,12 @@
1
- import {
2
- filter_counter_styles_default
3
- } from "./chunk.YSCXTTQZ.js";
4
1
  import {
5
2
  DSAInput
6
3
  } from "./chunk.JP47EKO5.js";
7
4
  import {
8
5
  FilterBase
9
6
  } from "./chunk.HTXWT3CI.js";
7
+ import {
8
+ filter_counter_styles_default
9
+ } from "./chunk.YSCXTTQZ.js";
10
10
  import {
11
11
  DSAButton
12
12
  } from "./chunk.2G35OVLZ.js";