@politiet/sheriff-web-components 2.5.0 → 2.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/custom-elements.json +210 -126
  2. package/dist/mixins/sds-event-dispatcher-mixin.d.ts +2 -1
  3. package/dist/mixins/sds-event-dispatcher-mixin.d.ts.map +1 -1
  4. package/dist/mixins/sds-event-dispatcher-mixin.js +58 -1
  5. package/dist/mixins/sds-event-dispatcher-mixin.js.map +1 -1
  6. package/dist/react-wrappers/SDSTextFieldWrapper.d.ts +2 -0
  7. package/dist/react-wrappers/SDSTextFieldWrapper.d.ts.map +1 -1
  8. package/dist/react-wrappers/SDSTextFieldWrapper.js +1 -0
  9. package/dist/react-wrappers/SDSTextFieldWrapper.js.map +1 -1
  10. package/dist/sds-alert/sds-alert.component.d.ts +2 -1
  11. package/dist/sds-alert/sds-alert.component.d.ts.map +1 -1
  12. package/dist/sds-alert/sds-alert.component.js +3 -5
  13. package/dist/sds-alert/sds-alert.component.js.map +1 -1
  14. package/dist/sds-button/sds-button.component.d.ts +2 -1
  15. package/dist/sds-button/sds-button.component.d.ts.map +1 -1
  16. package/dist/sds-button/sds-button.component.js +5 -17
  17. package/dist/sds-button/sds-button.component.js.map +1 -1
  18. package/dist/sds-checkbox/sds-checkbox.d.ts +2 -1
  19. package/dist/sds-checkbox/sds-checkbox.d.ts.map +1 -1
  20. package/dist/sds-checkbox/sds-checkbox.js +5 -4
  21. package/dist/sds-checkbox/sds-checkbox.js.map +1 -1
  22. package/dist/sds-checkbox-group/sds-checkbox-group.d.ts +2 -1
  23. package/dist/sds-checkbox-group/sds-checkbox-group.d.ts.map +1 -1
  24. package/dist/sds-checkbox-group/sds-checkbox-group.js +3 -5
  25. package/dist/sds-checkbox-group/sds-checkbox-group.js.map +1 -1
  26. package/dist/sds-chip/sds-chip.d.ts +2 -1
  27. package/dist/sds-chip/sds-chip.d.ts.map +1 -1
  28. package/dist/sds-chip/sds-chip.js +4 -9
  29. package/dist/sds-chip/sds-chip.js.map +1 -1
  30. package/dist/sds-details/sds-details.d.ts +3 -1
  31. package/dist/sds-details/sds-details.d.ts.map +1 -1
  32. package/dist/sds-details/sds-details.js +3 -6
  33. package/dist/sds-details/sds-details.js.map +1 -1
  34. package/dist/sds-dialog/sds-dialog.d.ts +2 -1
  35. package/dist/sds-dialog/sds-dialog.d.ts.map +1 -1
  36. package/dist/sds-dialog/sds-dialog.js +3 -5
  37. package/dist/sds-dialog/sds-dialog.js.map +1 -1
  38. package/dist/sds-icon/sds-icon.styles.d.ts.map +1 -1
  39. package/dist/sds-icon/sds-icon.styles.js +2 -1
  40. package/dist/sds-icon/sds-icon.styles.js.map +1 -1
  41. package/dist/sds-notification/sds-notification.d.ts +2 -1
  42. package/dist/sds-notification/sds-notification.d.ts.map +1 -1
  43. package/dist/sds-notification/sds-notification.js +3 -5
  44. package/dist/sds-notification/sds-notification.js.map +1 -1
  45. package/dist/sds-radio/sds-radio.d.ts +2 -1
  46. package/dist/sds-radio/sds-radio.d.ts.map +1 -1
  47. package/dist/sds-radio/sds-radio.js +5 -4
  48. package/dist/sds-radio/sds-radio.js.map +1 -1
  49. package/dist/sds-radio-group/sds-radio-group.d.ts +2 -1
  50. package/dist/sds-radio-group/sds-radio-group.d.ts.map +1 -1
  51. package/dist/sds-radio-group/sds-radio-group.js +3 -2
  52. package/dist/sds-radio-group/sds-radio-group.js.map +1 -1
  53. package/dist/sds-select/sds-select.d.ts +2 -1
  54. package/dist/sds-select/sds-select.d.ts.map +1 -1
  55. package/dist/sds-select/sds-select.js +6 -5
  56. package/dist/sds-select/sds-select.js.map +1 -1
  57. package/dist/sds-switch/sds-switch.d.ts +2 -1
  58. package/dist/sds-switch/sds-switch.d.ts.map +1 -1
  59. package/dist/sds-switch/sds-switch.js +5 -13
  60. package/dist/sds-switch/sds-switch.js.map +1 -1
  61. package/dist/sds-textarea/sds-textarea.d.ts +3 -1
  62. package/dist/sds-textarea/sds-textarea.d.ts.map +1 -1
  63. package/dist/sds-textarea/sds-textarea.js +15 -5
  64. package/dist/sds-textarea/sds-textarea.js.map +1 -1
  65. package/dist/sds-textfield/sds-textfield.d.ts +3 -1
  66. package/dist/sds-textfield/sds-textfield.d.ts.map +1 -1
  67. package/dist/sds-textfield/sds-textfield.js +28 -16
  68. package/dist/sds-textfield/sds-textfield.js.map +1 -1
  69. package/dist/sheriff-web-components.js +86 -85
  70. package/package.json +25 -25
  71. package/web-types.json +30 -148
@@ -120,6 +120,12 @@
120
120
  "fieldName": "palette"
121
121
  }
122
122
  ],
