@rcarls/rc-select 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,9 +44,16 @@
44
44
  "kind": "javascript-module",
45
45
  "path": "src/rc-select.ts",
46
46
  "declarations": [
47
+ {
48
+ "kind": "variable",
49
+ "name": "DEFAULT_SELECT_MESSAGES",
50
+ "type": {
51
+ "text": "Readonly<RCSelectMessages>"
52
+ }
53
+ },
47
54
  {
48
55
  "kind": "class",
49
- "description": "Select-only combobox backed by a native <select>, following the WAI-ARIA Combobox\npattern.\n\nWraps a native `<select>` (default slot) as the form value reflector while\nrendering a custom button trigger and popup listbox. Popup placement\nand `aria-activedescendant` virtual keyboard navigation are supported.",
56
+ "description": "Select-only combobox backed by a native <select>, following the WAI-ARIA Combobox\npattern.\n\nWraps a native `<select>` (default slot) as the form value reflector while\nrendering a custom button trigger and popup listbox. Popup placement\nand `aria-activedescendant` virtual keyboard navigation are supported.\n\nThe fullscreen dialog popup (`popup-mode=\"dialog\"`) and the selected-value\nchips of a `multiple` select load on first use, so a popover single select\nships neither. Importing `@rcarls/rc-select/define` therefore no longer\nregisters `rc-dialog` or `rc-chip-group` by itself.",
50
57
  "name": "RCSelect",
51
58
  "cssProperties": [
52
59
  {
@@ -87,22 +94,37 @@
87
94
  {
88
95
  "description": "Popup listbox border radius.",
89
96
  "name": "--rc-select-listbox-radius",
90
- "default": "var(--rc-control-radius)"
97
+ "default": "var(--rc-popup-radius)"
98
+ },
99
+ {
100
+ "description": "Popup listbox open/close fade transition duration.",
101
+ "name": "--rc-select-listbox-duration",
102
+ "default": "150ms"
91
103
  },
92
104
  {
93
105
  "description": "Popup listbox border.",
94
106
  "name": "--rc-select-listbox-border",
95
- "default": "var(--rc-border)"
107
+ "default": "var(--rc-popup-border)"
108
+ },
109
+ {
110
+ "description": "Popup listbox background.",
111
+ "name": "--rc-select-listbox-background",
112
+ "default": "var(--rc-popup-background)"
113
+ },
114
+ {
115
+ "description": "Popup listbox text color.",
116
+ "name": "--rc-select-listbox-color",
117
+ "default": "var(--rc-popup-color)"
96
118
  },
97
119
  {
98
120
  "description": "Popup listbox box shadow.",
99
121
  "name": "--rc-select-shadow",
100
- "default": "var(--rc-shadow)"
122
+ "default": "var(--rc-popup-shadow)"
101
123
  },
102
124
  {
103
125
  "description": "Popup listbox block padding.",
104
126
  "name": "--rc-select-listbox-padding-block",
105
- "default": "var(--rc-control-padding-block)"
127
+ "default": "var(--rc-popup-padding-block)"
106
128
  },
107
129
  {
108
130
  "description": "Multi-select chip border radius.",
@@ -115,12 +137,17 @@
115
137
  "default": "0.1em"
116
138
  },
117
139
  {
118
- "description": "Multi-select chip inline-axis padding.",
119
- "name": "--rc-select-chip-padding-inline",
140
+ "description": "Multi-select chip leading padding.",
141
+ "name": "--rc-select-chip-padding-inline-start",
120
142
  "default": "0.3em"
121
143
  },
122
144
  {
123
- "description": "Gap between chip label and remove icon.",
145
+ "description": "Multi-select chip trailing padding, including the remove affordance.",
146
+ "name": "--rc-select-chip-padding-inline-end",
147
+ "default": "calc(var(--rc-chip-remove-target-size, 1.5rem) + var(--rc-chip-remove-offset-inline, 0.125rem))"
148
+ },
149
+ {
150
+ "description": "Gap between chip content items.",
124
151
  "name": "--rc-select-chip-gap",
125
152
  "default": "calc(var(--rc-control-gap, 0.25em) * 0.8)"
126
153
  },
@@ -129,10 +156,40 @@
129
156
  "name": "--rc-select-chip-border",
130
157
  "default": "var(--rc-border)"
131
158
  },
159
+ {
160
+ "description": "Inherited remove-target width reserved by generated multi-select chips.",
161
+ "name": "--rc-chip-remove-target-size",
162
+ "default": "1.5rem"
163
+ },
164
+ {
165
+ "description": "Inherited edge offset reserved by generated multi-select chips.",
166
+ "name": "--rc-chip-remove-offset-inline",
167
+ "default": "0.125rem"
168
+ },
169
+ {
170
+ "description": "Space returned between wrapped chip rows after a touch target overlaps the field's leading padding.",
171
+ "name": "--rc-chip-touch-target-overlap-block-start",
172
+ "default": "0px"
173
+ },
174
+ {
175
+ "description": "Space returned between wrapped chip rows after a touch target overlaps the field's trailing padding.",
176
+ "name": "--rc-chip-touch-target-overlap-block-end",
177
+ "default": "0px"
178
+ },
132
179
  {
133
180
  "description": "Inline size of the toggle indicator container.",
134
181
  "name": "--rc-select-toggle-indicator-size",
135
182
  "default": "1.1em"
183
+ },
184
+ {
185
+ "description": "Gap between fullscreen dialog regions.",
186
+ "name": "--rc-select-dialog-gap",
187
+ "default": "1rem"
188
+ },
189
+ {
190
+ "description": "Gap between fullscreen dialog header slots.",
191
+ "name": "--rc-select-dialog-header-gap",
192
+ "default": "0.5rem"
136
193
  }
137
194
  ],
138
195
  "cssParts": [
@@ -171,6 +228,42 @@
171
228
  {
172
229
  "description": "The `<rc-listbox>` popup element.",
173
230
  "name": "listbox"
231
+ },
232
+ {
233
+ "description": "Dialog popup surface.",
234
+ "name": "dialog"
235
+ },
236
+ {
237
+ "description": "Managed leading/title/trailing header.",
238
+ "name": "dialog-header"
239
+ },
240
+ {
241
+ "description": "Leading button that discards pending changes.",
242
+ "name": "dialog-cancel"
243
+ },
244
+ {
245
+ "description": "Decorative close icon inside the cancel button.",
246
+ "name": "dialog-cancel-icon"
247
+ },
248
+ {
249
+ "description": "Visible dialog title.",
250
+ "name": "dialog-title"
251
+ },
252
+ {
253
+ "description": "Scrollable pending-selection chip region.",
254
+ "name": "dialog-selected"
255
+ },
256
+ {
257
+ "description": "Dialog confirmation action group.",
258
+ "name": "dialog-actions"
259
+ },
260
+ {
261
+ "description": "Commits pending changes and closes the dialog.",
262
+ "name": "dialog-confirm"
263
+ },
264
+ {
265
+ "description": "Dialog option list.",
266
+ "name": "dialog-listbox"
174
267
  }
175
268
  ],
176
269
  "slots": [
@@ -183,11 +276,36 @@
183
276
  "name": "display"
184
277
  },
185
278
  {
186
- "description": "Optional. Replaces the default chevron indicator. Accepts any element(s); the container shifts to inline-start in RTL via flex direction.",
279
+ "description": "Optional. Replaces the default chevron indicator. Accepts any element(s); the container shifts to inline-start in RTL via flex direction. Built-in text (chip names, the dialog actions, the compact summary) follows the element's own `lang`, else `<html lang>`: per element through `messages`, or for every select through `registerMessages()` from `@rcarls/rc-common` under `rc-select`.",
187
280
  "name": "toggle-indicator"
188
281
  }
189
282
  ],
190
283
  "members": [
284
+ {
285
+ "kind": "field",
286
+ "name": "messages",
287
+ "type": {
288
+ "text": "Partial<RCSelectMessages> | undefined"
289
+ },
290
+ "description": "Built-in text overrides; unset keys fall back to registered text, then English."
291
+ },
292
+ {
293
+ "kind": "field",
294
+ "name": "_messages",
295
+ "privacy": "private",
296
+ "readonly": true,
297
+ "default": "new MessagesController(this, 'rc-select', DEFAULT_SELECT_MESSAGES, { overrides: () => this.messages, })"
298
+ },
299
+ {
300
+ "kind": "field",
301
+ "name": "_text",
302
+ "type": {
303
+ "text": "RCSelectMessages"
304
+ },
305
+ "privacy": "protected",
306
+ "description": "The resolved built-in text. Subclasses with more text resolve their own scope.",
307
+ "readonly": true
308
+ },
191
309
  {
192
310
  "kind": "field",
193
311
  "name": "open",
@@ -221,6 +339,17 @@
221
339
  "attribute": "disabled",
222
340
  "reflects": true
223
341
  },
342
+ {
343
+ "kind": "field",
344
+ "name": "required",
345
+ "type": {
346
+ "text": "boolean"
347
+ },
348
+ "default": "false",
349
+ "description": "Mirrors the slotted native `<select>`'s own `required`, for `aria-required` on the trigger.\nRead-only in practice: set `required` on the slotted `<select>` itself, the source of truth\nfor form participation and constraint validation.",
350
+ "attribute": "required",
351
+ "reflects": true
352
+ },
224
353
  {
225
354
  "kind": "field",
226
355
  "name": "placeholder",
@@ -241,6 +370,28 @@
241
370
  "description": "Controls how selected values appear in the trigger.\n\n- `'chips'` — each selected value renders as a removable chip.\n- `'compact'` — selected values are summarized as \"First, +N more\".\n- `'auto'` — uses `'chips'` on pointer devices and `'compact'` on touch.",
242
371
  "attribute": "display"
243
372
  },
373
+ {
374
+ "kind": "field",
375
+ "name": "popupMode",
376
+ "type": {
377
+ "text": "RCSelectPopupMode"
378
+ },
379
+ "default": "'popover'",
380
+ "description": "Presents options in an anchored popover or transactional modal dialog.",
381
+ "attribute": "popup-mode",
382
+ "reflects": true
383
+ },
384
+ {
385
+ "kind": "field",
386
+ "name": "dialogCancelButton",
387
+ "type": {
388
+ "text": "'visible' | 'hidden'"
389
+ },
390
+ "default": "'visible'",
391
+ "description": "Whether the leading dialog cancel action is visible.",
392
+ "attribute": "dialog-cancel-button",
393
+ "reflects": true
394
+ },
244
395
  {
245
396
  "kind": "field",
246
397
  "name": "_$anchor",
@@ -268,6 +419,14 @@
268
419
  "privacy": "protected",
269
420
  "description": "The `<rc-listbox>` popup. Receives option lists and selected-value updates from the host."
270
421
  },
422
+ {
423
+ "kind": "field",
424
+ "name": "_$dialogHost",
425
+ "type": {
426
+ "text": "RCDialog | undefined"
427
+ },
428
+ "privacy": "protected"
429
+ },
271
430
  {
272
431
  "kind": "field",
273
432
  "name": "_selectedValues",
@@ -278,6 +437,34 @@
278
437
  "default": "new Set()",
279
438
  "description": "Reactive set of currently selected option values.\n\nDrive changes through `_applySelection` rather than mutating this directly\nso the listbox and native `<select>` stay in sync."
280
439
  },
440
+ {
441
+ "kind": "field",
442
+ "name": "_pendingSelectedValues",
443
+ "type": {
444
+ "text": "Set<string> | null"
445
+ },
446
+ "privacy": "protected",
447
+ "default": "null",
448
+ "description": "Transaction-local selection while a dialog popup is open."
449
+ },
450
+ {
451
+ "kind": "field",
452
+ "name": "_accessibleName",
453
+ "type": {
454
+ "text": "string"
455
+ },
456
+ "privacy": "protected",
457
+ "default": "''"
458
+ },
459
+ {
460
+ "kind": "field",
461
+ "name": "_activePopupMode",
462
+ "type": {
463
+ "text": "RCSelectPopupMode"
464
+ },
465
+ "privacy": "protected",
466
+ "default": "'popover'"
467
+ },
281
468
  {
282
469
  "kind": "field",
283
470
  "name": "_chipNavIndex",
@@ -412,16 +599,61 @@
412
599
  "kind": "field",
413
600
  "name": "_activeDescendantCtrl",
414
601
  "privacy": "protected",
415
- "default": "new ActiveDescendantController(this, { host: () => this._$trigger ?? null, items: () => this._$listbox?.navigableItems ?? [], })",
602
+ "default": "new ActiveDescendantController(this, { host: () => this._$activeDescendantHost, items: () => this._$listbox?.navigableItems ?? [], })",
416
603
  "description": "Manages `aria-activedescendant` on `_$trigger` and keyboard cursor position\nwithin `_$listbox.navigableItems`."
417
604
  },
418
605
  {
419
606
  "kind": "field",
420
607
  "name": "_anchorCtrl",
421
608
  "privacy": "protected",
422
- "default": "new AnchorController(this, { anchor: () => this._$anchor ?? null, floating: () => this._$listbox ?? null, shadowHost: () => this, placement: 'bottom-start', offset: 2, })",
609
+ "default": "new AnchorController(this, { anchor: () => this._$anchor ?? null, floating: () => this._$listbox ?? null, shadowHost: () => this, placement: 'block-end-start', offset: 2, disabled: () => !this.open || this._activePopupMode === 'dialog', })",
423
610
  "description": "Manages CSS-anchored (or JS-fallback) placement of `_$listbox` relative to `_$anchor`."
424
611
  },
612
+ {
613
+ "kind": "field",
614
+ "name": "_popoverCtrl",
615
+ "privacy": "protected",
616
+ "default": "new PopoverController(this, { element: () => this._$listbox ?? null })"
617
+ },
618
+ {
619
+ "kind": "field",
620
+ "name": "_$activeDescendantHost",
621
+ "type": {
622
+ "text": "HTMLElement | null"
623
+ },
624
+ "privacy": "protected",
625
+ "description": "Element that owns `aria-activedescendant` for the currently rendered popup.",
626
+ "readonly": true
627
+ },
628
+ {
629
+ "kind": "method",
630
+ "name": "focus",
631
+ "return": {
632
+ "type": {
633
+ "text": "void"
634
+ }
635
+ },
636
+ "parameters": [
637
+ {
638
+ "name": "options",
639
+ "optional": true,
640
+ "type": {
641
+ "text": "FocusOptions"
642
+ }
643
+ }
644
+ ],
645
+ "description": "Forwards focus to the trigger. The host itself is never in the tab order, so without this\noverride, calling `.focus()` on `<rc-select>` (as `rc-field` does when treating it as a\ncontrol provider) would be a no-op."
646
+ },
647
+ {
648
+ "kind": "method",
649
+ "name": "blur",
650
+ "return": {
651
+ "type": {
652
+ "text": "void"
653
+ }
654
+ },
655
+ "description": "Forwards blur to the trigger; see `focus()`."
656
+ },
425
657
  {
426
658
  "kind": "method",
427
659
  "name": "openPopup",
@@ -434,7 +666,7 @@
434
666
  {
435
667
  "name": "returnFocus",
436
668
  "default": "true",
437
- "description": "When `true` (default), returns focus to the trigger."
669
+ "description": "when `true` (default), returns focus to the trigger"
438
670
  }
439
671
  ],
440
672
  "description": "Closes the popup listbox."
@@ -497,6 +729,11 @@
497
729
  "type": {
498
730
  "text": "string[]"
499
731
  }
732
+ },
733
+ {
734
+ "name": "fromUser",
735
+ "default": "false",
736
+ "description": "pass `true` only for a selection driven by real user interaction, so\n`_syncNativeSelect` dispatches native `input`/`change` on the underlying `<select>` (a\nprogrammatic `value`/`defaultValue` write is not a native interaction and relies on an\nexternal `sync()` call instead, the same as `rc-textarea`'s controlled-value contract)"
500
737
  }
501
738
  ],
