@brightspace-ui/core 3.31.0 → 3.32.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -297,7 +297,7 @@ The `getUTCDateTimeRange(rangeType, diff)` helper function can be used to get th
297
297
  </d2l-filter>
298
298
  ```
299
299
 
300
- ## Dimension Set Value: Date-Time Range
300
+ ## Dimension Set Value: Date-Time Range [d2l-filter-dimension-set-date-time-range-value]
301
301
 
302
302
  This component is built to be used alongside the [d2l-filter-dimension-set](#d2l-filter-dimension-set) component. It will give you a selectable filter value which expands to allow the user to select a date range using either the `d2l-input-date-time-range` or `d2l-input-date-range` component (depending on the `type` of the component). Selection triggers the `d2l-filter-change` event, with `start-value` and `end-value` (in UTC) being included in the changes for the `selected` item.
303
303
 
@@ -167,10 +167,6 @@
167
167
  "description": "Type of the alert being displayed",
168
168
  "type": "'default'|'critical'|'success'|'warning'",
169
169
  "default": "\"default\""
170
- },
171
- {
172
- "name": "documentLocaleSettings",
173
- "default": "\"getDocumentLocaleSettings()\""
174
170
  }
175
171
  ],
176
172
  "events": [
@@ -330,10 +326,6 @@
330
326
  "description": "Renders in compact mode, displaying only the last item",
331
327
  "type": "boolean",
332
328
  "default": "false"
333
- },
334
- {
335
- "name": "documentLocaleSettings",
336
- "default": "\"getDocumentLocaleSettings()\""
337
329
  }
338
330
  ],
339
331
  "slots": [
@@ -373,10 +365,6 @@
373
365
  "description": "Display mode of the component. Defaults to `icon` (plus icon is always visible). Other options are `icon-and-text` (plus icon and text are always visible), and `icon-when-interacted` (plus icon is only visible when hover or focus).",
374
366
  "type": "'icon'|'icon-and-text'|'icon-when-interacted'",
375
367
  "default": "\"icon\""
376
- },
377
- {
378
- "name": "documentLocaleSettings",
379
- "default": "\"getDocumentLocaleSettings()\""
380
368
  }
381
369
  ]
382
370
  },
@@ -881,10 +869,6 @@
881
869
  "attribute": "summary",
882
870
  "description": "ACCESSIBILITY: Summary of the calendar used by screen reader users for identifying the calendar and/or summarizing its purpose",
883
871
  "type": "string"
884
- },
885
- {
886
- "name": "documentLocaleSettings",
887
- "default": "\"getDocumentLocaleSettings()\""
888
872
  }
889
873
  ],
890
874
  "events": [
@@ -1615,10 +1599,6 @@
1615
1599
  "type": "'count'|'notification'",
1616
1600
  "default": "\"count\""
1617
1601
  },
1618
- {
1619
- "name": "documentLocaleSettings",
1620
- "default": "\"getDocumentLocaleSettings()\""
1621
- },
1622
1602
  {
1623
1603
  "name": "skeleton",
1624
1604
  "attribute": "skeleton",
@@ -1764,10 +1744,6 @@
1764
1744
  "type": "'count'|'notification'",
1765
1745
  "default": "\"count\""
1766
1746
  },
1767
- {
1768
- "name": "documentLocaleSettings",
1769
- "default": "\"getDocumentLocaleSettings()\""
1770
- },
1771
1747
  {
1772
1748
  "name": "skeleton",
1773
1749
  "attribute": "skeleton",
@@ -2026,10 +2002,6 @@
2026
2002
  "type": "boolean",
2027
2003
  "default": "false"
2028
2004
  },
2029
- {
2030
- "name": "documentLocaleSettings",
2031
- "default": "\"getDocumentLocaleSettings()\""
2032
- },
2033
2005
  {
2034
2006
  "name": "titleText",
2035
2007
  "attribute": "title-text",
@@ -2122,10 +2094,6 @@
2122
2094
  "type": "number",
2123
2095
  "default": "1170"
2124
2096
  },
2125
- {
2126
- "name": "documentLocaleSettings",
2127
- "default": "\"getDocumentLocaleSettings()\""
2128
- },
2129
2097
  {
2130
2098
  "name": "asyncContainerCustom",
2131
2099
  "type": "boolean"
@@ -2257,10 +2225,6 @@
2257
2225
  "type": "number",
2258
2226
  "default": "600"
2259
2227
  },
2260
- {
2261
- "name": "documentLocaleSettings",
2262
- "default": "\"getDocumentLocaleSettings()\""
2263
- },
2264
2228
  {
2265
2229
  "name": "asyncContainerCustom",
2266
2230
  "type": "boolean"
@@ -2741,10 +2705,6 @@
2741
2705
  "description": "Optionally render a d2l-focus-trap around the dropdown content",
2742
2706
  "type": "boolean",
2743
2707
  "default": "false"
2744
- },
2745
- {
2746
- "name": "documentLocaleSettings",
2747
- "default": "\"getDocumentLocaleSettings()\""
2748
2708
  }
2749
2709
  ],
2750
2710
  "events": [
@@ -3119,10 +3079,6 @@
3119
3079
  "description": "Optionally render a d2l-focus-trap around the dropdown content",
3120
3080
  "type": "boolean",
3121
3081
  "default": "false"
3122
- },
3123
- {
3124
- "name": "documentLocaleSettings",
3125
- "default": "\"getDocumentLocaleSettings()\""
3126
3082
  }
3127
3083
  ],
3128
3084
  "events": [
@@ -3497,10 +3453,6 @@
3497
3453
  "description": "Optionally render a d2l-focus-trap around the dropdown content",
3498
3454
  "type": "boolean",
3499
3455
  "default": "false"
3500
- },
3501
- {
3502
- "name": "documentLocaleSettings",
3503
- "default": "\"getDocumentLocaleSettings()\""
3504
3456
  }
3505
3457
  ],
3506
3458
  "events": [
@@ -3861,10 +3813,6 @@
3861
3813
  "name": "text",
3862
3814
  "type": "string",
3863
3815
  "default": "\"\""
3864
- },
3865
- {
3866
- "name": "documentLocaleSettings",
3867
- "default": "\"getDocumentLocaleSettings()\""
3868
3816
  }
3869
3817
  ]
3870
3818
  },
@@ -3962,10 +3910,6 @@
3962
3910
  "description": "Date/time range input type",
3963
3911
  "type": "'date'|'date-time'",
3964
3912
  "default": "\"date-time\""
3965
- },
3966
- {
3967
- "name": "documentLocaleSettings",
3968
- "default": "\"getDocumentLocaleSettings()\""
3969
3913
  }
3970
3914
  ]
3971
3915
  },
@@ -4304,10 +4248,6 @@
4304
4248
  "name": "openerType",
4305
4249
  "type": "string",
4306
4250
  "default": "\"DEFAULT\""
4307
- },
4308
- {
4309
- "name": "documentLocaleSettings",
4310
- "default": "\"getDocumentLocaleSettings()\""
4311
4251
  }
4312
4252
  ],
4313
4253
  "events": [
@@ -4339,10 +4279,6 @@
4339
4279
  "attribute": "filter-ids",
4340
4280
  "description": "REQUIRED: Id(s) (space-delimited) of the filter component(s) to subscribe to",
4341
4281
  "type": "string"
4342
- },
4343
- {
4344
- "name": "documentLocaleSettings",
4345
- "default": "\"getDocumentLocaleSettings()\""
4346
4282
  }
4347
4283
  ]
4348
4284
  },
@@ -4389,10 +4325,6 @@
4389
4325
  "description": "Indicates if the filter is open",
4390
4326
  "type": "boolean",
4391
4327
  "default": "false"
4392
- },
4393
- {
4394
- "name": "documentLocaleSettings",
4395
- "default": "\"getDocumentLocaleSettings()\""
4396
4328
  }
4397
4329
  ],
4398
4330
  "events": [
@@ -4476,10 +4408,6 @@
4476
4408
  "name": "errors",
4477
4409
  "type": "object",
4478
4410
  "default": "[]"
4479
- },
4480
- {
4481
- "name": "documentLocaleSettings",
4482
- "default": "\"getDocumentLocaleSettings()\""
4483
4411
  }
4484
4412
  ]
4485
4413
  },
@@ -4554,10 +4482,6 @@
4554
4482
  "description": "Indicates that the form should interrupt and warn on navigation if the user has unsaved changes on native elements.",
4555
4483
  "type": "boolean",
4556
4484
  "default": "false"
4557
- },
4558
- {
4559
- "name": "documentLocaleSettings",
4560
- "default": "\"getDocumentLocaleSettings()\""
4561
4485
  }
4562
4486
  ],
4563
4487
  "events": [
@@ -4611,10 +4535,6 @@
4611
4535
  "description": "Indicates that the form should interrupt and warn on navigation if the user has unsaved changes on native elements.",
4612
4536
  "type": "boolean",
4613
4537
  "default": "false"
4614
- },
4615
- {
4616
- "name": "documentLocaleSettings",
4617
- "default": "\"getDocumentLocaleSettings()\""
4618
4538
  }
4619
4539
  ],
4620
4540
  "events": [
@@ -4699,10 +4619,6 @@
4699
4619
  "attribute": "name",
4700
4620
  "description": "Name of the form control. Submitted with the form as part of a name/value pair.",
4701
4621
  "type": "string"
4702
- },
4703
- {
4704
- "name": "documentLocaleSettings",
4705
- "default": "\"getDocumentLocaleSettings()\""
4706
4622
  }
4707
4623
  ]
4708
4624
  },
@@ -5263,10 +5179,6 @@
5263
5179
  "attribute": "name",
5264
5180
  "description": "Name of the form control. Submitted with the form as part of a name/value pair.",
5265
5181
  "type": "string"
5266
- },
5267
- {
5268
- "name": "documentLocaleSettings",
5269
- "default": "\"getDocumentLocaleSettings()\""
5270
5182
  }
5271
5183
  ],
5272
5184
  "events": [
@@ -5495,10 +5407,6 @@
5495
5407
  "attribute": "name",
5496
5408
  "description": "Name of the form control. Submitted with the form as part of a name/value pair.",
5497
5409
  "type": "string"
5498
- },
5499
- {
5500
- "name": "documentLocaleSettings",
5501
- "default": "\"getDocumentLocaleSettings()\""
5502
5410
  }
5503
5411
  ],
5504
5412
  "events": [
@@ -5569,10 +5477,6 @@
5569
5477
  "attribute": "skeleton",
5570
5478
  "description": "Render the component as a [skeleton loader](https://github.com/BrightspaceUI/core/tree/main/components/skeleton).",
5571
5479
  "type": "boolean"
5572
- },
5573
- {
5574
- "name": "documentLocaleSettings",
5575
- "default": "\"getDocumentLocaleSettings()\""
5576
5480
  }
5577
5481
  ]
5578
5482
  },
@@ -5802,10 +5706,6 @@
5802
5706
  "attribute": "name",
5803
5707
  "description": "Name of the form control. Submitted with the form as part of a name/value pair.",
5804
5708
  "type": "string"
5805
- },
5806
- {
5807
- "name": "documentLocaleSettings",
5808
- "default": "\"getDocumentLocaleSettings()\""
5809
5709
  }
5810
5710
  ],
5811
5711
  "events": [
@@ -5995,10 +5895,6 @@
5995
5895
  "attribute": "name",
5996
5896
  "description": "Name of the form control. Submitted with the form as part of a name/value pair.",
5997
5897
  "type": "string"
5998
- },
5999
- {
6000
- "name": "documentLocaleSettings",
6001
- "default": "\"getDocumentLocaleSettings()\""
6002
5898
  }
6003
5899
  ],
6004
5900
  "events": [
@@ -6169,10 +6065,6 @@
6169
6065
  "attribute": "name",
6170
6066
  "description": "Name of the form control. Submitted with the form as part of a name/value pair.",
6171
6067
  "type": "string"
6172
- },
6173
- {
6174
- "name": "documentLocaleSettings",
6175
- "default": "\"getDocumentLocaleSettings()\""
6176
6068
  }
6177
6069
  ],
6178
6070
  "events": [
@@ -6520,10 +6412,6 @@
6520
6412
  "attribute": "name",
6521
6413
  "description": "Name of the form control. Submitted with the form as part of a name/value pair.",
6522
6414
  "type": "string"
6523
- },
6524
- {
6525
- "name": "documentLocaleSettings",
6526
- "default": "\"getDocumentLocaleSettings()\""
6527
6415
  }
6528
6416
  ],
6529
6417
  "events": [
@@ -6705,10 +6593,6 @@
6705
6593
  "attribute": "name",
6706
6594
  "description": "Name of the form control. Submitted with the form as part of a name/value pair.",
6707
6595
  "type": "string"
6708
- },
6709
- {
6710
- "name": "documentLocaleSettings",
6711
- "default": "\"getDocumentLocaleSettings()\""
6712
6596
  }
6713
6597
  ],
6714
6598
  "events": [
@@ -6845,10 +6729,6 @@
6845
6729
  "description": "Value of the input",
6846
6730
  "type": "string",
6847
6731
  "default": "\"\""
6848
- },
6849
- {
6850
- "name": "documentLocaleSettings",
6851
- "default": "\"getDocumentLocaleSettings()\""
6852
6732
  }
6853
6733
  ],
6854
6734
  "events": [
@@ -7210,10 +7090,6 @@
7210
7090
  "description": "Name of the form control. Submitted with the form as part of a name/value pair.",
7211
7091
  "type": "string"
7212
7092
  },
7213
- {
7214
- "name": "documentLocaleSettings",
7215
- "default": "\"getDocumentLocaleSettings()\""
7216
- },
7217
7093
  {
7218
7094
  "name": "skeleton",
7219
7095
  "attribute": "skeleton",
@@ -7455,10 +7331,6 @@
7455
7331
  "description": "Name of the form control. Submitted with the form as part of a name/value pair.",
7456
7332
  "type": "string"
7457
7333
  },
7458
- {
7459
- "name": "documentLocaleSettings",
7460
- "default": "\"getDocumentLocaleSettings()\""
7461
- },
7462
7334
  {
7463
7335
  "name": "skeleton",
7464
7336
  "attribute": "skeleton",
@@ -7700,10 +7572,6 @@
7700
7572
  "attribute": "name",
7701
7573
  "description": "Name of the form control. Submitted with the form as part of a name/value pair.",
7702
7574
  "type": "string"
7703
- },
7704
- {
7705
- "name": "documentLocaleSettings",
7706
- "default": "\"getDocumentLocaleSettings()\""
7707
7575
  }
7708
7576
  ],
7709
7577
  "events": [
@@ -7885,10 +7753,6 @@
7885
7753
  "attribute": "name",
7886
7754
  "description": "Name of the form control. Submitted with the form as part of a name/value pair.",
7887
7755
  "type": "string"
7888
- },
7889
- {
7890
- "name": "documentLocaleSettings",
7891
- "default": "\"getDocumentLocaleSettings()\""
7892
7756
  }
7893
7757
  ],
7894
7758
  "events": [
@@ -7995,10 +7859,6 @@
7995
7859
  "description": "The number of lines to display before truncating text with an ellipsis. The text will not be truncated unless a value is specified.",
7996
7860
  "type": "number",
7997
7861
  "default": "0"
7998
- },
7999
- {
8000
- "name": "documentLocaleSettings",
8001
- "default": "\"getDocumentLocaleSettings()\""
8002
7862
  }
8003
7863
  ],
8004
7864
  "slots": [
@@ -8454,10 +8314,6 @@
8454
8314
  "description": "Render the component as a [skeleton loader](https://github.com/BrightspaceUI/core/tree/main/components/skeleton).",
8455
8315
  "type": "boolean"
8456
8316
  },
8457
- {
8458
- "name": "documentLocaleSettings",
8459
- "default": "\"getDocumentLocaleSettings()\""
8460
- },
8461
8317
  {
8462
8318
  "name": "labelledBy",
8463
8319
  "attribute": "labelled-by",
@@ -8572,10 +8428,6 @@
8572
8428
  },
8573
8429
  {
8574
8430
  "name": "selectionInfo"
8575
- },
8576
- {
8577
- "name": "documentLocaleSettings",
8578
- "default": "\"getDocumentLocaleSettings()\""
8579
8431
  }
8580
8432
  ],
8581
8433
  "events": [
@@ -8808,10 +8660,6 @@
8808
8660
  "description": "Render the component as a [skeleton loader](https://github.com/BrightspaceUI/core/tree/main/components/skeleton).",
8809
8661
  "type": "boolean"
8810
8662
  },
8811
- {
8812
- "name": "documentLocaleSettings",
8813
- "default": "\"getDocumentLocaleSettings()\""
8814
- },
8815
8663
  {
8816
8664
  "name": "labelledBy",
8817
8665
  "attribute": "labelled-by",
@@ -8926,10 +8774,6 @@
8926
8774
  "description": "Disables the handle",
8927
8775
  "type": "boolean",
8928
8776
  "default": "false"
8929
- },
8930
- {
8931
- "name": "documentLocaleSettings",
8932
- "default": "\"getDocumentLocaleSettings()\""
8933
8777
  }
8934
8778
  ],
8935
8779
  "events": [
@@ -8965,10 +8809,6 @@
8965
8809
  "type": "number",
8966
8810
  "default": "0"
8967
8811
  },
8968
- {
8969
- "name": "documentLocaleSettings",
8970
- "default": "\"getDocumentLocaleSettings()\""
8971
- },
8972
8812
  {
8973
8813
  "name": "skeleton",
8974
8814
  "attribute": "skeleton",
@@ -9288,10 +9128,6 @@
9288
9128
  "description": "Render the component as a [skeleton loader](https://github.com/BrightspaceUI/core/tree/main/components/skeleton).",
9289
9129
  "type": "boolean"
9290
9130
  },
9291
- {
9292
- "name": "documentLocaleSettings",
9293
- "default": "\"getDocumentLocaleSettings()\""
9294
- },
9295
9131
  {
9296
9132
  "name": "labelledBy",
9297
9133
  "attribute": "labelled-by",
@@ -9917,10 +9753,6 @@
9917
9753
  }
9918
9754
  ],
9919
9755
  "properties": [
9920
- {
9921
- "name": "documentLocaleSettings",
9922
- "default": "\"getDocumentLocaleSettings()\""
9923
- },
9924
9756
  {
9925
9757
  "name": "text",
9926
9758
  "attribute": "text",
@@ -10117,10 +9949,6 @@
10117
9949
  "description": "REQUIRED: Current number of completed units.\nValid values: A number between 0 and max",
10118
9950
  "type": "number",
10119
9951
  "default": "0"
10120
- },
10121
- {
10122
- "name": "documentLocaleSettings",
10123
- "default": "\"getDocumentLocaleSettings()\""
10124
9952
  }
10125
9953
  ]
10126
9954
  },
@@ -10193,10 +10021,6 @@
10193
10021
  "description": "REQUIRED: Current number of completed units.\nValid values: A number between 0 and max",
10194
10022
  "type": "number",
10195
10023
  "default": "0"
10196
- },
10197
- {
10198
- "name": "documentLocaleSettings",
10199
- "default": "\"getDocumentLocaleSettings()\""
10200
10024
  }
10201
10025
  ]
10202
10026
  },
@@ -10256,10 +10080,6 @@
10256
10080
  "description": "REQUIRED: Current number of completed units.\nValid values: A number between 0 and max",
10257
10081
  "type": "number",
10258
10082
  "default": "0"
10259
- },
10260
- {
10261
- "name": "documentLocaleSettings",
10262
- "default": "\"getDocumentLocaleSettings()\""
10263
10083
  }
10264
10084
  ]
10265
10085
  },
@@ -10330,10 +10150,6 @@
10330
10150
  "description": "Whether the component is active or inactive",
10331
10151
  "type": "boolean",
10332
10152
  "default": "false"
10333
- },
10334
- {
10335
- "name": "documentLocaleSettings",
10336
- "default": "\"getDocumentLocaleSettings()\""
10337
10153
  }
10338
10154
  ],
10339
10155
  "slots": [
@@ -10495,10 +10311,6 @@
10495
10311
  "description": "Number of skeleton items to insert",
10496
10312
  "type": "number"
10497
10313
  },
10498
- {
10499
- "name": "documentLocaleSettings",
10500
- "default": "\"getDocumentLocaleSettings()\""
10501
- },
10502
10314
  {
10503
10315
  "name": "skeleton",
10504
10316
  "attribute": "skeleton",
@@ -10602,10 +10414,6 @@
10602
10414
  "name": "openerType",
10603
10415
  "type": "string",
10604
10416
  "default": "\"DEFAULT\""
10605
- },
10606
- {
10607
- "name": "documentLocaleSettings",
10608
- "default": "\"getDocumentLocaleSettings()\""
10609
10417
  }
10610
10418
  ],
10611
10419
  "events": [
@@ -10662,10 +10470,6 @@
10662
10470
  "attribute": "pageable-for",
10663
10471
  "description": "Id of the `PageableMixin` component this component wants to observe (if not located within that component)",
10664
10472
  "type": "string"
10665
- },
10666
- {
10667
- "name": "documentLocaleSettings",
10668
- "default": "\"getDocumentLocaleSettings()\""
10669
10473
  }
10670
10474
  ],
10671
10475
  "events": [
@@ -11000,10 +10804,6 @@
11000
10804
  "description": "REQUIRED: Text for the dropdown opener button",
11001
10805
  "type": "string"
11002
10806
  },
11003
- {
11004
- "name": "documentLocaleSettings",
11005
- "default": "\"getDocumentLocaleSettings()\""
11006
- },
11007
10807
  {
11008
10808
  "name": "requiresSelection",
11009
10809
  "attribute": "requires-selection",
@@ -11217,10 +11017,6 @@
11217
11017
  "description": "REQUIRED: The text for the action",
11218
11018
  "type": "string"
11219
11019
  },
11220
- {
11221
- "name": "documentLocaleSettings",
11222
- "default": "\"getDocumentLocaleSettings()\""
11223
- },
11224
11020
  {
11225
11021
  "name": "requiresSelection",
11226
11022
  "attribute": "requires-selection",
@@ -11344,10 +11140,6 @@
11344
11140
  },
11345
11141
  {
11346
11142
  "name": "selectionInfo"
11347
- },
11348
- {
11349
- "name": "documentLocaleSettings",
11350
- "default": "\"getDocumentLocaleSettings()\""
11351
11143
  }
11352
11144
  ],
11353
11145
  "events": [
@@ -11467,10 +11259,6 @@
11467
11259
  }
11468
11260
  ],
11469
11261
  "properties": [
11470
- {
11471
- "name": "documentLocaleSettings",
11472
- "default": "\"getDocumentLocaleSettings()\""
11473
- },
11474
11262
  {
11475
11263
  "name": "selectionFor",
11476
11264
  "attribute": "selection-for",
@@ -11513,10 +11301,6 @@
11513
11301
  "type": "boolean",
11514
11302
  "default": "false"
11515
11303
  },
11516
- {
11517
- "name": "documentLocaleSettings",
11518
- "default": "\"getDocumentLocaleSettings()\""
11519
- },
11520
11304
  {
11521
11305
  "name": "selectionFor",
11522
11306
  "attribute": "selection-for",
@@ -11557,10 +11341,6 @@
11557
11341
  "description": "Text to display if no items are selected",
11558
11342
  "type": "string"
11559
11343
  },
11560
- {
11561
- "name": "documentLocaleSettings",
11562
- "default": "\"getDocumentLocaleSettings()\""
11563
- },
11564
11344
  {
11565
11345
  "name": "selectionFor",
11566
11346
  "attribute": "selection-for",
@@ -12048,10 +11828,6 @@
12048
11828
  "name": "onIcon",
12049
11829
  "type": "TemplateResult<1>"
12050
11830
  },
12051
- {
12052
- "name": "documentLocaleSettings",
12053
- "default": "\"getDocumentLocaleSettings()\""
12054
- },
12055
11831
  {
12056
11832
  "name": "disabled",
12057
11833
  "attribute": "disabled",
@@ -12455,10 +12231,6 @@
12455
12231
  "description": "The type of data in the column. Used to set the title.",
12456
12232
  "type": "'words'|'numbers'|'dates'|'unknown'",
12457
12233
  "default": "\"unknown\""
12458
- },
12459
- {
12460
- "name": "documentLocaleSettings",
12461
- "default": "\"getDocumentLocaleSettings()\""
12462
12234
  }
12463
12235
  ],
12464
12236
  "slots": [
@@ -12549,10 +12321,6 @@
12549
12321
  },
12550
12322
  {
12551
12323
  "name": "selectionInfo"
12552
- },
12553
- {
12554
- "name": "documentLocaleSettings",
12555
- "default": "\"getDocumentLocaleSettings()\""
12556
12324
  }
12557
12325
  ],
12558
12326
  "events": [
@@ -12828,10 +12596,6 @@
12828
12596
  "type": "number",
12829
12597
  "default": "-1"
12830
12598
  },
12831
- {
12832
- "name": "documentLocaleSettings",
12833
- "default": "\"getDocumentLocaleSettings()\""
12834
- },
12835
12599
  {
12836
12600
  "name": "arrowKeysDirection",
12837
12601
  "type": "string",
@@ -12917,10 +12681,6 @@
12917
12681
  "description": "Enables the option to clear a tag list item. The `d2l-tag-list-item-clear` event will be dispatched when the user selects to delete the item. The consumer must handle the actual item deletion.",
12918
12682
  "type": "boolean",
12919
12683
  "default": "false"
12920
- },
12921
- {
12922
- "name": "documentLocaleSettings",
12923
- "default": "\"getDocumentLocaleSettings()\""
12924
12684
  }
12925
12685
  ],
12926
12686
  "events": [
@@ -12973,10 +12733,6 @@
12973
12733
  "type": "number",
12974
12734
  "default": "0"
12975
12735
  },
12976
- {
12977
- "name": "documentLocaleSettings",
12978
- "default": "\"getDocumentLocaleSettings()\""
12979
- },
12980
12736
  {
12981
12737
  "name": "arrowKeysDirection",
12982
12738
  "type": "string",
@@ -13033,10 +12789,6 @@
13033
12789
  "description": "Enables the option to clear a tag list item. The `d2l-tag-list-item-clear` event will be dispatched when the user selects to delete the item. The consumer must handle the actual item deletion.",
13034
12790
  "type": "boolean",
13035
12791
  "default": "false"
13036
- },
13037
- {
13038
- "name": "documentLocaleSettings",
13039
- "default": "\"getDocumentLocaleSettings()\""
13040
12792
  }
13041
12793
  ],
13042
12794
  "events": [
@@ -13408,10 +13160,6 @@
13408
13160
  "description": "Whether content fills the screen or not",
13409
13161
  "type": "'fullscreen'|'normal'",
13410
13162
  "default": "\"fullscreen\""
13411
- },
13412
- {
13413
- "name": "documentLocaleSettings",
13414
- "default": "\"getDocumentLocaleSettings()\""
13415
13163
  }
13416
13164
  ],
13417
13165
  "events": [
@@ -1,70 +1,32 @@
1
- import '@formatjs/intl-pluralrules/dist-es6/polyfill-locales.js';
2
- import { defaultLocale as fallbackLang, getDocumentLocaleSettings, supportedLangpacks } from '@brightspace-ui/intl/lib/common.js';
1
+ import { disallowedTagsRegex, getLocalizeClass, validateMarkup } from './localize.js';
3
2
  import { dedupeMixin } from '@open-wc/dedupe-mixin';
4
- import { getLocalizeOverrideResources } from '../../helpers/getLocalizeResources.js';
5
3
  import { html } from 'lit';
6
4
  import { ifDefined } from 'lit/directives/if-defined.js';
7
- import IntlMessageFormat from 'intl-messageformat';
8
5
 
9
- export const _LocalizeMixinBase = dedupeMixin(superclass => class LocalizeMixinClass extends superclass {
6
+ export const _LocalizeMixinBase = dedupeMixin(superclass => class LocalizeMixinBaseClass extends getLocalizeClass(superclass) {
10
7
 
11
- static get properties() {
12
- return {
13
- __resources: { type: Object, attribute: false }
14
- };
15
- }
16
-
17
- static documentLocaleSettings = getDocumentLocaleSettings();
8
+ #updatedProperties = new Map();
18
9
 
19
10
  constructor() {
20
11
  super();
21
- this.__resourcesLoadedPromise = new Promise((resolve) => {
22
- let first = true;
23
- this.__languageChangeCallback = () => {
24
- if (!this._hasResources()) return;
25
- const localizeResources = this.constructor._getAllLocalizeResources();
26
- const resourcesLoadedPromise = Promise.all(localizeResources);
27
- resourcesLoadedPromise
28
- .then((results) => {
29
- if (results.length === 0) {
30
- return;
31
- }
32
- const resources = {};
33
- for (const res of results) {
34
- const language = res.language;
35
- for (const [key, value] of Object.entries(res.resources)) {
36
- resources[key] = { language, value };
37
- }
38
- }
39
- this.__resources = resources;
40
- this._onResourcesChange();
41
- if (first) {
42
- resolve();
43
- first = false;
44
- }
45
- });
46
- };
47
- });
48
-
49
- this.__updatedProperties = new Map();
12
+ super.constructor.setLocalizeMarkup(localizeMarkup);
50
13
  }
51
14
 
52
15
  connectedCallback() {
53
16
  super.connectedCallback();
54
- this.constructor.documentLocaleSettings.addChangeListener(this.__languageChangeCallback);
55
- this.__languageChangeCallback();
17
+ this.connect();
56
18
  }
57
19
 
58
20
  disconnectedCallback() {
59
21
  super.disconnectedCallback();
60
- this.constructor.documentLocaleSettings.removeChangeListener(this.__languageChangeCallback);
61
- this.__updatedProperties.clear();
22
+ this.disconnect();
23
+ this.#updatedProperties.clear();
62
24
  }
63
25
 
64
26
  async getUpdateComplete() {
65
27
  await super.getUpdateComplete();
66
28
  const hasResources = this._hasResources();
67
- const resourcesLoaded = this.__resources !== undefined;
29
+ const resourcesLoaded = this.localize.resources !== undefined && !this.pristine;
68
30
  if (!hasResources || resourcesLoaded) {
69
31
  return;
70
32
  }
@@ -78,148 +40,35 @@ export const _LocalizeMixinBase = dedupeMixin(superclass => class LocalizeMixinC
78
40
  return super.shouldUpdate(changedProperties);
79
41
  }
80
42
 
81
- const ready = this.__resources !== undefined;
43
+ const ready = this.localize.resources !== undefined && !this.pristine;
44
+
82
45
  if (!ready) {
83
46
  changedProperties.forEach((oldValue, propName) => {
84
- this.__updatedProperties.set(propName, oldValue);
47
+ this.#updatedProperties.set(propName, oldValue);
85
48
  });
86
49
  return false;
87
50
  }
88
51
 
89
- this.__updatedProperties.forEach((oldValue, propName) => {
52
+ this.#updatedProperties.forEach((oldValue, propName) => {
90
53
  if (!changedProperties.has(propName)) {
91
54
  changedProperties.set(propName, oldValue);
92
55
  }
93
56
  });
94
- this.__updatedProperties.clear();
57
+ this.#updatedProperties.clear();
95
58
 
96
59
  return super.shouldUpdate(changedProperties);
97
-
98
- }
99
-
100
- localize(key) {
101
-
102
- const { language, value } = this.__resources?.[key] ?? {};
103
- if (!value) return '';
104
-
105
- let params = {};
106
- if (arguments.length > 1 && arguments[1]?.constructor === Object) {
107
- // support for key-value replacements as a single arg
108
- params = arguments[1];
109
- } else {
110
- // legacy support for localize-behavior replacements as many args
111
- for (let i = 1; i < arguments.length; i += 2) {
112
- params[arguments[i]] = arguments[i + 1];
113
- }
114
- }
115
-
116
- const translatedMessage = new IntlMessageFormat(value, language);
117
- let formattedMessage = value;
118
- try {
119
- if (Object.values(params).some(v => typeof v === 'function')) throw 'localize() does not support rich text.';
120
- formattedMessage = translatedMessage.format(params);
121
- } catch (e) {
122
- console.error(e);
123
- }
124
-
125
- return formattedMessage;
126
60
  }
127
61
 
128
- localizeHTML(key, params = {}) {
129
-
130
- const { language, value } = this.__resources?.[key] ?? {};
131
- if (!value) return '';
132
-
133
- const translatedMessage = new IntlMessageFormat(value, language);
134
- let formattedMessage = value;
135
- try {
136
- const unvalidated = translatedMessage.format({
137
- b: chunks => localizeMarkup`<b>${chunks}</b>`,
138
- br: () => localizeMarkup`<br>`,
139
- em: chunks => localizeMarkup`<em>${chunks}</em>`,
140
- i: chunks => localizeMarkup`<i>${chunks}</i>`,
141
- p: chunks => localizeMarkup`<p>${chunks}</p>`,
142
- strong: chunks => localizeMarkup`<strong>${chunks}</strong>`,
143
- ...params
144
- });
145
- validateMarkup(unvalidated);
146
- formattedMessage = unvalidated;
147
- } catch (e) {
148
- console.error(e);
149
- }
150
-
151
- return formattedMessage;
152
- }
153
-
154
- static _generatePossibleLanguages(config) {
155
-
156
- if (config?.useBrowserLangs) return navigator.languages.map(e => e.toLowerCase()).concat('en');
157
-
158
- const { language, fallbackLanguage } = this.documentLocaleSettings;
159
- const langs = [ language, fallbackLanguage ]
160
- .filter(e => e)
161
- .map(e => [ e.toLowerCase(), e.split('-')[0] ])
162
- .flat();
163
-
164
- return Array.from(new Set([ ...langs, 'en-us', 'en' ]));
165
- }
166
-
167
- static _getAllLocalizeResources(config = this.localizeConfig) {
168
- let resourcesLoadedPromises = [];
169
- const superCtor = Object.getPrototypeOf(this);
170
- // get imported terms for each config, head up the chain to get them all
171
- if ('_getAllLocalizeResources' in superCtor) {
172
- const superConfig = Object.prototype.hasOwnProperty.call(superCtor, 'localizeConfig') && superCtor.localizeConfig.importFunc ? superCtor.localizeConfig : config;
173
- resourcesLoadedPromises = superCtor._getAllLocalizeResources(superConfig);
174
- }
175
- if (Object.prototype.hasOwnProperty.call(this, 'getLocalizeResources') || Object.prototype.hasOwnProperty.call(this, 'resources')) {
176
- const possibleLanguages = this._generatePossibleLanguages(config);
177
- const res = this.getLocalizeResources(possibleLanguages, config);
178
- resourcesLoadedPromises.push(res);
179
- }
180
- return resourcesLoadedPromises;
181
- }
182
-
183
- _hasResources() {
184
- return this.constructor['getLocalizeResources'] !== undefined;
185
- }
186
-
187
- _onResourcesChange() {
188
- /** @ignore */
189
- this.dispatchEvent(new CustomEvent('d2l-localize-resources-change'));
62
+ onLocalizeResourcesChange() {
63
+ this.requestUpdate('localize');
190
64
  }
191
65
 
192
66
  });
193
67
 
194
68
  export const LocalizeMixin = superclass => class extends _LocalizeMixinBase(superclass) {
195
69
 
196
- static async getLocalizeResources(langs, { importFunc, osloCollection, useBrowserLangs }) {
197
-
198
- // in dev, don't request unsupported langpacks
199
- if (!importFunc.toString().includes('switch') && !useBrowserLangs) {
200
- langs = langs.filter(lang => supportedLangpacks.includes(lang));
201
- }
202
-
203
- for (const lang of [...langs, fallbackLang]) {
204
-
205
- const resources = await Promise.resolve(importFunc(lang)).catch(() => {});
206
-
207
- if (resources) {
208
-
209
- if (osloCollection) {
210
- return await getLocalizeOverrideResources(
211
- lang,
212
- resources,
213
- () => osloCollection
214
- );
215
- }
216
-
217
- return {
218
- language: lang,
219
- resources
220
- };
221
- }
222
- }
70
+ static getLocalizeResources() {
71
+ return super._getLocalizeResources(...arguments);
223
72
  }
224
73
 
225
74
  static get localizeConfig() {
@@ -228,25 +77,9 @@ export const LocalizeMixin = superclass => class extends _LocalizeMixinBase(supe
228
77
 
229
78
  };
230
79
 
231
- export const allowedTags = Object.freeze(['d2l-link', 'd2l-tooltip-help', 'p', 'br', 'b', 'strong', 'i', 'em', 'button']);
232
-
233
- const markupError = `localizeHTML() rich-text replacements must use localizeMarkup templates with only the following allowed elements: ${allowedTags}. For more information, see: https://github.com/BrightspaceUI/core/blob/main/mixins/localize/`;
234
- const validTerminators = '([>\\s/]|$)';
235
- const allowedAfterTriangleBracket = `/?(${allowedTags.join('|')})?${validTerminators}`;
236
- const disallowedTagsRegex = new RegExp(`<(?!${allowedAfterTriangleBracket})`);
237
-
238
- function validateMarkup(content, applyRegex) {
239
- if (content) {
240
- if (content.map) return content.forEach(item => validateMarkup(item));
241
- if (content._localizeMarkup) return;
242
- if (Object.hasOwn(content, '_$litType$')) throw markupError;
243
- if (applyRegex && content.constructor === String && disallowedTagsRegex.test(content)) throw markupError;
244
- }
245
- }
246
-
247
80
  export function localizeMarkup(strings, ...expressions) {
248
- strings.forEach(str => validateMarkup(str, true));
249
- expressions.forEach(exp => validateMarkup(exp, true));
81
+ strings.forEach(str => validateMarkup(str, disallowedTagsRegex));
82
+ expressions.forEach(exp => validateMarkup(exp, disallowedTagsRegex));
250
83
  return { ...html(strings, ...expressions), _localizeMarkup: true };
251
84
  }