123
+ "mixins": [
124
+ {
125
+ "name": "SDSEventDispatcherMixin",
126
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
127
+ }
128
+ ],
123
129
  "superclass": {
124
130
  "name": "LitElement",
125
131
  "package": "lit"
@@ -587,6 +593,12 @@
587
593
  "fieldName": "variant"
588
594
  }
589
595
  ],
596
+ "mixins": [
597
+ {
598
+ "name": "SDSEventDispatcherMixin",
599
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
600
+ }
601
+ ],
590
602
  "superclass": {
591
603
  "name": "LitElement",
592
604
  "package": "lit"
@@ -1423,6 +1435,12 @@
1423
1435
  "fieldName": "readOnly"
1424
1436
  }
1425
1437
  ],
1438
+ "mixins": [
1439
+ {
1440
+ "name": "SDSEventDispatcherMixin",
1441
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
1442
+ }
1443
+ ],
1426
1444
  "superclass": {
1427
1445
  "name": "LitElement",
1428
1446
  "package": "lit"
@@ -1614,6 +1632,12 @@
1614
1632
  "fieldName": "size"
1615
1633
  }
1616
1634
  ],
1635
+ "mixins": [
1636
+ {
1637
+ "name": "SDSEventDispatcherMixin",
1638
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
1639
+ }
1640
+ ],
1617
1641
  "superclass": {
1618
1642
  "name": "LitElement",
1619
1643
  "package": "lit"
@@ -1857,6 +1881,12 @@
1857
1881
  "fieldName": "readonly"
1858
1882
  }
1859
1883
  ],
1884
+ "mixins": [
1885
+ {
1886
+ "name": "SDSEventDispatcherMixin",
1887
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
1888
+ }
1889
+ ],
1860
1890
  "superclass": {
1861
1891
  "name": "LitElement",
1862
1892
  "package": "lit"
@@ -1946,6 +1976,12 @@
1946
1976
  "fieldName": "name"
1947
1977
  }
1948
1978
  ],
1979
+ "mixins": [
1980
+ {
1981
+ "name": "SDSEventDispatcherMixin",
1982
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
1983
+ }
1984
+ ],
1949
1985
  "superclass": {
1950
1986
  "name": "LitElement",
1951
1987
  "package": "lit"
@@ -2147,6 +2183,12 @@
2147
2183
  "fieldName": "closeButtonLabel"
2148
2184
  }
2149
2185
  ],
2186
+ "mixins": [
2187
+ {
2188
+ "name": "SDSEventDispatcherMixin",
2189
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
2190
+ }
2191
+ ],
2150
2192
  "superclass": {
2151
2193
  "name": "LitElement",
2152
2194
  "package": "lit"
@@ -2989,6 +3031,12 @@
2989
3031
  "fieldName": "removableLabel"
2990
3032
  }
2991
3033
  ],
3034
+ "mixins": [
3035
+ {
3036
+ "name": "SDSEventDispatcherMixin",
3037
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
3038
+ }
3039
+ ],
2992
3040
  "superclass": {
2993
3041
  "name": "LitElement",
2994
3042
  "package": "lit"
@@ -3451,6 +3499,12 @@
3451
3499
  "fieldName": "disabled"
3452
3500
  }
3453
3501
  ],
3502
+ "mixins": [
3503
+ {
3504
+ "name": "SDSEventDispatcherMixin",
3505
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
3506
+ }
3507
+ ],
3454
3508
  "superclass": {
3455
3509
  "name": "LitElement",
3456
3510
  "package": "lit"
@@ -3674,6 +3728,12 @@
3674
3728
  "fieldName": "size"
3675
3729
  }
3676
3730
  ],
3731
+ "mixins": [
3732
+ {
3733
+ "name": "SDSEventDispatcherMixin",
3734
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
3735
+ }
3736
+ ],
3677
3737
  "superclass": {
3678
3738
  "name": "LitElement",
3679
3739
  "package": "lit"
@@ -4062,6 +4122,12 @@
4062
4122
  "fieldName": "size"
4063
4123
  }
4064
4124
  ],
4125
+ "mixins": [
4126
+ {
4127
+ "name": "SDSEventDispatcherMixin",
4128
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
4129
+ }
4130
+ ],
4065
4131
  "superclass": {
4066
4132
  "name": "LitElement",
4067
4133
  "package": "lit"
@@ -4201,132 +4267,6 @@
4201
4267
  }
4202
4268
  ]
4203
4269
  },