502
739
  "description": "Applies an already-normalized array of values as the current selection.\n\nIn single-select mode only the first value is kept. Syncs `_$listbox` and the\nnative `<select>` but does NOT dispatch `rc-select-change`."
@@ -784,7 +1021,14 @@
784
1021
  "kind": "method",
785
1022
  "name": "_syncNativeSelect",
786
1023
  "privacy": "protected",
787
- "description": "Flips `selected` on each `<option>` in the native `<select>` to match `_selectedValues`; no-op when no native select is present."
1024
+ "parameters": [
1025
+ {
1026
+ "name": "fromUser",
1027
+ "default": "false",
1028
+ "description": "when `true`, also dispatches native `input` and `change` on `$select`\n(in that order, matching a real `<select>`) so outside listeners, including an\n`rc-field` ancestor treating this component as its control provider, observe the change"
1029
+ }
1030
+ ],
1031
+ "description": "Flips `selected` on each `<option>` in the native `<select>` to match `_selectedValues`;\nno-op when no native select is present."
788
1032
  },
789
1033
  {
790
1034
  "kind": "method",
@@ -932,10 +1176,160 @@
932
1176
  "privacy": "protected",
933
1177
  "description": "Toggles the popup open or closed on trigger click."
934
1178
  },
1179
+ {
1180
+ "kind": "field",
1181
+ "name": "_dialogSelectedValues",
1182
+ "type": {
1183
+ "text": "string[]"
1184
+ },
1185
+ "privacy": "protected",
1186
+ "readonly": true
1187
+ },
1188
+ {
1189
+ "kind": "method",
1190
+ "name": "_focusDialogContent",
1191
+ "privacy": "protected",
1192
+ "return": {
1193
+ "type": {
1194
+ "text": "void"
1195
+ }
1196
+ }
1197
+ },
1198
+ {
1199
+ "kind": "method",
1200
+ "name": "_prepareDialogCommit",
1201
+ "privacy": "protected",
1202
+ "return": {
1203
+ "type": {
1204
+ "text": "void"
1205
+ }
1206
+ },
1207
+ "description": "Hook for subclasses to finalize provisional options before dialog selection commits."
1208
+ },
1209
+ {
1210
+ "kind": "method",
1211
+ "name": "_commitDialogSelection",
1212
+ "privacy": "protected",
1213
+ "return": {
1214
+ "type": {
1215
+ "text": "void"
1216
+ }
1217
+ }
1218
+ },
1219
+ {
1220
+ "kind": "method",
1221
+ "name": "_discardDialogSelection",
1222
+ "privacy": "protected",
1223
+ "return": {
1224
+ "type": {
1225
+ "text": "void"
1226
+ }
1227
+ }
1228
+ },
1229
+ {
1230
+ "kind": "method",
1231
+ "name": "_finishDialogClose",
1232
+ "privacy": "protected",
1233
+ "return": {
1234
+ "type": {
1235
+ "text": "void"
1236
+ }
1237
+ },
1238
+ "parameters": [
1239
+ {
1240
+ "name": "returnFocus",
1241
+ "type": {
1242
+ "text": "boolean"
1243
+ }
1244
+ }
1245
+ ]
1246
+ },
1247
+ {
1248
+ "kind": "method",
1249
+ "name": "_handleDialogClose",
1250
+ "privacy": "protected",
1251
+ "return": {
1252
+ "type": {
1253
+ "text": "void"
1254
+ }
1255
+ },
1256
+ "parameters": [
1257
+ {
1258
+ "name": "e",
1259
+ "type": {
1260
+ "text": "CustomEvent<RCDialogCloseEvent>"
1261
+ }
1262
+ }
1263
+ ]
1264
+ },
1265
+ {
1266
+ "kind": "method",
1267
+ "name": "_stopDialogEvent",
1268
+ "privacy": "protected",
1269
+ "return": {
1270
+ "type": {
1271
+ "text": "void"
1272
+ }
1273
+ },
1274
+ "parameters": [
1275
+ {
1276
+ "name": "e",
1277
+ "type": {
1278
+ "text": "Event"
1279
+ }
1280
+ }
1281
+ ]
1282
+ },
1283
+ {
1284
+ "kind": "method",
1285
+ "name": "_removePendingValue",
1286
+ "privacy": "protected",
1287
+ "return": {
1288
+ "type": {
1289
+ "text": "void"
1290
+ }
1291
+ },
1292
+ "parameters": [
1293
+ {
1294
+ "name": "value",
1295
+ "type": {
1296
+ "text": "string"
1297
+ }
1298
+ }
1299
+ ]
1300
+ },
1301
+ {
1302
+ "kind": "method",
1303
+ "name": "_renderDialogBody",
1304
+ "privacy": "protected"
1305
+ },
1306
+ {
1307
+ "kind": "method",
1308
+ "name": "_renderDialogPopup",
1309
+ "privacy": "protected"
1310
+ },
1311
+ {
1312
+ "kind": "method",
1313
+ "name": "_renderAnchor",
1314
+ "privacy": "protected"
1315
+ },
935
1316
  {
936
1317
  "kind": "method",
937
1318
  "name": "_renderChips",
938
1319
  "privacy": "protected",
1320
+ "parameters": [
1321
+ {
1322
+ "name": "values",
1323
+ "default": "this._selectedValues",
1324
+ "type": {
1325
+ "text": "Iterable<string>"
1326
+ }
1327
+ },
1328
+ {
1329
+ "name": "pending",
1330
+ "default": "false"
1331
+ }
1332
+ ],
939
1333
  "description": "Renders selected values as removable input chips inside the shared chip-group layout."
940
1334
  }