252
85
 
@@ -0,0 +1,255 @@
1
+ import '@formatjs/intl-pluralrules/dist-es6/polyfill-locales.js';
2
+ import { defaultLocale as fallbackLang, getDocumentLocaleSettings, supportedLangpacks } from '@brightspace-ui/intl/lib/common.js';
3
+ import { getLocalizeOverrideResources } from '../../helpers/getLocalizeResources.js';
4
+ import IntlMessageFormat from 'intl-messageformat';
5
+
6
+ export const allowedTags = Object.freeze(['d2l-link', 'd2l-tooltip-help', 'p', 'br', 'b', 'strong', 'i', 'em', 'button']);
7
+
8
+ const getDisallowedTagsRegex = allowedTags => {
9
+ const validTerminators = '([>\\s/]|$)';
10
+ const allowedAfterTriangleBracket = `/?(${allowedTags.join('|')})?${validTerminators}`;
11
+ return new RegExp(`<(?!${allowedAfterTriangleBracket})`);
12
+ };
13
+
14
+ export const disallowedTagsRegex = getDisallowedTagsRegex(allowedTags);
15
+ const noAllowedTagsRegex = getDisallowedTagsRegex([]);
16
+
17
+ export const getLocalizeClass = (superclass = class {}) => class LocalizeClass extends superclass {
18
+
19
+ static documentLocaleSettings = getDocumentLocaleSettings();
20
+ static #localizeMarkup;
21
+
22
+ static setLocalizeMarkup(localizeMarkup) {
23
+ this.#localizeMarkup ??= localizeMarkup;
24
+ }
25
+
26
+ pristine = true;
27
+ #connected = false;
28
+ #localeChangeCallback;
29
+ #resourcesPromise;
30
+ #resolveResourcesLoaded;
31
+
32
+ async #localeChangeHandler() {
33
+ if (!this._hasResources()) return;
34
+
35
+ const resourcesPromise = this.constructor._getAllLocalizeResources(this.config);
36
+ this.#resourcesPromise = resourcesPromise;
37
+ const localizeResources = (await resourcesPromise).flat(Infinity);
38
+ // If the locale changed while resources were being fetched, abort
39
+ if (this.#resourcesPromise !== resourcesPromise) return;
40
+
41
+ const allResources = {};
42
+ const resolvedLocales = new Set();
43
+ for (const { language, resources } of localizeResources) {
44
+ for (const [key, value] of Object.entries(resources)) {
45
+ allResources[key] = { language, value };
46
+ resolvedLocales.add(language);
47
+ }
48
+ }
49
+ this.localize.resources = allResources;
50
+ this.localize.resolvedLocale = [...resolvedLocales][0];
51
+ if (resolvedLocales.size > 1) {
52
+ console.warn(`Resolved multiple locales in '${this.constructor.name || this.tagName || ''}': ${[...resolvedLocales].join(', ')}`);
53
+ }
54
+
55
+ if (this.pristine) {
56
+ this.pristine = false;
57
+ this.#resolveResourcesLoaded();
58
+ }
59
+
60
+ this.#onResourcesChange();
61
+ }
62
+
63
+ #onResourcesChange() {
64
+ if (this.#connected) {
65
+ this.dispatchEvent?.(new CustomEvent('d2l-localize-resources-change'));
66
+ this.config?.onResourcesChange?.();
67
+ this.onLocalizeResourcesChange?.();
68
+ }
69
+ }
70
+
71
+ connect() {
72
+ this.#localeChangeCallback = () => this.#localeChangeHandler();
73
+ LocalizeClass.documentLocaleSettings.addChangeListener(this.#localeChangeCallback);
74
+ this.#connected = true;
75
+ this.#localeChangeCallback();
76
+ }
77
+
78
+ disconnect() {
79
+ LocalizeClass.documentLocaleSettings.removeChangeListener(this.#localeChangeCallback);
80
+ this.#connected = false;
81
+ }
82
+
83
+ localize(key) {
84
+
85
+ const { language, value } = this.localize.resources?.[key] ?? {};
86
+ if (!value) return '';
87
+
88
+ let params = {};
89
+ if (arguments.length > 1 && arguments[1]?.constructor === Object) {
90
+ // support for key-value replacements as a single arg
91
+ params = arguments[1];
92
+ } else {
93
+ // legacy support for localize-behavior replacements as many args
94
+ for (let i = 1; i < arguments.length; i += 2) {
95
+ params[arguments[i]] = arguments[i + 1];
96
+ }
97
+ }
98
+
99
+ const translatedMessage = new IntlMessageFormat(value, language);
100
+ let formattedMessage = value;
101
+ try {
102
+ validateMarkup(formattedMessage, noAllowedTagsRegex);
103
+ formattedMessage = translatedMessage.format(params);
104
+ } catch (e) {
105
+ if (e.name === 'MarkupError') {
106
+ e = new Error('localize() does not support rich text. For more information, see: https://github.com/BrightspaceUI/core/blob/main/mixins/localize/'); // eslint-disable-line no-ex-assign
107
+ formattedMessage = '';
108
+ }
109
+ console.error(e);
110
+ }
111
+
112
+ return formattedMessage;
113
+ }
114
+
115
+ localizeHTML(key, params = {}) {
116
+
117
+ const { language, value } = this.localize.resources?.[key] ?? {};
118
+ if (!value) return '';
119
+
120
+ const translatedMessage = new IntlMessageFormat(value, language);
121
+ let formattedMessage = value;
122
+ try {
123
+ const unvalidated = translatedMessage.format({
124
+ b: chunks => LocalizeClass.#localizeMarkup`<b>${chunks}</b>`,
125
+ br: () => LocalizeClass.#localizeMarkup`<br>`,
126
+ em: chunks => LocalizeClass.#localizeMarkup`<em>${chunks}</em>`,
127
+ i: chunks => LocalizeClass.#localizeMarkup`<i>${chunks}</i>`,
128
+ p: chunks => LocalizeClass.#localizeMarkup`<p>${chunks}</p>`,
129
+ strong: chunks => LocalizeClass.#localizeMarkup`<strong>${chunks}</strong>`,
130
+ ...params
131
+ });
132
+ validateMarkup(unvalidated);
133
+ formattedMessage = unvalidated;
134
+ } catch (e) {
135
+ if (e.name === 'MarkupError') formattedMessage = '';
136
+ console.error(e);
137
+ }
138
+
139
+ return formattedMessage;
140
+ }
141
+
142
+ __resourcesLoadedPromise = new Promise(r => this.#resolveResourcesLoaded = r);
143
+
144
+ static _generatePossibleLanguages(config) {
145
+
146
+ if (config?.useBrowserLangs) return navigator.languages.map(e => e.toLowerCase()).concat('en');
147
+
148
+ const { language, fallbackLanguage } = this.documentLocaleSettings;
149
+ const langs = [ language, fallbackLanguage ]
150
+ .filter(e => e)
151
+ .map(e => [ e.toLowerCase(), e.split('-')[0] ])
152
+ .flat();
153
+
154
+ return Array.from(new Set([ ...langs, 'en-us', 'en' ]));
155
+ }
156
+
157
+ static _getAllLocalizeResources(config = this.localizeConfig) {
158
+ const resourcesLoadedPromises = [];
159
+ const superCtor = Object.getPrototypeOf(this);
160
+ // get imported terms for each config, head up the chain to get them all
161
+ if ('_getAllLocalizeResources' in superCtor) {
162
+ const superConfig = Object.prototype.hasOwnProperty.call(superCtor, 'localizeConfig') && superCtor.localizeConfig.importFunc ? superCtor.localizeConfig : config;
163
+ resourcesLoadedPromises.push(superCtor._getAllLocalizeResources(superConfig));
164
+ }
165
+ if (Object.prototype.hasOwnProperty.call(this, 'getLocalizeResources') || Object.prototype.hasOwnProperty.call(this, 'resources')) {
166
+ const possibleLanguages = this._generatePossibleLanguages(config);
167
+ const resourcesPromise = this.getLocalizeResources(possibleLanguages, config);
168
+ resourcesLoadedPromises.push(resourcesPromise);
169
+ }
170
+ return Promise.all(resourcesLoadedPromises);
171
+ }
172
+
173
+ static async _getLocalizeResources(langs, { importFunc, osloCollection, useBrowserLangs }) {
174
+
175
+ // in dev, don't request unsupported langpacks
176
+ if (!importFunc.toString().includes('switch') && !useBrowserLangs) {
177
+ langs = langs.filter(lang => supportedLangpacks.includes(lang));
178
+ }
179
+
180
+ for (const lang of [...langs, fallbackLang]) {
181
+
182
+ const resources = await Promise.resolve(importFunc(lang)).catch(() => {});
183
+
184
+ if (resources) {
185
+
186
+ if (osloCollection) {
187
+ return await getLocalizeOverrideResources(
188
+ lang,
189
+ resources,
190
+ () => osloCollection
191
+ );
192
+ }
193
+
194
+ return {
195
+ language: lang,
196
+ resources
197
+ };
198
+ }
199
+ }
200
+ }
201
+
202
+ _hasResources() {
203
+ return this.constructor.localizeConfig ? Boolean(this.constructor.localizeConfig.importFunc) : this.constructor.getLocalizeResources !== undefined;
204
+ }
205
+
206
+ };
207
+
208
+ export const Localize = class extends getLocalizeClass() {
209
+
210
+ static getLocalizeResources() {
211
+ return super._getLocalizeResources(...arguments);
212
+ }
213
+
214
+ constructor(config) {
215
+ super();
216
+ super.constructor.setLocalizeMarkup(localizeMarkup);
217
+ this.config = config;
218
+ this.connect();
219
+ }
220
+
221
+ get ready() {
222
+ return this.__resourcesLoadedPromise;
223
+ }
224
+
225
+ connect() {
226
+ super.connect();
227
+ return this.ready;
228
+ }
229
+
230
+ };
231
+
232
+ class MarkupError extends Error {
233
+ name = this.constructor.name;
234
+ }
235
+
236
+ export function validateMarkup(content, disallowedTagsRegex) {
237
+ if (content) {
238
+ if (content.forEach) {
239
+ content.forEach(item => validateMarkup(item));
240
+ return;
241
+ }
242
+ if (content._localizeMarkup) return;
243
+ if (Object.hasOwn(content, '_$litType$')) throw new MarkupError('Rich-text replacements must use localizeMarkup templates. For more information, see: https://github.com/BrightspaceUI/core/blob/main/mixins/localize/');
244
+
245
+ if (content.constructor === String && disallowedTagsRegex?.test(content)) throw new MarkupError(`Rich-text replacements may use only the following allowed elements: ${allowedTags}. For more information, see: https://github.com/BrightspaceUI/core/blob/main/mixins/localize/`);
246
+ }
247
+ }
248
+
249
+ export function localizeMarkup(strings, ...expressions) {
250
+ strings.forEach(str => validateMarkup(str, disallowedTagsRegex));
251
+ expressions.forEach(exp => validateMarkup(exp, disallowedTagsRegex));
252
+ return strings.reduce((acc, i, idx) => {
253
+ return acc.push(i, expressions[idx] ?? '') && acc;
254
+ }, []).join('');
255
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.31.0",
3
+ "version": "3.32.0",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/BrightspaceUI/core.git",