4204
- {
4205
- "kind": "javascript-module",
4206
- "path": "src/sds-stepper-step/sds-stepper-step.ts",
4207
- "declarations": [
4208
- {
4209
- "kind": "class",
4210
- "description": "",
4211
- "name": "SDSStepperStep",
4212
- "members": [
4213
- {
4214
- "kind": "field",
4215
- "name": "internals",
4216
- "type": {
4217
- "text": "ElementInternals"
4218
- },
4219
- "privacy": "public",
4220
- "readonly": true
4221
- },
4222
- {
4223
- "kind": "field",
4224
- "name": "shadowRootOptions",
4225
- "type": {
4226
- "text": "ShadowRootInit"
4227
- },
4228
- "static": true,
4229
- "default": "{ ...LitElement.shadowRootOptions, delegatesFocus: true, }"
4230
- },
4231
- {
4232
- "kind": "field",
4233
- "name": "complete",
4234
- "type": {
4235
- "text": "SDSStepperStepProps['complete']"
4236
- },
4237
- "default": "false",
4238
- "attribute": "complete",
4239
- "reflects": true
4240
- },
4241
- {
4242
- "kind": "field",
4243
- "name": "interactive",
4244
- "type": {
4245
- "text": "SDSStepperStepProps['interactive']"
4246
- },
4247
- "default": "false",
4248
- "attribute": "interactive",
4249
- "reflects": true
4250
- },
4251
- {
4252
- "kind": "field",
4253
- "name": "active",
4254
- "type": {
4255
- "text": "SDSStepperStepProps['active']"
4256
- },
4257
- "default": "false",
4258
- "attribute": "active",
4259
- "reflects": true
4260
- },
4261
- {
4262
- "kind": "field",
4263
- "name": "_handleClick",
4264
- "privacy": "private",
4265
- "readonly": true
4266
- },
4267
- {
4268
- "kind": "field",
4269
- "name": "_renderNonInteractiveStep",
4270
- "privacy": "private",
4271
- "readonly": true
4272
- },
4273
- {
4274
- "kind": "field",
4275
- "name": "_renderInteractiveStep",
4276
- "privacy": "private",
4277
- "readonly": true
4278
- }
4279
- ],
4280
- "attributes": [
4281
- {
4282
- "name": "complete",
4283
- "type": {
4284
- "text": "SDSStepperStepProps['complete']"
4285
- },
4286
- "default": "false",
4287
- "fieldName": "complete"
4288
- },
4289
- {
4290
- "name": "interactive",
4291
- "type": {
4292
- "text": "SDSStepperStepProps['interactive']"
4293
- },
4294
- "default": "false",
4295
- "fieldName": "interactive"
4296
- },
4297
- {
4298
- "name": "active",
4299
- "type": {
4300
- "text": "SDSStepperStepProps['active']"
4301
- },
4302
- "default": "false",
4303
- "fieldName": "active"
4304
- }
4305
- ],
4306
- "mixins": [
4307
- {
4308
- "name": "SDSEventDispatcherMixin",
4309
- "module": "/src/mixins/sds-event-dispatcher-mixin"
4310
- }
4311
- ],
4312
- "superclass": {
4313
- "name": "LitElement",
4314
- "package": "lit"
4315
- },
4316
- "customElement": true
4317
- }
4318
- ],
4319
- "exports": [
4320
- {
4321
- "kind": "js",
4322
- "name": "SDSStepperStep",
4323
- "declaration": {
4324
- "name": "SDSStepperStep",
4325
- "module": "src/sds-stepper-step/sds-stepper-step.ts"
4326
- }
4327
- }
4328
- ]
4329
- },
4330
4270
  {
4331
4271
  "kind": "javascript-module",
4332
4272
  "path": "src/sds-switch/sds-switch.ts",
@@ -4572,6 +4512,12 @@
4572
4512
  "fieldName": "size"
4573
4513
  }
4574
4514
  ],
4515
+ "mixins": [
4516
+ {
4517
+ "name": "SDSEventDispatcherMixin",
4518
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
4519
+ }
4520
+ ],
4575
4521
  "superclass": {
4576
4522
  "name": "LitElement",
4577
4523
  "package": "lit"
@@ -4590,6 +4536,132 @@
4590
4536
  }
4591
4537
  ]
4592
4538
  },
4539
+ {
4540
+ "kind": "javascript-module",
4541
+ "path": "src/sds-stepper-step/sds-stepper-step.ts",
4542
+ "declarations": [
4543
+ {
4544
+ "kind": "class",
4545
+ "description": "",
4546
+ "name": "SDSStepperStep",
4547
+ "members": [
4548
+ {
4549
+ "kind": "field",
4550
+ "name": "internals",
4551
+ "type": {
4552
+ "text": "ElementInternals"
4553
+ },
4554
+ "privacy": "public",
4555
+ "readonly": true
4556
+ },
4557
+ {
4558
+ "kind": "field",
4559
+ "name": "shadowRootOptions",
4560
+ "type": {
4561
+ "text": "ShadowRootInit"
4562
+ },
4563
+ "static": true,
4564
+ "default": "{ ...LitElement.shadowRootOptions, delegatesFocus: true, }"
4565
+ },
4566
+ {
4567
+ "kind": "field",
4568
+ "name": "complete",
4569
+ "type": {
4570
+ "text": "SDSStepperStepProps['complete']"
4571
+ },
4572
+ "default": "false",
4573
+ "attribute": "complete",
4574
+ "reflects": true
4575
+ },
4576
+ {
4577
+ "kind": "field",
4578
+ "name": "interactive",
4579
+ "type": {
4580
+ "text": "SDSStepperStepProps['interactive']"
4581
+ },
4582
+ "default": "false",
4583
+ "attribute": "interactive",
4584
+ "reflects": true
4585
+ },
4586
+ {
4587
+ "kind": "field",
4588
+ "name": "active",
4589
+ "type": {
4590
+ "text": "SDSStepperStepProps['active']"
4591
+ },
4592
+ "default": "false",
4593
+ "attribute": "active",
4594
+ "reflects": true
4595
+ },
4596
+ {
4597
+ "kind": "field",
4598
+ "name": "_handleClick",
4599
+ "privacy": "private",
4600
+ "readonly": true
4601
+ },
4602
+ {
4603
+ "kind": "field",
4604
+ "name": "_renderNonInteractiveStep",
4605
+ "privacy": "private",
4606
+ "readonly": true
4607
+ },
4608
+ {
4609
+ "kind": "field",
4610
+ "name": "_renderInteractiveStep",
4611
+ "privacy": "private",
4612
+ "readonly": true
4613
+ }
4614
+ ],
4615
+ "attributes": [
4616
+ {
4617
+ "name": "complete",
4618
+ "type": {
4619
+ "text": "SDSStepperStepProps['complete']"
4620
+ },
4621
+ "default": "false",
4622
+ "fieldName": "complete"
4623
+ },
4624
+ {
4625
+ "name": "interactive",
4626
+ "type": {
4627
+ "text": "SDSStepperStepProps['interactive']"
4628
+ },
4629
+ "default": "false",
4630
+ "fieldName": "interactive"
4631
+ },
4632
+ {
4633
+ "name": "active",
4634
+ "type": {
4635
+ "text": "SDSStepperStepProps['active']"
4636
+ },
4637
+ "default": "false",
4638
+ "fieldName": "active"
4639
+ }
4640
+ ],
4641
+ "mixins": [
4642
+ {
4643
+ "name": "SDSEventDispatcherMixin",
4644
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
4645
+ }
4646
+ ],
4647
+ "superclass": {
4648
+ "name": "LitElement",
4649
+ "package": "lit"
4650
+ },
4651
+ "customElement": true
4652
+ }
4653
+ ],
4654
+ "exports": [
4655
+ {
4656
+ "kind": "js",
4657
+ "name": "SDSStepperStep",
4658
+ "declaration": {
4659
+ "name": "SDSStepperStep",
4660
+ "module": "src/sds-stepper-step/sds-stepper-step.ts"
4661
+ }
4662
+ }
4663
+ ]
4664
+ },
4593
4665
  {
4594
4666
  "kind": "javascript-module",
4595
4667
  "path": "src/sds-tag/sds-tag.ts",
@@ -5330,6 +5402,12 @@
5330
5402
  "fieldName": "size"
5331
5403
  }