941
1335
  ],
@@ -990,6 +1384,15 @@
990
1384
  "default": "false",
991
1385
  "fieldName": "disabled"
992
1386
  },
1387
+ {
1388
+ "description": "Mirrors the slotted native `<select>`'s own `required`, for `aria-required` on the trigger.\nRead-only in practice: set `required` on the slotted `<select>` itself, the source of truth\nfor form participation and constraint validation.",
1389
+ "name": "required",
1390
+ "type": {
1391
+ "text": "boolean"
1392
+ },
1393
+ "default": "false",
1394
+ "fieldName": "required"
1395
+ },
993
1396
  {
994
1397
  "description": "Text shown in the trigger when no value is selected.",
995
1398
  "name": "placeholder",
@@ -1008,6 +1411,24 @@
1008
1411
  "default": "'auto'",
1009
1412
  "fieldName": "display"
1010
1413
  },
1414
+ {
1415
+ "description": "Presents options in an anchored popover or transactional modal dialog.",
1416
+ "name": "popup-mode",
1417
+ "type": {
1418
+ "text": "RCSelectPopupMode"
1419
+ },
1420
+ "default": "'popover'",
1421
+ "fieldName": "popupMode"
1422
+ },
1423
+ {
1424
+ "description": "Whether the leading dialog cancel action is visible.",
1425
+ "name": "dialog-cancel-button",
1426
+ "type": {
1427
+ "text": "'visible' | 'hidden'"
1428
+ },
1429
+ "default": "'visible'",
1430
+ "fieldName": "dialogCancelButton"
1431
+ },
1011
1432
  {
1012
1433
  "description": "Present when one or more options are selected. Use with CSS selectors (e.g. `rc-select[has-value]`) for floating-label wrappers.",
1013
1434
  "name": "has-value"
@@ -1022,6 +1443,14 @@
1022
1443
  }
1023
1444
  ],
1024
1445
  "exports": [
1446
+ {
1447
+ "kind": "js",
1448
+ "name": "DEFAULT_SELECT_MESSAGES",
1449
+ "declaration": {
1450
+ "name": "DEFAULT_SELECT_MESSAGES",
1451
+ "module": "src/rc-select.ts"
1452
+ }
1453
+ },
1025
1454
  {
1026
1455
  "kind": "js",
1027
1456
  "name": "RCSelect",