5332
5404
  ],
5405
+ "mixins": [
5406
+ {
5407
+ "name": "SDSEventDispatcherMixin",
5408
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
5409
+ }
5410
+ ],
5333
5411
  "superclass": {
5334
5412
  "name": "LitElement",
5335
5413
  "package": "lit"
@@ -5821,6 +5899,12 @@
5821
5899
  "fieldName": "size"
5822
5900
  }
5823
5901
  ],
5902
+ "mixins": [
5903
+ {
5904
+ "name": "SDSEventDispatcherMixin",
5905
+ "module": "/src/mixins/sds-event-dispatcher-mixin"
5906
+ }
5907
+ ],
5824
5908
  "superclass": {
5825
5909
  "name": "LitElement",
5826
5910
  "package": "lit"
@@ -1,7 +1,8 @@
1
1
  import { LitElement } from 'lit';
2
2
  type Constructable<T = object> = new (...args: any[]) => T;
3
3
  export interface SDSEventDispatcherMixinInterface {
4
- dispatchSheriffEvent<TDetail = void>(type: string, detail?: TDetail): boolean;
4
+ dispatchSheriffEvent<TDetail = void>(type: string, detail?: TDetail, cancelable?: boolean): boolean;
5
+ dispatchKeyboardEvent(type: string, originalEvent: KeyboardEvent): boolean;
5
6
  }
6
7
  export declare function SDSEventDispatcherMixin<T extends Constructable<LitElement>>(superClass: T): Constructable<SDSEventDispatcherMixinInterface> & T;
7
8
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"sds-event-dispatcher-mixin.d.ts","sourceRoot":"","sources":["../../src/mixins/sds-event-dispatcher-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjC,KAAK,aAAa,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAE3D,MAAM,WAAW,gCAAgC;IAChD,oBAAoB,CAAC,OAAO,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;CAC9E;AAED,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,aAAa,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC,GAAG,aAAa,CAAC,gCAAgC,CAAC,GAAG,CAAC,CAY/I"}
1
+ {"version":3,"file":"sds-event-dispatcher-mixin.d.ts","sourceRoot":"","sources":["../../src/mixins/sds-event-dispatcher-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjC,KAAK,aAAa,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AA2C3D,MAAM,WAAW,gCAAgC;IAChD,oBAAoB,CAAC,OAAO,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC;IACpG,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC;CAC3E;AAED,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,aAAa,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,CAAC,GAAG,aAAa,CAAC,gCAAgC,CAAC,GAAG,CAAC,CAgC/I"}
@@ -1,10 +1,67 @@
1
+ const NON_CANCELABLE_EVENTS = new Set([
2
+ // Focus events
3
+ 'focus',
4
+ 'blur',
5
+ 'focusin',
6
+ 'focusout',
7
+ // Input events
8
+ 'input',
9
+ 'change',
10
+ // Media events
11
+ 'play',
12
+ 'pause',
13
+ 'ended',
14
+ 'volumechange',
15
+ 'timeupdate',
16
+ 'durationchange',
17
+ 'loadeddata',
18
+ 'loadedmetadata',
19
+ 'loadstart',
20
+ 'canplay',
21
+ 'canplaythrough',
22
+ 'playing',
23
+ 'seeked',
24
+ 'stalled',
25
+ 'suspend',
26
+ 'waiting',
27
+ 'ratechange',
28
+ // Lifecycle/window events
29
+ 'load',
30
+ 'unload',
31
+ 'abort',
32
+ 'error',
33
+ 'resize',
34
+ 'scroll',
35
+ // Keyboard
36
+ 'keyup',
37
+ // Misc
38
+ 'reset',
39
+ 'select',
40
+ ]);
1
41
  export function SDSEventDispatcherMixin(superClass) {
2
42
  return class SDSEventDispatcher extends superClass {
3
- dispatchSheriffEvent(type, detail) {
43
+ dispatchSheriffEvent(type, detail, cancelable = !NON_CANCELABLE_EVENTS.has(type)) {
4
44
  return this.dispatchEvent(new CustomEvent(type, {
5
45
  detail,
6
46
  bubbles: true,
7
47
  composed: true,
48
+ cancelable,
49
+ }));
50
+ }
51
+ dispatchKeyboardEvent(type, originalEvent) {
52
+ return this.dispatchEvent(new KeyboardEvent(type, {
53
+ key: originalEvent.key,
54
+ code: originalEvent.code,
55
+ bubbles: true,
56
+ composed: true,
57
+ cancelable: !NON_CANCELABLE_EVENTS.has(type),
58
+ ctrlKey: originalEvent.ctrlKey,
59
+ shiftKey: originalEvent.shiftKey,
60
+ altKey: originalEvent.altKey,
61
+ metaKey: originalEvent.metaKey,
62
+ repeat: originalEvent.repeat,
63
+ isComposing: originalEvent.isComposing,
64
+ location: originalEvent.location,
8
65
  }));
9
66
  }
10
67
  };
@@ -1 +1 @@
1
- {"version":3,"file":"sds-event-dispatcher-mixin.js","sourceRoot":"","sources":["../../src/mixins/sds-event-dispatcher-mixin.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,uBAAuB,CAAsC,UAAa;IACzF,OAAO,MAAM,kBAAmB,SAAQ,UAAU;QACjD,oBAAoB,CAAiB,IAAY,EAAE,MAAgB;YAClE,OAAO,IAAI,CAAC,aAAa,CACxB,IAAI,WAAW,CAAU,IAAI,EAAE;gBAC9B,MAAM;gBACN,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE,IAAI;aACd,CAAC,CACF,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import { LitElement } from 'lit';\n\ntype Constructable<T = object> = new (...args: any[]) => T;\n\nexport interface SDSEventDispatcherMixinInterface {\n\tdispatchSheriffEvent<TDetail = void>(type: string, detail?: TDetail): boolean;\n}\n\nexport function SDSEventDispatcherMixin<T extends Constructable<LitElement>>(superClass: T): Constructable<SDSEventDispatcherMixinInterface> & T {\n\treturn class SDSEventDispatcher extends superClass {\n\t\tdispatchSheriffEvent<TDetail = void>(type: string, detail?: TDetail): boolean {\n\t\t\treturn this.dispatchEvent(\n\t\t\t\tnew CustomEvent<TDetail>(type, {\n\t\t\t\t\tdetail,\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t};\n}\n"]}
1
+ {"version":3,"file":"sds-event-dispatcher-mixin.js","sourceRoot":"","sources":["../../src/mixins/sds-event-dispatcher-mixin.ts"],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AAC,QAAQ;gBAChC,MAAM,EAAE,aAAa,CAAC,MAAM;gBAC5B,OAAO,EAAE,aAAa,CAAC,OAAO;gBAC9B,MAAM,EAAE,aAAa,CAAC,MAAM;gBAC5B,WAAW,EAAE,aAAa,CAAC,WAAW;gBACtC,QAAQ,EAAE,aAAa,CAAC,QAAQ;aAChC,CAAC,CACF,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import { LitElement } from 'lit';\n\ntype Constructable<T = object> = new (...args: any[]) => T;\n\nconst NON_CANCELABLE_EVENTS = new Set([\n\t// Focus events\n\t'focus',\n\t'blur',\n\t'focusin',\n\t'focusout',\n\t// Input events\n\t'input',\n\t'change',\n\t// Media events\n\t'play',\n\t'pause',\n\t'ended',\n\t'volumechange',\n\t'timeupdate',\n\t'durationchange',\n\t'loadeddata',\n\t'loadedmetadata',\n\t'loadstart',\n\t'canplay',\n\t'canplaythrough',\n\t'playing',\n\t'seeked',\n\t'stalled',\n\t'suspend',\n\t'waiting',\n\t'ratechange',\n\t// Lifecycle/window events\n\t'load',\n\t'unload',\n\t'abort',\n\t'error',\n\t'resize',\n\t'scroll',\n\t// Keyboard\n\t'keyup',\n\t// Misc\n\t'reset',\n\t'select',\n]);\n\nexport interface SDSEventDispatcherMixinInterface {\n\tdispatchSheriffEvent<TDetail = void>(type: string, detail?: TDetail, cancelable?: boolean): boolean;\n\tdispatchKeyboardEvent(type: string, originalEvent: KeyboardEvent): boolean;\n}\n\nexport function SDSEventDispatcherMixin<T extends Constructable<LitElement>>(superClass: T): Constructable<SDSEventDispatcherMixinInterface> & T {\n\treturn class SDSEventDispatcher extends superClass {\n\t\tdispatchSheriffEvent<TDetail = void>(type: string, detail?: TDetail, cancelable = !NON_CANCELABLE_EVENTS.has(type)): boolean {\n\t\t\treturn this.dispatchEvent(\n\t\t\t\tnew CustomEvent<TDetail>(type, {\n\t\t\t\t\tdetail,\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t\tcancelable,\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\tdispatchKeyboardEvent(type: string, originalEvent: KeyboardEvent): boolean {\n\t\t\treturn this.dispatchEvent(\n\t\t\t\tnew KeyboardEvent(type, {\n\t\t\t\t\tkey: originalEvent.key,\n\t\t\t\t\tcode: originalEvent.code,\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t\tcancelable: !NON_CANCELABLE_EVENTS.has(type),\n\t\t\t\t\tctrlKey: originalEvent.ctrlKey,\n\t\t\t\t\tshiftKey: originalEvent.shiftKey,\n\t\t\t\t\taltKey: originalEvent.altKey,\n\t\t\t\t\tmetaKey: originalEvent.metaKey,\n\t\t\t\t\trepeat: originalEvent.repeat,\n\t\t\t\t\tisComposing: originalEvent.isComposing,\n\t\t\t\t\tlocation: originalEvent.location,\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t};\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import { EventName } from '@lit/react';
1
2
  import { SDSTextField } from '../sds-textfield/sds-textfield';
2
3
  import { SheriffEventName } from './types';
3
4
  export declare const SDSTextFieldWrapper: import("@lit/react").ReactWebComponent<SDSTextField, {
@@ -6,5 +7,6 @@ export declare const SDSTextFieldWrapper: import("@lit/react").ReactWebComponent
6
7
  onSelect: SheriffEventName;
7
8
  onFocus: SheriffEventName;
8
9
  onBlur: SheriffEventName;
10
+ onKeyDown: EventName<KeyboardEvent>;
9
11
  }>;
10
12
  //# sourceMappingURL=SDSTextFieldWrapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SDSTextFieldWrapper.d.ts","sourceRoot":"","sources":["../../src/react-wrappers/SDSTextFieldWrapper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,mBAAmB;aAKV,gBAAgB;cACf,gBAAgB;cACf,gBAAgB;aAClB,gBAAgB;YAClB,gBAAgB;EAElC,CAAC"}
1
+ {"version":3,"file":"SDSTextFieldWrapper.d.ts","sourceRoot":"","sources":["../../src/react-wrappers/SDSTextFieldWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,SAAS,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,mBAAmB;aAKV,gBAAgB;cACf,gBAAgB;cACf,gBAAgB;aAClB,gBAAgB;YAClB,gBAAgB;eACV,SAAS,CAAC,aAAa,CAAC;EAEhD,CAAC"}
@@ -11,6 +11,7 @@ export const SDSTextFieldWrapper = createComponent({
11
11
  onSelect: 'select',
12
12
  onFocus: 'focus',
13
13
  onBlur: 'blur',
14
+ onKeyDown: 'keydown',
14
15
  },
15
16
  });
16
17
  //# sourceMappingURL=SDSTextFieldWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SDSTextFieldWrapper.js","sourceRoot":"","sources":["../../src/react-wrappers/SDSTextFieldWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG9D,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;IAClD,OAAO,EAAE,eAAe;IACxB,YAAY,EAAE,YAAY;IAC1B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE;QACP,OAAO,EAAE,OAA2B;QACpC,QAAQ,EAAE,OAA2B;QACrC,QAAQ,EAAE,QAA4B;QACtC,OAAO,EAAE,OAA2B;QACpC,MAAM,EAAE,MAA0B;KAClC;CACD,CAAC,CAAC","sourcesContent":["import { createComponent } from '@lit/react';\nimport React from 'react';\nimport { SDSTextField } from '../sds-textfield/sds-textfield';\nimport { SheriffEventName } from './types';\n\nexport const SDSTextFieldWrapper = createComponent({\n\ttagName: 'sds-textfield',\n\telementClass: SDSTextField,\n\treact: React,\n\tevents: {\n\t\tonInput: 'input' as SheriffEventName,\n\t\tonChange: 'input' as SheriffEventName,\n\t\tonSelect: 'select' as SheriffEventName,\n\t\tonFocus: 'focus' as SheriffEventName,\n\t\tonBlur: 'blur' as SheriffEventName,\n\t},\n});\n"]}
1
+ {"version":3,"file":"SDSTextFieldWrapper.js","sourceRoot":"","sources":["../../src/react-wrappers/SDSTextFieldWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAa,MAAM,YAAY,CAAC;AACxD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG9D,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC;IAClD,OAAO,EAAE,eAAe;IACxB,YAAY,EAAE,YAAY;IAC1B,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE;QACP,OAAO,EAAE,OAA2B;QACpC,QAAQ,EAAE,OAA2B;QACrC,QAAQ,EAAE,QAA4B;QACtC,OAAO,EAAE,OAA2B;QACpC,MAAM,EAAE,MAA0B;QAClC,SAAS,EAAE,SAAqC;KAChD;CACD,CAAC,CAAC","sourcesContent":["import { createComponent, EventName } from '@lit/react';\nimport React from 'react';\nimport { SDSTextField } from '../sds-textfield/sds-textfield';\nimport { SheriffEventName } from './types';\n\nexport const SDSTextFieldWrapper = createComponent({\n\ttagName: 'sds-textfield',\n\telementClass: SDSTextField,\n\treact: React,\n\tevents: {\n\t\tonInput: 'input' as SheriffEventName,\n\t\tonChange: 'input' as SheriffEventName,\n\t\tonSelect: 'select' as SheriffEventName,\n\t\tonFocus: 'focus' as SheriffEventName,\n\t\tonBlur: 'blur' as SheriffEventName,\n\t\tonKeyDown: 'keydown' as EventName<KeyboardEvent>,\n\t},\n});\n"]}
@@ -9,7 +9,8 @@ export interface SDSAlertProps {
9
9
  size?: AlertSize;
10
10
  'removable-label'?: string;
11
11
  }
12
- export declare class SDSAlertComponent extends LitElement {
12
+ declare const SDSAlertComponent_base: (new (...args: any[]) => import("../mixins/sds-event-dispatcher-mixin").SDSEventDispatcherMixinInterface) & typeof LitElement;
13
+ export declare class SDSAlertComponent extends SDSAlertComponent_base {
13
14
  static styles: import("lit").CSSResult[];
14
15
  variant: Variants;
15
16
  size: AlertSize;
@@ -1 +1 @@
1
- {"version":3,"file":"sds-alert.component.d.ts","sourceRoot":"","sources":["../../src/sds-alert/sds-alert.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,KAAK,CAAC;AAGhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEnD,KAAK,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAChE,KAAK,QAAQ,GAAG,OAAO,CAAC,YAAY,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC;AAC/D,KAAK,SAAS,GAAG,OAAO,CAAC,SAAS,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AASxD,MAAM,WAAW,aAAa;IAC7B,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qBAAa,iBAAkB,SAAQ,UAAU;IAChD,OAAgB,MAAM,4BAAY;IAES,OAAO,EAAE,QAAQ,CAAa;IAC9B,IAAI,EAAE,SAAS,CAAQ;IACO,cAAc,CAAC,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,YAAY,CAAU;IAErG,SAAS,CAAC,OAAO,EAAE,WAAW,CAAqB;IACnD,SAAS,CAAC,SAAS,EAAE,WAAW,CAAuB;IAE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f"}
@@ -8,13 +8,14 @@ import { LitElement, html, nothing } from 'lit';
8
8
  import { property } from 'lit/decorators.js';
9
9
  import { html as staticHtml, literal } from 'lit/static-html.js';
10
10
  import { styles } from './sds-alert.styles';
11
+ import { SDSEventDispatcherMixin } from '../mixins/sds-event-dispatcher-mixin';
11
12
  const alertIcons = {
12
13
  info: 'InformationSquareFill-aksel-filled',
13
14
  success: 'check_circle-material-filled',
14
15
  attention: 'warning-material-filled',
15
16
  danger: 'dangerous-material-filled',
16
17
  };
17
- export class SDSAlertComponent extends LitElement {
18
+ export class SDSAlertComponent extends SDSEventDispatcherMixin(LitElement) {
18
19
  constructor() {
19
20
  super(...arguments);
20
21
  this.variant = 'primary';
@@ -23,10 +24,7 @@ export class SDSAlertComponent extends LitElement {
23
24
  this.iconTag = literal `sds-icon`;
24
25
  this.buttonTag = literal `sds-button`;
25
26
  this._remove = () => {
26
- this.dispatchEvent(new CustomEvent('sds-remove', {
27
- bubbles: true,
28
- composed: true,
29
- }));
27
+ this.dispatchSheriffEvent('sds-remove');
30
28
  };
31
29
  this._renderIcon = (iconName, size, cls) => {
32
30
  return staticHtml `<${this.iconTag} ${cls ? `class=${cls}` : ''} name="${iconName}" size=${size}></${this.iconTag}>`;
@@ -1 +1 @@
1
- {"version":3,"file":"sds-alert.component.js","sourceRoot":"","sources":["../../src/sds-alert/sds-alert.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAO5C,MAAM,UAAU,GAAiC;IAChD,IAAI,EAAE,oCAAoC;IAC1C,OAAO,EAAE,8BAA8B;IACvC,SAAS,EAAE,yBAAyB;IAC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QAEhE,OAAO,IAAI,CAAA;kCACqB,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,iBAAiB,CAAC;;;;;KAKpF,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA,mCAAmC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO;SACtJ,CAAC;IACT,CAAC;;AAhDe,wBAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAES;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDAA+B;AAC9B;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAwB;AACO;IAAxE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yDAAyB;AAC3B;IAArE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDAAgC","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { html as staticHtml, literal } from 'lit/static-html.js';\nimport type { StaticValue } from 'lit-html/static.js';\nimport { styles } from './sds-alert.styles';\nimport { SDS_VARIANTS, SDS_SIZES } from '../types';\n\ntype ColorPalette = 'info' | 'success' | 'attention' | 'danger';\ntype Variants = Extract<SDS_VARIANTS, 'primary' | 'secondary'>;\ntype AlertSize = Extract<SDS_SIZES, 'lg' | 'md' | 'sm'>;\n\nconst alertIcons: Record<ColorPalette, string> = {\n\tinfo: 'InformationSquareFill-aksel-filled',\n\tsuccess: 'check_circle-material-filled',\n\tattention: 'warning-material-filled',\n\tdanger: 'dangerous-material-filled',\n};\n\nexport interface SDSAlertProps {\n\tvariant?: Variants;\n\tsize?: AlertSize;\n\t'removable-label'?: string;\n}\n\nexport class SDSAlertComponent extends LitElement {\n\tstatic override styles = [styles];\n\n\t@property({ type: String, reflect: true }) variant: Variants = 'primary';\n\t@property({ type: String, reflect: true }) size: AlertSize = 'md';\n\t@property({ type: String, attribute: 'removable-label', reflect: true }) removableLabel?: string;\n\t@property({ type: String, attribute: 'data-palette', reflect: true }) palette: ColorPalette = 'info';\n\n\tprotected iconTag: StaticValue = literal`sds-icon`;\n\tprotected buttonTag: StaticValue = literal`sds-button`;\n\n\tprivate readonly _remove = () => {\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('sds-remove', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t})\n\t\t);\n\t};\n\n\tprivate readonly _renderIcon = (iconName: string, size: string, cls?: string) => {\n\t\treturn staticHtml`<${this.iconTag} ${cls ? `class=${cls}` : ''} name=\"${iconName}\" size=${size}></${this.iconTag}>`;\n\t};\n\n\tprivate readonly _renderRemoveButton = (ariaLabel: string) => {\n\t\treturn staticHtml`<${this.buttonTag}\n\t\tclass=\"sds-alert__remove-btn\"\n\t\tvariant=\"tertiary\"\n\t\tsize=\"sm\"\n\t\t?icon=${true}\n\t\taria-label=${ariaLabel}\n\t\t@click=${this._remove}\n\t\t>\n\t\t${this._renderIcon('close-material-outlined', 'sm')}\n\t\t</${this.buttonTag}>`;\n\t};\n\n\toverride render() {\n\t\tconst iconSize = this.variant === 'primary' ? 'md' : this.size ?? 'md';\n\t\tconst iconName = alertIcons[this.palette] ?? alertIcons['info'];\n\n\t\treturn html`<div class=\"sds-alert\">\n\t\t\t<div class=\"sds-alert__type\">${this._renderIcon(iconName, iconSize, 'sds-alert__icon')}</div>\n\t\t\t<div class=\"sds-alert__content\">\n\t\t\t\t<slot name=\"title\"></slot>\n\t\t\t\t<slot name=\"message\"></slot>\n\t\t\t</div>\n\t\t\t${this.removableLabel && this.variant === 'primary' ? html`<div class=\"sds-alert__actions\">${this._renderRemoveButton(this.removableLabel)}</div>` : nothing}\n\t\t</div>`;\n\t}\n}\n"]}
1
+ {"version":3,"file":"sds-alert.component.js","sourceRoot":"","sources":["../../src/sds-alert/sds-alert.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAM/E,MAAM,UAAU,GAAiC;IAChD,IAAI,EAAE,oCAAoC;IAC1C,OAAO,EAAE,8BAA8B;IACvC,SAAS,EAAE,yBAAyB;IACpC,MAAM,EAAE,2BAA2B;CACnC,CAAC;AAQF,MAAM,OAAO,iBAAkB,SAAQ,uBAAuB,CAAC,UAAU,CAAC;IAA1E;;QAG4C,YAAO,GAAa,SAAS,CAAC;QAC9B,SAAI,GAAc,IAAI,CAAC;QAEI,YAAO,GAAiB,MAAM,CAAC;QAE3F,YAAO,GAAgB,OAAO,CAAA,UAAU,CAAC;QACzC,cAAS,GAAgB,OAAO,CAAA,YAAY,CAAC;QAEtC,YAAO,GAAG,GAAG,EAAE;YAC/B,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;QACzC,CAAC,CAAC;QAEe,gBAAW,GAAG,CAAC,QAAgB,EAAE,IAAY,EAAE,GAAY,EAAE,EAAE;YAC/E,OAAO,UAAU,CAAA,IAAI,IAAI,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,QAAQ,UAAU,IAAI,MAAM,IAAI,CAAC,OAAO,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Q,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDAAgC","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { html as staticHtml, literal } from 'lit/static-html.js';\nimport type { StaticValue } from 'lit-html/static.js';\nimport { styles } from './sds-alert.styles';\nimport { SDS_VARIANTS, SDS_SIZES } from '../types';\nimport { SDSEventDispatcherMixin } from '../mixins/sds-event-dispatcher-mixin';\n\ntype ColorPalette = 'info' | 'success' | 'attention' | 'danger';\ntype Variants = Extract<SDS_VARIANTS, 'primary' | 'secondary'>;\ntype AlertSize = Extract<SDS_SIZES, 'lg' | 'md' | 'sm'>;\n\nconst alertIcons: Record<ColorPalette, string> = {\n\tinfo: 'InformationSquareFill-aksel-filled',\n\tsuccess: 'check_circle-material-filled',\n\tattention: 'warning-material-filled',\n\tdanger: 'dangerous-material-filled',\n};\n\nexport interface SDSAlertProps {\n\tvariant?: Variants;\n\tsize?: AlertSize;\n\t'removable-label'?: string;\n}\n\nexport class SDSAlertComponent extends SDSEventDispatcherMixin(LitElement) {\n\tstatic override styles = [styles];\n\n\t@property({ type: String, reflect: true }) variant: Variants = 'primary';\n\t@property({ type: String, reflect: true }) size: AlertSize = 'md';\n\t@property({ type: String, attribute: 'removable-label', reflect: true }) removableLabel?: string;\n\t@property({ type: String, attribute: 'data-palette', reflect: true }) palette: ColorPalette = 'info';\n\n\tprotected iconTag: StaticValue = literal`sds-icon`;\n\tprotected buttonTag: StaticValue = literal`sds-button`;\n\n\tprivate readonly _remove = () => {\n\t\tthis.dispatchSheriffEvent('sds-remove');\n\t};\n\n\tprivate readonly _renderIcon = (iconName: string, size: string, cls?: string) => {\n\t\treturn staticHtml`<${this.iconTag} ${cls ? `class=${cls}` : ''} name=\"${iconName}\" size=${size}></${this.iconTag}>`;\n\t};\n\n\tprivate readonly _renderRemoveButton = (ariaLabel: string) => {\n\t\treturn staticHtml`<${this.buttonTag}\n\t\tclass=\"sds-alert__remove-btn\"\n\t\tvariant=\"tertiary\"\n\t\tsize=\"sm\"\n\t\t?icon=${true}\n\t\taria-label=${ariaLabel}\n\t\t@click=${this._remove}\n\t\t>\n\t\t${this._renderIcon('close-material-outlined', 'sm')}\n\t\t</${this.buttonTag}>`;\n\t};\n\n\toverride render() {\n\t\tconst iconSize = this.variant === 'primary' ? 'md' : this.size ?? 'md';\n\t\tconst iconName = alertIcons[this.palette] ?? alertIcons['info'];\n\n\t\treturn html`<div class=\"sds-alert\">\n\t\t\t<div class=\"sds-alert__type\">${this._renderIcon(iconName, iconSize, 'sds-alert__icon')}</div>\n\t\t\t<div class=\"sds-alert__content\">\n\t\t\t\t<slot name=\"title\"></slot>\n\t\t\t\t<slot name=\"message\"></slot>\n\t\t\t</div>\n\t\t\t${this.removableLabel && this.variant === 'primary' ? html`<div class=\"sds-alert__actions\">${this._renderRemoveButton(this.removableLabel)}</div>` : nothing}\n\t\t</div>`;\n\t}\n}\n"]}
@@ -17,7 +17,8 @@ export interface SDSButtonProps {
17
17
  value?: string;
18
18
  variant?: ButtonVariant;
19
19
  }
20
- export declare class SDSButtonComponent extends LitElement {
20
+ declare const SDSButtonComponent_base: (new (...args: any[]) => import("../mixins/sds-event-dispatcher-mixin").SDSEventDispatcherMixinInterface) & typeof LitElement;
21
+ export declare class SDSButtonComponent extends SDSButtonComponent_base {
21
22
  static styles: import("lit").CSSResult[];
22
23
  static formAssociated: boolean;
23
24
  readonly internals: ElementInternals;